chore: merge main into cw/small-change-flow
Integrates main branch changes (headquarters dashboard, task retry count, agent prompt persistence, remote sync improvements) with the initiative's errand agent feature. Both features coexist in the merged result. Key resolutions: - Schema: take main's errands table (nullable projectId, no conflictFiles, with errandsRelations); migrate to 0035_faulty_human_fly - Router: keep both errandProcedures and headquartersProcedures - Errand prompt: take main's simpler version (no question-asking flow) - Manager: take main's status check (running|idle only, no waiting_for_input) - Tests: update to match removed conflictFiles field and undefined vs null
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
## Architecture
|
||||
|
||||
- **Schema**: `apps/server/db/schema.ts` — all tables, columns, relations
|
||||
- **Ports** (interfaces): `apps/server/db/repositories/*.ts` — 13 repository interfaces
|
||||
- **Adapters** (implementations): `apps/server/db/repositories/drizzle/*.ts` — 13 Drizzle adapters
|
||||
- **Ports** (interfaces): `apps/server/db/repositories/*.ts` — 14 repository interfaces
|
||||
- **Adapters** (implementations): `apps/server/db/repositories/drizzle/*.ts` — 14 Drizzle adapters
|
||||
- **Barrel exports**: `apps/server/db/index.ts` re-exports everything
|
||||
|
||||
All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.returning()` for atomic reads after writes.
|
||||
@@ -51,6 +51,7 @@ All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.r
|
||||
| status | text enum | 'pending' \| 'in_progress' \| 'completed' \| 'blocked' |
|
||||
| order | integer | default 0 |
|
||||
| summary | text nullable | Agent result summary — propagated to dependent tasks as context |
|
||||
| retryCount | integer NOT NULL | default 0, incremented on agent crash auto-retry, reset on manual retry |
|
||||
| createdAt, updatedAt | integer/timestamp | |
|
||||
|
||||
### task_dependencies
|
||||
@@ -71,6 +72,7 @@ All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.r
|
||||
| mode | text enum | 'execute' \| 'discuss' \| 'plan' \| 'detail' \| 'refine' |
|
||||
| pid | integer nullable | OS process ID |
|
||||
| exitCode | integer nullable | |
|
||||
| prompt | text nullable | Full assembled prompt passed to agent at spawn; persisted for durability after log cleanup |
|
||||
| outputFilePath | text nullable | |
|
||||
| result | text nullable | JSON |
|
||||
| pendingQuestions | text nullable | JSON |
|
||||
@@ -195,6 +197,21 @@ Messages within a chat session.
|
||||
|
||||
Index: `(chatSessionId)`.
|
||||
|
||||
### errands
|
||||
|
||||
Tracks errand work items linked to a project branch, optionally assigned to an agent.
|
||||
|
||||
| Column | Type | Notes |
|
||||
|--------|------|-------|
|
||||
| id | text PK | caller-supplied |
|
||||
| description | text NOT NULL | human-readable description |
|
||||
| branch | text NOT NULL | working branch name |
|
||||
| baseBranch | text NOT NULL | default 'main' |
|
||||
| agentId | text FK → agents (set null) | assigned agent; null if unassigned |
|
||||
| projectId | text FK → projects (cascade) | owning project |
|
||||
| status | text enum | active, pending_review, conflict, merged, abandoned; default 'active' |
|
||||
| createdAt, updatedAt | integer/timestamp | |
|
||||
|
||||
### review_comments
|
||||
|
||||
Inline review comments on phase diffs, persisted across page reloads.
|
||||
@@ -215,7 +232,7 @@ Index: `(phaseId)`.
|
||||
|
||||
## Repository Interfaces
|
||||
|
||||
13 repositories, each with standard CRUD plus domain-specific methods:
|
||||
14 repositories, each with standard CRUD plus domain-specific methods:
|
||||
|
||||
| Repository | Key Methods |
|
||||
|-----------|-------------|
|
||||
@@ -232,6 +249,7 @@ Index: `(phaseId)`.
|
||||
| ConversationRepository | create, findById, findPendingForAgent, answer |
|
||||
| ChatSessionRepository | createSession, findActiveSession, findActiveSessionByAgentId, updateSession, createMessage, findMessagesBySessionId |
|
||||
| ReviewCommentRepository | create, findByPhaseId, resolve, unresolve, delete |
|
||||
| ErrandRepository | create, findById, findAll (filter by projectId/status), update, delete |
|
||||
|
||||
## Migrations
|
||||
|
||||
@@ -243,4 +261,4 @@ Key rules:
|
||||
- See [database-migrations.md](database-migrations.md) for full workflow
|
||||
- Snapshots stale after 0008; migrations 0008+ are hand-written
|
||||
|
||||
Current migrations: 0000 through 0030 (31 total).
|
||||
Current migrations: 0000 through 0035 (36 total).
|
||||
|
||||
Reference in New Issue
Block a user