feat(web): expose Pi-native turn cancellation - #358
Open
seekskyworld wants to merge 2 commits into
Open
Conversation
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Implements the first runtime slice of #342. The Web host had no per-turn cancellation endpoint and could only abort sessions during host disposal.
Value
A browser client can request cancellation without tearing down unrelated Web runtime state, while stale Session requests are rejected.
Approach
Add an optional
interruptTurncontroller seam backed by PiAgentSession.abort(). Bind the request to the active Session id, returncancelledoralready_settled, emit a cancellation event, and exposePOST /api/prompt/cancel. Existing test doubles remain compatible through the optional interface member.Validation
npx tsc --noEmitnode --test --experimental-strip-types tests/web/pi-runtime.test.ts tests/web/web-host.test.ts(39 passed)git diff --checkImpact