Feature hasn't been suggested before.
Describe the enhancement you want to request
Plugins currently can only observe completed text via experimental.text.complete. There is no way to monitor streaming content in real time, abort a stream mid-flight based on content rules, or retry with corrective instructions after an abort.
Proposed hooks:
stream.delta — fires on every text-delta, reasoning-delta, and tool-input-delta event. Plugins can observe the stream and optionally set abort: true to cancel it.
stream.aborted — fires after a stream is aborted by a delta hook. Plugins can decide whether to retry with optional corrective context injected into the conversation.
Use cases: content filtering, pattern detection, real-time monitoring, self-correcting agents.
I have a working implementation ready as a PR.
Feature hasn't been suggested before.
Describe the enhancement you want to request
Plugins currently can only observe completed text via
experimental.text.complete. There is no way to monitor streaming content in real time, abort a stream mid-flight based on content rules, or retry with corrective instructions after an abort.Proposed hooks:
stream.delta— fires on everytext-delta,reasoning-delta, andtool-input-deltaevent. Plugins can observe the stream and optionally setabort: trueto cancel it.stream.aborted— fires after a stream is aborted by a delta hook. Plugins can decide whether to retry with optional corrective context injected into the conversation.Use cases: content filtering, pattern detection, real-time monitoring, self-correcting agents.
I have a working implementation ready as a PR.