fix: allow custom skill config bag
Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>
This commit is contained in:
@@ -72,6 +72,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- TUI: show generic empty-state text for searchable pickers. (#1201) — thanks @vignesh07.
|
- TUI: show generic empty-state text for searchable pickers. (#1201) — thanks @vignesh07.
|
||||||
- Doctor: canonicalize legacy session keys in session stores to prevent stale metadata. (#1169)
|
- Doctor: canonicalize legacy session keys in session stores to prevent stale metadata. (#1169)
|
||||||
- CLI: centralize CLI command registration to keep fast-path routing and program wiring in sync. (#1207) — thanks @gumadeiras.
|
- CLI: centralize CLI command registration to keep fast-path routing and program wiring in sync. (#1207) — thanks @gumadeiras.
|
||||||
|
- Config: allow custom fields under `skills.entries.<name>.config` for skill credentials/config. (#1226) — thanks @VACInc. (fixes #1225)
|
||||||
|
|
||||||
## 2026.1.18-5
|
## 2026.1.18-5
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,10 @@ Bundled/managed skills can be toggled and supplied with env values:
|
|||||||
apiKey: "GEMINI_KEY_HERE",
|
apiKey: "GEMINI_KEY_HERE",
|
||||||
env: {
|
env: {
|
||||||
GEMINI_API_KEY: "GEMINI_KEY_HERE"
|
GEMINI_API_KEY: "GEMINI_KEY_HERE"
|
||||||
|
},
|
||||||
|
config: {
|
||||||
|
endpoint: "https://example.invalid",
|
||||||
|
model: "nano-pro"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
peekaboo: { enabled: true },
|
peekaboo: { enabled: true },
|
||||||
@@ -173,6 +177,7 @@ Rules:
|
|||||||
- `enabled: false` disables the skill even if it’s bundled/installed.
|
- `enabled: false` disables the skill even if it’s bundled/installed.
|
||||||
- `env`: injected **only if** the variable isn’t already set in the process.
|
- `env`: injected **only if** the variable isn’t already set in the process.
|
||||||
- `apiKey`: convenience for skills that declare `metadata.clawdbot.primaryEnv`.
|
- `apiKey`: convenience for skills that declare `metadata.clawdbot.primaryEnv`.
|
||||||
|
- `config`: optional bag for custom per-skill fields; custom keys must live here.
|
||||||
- `allowBundled`: optional allowlist for **bundled** skills only. If set, only
|
- `allowBundled`: optional allowlist for **bundled** skills only. If set, only
|
||||||
bundled skills in the list are eligible (managed/workspace skills unaffected).
|
bundled skills in the list are eligible (managed/workspace skills unaffected).
|
||||||
|
|
||||||
|
|||||||
46
src/config/config.skills-entries-config.test.ts
Normal file
46
src/config/config.skills-entries-config.test.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import { ClawdbotSchema } from "./zod-schema.js";
|
||||||
|
|
||||||
|
describe("skills entries config schema", () => {
|
||||||
|
it("accepts custom fields under config", () => {
|
||||||
|
const res = ClawdbotSchema.safeParse({
|
||||||
|
skills: {
|
||||||
|
entries: {
|
||||||
|
"custom-skill": {
|
||||||
|
enabled: true,
|
||||||
|
config: {
|
||||||
|
url: "https://example.invalid",
|
||||||
|
token: "abc123",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(res.success).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects unknown top-level fields", () => {
|
||||||
|
const res = ClawdbotSchema.safeParse({
|
||||||
|
skills: {
|
||||||
|
entries: {
|
||||||
|
"custom-skill": {
|
||||||
|
url: "https://example.invalid",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(res.success).toBe(false);
|
||||||
|
if (res.success) return;
|
||||||
|
|
||||||
|
expect(
|
||||||
|
res.error.issues.some(
|
||||||
|
(issue) =>
|
||||||
|
issue.path.join(".") === "skills.entries.custom-skill" &&
|
||||||
|
issue.message.toLowerCase().includes("unrecognized"),
|
||||||
|
),
|
||||||
|
).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -2,7 +2,7 @@ export type SkillConfig = {
|
|||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
env?: Record<string, string>;
|
env?: Record<string, string>;
|
||||||
[key: string]: unknown;
|
config?: Record<string, unknown>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SkillsLoadConfig = {
|
export type SkillsLoadConfig = {
|
||||||
|
|||||||
@@ -380,6 +380,7 @@ export const ClawdbotSchema = z
|
|||||||
enabled: z.boolean().optional(),
|
enabled: z.boolean().optional(),
|
||||||
apiKey: z.string().optional(),
|
apiKey: z.string().optional(),
|
||||||
env: z.record(z.string(), z.string()).optional(),
|
env: z.record(z.string(), z.string()).optional(),
|
||||||
|
config: z.record(z.string(), z.unknown()).optional(),
|
||||||
})
|
})
|
||||||
.strict(),
|
.strict(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user