mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-22 01:02:16 +00:00
feat(plan-mode): show todo list in chat after planning, widget during execution
- After agent creates plan: show todo list as a message in chat - During execution: show widget under Working indicator with checkboxes - Check off items as they complete with strikethrough
This commit is contained in:
parent
764d9d4efc
commit
435acf1c18
1 changed files with 17 additions and 11 deletions
|
|
@ -244,8 +244,8 @@ export default function planModeHook(pi: HookAPI) {
|
||||||
ctx.ui.setStatus("plan-mode", undefined);
|
ctx.ui.setStatus("plan-mode", undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update widget with todo list (show in both plan mode and execution mode)
|
// Update widget with todo list (only during execution mode)
|
||||||
if (todoItems.length > 0) {
|
if (executionMode && todoItems.length > 0) {
|
||||||
const lines: string[] = [];
|
const lines: string[] = [];
|
||||||
for (const item of todoItems) {
|
for (const item of todoItems) {
|
||||||
if (item.completed) {
|
if (item.completed) {
|
||||||
|
|
@ -405,20 +405,26 @@ Do NOT attempt to make changes - just describe what you would do.`,
|
||||||
const extracted = extractTodoItems(textContent);
|
const extracted = extractTodoItems(textContent);
|
||||||
if (extracted.length > 0) {
|
if (extracted.length > 0) {
|
||||||
todoItems = extracted;
|
todoItems = extracted;
|
||||||
updateStatus(ctx); // Show the extracted todos
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasTodos = todoItems.length > 0;
|
const hasTodos = todoItems.length > 0;
|
||||||
const todoPreview = hasTodos
|
|
||||||
? `\n\nExtracted ${todoItems.length} steps:\n${todoItems
|
|
||||||
.slice(0, 3)
|
|
||||||
.map((t, i) => ` ${i + 1}. ${t.text.slice(0, 50)}...`)
|
|
||||||
.join("\n")}${todoItems.length > 3 ? `\n ... and ${todoItems.length - 3} more` : ""}`
|
|
||||||
: "";
|
|
||||||
|
|
||||||
const choice = await ctx.ui.select(`Plan mode - what next?${todoPreview}`, [
|
// Show todo list in chat if we extracted items
|
||||||
|
if (hasTodos) {
|
||||||
|
const todoListText = todoItems.map((t, i) => `☐ ${i + 1}. ${t.text}`).join("\n");
|
||||||
|
pi.sendMessage(
|
||||||
|
{
|
||||||
|
customType: "plan-todo-list",
|
||||||
|
content: `**Plan Steps (${todoItems.length}):**\n\n${todoListText}`,
|
||||||
|
display: true,
|
||||||
|
},
|
||||||
|
{ triggerTurn: false },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const choice = await ctx.ui.select("Plan mode - what next?", [
|
||||||
hasTodos ? "Execute the plan (track progress)" : "Execute the plan",
|
hasTodos ? "Execute the plan (track progress)" : "Execute the plan",
|
||||||
"Stay in plan mode",
|
"Stay in plan mode",
|
||||||
"Refine the plan",
|
"Refine the plan",
|
||||||
|
|
@ -429,7 +435,7 @@ Do NOT attempt to make changes - just describe what you would do.`,
|
||||||
planModeEnabled = false;
|
planModeEnabled = false;
|
||||||
executionMode = hasTodos;
|
executionMode = hasTodos;
|
||||||
pi.setTools(NORMAL_MODE_TOOLS);
|
pi.setTools(NORMAL_MODE_TOOLS);
|
||||||
updateStatus(ctx);
|
updateStatus(ctx); // This will now show the widget during execution
|
||||||
|
|
||||||
// Send message to trigger execution immediately
|
// Send message to trigger execution immediately
|
||||||
const execMessage = hasTodos
|
const execMessage = hasTodos
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue