68 lines
2.6 KiB
Markdown
68 lines
2.6 KiB
Markdown
---
|
|
phase: 23-brainstormer-flow
|
|
plan: "01"
|
|
subsystem: api, chat-service
|
|
tags: [express, drizzle, chat, handoff, issue-creation, system-messages]
|
|
dependency_graph:
|
|
requires:
|
|
- phase: 23-00
|
|
provides: messageType column in chat_messages, handoffSchema validator
|
|
- phase: 21-chat-foundation
|
|
provides: chatService, chatRoutes, addMessage, getConversation
|
|
provides:
|
|
- addSystemMessage helper in chatService
|
|
- messageType support in addMessage
|
|
- POST /conversations/:id/handoff route
|
|
- POST /conversations/:id/status-update route
|
|
affects:
|
|
- server/src/services/chat.ts
|
|
- server/src/routes/chat.ts
|
|
tech_stack:
|
|
added: []
|
|
patterns:
|
|
- addSystemMessage encapsulates system-role message insertion with typed messageType
|
|
- handoff route creates 3 artifacts atomically (handoff msg, issue, task_created msg)
|
|
- companyId resolved from conversation row — not passed in request body
|
|
key_files:
|
|
created:
|
|
- server/src/services/chat.ts
|
|
- server/src/routes/chat.ts
|
|
modified: []
|
|
decisions:
|
|
- "Import issueService from ../services/issues.js directly (not via index.js) — matches plan guidance and local instantiation pattern used in heartbeat.ts"
|
|
- "issueSvc instantiated inside chatRoutes(db) — option (a) from plan, simplest approach"
|
|
- "Handoff content uses arrow character (→) in system message; spec fields assembled into markdown description"
|
|
requirements-completed: [AGENT-03, AGENT-06, AGENT-07, CHAT-09]
|
|
metrics:
|
|
duration: "8 minutes"
|
|
completed_date: "2026-04-01"
|
|
tasks_completed: 2
|
|
files_changed: 2
|
|
---
|
|
|
|
# Phase 23 Plan 01: Chat Service Extension — handoff + status-update Routes Summary
|
|
|
|
**Extended chatService with addSystemMessage helper and messageType support, and added POST handoff and status-update routes that insert typed system messages and create issues from brainstormer specs.**
|
|
|
|
## Tasks Completed
|
|
|
|
| Task | Name | Commit | Files |
|
|
|------|------|--------|-------|
|
|
| 1 | Extend chat service with messageType support and addSystemMessage | 0a1b3dc0 | server/src/services/chat.ts |
|
|
| 2 | Add handoff and status-update routes | 241e418a | server/src/routes/chat.ts |
|
|
|
|
## Verification
|
|
|
|
- `pnpm exec tsc --noEmit -p server/tsconfig.json` passes for chat files (pre-existing plugin-sdk errors unrelated)
|
|
- `pnpm vitest run` — same failures as baseline (6 pre-existing, none new)
|
|
- All 5 acceptance criteria pass for both tasks
|
|
|
|
## Deviations from Plan
|
|
|
|
None — plan executed exactly as written.
|
|
|
|
## Known Stubs
|
|
|
|
None — both routes are fully implemented. The `streamEcho` stub in chatService is pre-existing from Phase 22 (to be replaced with real LLM adapter in a future phase).
|
|
|
|
## Self-Check: PASSED
|