Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.246 Home All releases olderv2.1.245 v2.1.247newer
Claude Code v2.1.246

Plugins can abort the current turn with $.turn.abort

Use it now
Useful3 Signal4
Plugins Notable not in their notes

Plugins get a new turn object whose abort verb ends the running turn with its own interrupt wording.

$.turn.abort
What

Plugin function hooks can now end the turn in progress through a new turn object on the plugin API surface, sitting alongside the existing tool, agent, fs, store and clock objects. Any tool call still running when the abort lands comes back as the synthetic result "[Request interrupted by a plugin for tool use]", which is distinct from the wording used when a person rejects a tool. Its only verb is abort, and it needs the turn id that the plugin was handed when the turn began.

Details
  • turn.start now carries a turn id and an abort callback, and a hook passes that id back as $.turn.abort({ turnId }); calling it without the id rejects with an error.
  • The interrupted tool result is recorded with denial kind interrupted, not the user-rejected kind.
  • The turn's controller is aborted with a new cancellation reason, turn-abort, which is included in the sets that treat an interruption as user-initiated.
  • Misuse produces $.turn.abort: no turn is running or $.turn.abort: <id> is already ending.
  • Rate limited to one abort per 2000ms per plugin and 50 aborts per session.
  • The turn object is registered unconditionally for any plugin using function hooks, with no feature gate around it; a separate helper restricts a differently named object, flag, to internal builds only, so that one is present but off in this build.
Evidence

[Request interrupted by a plugin for tool use], $.turn.abort takes { turnId } (the id turn.start carried)

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

See this entry in the whole of v2.1.246 →