feat: implement AI checkpoint and task suggestion UI with approval flow

This commit is contained in:
Roberto Musso
2026-02-24 22:29:09 +01:00
parent 77b94e2b27
commit 5445bb0eec
11 changed files with 278 additions and 26 deletions

View File

@@ -533,3 +533,32 @@
- LanceDB `table.search(vector).limit(k).execute()` returns objects with all stored fields plus `_distance` (L2 distance, lower = more similar)
- The `SearchResult` type is exported from `vectordb.ts` for reuse in the orchestrator — keep vector DB types in the DB module, not the AI module
---
## 2026-02-24 - US-024
- Implemented AI checkpoint suggestions UI with approve/reject flow
- Extended to also support AI task suggestions (user-requested scope expansion)
- Modified suggest_checkpoints tool in orchestrator to persist suggestions to DB (isAiSuggested=1, isApproved=0)
- Created new suggest_tasks tool with same pattern (analyzes notes, extracts actionable tasks, persists to DB)
- Added isAiSuggested/isApproved columns to tasks table schema + ALTER TABLE migration for existing databases
- Updated tasks.create/update router to accept new fields
- Added TaskItem type fields for isAiSuggested/isApproved
- ProjectDetail.tsx: "Suggest checkpoints" button (outline+Sparkles) in timeline header, "Suggest tasks" button in tasks header
- Pending suggestions render as border-dashed Card components below GanttChart / above KanbanBoard
- Approve (variant=default, size=sm) calls update with isApproved=1; Reject (variant=ghost, size=sm) calls delete
- KanbanBoard and workspace tasks route filter out unapproved AI suggestions
- Files changed:
- src/main/db/schema.ts (added isAiSuggested + isApproved to tasks)
- src/main/db/index.ts (ALTER TABLE migration + updated CREATE TABLE)
- src/main/router/index.ts (tasks.create/update/list updated)
- src/main/ai/orchestrator.ts (persist checkpoint suggestions + new suggest_tasks tool + updated system prompt)
- src/renderer/components/projects/ProjectDetail.tsx (suggest buttons + pending cards for both)
- src/renderer/components/projects/KanbanBoard.tsx (filter out pending AI suggestions)
- src/renderer/components/tasks/TaskRow.tsx (TaskItem type extended)
- src/renderer/routes/tasks.tsx (filter out pending AI suggestions)
- **Learnings for future iterations:**
- Tasks table defaults isApproved=1 (unlike checkpoints which default=0) so existing/manually-created tasks remain visible
- SQLite has no ADD COLUMN IF NOT EXISTS — use try/catch around ALTER TABLE statements
- The suggest_checkpoints/suggest_tasks tools persist directly via db.insert() in the tool handler, then query invalidation on the frontend picks up new records
- TaskItem type in TaskRow.tsx is manually defined (not auto-inferred from tRPC) — must be updated when adding columns to the tasks select
- The ai.chat mutation can be instantiated multiple times for independent suggest flows (suggestCheckpoints vs suggestTasks)
---