You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/23 12:00:56 UTC

(maka) branch main updated: fix(ui): localize client capability recovery (#3588)

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/main by this push:
     new efddab2fb fix(ui): localize client capability recovery (#3588)
efddab2fb is described below

commit efddab2fbb15c5e34472cb88770605ee77bb9d24
Author: Haoqing Wang <78...@users.noreply.github.com>
AuthorDate: Sun Aug 23 20:00:51 2026 +0800

    fix(ui): localize client capability recovery (#3588)
    
    * fix(ui): localize client capability recovery
    
    * chore(cli): restore ASF source headers
---
 .../app-shell-session-settings-actions.test.ts     |  51 +++++++++++++-
 .../src/renderer/app-shell-command-actions.ts      |   6 +-
 .../renderer/app-shell-session-settings-actions.ts |  16 +++--
 apps/desktop/src/renderer/app-shell.tsx            |  15 +++-
 docs/images/client-capability-bypass/after.png     | Bin 0 -> 31651 bytes
 docs/images/client-capability-bypass/before.png    | Bin 0 -> 50522 bytes
 .../__tests__/tool-result-record-schema.test.ts    |  16 +++++
 packages/core/src/events.ts                        |   1 +
 packages/core/src/tool-result-record-schema.ts     |   5 +-
 .../__tests__/pre-dispatch-refusal-ledger.test.ts  |  23 ++++++
 packages/runtime/src/tool-runtime.ts               |  12 +++-
 packages/ui/src/__tests__/materialize.test.ts      |  25 +++++++
 .../__tests__/tool-activity-presentation.test.ts   |  72 +++++++++++++++++++
 .../ui/src/__tests__/transcript-projection.test.ts |  31 ++++++++
 packages/ui/src/chat-turn.tsx                      |  23 +++++-
 packages/ui/src/chat-view.tsx                      |  19 ++++-
 packages/ui/src/conversation-copy.ts               |  15 ++++
 packages/ui/src/materialize.ts                     |  26 +++----
 packages/ui/src/styles.css                         |   3 +-
 packages/ui/src/tool-activity.tsx                  |  78 ++++++++++++++++++---
 packages/ui/src/tool-activity/copy.ts              |  30 ++++++++
 packages/ui/src/tool-activity/result-projection.ts |   6 ++
 .../ui/src/tool-activity/tool-result-preview.tsx   |   5 +-
 packages/ui/src/transcript-projection.ts           |  13 +++-
 packages/ui/stories/tool-activity.stories.tsx      |  35 +++++++++
 25 files changed, 483 insertions(+), 43 deletions(-)

diff --git a/apps/desktop/src/main/__tests__/app-shell-session-settings-actions.test.ts b/apps/desktop/src/main/__tests__/app-shell-session-settings-actions.test.ts
index c72853f28..63ff7460d 100644
--- a/apps/desktop/src/main/__tests__/app-shell-session-settings-actions.test.ts
+++ b/apps/desktop/src/main/__tests__/app-shell-session-settings-actions.test.ts
@@ -59,6 +59,7 @@ function createHarness(options: {
   confirm?: () => Promise<boolean>;
   connections?: LlmConnection[];
   messages?: StoredMessage[];
+  permissionModeResult?: 'ask' | 'bypass';
 } = {}) {
   const activeIdRef = { current: 'session-a' as string | undefined };
   const sessions = [session('session-a'), session('session-b')];
@@ -82,7 +83,10 @@ function createHarness(options: {
         sessions: {
           setPermissionMode: async (sessionId: string, mode: 'ask' | 'bypass') => {
             permissionCalls.push(`${sessionId}:${mode}`);
-            return { ...session(sessionId), permissionMode: mode };
+            return {
+              ...session(sessionId),
+              permissionMode: options.permissionModeResult ?? mode,
+            };
           },
           setModel: async (sessionId: string) => {
             modelCalls.push(sessionId);
@@ -138,6 +142,7 @@ function createHarness(options: {
     pending,
     pendingBySession,
     permissionCalls,
+    sessionsRef,
     thinkingCalls,
     thinkingResult,
     successes,
@@ -149,8 +154,9 @@ describe('AppShell session settings actions', () => {
     const harness = createHarness();
     harness.activeIdRef.current = undefined;
 
-    await harness.actions.setPermissionMode('bypass');
+    const switched = await harness.actions.setPermissionMode('bypass');
 
+    assert.equal(switched, true);
     assert.deepEqual(harness.newTaskPermissionModes, ['bypass']);
     assert.deepEqual(harness.permissionCalls, []);
   });
@@ -164,12 +170,51 @@ describe('AppShell session settings actions', () => {
       },
     });
 
-    await harness.actions.setPermissionMode('bypass');
+    const switched = await harness.actions.setPermissionMode('bypass');
 
+    assert.equal(switched, false);
     assert.equal(confirmations, 1);
     assert.deepEqual(harness.permissionCalls, []);
   });
 
+  it('reports a confirmed bypass switch as successful', async () => {
+    const harness = createHarness();
+
+    const switched = await harness.actions.setPermissionMode('bypass');
+
+    assert.equal(switched, true);
+    assert.deepEqual(harness.permissionCalls, ['session-a:bypass']);
+  });
+
+  it('does not report success when the Host returns another permission mode', async () => {
+    const harness = createHarness({ permissionModeResult: 'ask' });
+
+    const switched = await harness.actions.setPermissionMode('bypass');
+
+    assert.equal(switched, false);
+    assert.deepEqual(harness.permissionCalls, ['session-a:bypass']);
+  });
+
+  it('treats an already-active permission mode as successful without prompting', async () => {
+    let confirmations = 0;
+    const harness = createHarness({
+      confirm: async () => {
+        confirmations += 1;
+        return true;
+      },
+    });
+    harness.sessionsRef.current = [{
+      ...session('session-a'),
+      permissionMode: 'bypass',
+    }];
+
+    const switched = await harness.actions.setPermissionMode('bypass');
+
+    assert.equal(switched, true);
+    assert.equal(confirmations, 0);
+    assert.deepEqual(harness.permissionCalls, []);
+  });
+
   it('blocks a thinking-level mutation while the same session model mutation is pending', async () => {
     const harness = createHarness();
 
diff --git a/apps/desktop/src/renderer/app-shell-command-actions.ts b/apps/desktop/src/renderer/app-shell-command-actions.ts
index 1ea78b8dc..c2d3ae8b1 100644
--- a/apps/desktop/src/renderer/app-shell-command-actions.ts
+++ b/apps/desktop/src/renderer/app-shell-command-actions.ts
@@ -113,7 +113,7 @@ export interface AppShellCommandListOptions {
     input: DailyReviewMarkdownActionInput,
   ) => Promise<void>;
   setNavSelection: (selection: NavSelection) => void;
-  setPermissionMode: (mode: PermissionMode) => Promise<void>;
+  setPermissionMode: (mode: PermissionMode) => Promise<boolean>;
   setThemePref: (themePref: ThemePreference) => void;
   toastApi: ToastApi;
 }
@@ -334,7 +334,9 @@ export function buildAppShellCommandList(
       }
     },
     onSetPermissionMode: options.canSetPermissionMode
-      ? (mode) => optionsRef.current.setPermissionMode(mode)
+      ? async (mode) => {
+          await optionsRef.current.setPermissionMode(mode);
+        }
       : undefined,
     activePermissionMode: options.activePermissionMode,
     onCopyTodayDailyReview: async () => {
diff --git a/apps/desktop/src/renderer/app-shell-session-settings-actions.ts b/apps/desktop/src/renderer/app-shell-session-settings-actions.ts
index c27dc0c25..0c4f37d78 100644
--- a/apps/desktop/src/renderer/app-shell-session-settings-actions.ts
+++ b/apps/desktop/src/renderer/app-shell-session-settings-actions.ts
@@ -50,7 +50,7 @@ type ToastApi = {
 };
 
 export interface AppShellSessionSettingsActions {
-  setPermissionMode(mode: PermissionMode): Promise<void>;
+  setPermissionMode(mode: PermissionMode): Promise<boolean>;
   setSessionModel(input: { llmConnectionSlug: string; model: string }): Promise<void>;
   setSessionThinkingLevel(level: ThinkingLevel | undefined): Promise<void>;
 }
@@ -114,11 +114,15 @@ export function createAppShellSessionSettingsActions(deps: {
     return `${label} (${connection?.name ?? connectionSlug})`;
   }
 
-  async function setPermissionMode(mode: PermissionMode) {
-    if (mode !== 'ask' && mode !== 'bypass') return;
+  async function setPermissionMode(mode: PermissionMode): Promise<boolean> {
+    if (mode !== 'ask' && mode !== 'bypass') return false;
     const sessionId = activeIdRef.current;
+    const currentMode = sessionId
+      ? sessionsRef.current.find((session) => session.id === sessionId)?.permissionMode
+      : undefined;
+    if (currentMode === mode) return true;
     const pendingKey = sessionId ?? '__global_permission_mode__';
-    if (pendingPermissionModeChangesRef.current.has(pendingKey)) return;
+    if (pendingPermissionModeChangesRef.current.has(pendingKey)) return false;
     if (
       mode === 'bypass' &&
       !(await toastApi.confirm({
@@ -129,7 +133,7 @@ export function createAppShellSessionSettingsActions(deps: {
         destructive: true,
       }))
     ) {
-      return;
+      return false;
     }
 
     pendingPermissionModeChangesRef.current.add(pendingKey);
@@ -154,6 +158,7 @@ export function createAppShellSessionSettingsActions(deps: {
         copy.permissionDescriptions[nextMode],
       );
       if (sessionId) await refreshSessions();
+      return nextMode === mode;
     } catch (error) {
       toastApi.error(
         copy.permissionFailedTitle,
@@ -161,6 +166,7 @@ export function createAppShellSessionSettingsActions(deps: {
         undefined,
         sessionId ? { sessionId } : undefined,
       );
+      return false;
     } finally {
       pendingPermissionModeChangesRef.current.delete(pendingKey);
       if (sessionId) setPendingPermissionModeBySession((current) => omitSessionKey(current, sessionId));
diff --git a/apps/desktop/src/renderer/app-shell.tsx b/apps/desktop/src/renderer/app-shell.tsx
index 70667f67f..9fe3e73f5 100644
--- a/apps/desktop/src/renderer/app-shell.tsx
+++ b/apps/desktop/src/renderer/app-shell.tsx
@@ -1925,6 +1925,16 @@ function AppShellContent({
     toastApi,
     upsertSessionSummary,
   });
+  const handleSwitchToBypassAndRetry = useCallback(
+    async (turnId: string) => {
+      const sessionId = activeIdRef.current;
+      if (!sessionId) return;
+      const switched = await setPermissionMode('bypass');
+      if (!switched || activeIdRef.current !== sessionId) return;
+      await handleTurnFooterAction(turnId, 'regenerate');
+    },
+    [handleTurnFooterAction, setPermissionMode],
+  );
 
   const {
     beginEditUserMessage,
@@ -3139,7 +3149,9 @@ function AppShellContent({
                   }
                   onPermissionModeChange={
                     activeBoundarySurface.localInteractionAvailable
-                      ? (mode) => setPermissionMode(mode)
+                      ? async (mode) => {
+                          await setPermissionMode(mode);
+                        }
                       : undefined
                   }
                   planModeActive={activePlanMode}
@@ -3277,6 +3289,7 @@ function AppShellContent({
                 onRetryMessages={activeId ? () => void retryMessages(activeId) : undefined}
                 deriveTurnPresentation={deriveTurnPresentation}
                 onTurnFooterAction={handleTurnFooterAction}
+                onSwitchToBypassAndRetry={handleSwitchToBypassAndRetry}
                 onEditUserMessage={(turnId) => { void beginEditUserMessage(turnId); }}
                 safeResumeAction={activeId ? {
                   pending: resumePendingSessionId === activeId,
diff --git a/docs/images/client-capability-bypass/after.png b/docs/images/client-capability-bypass/after.png
new file mode 100644
index 000000000..e98db5aa9
Binary files /dev/null and b/docs/images/client-capability-bypass/after.png differ
diff --git a/docs/images/client-capability-bypass/before.png b/docs/images/client-capability-bypass/before.png
new file mode 100644
index 000000000..15d311ceb
Binary files /dev/null and b/docs/images/client-capability-bypass/before.png differ
diff --git a/packages/core/src/__tests__/tool-result-record-schema.test.ts b/packages/core/src/__tests__/tool-result-record-schema.test.ts
index f60fd2aa5..0e38d57fe 100644
--- a/packages/core/src/__tests__/tool-result-record-schema.test.ts
+++ b/packages/core/src/__tests__/tool-result-record-schema.test.ts
@@ -73,10 +73,26 @@ describe('sandbox boundary failure tool result metadata', () => {
     assert.deepEqual(toolResultContent(decodeStoredMessage(storedToolResult(result))), result);
   });
 
+  test('preserves the client capability source for actionable bypass recovery', () => {
+    const result = {
+      kind: 'text',
+      text: 'Client Capability tools require the Bypass execution boundary.',
+      sandboxFailure: {
+        reason: 'requires_bypass',
+        source: 'client_capability',
+      },
+    } as const;
+
+    assert.deepEqual(decodeCanonicalToolResultContent(result), result);
+    assert.deepEqual(toolResultContent(decodeStoredMessage(storedToolResult(result))), result);
+  });
+
   test('rejects malformed or widened boundary failure signals', () => {
     for (const sandboxFailure of [
       { reason: 'sandbox_denial' },
       { reason: 'requires_bypass', unexpected: true },
+      { reason: 'requires_bypass', source: 'filesystem' },
+      { reason: 'sandbox_boundary_required', source: 'client_capability' },
       { reason: 'sandbox_boundary_required', requiredExpansion: {} },
     ]) {
       assert.throws(
diff --git a/packages/core/src/events.ts b/packages/core/src/events.ts
index 4896c7641..bdfa3d4f6 100644
--- a/packages/core/src/events.ts
+++ b/packages/core/src/events.ts
@@ -679,6 +679,7 @@ export interface SandboxDenialRecovery extends SandboxDenialSignal {
 export interface SandboxBoundaryFailureSignal {
   reason: 'sandbox_boundary_required' | 'requires_bypass';
   requiredExpansion?: SandboxBoundaryExpansion;
+  source?: 'client_capability';
 }
 
 export interface ToolUncertainOutcomeSignal {
diff --git a/packages/core/src/tool-result-record-schema.ts b/packages/core/src/tool-result-record-schema.ts
index 2a3b985ea..a6a4466ec 100644
--- a/packages/core/src/tool-result-record-schema.ts
+++ b/packages/core/src/tool-result-record-schema.ts
@@ -45,7 +45,7 @@ const TEXT_SHAPE = defineObjectShape<Result<'text'>>()(
 );
 const SANDBOX_FAILURE_SHAPE = defineObjectShape<NonNullable<Result<'text'>['sandboxFailure']>>()(
   ['reason'],
-  ['requiredExpansion'],
+  ['requiredExpansion', 'source'],
 );
 const UNCERTAIN_OUTCOME_SHAPE = defineObjectShape<
   NonNullable<Result<'text'>['uncertainOutcome']>
@@ -245,6 +245,9 @@ function isNonShellToolResultContent(value: unknown): value is ToolResultContent
             hasExactShape(value.sandboxFailure, SANDBOX_FAILURE_SHAPE) &&
             (value.sandboxFailure.reason === 'sandbox_boundary_required' ||
               value.sandboxFailure.reason === 'requires_bypass') &&
+            (value.sandboxFailure.source === undefined ||
+              (value.sandboxFailure.reason === 'requires_bypass' &&
+                value.sandboxFailure.source === 'client_capability')) &&
             (value.sandboxFailure.requiredExpansion === undefined ||
               validateSandboxBoundaryExpansion(value.sandboxFailure.requiredExpansion).ok))) &&
         (value.uncertainOutcome === undefined ||
diff --git a/packages/runtime/src/__tests__/pre-dispatch-refusal-ledger.test.ts b/packages/runtime/src/__tests__/pre-dispatch-refusal-ledger.test.ts
index a550241d1..dc07667ee 100644
--- a/packages/runtime/src/__tests__/pre-dispatch-refusal-ledger.test.ts
+++ b/packages/runtime/src/__tests__/pre-dispatch-refusal-ledger.test.ts
@@ -347,6 +347,29 @@ for (const path of REFUSAL_PATHS) {
   });
 }
 
+test('client-capability refusal carries actionable bypass metadata', async () => {
+  const h = harness();
+  const tool: MakaTool = {
+    name: 'browser_click',
+    description: 'test',
+    categoryHint: 'client_capability',
+    parameters: z.object({}),
+    impl: async () => ({ ok: true }),
+  };
+
+  await settle(h, tool, {}, { toolCallId: 'call_boundary_metadata' });
+
+  const result = h.events.find(
+    (event) => event.type === 'tool_result' && event.toolUseId === 'call_boundary_metadata',
+  );
+  assert.deepEqual(
+    result?.type === 'tool_result' && result.content.kind === 'text'
+      ? result.content.sandboxFailure
+      : undefined,
+    { reason: 'requires_bypass', source: 'client_capability' },
+  );
+});
+
 test('arguments the schema rejects leave a matched call/response pair on the generic lane', async () => {
   const h = harness();
 
diff --git a/packages/runtime/src/tool-runtime.ts b/packages/runtime/src/tool-runtime.ts
index 84fab7c47..f78e13240 100644
--- a/packages/runtime/src/tool-runtime.ts
+++ b/packages/runtime/src/tool-runtime.ts
@@ -1061,7 +1061,10 @@ export class ToolRuntime {
      * refusal the model reads, on the same lane. Every refusal below routes
      * through here so the pair can never be split across lanes again.
      */
-    const refuseBeforeDispatch = async (text: string): Promise<void> => {
+    const refuseBeforeDispatch = async (
+      text: string,
+      sandboxFailure?: Extract<ToolResultContent, { kind: 'text' }>['sandboxFailure'],
+    ): Promise<void> => {
       pushCallEvent('preflight');
       await this.writeSyntheticToolResult(
         toolUseId,
@@ -1069,7 +1072,7 @@ export class ToolRuntime {
         text,
         queue,
         undefined,
-        undefined,
+        sandboxFailure,
         undefined,
         activityIdentity,
       );
@@ -1251,7 +1254,10 @@ export class ToolRuntime {
         return this.errorReturn(reason);
       }
       if (clientCapabilityBoundary.kind !== 'bypass') {
-        await refuseBeforeDispatch(CLIENT_CAPABILITY_BOUNDARY_MESSAGE);
+        await refuseBeforeDispatch(CLIENT_CAPABILITY_BOUNDARY_MESSAGE, {
+          reason: 'requires_bypass',
+          source: 'client_capability',
+        });
         trace?.emit('tool', 'tool_failed', 'Client Capability blocked by execution boundary', {
           toolUseId,
           toolName: tool.name,
diff --git a/packages/ui/src/__tests__/materialize.test.ts b/packages/ui/src/__tests__/materialize.test.ts
index a95d2233d..d295a35d9 100644
--- a/packages/ui/src/__tests__/materialize.test.ts
+++ b/packages/ui/src/__tests__/materialize.test.ts
@@ -193,6 +193,31 @@ describe("steering timeline", () => {
 });
 
 describe("materializeChat message metadata", () => {
+  test("localizes visible system notes", () => {
+    const messages: StoredMessage[] = [
+      {
+        type: "system_note",
+        id: "note-1",
+        turnId: "t1",
+        ts: 1,
+        kind: "context_compacted",
+      },
+    ];
+
+    assert.equal(
+      materializeChat(messages, "en")[0]?.text,
+      "Context compacted to keep this session within the model window.",
+    );
+    assert.equal(
+      materializeChat(messages, "zh")[0]?.text,
+      "已压缩较早的对话内容,以适应模型上下文窗口。",
+    );
+    assert.equal(
+      materializeTurns(messages, "zh")[0]?.notes[0]?.text,
+      "已压缩较早的对话内容,以适应模型上下文窗口。",
+    );
+  });
+
   test("preserves an explicit empty reference projection as the new-format marker", () => {
     const messages: StoredMessage[] = [
       {
diff --git a/packages/ui/src/__tests__/tool-activity-presentation.test.ts b/packages/ui/src/__tests__/tool-activity-presentation.test.ts
index de0fd00de..fbe68eb7c 100644
--- a/packages/ui/src/__tests__/tool-activity-presentation.test.ts
+++ b/packages/ui/src/__tests__/tool-activity-presentation.test.ts
@@ -25,6 +25,7 @@ import { computerUseModelCallArgs } from '@maka/core/computer-use';
 import { ToolCallDetail, ToolTrow } from '../tool-activity.js';
 import type { ToolActivityItem } from '../materialize.js';
 import { LocaleProvider } from '../locale-context.js';
+import { ToolResultPreview } from '../tool-activity/tool-result-preview.js';
 import {
   computerActionLabel,
   computerRunningLabel,
@@ -39,6 +40,77 @@ function renderToStaticMarkup(node: ReactNode, locale: 'zh' | 'en' = 'zh'): stri
 }
 
 describe('tool activity presentation', () => {
+  it('localizes client capability boundary failures and offers recovery', () => {
+    const item: ToolActivityItem = {
+      toolUseId: 'client-capability-boundary',
+      toolName: 'maka_computer',
+      displayName: '列出打开的应用',
+      activityKind: 'computer',
+      status: 'errored',
+      args: { action: 'list_apps' },
+      result: {
+        kind: 'text',
+        text: 'Client Capability tools require the Bypass execution boundary.',
+        sandboxFailure: {
+          reason: 'requires_bypass',
+          source: 'client_capability',
+        },
+      },
+    };
+
+    const zh = renderToStaticMarkup(createElement(ToolCallDetail, {
+      item,
+      onSwitchToBypassAndRetry: async () => undefined,
+    }));
+    const en = renderToStaticMarkup(createElement(ToolCallDetail, {
+      item,
+      onSwitchToBypassAndRetry: async () => undefined,
+    }), 'en');
+
+    assert.match(zh, /需要“绕过”模式/);
+    assert.match(zh, /此操作会直接控制本机应用,无法在沙箱模式下执行。/);
+    assert.match(zh, /切换并重试/);
+    assert.doesNotMatch(zh, /Client Capability tools require/);
+    assert.match(en, /Bypass mode required/);
+    assert.match(en, /Switch and retry/);
+  });
+
+  it('keeps generic requires-bypass failures verbatim', () => {
+    const markup = renderToStaticMarkup(createElement(ToolCallDetail, {
+      item: {
+        toolUseId: 'filesystem-boundary',
+        toolName: 'Write',
+        status: 'errored',
+        args: { path: '/etc/hosts' },
+        result: {
+          kind: 'text',
+          text: 'This path requires the Bypass execution boundary.',
+          sandboxFailure: { reason: 'requires_bypass' },
+        },
+      } satisfies ToolActivityItem,
+      onSwitchToBypassAndRetry: async () => undefined,
+    }));
+
+    assert.match(markup, /This path requires the Bypass execution boundary./);
+    assert.doesNotMatch(markup, /控制本机应用|切换并重试/);
+  });
+
+  it('localizes file-write result summaries', () => {
+    const result = {
+      kind: 'file_write' as const,
+      path: '/tmp/output.txt',
+      bytes: 42,
+    };
+    assert.match(
+      renderToStaticMarkup(createElement(ToolResultPreview, { content: result })),
+      /已向 \/tmp\/output.txt 写入 42 字节/,
+    );
+    assert.match(
+      renderToStaticMarkup(createElement(ToolResultPreview, { content: result }), 'en'),
+      /Wrote 42 bytes to \/tmp\/output.txt/,
+    );
+  });
+
   it('describes Computer Use proxy calls by action instead of the generic tool name', () => {
     const item: ToolActivityItem = {
       toolUseId: 'computer-observe',
diff --git a/packages/ui/src/__tests__/transcript-projection.test.ts b/packages/ui/src/__tests__/transcript-projection.test.ts
index 7a5fffbc4..559ce849f 100644
--- a/packages/ui/src/__tests__/transcript-projection.test.ts
+++ b/packages/ui/src/__tests__/transcript-projection.test.ts
@@ -68,6 +68,37 @@ function streamingTurn(text: string): LiveTurnProjection {
 }
 
 describe('incremental transcript projection', () => {
+  test('a locale change rematerializes localized system notes', () => {
+    const projection = createTranscriptProjection();
+    const messages: StoredMessage[] = [{
+      type: 'system_note',
+      id: 'note-1',
+      turnId: 'turn-1',
+      ts: 1,
+      kind: 'context_compacted',
+    }];
+
+    const english = projection.project({
+      sessionId: SESSION,
+      messages,
+      locale: 'en',
+    });
+    const chinese = projection.project({
+      sessionId: SESSION,
+      messages,
+      locale: 'zh',
+    });
+
+    assert.equal(
+      english[0]?.notes[0]?.text,
+      'Context compacted to keep this session within the model window.',
+    );
+    assert.equal(
+      chinese[0]?.notes[0]?.text,
+      '已压缩较早的对话内容,以适应模型上下文窗口。',
+    );
+    assert.notStrictEqual(chinese, english);
+  });
 
   test('a shell-run update whose semantics are unchanged affects nothing', () => {
     const projection = createTranscriptProjection();
diff --git a/packages/ui/src/chat-turn.tsx b/packages/ui/src/chat-turn.tsx
index a34489b1b..e0e6f2738 100644
--- a/packages/ui/src/chat-turn.tsx
+++ b/packages/ui/src/chat-turn.tsx
@@ -435,6 +435,8 @@ export const TurnView = memo(function TurnView(props: {
    * linked subagent tool rows; omitted when the host has no navigation.
    */
   onOpenLinkedSession?(sessionId: string): void;
+  /** Resolve a requires-bypass tool refusal, then regenerate this turn. */
+  onSwitchToBypassAndRetry?(turnId: string): void | Promise<void>;
 }) {
   const locale = useUiLocale();
   const copy = getConversationCopy(locale).messages;
@@ -665,6 +667,11 @@ export const TurnView = memo(function TurnView(props: {
                     key={`processing-${item.id}`}
                     entries={item.children}
                     onOpenLinkedSession={props.onOpenLinkedSession}
+                    onSwitchToBypassAndRetry={
+                      props.onSwitchToBypassAndRetry
+                        ? () => props.onSwitchToBypassAndRetry?.(turn.turnId)
+                        : undefined
+                    }
                     initialLiveContent={props.liveStreaming?.initialLiveContent}
                   />
                 ) : (
@@ -673,6 +680,11 @@ export const TurnView = memo(function TurnView(props: {
                     item={item}
                     onStreamingSettled={props.liveStreaming?.onStreamingSettled}
                     onOpenLinkedSession={props.onOpenLinkedSession}
+                    onSwitchToBypassAndRetry={
+                      props.onSwitchToBypassAndRetry
+                        ? () => props.onSwitchToBypassAndRetry?.(turn.turnId)
+                        : undefined
+                    }
                     initialLiveContent={props.liveStreaming?.initialLiveContent}
                   />
                 ),
@@ -1181,6 +1193,7 @@ function TurnTimelineEntry(props: {
   item: Exclude<TurnTimelineItem, { kind: 'user' }>;
   onStreamingSettled?: (messageId?: string) => void;
   onOpenLinkedSession?(sessionId: string): void;
+  onSwitchToBypassAndRetry?(): void | Promise<void>;
   initialLiveContent?: ReadonlyMap<string, string>;
 }) {
   const { item } = props;
@@ -1195,7 +1208,13 @@ function TurnTimelineEntry(props: {
     );
   }
   if (item.kind === 'tools') {
-    return <ToolTrow items={item.items} onOpenLinkedSession={props.onOpenLinkedSession} />;
+    return (
+      <ToolTrow
+        items={item.items}
+        onOpenLinkedSession={props.onOpenLinkedSession}
+        onSwitchToBypassAndRetry={props.onSwitchToBypassAndRetry}
+      />
+    );
   }
   // Same component either way — a type swap here would remount the answer.
   if (item.live !== true) return <AssistantAnswerBubble text={item.text} phase="historical" />;
@@ -1213,6 +1232,7 @@ function TurnTimelineEntry(props: {
 function ProcessingBlock(props: {
   entries: FoldedTimelineChild[];
   onOpenLinkedSession?(sessionId: string): void;
+  onSwitchToBypassAndRetry?(): void | Promise<void>;
   initialLiveContent?: ReadonlyMap<string, string>;
 }) {
   const { entries } = props;
@@ -1223,6 +1243,7 @@ function ProcessingBlock(props: {
           key={timelineEntryKey(entry, index)}
           item={entry}
           onOpenLinkedSession={props.onOpenLinkedSession}
+          onSwitchToBypassAndRetry={props.onSwitchToBypassAndRetry}
           initialLiveContent={props.initialLiveContent}
         />
       ))}
diff --git a/packages/ui/src/chat-view.tsx b/packages/ui/src/chat-view.tsx
index 66a582a71..c05d77fd2 100644
--- a/packages/ui/src/chat-view.tsx
+++ b/packages/ui/src/chat-view.tsx
@@ -233,6 +233,8 @@ export function ChatView(props: {
    * reconciliation on the hot streaming path (ChatView also ref-wraps this).
    */
   onOpenLinkedSession?(sessionId: string): void;
+  /** Resolve a requires-bypass tool refusal, then regenerate its owning turn. */
+  onSwitchToBypassAndRetry?(turnId: string): void | Promise<void>;
   onNew(): void;
   onPromptSuggestion?(prompt: string): void;
   /**
@@ -251,7 +253,8 @@ export function ChatView(props: {
    */
   onAskAboutSelection?(input: { text: string; turnId: string }): void;
 }) {
-  const conversationCopy = getConversationCopy(useUiLocale());
+  const locale = useUiLocale();
+  const conversationCopy = getConversationCopy(locale);
   const copy = conversationCopy.chat;
   // chat survives for the empty-state path; the main message log is driven by
   // `turns` (per @kenji UI-04 turn-grouping projection).
@@ -268,13 +271,14 @@ export function ChatView(props: {
       : props.messages,
     [drainingMessageIds, props.messages],
   );
-  const chat = useMemo(() => materializeChat(visibleMessages), [visibleMessages]);
+  const chat = useMemo(() => materializeChat(visibleMessages, locale), [visibleMessages, locale]);
   // The projection owns the derived turns, so a turn nothing said anything
   // about keeps its object identity and its memoized TurnView skips — across
   // deltas AND across the message refreshes that fire at every step/tool
   // boundary (#2030).
   const turns = useTranscriptProjection({
     sessionId: props.activeSession?.id,
+    locale,
     messages: visibleMessages,
     liveTurn: props.liveTurn,
     shellRunUpdates: props.shellRunUpdates,
@@ -403,6 +407,12 @@ export function ChatView(props: {
     (sessionId: string) => onOpenLinkedSessionRef.current?.(sessionId),
     [],
   );
+  const onSwitchToBypassAndRetryRef = useRef(props.onSwitchToBypassAndRetry);
+  onSwitchToBypassAndRetryRef.current = props.onSwitchToBypassAndRetry;
+  const stableSwitchToBypassAndRetry = useCallback(
+    (turnId: string) => onSwitchToBypassAndRetryRef.current?.(turnId),
+    [],
+  );
   const turnIds = useMemo(() => new Set(turns.map((turn) => turn.turnId)), [turns]);
   const conversationItemPlacement = useMemo(() => placeChatConversationItems(
     (props.conversationItems ?? []).map((item) => ({
@@ -647,6 +657,11 @@ export function ChatView(props: {
                       onOpenLinkedSession={
                         props.onOpenLinkedSession ? stableOpenLinkedSession : undefined
                       }
+                      onSwitchToBypassAndRetry={
+                        props.onSwitchToBypassAndRetry
+                          ? stableSwitchToBypassAndRetry
+                          : undefined
+                      }
                       searchHighlighted={highlightedTurnId === turn.turnId}
                       liveStreaming={
                         turn.turnId === tailTurnId
diff --git a/packages/ui/src/conversation-copy.ts b/packages/ui/src/conversation-copy.ts
index ddfeb3b85..ee43ed20e 100644
--- a/packages/ui/src/conversation-copy.ts
+++ b/packages/ui/src/conversation-copy.ts
@@ -278,6 +278,11 @@ export interface ConversationCopy {
     removeQuoteAriaLabel: string;
     aborted: string;
     abortedByStop: string;
+    systemNotes: {
+      contextCompacted: string;
+      contextCompactionFailedOpen: string;
+      stepLimit: string;
+    };
   };
   chat: {
     conversationAriaLabel: (name: string) => string;
@@ -467,6 +472,11 @@ const CONVERSATION_COPY = {
       you: '你', assistant: 'Maka', processing: '正在处理…', continuing: '继续中…', workingPhrases: ['正在琢磨…', '正在推敲…', '正在盘算…', '正在钻研…', '正在忙活…', '正在梳理…', '正在打磨…', '正在鼓捣…', '正在酝酿…', '正在攻坚…', '正在权衡…', '正在拾掇…'], providerRetryScheduled: (seconds, attempt, maxAttempts) => `${seconds} 秒后重试(${attempt}/${maxAttempts})`, providerRetryStarted: (attempt, maxAttempts) => `正在重试(${attempt}/${maxAttempts})`, providerRetryReason: { network: '网络中断', provider_unavailable: '模型服务暂时不可用', rate_limit: '触发模型速率限制', tim [...]
       userAriaLabel: '你发送的消息', systemAriaLabel: '系统消息', assistantAriaLabel: 'Maka 的回答', answerActionsAriaLabel: (context) => `回答操作${context ? `:${context}` : ''}`, answerActionAriaLabel: (action, context) => `${action}回答${context ? `:${context}` : ''}`, messageActionAriaLabel: (action, context) => `${action}消息${context ? `:${context}` : ''}`, sourceAriaLabel: '本轮回答的来源', derivativesAriaLabel: '本轮回答的衍生', scheduledTaskTriggered: '定时任务触发', scheduledTaskTitle: (id) => `由定时任务触发 · ${id}`, legac [...]
       thinkingTruncatedTitle: '部分 reasoning 已截断;显示的是最近的内容', outputTruncatedTitle: '助手输出已超过单次回合上限,超出部分未渲染。如需完整内容请重新生成或查看持久化的任务日志。', removeAttachmentAriaLabel: (name) => `移除 ${name}`, quoteLabel: '引用', quoteExpandAriaLabel: '展开引用全文', quoteCollapseAriaLabel: '收起引用', removeQuoteAriaLabel: '移除引用', aborted: '(已中断)', abortedByStop: '(已中断 · 由停止按钮触发)',
+      systemNotes: {
+        contextCompacted: '已压缩较早的对话内容,以适应模型上下文窗口。',
+        contextCompactionFailedOpen: '上下文摘要失败;本轮已在未生成新摘要的情况下继续。',
+        stepLimit: '已达到本轮工具步骤上限,任务可能尚未完成。发送“继续”即可接着处理。',
+      },
     },
     chat: {
       conversationAriaLabel: (name) => `对话:${name}`,
@@ -610,6 +620,11 @@ const CONVERSATION_COPY = {
       you: 'You', assistant: 'Maka', processing: 'Working…', continuing: 'Continuing…', workingPhrases: ['Pondering…', 'Tinkering…', 'Untangling…', 'Digging in…', 'Mulling…', 'Chewing on it…', 'Wrangling…', 'Piecing it together…'], providerRetryScheduled: (seconds, attempt, maxAttempts) => `Retrying in ${seconds}s (${attempt}/${maxAttempts})`, providerRetryStarted: (attempt, maxAttempts) => `Retrying (${attempt}/${maxAttempts})`, providerRetryReason: { network: 'Network interrupted', pro [...]
       userAriaLabel: 'Your message', systemAriaLabel: 'System message', assistantAriaLabel: "Maka's response", answerActionsAriaLabel: (context) => `Response actions${context ? `: ${context}` : ''}`, answerActionAriaLabel: (action, context) => `${action} response${context ? `: ${context}` : ''}`, messageActionAriaLabel: (action, context) => `${action} message${context ? `: ${context}` : ''}`, sourceAriaLabel: 'Source of this response', derivativesAriaLabel: 'Responses derived from this o [...]
       thinkingTruncatedTitle: 'Some reasoning was truncated; showing the most recent content', outputTruncatedTitle: 'The assistant output exceeded the per-turn limit. Regenerate it or inspect the persisted task log for the complete content.', removeAttachmentAriaLabel: (name) => `Remove ${name}`, quoteLabel: 'Quote', quoteExpandAriaLabel: 'Show the full quoted excerpt', quoteCollapseAriaLabel: 'Collapse the quoted excerpt', removeQuoteAriaLabel: 'Remove quote', aborted: '(Interrupted)', [...]
+      systemNotes: {
+        contextCompacted: 'Context compacted to keep this session within the model window.',
+        contextCompactionFailedOpen: 'Context summary failed; the session continued without a new summary.',
+        stepLimit: 'Reached the configured step limit. The task may be incomplete. Send “continue” to resume.',
+      },
     },
     chat: {
       conversationAriaLabel: (name) => `Conversation: ${name}`,
diff --git a/packages/ui/src/materialize.ts b/packages/ui/src/materialize.ts
index 687272944..fc328ecfb 100644
--- a/packages/ui/src/materialize.ts
+++ b/packages/ui/src/materialize.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { deriveTurnRecords, STEP_LIMIT_NOTICE_TEXT } from '@maka/core/session';
+import { deriveTurnRecords } from '@maka/core/session';
 import {
   isInFlightToolStatus,
   toolResultActivityStatus,
@@ -39,10 +39,12 @@ import type {
 import type { ToolActivityStatus } from '@maka/core/tool-result-status';
 import type { ShellRunToolResult } from '@maka/core/shell-run-result';
 import type { StoredMessage, TurnRecord, TurnStatus, UserMessage } from '@maka/core/session';
+import type { UiLocale } from '@maka/core/ui-locale';
 import type {
   LiveSteeringProjection,
   LiveTurnProjection,
 } from "./live-turn-projection.js";
+import { getConversationCopy } from "./conversation-copy.js";
 
 export { isCancelledToolResultContent, isInFlightToolStatus, toolResultActivityStatus } from '@maka/core/tool-result-status';
 
@@ -139,18 +141,17 @@ const VISIBLE_SYSTEM_NOTES = new Set<string>([
   "step_limit",
 ]);
 
-const SYSTEM_NOTE_LABELS: Record<string, string> = {
-  context_compacted:
-    "Context compacted to keep this session within the model window.",
-  context_compaction_failed_open:
-    "Context summary failed; the session continued without a new summary.",
-  step_limit: STEP_LIMIT_NOTICE_TEXT,
-  mode_change: "Permission mode changed",
-  turn_aborted: "Turn aborted",
-};
+function systemNoteLabel(kind: string, locale: UiLocale): string {
+  const copy = getConversationCopy(locale).messages.systemNotes;
+  if (kind === "context_compacted") return copy.contextCompacted;
+  if (kind === "context_compaction_failed_open") return copy.contextCompactionFailedOpen;
+  if (kind === "step_limit") return copy.stepLimit;
+  return kind;
+}
 
 export function materializeChat(
   messages: readonly StoredMessage[],
+  locale: UiLocale = "en",
 ): ChatItem[] {
   const items: ChatItem[] = [];
   for (const message of messages) {
@@ -186,7 +187,7 @@ export function materializeChat(
       items.push({
         id: message.id,
         role: "system",
-        text: SYSTEM_NOTE_LABELS[message.kind] ?? message.kind,
+        text: systemNoteLabel(message.kind, locale),
         ts: message.ts,
       });
     }
@@ -628,6 +629,7 @@ export function applyShellRunOverlayEntry(
  */
 export function materializeTurns(
   messages: readonly StoredMessage[],
+  locale: UiLocale = "en",
 ): TurnViewModel[] {
   const turnRecords = deriveTurnRecords(messages);
   const turnRecordById = new Map(
@@ -735,7 +737,7 @@ export function materializeTurns(
       turn.notes.push({
         id: message.id,
         role: "system",
-        text: SYSTEM_NOTE_LABELS[message.kind] ?? message.kind,
+        text: systemNoteLabel(message.kind, locale),
         ts: message.ts,
       });
     } else if (message.type === "token_usage") {
diff --git a/packages/ui/src/styles.css b/packages/ui/src/styles.css
index fe9719eea..0e5d42f3a 100644
--- a/packages/ui/src/styles.css
+++ b/packages/ui/src/styles.css
@@ -674,7 +674,8 @@
 .maka-tool-output-chunk-stderr { color: var(--destructive); }
 .maka-tool-output-chunk-redacted { opacity: 0.65; }
 .maka-tool-output-redacted { display: inline; margin-left: 2px; color: var(--warning-text, var(--info-text)); }
-.maka-sandbox-blocked-banner { margin-bottom: 10px; }
+.maka-sandbox-blocked-banner,
+.maka-requires-bypass-banner { margin-bottom: 10px; }
 .maka-sandbox-blocked-description {
   font: var(--maka-text-supporting);
  display: flex; flex-direction: column; gap: 4px; white-space: pre-wrap; word-break: break-word; }
diff --git a/packages/ui/src/tool-activity.tsx b/packages/ui/src/tool-activity.tsx
index fa521d945..10b3dfd49 100644
--- a/packages/ui/src/tool-activity.tsx
+++ b/packages/ui/src/tool-activity.tsx
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { useEffect, useRef } from 'react';
+import { useEffect, useRef, useState } from 'react';
 import { countDiffLineStats } from '@maka/core/unified-diff';
 import { isInFlightToolStatus } from '@maka/core/tool-result-status';
 import { type ToolResultContent } from '@maka/core/events';
@@ -43,6 +43,7 @@ import {
   extractErrorText,
   isCancelledToolResult,
   isPermissionDeniedToolResult,
+  isRequiresBypassToolResult,
   resultOwnsOwnPanel,
   withLiveStreamFallback,
 } from './tool-activity/result-projection.js';
@@ -115,12 +116,15 @@ function LoadToolResultPreview(props: {
  */
 export function ToolCallDetail({
   item,
+  onSwitchToBypassAndRetry,
 }: {
   item: ToolActivityItem;
+  onSwitchToBypassAndRetry?(): void | Promise<void>;
 }) {
   const locale = useUiLocale();
   const cancelled = isCancelledToolResult(item.result);
   const sandboxBlocked = isSandboxDeniedTool(item);
+  const requiresBypass = isRequiresBypassToolResult(item.result);
   // Cancel is not a failure; stale errored+cancelled must not paint as failed.
   const failedOutcome = item.status === 'errored' && !cancelled;
   const permissionDenied = isPermissionDeniedToolResult(item.result);
@@ -132,7 +136,7 @@ export function ToolCallDetail({
     .filter((value): value is string => Boolean(value))
     .join(' · ');
   const ptyControlResult = item.toolName === 'WriteStdin' && item.result?.kind === 'shell_run';
-  const ownsPanel = resultOwnsOwnPanel(item);
+  const ownsPanel = resultOwnsOwnPanel(item) || requiresBypass;
   // Sandbox only — ordinary failures use ChatToolCalls status=error on the row.
   const showSandboxBanner = sandboxBlocked && failedOutcome && !ptyControlResult;
   // Skip invocation when the owned panel already prints the command.
@@ -144,7 +148,7 @@ export function ToolCallDetail({
     && item.outputChunks.length > 0
     && !ownsPanel
     && (running || !item.result);
-  const showResult = !!item.result && !permissionDenied;
+  const showResult = !!item.result && !permissionDenied && !requiresBypass;
   const displayResult = showResult && item.result
     ? withLiveStreamFallback(item.result, item.outputChunks, {
       truncated: item.outputTruncated === true,
@@ -176,6 +180,9 @@ export function ToolCallDetail({
       {showSandboxBanner && (
         <SandboxBlockedBanner result={displayResult ?? item.result} />
       )}
+      {requiresBypass && (
+        <RequiresBypassBanner onSwitchToBypassAndRetry={onSwitchToBypassAndRetry} />
+      )}
       {showResult && ownsPanel && displayResult && (
         isConnectorTool(item.toolName) && displayResult.kind === 'json' ? (
           <LoadToolResultPreview
@@ -262,13 +269,15 @@ export function ToolCallDetail({
 export function ToolTrow({
   items,
   onOpenLinkedSession,
+  onSwitchToBypassAndRetry,
 }: {
   items: ToolActivityItem[];
   onOpenLinkedSession?(sessionId: string): void;
+  onSwitchToBypassAndRetry?(): void | Promise<void>;
 }) {
   const locale = useUiLocale();
   if (items.length === 0) return null;
-  const segments = toolTrowSegments(items, locale);
+  const segments = toolTrowSegments(items, locale, onSwitchToBypassAndRetry);
 
   // ChatToolCalls owns expandable tool evidence. Linked child sessions are
   // navigation targets instead, so they render through Astryx's compact List:
@@ -317,7 +326,11 @@ type ToolTrowSegment =
   | { kind: 'tools'; key: string; calls: ChatToolCallItem[] }
   | { kind: 'agents'; key: string; rows: LinkedAgentRow[] };
 
-function toolTrowSegments(items: ToolActivityItem[], locale: UiLocale): ToolTrowSegment[] {
+function toolTrowSegments(
+  items: ToolActivityItem[],
+  locale: UiLocale,
+  onSwitchToBypassAndRetry?: () => void | Promise<void>,
+): ToolTrowSegment[] {
   const segments: ToolTrowSegment[] = [];
   let computerTarget: string | undefined;
   for (const item of items) {
@@ -336,6 +349,7 @@ function toolTrowSegments(items: ToolActivityItem[], locale: UiLocale): ToolTrow
       isComputerTool(item) && !computerActionLabelIncludesTarget(item)
         ? computerTarget
         : undefined,
+      onSwitchToBypassAndRetry,
     );
     if (previous?.kind === 'tools') previous.calls.push(call);
     else segments.push({ kind: 'tools', key: item.toolUseId, calls: [call] });
@@ -348,7 +362,8 @@ function LinkedAgentList(props: {
   locale: UiLocale;
   onOpenLinkedSession?: (sessionId: string) => void;
 }) {
-  const copy = getToolActivityCopy(props.locale).agent;
+  const activityCopy = getToolActivityCopy(props.locale);
+  const copy = activityCopy.agent;
   return (
     <List density="compact">
       {props.rows.map((row) => {
@@ -378,7 +393,7 @@ function LinkedAgentList(props: {
                   </Text>
                 ) : null}
                 {row.failureClass ? (
-                  <VisuallyHidden>Error: {row.failureClass}</VisuallyHidden>
+                  <VisuallyHidden>{activityCopy.errorLabel}: {row.failureClass}</VisuallyHidden>
                 ) : null}
               </span>
             )}
@@ -404,6 +419,7 @@ function standardToolCall(
   item: ToolActivityItem,
   locale: UiLocale,
   inferredTarget?: string,
+  onSwitchToBypassAndRetry?: () => void | Promise<void>,
 ): ChatToolCallItem {
   return {
     key: item.toolUseId,
@@ -422,7 +438,10 @@ function standardToolCall(
     ...diffStats(itemDiffs(item)),
     resultDetail: (
       <ToolDetailReveal>
-        <ToolCallDetail item={item} />
+        <ToolCallDetail
+          item={item}
+          onSwitchToBypassAndRetry={onSwitchToBypassAndRetry}
+        />
       </ToolDetailReveal>
     ),
   };
@@ -545,12 +564,55 @@ function astryxToolStatus(item: ToolActivityItem): ChatToolCallItem['status'] {
  */
 function toolCallErrorMessage(item: ToolActivityItem, locale: UiLocale): string | undefined {
   if (item.status !== 'errored') return undefined;
+  if (isRequiresBypassToolResult(item.result)) {
+    const copy = getToolActivityCopy(locale).requiresBypass;
+    return locale === 'zh'
+      ? `${copy.title}。${copy.description}`
+      : `${copy.title}. ${copy.description}`;
+  }
   return summarizeErrorText(formatUserVisibleToolText(
     redactSecrets(extractErrorText(item.result, locale)),
     locale,
   )).replace(/^Error:\s*/i, '');
 }
 
+function RequiresBypassBanner(props: {
+  onSwitchToBypassAndRetry?(): void | Promise<void>;
+}) {
+  const copy = getToolActivityCopy(useUiLocale()).requiresBypass;
+  const [pending, setPending] = useState(false);
+
+  async function switchAndRetry() {
+    if (!props.onSwitchToBypassAndRetry || pending) return;
+    setPending(true);
+    try {
+      await props.onSwitchToBypassAndRetry();
+    } finally {
+      setPending(false);
+    }
+  }
+
+  return (
+    <Banner
+      status="warning"
+      className="maka-requires-bypass-banner"
+      icon={<ShieldAlert size={ICON_SIZE.chrome} aria-hidden="true" />}
+      title={copy.title}
+      description={copy.description}
+      endContent={props.onSwitchToBypassAndRetry ? (
+        <UiButton
+          variant="primary"
+          size="sm"
+          isDisabled={pending}
+          aria-busy={pending || undefined}
+          onClick={() => void switchAndRetry()}
+          label={pending ? copy.pending : copy.action}
+        />
+      ) : undefined}
+    />
+  );
+}
+
 /**
  * A visible word for the two outcomes a red status icon cannot say on its own:
  * the run stopped before finishing, or the sandbox likely blocked it. Ordinary
diff --git a/packages/ui/src/tool-activity/copy.ts b/packages/ui/src/tool-activity/copy.ts
index 899956b05..192d2b03d 100644
--- a/packages/ui/src/tool-activity/copy.ts
+++ b/packages/ui/src/tool-activity/copy.ts
@@ -24,6 +24,7 @@ type WebCredentialCopyKey = 'env' | 'settings' | 'missing' | 'unknown';
 type WebGuidanceKey = 'env' | 'settings' | 'rate_limited' | 'not_configured' | 'timed_out' | 'privacy_mode' | 'unknown';
 
 export interface ToolActivityCopy {
+  errorLabel: string;
   /** The two outcomes a tool row spells out next to its name. */
   status: {
     sandboxBlocked: string;
@@ -45,6 +46,12 @@ export interface ToolActivityCopy {
     description: string;
     copyAriaLabel: (label: string) => string;
   };
+  requiresBypass: {
+    title: string;
+    description: string;
+    action: string;
+    pending: string;
+  };
   /**
    * Row labels for one Computer Use call, derived from its arguments (see
    * `computer-action-label.ts`). The tool's display name is a noun, so every
@@ -138,6 +145,9 @@ export interface ToolActivityCopy {
     backgroundStatus: Record<BackgroundTerminalStatus, string>;
     backgroundUnknown: (status: string) => string;
     workflow: { action: string; status: string; error: string; nodes: string; diagnostics: string };
+    workflowCompleted: string;
+    workflowFailed: string;
+    fileWritten: (bytes: number, path: string) => string;
     webNoResults: string;
     webResults: (count: number) => string;
     credentialSource: Record<WebCredentialCopyKey, string>;
@@ -187,6 +197,7 @@ export interface ToolActivityCopy {
 
 const TOOL_ACTIVITY_COPY = {
   zh: {
+    errorLabel: '错误',
     status: { sandboxBlocked: '可能被沙箱阻止', interrupted: '已中断' },
     output: { redacted: '[已脱敏]', truncated: '输出已截断' },
     copy: {
@@ -197,6 +208,12 @@ const TOOL_ACTIVITY_COPY = {
       actionAriaLabel: (action, identity) => `${action}:${identity}`,
     },
     sandboxBlocked: { title: '操作可能被沙箱阻止', description: '沙箱可能阻止了该调用中的至少一项操作。失败前可能已经产生部分结果,请检查输出和工作区状态后再决定是否重试。', copyAriaLabel: (label) => `${label}沙箱诊断信息` },
+    requiresBypass: {
+      title: '需要“绕过”模式',
+      description: '此操作会直接控制本机应用,无法在沙箱模式下执行。',
+      action: '切换并重试',
+      pending: '正在切换…',
+    },
     computer: {
       fallback: '操作电脑',
       listApps: '列出打开的应用',
@@ -257,6 +274,9 @@ const TOOL_ACTIVITY_COPY = {
       hiddenLines: (n) => `… 已隐藏 ${n} 行`, ptyFailed: '后台终端交互失败', queued: '已输入', notQueued: '未输入', queuedPreview: (action, preview, bytes) => bytes === undefined ? `${action}:${preview}` : `${action}:${preview}… · 共 ${bytes} 字节`, byteCount: (action, bytes) => `${action} ${bytes} 字节`, resizeNotApplied: (size) => `未调整为 ${size}`, resized: (size) => `已调整为 ${size}`, sizeUnchanged: (size) => `尺寸已是 ${size}`, ptyCompleted: '后台终端交互已完成', terminalUnavailable: '终端输出不可用', noTerminalFrame: '(无可用终端画面)', [...]
       backgroundStatus: { running: '后台运行中', completed: '后台已完成', failed: '后台失败', timed_out: '后台超时', cancelled: '后台已取消', orphaned: '后台任务已断开' }, backgroundUnknown: (status) => `后台 · ${status}`,
       workflow: { action: '动作', status: '状态', error: '错误', nodes: '节点摘要', diagnostics: '诊断片段' }, webNoResults: '没有结果', webResults: (n) => `${n} 条结果`, credentialSource: { env: '环境变量', settings: '本机已保存 key', missing: '未配置', unknown: '来源未知' }, webFailure: '搜索失败', webSearch: '联网搜索', webGuidance: { env: '请检查 TAVILY_API_KEY / MAKA_TAVILY_API_KEY 后重启。', settings: '请在 设置 · 联网搜索 中更新 Tavily key。', rate_limited: 'Tavily 当前限流,请稍后重试或更换可用凭据。', not_configured: '请先完成联网搜索配置后再重试。', timed_out: '请求超时,请稍后重试。 [...]
+      workflowCompleted: 'Rive 工作流已完成',
+      workflowFailed: 'Rive 工作流执行失败',
+      fileWritten: (bytes, path) => `已向 ${path} 写入 ${bytes} 字节`,
     },
     agent: {
       subagentStatus: { completed: '已完成', failed: '失败', cancelled: '已取消', running: '运行中', waiting_for_user: '等待用户输入' }, readOnly: '只读', duration: (value) => `耗时 ${value}`,
@@ -270,6 +290,7 @@ const TOOL_ACTIVITY_COPY = {
     },
   },
   en: {
+    errorLabel: 'Error',
     status: { sandboxBlocked: 'Possibly blocked by sandbox', interrupted: 'Interrupted' },
     output: { redacted: '[Redacted]', truncated: 'Output truncated' },
     copy: {
@@ -280,6 +301,12 @@ const TOOL_ACTIVITY_COPY = {
       actionAriaLabel: (action, identity) => `${action}: ${identity}`,
     },
     sandboxBlocked: { title: 'Operation may have been blocked by sandbox', description: 'The sandbox may have blocked at least one action in this call. Some effects may have occurred before it failed; check the output and workspace state before retrying.', copyAriaLabel: (label) => `${label} sandbox diagnostics` },
+    requiresBypass: {
+      title: 'Bypass mode required',
+      description: 'This action controls a local app directly and cannot run inside the sandbox.',
+      action: 'Switch and retry',
+      pending: 'Switching…',
+    },
     computer: {
       fallback: 'Use the computer',
       listApps: 'List open apps',
@@ -337,6 +364,9 @@ const TOOL_ACTIVITY_COPY = {
       hiddenLines: (n) => `… ${n} ${n === 1 ? 'line' : 'lines'} hidden`, ptyFailed: 'Background terminal interaction failed', queued: 'Entered', notQueued: 'Not entered', queuedPreview: (action, preview, bytes) => bytes === undefined ? `${action}: ${preview}` : `${action}: ${preview}… · ${bytes} bytes total`, byteCount: (action, bytes) => `${action} ${bytes} bytes`, resizeNotApplied: (size) => `Not resized to ${size}`, resized: (size) => `Resized to ${size}`, sizeUnchanged: (size) => `Si [...]
       backgroundStatus: { running: 'Running in background', completed: 'Background task completed', failed: 'Background task failed', timed_out: 'Background task timed out', cancelled: 'Background task cancelled', orphaned: 'Background task disconnected' }, backgroundUnknown: (status) => `Background · ${status}`,
       workflow: { action: 'Action', status: 'Status', error: 'Error', nodes: 'Node summary', diagnostics: 'Diagnostic excerpts' }, webNoResults: 'No results', webResults: (n) => `${n} ${n === 1 ? 'result' : 'results'}`, credentialSource: { env: 'Environment variable', settings: 'Locally saved key', missing: 'Not configured', unknown: 'Unknown source' }, webFailure: 'Search failed', webSearch: 'Web search', webGuidance: { env: 'Check TAVILY_API_KEY / MAKA_TAVILY_API_KEY and restart.', set [...]
+      workflowCompleted: 'Rive workflow completed',
+      workflowFailed: 'Rive workflow failed',
+      fileWritten: (bytes, path) => `Wrote ${bytes} bytes to ${path}`,
     },
     agent: {
       subagentStatus: { completed: 'Completed', failed: 'Failed', cancelled: 'Cancelled', running: 'Running', waiting_for_user: 'Waiting for user input' }, readOnly: 'Read only', duration: (value) => `Duration ${value}`,
diff --git a/packages/ui/src/tool-activity/result-projection.ts b/packages/ui/src/tool-activity/result-projection.ts
index 8f7a458f1..4a47e471d 100644
--- a/packages/ui/src/tool-activity/result-projection.ts
+++ b/packages/ui/src/tool-activity/result-projection.ts
@@ -58,6 +58,12 @@ export function isPermissionDeniedToolResult(result: ToolActivityItem['result'])
   return /^(User denied permission(?: request)?|用户已拒绝权限请求)$/.test(result.text.trim());
 }
 
+export function isRequiresBypassToolResult(result: ToolActivityItem['result']): boolean {
+  return result?.kind === 'text'
+    && result.sandboxFailure?.reason === 'requires_bypass'
+    && result.sandboxFailure.source === 'client_capability';
+}
+
 /**
  * Result kinds (or tool-specific cards) that already paint their own chrome —
  * never nest them inside the shared quiet well.
diff --git a/packages/ui/src/tool-activity/tool-result-preview.tsx b/packages/ui/src/tool-activity/tool-result-preview.tsx
index b67e7ec25..e3274e818 100644
--- a/packages/ui/src/tool-activity/tool-result-preview.tsx
+++ b/packages/ui/src/tool-activity/tool-result-preview.tsx
@@ -248,10 +248,11 @@ export function ToolResultPreview(props: {
   // image / summary / unknown — show a compact descriptor so the user knows
   // what kind landed without dumping binary or storage refs.
   if (content.kind === 'file_write') {
+    const copy = getToolActivityCopy(locale).result;
     return (
       <div data-kind={content.kind}>
         <ToolCodeBlock
-          code={`Wrote ${content.bytes} bytes to ${content.path}`}
+          code={copy.fileWritten(content.bytes, content.path)}
           actionIdentity={props.actionIdentity}
         />
       </div>
@@ -729,7 +730,7 @@ function RiveWorkflowPreview(props: {
     result.stderrTail ? `stderr_tail:\n${result.stderrTail}` : '',
   ].filter(Boolean);
   const body = [
-    result.ok ? 'Rive workflow completed' : 'Rive workflow failed',
+    result.ok ? copy.workflowCompleted : copy.workflowFailed,
     result.summary,
     '',
     ...rows.map(([label, value]) => `${label}: ${value}`),
diff --git a/packages/ui/src/transcript-projection.ts b/packages/ui/src/transcript-projection.ts
index 1d93341d6..08ab6cf75 100644
--- a/packages/ui/src/transcript-projection.ts
+++ b/packages/ui/src/transcript-projection.ts
@@ -19,6 +19,7 @@
 
 import type { ShellRunUpdate } from '@maka/core/events';
 import type { StoredMessage } from '@maka/core/session';
+import type { UiLocale } from '@maka/core/ui-locale';
 import type { LiveTurnProjection } from './live-turn-projection.js';
 import {
   applyShellRunOverlayEntry,
@@ -59,6 +60,7 @@ export interface TranscriptProjectionInput {
    * turn is only reused when its value matches.
    */
   sessionId?: string;
+  locale?: UiLocale;
   messages: readonly StoredMessage[];
   liveTurn?: LiveTurnProjection;
   shellRunUpdates?: readonly ShellRunUpdate[];
@@ -77,6 +79,7 @@ export function createTranscriptProjection(): TranscriptProjection {
 
   // Stage inputs, remembered so a stage only reruns when its own input moved.
   let lastMessages: readonly StoredMessage[] | undefined;
+  let lastLocale: UiLocale | undefined;
   let lastLiveTurn: LiveTurnProjection | undefined;
   let lastUpdates: readonly ShellRunUpdate[] | undefined;
 
@@ -92,6 +95,7 @@ export function createTranscriptProjection(): TranscriptProjection {
   function reset(): void {
     hasProjected = false;
     lastMessages = undefined;
+    lastLocale = undefined;
     lastLiveTurn = undefined;
     lastUpdates = undefined;
     settledTurns = NO_TURNS;
@@ -118,15 +122,20 @@ export function createTranscriptProjection(): TranscriptProjection {
     if (
       hasProjected
       && input.messages === lastMessages
+      && input.locale === lastLocale
       && input.liveTurn === lastLiveTurn
       && !updatesMoved
     ) {
       return lastTurns;
     }
 
-    if (input.messages !== lastMessages) {
-      settledTurns = reconcileTurnIdentities(settledTurns, materializeTurns(input.messages));
+    if (input.messages !== lastMessages || input.locale !== lastLocale) {
+      settledTurns = reconcileTurnIdentities(
+        settledTurns,
+        materializeTurns(input.messages, input.locale),
+      );
       lastMessages = input.messages;
+      lastLocale = input.locale;
     }
     if (liveTurnsFrom !== settledTurns || input.liveTurn !== lastLiveTurn) {
       liveTurns = overlayLiveTurn(settledTurns, input.liveTurn);
diff --git a/packages/ui/stories/tool-activity.stories.tsx b/packages/ui/stories/tool-activity.stories.tsx
index 1fc301ef9..5a8ab686c 100644
--- a/packages/ui/stories/tool-activity.stories.tsx
+++ b/packages/ui/stories/tool-activity.stories.tsx
@@ -43,6 +43,27 @@ export default meta;
 
 type Story = StoryObj<typeof meta>;
 
+const requiresBypassItem: ToolActivityItem = {
+  toolUseId: 'client-capability-boundary',
+  toolName: 'maka_computer',
+  displayName: '列出打开的应用',
+  activityKind: 'computer',
+  status: 'errored',
+  args: { action: 'list_apps' },
+  result: {
+    kind: 'text',
+    text: [
+      'Client Capability tools require the Bypass execution boundary because their',
+      'client-side effects cannot be sandboxed by the Host. Switch this Session',
+      'to Bypass and retry.',
+    ].join(' '),
+    sandboxFailure: {
+      reason: 'requires_bypass',
+      source: 'client_capability',
+    },
+  },
+};
+
 /**
  * One row per item. The product groups a contiguous run into a single
  * `ToolTrow`, which collapses to its latest row; rendering one trow per item
@@ -140,6 +161,20 @@ export const ErrorsAndPermissionDenied: Story = {
   render: (args) => <ToolRowBoard items={args.items} width={860} />,
 };
 
+// Real path: a client capability is invoked from an Ask-mode task. The product
+// replaces the model-facing diagnostic with a localized recovery action.
+export const RequiresBypassRecovery: Story = {
+  args: { items: [requiresBypassItem] },
+  render: (args) => (
+    <Board width={860}>
+      <ToolTrow
+        items={args.items}
+        onSwitchToBypassAndRetry={async () => undefined}
+      />
+    </Board>
+  ),
+};
+
 // Real path: a turn that mixes many tool kinds — the density case reviewers compare
 // spacing against.
 export const DenseMixedResults: Story = {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org