Multimodal Agent Interface Wiring Map
Execution coordinates for the engineering agent. All paths relative to the implementation worktree.
Pages
| Screen | Route | File | Pattern to Copy |
|---|---|---|---|
| Chat Interface | /chat | BLOCKER: path unknown — likely app/(app)/chat/page.tsx | app/(app)/crm/contacts/page.tsx (list page with data fetching) |
Components
| Component | File | Serves |
|---|---|---|
| ChatWindow | BLOCKER: libs/ui/src/components/chat/ChatWindow.tsx | Screen: Chat (#1, #4, #8-10) |
| MessageInput | BLOCKER: libs/ui/src/components/chat/MessageInput.tsx | Screen: Chat (#1) |
| FileUpload | BLOCKER: libs/ui/src/components/chat/FileUpload.tsx | Screen: Chat (#2) |
| VoiceInput | BLOCKER: libs/ui/src/components/chat/VoiceInput.tsx | Screen: Chat (#3) |
| RichMessage | BLOCKER: libs/ui/src/components/chat/RichMessage.tsx | Screen: Chat (#10) |
| StreamProgress | BLOCKER: libs/ui/src/components/chat/StreamProgress.tsx | Screen: Chat (#8) |
Server Actions
| File | Actions | Permission Required |
|---|---|---|
BLOCKER: actions/chat.actions.ts | sendMessage(orgId, message), uploadFile(orgId, file) | chat:send |
BLOCKER: actions/crm-query.actions.ts | queryCRM(orgId, naturalLanguageQuery) | crm:read |
Infrastructure
| Layer | File | Purpose |
|---|---|---|
| Streaming API | BLOCKER: app/api/chat/route.ts | Vercel AI SDK streaming endpoint |
| Session Store | BLOCKER: depends on Agent Platform memory architecture | Per-user, per-org session context |
| Modality Router | BLOCKER: libs/agency/src/modality/router.ts | Input classification + routing |
| Input Normaliser | BLOCKER: libs/agency/src/modality/normaliser.ts | PDF/image/voice to text |
| Feature Flag | BLOCKER: depends on org settings schema | Per-org conversational mode |
Existing Tests
| Type | File | Covers |
|---|---|---|
| e2e | BLOCKER: apps/drmg-sales-e2e/src/e2e/chat-*.spec.ts | S1, S2, S3 |
| integration | BLOCKER: libs/agency/src/__tests__/session-memory.spec.ts | S4 |
| integration | BLOCKER: libs/agency/src/__tests__/modality-router.spec.ts | S5 |
Seeds and Fixtures
- Org with >=3 deals across 2+ stages (for S2 pipeline query)
- Org with venture + 0 RFP questions (for S1 PDF extraction)
- Contact with
company_name= 'Acme Corp' (for S3 outreach) - Answer library with >=3 approved answers (for S1b auto-fill)
- Test user with
chat:sendandcrm:readpermissions - Sample PDF with RFP questions in body + appendix (for S1 coverage test)
- Ambiguous image file (whiteboard photo, for S5 classification test)
Implementation Guardrails
- Use existing
(app)layout; do not introduce a new layout - Follow
page.tsxas the pattern (server-component-first unless client interactivity needed) - New mutations must go through
actions/directory - Do not create alternate domain terminology; use spec naming (WorkChart, not "workflow" or "pipeline")
- Chat streaming must use Vercel AI SDK
useChathook — do not build custom streaming - All CRM queries must go through existing Convex query functions — do not bypass with direct DB access
- Feature flag must be org-level, not user-level — consistent experience per organisation