Files
oh-my-opencode/src/plugin-handlers/tool-config-handler.ts
T
YeonGyu-Kim 83595df63f merge: integrate origin/dev into modular-enforcement branch
Resolves all merge conflicts, preserving our split module structure
while integrating all dev changes:
- Custom agent summaries support (parseRegisteredAgentSummaries)
- Background notification queue (enqueueNotificationForParent)
- Atlas shared git-worktree module (collectGitDiffStats, formatFileChanges)
- Ralph-loop withTimeout + DEFAULT_API_TIMEOUT=5000
- Session recovery assistant_prefill_unsupported error type
- Atlas agentOverrides forwarding
- Config handler plan model demotion (buildPlanDemoteConfig)
- Delegate-task agentOverrides, promptSyncWithModelSuggestionRetry, variant
- LSP init timeout + stale init detection
- isPlanFamily function + task-continuation-enforcer hook
- Handoff command
2026-02-08 17:34:47 +09:00

101 lines
2.9 KiB
TypeScript

import type { OhMyOpenCodeConfig } from "../config";
type AgentWithPermission = { permission?: Record<string, unknown> };
export function applyToolConfig(params: {
config: Record<string, unknown>;
pluginConfig: OhMyOpenCodeConfig;
agentResult: Record<string, unknown>;
}): void {
const denyTodoTools = params.pluginConfig.experimental?.task_system
? { todowrite: "deny", todoread: "deny" }
: {}
params.config.tools = {
...(params.config.tools as Record<string, unknown>),
"grep_app_*": false,
LspHover: false,
LspCodeActions: false,
LspCodeActionResolve: false,
"task_*": false,
teammate: false,
...(params.pluginConfig.experimental?.task_system
? { todowrite: false, todoread: false }
: {}),
};
const isCliRunMode = process.env.OPENCODE_CLI_RUN_MODE === "true";
const questionPermission = isCliRunMode ? "deny" : "allow";
if (params.agentResult.librarian) {
const agent = params.agentResult.librarian as AgentWithPermission;
agent.permission = { ...agent.permission, "grep_app_*": "allow" };
}
if (params.agentResult["multimodal-looker"]) {
const agent = params.agentResult["multimodal-looker"] as AgentWithPermission;
agent.permission = { ...agent.permission, task: "deny", look_at: "deny" };
}
if (params.agentResult["atlas"]) {
const agent = params.agentResult["atlas"] as AgentWithPermission;
agent.permission = {
...agent.permission,
task: "allow",
call_omo_agent: "deny",
"task_*": "allow",
teammate: "allow",
...denyTodoTools,
};
}
if (params.agentResult.sisyphus) {
const agent = params.agentResult.sisyphus as AgentWithPermission;
agent.permission = {
...agent.permission,
call_omo_agent: "deny",
task: "allow",
question: questionPermission,
"task_*": "allow",
teammate: "allow",
...denyTodoTools,
};
}
if (params.agentResult.hephaestus) {
const agent = params.agentResult.hephaestus as AgentWithPermission;
agent.permission = {
...agent.permission,
call_omo_agent: "deny",
task: "allow",
question: questionPermission,
...denyTodoTools,
};
}
if (params.agentResult["prometheus"]) {
const agent = params.agentResult["prometheus"] as AgentWithPermission;
agent.permission = {
...agent.permission,
call_omo_agent: "deny",
task: "allow",
question: questionPermission,
"task_*": "allow",
teammate: "allow",
...denyTodoTools,
};
}
if (params.agentResult["sisyphus-junior"]) {
const agent = params.agentResult["sisyphus-junior"] as AgentWithPermission;
agent.permission = {
...agent.permission,
task: "allow",
"task_*": "allow",
teammate: "allow",
...denyTodoTools,
};
}
params.config.permission = {
...(params.config.permission as Record<string, unknown>),
webfetch: "allow",
external_directory: "allow",
task: "deny",
};
}