[Agent] Add support for speech streaming / interruption#1984
Open
Guikingone wants to merge 1 commit into
Open
Conversation
ed68d91 to
14e9d9c
Compare
485782d to
3009ef7
Compare
Adds InterruptionSignal/InterruptionSignalInterface and integrates cooperative checks at phase boundaries in Agent, MultiAgent, SpeechAgent via the new InterruptibleTrait. Introduces SpeechSession to manage signals and cancel previous in-flight results across successive calls. Makes Chat transactional (cloned MessageBag) so interruptions don't pollute the store. For streaming TTS, SpeechAgent attaches an InterruptionStreamListener to the returned StreamResult so the signal is observed between deltas too, not only at coarse phase boundaries. SpeechConfiguration grows a `ttsStream` flag (and `shouldStreamTextToSpeech()` accessor) that propagates `stream: true` to the TTS bridge. Pulls in the cancellation primitives the feature relies on: CancellableInterface, StreamResult::cancel()/isCancelled() honouring the cancelled flag inside the generator loop and Event::stop() requests, and RawHttpResult::cancel() forwarding to the underlying ResponseInterface::cancel(). DeferredResult implements CancellableInterface and cascades cancellation to raw and converted results, throwing CancelledResultException on access after cancel. ai-bundle exposes the SpeechSession decorator via `speech.session: true` on agent configuration. Drive-by: refactor the Schema enum-guard to use foreach + gettype() instead of a chained is_int/is_float/is_string closure, removing the stale `@phpstan-ignore` directive that PHPStan 2.x no longer matched.
3009ef7 to
175c076
Compare
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.
Uh oh!
There was an error while loading. Please reload this page.