@steerable/agent-shell-web 0.14.4 → 0.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/package.json +4 -4
  2. package/src/components/AgentSidebar.tsx +189 -46
  3. package/src/components/ChatHeader.tsx +12 -1
  4. package/src/components/SidebarAccount.tsx +33 -41
  5. package/src/components/chat/AssistantMessage.tsx +25 -4
  6. package/src/components/chat/ChatInput.tsx +169 -111
  7. package/src/components/chat/ChatProjectBadge.tsx +233 -88
  8. package/src/components/chat/ContextUsagePill.tsx +20 -5
  9. package/src/components/chat/ExecPolicyPicker.tsx +72 -67
  10. package/src/components/chat/LocalChatPanel.tsx +34 -34
  11. package/src/components/chat/MessageList.tsx +109 -19
  12. package/src/components/chat/ModelPicker.tsx +2 -2
  13. package/src/components/chat/SessionTodoList.tsx +63 -72
  14. package/src/components/chat/TurnFilesCard.tsx +270 -112
  15. package/src/components/chat/TurnProcessGroup.tsx +3 -0
  16. package/src/components/chat/TurnProcessTimeline.tsx +13 -0
  17. package/src/components/chat/UserMessage.tsx +8 -1
  18. package/src/components/chat/next-steps-tags.ts +13 -0
  19. package/src/components/chat/process-status.ts +112 -2
  20. package/src/components/chat/todo-list-model.ts +52 -4
  21. package/src/components/settings/AgentsSettingsPanel.tsx +3 -3
  22. package/src/components/settings/AppUpdateSettingsPanel.tsx +67 -43
  23. package/src/components/settings/AppearanceSettingsPanel.tsx +101 -134
  24. package/src/components/settings/CliInstallSettingsPanel.tsx +25 -23
  25. package/src/components/settings/DiagnoseSettingsPanel.tsx +3 -3
  26. package/src/components/settings/InsightsSettingsPanel.tsx +5 -7
  27. package/src/components/settings/LlmSettingsPanel.tsx +22 -2
  28. package/src/components/settings/McpSettingsPanel.tsx +4 -5
  29. package/src/components/settings/MemorySettingsPanel.tsx +210 -159
  30. package/src/components/settings/OrchestrationSettingsPanel.tsx +79 -121
  31. package/src/components/settings/PortableSettingsPanel.tsx +62 -49
  32. package/src/components/settings/PythonRunnerSettingsPanel.tsx +2 -4
  33. package/src/components/settings/SecuritySettingsPanel.tsx +91 -70
  34. package/src/components/settings/SettingsSidebar.tsx +238 -0
  35. package/src/components/settings/SkillsSettingsPanel.tsx +3 -4
  36. package/src/components/settings/TelemetrySettingsPanel.tsx +2 -7
  37. package/src/components/settings/UsagePanel.tsx +27 -35
  38. package/src/components/settings/WebSearchSettingsPanel.tsx +89 -88
  39. package/src/components/settings/primitives.tsx +302 -0
  40. package/src/components/settings/settings-registry.ts +371 -0
  41. package/src/layouts/AgentLayout.tsx +275 -12
  42. package/src/layouts/PanelToggleButton.tsx +27 -9
  43. package/src/layouts/conversation-preview.ts +3 -0
  44. package/src/layouts/request-chat-slot.ts +20 -0
  45. package/src/layouts/right-panel-tabs.ts +32 -0
  46. package/src/lib/chat-draft-store.ts +43 -0
  47. package/src/lib/file-preview-registry.ts +57 -0
  48. package/src/packs/registry.ts +2 -0
  49. package/src/pages/AgentPage.tsx +17 -4
  50. package/src/pages/SettingsPage.tsx +327 -489
  51. package/src/styles/index.css +6 -0
@@ -1,140 +1,98 @@
1
- import { LuGitFork } from 'react-icons/lu';
2
1
  import {
3
2
  ORCHESTRATION_MAX_DEPTH_RANGE,
4
3
  ORCHESTRATION_MAX_PARALLEL_RANGE,
5
4
  useOrchestrationLimits,
6
5
  } from '@/lib/orchestration-settings';
