@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.
- package/package.json +4 -4
- package/src/components/AgentSidebar.tsx +189 -46
- package/src/components/ChatHeader.tsx +12 -1
- package/src/components/SidebarAccount.tsx +33 -41
- package/src/components/chat/AssistantMessage.tsx +25 -4
- package/src/components/chat/ChatInput.tsx +169 -111
- package/src/components/chat/ChatProjectBadge.tsx +233 -88
- package/src/components/chat/ContextUsagePill.tsx +20 -5
- package/src/components/chat/ExecPolicyPicker.tsx +72 -67
- package/src/components/chat/LocalChatPanel.tsx +34 -34
- package/src/components/chat/MessageList.tsx +109 -19
- package/src/components/chat/ModelPicker.tsx +2 -2
- package/src/components/chat/SessionTodoList.tsx +63 -72
- package/src/components/chat/TurnFilesCard.tsx +270 -112
- package/src/components/chat/TurnProcessGroup.tsx +3 -0
- package/src/components/chat/TurnProcessTimeline.tsx +13 -0
- package/src/components/chat/UserMessage.tsx +8 -1
- package/src/components/chat/next-steps-tags.ts +13 -0
- package/src/components/chat/process-status.ts +112 -2
- package/src/components/chat/todo-list-model.ts +52 -4
- package/src/components/settings/AgentsSettingsPanel.tsx +3 -3
- package/src/components/settings/AppUpdateSettingsPanel.tsx +67 -43
- package/src/components/settings/AppearanceSettingsPanel.tsx +101 -134
- package/src/components/settings/CliInstallSettingsPanel.tsx +25 -23
- package/src/components/settings/DiagnoseSettingsPanel.tsx +3 -3
- package/src/components/settings/InsightsSettingsPanel.tsx +5 -7
- package/src/components/settings/LlmSettingsPanel.tsx +22 -2
- package/src/components/settings/McpSettingsPanel.tsx +4 -5
- package/src/components/settings/MemorySettingsPanel.tsx +210 -159
- package/src/components/settings/OrchestrationSettingsPanel.tsx +79 -121
- package/src/components/settings/PortableSettingsPanel.tsx +62 -49
- package/src/components/settings/PythonRunnerSettingsPanel.tsx +2 -4
- package/src/components/settings/SecuritySettingsPanel.tsx +91 -70
- package/src/components/settings/SettingsSidebar.tsx +238 -0
- package/src/components/settings/SkillsSettingsPanel.tsx +3 -4
- package/src/components/settings/TelemetrySettingsPanel.tsx +2 -7
- package/src/components/settings/UsagePanel.tsx +27 -35
- package/src/components/settings/WebSearchSettingsPanel.tsx +89 -88
- package/src/components/settings/primitives.tsx +302 -0
- package/src/components/settings/settings-registry.ts +371 -0
- package/src/layouts/AgentLayout.tsx +275 -12
- package/src/layouts/PanelToggleButton.tsx +27 -9
- package/src/layouts/conversation-preview.ts +3 -0
- package/src/layouts/request-chat-slot.ts +20 -0
- package/src/layouts/right-panel-tabs.ts +32 -0
- package/src/lib/chat-draft-store.ts +43 -0
- package/src/lib/file-preview-registry.ts +57 -0
- package/src/packs/registry.ts +2 -0
- package/src/pages/AgentPage.tsx +17 -4
- package/src/pages/SettingsPage.tsx +327 -489
- package/src/styles/index.css +6 -0
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
LuBlocks,
|
|
5
|
-
LuBookOpen,
|
|
6
|
-
LuBot,
|
|
7
|
-
LuChartBar,
|
|
8
|
-
LuCodeXml,
|
|
9
|
-
LuDownload,
|
|
10
|
-
LuGitFork,
|
|
11
|
-
LuInfo,
|
|
12
|
-
LuMonitor,
|
|
13
|
-
LuNetwork,
|
|
14
|
-
LuPlug,
|
|
15
|
-
LuSearch,
|
|
16
|
-
LuSettings,
|
|
17
|
-
LuShieldCheck,
|
|
18
|
-
} from 'react-icons/lu';
|
|
19
|
-
import { useOutletContext, useSearchParams } from 'react-router-dom';
|
|
1
|
+
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
|
2
|
+
import { LuArrowLeft } from 'react-icons/lu';
|
|
3
|
+
import { useNavigate, useOutletContext, useSearchParams } from 'react-router-dom';
|
|
20
4
|
import { hasHostBridge } from '@/lib/host-bridge';
|
|
21
|
-
import {
|
|
5
|
+
import { t } from '@/i18n';
|
|
22
6
|
import { useAppRelease } from '@/components/SidebarRelease';
|
|
23
7
|
import { AgentsSettingsPanel } from '@/components/settings/AgentsSettingsPanel';
|
|
24
8
|
import { AppearanceSettingsPanel } from '@/components/settings/AppearanceSettingsPanel';
|
|
@@ -41,502 +25,356 @@ import { SettingsSaveButton } from '@/components/settings/SettingsSaveButton';
|
|
|
41
25
|
import { TelemetrySettingsPanel } from '@/components/settings/TelemetrySettingsPanel';
|
|
42
26
|
import { UsagePanel } from '@/components/settings/UsagePanel';
|
|
43
27
|
import { WebSearchSettingsPanel } from '@/components/settings/WebSearchSettingsPanel';
|
|
44
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
SettingDisclosure,
|
|
30
|
+
SettingPageShell,
|
|
31
|
+
SettingSection,
|
|
32
|
+
} from '@/components/settings/primitives';
|
|
33
|
+
import {
|
|
34
|
+
buildSettingsNavEntries,
|
|
35
|
+
resolveSettingsRoute,
|
|
36
|
+
} from '@/components/settings/settings-registry';
|
|
45
37
|
import { getPackSettingsPanels } from '@/packs/registry';
|
|
46
38
|
import { settingsChrome } from '@/lib/host-tools';
|
|
47
|
-
import { isPortableEnabled } from '@/lib/portable';
|
|
48
39
|
import type { AgentOutletContext } from '@/layouts/AgentLayout';
|
|
49
40
|
|
|
50
|
-
type SettingsSection = 'plugins' | 'general';
|
|
51
|
-
type PluginTab = 'agents' | 'skills' | 'mcp' | 'web-search';
|
|
52
|
-
|
|
53
|
-
const PLUGIN_TABS: readonly PluginTab[] = ['agents', 'skills', 'mcp', 'web-search'];
|
|
54
|
-
|
|
55
|
-
/** 每次渲染现取,文案跟随当前语言。 */
|
|
56
|
-
function pluginTabMeta(): Record<PluginTab, { label: string; noun: string; Icon: typeof LuBot }> {
|
|
57
|
-
return {
|
|
58
|
-
agents: { label: t('Agents'), noun: t('agents'), Icon: LuBot },
|
|
59
|
-
skills: { label: 'Skills', noun: t('skills'), Icon: LuBlocks },
|
|
60
|
-
mcp: { label: 'MCP', noun: t('MCP servers'), Icon: LuPlug },
|
|
61
|
-
'web-search': { label: t('Web search'), noun: t('web search'), Icon: LuSearch },
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function isPluginTab(value: string | null): value is PluginTab {
|
|
66
|
-
return (PLUGIN_TABS as readonly string[]).includes(value ?? '');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function pluginsSummary(tabs: readonly PluginTab[]): string {
|
|
70
|
-
const meta = pluginTabMeta();
|
|
71
|
-
const nouns = tabs.map((id) => meta[id].noun);
|
|
72
|
-
const items =
|
|
73
|
-
nouns.length === 0
|
|
74
|
-
? t('plugins')
|
|
75
|
-
: new Intl.ListFormat(getLocale(), { type: 'conjunction' }).format(nouns);
|
|
76
|
-
return t('Manage {items}.', { items });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function enabledPluginTabs(): PluginTab[] {
|
|
80
|
-
return PLUGIN_TABS.filter((id) => settingsChrome(id));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function resolveSection(raw: string | null): SettingsSection {
|
|
84
|
-
if (raw === 'plugins') return enabledPluginTabs().length > 0 ? 'plugins' : 'general';
|
|
85
|
-
if ((raw === 'agents' || raw === 'skills' || raw === 'mcp') && settingsChrome(raw)) {
|
|
86
|
-
return 'plugins';
|
|
87
|
-
}
|
|
88
|
-
return 'general';
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** `?section=agents|skills|mcp` 是旧深链,仍打开插件页上对应分类。 */
|
|
92
|
-
function resolvePluginTab(section: string | null, tab: string | null): PluginTab | null {
|
|
93
|
-
const enabled = enabledPluginTabs();
|
|
94
|
-
const requested =
|
|
95
|
-
section === 'agents' || section === 'skills' || section === 'mcp' ? section : tab;
|
|
96
|
-
if (isPluginTab(requested) && enabled.includes(requested)) {
|
|
97
|
-
return requested;
|
|
98
|
-
}
|
|
99
|
-
return enabled[0] ?? null;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
41
|
/**
|
|
103
|
-
* `/settings` —
|
|
104
|
-
* - `
|
|
105
|
-
*
|
|
106
|
-
* -
|
|
107
|
-
*
|
|
108
|
-
* Panel 数据自管理(挂载即拉取),页面本身不持有后端状态。
|
|
42
|
+
* `/settings` — Codex × WorkBuddy 式单页按需懒挂载设置画布:
|
|
43
|
+
* - 左侧导航栏已在 `AgentLayout` 原地切换为 `SettingsSidebar`(含搜索与返回原对话);
|
|
44
|
+
* - 右侧主画布每次仅挂载当前 `activeTabId` 对应的单个子页,根除 14 路并发请求风暴;
|
|
45
|
+
* - 100% 兼容 `?tab=<id>` 与存量 `?section=plugins|agents|skills|mcp|llm|diagnose|...` 深链;
|
|
46
|
+
* - 撤除误导性全局顶栏保存按钮,仅在 `llm`(模型服务)子页页头提供就地凭证保存。
|
|
109
47
|
*/
|
|
110
48
|
export function SettingsPage() {
|
|
111
49
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
112
|
-
const
|
|
113
|
-
const section = resolveSection(rawSection);
|
|
114
|
-
const pluginTab = section === 'plugins' ? resolvePluginTab(rawSection, searchParams.get('tab')) : null;
|
|
115
|
-
const pluginTabs = section === 'plugins' ? enabledPluginTabs() : [];
|
|
116
|
-
const selectPluginTab = useCallback((id: PluginTab) => {
|
|
117
|
-
setSearchParams({ section: 'plugins', tab: id });
|
|
118
|
-
}, [setSearchParams]);
|
|
50
|
+
const navigate = useNavigate();
|
|
119
51
|
const catalog = useOutletContext<AgentOutletContext | null>();
|
|
120
52
|
const release = useAppRelease();
|
|
121
53
|
const llmPanelRef = useRef<LlmSettingsPanelHandle>(null);
|
|
122
|
-
const pageContainerRef = useRef<HTMLDivElement>(null);
|
|
123
|
-
const scrollRef = useRef<HTMLDivElement>(null);
|
|
124
|
-
const contentRef = useRef<HTMLDivElement>(null);
|
|
125
|
-
const [containerWidth, setContainerWidth] = useState<number>(0);
|
|
126
|
-
const [activeSectionId, setActiveSectionId] = useState<string | null>(null);
|
|
127
|
-
const [renderedSectionIds, setRenderedSectionIds] = useState<Set<string> | null>(null);
|
|
128
54
|
const [llmSaveUi, setLlmSaveUi] = useState<LlmSaveUi>({
|
|
129
55
|
saving: false,
|
|
130
56
|
savedOk: false,
|
|
131
57
|
loading: true,
|
|
132
58
|
});
|
|
133
59
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
ro.observe(el);
|
|
143
|
-
return () => ro.disconnect();
|
|
144
|
-
}, []);
|
|
145
|
-
|
|
146
|
-
// 扫描右侧实际挂载且未被隐藏 (display !== 'none') 的设置分段
|
|
147
|
-
const updateRenderedSections = useCallback(() => {
|
|
148
|
-
const container = contentRef.current;
|
|
149
|
-
if (!container) return;
|
|
150
|
-
const sectionEls = container.querySelectorAll<HTMLElement>('[data-testid^="settings-section-"]');
|
|
151
|
-
const ids = new Set<string>();
|
|
152
|
-
sectionEls.forEach((el) => {
|
|
153
|
-
const tid = el.getAttribute('data-testid');
|
|
154
|
-
if (!tid) return;
|
|
155
|
-
const id = tid.replace('settings-section-', '');
|
|
156
|
-
if (typeof window !== 'undefined' && window.getComputedStyle) {
|
|
157
|
-
const style = window.getComputedStyle(el);
|
|
158
|
-
if (style.display === 'none' || style.visibility === 'hidden') return;
|
|
159
|
-
}
|
|
160
|
-
ids.add(id);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
setRenderedSectionIds((prev) => {
|
|
164
|
-
if (prev && prev.size === ids.size && [...ids].every((id) => prev.has(id))) {
|
|
165
|
-
return prev;
|
|
166
|
-
}
|
|
167
|
-
return ids;
|
|
168
|
-
});
|
|
169
|
-
}, []);
|
|
170
|
-
|
|
171
|
-
useLayoutEffect(() => {
|
|
172
|
-
updateRenderedSections();
|
|
173
|
-
const container = contentRef.current;
|
|
174
|
-
if (!container || typeof MutationObserver === 'undefined') return;
|
|
175
|
-
const observer = new MutationObserver(() => {
|
|
176
|
-
updateRenderedSections();
|
|
177
|
-
});
|
|
178
|
-
observer.observe(container, {
|
|
179
|
-
childList: true,
|
|
180
|
-
subtree: true,
|
|
181
|
-
attributes: true,
|
|
182
|
-
attributeFilter: ['style', 'class', 'hidden'],
|
|
183
|
-
});
|
|
184
|
-
return () => observer.disconnect();
|
|
185
|
-
}, [updateRenderedSections]);
|
|
186
|
-
|
|
187
|
-
// 页面宽度 >= 920px 视为宽屏(有足够空间并排容纳左侧边栏目录与主设置表单)
|
|
188
|
-
const isWide = containerWidth >= 920;
|
|
189
|
-
|
|
190
|
-
const allCandidates = useMemo<SettingsNavItem[]>(() => {
|
|
191
|
-
if (section !== 'general') return [];
|
|
192
|
-
const list: SettingsNavItem[] = [];
|
|
193
|
-
|
|
194
|
-
if (settingsChrome('appearance')) {
|
|
195
|
-
list.push({ id: 'appearance', label: t('Interface'), Icon: LuMonitor });
|
|
196
|
-
}
|
|
197
|
-
list.push({ id: 'orchestration', label: t('Orchestration'), Icon: LuGitFork });
|
|
198
|
-
|
|
199
|
-
if (settingsChrome('llm')) {
|
|
200
|
-
list.push({ id: 'llm', label: t('Local model settings'), Icon: LuSettings });
|
|
201
|
-
}
|
|
202
|
-
if (settingsChrome('web-search')) {
|
|
203
|
-
list.push({ id: 'web-search', label: t('Web search'), Icon: LuSearch });
|
|
204
|
-
}
|
|
205
|
-
if (settingsChrome('usage')) {
|
|
206
|
-
list.push({ id: 'usage', label: t('Usage and cost'), Icon: LuChartBar });
|
|
207
|
-
}
|
|
208
|
-
if (settingsChrome('diagnose')) {
|
|
209
|
-
list.push({ id: 'diagnose', label: t('Connection diagnostics'), Icon: LuNetwork });
|
|
210
|
-
}
|
|
211
|
-
if (settingsChrome('security')) {
|
|
212
|
-
list.push({ id: 'security', label: t('Security'), Icon: LuShieldCheck });
|
|
213
|
-
}
|
|
214
|
-
list.push({ id: 'memory', label: t('Memory'), Icon: LuBookOpen });
|
|
215
|
-
if (settingsChrome('insights')) {
|
|
216
|
-
list.push({ id: 'insights', label: t('Help improve the product'), Icon: LuChartBar });
|
|
217
|
-
}
|
|
218
|
-
if (settingsChrome('telemetry')) {
|
|
219
|
-
list.push({ id: 'telemetry', label: t('Telemetry (OTLP)'), Icon: LuActivity });
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const packPanels = getPackSettingsPanels();
|
|
223
|
-
for (const panel of packPanels) {
|
|
224
|
-
list.push({
|
|
225
|
-
id: panel.panelId,
|
|
226
|
-
label: t(panel.title),
|
|
227
|
-
Icon: panel.Icon ?? LuSettings,
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (isPortableEnabled()) {
|
|
232
|
-
list.push({ id: 'portable', label: t('Backup and migration'), Icon: LuDownload });
|
|
233
|
-
}
|
|
234
|
-
if (hasHostBridge()) {
|
|
235
|
-
list.push({ id: 'python-runner', label: t('Python runtime'), Icon: LuCodeXml });
|
|
236
|
-
}
|
|
237
|
-
if (release.version) {
|
|
238
|
-
list.push({ id: 'update', label: t('Software update'), Icon: LuInfo });
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return list;
|
|
242
|
-
}, [section, release.version]);
|
|
60
|
+
const navEntries = useMemo(
|
|
61
|
+
() =>
|
|
62
|
+
buildSettingsNavEntries({
|
|
63
|
+
hiddenNavItems: catalog?.hiddenNavItems,
|
|
64
|
+
releaseVersion: release.version,
|
|
65
|
+
}),
|
|
66
|
+
[catalog?.hiddenNavItems, release.version],
|
|
67
|
+
);
|
|
243
68
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
69
|
+
const { tabId: activeTabId, anchorId } = useMemo(
|
|
70
|
+
() =>
|
|
71
|
+
resolveSettingsRoute(
|
|
72
|
+
searchParams,
|
|
73
|
+
navEntries.map((entry) => entry.id),
|
|
74
|
+
),
|
|
75
|
+
[searchParams, navEntries],
|
|
76
|
+
);
|
|
252
77
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const target = document.
|
|
256
|
-
|
|
257
|
-
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!anchorId) return;
|
|
80
|
+
const target = document.getElementById(anchorId);
|
|
81
|
+
target?.scrollIntoView?.({ behavior: 'smooth', block: 'start' });
|
|
82
|
+
}, [activeTabId, anchorId]);
|
|
83
|
+
|
|
84
|
+
const previewBanner = !hasHostBridge() ? (
|
|
85
|
+
<p className="rounded-agent-md border border-agent-destructive/20 bg-agent-destructive/10 p-2.5 text-xs text-agent-destructive">
|
|
86
|
+
{t('Browser preview mode: no host bridge, so some settings are unavailable.')}
|
|
87
|
+
</p>
|
|
88
|
+
) : null;
|
|
89
|
+
|
|
90
|
+
const packPanels = getPackSettingsPanels();
|
|
91
|
+
const activePackPanel = packPanels.find((panel) => panel.panelId === activeTabId);
|
|
92
|
+
|
|
93
|
+
const selectMobileTab = (id: string) => {
|
|
94
|
+
const next = new URLSearchParams();
|
|
95
|
+
if (id !== 'general') {
|
|
96
|
+
next.set('tab', id);
|
|
258
97
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const handleScroll = useCallback(() => {
|
|
262
|
-
if (!scrollRef.current || menuItems.length === 0) return;
|
|
263
|
-
const containerTop = scrollRef.current.getBoundingClientRect().top;
|
|
264
|
-
let closestId: string | null = null;
|
|
265
|
-
let minDistance = Infinity;
|
|
98
|
+
setSearchParams(next);
|
|
99
|
+
};
|
|
266
100
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
101
|
+
const withMobileChrome = (page: ReactNode) => (
|
|
102
|
+
<div className="flex h-full flex-col overflow-hidden">
|
|
103
|
+
<div className="flex flex-col gap-2 border-b border-agent-border/60 bg-agent-canvas px-4 py-2.5 sm:hidden">
|
|
104
|
+
<button
|
|
105
|
+
type="button"
|
|
106
|
+
data-testid="settings-mobile-back"
|
|
107
|
+
onClick={() => (catalog?.onExitSettings ? catalog.onExitSettings() : navigate('/agent'))}
|
|
108
|
+
className="inline-flex w-fit items-center gap-1.5 text-xs font-medium text-agent-muted-foreground hover:text-agent-foreground"
|
|
109
|
+
>
|
|
110
|
+
<LuArrowLeft className="h-3.5 w-3.5" />
|
|
111
|
+
<span>{t('Back to chat')}</span>
|
|
112
|
+
</button>
|
|
113
|
+
<div
|
|
114
|
+
role="tablist"
|
|
115
|
+
aria-label={t('Settings navigation')}
|
|
116
|
+
className="flex items-center gap-1 overflow-x-auto pb-0.5"
|
|
117
|
+
>
|
|
118
|
+
{navEntries.map((entry) => {
|
|
119
|
+
const active = entry.id === activeTabId;
|
|
120
|
+
return (
|
|
121
|
+
<button
|
|
122
|
+
key={entry.id}
|
|
123
|
+
type="button"
|
|
124
|
+
role="tab"
|
|
125
|
+
aria-selected={active}
|
|
126
|
+
data-testid={`settings-mobile-tab-${entry.id}`}
|
|
127
|
+
onClick={() => selectMobileTab(entry.id)}
|
|
128
|
+
className={[
|
|
129
|
+
'h-7 shrink-0 rounded-full px-2.5 text-xs font-medium transition-colors',
|
|
130
|
+
active
|
|
131
|
+
? 'bg-agent-foreground text-agent-canvas'
|
|
132
|
+
: 'bg-agent-muted/60 text-agent-muted-foreground hover:text-agent-foreground',
|
|
133
|
+
].join(' ')}
|
|
134
|
+
>
|
|
135
|
+
{t(entry.label)}
|
|
136
|
+
</button>
|
|
137
|
+
);
|
|
138
|
+
})}
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
<div className="min-h-0 flex-1 overflow-hidden">{page}</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
281
144
|
|
|
282
|
-
|
|
283
|
-
|
|
145
|
+
if (activePackPanel) {
|
|
146
|
+
return withMobileChrome(
|
|
147
|
+
<SettingPageShell
|
|
148
|
+
title={t(activePackPanel.title)}
|
|
149
|
+
description={activePackPanel.description ? t(activePackPanel.description) : undefined}
|
|
150
|
+
banner={previewBanner}
|
|
151
|
+
testId={`settings-section-${activePackPanel.panelId}`}
|
|
152
|
+
>
|
|
153
|
+
<activePackPanel.Component />
|
|
154
|
+
</SettingPageShell>,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
284
157
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
{
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
aria-label={t('Plugins')}
|
|
294
|
-
data-testid="plugins-tabs"
|
|
295
|
-
className="flex min-w-0 items-center gap-1"
|
|
296
|
-
>
|
|
297
|
-
{pluginTabs.map((id) => {
|
|
298
|
-
const meta = pluginMeta[id];
|
|
299
|
-
const active = pluginTab === id;
|
|
300
|
-
return (
|
|
301
|
-
<button
|
|
302
|
-
key={id}
|
|
303
|
-
type="button"
|
|
304
|
-
role="tab"
|
|
305
|
-
aria-selected={active}
|
|
306
|
-
data-testid={`plugins-tab-${id}`}
|
|
307
|
-
onClick={() => selectPluginTab(id)}
|
|
308
|
-
className={[
|
|
309
|
-
'flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs transition-colors',
|
|
310
|
-
active
|
|
311
|
-
? 'bg-agent-foreground/10 font-medium text-agent-foreground'
|
|
312
|
-
: 'text-agent-muted-foreground hover:bg-agent-foreground/5 hover:text-agent-foreground',
|
|
313
|
-
].join(' ')}
|
|
314
|
-
>
|
|
315
|
-
<meta.Icon className="h-3.5 w-3.5" />
|
|
316
|
-
{meta.label}
|
|
317
|
-
</button>
|
|
318
|
-
);
|
|
319
|
-
})}
|
|
320
|
-
</div>
|
|
158
|
+
const pageBody = (() => {
|
|
159
|
+
switch (activeTabId) {
|
|
160
|
+
case 'llm':
|
|
161
|
+
return (
|
|
162
|
+
<SettingPageShell
|
|
163
|
+
title={t('Models')}
|
|
164
|
+
description={t(
|
|
165
|
+
'Configure model provider, gateway URL, API key, and advanced parameters.',
|
|
321
166
|
)}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
167
|
+
banner={previewBanner}
|
|
168
|
+
testId="settings-section-llm"
|
|
169
|
+
headerAction={
|
|
170
|
+
<SettingsSaveButton
|
|
171
|
+
testId="settings-header-save"
|
|
172
|
+
saving={llmSaveUi.saving}
|
|
173
|
+
savedOk={llmSaveUi.savedOk}
|
|
174
|
+
disabled={llmSaveUi.saving || llmSaveUi.loading}
|
|
175
|
+
onClick={() => void llmPanelRef.current?.save()}
|
|
176
|
+
/>
|
|
177
|
+
}
|
|
178
|
+
>
|
|
179
|
+
<LlmSettingsPanel
|
|
180
|
+
ref={llmPanelRef}
|
|
181
|
+
showFooterSave={false}
|
|
182
|
+
collapseAdvanced
|
|
183
|
+
onSaveUiChange={setLlmSaveUi}
|
|
330
184
|
/>
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}`}
|
|
185
|
+
</SettingPageShell>
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
case 'agents':
|
|
189
|
+
return (
|
|
190
|
+
<SettingPageShell
|
|
191
|
+
title={t('Agents')}
|
|
192
|
+
description={t('Create and customize role prompts, skills, and tool permissions.')}
|
|
193
|
+
width="wide"
|
|
194
|
+
banner={previewBanner}
|
|
195
|
+
testId="settings-section-agents"
|
|
343
196
|
>
|
|
344
|
-
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
197
|
+
<AgentsSettingsPanel onCatalogChange={catalog?.refreshAgents} />
|
|
198
|
+
</SettingPageShell>
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
case 'skills':
|
|
202
|
+
return (
|
|
203
|
+
<SettingPageShell
|
|
204
|
+
title="Skills"
|
|
205
|
+
description={t('Import local skill folders and inspect loaded workspace skills.')}
|
|
206
|
+
width="wide"
|
|
207
|
+
banner={previewBanner}
|
|
208
|
+
testId="settings-section-skills"
|
|
209
|
+
>
|
|
210
|
+
<SkillsSettingsPanel />
|
|
211
|
+
</SettingPageShell>
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
case 'mcp':
|
|
215
|
+
return (
|
|
216
|
+
<SettingPageShell
|
|
217
|
+
title={t('MCP servers')}
|
|
218
|
+
description={t('Connect local stdio or remote Streamable HTTP MCP tool servers.')}
|
|
219
|
+
width="wide"
|
|
220
|
+
banner={previewBanner}
|
|
221
|
+
testId="settings-section-mcp"
|
|
222
|
+
>
|
|
223
|
+
<McpSettingsPanel />
|
|
224
|
+
</SettingPageShell>
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
case 'web-search':
|
|
228
|
+
return (
|
|
229
|
+
<SettingPageShell
|
|
230
|
+
title={t('Web search')}
|
|
231
|
+
description={t('Choose free DuckDuckGo search or configure a Tavily API key.')}
|
|
232
|
+
banner={previewBanner}
|
|
233
|
+
testId="settings-section-web-search"
|
|
234
|
+
>
|
|
235
|
+
<WebSearchSettingsPanel />
|
|
236
|
+
</SettingPageShell>
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
case 'memory':
|
|
240
|
+
return (
|
|
241
|
+
<SettingPageShell
|
|
242
|
+
title={t('Memory')}
|
|
243
|
+
description={t('Manage automatic memory mode, personal notes, and project rules.')}
|
|
244
|
+
width="wide"
|
|
245
|
+
banner={previewBanner}
|
|
246
|
+
testId="settings-section-memory"
|
|
247
|
+
>
|
|
248
|
+
<MemorySettingsPanel />
|
|
249
|
+
</SettingPageShell>
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
case 'usage':
|
|
253
|
+
return (
|
|
254
|
+
<SettingPageShell
|
|
255
|
+
title={t('Usage & diagnostics')}
|
|
256
|
+
description={t('Inspect token consumption, estimated cost, and gateway connectivity.')}
|
|
257
|
+
width="wide"
|
|
258
|
+
banner={previewBanner}
|
|
259
|
+
testId="settings-page-usage"
|
|
260
|
+
>
|
|
261
|
+
{settingsChrome('usage') && (
|
|
262
|
+
<SettingSection
|
|
263
|
+
title={t('Usage and cost')}
|
|
264
|
+
divided={false}
|
|
265
|
+
testId="settings-section-usage"
|
|
266
|
+
>
|
|
267
|
+
<UsagePanel />
|
|
268
|
+
</SettingSection>
|
|
401
269
|
)}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
{
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
{
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
{
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
{t('Help improve the product')}
|
|
490
|
-
</h2>
|
|
491
|
-
<InsightsSettingsPanel />
|
|
492
|
-
</section>
|
|
493
|
-
)}
|
|
494
|
-
|
|
495
|
-
{settingsChrome('telemetry') && (
|
|
496
|
-
<section className="space-y-2" data-testid="settings-section-telemetry">
|
|
497
|
-
<h2 className="flex items-center gap-1.5 text-xs font-semibold text-agent-foreground">
|
|
498
|
-
<LuActivity className="h-3.5 w-3.5 text-agent-muted-foreground" />
|
|
499
|
-
{t('Telemetry (OTLP)')}
|
|
500
|
-
</h2>
|
|
501
|
-
<TelemetrySettingsPanel />
|
|
502
|
-
</section>
|
|
503
|
-
)}
|
|
504
|
-
|
|
505
|
-
{/* 场景包设置面板(1.2 起由包渲染层贡献)。
|
|
506
|
-
包经 packs/registry 注册,未激活 flavor 的产物里没有包组件。 */}
|
|
507
|
-
{getPackSettingsPanels().map((panel) => (
|
|
508
|
-
<section
|
|
509
|
-
key={panel.panelId}
|
|
510
|
-
className="space-y-2"
|
|
511
|
-
data-testid={`settings-section-${panel.panelId}`}
|
|
512
|
-
>
|
|
513
|
-
<h2 className="flex items-center gap-1.5 text-xs font-semibold text-agent-foreground">
|
|
514
|
-
{panel.Icon ? (
|
|
515
|
-
<panel.Icon className="h-3.5 w-3.5 text-agent-muted-foreground" />
|
|
516
|
-
) : null}
|
|
517
|
-
{t(panel.title)}
|
|
518
|
-
</h2>
|
|
519
|
-
<panel.Component />
|
|
520
|
-
</section>
|
|
521
|
-
))}
|
|
522
|
-
|
|
523
|
-
{isPortableEnabled() && (
|
|
524
|
-
<section className="space-y-2" data-testid="settings-section-portable">
|
|
525
|
-
<h2 className="flex items-center gap-1.5 text-xs font-semibold text-agent-foreground">
|
|
526
|
-
<LuDownload className="h-3.5 w-3.5 text-agent-muted-foreground" />
|
|
527
|
-
{t('Backup and migration')}
|
|
528
|
-
</h2>
|
|
529
|
-
<PortableSettingsPanel />
|
|
530
|
-
</section>
|
|
531
|
-
)}
|
|
532
|
-
|
|
533
|
-
<PythonRunnerSettingsPanel />
|
|
534
|
-
<AppUpdateSettingsPanel />
|
|
535
|
-
</>
|
|
270
|
+
{settingsChrome('diagnose') && (
|
|
271
|
+
<SettingSection
|
|
272
|
+
id="diagnose"
|
|
273
|
+
title={t('Connection diagnostics')}
|
|
274
|
+
divided={false}
|
|
275
|
+
testId="settings-section-diagnose"
|
|
276
|
+
>
|
|
277
|
+
<DiagnoseSettingsPanel />
|
|
278
|
+
</SettingSection>
|
|
279
|
+
)}
|
|
280
|
+
</SettingPageShell>
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
case 'security':
|
|
284
|
+
return (
|
|
285
|
+
<SettingPageShell
|
|
286
|
+
title={t('Security & privacy')}
|
|
287
|
+
description={t(
|
|
288
|
+
'Review process sandbox isolation, data sharing consent, and OTLP telemetry.',
|
|
289
|
+
)}
|
|
290
|
+
banner={previewBanner}
|
|
291
|
+
testId="settings-page-security"
|
|
292
|
+
>
|
|
293
|
+
{settingsChrome('security') && (
|
|
294
|
+
<SettingSection
|
|
295
|
+
title={t('Sidecar process sandbox')}
|
|
296
|
+
divided={false}
|
|
297
|
+
testId="settings-section-security"
|
|
298
|
+
>
|
|
299
|
+
<SecuritySettingsPanel />
|
|
300
|
+
</SettingSection>
|
|
301
|
+
)}
|
|
302
|
+
{settingsChrome('insights') && (
|
|
303
|
+
<SettingSection
|
|
304
|
+
id="insights"
|
|
305
|
+
title={t('Help improve the product')}
|
|
306
|
+
divided={false}
|
|
307
|
+
testId="settings-section-insights"
|
|
308
|
+
>
|
|
309
|
+
<InsightsSettingsPanel />
|
|
310
|
+
</SettingSection>
|
|
311
|
+
)}
|
|
312
|
+
{settingsChrome('telemetry') && (
|
|
313
|
+
<SettingDisclosure
|
|
314
|
+
id="telemetry"
|
|
315
|
+
title={t('Telemetry (OTLP)')}
|
|
316
|
+
summary="OTLP/HTTP"
|
|
317
|
+
defaultOpen={anchorId === 'telemetry'}
|
|
318
|
+
testId="settings-section-telemetry"
|
|
319
|
+
>
|
|
320
|
+
<TelemetrySettingsPanel />
|
|
321
|
+
</SettingDisclosure>
|
|
322
|
+
)}
|
|
323
|
+
</SettingPageShell>
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
case 'portable':
|
|
327
|
+
return (
|
|
328
|
+
<SettingPageShell
|
|
329
|
+
title={t('Data & migration')}
|
|
330
|
+
description={t('Export or import configuration bundles and conversation archives.')}
|
|
331
|
+
banner={previewBanner}
|
|
332
|
+
testId="settings-section-portable"
|
|
333
|
+
>
|
|
334
|
+
<PortableSettingsPanel />
|
|
335
|
+
</SettingPageShell>
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
case 'about':
|
|
339
|
+
return (
|
|
340
|
+
<SettingPageShell
|
|
341
|
+
title={t('About')}
|
|
342
|
+
description={t('Check application version, release notes, and software updates.')}
|
|
343
|
+
banner={previewBanner}
|
|
344
|
+
testId="settings-section-about"
|
|
345
|
+
>
|
|
346
|
+
<AppUpdateSettingsPanel showFallbackBrand />
|
|
347
|
+
</SettingPageShell>
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
case 'general':
|
|
351
|
+
default:
|
|
352
|
+
return (
|
|
353
|
+
<SettingPageShell
|
|
354
|
+
title={t('General')}
|
|
355
|
+
description={t(
|
|
356
|
+
'Manage language, zoom level, thinking display, and multi-agent collaboration.',
|
|
536
357
|
)}
|
|
358
|
+
banner={previewBanner}
|
|
359
|
+
testId="settings-page-general"
|
|
360
|
+
>
|
|
361
|
+
{settingsChrome('appearance') && (
|
|
362
|
+
<div id="appearance" data-testid="settings-section-appearance">
|
|
363
|
+
<AppearanceSettingsPanel />
|
|
364
|
+
</div>
|
|
365
|
+
)}
|
|
366
|
+
<div id="orchestration" data-testid="settings-section-orchestration">
|
|
367
|
+
<OrchestrationSettingsPanel />
|
|
537
368
|
</div>
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
369
|
+
{hasHostBridge() && (
|
|
370
|
+
<div id="python-runner">
|
|
371
|
+
<PythonRunnerSettingsPanel />
|
|
372
|
+
</div>
|
|
373
|
+
)}
|
|
374
|
+
</SettingPageShell>
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
})();
|
|
378
|
+
|
|
379
|
+
return withMobileChrome(pageBody);
|
|
542
380
|
}
|