fix
This commit is contained in:
parent
a7f920d83b
commit
91e710a9eb
1 changed files with 1 additions and 24 deletions
|
|
@ -1,9 +1,6 @@
|
||||||
import { EOL } from "os"
|
import { EOL } from "os"
|
||||||
import { basename } from "path"
|
import { basename } from "path"
|
||||||
import { Agent } from "../../../agent/agent"
|
import { Agent } from "../../../agent/agent"
|
||||||
import { Provider } from "../../../provider/provider"
|
|
||||||
import { ToolRegistry } from "../../../tool/registry"
|
|
||||||
import { Wildcard } from "../../../util/wildcard"
|
|
||||||
import { bootstrap } from "../../bootstrap"
|
import { bootstrap } from "../../bootstrap"
|
||||||
import { cmd } from "../cmd"
|
import { cmd } from "../cmd"
|
||||||
|
|
||||||
|
|
@ -25,27 +22,7 @@ export const AgentCommand = cmd({
|
||||||
)
|
)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
const resolvedTools = await resolveTools(agent)
|
process.stdout.write(JSON.stringify(agent, null, 2) + EOL)
|
||||||
const output = {
|
|
||||||
...agent,
|
|
||||||
tools: resolvedTools,
|
|
||||||
toolOverrides: agent.tools,
|
|
||||||
}
|
|
||||||
process.stdout.write(JSON.stringify(output, null, 2) + EOL)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
async function resolveTools(agent: Agent.Info) {
|
|
||||||
const providerID = agent.model?.providerID ?? (await Provider.defaultModel()).providerID
|
|
||||||
const toolOverrides = {
|
|
||||||
...agent.tools,
|
|
||||||
...(await ToolRegistry.enabled(agent)),
|
|
||||||
}
|
|
||||||
const availableTools = await ToolRegistry.tools(providerID, agent)
|
|
||||||
const resolved: Record<string, boolean> = {}
|
|
||||||
for (const tool of availableTools) {
|
|
||||||
resolved[tool.id] = Wildcard.all(tool.id, toolOverrides) !== false
|
|
||||||
}
|
|
||||||
return resolved
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue