fix(core): close turn cancellation contract gaps

This commit is contained in:
Tianyi Cui
2026-07-21 12:14:53 +08:00
parent 81cdebc531
commit c6e1d35a99
23 changed files with 185 additions and 168 deletions

View File

@@ -20,12 +20,12 @@ export class TurnCancellation {
/**
* Abort the turn once.
* @param reason - a validated caller cause or lifecycle disposal marker.
* @param reason - a typed caller cause or lifecycle disposal marker.
* @returns whether this request established the signal reason.
*/
request(reason: AgentCancelCause | typeof DISPOSED_INTERRUPT_REASON): boolean {
if (this.signal.aborted) return false
this.#controller.abort(reason)
this.#controller.abort(Object.freeze({ kind: reason.kind }))
return true
}
}