Reorganize major src/ directories to follow a consistent pattern with
core/, menu/, submenu/, inputs/, logs/, layout/, feedback/ subdirectories.
Changes by module:
- stores/: Move 5 store files to stores/core/
- utils/: Create core/ (terminal, tools, etc.) and menu/ (progress-bar)
- api/: Create copilot/core/, copilot/auth/, ollama/core/
- providers/: Create core/, copilot/core/, copilot/auth/, ollama/core/, login/core/
- ui/: Create core/, banner/core/, banner/menu/, spinner/core/,
input-editor/core/, components/core/, components/menu/
- tools/: Create core/ for registry.ts and types.ts
- tui-solid/: Reorganize components/ into menu/, submenu/, inputs/,
logs/, modals/, panels/, layout/, feedback/
- commands/: Create core/ for runner.ts and handlers.ts
- services/: Create core/ for agent.ts, permissions.ts, session.ts,
executor.ts, config.ts
All imports updated to use new paths. TypeScript compilation verified.
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
/**
|
|
* TodoRead Tool - Allows agent to read current task list
|
|
*
|
|
* The agent calls this tool to see current progress and pending tasks.
|
|
*/
|
|
|
|
import { z } from "zod";
|
|
import { todoStore } from "@stores/core/todo-store";
|
|
import type { ToolDefinition } from "@tools/core/types";
|
|
|
|
const parametersSchema = z.object({});
|
|
|
|
export const todoReadTool: ToolDefinition = {
|
|
name: "todoread",
|
|
description: `Read the current todo list to see task progress.
|
|
|
|
Use this tool to:
|
|
- Check what tasks are pending
|
|
- See which task is currently in progress
|
|
- Review completed tasks
|
|
- Plan next steps based on remaining work
|
|
|
|
Returns the complete todo list with status for each item.`,
|
|
parameters: parametersSchema,
|
|
execute: async () => {
|
|
const plan = todoStore.getPlan();
|
|
|
|
if (!plan || plan.items.length === 0) {
|
|
return {
|
|
success: true,
|
|
title: "No todos",
|
|
output: "No tasks in the todo list. Use todowrite to create tasks.",
|
|
};
|
|
}
|
|
|
|
const progress = todoStore.getProgress();
|
|
|
|
const items = plan.items.map((item) => ({
|
|
id: item.id,
|
|
title: item.title,
|
|
status: item.status,
|
|
}));
|
|
|
|
const summary = items
|
|
.map((item) => {
|
|
const icon =
|
|
item.status === "completed"
|
|
? "✓"
|
|
: item.status === "in_progress"
|
|
? "→"
|
|
: item.status === "failed"
|
|
? "✗"
|
|
: "○";
|
|
return `${icon} [${item.id}] ${item.title} (${item.status})`;
|
|
})
|
|
.join("\n");
|
|
|
|
return {
|
|
success: true,
|
|
title: `Todos: ${progress.completed}/${progress.total}`,
|
|
output: `Progress: ${progress.completed}/${progress.total} (${progress.percentage}%)\n\n${summary}\n\nTodos JSON:\n${JSON.stringify(items, null, 2)}`,
|
|
};
|
|
},
|
|
};
|