feat(ui): 侧边栏工作模式切换器——编程 / 写作 / 设计三模式(提示词、工具面、模型记忆全局适配)#184
Open
Bsyy95 wants to merge 1 commit into
Open
Conversation
…-mode prompt, tools, and model memory Co-authored-by: Cursor <cursoragent@cursor.com>
Bsyy95
force-pushed
the
feat/sidebar-work-modes
branch
from
July 21, 2026 10:20
b86ecf5 to
6c0e091
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
侧边栏头部的「Live Agent」品牌文字行是全应用功能密度最低的一等位置。这个 PR 把它改造成三段式工作模式切换器:编程 / 写作 / 设计——一次点击(或
Ctrl/⌘+Alt+1/2/3)就把提示词、工具面、模型选择与首屏内容整体切换到对应场景。品牌识别保留 32px logo(悬停显示全名),Windows 标题栏与关于页的完整品牌不受影响。模式即预设:不发明新机制,只打包既有原语
模式定义集中在新增的
lib/settings/workModes.ts(GUI/WebUI 字节级镜像,纯数据 + 纯函数,已登记 mirror-manifest):<work-mode>标签包裹)Bash/ManagedProcess/ReadTerminal(防误操作 + 聚焦工具清单)modelByMode.codingmodelByMode.writingmodelByMode.design全局面的处理(设置 / 同步 / 运行时 / 内容)
customSettings.workMode = { activeModeId, modelByMode },走既有归一化管线(normalizeCustomSettings/ 本地LocalUiSettings读写均已覆盖)。customSettings双向同步——对话在桌面端运行,WebUI 切模式必须落回桌面端才对下一轮生效;applyGatewaySettingsSyncPayload对旧版本对端(payload 无 workMode)做缺席保留,Rust 端零改动(customSettings本就在 UI-only 缓存覆盖名单内)。activeAgentPrompt现有链路,压缩/token 统计语义不变。builtinRegistry新增excludedToolNames(按 bundle 过滤,含子代理注册表);cron 等非 chat 作用域不受影响,后台任务在写作模式下照常可用 Bash。setSelectedModel实时把用户显式选择记到当前模式名下;setActiveWorkMode离开前记忆、进入时恢复,目标模式没记过则沿用当前模型——切换永远无感,不会弹"未配置模型"空态。同模式重复点击是引用相等的 no-op,不触发保存链与网关广播。border-border/40 bg-background/60 p-0.5+ 激活段 ring),激活段仅加一枚 2×6px 模式色圆点(sky/amber/fuchsia),所有段常驻圆点占位避免布局抖动;空态 logo 光晕随模式换色。272px 侧边栏下中英文标签均有余量,--zone-font-scale缩放兼容。变更清单
lib/settings/workModes.ts(双端镜像)+ mirror-manifest 登记lib/settings/index.ts(双端):WorkModeSettings域、归一化、setActiveWorkMode/getActiveWorkMode、setSelectedModel模式记忆;storage.ts(GUI)本地读写补 workMode;sync.ts(双端)缺席保留ChatHistorySidebar(双端):头部品牌行 → 模式切换器;两个 sidebar container 透传ChatPage/GatewayApp:模式提示词合成、工具裁剪传参(GUI)、占位符、快捷键、空态传参builtinRegistry.ts+runAgentConversationTurn.ts:excludedToolNames支持ChatEmptyState(双端):模式化问候语/建议卡/光晕;GatewayTranscript/ChatTranscript透传icons.tsx补Palette;i18n 双端中英文各 25 条work-modes.test.mjs(6 例:定义契约、i18n 双语完整性、归一化、切换往返、同步 payload)+builtin-registry裁剪用例;文档docs/features/work-modes.md验证
pnpm build/pnpm lint(0 错误)/pnpm test:frontend(1072 全过,含新增 6 例)pnpm build/pnpm lint(0 错误)/pnpm test(367 全过)node scripts/check-mirror.mjs(88 个镜像文件一致)git diff --check无尾随空白;未改动 Rust / Go / proto