Skip to content

Commit 77a779f

Browse files
committed
feat: change the UpdatePlan display
1 parent 32e5796 commit 77a779f

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/session.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,8 @@ ${skillMd}
20322032
if (description) {
20332033
return description;
20342034
}
2035+
} else if (toolName === "UpdatePlan") {
2036+
return typeof args.explanation === "string" ? args.explanation.trim() : "";
20352037
}
20362038

20372039
const firstKey = Object.keys(args)[0];

src/tests/session.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,27 @@ test("buildOpenAIMessages preserves a real failed tool result", () => {
11601160
assert.doesNotMatch(openAIMessages[1]?.content ?? "", /Previous tool call did not complete/);
11611161
});
11621162

1163+
test("UpdatePlan tool params only show explanation when provided", () => {
1164+
const manager = createSessionManager(process.cwd(), "machine-id-update-plan-params");
1165+
const plan = "## Task List\n\n- [ ] Inspect project";
1166+
1167+
const withExplanation = (manager as any).buildToolMessage(
1168+
"session-1",
1169+
"call-plan-1",
1170+
JSON.stringify({ ok: true, name: "UpdatePlan", output: "Plan updated." }),
1171+
{ name: "UpdatePlan", arguments: JSON.stringify({ plan, explanation: "Start planning" }) }
1172+
) as SessionMessage;
1173+
const withoutExplanation = (manager as any).buildToolMessage(
1174+
"session-1",
1175+
"call-plan-2",
1176+
JSON.stringify({ ok: true, name: "UpdatePlan", output: "Plan updated." }),
1177+
{ name: "UpdatePlan", arguments: JSON.stringify({ plan }) }
1178+
) as SessionMessage;
1179+
1180+
assert.equal(withExplanation.meta?.paramsMd, "Start planning");
1181+
assert.equal(withoutExplanation.meta?.paramsMd, "");
1182+
});
1183+
11631184
test("buildOpenAIMessages repairs mixed missing duplicate and orphan tool messages", () => {
11641185
const manager = createSessionManager(process.cwd(), "machine-id-mixed-tool-badcase");
11651186
const assistantMessage = (manager as any).buildAssistantMessage(

0 commit comments

Comments
 (0)