agent-orchestrator/packages/web/src
Dhruv Sharma 73bed33c2e
feat(web): activity events for webhooks and mux WebSocket (#1656) (#1693)
* feat(web): activity events for webhooks and mux WebSocket (#1656)

Closes #1656 — adds the 10 activity events called out in the issue, covering
webhook ingress (4) and the mux WebSocket terminal server (6). Builds on the
ActivityEvent infrastructure landed in #1620.

Webhook events (api source):
- api.webhook_unverified (warn) — 401 signature verification failure
- api.webhook_rejected   (warn) — 413 payload exceeds maxBodyBytes
- api.webhook_received   (info|warn) — 202 success, with parse/lifecycle error counts
- api.webhook_failed     (error) — 500 outer catch / pipeline crash

Mux WS events (ui source — Node-side server only):
- ui.terminal_connected     — one per mux WS connection
- ui.terminal_disconnected  — one per close
- ui.terminal_heartbeat_lost (warn) — once on 3 missed pongs (was console-only)
- ui.terminal_pty_lost       (warn) — fires only when subscribers are still attached,
  distinguishing "PTY actually died" from "user closed browser"
- ui.terminal_protocol_error (warn) — invalid mux client message
- ui.session_broadcast_failed (warn) — emitted on the healthy→failing transition
  only; re-arms after a successful poll so a long outage yields one event, not 20/min

Invariants honored: no raw payloads or signatures in `data`, no client IPs in
`summary` (kept in `data` only), no per-keystroke / per-pong fan-out — only on
state transitions. `api.webhook_unverified` is the security-audit event; data
captures `slug` and `remoteAddr` but never the failed signature.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(web): harden webhook and PTY activity events

* chore(ci): retrigger checks

* fix(web): record PTY loss across mux exit paths

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: whoisasx <adil.business4064@gmail.com>
2026-05-18 18:54:00 +05:30
..
__tests__ feat(web): activity events for webhooks and mux WebSocket (#1656) (#1693) 2026-05-18 18:54:00 +05:30
app feat(web): activity events for webhooks and mux WebSocket (#1656) (#1693) 2026-05-18 18:54:00 +05:30
components fix(web): hide unenriched PR diff stats (#1912) 2026-05-18 03:48:28 +05:30
hooks fix(web): kill RSC prefetch storm + dedupe in-flight fetches + retry on transient timeout (closes #1855) (#1856) 2026-05-15 12:00:56 +05:30
lib feat(web): activity events for webhooks and mux WebSocket (#1656) (#1693) 2026-05-18 18:54:00 +05:30
providers Fix direct terminal attach and keep project-scoped mux routing (#1608) 2026-05-04 19:55:10 +05:30
vitest.d.ts fix: upgrade @testing-library/jest-dom for vitest 2.x type compatibility (#21) 2026-02-14 14:40:44 +05:30