summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useToolScheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/hooks/useToolScheduler.ts')
-rw-r--r--packages/cli/src/ui/hooks/useToolScheduler.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/cli/src/ui/hooks/useToolScheduler.ts b/packages/cli/src/ui/hooks/useToolScheduler.ts
index e14241b6..8bcc0ae9 100644
--- a/packages/cli/src/ui/hooks/useToolScheduler.ts
+++ b/packages/cli/src/ui/hooks/useToolScheduler.ts
@@ -185,12 +185,19 @@ export function useToolScheduler(
useEffect(() => {
// effect for executing scheduled tool calls
if (toolCalls.every((t) => t.status === 'scheduled')) {
+ const signal = abortController.signal;
toolCalls.forEach((c) => {
const callId = c.request.callId;
setToolCalls(setStatus(c.request.callId, 'executing'));
c.tool
- .execute(c.request.args, abortController.signal)
+ .execute(c.request.args, signal)
.then((result) => {
+ if (signal.aborted) {
+ setToolCalls(
+ setStatus(callId, 'cancelled', 'Cancelled during execution'),
+ );
+ return;
+ }
const functionResponse: Part = {
functionResponse: {
name: c.request.name,