mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-10-28 21:12:01 +00:00
fix: report EnterPlanMode tool calls with the switch_mode kind (#1467)
Stacked on #1457 (SDK 2.1.0). EnterPlanMode tool calls now use `kind: "switch_mode"`, like ExitPlanMode (agentclientprotocol/agent-client-protocol#2543). The title is unchanged.
This commit is contained in:
@@ -2448,6 +2448,18 @@ describe("toolInfoFromToolUse - ExitPlanMode", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("toolInfoFromToolUse - EnterPlanMode", () => {
|
||||
it("reports a mode switch", () => {
|
||||
const info = toolInfoFromToolUse(
|
||||
{ name: "EnterPlanMode", id: "toolu_enter", input: {} },
|
||||
false,
|
||||
);
|
||||
|
||||
expect(info.kind).toBe("switch_mode");
|
||||
expect(info.title).toBe("EnterPlanMode");
|
||||
});
|
||||
});
|
||||
|
||||
describe("toolInfoFromToolUse - Write input aliases", () => {
|
||||
it.each([
|
||||
["path + file_text", { path: "/repo/a.ts", file_text: "x" }],
|
||||
|
||||
@@ -5,6 +5,7 @@ import { EditReporter, NotebookEditReporter, WriteReporter } from "./file-edit.j
|
||||
import {
|
||||
AgentControlReporter,
|
||||
AskUserQuestionReporter,
|
||||
EnterPlanModeReporter,
|
||||
ExitPlanModeReporter,
|
||||
GenericReporter,
|
||||
PlanToolReporter,
|
||||
@@ -35,6 +36,7 @@ const reporters: Record<string, ToolReporter> = {
|
||||
TaskList: new PlanToolReporter("TaskList"),
|
||||
TaskGet: new PlanToolReporter("TaskGet"),
|
||||
ReportFindings: new ReportFindingsReporter(),
|
||||
EnterPlanMode: new EnterPlanModeReporter(),
|
||||
ExitPlanMode: new ExitPlanModeReporter(),
|
||||
AskUserQuestion: new AskUserQuestionReporter(),
|
||||
Skill: new SkillReporter(),
|
||||
|
||||
@@ -72,6 +72,13 @@ export class ExitPlanModeReporter implements ToolReporter {
|
||||
}
|
||||
}
|
||||
|
||||
/** EnterPlanMode switches the session to plan mode, so it has the `switch_mode` kind like ExitPlanMode. */
|
||||
export class EnterPlanModeReporter implements ToolReporter {
|
||||
toolUse(): ToolUseFacts {
|
||||
return { title: "EnterPlanMode", kind: "switch_mode" };
|
||||
}
|
||||
}
|
||||
|
||||
/** The plan file of a result: the path of the input, else the `filePath` of the structured result. */
|
||||
function resultPlanFile({ toolUse, structured, capabilities }: ToolResultContext) {
|
||||
if (!capabilities.air.planFile) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user