feat(secrets): finalize mode rename and validated exec docs

This commit is contained in:
joshavant
2026-02-25 23:17:31 -06:00
committed by Peter Steinberger
parent ba2eb583c0
commit 06290b49b2
20 changed files with 1109 additions and 128 deletions

View File

@@ -232,7 +232,7 @@ describe("ensureApiKeyFromEnvOrPrompt", () => {
filemain: {
source: "file",
path: "/tmp/does-not-exist-secrets.json",
mode: "jsonPointer",
mode: "json",
},
},
},

View File

@@ -176,11 +176,11 @@ async function resolveApiKeyRefForOnboarding(params: {
}
const idPrompt =
providerEntry.source === "file"
? "Secret id (JSON pointer for jsonPointer mode, or 'value' for raw mode)"
? "Secret id (JSON pointer for json mode, or 'value' for singleValue mode)"
: "Secret id for the exec provider";
const idDefault =
providerEntry.source === "file"
? providerEntry.mode === "raw"
? providerEntry.mode === "singleValue"
? "value"
: defaultFilePointer
: `${params.provider}/apiKey`;
@@ -195,17 +195,17 @@ async function resolveApiKeyRefForOnboarding(params: {
}
if (
providerEntry.source === "file" &&
providerEntry.mode !== "raw" &&
providerEntry.mode !== "singleValue" &&
!isValidFileSecretRefId(candidate)
) {
return 'Use an absolute JSON pointer like "/providers/openai/apiKey".';
}
if (
providerEntry.source === "file" &&
providerEntry.mode === "raw" &&
providerEntry.mode === "singleValue" &&
candidate !== "value"
) {
return 'Raw file mode expects id "value".';
return 'singleValue mode expects id "value".';
}
return undefined;
},

View File

@@ -775,7 +775,7 @@ describe("applyAuthChoice", () => {
filemain: {
source: "file",
path: "/tmp/openclaw-missing-secrets.json",
mode: "jsonPointer",
mode: "json",
},
},
},

View File

@@ -268,7 +268,7 @@ describe("promptCustomApiConfig", () => {
filemain: {
source: "file",
path: "/tmp/openclaw-missing-provider.json",
mode: "jsonPointer",
mode: "json",
},
},
},