7
6
  import { t } from '@/i18n';
7
+ import { SettingRow, SettingSection, SettingSwitch } from './primitives';
8
8
 
9
9
  /**
10
- * OrchestrationSettingsPanel — 多智能体协同编排设置面板。
11
- * 默认开启。开关、深度与并发都实时持久化,并随 `metadata.orchestration`
12
- * 以对象形式下发给后续回合。
13
- *
14
- * 深度是权限(子代理能不能再派孙代理),所以它必须能在界面上改;写死 1/4
15
- * 会让「设置里有这个开关」变成一句空话。
10
+ * OrchestrationSettingsPanel — 多智能体协同编排设置面板(Codex 式细分割线行)。
11
+ * 默认开启。开关、深度与并发实时持久化,并随 `metadata.orchestration` 下发给后续回合。
16
12
  */
17
13
  export function OrchestrationSettingsPanel() {
18
14
  const [setting, update] = useOrchestrationLimits();
19
15
  const enabled = setting.enabled;
20
16
 
21
17
  return (
22
- <div
23
- className="space-y-2.5 rounded-agent-md border border-agent-border bg-agent-card p-3"
24
- data-testid="orchestration-settings-panel"
25
- >
26
- <div className="flex items-start justify-between gap-3">
27
- <div className="space-y-1">
28
- <div className="flex items-center gap-1.5 text-xs font-semibold text-agent-foreground">
29
- <LuGitFork className="h-3.5 w-3.5 text-violet-600 dark:text-violet-400" />
30
- <span>{t('Multi-agent orchestration (Fork-Join)')}</span>
31
- </div>
32
- <p className="text-xs leading-relaxed text-agent-muted-foreground">
33
- {t(
34
- 'Let the main agent spawn subtasks (agent_spawn) to reason in parallel, and show a flow chart and live progress board above the input box.',
35
- )}
36
- </p>
37
- </div>
18
+ <div data-testid="orchestration-settings-panel">
19
+ <SettingSection title={t('Orchestration')}>
20
+ <SettingRow
21
+ title={t('Multi-agent orchestration (Fork-Join)')}
22
+ description={t(
23
+ 'Let the main agent spawn subtasks (agent_spawn) to reason in parallel, and show a flow chart and live progress board above the input box.',
24
+ )}
25
+ control={
26
+ <SettingSwitch
27
+ checked={enabled}
28
+ onChange={(next) => update({ enabled: next })}
29
+ label={t('Multi-agent orchestration toggle')}
30
+ testId="orchestration-toggle"
31
+ />
32
+ }
33
+ />
38
34
 
39
- {/* 开关 Radio Group / Toggle */}
40
- <div
41
- className="flex shrink-0 rounded-full border border-agent-border bg-agent-canvas p-0.5"
42
- role="radiogroup"
43
- aria-label={t('Multi-agent orchestration toggle')}
44
- >
45
- <button
46
- type="button"
47
- role="radio"
48
- aria-checked={enabled}
49
- onClick={() => update({ enabled: true })}
50
- className={[
51
- 'h-6 rounded-full px-2.5 text-[11px] font-medium transition-colors',
52
- enabled
53
- ? 'bg-emerald-500/15 text-emerald-700 dark:text-emerald-300 shadow-2xs'
54
- : 'text-agent-muted-foreground hover:text-agent-foreground',
55
- ].join(' ')}
56
- >
57
- {t('On')}
58
- </button>
59
- <button
60
- type="button"
61
- role="radio"
62
- aria-checked={!enabled}
63
- onClick={() => update({ enabled: false })}
64
- className={[
65
- 'h-6 rounded-full px-2.5 text-[11px] font-medium transition-colors',
66
- !enabled
67
- ? 'bg-agent-foreground/10 text-agent-foreground shadow-2xs'
68
- : 'text-agent-muted-foreground hover:text-agent-foreground',
69
- ].join(' ')}
70
- >
71
- {t('Off')}
72
- </button>
73
- </div>
74
- </div>
35
+ <SettingRow
36
+ title={t('Max depth')}
37
+ description={
38
+ <>
39
+ <span>
40
+ {t('{min}–{max}; above 1 lets sub-agents spawn their own.', {
41
+ min: ORCHESTRATION_MAX_DEPTH_RANGE.min,
42
+ max: ORCHESTRATION_MAX_DEPTH_RANGE.max,
43
+ })}
44
+ </span>
45
+ {enabled && setting.maxDepth > 1 ? (
46
+ <span className="mt-0.5 block text-[11px] text-amber-700 dark:text-amber-300">
47
+ {t(
48
+ 'Allowing children to spawn further sub-agents raises token use and unpredictability with every extra layer.',
49
+ )}
50
+ </span>
51
+ ) : null}
52
+ </>
53
+ }
54
+ control={
55
+ <select
56
+ value={setting.maxDepth}
57
+ disabled={!enabled}
58
+ aria-label={t('Max depth')}
59
+ onChange={(event) => update({ maxDepth: Number(event.target.value) })}
60
+ className="h-7 min-w-[4.5rem] rounded-md border border-agent-border bg-agent-canvas px-2 text-xs text-agent-foreground disabled:cursor-not-allowed disabled:opacity-50"
61
+ data-testid="orchestration-max-depth"
62
+ >
63
+ {rangeOptions(ORCHESTRATION_MAX_DEPTH_RANGE).map((n) => (
64
+ <option key={n} value={n}>
65
+ {n}
66
+ </option>
67
+ ))}
68
+ </select>
69
+ }
70
+ />
75
71
 
76
- {/* 编排参数:关掉开关时置灰,值保留(下次打开还是用户调过的)。 */}
77
- <div className="grid grid-cols-2 gap-2 border-t border-agent-border/60 pt-2">
78
- <label className={enabled ? 'space-y-1' : 'space-y-1 opacity-50'}>
79
- <span className="block text-[10px] font-medium text-agent-muted-foreground">
80
- {t('Max depth')}
81
- </span>
82
- <select
83
- value={setting.maxDepth}
84
- disabled={!enabled}
85
- onChange={(event) => update({ maxDepth: Number(event.target.value) })}
86
- className="h-7 w-full rounded-agent-md border border-agent-border bg-agent-canvas px-2 text-xs text-agent-foreground disabled:cursor-not-allowed"
87
- data-testid="orchestration-max-depth"
88
- >
89
- {rangeOptions(ORCHESTRATION_MAX_DEPTH_RANGE).map((n) => (
90
- <option key={n} value={n}>
91
- {n}
92
- </option>
93
- ))}
94
- </select>
95
- <span className="block text-[10px] leading-snug text-agent-muted-foreground">
96
- {t('{min}–{max}; above 1 lets sub-agents spawn their own.', {
97
- min: ORCHESTRATION_MAX_DEPTH_RANGE.min,
98
- max: ORCHESTRATION_MAX_DEPTH_RANGE.max,
99
- })}
100
- </span>
101
- </label>
102
- <label className={enabled ? 'space-y-1' : 'space-y-1 opacity-50'}>
103
- <span className="block text-[10px] font-medium text-agent-muted-foreground">
104
- {t('Max parallel')}
105
- </span>
106
- <select
107
- value={setting.maxParallel}
108
- disabled={!enabled}
109
- onChange={(event) => update({ maxParallel: Number(event.target.value) })}
110
- className="h-7 w-full rounded-agent-md border border-agent-border bg-agent-canvas px-2 text-xs text-agent-foreground disabled:cursor-not-allowed"
111
- data-testid="orchestration-max-parallel"
112
- >
113
- {rangeOptions(ORCHESTRATION_MAX_PARALLEL_RANGE).map((n) => (
114
- <option key={n} value={n}>
115
- {n}
116
- </option>
117
- ))}
118
- </select>
119
- <span className="block text-[10px] leading-snug text-agent-muted-foreground">
120
- {t('{min}–{max}; how many sub-agents run at once.', {
121
- min: ORCHESTRATION_MAX_PARALLEL_RANGE.min,
122
- max: ORCHESTRATION_MAX_PARALLEL_RANGE.max,
123
- })}
124
- </span>
125
- </label>
126
- </div>
127
- {enabled && setting.maxDepth > 1 ? (
128
- // 深度 >1 是权限扩张,不是普通偏好:说清代价。
129
- <p className="text-[10px] leading-relaxed text-agent-muted-foreground">
130
- {t(
131
- 'Allowing children to spawn further sub-agents raises token use and unpredictability with every extra layer.',
132
- )}
133
- </p>
134
- ) : null}
135
- <p className="text-[10px] text-agent-muted-foreground">
136
- {t('Taking effect next turn')}
137
- </p>
72
+ <SettingRow
73
+ title={t('Max parallel')}
74
+ description={t('{min}–{max}; how many sub-agents run at once.', {
75
+ min: ORCHESTRATION_MAX_PARALLEL_RANGE.min,
76
+ max: ORCHESTRATION_MAX_PARALLEL_RANGE.max,
77
+ })}
78
+ control={
79
+ <select
80
+ value={setting.maxParallel}
81
+ disabled={!enabled}
82
+ aria-label={t('Max parallel')}
83
+ onChange={(event) => update({ maxParallel: Number(event.target.value) })}
84
+ className="h-7 min-w-[4.5rem] rounded-md border border-agent-border bg-agent-canvas px-2 text-xs text-agent-foreground disabled:cursor-not-allowed disabled:opacity-50"
85
+ data-testid="orchestration-max-parallel"
86
+ >
87
+ {rangeOptions(ORCHESTRATION_MAX_PARALLEL_RANGE).map((n) => (
88
+ <option key={n} value={n}>
89
+ {n}
90
+ </option>
91
+ ))}
92
+ </select>
93
+ }
94
+ />
95
+ </SettingSection>
138
96
  </div>
139
97
  );
140
98
  }
