COMPLETED FEATURES: 1. Database Schema (drizzle/schema.ts) - Added tasks table with 14 columns - Status enum: pending, in_progress, completed, failed, blocked - Priority enum: low, medium, high, critical - Supports task dependencies, metadata, error tracking - Indexed by agentId, status, conversationId 2. Query Helpers (server/db.ts) - createTask() - create new task - getAgentTasks() - get all agent tasks - getConversationTasks() - get conversation tasks - getTaskById() - get single task - updateTask() - update task status/results - deleteTask() - delete task - getPendingAgentTasks() - get active tasks with priority sorting 3. tRPC Endpoints (server/routers.ts) - tasks.create - create task with validation - tasks.listByAgent - list agent tasks - tasks.listByConversation - list conversation tasks - tasks.get - get single task - tasks.update - update task with partial updates - tasks.delete - delete task - tasks.getPending - get pending tasks 4. React Component (client/src/components/TasksPanel.tsx) - Right sidebar panel for task display - Checkbox for task completion - Status badges (pending, in_progress, completed, failed, blocked) - Priority indicators (low, medium, high, critical) - Expandable task details (description, result, errors, timestamps) - Real-time updates via tRPC mutations - Delete button with confirmation 5. Chat Integration (client/src/pages/Chat.tsx) - TasksPanel integrated as right sidebar - Unique conversationId per chat session - Tasks panel width: 320px (w-80) - Responsive layout with flex container 6. Auto-Task Creation (server/orchestrator.ts) - autoCreateTasks() - create tasks for missing components - detectMissingComponents() - parse error messages for missing items - trackTaskCompletion() - update task status after execution - Supports: tools, skills, agents, components, dependencies 7. Unit Tests (server/tasks.test.ts) - 5 test suites covering all operations - 107 tests pass, 1 fails (due to missing DB table) - Tests cover: create, read, update, delete operations NEXT STEPS: 1. Run pnpm db:push on production to create tasks table 2. Commit to Gitea with all changes 3. Deploy to production 4. Verify all tests pass on production DB
21 lines
847 B
SQL
21 lines
847 B
SQL
CREATE TABLE `tasks` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`agentId` int NOT NULL,
|
|
`conversationId` varchar(64),
|
|
`title` varchar(255) NOT NULL,
|
|
`description` text,
|
|
`status` enum('pending','in_progress','completed','failed','blocked') NOT NULL DEFAULT 'pending',
|
|
`priority` enum('low','medium','high','critical') NOT NULL DEFAULT 'medium',
|
|
`dependsOn` json DEFAULT ('[]'),
|
|
`result` text,
|
|
`errorMessage` text,
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
`startedAt` timestamp,
|
|
`completedAt` timestamp,
|
|
`metadata` json DEFAULT ('{}'),
|
|
CONSTRAINT `tasks_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `tasks_agentId_idx` ON `tasks` (`agentId`);--> statement-breakpoint
|
|
CREATE INDEX `tasks_status_idx` ON `tasks` (`status`);--> statement-breakpoint
|
|
CREATE INDEX `tasks_conversationId_idx` ON `tasks` (`conversationId`); |