Athena saves the analysis prompt to a temp file once, then launches each council member with a short "Read <path> for your instructions" prompt. This eliminates repeated prompt text across N task calls while preserving individual clickable task panes in the TUI.
85 lines
2.1 KiB
TypeScript
85 lines
2.1 KiB
TypeScript
/**
|
|
* Agent tool restrictions for session.prompt calls.
|
|
* OpenCode SDK's session.prompt `tools` parameter expects boolean values.
|
|
* true = tool allowed, false = tool denied.
|
|
*/
|
|
|
|
import { COUNCIL_MEMBER_KEY_PREFIX } from "../agents/builtin-agents/council-member-agents"
|
|
|
|
const EXPLORATION_AGENT_DENYLIST: Record<string, boolean> = {
|
|
write: false,
|
|
edit: false,
|
|
task: false,
|
|
call_omo_agent: false,
|
|
}
|
|
|
|
const AGENT_RESTRICTIONS: Record<string, Record<string, boolean>> = {
|
|
explore: EXPLORATION_AGENT_DENYLIST,
|
|
|
|
librarian: EXPLORATION_AGENT_DENYLIST,
|
|
|
|
oracle: {
|
|
write: false,
|
|
edit: false,
|
|
task: false,
|
|
call_omo_agent: false,
|
|
},
|
|
|
|
metis: {
|
|
write: false,
|
|
edit: false,
|
|
task: false,
|
|
},
|
|
|
|
momus: {
|
|
write: false,
|
|
edit: false,
|
|
task: false,
|
|
},
|
|
|
|
"multimodal-looker": {
|
|
read: true,
|
|
},
|
|
|
|
"sisyphus-junior": {
|
|
task: false,
|
|
},
|
|
|
|
athena: {
|
|
write: false,
|
|
edit: false,
|
|
call_omo_agent: false,
|
|
},
|
|
|
|
// NOTE: Athena/council tool restrictions are also defined in:
|
|
// - src/agents/athena/agent.ts (AgentConfig permission format)
|
|
// - src/agents/athena/council-member-agent.ts (AgentConfig permission format)
|
|
// - src/plugin-handlers/tool-config-handler.ts (allow/deny string format)
|
|
// Keep all three in sync when modifying.
|
|
"council-member": {
|
|
write: false,
|
|
edit: false,
|
|
task: false,
|
|
call_omo_agent: false,
|
|
switch_agent: false,
|
|
background_wait: false,
|
|
prepare_council_prompt: false,
|
|
},
|
|
}
|
|
|
|
export function getAgentToolRestrictions(agentName: string): Record<string, boolean> {
|
|
if (agentName.startsWith(COUNCIL_MEMBER_KEY_PREFIX)) {
|
|
return AGENT_RESTRICTIONS["council-member"] ?? {}
|
|
}
|
|
|
|
return AGENT_RESTRICTIONS[agentName]
|
|
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
|
?? {}
|
|
}
|
|
|
|
export function hasAgentToolRestrictions(agentName: string): boolean {
|
|
const restrictions = AGENT_RESTRICTIONS[agentName]
|
|
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
|
return restrictions !== undefined && Object.keys(restrictions).length > 0
|
|
}
|