fix(coding-agent/tools): restricted IRC tool availability for main agent in sync mode
- Updated `irc` tool availability logic to require both `irc` settings and concurrency support. - Imported `MAIN_AGENT_ID` and suppressed IRC access for the main agent when async mode is disabled, preventing sync-mode peer messaging.
This commit is contained in:
@@ -11,7 +11,7 @@ import type { HindsightSessionState } from "../hindsight/state";
|
||||
import type { InternalUrlRouter } from "../internal-urls";
|
||||
import { LspTool } from "../lsp";
|
||||
import type { PlanModeState } from "../plan-mode/state";
|
||||
import type { AgentRegistry } from "../registry/agent-registry";
|
||||
import { type AgentRegistry, MAIN_AGENT_ID } from "../registry/agent-registry";
|
||||
import type { CustomMessage } from "../session/messages";
|
||||
import type { ToolChoiceQueue } from "../session/tool-choice-queue";
|
||||
import { TaskTool } from "../task";
|
||||
@@ -443,7 +443,13 @@ export async function createTools(session: ToolSession, toolNames?: string[]): P
|
||||
if (name === "calc") return session.settings.get("calc.enabled");
|
||||
if (name === "browser") return session.settings.get("browser.enabled");
|
||||
if (name === "checkpoint" || name === "rewind") return session.settings.get("checkpoint.enabled");
|
||||
if (name === "irc") return session.settings.get("irc.enabled");
|
||||
if (name === "irc") {
|
||||
if (!session.settings.get("irc.enabled")) return false;
|
||||
// Main agent only needs `irc` when subagents may run concurrently (async).
|
||||
// In sync mode main blocks on `task`, so peer messaging from main is dead weight.
|
||||
if (!session.settings.get("async.enabled") && session.getAgentId?.() === MAIN_AGENT_ID) return false;
|
||||
return true;
|
||||
}
|
||||
if (name === "recipe") return session.settings.get("recipe.enabled");
|
||||
if (name === "retain" || name === "recall" || name === "reflect") {
|
||||
return session.settings.get("memory.backend") === "hindsight";
|
||||
|
||||
Reference in New Issue
Block a user