Skip to content

Add wait_for_signal callback support across examples - #10

Merged
matviychuk merged 1 commit into
mainfrom
feat/wait-for-signal-callback
May 11, 2026
Merged

Add wait_for_signal callback support across examples#10
matviychuk merged 1 commit into
mainfrom
feat/wait-for-signal-callback

Conversation

@matviychuk

@matviychuk matviychuk commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • README: documents the new wait_for_signal external signal flow — endpoint POST /api/v1/projects/{projectId}/callbacks/{tokenId}, auth scheme (Bearer {tokenId}:{secret}), three new SSE event types (awaiting_signal, signal_received, signal_timed_out), all response codes (SIGNAL_ALREADY_DELIVERED, SIGNAL_PAYLOAD_CONFLICT, SIGNAL_EXPIRED), and GET .../history persistence.
  • frontend/react-chat: handles the three new SSE events; shows a card when the session is paused (awaiting_signal) with token details, a secret input, a JSON payload editor, and a button that calls POST .../callbacks/{tokenId}; clears on signal_received / signal_timed_out.
  • scripts/bash-e2e: polls history for awaiting_signal alongside the existing confirm_plan_required check; auto-delivers the signal when PLANVAULT_SIGNAL_SECRET is set, otherwise prints a ready-to-run curl command.

Test plan

  • Run vitest run in frontend/react-chat — existing tests pass (no test-visible logic changed)
  • Manually open the React dev server, create a session with a scenario that uses wait_for_signal, confirm the new card appears on awaiting_signal SSE event and clears on signal_received
  • Run bash scripts/bash-e2e/script.sh against a project/scenario without wait_for_signal — behaviour unchanged (new branches not taken)
  • Run the bash script against a scenario that emits awaiting_signal; without PLANVAULT_SIGNAL_SECRET confirm the helper curl command is printed; with it set confirm the signal is auto-delivered and the session reaches done

Reflects the new external signal callback API added to the PlanVault
runtime (POST /api/v1/projects/{projectId}/callbacks/{tokenId}):

- README: document the wait_for_signal flow, three new SSE event types
  (awaiting_signal, signal_received, signal_timed_out), auth scheme,
  idempotency codes, and response status codes.
- react-chat: handle awaiting_signal/signal_received/signal_timed_out
  SSE events; add delivery UI with secret input, JSON payload editor,
  and POST .../callbacks/{tokenId} call.
- bash-e2e: detect awaiting_signal in history poll; auto-deliver when
  PLANVAULT_SIGNAL_SECRET is set, otherwise print example curl command.

Co-authored-by: Cursor <cursoragent@cursor.com>
@matviychuk
matviychuk merged commit c868dc2 into main May 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant