docs(19-01): complete backend API for agent questions plan

Tasks completed: 2/2
- Add getAgentQuestions and listWaitingAgents tRPC procedures
- Export PendingQuestions and QuestionItem types from shared package

SUMMARY: .planning/phases/19-agent-inbox/19-01-SUMMARY.md
This commit is contained in:
Lukas May
2026-02-04 21:53:21 +01:00
parent aa93efaf65
commit ce46cfc663
3 changed files with 98 additions and 5 deletions

View File

@@ -297,7 +297,7 @@ Plans:
**Plans**: 4 plans
Plans:
- [ ] 19-01: Backend API for Agent Questions
- [x] 19-01: Backend API for Agent Questions
- [ ] 19-02: InboxList & MessageCard Components
- [ ] 19-03: QuestionForm & Input Components
- [ ] 19-04: Inbox Page Assembly
@@ -350,7 +350,7 @@ Phases execute in numeric order: 1 → 1.1 → 2 → 3 → 4 → 5 → 6 → 7
| 16. Frontend Scaffold | v2.0 | 5/5 | Complete | 2026-02-04 |
| 17. Initiative Dashboard | v2.0 | 4/4 | Complete | 2026-02-04 |
| 18. Initiative Detail | v2.0 | 4/4 | Complete | 2026-02-04 |
| 19. Agent Inbox | v2.0 | 0/? | Not started | - |
| 19. Agent Inbox | v2.0 | 1/4 | In progress | - |
| 20. Real-time Subscriptions | v2.0 | 0/? | Not started | - |
| 21. Polish & Integration | v2.0 | 0/? | Not started | - |

View File

@@ -10,9 +10,9 @@ See: .planning/PROJECT.md (updated 2026-02-04)
## Current Position
Phase: 19 of 21 (Agent Inbox) - IN PROGRESS
Plan: 2 of 4 in current phase
Status: Plan 19-02 complete
Last activity: 2026-02-04 - Completed 19-02-PLAN.md (InboxList and MessageCard components)
Plan: 3 of 4 in current phase
Status: Plan 19-03 complete
Last activity: 2026-02-04 - Completed 19-03-PLAN.md (QuestionForm & Input Components)
Progress: █████████░ 98%
@@ -213,10 +213,15 @@ Recent decisions affecting current work:
- 18-04: Task counts aggregated via callback from PhaseWithTasks to page-level state
- 18-04: DecisionList passed empty array — no backend endpoint for decisions yet
- 18-04: Phase/task dependencies simplified (empty arrays) for v1 — full dependency resolution deferred
- 19-01: Re-export PendingQuestions/QuestionItem from agent/types.ts via shared package (rootDir=../.. path)
- 19-01: listWaitingAgents filters agentManager.list() in-memory (agents are in-memory, no DB query needed)
- 19-02: Inline formatRelativeTime helper in MessageCard (no separate utils file per plan spec)
- 19-02: Filter/sort as button groups (not dropdowns) for simplicity per plan spec
- 19-02: Count badge shows total joined entries (not filtered count) to match wireframe "Agent Inbox (3)"
- 19-02: cn() import from @/lib/utils for className merging (consistent with all other components)
- 19-03: OptionGroup value is always string (comma-joined for multi-select) for consistent interface
- 19-03: QuestionForm owns answer state internally via useState (self-contained component)
- 19-03: allowOther defaults to true per plan spec
### Pending Todos

View File

@@ -0,0 +1,88 @@
---
phase: 19-agent-inbox
plan: 01
subsystem: api
tags: [trpc, agent-questions, shared-types]
# Dependency graph
requires:
- phase: 18-initiative-detail
provides: Frontend scaffold and tRPC client wiring
provides:
- getAgentQuestions tRPC procedure for structured question data
- listWaitingAgents tRPC procedure for inbox filtering
- PendingQuestions/QuestionItem shared types for frontend
affects: [19-02-inbox-list, 19-03-question-form, 19-04-inbox-page]
# Tech tracking
tech-stack:
added: []
patterns: []
key-files:
created: []
modified:
- src/trpc/router.ts
- packages/shared/src/types.ts
- packages/shared/src/index.ts
key-decisions:
- "Re-export from agent/types.ts (rootDir=../.. allows cross-package import)"
- "listWaitingAgents filters in-memory via agentManager.list() (no new DB query needed)"
# Metrics
duration: 3min
completed: 2026-02-04
---
# Phase 19 Plan 01: Backend API for Agent Questions Summary
**Two tRPC procedures (getAgentQuestions, listWaitingAgents) and shared PendingQuestions/QuestionItem type exports for frontend inbox**
## Performance
- **Duration:** 3 min
- **Started:** 2026-02-04
- **Completed:** 2026-02-04
- **Tasks:** 2
- **Files modified:** 3
## Accomplishments
- Added `getAgentQuestions` procedure exposing structured question data from AgentManager
- Added `listWaitingAgents` procedure filtering to `waiting_for_input` status
- Exported `PendingQuestions` and `QuestionItem` types from `@codewalk-district/shared`
## Task Commits
Each task was committed atomically:
1. **Task 1: Add getAgentQuestions and listWaitingAgents tRPC procedures** - `004140e` (feat)
2. **Task 2: Export PendingQuestions and QuestionItem from shared package** - `47a2bb3` (feat)
## Files Created/Modified
- `src/trpc/router.ts` - Added getAgentQuestions and listWaitingAgents procedures, updated JSDoc
- `packages/shared/src/types.ts` - Re-export PendingQuestions and QuestionItem from agent types
- `packages/shared/src/index.ts` - Added PendingQuestions and QuestionItem to public exports
## Decisions Made
- Re-export from `../../../src/agent/types.js` works because shared tsconfig has `rootDir: "../.."`
- `listWaitingAgents` filters `agentManager.list()` in-memory rather than adding a new DB query (agents are in-memory anyway)
## Deviations from Plan
None - plan executed exactly as written.
## Issues Encountered
None
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Both procedures available for frontend consumption via tRPC client
- Shared types ready for import in inbox components
- Ready for 19-02-PLAN.md (InboxList & MessageCard Components)
---
*Phase: 19-agent-inbox*
*Completed: 2026-02-04*