fix(plugin): forward Promise tool cancellation (#50190)

This commit is contained in:
Aiden Cline
2026-09-20 11:22:49 -05:00
committed by GitHub
Unverified
parent 6238af397e
commit e3a3fa7108
4 changed files with 74 additions and 6 deletions
@@ -927,6 +927,16 @@ const registration = await ctx.tool.transform((editor) => {
})
```
Promise tool executors receive `tool.signal`. Pass it to cancellable work such as `fetch` so stopping the Session also
stops the underlying operation.
```ts
execute: async ({ url }, tool) => {
const response = await fetch(url, { signal: tool.signal })
return { content: await response.text() }
}
```
Call `reload()` after changing source data captured by the callback. Reload replays the active transforms without
changing their order; it does not rerun plugin setup.