Files
hapi/docs/guide
f34ff13fce feat(peer): forward peer replies back to the caller with waitForReply (#2167)
* feat(peer): spawn_peer and reply forwarding for peer sessions

Peer sessions could only fire messages at each other: the caller had to
poll inspect_peer to learn that a peer finished, and nothing woke it once
it ended its turn. There was also no way to start a peer for new work.

- spawn_peer starts a session on the caller's machine (directory and
  agent default to the caller's) and sends it a task.
- ping_peer gains waitForReply.
- In both cases the caller's CLI watches the peer and, when its turn
  ends, posts the peer's latest reply into the caller session, which
  starts the caller's next turn.

spawn_peer needs manual approval like ping_peer. No hub changes.

* refactor(peer): drop own spawn_peer; add waitForReply to upstream spawn_peer

Upstream #1922 ships spawn_peer (spawn, rename, remit delivery, fresh-child
wait, manual approval). Remove this PR's duplicate spawnPeer and keep only
reply forwarding: spawnPeer now returns the remit's ping-peer localId and
resolved flavor, and MCP spawn_peer/ping_peer share one waitForReply hook.
Add a steered-task attribution test.

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

* fix(peer): keep waiting for a task an offline peer has not read

The hub keeps unconsumed peer tasks for replay, so a peer that goes offline
before reading the task can still run it after a resume. Only a stop after
consumption ends the reply watch.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-09 12:33:20 +08:00
..