feat: Add persistent chat sessions for iterative phase/task refinement
Introduces a chat loop where users send instructions to an agent that applies changes (create/update/delete phases, tasks, pages) and stays alive for follow-up messages. Includes schema + migration, repository layer, chat prompt, file-io action field extension, output handler chat mode, revert support for deletes, tRPC procedures, events, frontend slide-over UI with inline changeset display and revert, and docs.
This commit is contained in:
26
apps/server/drizzle/0027_add_chat_sessions.sql
Normal file
26
apps/server/drizzle/0027_add_chat_sessions.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
-- Chat sessions and messages for iterative phase/task refinement
|
||||
CREATE TABLE `chat_sessions` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`target_type` text NOT NULL,
|
||||
`target_id` text NOT NULL,
|
||||
`initiative_id` text NOT NULL REFERENCES `initiatives`(`id`) ON DELETE CASCADE,
|
||||
`agent_id` text REFERENCES `agents`(`id`) ON DELETE SET NULL,
|
||||
`status` text DEFAULT 'active' NOT NULL,
|
||||
`created_at` integer NOT NULL,
|
||||
`updated_at` integer NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `chat_sessions_target_idx` ON `chat_sessions` (`target_type`, `target_id`);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `chat_sessions_initiative_id_idx` ON `chat_sessions` (`initiative_id`);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `chat_messages` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`chat_session_id` text NOT NULL REFERENCES `chat_sessions`(`id`) ON DELETE CASCADE,
|
||||
`role` text NOT NULL,
|
||||
`content` text NOT NULL,
|
||||
`change_set_id` text REFERENCES `change_sets`(`id`) ON DELETE SET NULL,
|
||||
`created_at` integer NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `chat_messages_session_id_idx` ON `chat_messages` (`chat_session_id`);
|
||||
@@ -190,6 +190,13 @@
|
||||
"when": 1771804800000,
|
||||
"tag": "0026_add_task_summary",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 27,
|
||||
"version": "6",
|
||||
"when": 1771891200000,
|
||||
"tag": "0027_add_chat_sessions",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user