Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(runtime): interrupt safe tools when steering

Linuxdazhao61b1152889fd
diff --git a/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx b/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx
index 254c9d1d4..58cc64a5e 100644
--- a/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx
+++ b/apps/desktop/src/features/chat/transcript/ActivityGroup.tsx
@@ -120,6 +120,8 @@ export function runActivityLabel(
return t("chat.waitingForModel");
case "preparing":
return t("chat.preparingNextRequest");
+ case "waiting-tool-stop":
+ return t("chat.waitingForToolStop");
case "compacting":
return t("chat.compactingContext");
case "recovering":
diff --git a/apps/desktop/src/features/chat/transcript/TurnProcess.tsx b/apps/desktop/src/features/chat/transcript/TurnProcess.tsx
index eaccb09de..3b35ba130 100644
--- a/apps/desktop/src/features/chat/transcript/TurnProcess.tsx
+++ b/apps/desktop/src/features/chat/transcript/TurnProcess.tsx
@@ -36,6 +36,7 @@ const LIVE_PHASE_KEYS: Partial<Record<AgentActivity["phase"], string>> = {
compacting: "chat.compactingContext",
recovering: "chat.recoveringTurn",
retrying: "chat.processRunning",
+ "waiting-tool-stop": "chat.waitingForToolStop",
"waiting-subagents": "chat.processRunning",
};
diff --git a/docs/adr/active-turn-steering.md b/docs/adr/active-turn-steering.md
index b7809b2f3..9051ca468 100644
--- a/docs/adr/active-turn-steering.md
+++ b/docs/adr/active-turn-steering.md
@@ -19,10 +19,13 @@ optimistic input and restores rejected drafts. The agent IPC handler reuses
attachment validation against the running model and workspace; the sidecar
rechecks the target after asynchronous preparation and calls `Agent.steer`.
-Steering keeps the active configuration and durable turn. Started tools finish
-before the next model request consumes input, except `TaskWait`, which yields
-to accepted user input without canceling its delegates (issue #1607). The
-runtime handles admission at its closing boundary and while awaiting delegates.
+Steering keeps the active configuration and durable turn. Local foreground
+shell and read calls receive cancellation; the runtime waits for their results
+before the next request, without the normal Stop grace timeout. An unconfirmed
+shell lifecycle failure remains pending until Stop. Remote and other operations
+continue to settlement. Calls not yet started are skipped. `TaskWait` yields
+without canceling its delegates (issue #1607); background commands keep running.
+The runtime handles admission at its closing boundary and while awaiting delegates.
Stop closes admission
and retains accepted input as history without independently replaying it.
diff --git a/docs/adr/steering-local-tool-interruption.md b/docs/adr/steering-local-tool-interruption.md
new file mode 100644
index 000000000..b8fc899d7
--- /dev/null
+++ b/docs/adr/steering-local-tool-interruption.md
@@ -0,0 +1,26 @@
+# Steering waits for confirmed tool settlement
+
+- Status: Accepted
+- Date: 2026-11-06
+- Supersedes: started-tool behavior in ADR active-turn-steering
+- Issue: https://github.com/vastsa/PI-Desktop/issues/2131
+
+## Decision
+
+Accepted steering requests cancellation of local foreground Bash and read
+operations owned by the current turn. The model receives the input only after
+the operations settle; steering does not use Stop's bounded grace period.
+Unstarted calls are skipped and their batch reservations are released.
+TaskWait yields while delegates continue, and background commands are retained.
+
+Remote workspace calls cannot acknowledge remote settlement through their
+existing abort path, so steering does not cancel them. Other started operations
+settle normally. A shell lifecycle failure, remote failure, or uncertain external
+timeout does not prove settlement and waits for explicit Stop. The UI reports the
+pending operation. Already completed work is not rolled back.
+
+## Consequences
+
+A hung or unreachable Host may still require Stop. Steering retains the same
+turn, model, workspace and permissions, and never starts an independent turn.
+The Host's existing cancellation and process ownership remain authoritative.
diff --git a/docs/spec/03-runtime/01-ipc-protocol.md b/docs/spec/03-runtime/01-ipc-protocol.md
index 890f2e366..04b55b635 100644
--- a/docs/spec/03-runtime/01-ipc-protocol.md
+++ b/docs/spec/03-runtime/01-ipc-protocol.md
@@ -284,6 +284,11 @@ existing runtime. They do not run launch configuration, `runtimeFor`, or
`session.beginTurn`. Steering cannot change the active model, permission mode,
workspace, or approved execution. Slash text is literal input on this channel.
+After accepted steering, status activity may be `waiting-tool-stop` while the
+current turn waits for a tool to settle. Local foreground shell and read calls
+receive cancellation; the activity does not assert that a process has exited.
+Remote or uncertain external operations retain their settlement fence.
+
Accepted input is echoed as ordinary user message events with the current
`turnId`, main-prepared attachment refs, and `UiMessage.steering: true`. This
persisted marker protects accepted input from Smart Stop after renderer reload.
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index d07429321..08e66b9c1 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -965,9 +965,9 @@ may be retained while exactly one workspace supplies the visible shell context.
with Saving tooltips and a Saving label on Send now; edit/remove leave both
the queue and composer draft unchanged.
- Send now promotes its row in click order and asks the Host to deliver it as
- steering input into the active turn. It does not request a stop. An active
- `TaskWait` returns early so the parent handles the new input while its
- delegates keep working. Other started tools retain their normal boundaries.
+ steering input into the active turn. Local foreground shell and read calls
+ receive cancellation; an active `TaskWait` returns without stopping delegates.
+ The turn waits for tool settlement before delivering the input.
An idle Send now dispatches immediately. Refused input or an input admitted
under a different permission mode stays queued for the next turn. Promoted
rows retain Remove until delivery and show Waiting to send. Removal
@@ -999,8 +999,10 @@ may be retained while exactly one workspace supplies the visible shell context.
- `Shift+Enter` and `Alt+Shift+Enter` insert a newline. An Enter confirming an
IME candidate (`isComposing` or key code 229) never sends or steers.
- Steering appears as a user message in the current transcript, clears the
- draft immediately, and reaches the next model request after the current
- response/tool batch. It creates no FIFO row and does not interrupt tools.
+ draft immediately, and reaches the next model request after current operations
+ settle. It creates no FIFO row. Local foreground shell and read calls receive
+ cancellation; background commands and delegates continue. Other operations
+ settle normally. Show a waiting status while a tool remains active.
- Submission captures the session and current turn identity. If that target
ends, rejects input, or is awaiting approval, the draft is restored in its
own session and a concise error is shown. New text typed after submission
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 7a36ba428..6eaa220e0 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -17315,6 +17315,12 @@ plugin-form fixtures in an isolated temporary directory at runtime.
#### E2E-AGENT-alt-enter-steers-active-turn: Enter follows up and Alt+Enter steers the active turn
+Steer a long-running local foreground command. Verify cancellation, partial
+output and the waiting status, and require confirmed settlement before the next
+model request. Repeat with delayed settlement beyond the Stop grace period, an
+unconfirmed shell failure, a remote tool, parallel and queued calls, a background
+command, a delegate, and an explicit Stop. Accepted input is delivered once.
+
- **Preconditions**: A session with a configured model and a controllable
streaming response/tool; an image-capable model for the attachment case.
- **Steps**:
diff --git a/packages/agent-runtime/src/runtime.test.ts b/packages/agent-runtime/src/runtime.test.ts
index 1e6e76ef8..3c97ea793 100644
--- a/packages/agent-runtime/src/runtime.test.ts
+++ b/packages/agent-runtime/src/runtime.test.ts
@@ -10245,6 +10245,184 @@ describe("DesktopAgentRuntime subagents", () => {
},
);
+ it("waits for a steered Bash call to settle before requesting the next model response", async () => {
+ let finish!: (value: unknown) => void;
+ const host = { call: vi.fn((method: string) => {
+ if (method === "tools.execute") return new Promise((resolve) => { finish = resolve; });
+ return Promise.resolve({ ok: true });
+ }) };
+ const requests: AgentMessage[][] = [];
+ const runtime = createRuntime({ host });
+ (runtime as any).models = { streamSimple: scriptedStream([
+ [{ type: "toolCall", id: "long-bash", name: "Bash", arguments: { command: "sleep 600" } }],
+ ], requests) };
+ const running = runtime.prompt("Run the command", "initial-user", "active-turn");
+ try {
+ await vi.waitFor(() => expect(finish).toBeDefined());
+ runtime.steer({ text: "Change direction" }, "active-turn", {
+ id: "steer-user", role: "user", content: "Change direction", createdAt: new Date().toISOString(), steering: true,
+ });
+ await vi.waitFor(() => expect(host.call).toHaveBeenCalledWith("tools.abort", expect.objectContaining({ toolCallId: "long-bash" })));
+ runtime.steer({ text: "Another constraint" }, "active-turn", {
+ id: "steer-user-2", role: "user", content: "Another constraint", createdAt: new Date().toISOString(), steering: true,
+ });
+ expect(host.call.mock.calls.filter(([method]) => method === "tools.abort")).toHaveLength(1);
+ vi.useFakeTimers();
+ await vi.advanceTimersByTimeAsync(11_000);
+ expect(requests).toHaveLength(1);
+ finish({ ok: false, content: "Interrupted", errorCode: "TOOL_ABORTED" });
+ vi.useRealTimers();
+ await running;
+ expect(requests).toHaveLength(2);
+ expect(JSON.stringify(requests[1])).toContain("Change direction");
+ expect(requests[1].filter((message) => message.role === "user" && JSON.stringify(message.content).includes("Another constraint"))).toHaveLength(1);
+ } finally {
+ vi.useRealTimers();
+ finish?.({ ok: false, content: "Stopped" });
+ await runtime.abort();
+ await running;
+ await runtime.dispose();
+ }
+ });
+
+ it.each(["remote", "background"] as const)("does not cancel a %s command on steering", async (kind) => {
+ let finish!: (value: unknown) => void;
+ const host = { call: vi.fn((method: string) => method === "tools.execute"
+ ? new Promise((resolve) => { finish = resolve; }) : Promise.resolve({ ok: true })) };
+ const requests: AgentMessage[][] = [];
+ const runtime = createRuntime({ host, ...(kind === "remote" ? { remoteWorkspace: { hostKey: "ssh", path: "/remote" } } : {}) });
+ (runtime as any).models = { streamSimple: scriptedStream([[
+ { type: "toolCall", id: "keep-running", name: "Bash", arguments: { command: "sleep 600", ...(kind === "background" ? { runInBackground: true } : {}) } },
+ ]], requests) };
+ const running = runtime.prompt("Run command", "initial-user", "active-turn");
+ try {
+ await vi.waitFor(() => expect(finish).toBeDefined());
+ runtime.steer({ text: "Change direction" }, "active-turn", {
+ id: "steer-user", role: "user", content: "Change direction", createdAt: new Date().toISOString(), steering: true,
+ });
+ expect(host.call.mock.calls.some(([method]) => method === "tools.abort")).toBe(false);
+ expect(runtime.getStatus().activity?.phase).toBe("waiting-tool-stop");
+ expect(requests).toHaveLength(1);
+ finish({ ok: true, content: "done" });
+ await running;
+ expect(JSON.stringify(requests[1])).toContain("Change direction");
+ } finally {
+ finish?.({ ok: false, content: "Stopped" });
+ await runtime.abort();
+ await running;
+ await runtime.dispose();
+ }
+ });
+
+ it.each(["local", "remote"] as const)("waits for Stop when a %s shell reports an unconfirmed failure", async (kind) => {
+ let finish!: (value: unknown) => void;
+ const host = { call: vi.fn((method: string) => method === "tools.execute"
+ ? new Promise((resolve) => { finish = resolve; }) : Promise.resolve({ ok: true })) };
+ const requests: AgentMessage[][] = [];
+ const runtime = createRuntime({ host, ...(kind === "remote" ? { remoteWorkspace: { hostKey: "ssh", path: "/remote" } } : {}) });
+ (runtime as any).models = { streamSimple: scriptedStream([[
+ { type: "toolCall", id: "uncertain", name: "Bash", arguments: { command: "sleep 600" } },
+ ]], requests) };
+ const running = runtime.prompt("Run command", "initial-user", "active-turn");
+ try {
+ await vi.waitFor(() => expect(finish).toBeDefined());
+ runtime.steer({ text: "Change direction" }, "active-turn", {
+ id: "steer-user", role: "user", content: "Change direction", createdAt: new Date().toISOString(), steering: true,
+ });
+ finish({ ok: false, content: "lifecycle failed", errorCode: "TOOL_FAILED" });
+ await new Promise((resolve) => setTimeout(resolve, 20));
+ expect(requests).toHaveLength(1);
+ await runtime.abort();
+ await running;
+ expect(requests).toHaveLength(1);
+ } finally {
+ finish?.({ ok: false, content: "Stopped" });
+ await runtime.abort();
+ await running;
+ await runtime.dispose();
+ }
+ });
+
+ it("skips a write when steering arrives during tool preparation", async () => {
+ let finishPreparation!: (value: unknown) => void;
+ const host = { call: vi.fn((method: string) => method === "project.instructions.resolve"
+ ? new Promise((resolve) => { finishPreparation = resolve; }) : Promise.resolve({ ok: true })) };
+ const requests: AgentMessage[][] = [];
+ const runtime = createRuntime({ host, projectPath: "/root" });
+ (runtime as any).models = { streamSimple: scriptedStream([[
+ { type: "toolCall", id: "prepared-write", name: "Write", arguments: { path: "file.txt", content: "new" } },
+ ]], requests) };
+ const running = runtime.prompt("Write file", "initial-user", "active-turn");
+ try {
+ await vi.waitFor(() => expect(finishPreparation).toBeDefined());
+ runtime.steer({ text: "Do not write" }, "active-turn", {
+ id: "steer-user", role: "user", content: "Do not write", createdAt: new Date().toISOString(), steering: true,
+ });
+ finishPreparation({ entries: [] });
+ await running;
+ expect(host.call.mock.calls.some(([method]) => method === "tools.execute")).toBe(false);
+ expect(JSON.stringify(requests[1])).toContain("Do not write");
+ } finally {
+ finishPreparation?.({ entries: [] });
+ await runtime.abort();
+ await running;
+ await runtime.dispose();
+ }
+ });
+
+ it("settles each parallel read before delivering steering", async () => {
+ const fixture = gatedHost();
+ const requests: AgentMessage[][] = [];
+ const runtime = createRuntime({ host: fixture.host });
+ (runtime as any).models = { streamSimple: scriptedStream([[
+ { type: "toolCall", id: "read-a", name: "Read", arguments: { path: "a.txt" } },
+ { type: "toolCall", id: "read-b", name: "Read", arguments: { path: "b.txt" } },
+ ]], requests) };
+ const running = runtime.prompt("Read files", "initial-user", "active-turn");
+ try {
+ await vi.waitFor(() => expect(fixture.entered).toEqual(["read-a", "read-b"]));
+ runtime.steer({ text: "Change direction" }, "active-turn", {
+ id: "steer-user", role: "user", content: "Change direction", createdAt: new Date().toISOString(), steering: true,
+ });
+ await running;
+ const aborted = fixture.host.call.mock.calls.filter(([method]) => method === "tools.abort");
+ expect(aborted.map(([, args]) => args.toolCallId).sort()).toEqual(["read-a", "read-b"]);
+ expect(toolResults(requests[1]).map((result) => result.id)).toEqual(["read-a", "read-b"]);
+ expect(JSON.stringify(requests[1])).toContain("Change direction");
+ } finally {
+ fixture.drain();
+ await runtime.abort();
+ await running;
+ await runtime.dispose();
+ }
+ });
+
+ it("does not start later sequential tools after steering", async () => {
+ const fixture = gatedHost();
+ const requests: AgentMessage[][] = [];
+ const runtime = createRuntime({ host: fixture.host });
+ (runtime as any).models = { streamSimple: scriptedStream([[
+ { type: "toolCall", id: "first", name: "Bash", arguments: { command: "sleep 600" } },
+ { type: "toolCall", id: "second", name: "Bash", arguments: { command: "echo unexpected" } },
+ ]], requests) };
+ const running = runtime.prompt("Run commands", "initial-user", "active-turn");
+ try {
+ await vi.waitFor(() => expect(fixture.entered).toEqual(["first"]));
+ runtime.steer({ text: "Change direction" }, "active-turn", {
+ id: "steer-user", role: "user", content: "Change direction", createdAt: new Date().toISOString(), steering: true,
+ });
+ await running;
+ expect(fixture.entered).toEqual(["first"]);
+ expect(JSON.stringify(requests[1])).toContain("Skipped because new user input is waiting");
+ expect(JSON.stringify(requests[1])).toContain("Change direction");
+ } finally {
+ fixture.drain();
+ await runtime.abort();
+ await running;
+ await runtime.dispose();
+ }
+ });
+
it.each(["during", "before"] as const)("handles steering %s TaskWait while its delegate continues running", async (timing) => {
subagentRuns.calls.length = 0;
subagentRuns.instances.length = 0;
diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.ts
index 379630f24..245e63876 100644
--- a/packages/agent-runtime/src/runtime.ts
+++ b/packages/agent-runtime/src/runtime.ts
@@ -2030,6 +2030,7 @@ export class DesktopAgentRuntime {
* signal it was handed never fires, or the stop RPC stays pending forever.
*/
private activeToolAborts = new Set<() => void>();
+ private readonly steeringToolAborts = new Map<string, () => void>();
private hostCloseUnsubscribe?: () => void;
private turnSubagentUsage?: MessageUsage;
private compactionRequestShape?: CompactionRequestShape;
@@ -2631,6 +2632,9 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
private async beforeToolCall(
context: BeforeToolCallContext,
): Promise<BeforeToolCallResult | undefined> {
+ if (this.pendingSteering.size && context.toolCall.name !== SUBAGENT_WAIT_TOOL_NAME) {
+ return { block: true, reason: "Skipped because new user input is waiting." };
+ }
if (this.deferredToolNames.has(context.toolCall.name) && !this.activeDeferredToolNames.has(context.toolCall.name)) {
return { block: true, reason: `Call ${TOOL_SEARCH_NAME} to activate ${context.toolCall.name} before using it. A tool declaration does not grant execution permission.` };
}
@@ -3554,6 +3558,14 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
});
let abortGraceTimer: ReturnType<typeof setTimeout> | undefined;
let stopped = false;
+ let steeringAbortRequested = false;
+ const steeringAbort = () => {
+ if (steeringAbortRequested || settled) return;
+ steeringAbortRequested = true;
+ void this.host.call("tools.abort", {
+ sessionId: this.sessionId, toolCallId, toolName,
+ }).catch(() => undefined);
+ };
const abort = () => {
if (abortRequested || settled) return;
abortRequested = true;
@@ -3596,6 +3608,7 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
signal?.removeEventListener("abort", abort);
this.activeToolProgressCleanups.delete(cleanup);
this.activeToolAborts.delete(abort);
+ this.steeringToolAborts.delete(toolCallId);
};
this.activeToolProgressCleanups.add(cleanup);
if (signal?.aborted) {
@@ -3608,6 +3621,14 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
signal.addEventListener("abort", abort, { once: true });
}
this.activeToolAborts.add(abort);
+ // Remote cancellation only acknowledges the request, not the remote
+ // operation's settlement. Keep waiting for those calls instead.
+ if (!this.remoteWorkspace && (isBash || canAbandonWait) &&
+ this.activeToolCalls.has(toolCallId) && !this.delegateToolCalls.has(toolCallId) &&
+ !(isBash && isRecord(params) && params.runInBackground === true)) {
+ this.steeringToolAborts.set(toolCallId, steeringAbort);
+ if (this.pendingSteering.size) steeringAbort();
+ }
let result: {
ok: boolean;
@@ -3691,6 +3712,21 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
// it armed is released here instead.
if (abortGraceTimer) clearTimeout(abortGraceTimer);
}
+ // A failed transport or process-lifecycle result does not prove that
+ // the interrupted shell and its descendants have stopped. Only an
+ // explicit whole-turn Stop may release this uncertain operation.
+ const uncertainShell = steeringAbortRequested && isBash &&
+ (executionFailed || (result?.ok === false && result.errorCode === "TOOL_FAILED"));
+ const uncertainRemote = this.pendingSteering.size > 0 && Boolean(this.remoteWorkspace) &&
+ (executionFailed || result?.ok === false);
+ const uncertainExternal = this.pendingSteering.size > 0 && !canAbandonWait && !isBash &&
+ (executionFailed || result?.errorCode === "TOOL_TIMEOUT");
+ if (!signal?.aborted && (uncertainShell || uncertainRemote || uncertainExternal)) {
+ await new Promise<void>((resolve) => {
+ if (!signal || signal.aborted) return resolve();
+ signal.addEventListener("abort", () => resolve(), { once: true });
+ });
+ }
// A local read-only stop cannot depend on the same Host answering a
// second RPC. Its abort request already observes late rejections.
// Other tools retain Host settlement ownership for their side effects.
@@ -4124,6 +4160,16 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
* declarations. Execution activation and Host permissions remain separate
* from the provider-visible schemas.
*/
+ private guardSteeredTool(tool: AgentTool): AgentTool {
+ return { ...tool, execute: async (id, args, signal, update) => {
+ if (tool.name !== SUBAGENT_WAIT_TOOL_NAME && this.pendingSteering.size &&
+ this.activeToolCalls.has(id) && !this.delegateToolCalls.has(id)) {
+ return { content: [{ type: "text", text: "Skipped because new user input is waiting." }], details: {}, isError: true };
+ }
+ return tool.execute(id, args, signal, update);
+ } };
+ }
+
private rebuildToolCatalog(): void {
const catalog = new Map<string, AgentTool>();
for (const tool of this.buildToolDefinitions()) {
@@ -4147,8 +4193,9 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
);
// Batch ordering wraps the mode guard: a call the guard rejects must
// still release the calls ordered behind it in its batch.
+ const steeringGuarded = this.guardSteeredTool(guarded);
const catalogTool = withDynamicTaskExecutionMode(
- builtin && TOOL_EXECUTION_SPECS[tool.name]?.file ? withBatchTurn(guarded, this.batchPlanner) : guarded,
+ builtin && TOOL_EXECUTION_SPECS[tool.name]?.file ? withBatchTurn(steeringGuarded, this.batchPlanner) : steeringGuarded,
() => this.agent?.state.messages.at(-1),
);
if (builtin) this.builtinTools.add(catalogTool);
@@ -4168,10 +4215,10 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
if (this.deferredToolNames.size > 0) {
this.toolCatalog.set(
TOOL_SEARCH_NAME,
- withExplicitRequired({
+ this.guardSteeredTool(withExplicitRequired({
...this.buildToolSearchTool(),
executionMode: "sequential",
- }),
+ })),
);
}
if (this.model) this.refreshToolDeclarationPolicy();
@@ -9387,6 +9434,10 @@ Do not invent objections or turn speculative risks into blockers. Stop when the
this.pendingSteering.set(queued, { id: message.id, toolNames });
this.agent.steer(queued);
this.steeringWaitAbort?.abort();
+ for (const abortTool of this.steeringToolAborts.values()) abortTool();
+ if ([...this.activeToolCalls.values()].some((call) => call.toolName !== SUBAGENT_WAIT_TOOL_NAME)) {
+ this.setAgentActivity({ phase: "waiting-tool-stop", since: Date.now() });
+ }
// Main persists this echo through the same outbox as assistant messages.
this.emit({ type: "message_start", message });
this.emit({
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 97a1eb828..f0806ab64 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -651,6 +651,7 @@ export const de = {
"processFailedFor": "Fehlgeschlagen nach {{time}}",
"waitingForModel": "Warten auf Modell",
"startingTurn": "Wird gestartet…",
+ "waitingForToolStop": "Warten, bis der aktuelle Vorgang beendet ist…",
"preparingNextRequest": "Nächste Anfrage wird vorbereitet…",
"compactingContext": "Kontext wird verdichtet…",
"recoveringTurn": "Leere Antwort wird nachgeholt…",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index d2fca3307..4743cd296 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -663,6 +663,7 @@ export const en = {
processFailedFor: "Failed after {{time}}",
waitingForModel: "Waiting for model",
startingTurn: "Starting…",
+ waitingForToolStop: "Waiting for the current operation to finish…",
preparingNextRequest: "Preparing next request…",
compactingContext: "Compacting context…",
recoveringTurn: "Recovering empty response…",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index dbcbcfa2a..e747c878c 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -651,6 +651,7 @@ export const es = {
"processFailedFor": "Fallido tras {{time}}",
"waitingForModel": "Esperando modelo",
"startingTurn": "Iniciando…",
+ "waitingForToolStop": "Esperando a que se detenga la operación actual…",
"preparingNextRequest": "Preparando la siguiente solicitud…",
"compactingContext": "Compactando contexto…",
"recoveringTurn": "Recuperando respuesta vacía…",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 08e46c617..16bbea784 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -651,6 +651,7 @@ export const fr = {
"processFailedFor": "Échec après {{time}}",
"waitingForModel": "En attente du modèle",
"startingTurn": "Démarrage…",
+ "waitingForToolStop": "En attente de l’arrêt de l’opération en cours…",
"preparingNextRequest": "Préparation de la prochaine requête…",
"compactingContext": "Compactage du contexte…",
"recoveringTurn": "Récupération d’une réponse vide…",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 35056275d..cfa871882 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -660,6 +660,7 @@ export const ko = {
processFailedFor: "실패, {{time}}",
waitingForModel: "모델 대기 중",
startingTurn: "시작하는 중…",
+ waitingForToolStop: "현재 작업이 중지되기를 기다리는 중…",
preparingNextRequest: "다음 요청 준비 중…",
compactingContext: "컨텍스트 압축 중…",
recoveringTurn: "빈 응답 복구 중…",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index 4a8e6a49b..45397fff1 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -650,6 +650,7 @@ export const ptBR = {
processFailedFor: "Falhou após {{time}}",
waitingForModel: "Aguardando o modelo…",
startingTurn: "Iniciando…",
+ waitingForToolStop: "Aguardando a operação atual parar…",
preparingNextRequest: "Preparando próxima solicitação…",
compactingContext: "Compactando contexto…",
recoveringTurn: "Recuperando resposta vazia…",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index f72a7d3ea..25f3076c4 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -660,6 +660,7 @@ export const tr = {
processFailedFor: "{{time}} sonra başarısız",
waitingForModel: "Model bekleniyor",
startingTurn: "Başlatılıyor…",
+ waitingForToolStop: "Geçerli işlemin durması bekleniyor…",
preparingNextRequest: "Sonraki istek hazırlanıyor…",
compactingContext: "Bağlam sıkıştırılıyor…",
recoveringTurn: "Boş yanıt kurtarılıyor…",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 8120b7f08..761053fb6 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -656,6 +656,7 @@ export const zhCN = {
processFailedFor: "失败,{{time}}",
waitingForModel: "等待模型响应",
startingTurn: "正在开始…",
+ waitingForToolStop: "正在等待当前操作结束…",
preparingNextRequest: "正在准备下一次请求…",
compactingContext: "正在压缩上下文…",
recoveringTurn: "正在补救空回复…",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 2c3bb6d5b..a64430656 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -656,6 +656,7 @@ export const zhTW = {
processFailedFor: "失敗,{{time}}",
waitingForModel: "等待模型響應",
startingTurn: "正在開始…",
+ waitingForToolStop: "正在等待目前操作停止…",
preparingNextRequest: "正在準備下一次請求…",
compactingContext: "正在壓縮上下文…",
recoveringTurn: "正在補救空回覆…",
diff --git a/packages/shared/src/types/sessions.ts b/packages/shared/src/types/sessions.ts
index c4cb04bf4..63cce096e 100644
--- a/packages/shared/src/types/sessions.ts
+++ b/packages/shared/src/types/sessions.ts
@@ -210,6 +210,7 @@ export type AgentActivity =
| { phase: "starting"; since: number }
| { phase: "waiting-model"; since: number }
| { phase: "preparing"; since: number }
+ | { phase: "waiting-tool-stop"; since: number }
| {
phase: "compacting";
since: number;