UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

52 lines (51 loc) • 2 kB
import { g as parseSecretRef } from "./types.secrets-BmNLLnHp.mjs"; import { c as getAuthoredConfigSecretRef, p as resolveConfigSecretRef } from "./resolution-facts-xaIKuREs.mjs"; import { h as isExpectedResolvedSecretValue } from "./runtime-shared-BVJ4BbUu.mjs"; import { n as getPath } from "./path-utils-A4pcYa4R.mjs"; import { r as discoverConfigSecretTargetsByIds } from "./target-registry-query-le6rMGHo.mjs"; import "./target-registry-C0PdHjLu.mjs"; //#region src/secrets/command-config.ts /** Collects and analyzes command-scoped secret assignments from OpenClaw config. */ /** Analyzes command secret assignments without mutating the source config. */ function analyzeCommandSecretAssignmentsFromSnapshot(e) { const t = e.sourceConfig.secrets?.defaults; const n = []; const r = []; const i = []; const a = []; for (const o of discoverConfigSecretTargetsByIds(e.sourceConfig, e.targetIds)) { if (e.allowedPaths && !e.allowedPaths.has(o.path)) continue; const s = resolveConfigSecretRef({ config: e.sourceConfig, path: o.path, value: o.value, defaults: t }); const c = parseSecretRef(o.refValue, t); if (!(c ?? s)) continue; const l = getPath(e.resolvedConfig, o.pathSegments); if (getAuthoredConfigSecretRef(e.resolvedConfig, o.path) || !isExpectedResolvedSecretValue(l, o.entry.expectedResolvedValue)) { const t = e.inactiveRefPaths?.has(o.path); if (t) r.push(`${o.path}: secret ref is configured on an inactive surface; skipping command-time assignment.`); (t ? a : i).push({ path: o.path, pathSegments: [...o.pathSegments] }); continue; } n.push({ path: o.path, pathSegments: [...o.pathSegments], value: l }); if (o.entry.secretShape === "sibling_ref" && c && s) r.push(`${o.path}: both inline and sibling ref were present; sibling ref took precedence.`); } return { assignments: n, diagnostics: r, unresolved: i, inactive: a }; } //#endregion export { analyzeCommandSecretAssignmentsFromSnapshot as t };