The open source coding agent.
TypeScript
feat: top level tool config (#2008)
Aiden Clinedaea79c0d444
diff --git a/packages/opencode/src/agent/agent.ts b/packages/opencode/src/agent/agent.tsindex 98884abafbd..fbfff7de2f1 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 = descriptionif (temperature != undefined) item.temperature = temperatureif (top_p != undefined) item.topP = top_pdiff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.tsindex 5f3edca7ebf..41f7215e782 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