@@ -288,55 +288,68 @@ export function PortableSettingsPanel() {
288
288
  };
289
289
 
290
290
  return (
291
- <div
292
- className="space-y-2 rounded-agent-md border border-agent-border bg-agent-card p-2.5"
293
- data-testid="portable-settings-panel"
294
- >
295
- <p className="text-xs leading-relaxed text-agent-muted-foreground">
296
- {t(
297
- 'Export your config or chat history, take it to another computer, and import it there. Chats are exported with their projects, without the files in project directories. Chats are imported as new chats and do not overwrite existing history. API keys are not included by default.',
298
- )}
299
- </p>
300
- <div className="flex flex-wrap gap-1.5">
301
- <button
302
- type="button"
303
- onClick={startExport}
304
- className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border px-2.5 text-xs text-agent-foreground hover:bg-agent-foreground/5"
305
- data-testid="portable-export-config"
306
- >
307
- <LuDownload className="h-3.5 w-3.5" />
308
- {t('Export config')}
309
- </button>
310
- <button
311
- type="button"
312
- onClick={() => void startExportChats()}
313
- disabled={busy}
314
- className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border px-2.5 text-xs text-agent-foreground hover:bg-agent-foreground/5 disabled:opacity-60"
315
- data-testid="portable-export-chats"
316
- >
317
- <LuDownload className="h-3.5 w-3.5" />
318
- {t('Export chats')}
319
- </button>
320
- <button
321
- type="button"
322
- onClick={() => void startImport('config')}
323
- disabled={busy}
324
- className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border px-2.5 text-xs text-agent-foreground hover:bg-agent-foreground/5 disabled:opacity-60"
325
- data-testid="portable-import-config"
326
- >
327
- <LuUpload className="h-3.5 w-3.5" />
328
- {t('Import config')}
329
- </button>
330
- <button
331
- type="button"
332
- onClick={() => void startImport('chat')}
333
- disabled={busy}
334
- className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border px-2.5 text-xs text-agent-foreground hover:bg-agent-foreground/5 disabled:opacity-60"
335
- data-testid="portable-import-chats"
336
- >
337
- <LuUpload className="h-3.5 w-3.5" />
338
- {t('Import chats')}
339
- </button>
291
+ <div className="space-y-4" data-testid="portable-settings-panel">
292
+ <div className="divide-y divide-agent-border/60 border-t border-b border-agent-border/60">
293
+ <div className="flex flex-wrap items-center justify-between gap-4 py-3.5">
294
+ <div className="min-w-0 flex-1 space-y-0.5">
295
+ <div className="text-xs font-medium text-agent-foreground">{t('Configuration')}</div>
296
+ <p className="text-xs leading-relaxed text-agent-muted-foreground">
297
+ {t('Export or import interface, model, agent, and MCP settings. API keys are omitted by default.')}
298
+ </p>
299
+ </div>
300
+ <div className="flex shrink-0 items-center gap-1.5">
301
+ <button
302
+ type="button"
303
+ onClick={startExport}
304
+ className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border bg-agent-canvas px-3 text-xs font-medium text-agent-foreground transition-colors hover:bg-agent-muted/60"
305
+ data-testid="portable-export-config"
306
+ >
307
+ <LuDownload className="h-3.5 w-3.5" />
308
+ {t('Export config')}
309
+ </button>
310
+ <button
311
+ type="button"
312
+ onClick={() => void startImport('config')}
313
+ disabled={busy}
314
+ className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border bg-agent-canvas px-3 text-xs font-medium text-agent-foreground transition-colors hover:bg-agent-muted/60 disabled:opacity-60"
315
+ data-testid="portable-import-config"
316
+ >
317
+ <LuUpload className="h-3.5 w-3.5" />
318
+ {t('Import config')}
319
+ </button>
320
+ </div>
321
+ </div>
322
+
323
+ <div className="flex flex-wrap items-center justify-between gap-4 py-3.5">
324
+ <div className="min-w-0 flex-1 space-y-0.5">
325
+ <div className="text-xs font-medium text-agent-foreground">{t('Chat history')}</div>
326
+ <p className="text-xs leading-relaxed text-agent-muted-foreground">
327
+ {t('Export selected conversations with project metadata, or import them as new chats without overwriting existing history.')}
328
+ </p>
329
+ </div>
330
+ <div className="flex shrink-0 items-center gap-1.5">
331
+ <button
332
+ type="button"
333
+ onClick={() => void startExportChats()}
334
+ disabled={busy}
335
+ className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border bg-agent-canvas px-3 text-xs font-medium text-agent-foreground transition-colors hover:bg-agent-muted/60 disabled:opacity-60"
336
+ data-testid="portable-export-chats"
337
+ >
338
+ <LuDownload className="h-3.5 w-3.5" />
339
+ {t('Export chats')}
340
+ </button>
341
+ <button
342
+ type="button"
343
+ onClick={() => void startImport('chat')}
344
+ disabled={busy}
345
+ className="inline-flex h-7 items-center gap-1 rounded-full border border-agent-border bg-agent-canvas px-3 text-xs font-medium text-agent-foreground transition-colors hover:bg-agent-muted/60 disabled:opacity-60"
346
+ data-testid="portable-import-chats"
347
+ >
348
+ <LuUpload className="h-3.5 w-3.5" />
349
+ {t('Import chats')}
350
+ </button>
351
+ </div>
352
+ </div>
340
353
  </div>
341
354
 
342
355
  {mode === 'export' && (
@@ -1,5 +1,4 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { LuCodeXml } from 'react-icons/lu';
3
2
  import { t } from '@/i18n';
4
3
  import {
5
4
  getHostBridge,
@@ -86,11 +85,10 @@ export function PythonRunnerSettingsPanel() {
86
85
 
87
86
  return (
88
87
  <section className="space-y-2" data-testid="settings-section-python-runner">
89
- <h2 className="flex items-center gap-1.5 text-xs font-semibold text-agent-foreground">
90
- <LuCodeXml className="h-3.5 w-3.5 text-agent-muted-foreground" />
88
+ <h2 className="text-xs font-semibold text-agent-foreground">
91
89
  {t('Python code runner')}
92
90
  </h2>
93
- <div className="space-y-3 rounded-agent-md border border-agent-border bg-agent-card p-3 text-xs">
91
+ <div className="space-y-3 border-t border-b border-agent-border/60 py-3.5 text-xs">
94
92
  <p className="leading-relaxed text-agent-muted-foreground">
95
93
  {t(
96
94
  'run_code uses a separate Python interpreter. Downloading and configuring it does not block chat. Changes take effect after you restart the app.',
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
- import { LuLoaderCircle, LuShieldCheck } from 'react-icons/lu';
2
+ import { LuLoaderCircle } from 'react-icons/lu';
3
3
  import { t } from '@/i18n';
4
4
  import { hasHostBridge } from '@/lib/host-bridge';
5
5
  import {
@@ -7,22 +7,17 @@ import {
7
7
  type EgressPosture,
8
8
  type SidecarSandboxPosture,
9
9
  } from '@/lib/local-api';
10
+ import { SettingRow, SettingStatusBadge } from './primitives';
10
11
 
11
12
  /**
12
13
  * SecuritySettingsPanel — W4-3 layer-1(sidecar 进程沙箱)态势的持久披露。
13
14
  *
14
- * sidecar 进程持有服务商 API 密钥并接收不可信工具输出。收容失败时主进程
15
- * 拒绝启动(不是裸跑),态势记在 supervisor / lastSpawnRefusal 上
16
- * (GET /api/v2/sidecar/sandbox-posture)。手动关闭(sandbox:false /
17
- * STEERABLE_SIDECAR_SANDBOX=0)中性展示;收容失败告知「无法收容、已拒绝启动」。
18
- * layer-3(每次命令的沙箱)披露在工具卡片,不在此重复。
19
- *
20
- * 数据自管理:挂载拉一次,走 local-backend REST,无专用 IPC channel。
15
+ * 采用 Codex 式细分割线行与直观状态徽标,同时完整保留诚实告知语义:
16
+ * 收容失败明确披露「无法收容、已拒绝启动」,部分强制明确标注「partial」。
21
17
  */
22
18
 
23
19
  type PostureReason = SidecarSandboxPosture['reason'];
24
20
 
25
- /** 收容失败、已拒绝启动(告警行首句)。 */
26
21
  const REFUSED_REASON_TEXT: Partial<Record<PostureReason, string>> = {
27
22
  platform_unsupported: 'No process sandbox backend is available on this platform',
28
23
  seatbelt_missing: '/usr/bin/sandbox-exec not found',
@@ -31,7 +26,6 @@ const REFUSED_REASON_TEXT: Partial<Record<PostureReason, string>> = {
31
26
  helper_missing: 'win-spawn-helper.exe not found',
32
27
  };
33
28
 
34
- /** 手动关闭原因的中文说明(中性行,不告警)。 */
35
29
  const OPT_OUT_REASON_TEXT: Partial<Record<PostureReason, string>> = {
36
30
  disabled_by_option: 'Turned off with sandbox: false',
37
31
  disabled_by_env: 'Turned off with STEERABLE_SIDECAR_SANDBOX=0',
@@ -75,30 +69,41 @@ function activeBody(backend: SidecarSandboxPosture['backend']): string {
75
69
  }
76
70
  }
77
71
 
78
- /** 出网管控态势行(W-egress-posture):退回分支此前只有主进程日志可见。 */
79
72
  function EgressPostureRow({ egress }: { egress: EgressPosture }) {
80
73
  if (egress.mode === 'per-host-proxy') {
81
74
  return (
82
- <p className="text-[11px] text-agent-muted-foreground">
83
- {t(
75
+ <SettingRow
76
+ title={t('Outbound network control')}
77
+ badge={<SettingStatusBadge tone="success">{t('Active')}</SettingStatusBadge>}
78
+ description={t(
84
79
  'Egress control: the per-host allowlist proxy is active. Requests outside the allowlist ask you to allow them one by one (valid for this session only).',
85
80
  )}
86
- </p>
81
+ />
87
82
  );
88
83
  }
89
84
  if (egress.mode === 'disabled') {
90
85
  return (
91
- <p className="text-[11px] text-agent-muted-foreground">
92
- {t('Egress control: off{reason}.', { reason: egress.reason ? ` — ${egress.reason}` : '' })}
93
- </p>
86
+ <SettingRow
87
+ title={t('Outbound network control')}
88
+ badge={<SettingStatusBadge tone="neutral">{t('Off')}</SettingStatusBadge>}
89
+ description={t('Egress control: off{reason}.', {
90
+ reason: egress.reason ? ` — ${egress.reason}` : '',
91
+ })}
92
+ />
94
93
  );
95
94
  }
96
95
  return (
97
- <p className="text-[11px] text-amber-600 dark:text-amber-400">
98
- {t('Egress control: fell back to port level (coarser control){reason}.', {
99
- reason: egress.reason ? ` — ${egress.reason}` : '',
100
- })}
101
- </p>
96
+ <SettingRow
97
+ title={t('Outbound network control')}
98
+ badge={<SettingStatusBadge tone="warning">{t('Fallback')}</SettingStatusBadge>}
99
+ description={
100
+ <span className="text-amber-600 dark:text-amber-400">
101
+ {t('Egress control: fell back to port level (coarser control){reason}.', {
102
+ reason: egress.reason ? ` — ${egress.reason}` : '',
103
+ })}
104
+ </span>
105
+ }
106
+ />
102
107
  );
103
108
  }
104
109
 
@@ -118,7 +123,6 @@ export function SecuritySettingsPanel() {
118
123
  setEgress(res.egress ?? null);
119
124
  if (!res.posture) setUnavailable(t('Could not read sandbox status'));
120
125
  } catch {
121
- // 503 = sidecar 未就绪且没有收容失败记录。
122
126
  setPosture(null);
123
127
  setEgress(null);
124
128
  setUnavailable(t('Sidecar not ready — could not read sandbox status'));
@@ -134,57 +138,74 @@ export function SecuritySettingsPanel() {
134
138
  const refusedReason = posture ? REFUSED_REASON_TEXT[posture.reason] : undefined;
135
139
  const optOutReason = posture ? OPT_OUT_REASON_TEXT[posture.reason] : undefined;
136
140
 
141
+ if (!hasHostBridge()) {
142
+ return (
143
+ <p className="py-2 text-xs text-agent-muted-foreground">
144
+ {t('Open this in the desktop app')}
145
+ </p>
146
+ );
147
+ }
148
+
149
+ if (loading) {
150
+ return (
151
+ <div className="flex items-center gap-2 py-2 text-xs text-agent-muted-foreground">
152
+ <LuLoaderCircle className="h-3.5 w-3.5 animate-spin" />
153
+ {t('Loading sandbox status...')}
154
+ </div>
155
+ );
156
+ }
157
+
158
+ if (unavailable) {
159
+ return <p className="py-2 text-xs text-agent-muted-foreground">{unavailable}</p>;
160
+ }
161
+
137
162
  return (
138
- <div className="bg-agent-muted/30 border border-agent-border/60 rounded-agent-md p-2.5 space-y-2">
139
- <h4 className="text-xs font-semibold text-agent-foreground flex items-center gap-1.5">
140
- <LuShieldCheck className="h-3.5 w-3.5 text-agent-muted-foreground" />
141
- {t('Sidecar process sandbox')}
142
- </h4>
143
-
144
- {!hasHostBridge() ? (
145
- <p className="text-[11px] text-agent-muted-foreground">{t('Open this in the desktop app')}</p>
146
- ) : loading ? (
147
- <div className="flex items-center gap-2 py-2 text-xs text-agent-muted-foreground">
148
- <LuLoaderCircle className="h-3.5 w-3.5 animate-spin" />
149
- {t('Loading sandbox status...')}
150
- </div>
151
- ) : unavailable ? (
152
- <p className="text-[11px] text-agent-muted-foreground">{unavailable}</p>
153
- ) : posture && refusedReason ? (
154
- <div className="rounded-agent-md border border-agent-destructive/20 bg-agent-destructive/10 p-2.5 text-xs text-agent-destructive space-y-1.5">
155
- <p className="font-medium">
156
- {t('Cannot contain the process, so startup was refused — {reason}.', {
157
- reason: t(refusedReason),
158
- })}
159
- </p>
160
- <p>
161
- {t(
162
- 'The sidecar process that holds the provider API keys did not start, so it is not running without isolation either.',
163
- )}{' '}
164
- {t('The only way to run it unsandboxed is to set STEERABLE_SIDECAR_SANDBOX=0 explicitly.')}
165
- </p>
166
- <p>
167
- {t(
168
- 'For isolation, install the containment backend for your platform (macOS Seatbelt, Linux bwrap/Landlock, Windows win-spawn-helper), or run this app in a container.',
169
- )}
170
- </p>
163
+ <div className="divide-y divide-agent-border/60 border-t border-b border-agent-border/60">
164
+ {posture && refusedReason ? (
165
+ <div className="py-3.5">
166
+ <div className="space-y-1.5 rounded-agent-md border border-agent-destructive/20 bg-agent-destructive/10 p-3 text-xs text-agent-destructive">
167
+ <p className="font-medium">
168
+ {t('Cannot contain the process, so startup was refused — {reason}.', {
169
+ reason: t(refusedReason),
170
+ })}
171
+ </p>
172
+ <p>
173
+ {t(
174
+ 'The sidecar process that holds the provider API keys did not start, so it is not running without isolation either.',
175
+ )}{' '}
176
+ {t(
177
+ 'The only way to run it unsandboxed is to set STEERABLE_SIDECAR_SANDBOX=0 explicitly.',
178
+ )}
179
+ </p>
180
+ <p>
181
+ {t(
182
+ 'For isolation, install the containment backend for your platform (macOS Seatbelt, Linux bwrap/Landlock, Windows win-spawn-helper), or run this app in a container.',
183
+ )}
184
+ </p>
185
+ </div>
171
186
  </div>
172
187
  ) : posture && optOutReason ? (
173
- <div className="rounded-agent-md border border-agent-border/60 bg-agent-canvas p-2.5 text-xs text-agent-muted-foreground space-y-1.5">
174
- <p className="font-medium text-agent-foreground">
175
- {t('Turned off manually — {reason}.', { reason: t(optOutReason) })}
176
- </p>
177
- <p>
178
- {t(
179
- 'The sidecar process (which holds the provider API keys) runs without OS isolation. To restore it, remove the setting and restart the app.',
180
- )}
181
- </p>
182
- </div>
188
+ <SettingRow
189
+ align="start"
190
+ title={t('Turned off manually — {reason}.', { reason: t(optOutReason) })}
191
+ badge={<SettingStatusBadge tone="neutral">{t('Off')}</SettingStatusBadge>}
192
+ description={t(
193
+ 'The sidecar process (which holds the provider API keys) runs without OS isolation. To restore it, remove the setting and restart the app.',
194
+ )}
195
+ />
183
196
  ) : posture ? (
184
- <div className="rounded-agent-md border border-agent-border/60 bg-agent-canvas p-2.5 text-xs text-agent-muted-foreground space-y-1.5">
185
- <p className="font-medium text-agent-foreground">{activeHeadline(posture.backend)}</p>
186
- <p>{activeBody(posture.backend)}</p>
187
- </div>
197
+ <SettingRow
198
+ align="start"
199
+ title={activeHeadline(posture.backend)}
200
+ badge={
201
+ posture.backend === 'none' ? (
202
+ <SettingStatusBadge tone="neutral">{t('Off')}</SettingStatusBadge>
203
+ ) : (
204
+ <SettingStatusBadge tone="success">{t('Active')}</SettingStatusBadge>
205
+ )
206
+ }
207
+ description={activeBody(posture.backend)}
208
+ />
188
209
  ) : null}
189
210
 
190
211
  {egress && <EgressPostureRow egress={egress} />}