feat: top level tool config (#2008)

This commit is contained in:
Aiden Cline
2025-08-16 21:51:56 -05:00
committed by GitHub
parent 9c7fa35051
commit daea79c0d4
2 changed files with 9 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ export namespace Agent {
const state = App.state("agent", async () => { const state = App.state("agent", async () => {
const cfg = await Config.get() const cfg = await Config.get()
const defaultTools = cfg.tools ?? {}
const defaultPermission: Info["permission"] = { const defaultPermission: Info["permission"] = {
edit: "allow", edit: "allow",
bash: { bash: {
@@ -55,6 +56,7 @@ export namespace Agent {
tools: { tools: {
todoread: false, todoread: false,
todowrite: false, todowrite: false,
...defaultTools,
}, },
options: {}, options: {},
permission: agentPermission, permission: agentPermission,
@@ -63,7 +65,7 @@ export namespace Agent {
}, },
build: { build: {
name: "build", name: "build",
tools: {}, tools: { ...defaultTools },
options: {}, options: {},
permission: agentPermission, permission: agentPermission,
mode: "primary", mode: "primary",
@@ -77,6 +79,7 @@ export namespace Agent {
write: false, write: false,
edit: false, edit: false,
patch: false, patch: false,
...defaultTools,
}, },
mode: "primary", mode: "primary",
builtIn: true, builtIn: true,
@@ -109,6 +112,10 @@ export namespace Agent {
...item.tools, ...item.tools,
...tools, ...tools,
} }
item.tools = {
...defaultTools,
...item.tools,
}
if (description) item.description = description if (description) item.description = description
if (temperature != undefined) item.temperature = temperature if (temperature != undefined) item.temperature = temperature
if (top_p != undefined) item.topP = top_p if (top_p != undefined) item.topP = top_p

View File

@@ -384,6 +384,7 @@ export namespace Config {
webfetch: Permission.optional(), webfetch: Permission.optional(),
}) })
.optional(), .optional(),
tools: z.record(z.string(), z.boolean()).optional(),
experimental: z experimental: z
.object({ .object({
hook: z hook: z