fix(tool-config): use permission-only approach for council tool visibility
Remove dead agent.tools fields that only work during Zod parsing (before plugin config hook runs). Council tool restriction now uses config.permission deny globally + per-agent permission allow for athena/athena-junior, which is the correct mechanism per OpenCode's LLM.resolveTools() → PermissionNext.disabled() filtering path.
This commit is contained in:
@@ -352,19 +352,15 @@ describe("applyToolConfig", () => {
|
|||||||
describe("#given council tools are globally hidden", () => {
|
describe("#given council tools are globally hidden", () => {
|
||||||
describe("#when applying tool config for Athena agents", () => {
|
describe("#when applying tool config for Athena agents", () => {
|
||||||
it.each(["athena", "athena-junior"])(
|
it.each(["athena", "athena-junior"])(
|
||||||
"#then should expose council tools via agent tools for %s",
|
"#then should allow council tools permission for %s",
|
||||||
(agentName) => {
|
(agentName) => {
|
||||||
const params = createParams({ agents: [agentName] })
|
const params = createParams({ agents: [agentName] })
|
||||||
|
|
||||||
applyToolConfig(params)
|
applyToolConfig(params)
|
||||||
|
|
||||||
const agent = params.agentResult[agentName] as {
|
const agent = params.agentResult[agentName] as {
|
||||||
tools?: Record<string, unknown>
|
|
||||||
permission: Record<string, unknown>
|
permission: Record<string, unknown>
|
||||||
}
|
}
|
||||||
expect(agent.tools?.prepare_council_prompt).toBe(true)
|
|
||||||
expect(agent.tools?.council_finalize).toBe(true)
|
|
||||||
expect(agent.tools?.athena_council).toBe(true)
|
|
||||||
expect(agent.permission.prepare_council_prompt).toBe("allow")
|
expect(agent.permission.prepare_council_prompt).toBe("allow")
|
||||||
expect(agent.permission.council_finalize).toBe("allow")
|
expect(agent.permission.council_finalize).toBe("allow")
|
||||||
expect(agent.permission.athena_council).toBe("allow")
|
expect(agent.permission.athena_council).toBe("allow")
|
||||||
@@ -374,20 +370,20 @@ describe("applyToolConfig", () => {
|
|||||||
|
|
||||||
describe("#when applying tool config for non-Athena agents", () => {
|
describe("#when applying tool config for non-Athena agents", () => {
|
||||||
it.each(["atlas", "sisyphus", "prometheus", "hephaestus", "sisyphus-junior"])(
|
it.each(["atlas", "sisyphus", "prometheus", "hephaestus", "sisyphus-junior"])(
|
||||||
"#then should keep council tools hidden for %s",
|
"#then should deny council tools permission for %s",
|
||||||
(agentName) => {
|
(agentName) => {
|
||||||
const params = createParams({ agents: [agentName] })
|
const params = createParams({ agents: [agentName] })
|
||||||
|
|
||||||
applyToolConfig(params)
|
applyToolConfig(params)
|
||||||
|
|
||||||
const tools = params.config.tools as Record<string, unknown>
|
const permission = params.config.permission as Record<string, unknown>
|
||||||
const agent = params.agentResult[agentName] as {
|
const agent = params.agentResult[agentName] as {
|
||||||
tools?: Record<string, unknown>
|
tools?: Record<string, unknown>
|
||||||
permission: Record<string, unknown>
|
permission: Record<string, unknown>
|
||||||
}
|
}
|
||||||
expect(tools.prepare_council_prompt).toBe(false)
|
expect(permission.prepare_council_prompt).toBe("deny")
|
||||||
expect(tools.council_finalize).toBe(false)
|
expect(permission.council_finalize).toBe("deny")
|
||||||
expect(tools.athena_council).toBe(false)
|
expect(permission.athena_council).toBe("deny")
|
||||||
expect(agent.tools?.prepare_council_prompt).toBeUndefined()
|
expect(agent.tools?.prepare_council_prompt).toBeUndefined()
|
||||||
expect(agent.tools?.council_finalize).toBeUndefined()
|
expect(agent.tools?.council_finalize).toBeUndefined()
|
||||||
expect(agent.tools?.athena_council).toBeUndefined()
|
expect(agent.tools?.athena_council).toBeUndefined()
|
||||||
|
|||||||
Reference in New Issue
Block a user