fix: expose abort signal to extensions closes #2660

This commit is contained in:
Mario Zechner
2026-03-28 22:25:06 +01:00
parent e773527b3a
commit 7d4faa080d
10 changed files with 76 additions and 0 deletions

View File

@@ -2,6 +2,10 @@
## [Unreleased]
### Added
- Added `Agent.signal` to expose the active abort signal for the current turn, allowing callers to forward cancellation into nested async work ([#2660](https://github.com/badlogic/pi-mono/issues/2660))
## [0.63.1] - 2026-03-27
## [0.63.0] - 2026-03-27

View File

@@ -371,6 +371,11 @@ export class Agent {
this._state.messages = [];
}
/** The current abort signal, or undefined when the agent is not streaming. */
get signal(): AbortSignal | undefined {
return this.abortController?.signal;
}
abort() {
this.abortController?.abort();
}