v2 phase 5: pending questions with interactive cards

End-to-end ask_user_question flow:
- Agent MCP tool writes question card to messages_out
- Host delivery creates pending_questions row, delivers as Discord Card with buttons
- Local webhook server receives Gateway INTERACTION_CREATE events
- Acknowledges interaction + updates card to show selected answer
- Routes response back to session DB as system message
- MCP tool poll picks up response and returns to agent

Key fixes:
- Poll loop now skips system messages (reserved for MCP tool responses)
- Gateway listener uses webhookUrl forwarding mode for interaction support
- Button custom_id encodes questionId + option text for self-contained routing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-09 03:26:16 +03:00
parent c348fabf22
commit c31bb02c06
7 changed files with 233 additions and 6 deletions

View File

@@ -103,6 +103,7 @@ describe('channel registry', () => {
conversations: [],
onInbound: () => {},
onMetadata: () => {},
onAction: () => {},
}));
// Should not have any active adapters for channels with null factory returns
@@ -205,6 +206,7 @@ describe('channel + router integration', () => {
conversations: [],
onInbound: () => {},
onMetadata: () => {},
onAction: () => {},
}));
// Set up delivery adapter bridge (same pattern as index-v2.ts)