mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-02 07:25:00 +01:00
feat: top level tool config (#2008)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user