openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
30 lines (29 loc) • 1.27 kB
JavaScript
import { o as formatExecSecretRefIdValidationMessage, u as isValidExecSecretRefId } from "./ref-contract-b8L-9DrQ.mjs";
//#region src/secrets/exec-resolution-policy.ts
/**
* Splits refs by whether the current audit/apply mode is allowed to execute secret providers.
*/
function selectRefsForExecPolicy(e) {
const t = [];
const n = [];
for (const r of e.refs) (r.source === "exec" && !e.allowExec ? n : t).push(r);
return {
refsToResolve: t,
skippedExecRefs: n
};
}
/**
* Returns static validation errors for skipped exec refs without resolving the provider command.
*/
function getSkippedExecRefStaticError(e) {
const t = e.ref.id.trim();
const n = `${e.ref.source}:${e.ref.provider}:${t}`;
if (!t) return "Error: Secret reference id is empty.";
if (!isValidExecSecretRefId(t)) return `Error: ${formatExecSecretRefIdValidationMessage()} (ref: ${n}).`;
const r = e.config.secrets?.providers?.[e.ref.provider];
if (!r) return `Error: Secret provider "${e.ref.provider}" is not configured (ref: ${n}).`;
if (r.source !== e.ref.source) return `Error: Secret provider "${e.ref.provider}" has source "${r.source}" but ref requests "${e.ref.source}".`;
return null;
}
//#endregion
export { selectRefsForExecPolicy as n, getSkippedExecRefStaticError as t };