Files
openclaw-zero-token/plugin-sdk/secret-input-schema.ts
sjhu 571e14a236 feat: upgrade to upstream v2026.3.28
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
2026-03-30 17:58:12 +08:00

56 lines
1.7 KiB
TypeScript

import { z } from "zod";
import { ENV_SECRET_REF_ID_RE } from "../config/types.secrets.js";
import { sensitive } from "../config/zod-schema.sensitive.js";
import {
formatExecSecretRefIdValidationMessage,
isValidExecSecretRefId,
isValidFileSecretRefId,
SECRET_PROVIDER_ALIAS_PATTERN,
} from "../secrets/ref-contract.js";
export function buildSecretInputSchema() {
return secretInputSchema;
}
const providerSchema = z
.string()
.regex(
SECRET_PROVIDER_ALIAS_PATTERN,
'Secret reference provider must match /^[a-z][a-z0-9_-]{0,63}$/ (example: "default").',
);
// Singleton registered with the sensitive registry so that mapSensitivePaths
// marks every config field using this schema as sensitive (redacted).
const secretInputSchema = z
.union([
z.string(),
z.discriminatedUnion("source", [
z.object({
source: z.literal("env"),
provider: providerSchema,
id: z
.string()
.regex(
ENV_SECRET_REF_ID_RE,
'Env secret reference id must match /^[A-Z][A-Z0-9_]{0,127}$/ (example: "OPENAI_API_KEY").',
),
}),
z.object({
source: z.literal("file"),
provider: providerSchema,
id: z
.string()
.refine(
isValidFileSecretRefId,
'File secret reference id must be an absolute JSON pointer (example: "/providers/openai/apiKey"), or "value" for singleValue mode.',
),
}),
z.object({
source: z.literal("exec"),
provider: providerSchema,
id: z.string().refine(isValidExecSecretRefId, formatExecSecretRefIdValidationMessage()),
}),
]),
])
.register(sensitive);