feat(events-shim): one MCP URL that wakes an idle agent on each webhook post
Merged
KH
3h ago+3102+3102+0123456789012345678901234567890123456789-1-1-0123456789
Summary
Adds @agent-relay/events-shim: one MCP URL that turns webhook posts into Agent Relay messages that wake an idle agent session (like a hosted webhook inbox, but delivered by injection instead of polling).
- A person adds one MCP server (
claude mcp add --transport http webhooks <mcp url>) and points any sender at the paired webhook URL. - Under Agent Relay the agent runs
agent-relay-probe webhook --socket <socket>(new;POST /webhookson the session socket, which already existed) and callslink_relay_wake. Every later post is forwarded to that session webhook; relay-node injects it, waking the session when idle. - Without Agent Relay:
wait_for_webhook(blocks up to 50s) orget_webhook_events. - Webhook URLs: open, GitHub, Stripe, Linear and bearer (signature/bearer checked). Once-per-
Idempotency-Key(or provider delivery id). 60/h, 500/day, 64 KB bodies, 50-post feed, 7-day idle expiry. - Nudges: a
text/plainpost to an authenticated URL is delivered verbatim, so an MCP vendor can wake agents with a pointer to its own data. Open posts are always wrapped as untrusted data. - Wake links only to allowed Relaycast origins (default
https://cast.agentrelay.com), checked with a link-check post before storing — prevents SSRF via the MCP URL. - Hosts supply an
EventsShimStoreand mount one WebRequest → Responsehandler (handleEventsShimRequest). Cloud and relay-control PRs consume it. agent-relay-probe webhookis deliberately not in Codex's auto-allow list: its secret lets the holder inject into the session, so a relayed message must not be able to mint one unattended.- Package added to the publish matrix,
build:core, vitest workspace aliases; CHANGELOG[Unreleased - Minor].
Test Plan
-
vitestpackages/events-shim/src— 13/13 (real MCP SDK client over the HTTP handler: queueing, wake forwarding, broken links, SSRF refusal, wait_for_webhook, idempotency, GitHub/Stripe/Linear/bearer verification, limits, rotate/expiry, verbatim nudges, no double hand-over) -
tsc --noEmitfor the package -
cargo test --lib -- session_cli relay_commands sandbox_rule— 12/12 - Real end-to-end (2026-11-11): package handler → real
cast.agentrelay.comsession webhook → Agent Relay Desktop. The link check arrived in a live Claude Code session asfrom webhook; then, with that session idle, a bearertext/plainpost (202,wake: forwarded) woke the session with the exact nudge text; feed recordedwoken. Test webhook revoked afterwards.
Follow-ups: AgentWorkforce/cloud and AgentWorkforce/relay-control PRs pin @agent-relay/events-shim@18.2.0 and need this released first.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.