oh-my-opencode/src/shared/agent-tool-restrictions.ts
justsisyphus 444fbe396a fix(delegate-task): use lowercase sisyphus-junior agent name in API calls
Previous fix (7ed7bf5c) only updated Atlas → atlas, but missed Sisyphus-Junior.
OpenCode does case-sensitive agent lookup, causing crash when delegate_task
tried to spawn 'Sisyphus-Junior' (registered as 'sisyphus-junior').

- SISYPHUS_JUNIOR_AGENT constant: 'Sisyphus-Junior' → 'sisyphus-junior'
- agent-tool-restrictions key: 'Sisyphus-Junior' → 'sisyphus-junior'
- Updated related test mocks
2026-01-24 03:00:58 +09:00

47 lines
1.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 { findCaseInsensitive } from "./case-insensitive"
const EXPLORATION_AGENT_DENYLIST: Record<string, boolean> = {
write: false,
edit: false,
task: false,
delegate_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,
delegate_task: false,
},
"multimodal-looker": {
read: true,
},
"sisyphus-junior": {
task: false,
delegate_task: false,
},
}
export function getAgentToolRestrictions(agentName: string): Record<string, boolean> {
return findCaseInsensitive(AGENT_RESTRICTIONS, agentName) ?? {}
}
export function hasAgentToolRestrictions(agentName: string): boolean {
const restrictions = findCaseInsensitive(AGENT_RESTRICTIONS, agentName)
return restrictions !== undefined && Object.keys(restrictions).length > 0
}