Commit Graph

19 Commits

Author SHA1 Message Date
maaz519 eb04becc57 feat(service): P4 doc-faithfulness — SLA placeholder columns, issueSubclass, traceId on state.changed
Adds ticket.slaDueAt + ticket.issueSubclass + queue.slaPolicyRef (placeholder
columns, no timer logic until P7) and propagates ticket.traceId onto
ticket.state.changed events (assignment + transition). 45 tests still green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 12:25:11 +05:30
maaz519 7441d0ec36 feat: P4.6 agent demo + escalate button + support seed/smoke (P4 complete)
apps/agent-demo (Vite): agent sets AVAILABLE, sees assigned tickets, opens the
thread, replies. message-demo customer pane gains 'escalate to support' (via
SupportProvider/useEscalate). seed-support + smoke-support prove the loop:
escalate -> auto-assign -> agent reply -> customer receives. 45 tests; realtime/
inbox/support smokes all pass; both demos build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 12:09:29 +05:30
maaz519 e9e61b52bc feat: P4.4 support REST (tickets/escalate/callbacks/queue admin) + kernel-client methods
8 routes under /v1/support (session-auth). RestClient gains createTicket/escalate/
listTickets/patchTicket/requestCallback/createQueue/joinQueue/setAvailability +
Ticket/CallbackRequest types.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 11:58:52 +05:30
maaz519 859124914c feat(service): P4.3 AssignmentService — event-driven least-loaded assignment
Consumes support.ticket.created -> picks least-loaded available agent within
capacity -> ticket OPEN, activeCount++, agent joins linked thread(s), base
thread untouched; idempotent (processed-event + assignedActorId guard). Queue/
team admin (createQueue/addMember/setAvailability, re-scan on available). 45 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 11:55:31 +05:30
maaz519 2695f0ffee feat(service): P4.2 SupportService — tickets, M:N thread links, transitions, callback
createTicket (NEW + history + ticket.created event, default queue), escalate,
linkThread/unlinkThread (M:N both directions), transition state machine +
ticket.state.changed, requestCallback placeholder, listTickets (mine/assigned),
fail-closed. 6 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 11:53:13 +05:30
maaz519 2141cea8dc feat(service): P4.1 support tables (queue/team_member/ticket/ticket_thread_link/state_history/callback) + events
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 11:51:19 +05:30
maaz519 942f40292e feat(demo): P3.5 inbox sidebar + inbox smoke (P3 complete)
message-demo gains a per-person Inbox rail (useInbox, done/snooze); sending
surfaces a NEEDS_REPLY item in the other pane; reading auto-resolves it.
smoke-inbox.mjs proves the event-driven flow end-to-end (send -> relay ->
projector -> inbox -> read -> DONE). Realtime smoke still passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 07:24:52 +05:30
maaz519 20c8f15dff feat(service): P3.3 inbox API + state machine (list/transition, fail-closed, STALE)
InboxService.list (fail-closed) + transition (OPEN/SNOOZED/DONE/STALE/ARCHIVED
state machine, owner-only, state-history). GET /v1/inbox/items + PATCH
/v1/inbox/items/:id. Moved SessionVerifier to global IdentityModule (shared by
message + inbox, no circular imports). 35 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 03:54:11 +05:30
maaz519 a2b95afaf0 feat(service): P3.2 InboxProjector + message.read event + scheduled relay
Event-driven projector creates/collapses NEEDS_REPLY items from message.sent
(traceId propagated; inbox.item.created emitted) and resolves them to DONE on
message.read; idempotent via processed-event ledger. markRead now emits a
message.read outbox event (atomic). OutboxRelay runs on a 500ms timer in the
app (off in tests). Shared resetDb (TRUNCATE CASCADE) fixes cross-spec FK
isolation. 32 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 02:48:44 +05:30
maaz519 7b174e24fa feat(service): P3.1 inbox tables + extract ActorResolver
IiosInboxItem + IiosInboxItemStateHistory (migration inbox-init). Extracted
resolveScope/resolveActor/ensureParticipant into a shared ActorResolver
(IdentityModule) so message + inbox layers share identity resolution; MessageService
delegates (P2 tests unchanged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 02:41:50 +05:30
maaz519 4d05f7c1b1 feat(demo): P2.7 Vite React two-pane realtime demo + dev token endpoint (P2 complete)
apps/message-demo: Alice creates a thread, Bob joins; live two-way chat, typing,
read receipts (useMessages now exposes reads[]). Dev-only /v1/dev/token endpoint
(gated by IIOS_DEV_TOKENS) so the browser can auth. .env autoloaded (dotenv).
Realtime smoke script passes end-to-end (message + unread + receipt).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 01:36:14 +05:30
maaz519 3165a5bb59 feat(service): P2.4 REST fallback POST /v1/threads/:id/messages (session-auth)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 01:18:59 +05:30
maaz519 50ef34dd90 feat(service): P2.3 Socket.io /message gateway + real SessionVerifier
open_thread (create-or-join) / send_message / read / delivered / typing; HS256
token verified on connect (SessionVerifier reuses AppTokenVerifier pattern);
OutboxBus bridge propagates REST/ingest messages to rooms (dedup vs inline emit).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 01:12:49 +05:30
maaz519 827fb52f5f feat(service): P2.2 MessageService — native send + receipts/unread + traceId
openThread (create-or-join), send (idempotent, bumps other participants' unread,
message.sent outbox event, traceId DB->event), markRead (READ receipt + unread
reset), contentRef attachment placeholder. Adds messageSent to contracts events.
5 DB-backed tests green; 24 total.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 01:09:19 +05:30
maaz519 7197157058 feat(service): P2.1 messaging tables — IiosMessageReceipt + IiosUnreadCounter
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 01:04:26 +05:30
maaz519 072c541e09 feat(service): outbox relay + thread read endpoint + replay (P1.5, P1 complete)
OutboxRelay: FOR UPDATE SKIP LOCKED claim, in-process bus publish, PENDING->
PUBLISHED with 30s backoff + idempotent-consumer ledger. GET /v1/threads/:id/
messages (policy-scoped). Replay + read specs green; vitest fileParallelism off
(shared DB). End-to-end HTTP smoke verified: idempotent ingest, read-back, 400
on missing key. 19 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 21:29:00 +05:30
maaz519 4b7dc98c6b feat(service): ingest endpoint with kernel gates (P1.4)
POST /v1/interactions/ingest: fail-closed OPA gate -> resolve scope/handle(MDM,
no silent merge)/actor/channel/thread -> idempotent write of interaction+parts+
outbox CloudEvent in one tx. 4 DB-backed gate tests green (idempotent /
fail-closed / unresolved-handle / outbox event). 16 tests total.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 21:24:09 +05:30
maaz519 8cd5d9b248 feat(service): PlatformGates seam + fail-closed decideOrThrow (P1.3)
LocalDevPorts = permissive in-service default (no testkit at runtime);
decideOrThrow turns OPA deny/throw/timeout into PolicyDeniedError. Tests drive
deny/timeout via testkit fakes. 12 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 21:18:23 +05:30
maaz519 9cfd1ab1ab feat(service): NestJS kernel skeleton + 10-table kernel schema (P1.1+1.2)
Reuses support-service bootstrap/health/prisma patterns. Kernel-only Prisma
schema (scope/source_handle/actor/channel/thread/participant/interaction/
message_part/outbox/processed_event) with orgId/appId NOT NULL and
@@unique([scopeId, idempotencyKey]). Health verified: {status:ok,db:true}.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 21:16:31 +05:30