feat(core): make turn cancellation explicit

This commit is contained in:
Yichen Jiang
2026-07-16 18:14:13 +08:00
parent b1e19d8b69
commit c238992fbb
55 files changed
+884 -383

No files matched your search

+4 -1
View File
@@ -254,10 +254,13 @@ interface TurnTriggerMap {
## Why a turn ended: `TurnEndReasonMap`
`aborted` is intentionally a coarse durable outcome: it records that cancellation interrupted the live turn, not which runtime caller requested it. The runtime-only caller vocabulary belongs to [`AgentCancelCause`](core.md#the-agent-handle); a future audit requirement would use a separate control-request event rather than overloading the terminal result.
```ts type-equiv
interface TurnEndReasonMap {
completed: { kind: 'completed' }
aborted: { kind: 'aborted'; reason?: string }
/** A cancellation request interrupted the live turn. */
aborted: { kind: 'aborted' }
/**
* The turn failed: a step threw or the model reported a failure. `step` is the
* step number the failure occurred on (the operational error's location — the