feat(hn-monitor): reply over the relay to the sender (consume #254 platform)

Merged
KH
5mo ago
+211-39

The agents-repo consumption (D) of the platform relay-reply work (workforce#254 / #255 / #256). Makes hn-monitor answer a relay DM over the relay, back to whoever asked, instead of always posting to Slack.

What

  • Bump @agentworkforce/{delivery,runtime,persona-kit} → ^4.1.14 (published relaycast target + ctx.relay).
  • hn-monitor relay Q&A branch:
    • Resolve the inbound sender from the event summary actor (the cloud envelope-builder normalizes the relaycast from → summary.actor), defensively probing event.summary / expand('summary') / full payload.
    • When resolved → ctx.relay.dm(sender, answer) (true A2A round-trip); otherwise fall back to the existing Slack/Telegram delivery (no regression). Never throws.
  • Fix two pre-existing narrowings now that delivery's MessageRef/targets include relaycast (filter to slack|telegram in the fallback target list + saveHeaderRefs).

Tests

  • New: A2A round-trip (sender resolved → ctx.relay.dm called, Slack skipped).
  • Existing relay test (no sender → Slack fallback) still green.
  • 167/167, tsc --noEmit clean.

Notes / sequencing

  • Safe to merge on its own — graceful Slack fallback means no behavior regression if the sender can't be resolved.
  • The full prod round-trip also needs the gateway/key cutover (cloud#2501 → cast.agentrelay.com + re-mint keys) and relay-on-default (cloud#2491, merged) + recipient-scoping (cloud#2494, merged).
  • The summary.actor field path is verified against the test harness; worth a final confirm against the live relay — the resolver degrades gracefully if it differs.

Refs AgentWorkforce/workforce#254

🤖 Generated with Claude Code


Summary by cubic

hn-monitor now replies to relay DMs over the relay directly to the sender (agent-to-agent), instead of always posting to Slack. Upgrades @agentworkforce/{delivery,runtime,persona-kit} to ^4.1.14 to enable relaycast and ctx.relay, aligning with workforce#254.

  • New Features

    • Resolve inbound sender from summary.actor, also probing expanded summary and the full payload.
    • When found, reply via ctx.relay.dm(sender, answer); otherwise fall back to Slack/Telegram.
  • Bug Fixes

    • Guard the relay-reply path behind ctx.relay and reuse the already-expanded payload (no redundant expand).
    • Filter fallback delivery to only slack/telegram and limit saveHeaderRefs to those refs.