openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.59 kB
JavaScript
import{g as parseSecretRef}from"./types.secrets-UWdyCdE6.mjs";import{c as getAuthoredConfigSecretRef,p as resolveConfigSecretRef}from"./resolution-facts-DYKtoyes.mjs";import{h as isExpectedResolvedSecretValue}from"./runtime-shared-ByPlHLvN.mjs";import{n as getPath}from"./path-utils-Da5tqfDE.mjs";import{r as discoverConfigSecretTargetsByIds}from"./target-registry-query-UuUEzVi7.mjs";import"./target-registry-D_8Q9dwn.mjs";
//!src/secrets/command-config.ts
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}}export{analyzeCommandSecretAssignmentsFromSnapshot as t};