Files
Codewalkers/.planning/phases/19-agent-inbox/19-01-PLAN.md
Lukas May d9b6ce4748 docs(19): create agent inbox phase plan
Phase 19: Agent Inbox
- 4 plans in 2 waves
- 3 parallel (Wave 1), 1 sequential (Wave 2)
- Ready for execution
2026-02-04 21:47:58 +01:00

3.8 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous
phase plan type wave depends_on files_modified autonomous
19-agent-inbox 01 execute 1
src/trpc/router.ts
true
Add tRPC procedures to expose structured agent question data to the frontend.

Purpose: The agent inbox UI needs structured question data (options, multiSelect) to render form controls. Questions are stored in-memory on AgentManager via getPendingQuestions(agentId), but no tRPC procedure exposes this. The message table content is a plain string and does NOT contain the structured question data. This plan bridges that gap.

Output: Two new tRPC procedures: getAgentQuestions and listWaitingAgents.

<execution_context> @/.claude/get-shit-done/workflows/execute-plan.md @/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md

@src/trpc/router.ts @src/agent/types.ts @src/agent/schema.ts

Task 1: Add getAgentQuestions tRPC procedure src/trpc/router.ts Add a `getAgentQuestions` query procedure to the appRouter. It should: 1. Accept `agentIdentifierSchema` input (same as getAgent — name or id) 2. Resolve the agent via `resolveAgent(ctx, input)` 3. Call `agentManager.getPendingQuestions(agent.id)` 4. Return the `PendingQuestions` object (or null if no pending questions)

Place it near the existing getAgentResult procedure since it follows the same pattern.

Also add a listWaitingAgents query that filters agentManager.list() to only agents with status === 'waiting_for_input'. This lets the inbox efficiently fetch only agents that have questions without filtering client-side.

Update the JSDoc procedure list comment at the top of appRouter to include both new procedures. npx tsc --noEmit (TypeScript compiles without errors) - getAgentQuestions procedure exists and returns PendingQuestions | null - listWaitingAgents procedure exists and returns AgentInfo[] filtered to waiting_for_input - TypeScript compiles clean

Task 2: Export PendingQuestions and QuestionItem types from shared package packages/shared/src/types.ts The frontend needs `PendingQuestions` and `QuestionItem` types to properly type the question form props. Export these types from the shared package:
  1. In packages/shared/src/types.ts, add re-exports for PendingQuestions and QuestionItem from ../../src/agent/types.js
  2. If the import path doesn't work with the shared package's rootDir config, define matching interfaces directly in the shared types file (same shapes as in src/agent/types.ts)

The key types needed by the frontend are:

  • QuestionItem: { id: string; question: string; options?: { label: string; description?: string }[]; multiSelect?: boolean }
  • PendingQuestions: { questions: QuestionItem[] } npx tsc --noEmit -p packages/shared/tsconfig.json && npx tsc --noEmit -p packages/web/tsconfig.app.json
    • PendingQuestions and QuestionItem available to import from @codewalk-district/shared
    • Both frontend and backend packages compile
Before declaring plan complete: - [ ] `npx tsc --noEmit` passes in root - [ ] `npm run build` succeeds - [ ] New procedures visible in router type

<success_criteria>

  • getAgentQuestions procedure returns structured question data from AgentManager
  • listWaitingAgents returns only agents in waiting_for_input status
  • PendingQuestions/QuestionItem types available in shared package
  • All builds pass </success_criteria>
After completion, create `.planning/phases/19-agent-inbox/19-01-SUMMARY.md`