singularity-forge/packages/pi-coding-agent/src/modes
Mikael Hugo a055b3adf2 feat: structured notification event model with metadata-first classification
Replace brittle string-matching in headless-events.ts with structured
source/kind/blocking/dedupe_key metadata on notify() events. String
matching is preserved as a fallback for the ~940 untagged call sites.

- Add NotificationMetadata type to headless-types.ts (canonical definition)
- Extend rpc-types.ts notify event with optional metadata field
- Extend ExtensionUIContext.notify() signature with optional 3rd arg
- Pass metadata through RPC notify implementation in rpc-mode.ts
- Update headless-events.ts: isTerminalNotification, isBlockedNotification,
  isMilestoneReadyNotification, isPauseNotification all check metadata first
- Update notification-store.ts: store metadata on NotificationEntry; use
  metadata.dedupe_key as dedup key when provided (falls back to message hash)
- Update notify-interceptor.ts to thread metadata through to store + original
- Tag critical emit sites with structured metadata:
  stopAuto → { kind: "terminal" } (+ blocking: true when reason includes "block")
  pauseAuto → { kind: "terminal", blocking: true }
  guided-flow milestone ready → { kind: "approval_request", blocking: true }
- Update notification-overlay.ts to prefer metadata.source for [label] display
- Add 17-test regression suite (notification-event-model.test.ts)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 23:07:57 +02:00
..
interactive feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
rpc feat: structured notification event model with metadata-first classification 2026-05-01 23:07:57 +02:00
shared refactor: deduplicate RPC mode shared patterns 2026-03-19 16:38:51 -03:00
index.ts feat: Added RPC protocol v2 types, init handshake with version detectio… 2026-03-26 11:01:58 -06:00
print-mode.ts Cherry-pick process lifecycle fixes for multi-day autonomous operation 2026-04-18 14:38:55 +02:00