diff options
| author | Aiden Cline <[email protected]> | 2025-08-16 21:51:56 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-16 22:51:56 -0400 |
| commit | daea79c0d44438bf1884082381522723a9e7de7c (patch) | |
| tree | ae5490ddb375bc1944c227585dcfe6db4a87498e | |
| parent | 9c7fa35051eefa5400e7b84f0e9c978834cc3dda (diff) | |
| download | opencode-daea79c0d44438bf1884082381522723a9e7de7c.tar.gz opencode-daea79c0d44438bf1884082381522723a9e7de7c.zip | |
feat: top level tool config (#2008)
| -rw-r--r-- | packages/opencode/src/agent/agent.ts | 9 | ||||
| -rw-r--r-- | packages/opencode/src/config/config.ts | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/packages/opencode/src/agent/agent.ts b/packages/opencode/src/agent/agent.ts index 98884abaf..fbfff7de2 100644 --- a/packages/opencode/src/agent/agent.ts +++ b/packages/opencode/src/agent/agent.ts @@ -38,6 +38,7 @@ export namespace Agent { const state = App.state("agent", async () => { const cfg = await Config.get() + const defaultTools = cfg.tools ?? {} const defaultPermission: Info["permission"] = { edit: "allow", bash: { @@ -55,6 +56,7 @@ export namespace Agent { tools: { todoread: false, todowrite: false, + ...defaultTools, }, options: {}, permission: agentPermission, @@ -63,7 +65,7 @@ export namespace Agent { }, build: { name: "build", - tools: {}, + tools: { ...defaultTools }, options: {}, permission: agentPermission, mode: "primary", @@ -77,6 +79,7 @@ export namespace Agent { write: false, edit: false, patch: false, + ...defaultTools, }, mode: "primary", builtIn: true, @@ -109,6 +112,10 @@ export namespace Agent { ...item.tools, ...tools, } + item.tools = { + ...defaultTools, + ...item.tools, + } if (description) item.description = description if (temperature != undefined) item.temperature = temperature if (top_p != undefined) item.topP = top_p diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 5f3edca7e..41f7215e7 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -384,6 +384,7 @@ export namespace Config { webfetch: Permission.optional(), }) .optional(), + tools: z.record(z.string(), z.boolean()).optional(), experimental: z .object({ hook: z |
