Repository navigation
feat(workbench): refactor Settings shell into a full-window inverted-L page - #7238
Conversation
63eae10 to
a1b18ec
Compare
M4n5ter
left a comment
There was a problem hiding this comment.
English
The overall direction looks solid—moving Settings out of ModalDialog into a peer inverted-L WorkspaceSurface, converging notices onto the global toast store, and removing the one-off ModalDialog size="page" variant all make sense. Before merging, there are a few real bugs, some design/cleanliness items (cc @Astro-Han on the DESIGN.md / visual shell trade-offs), and test bloat worth cleaning up.
Correctness & Merge Readiness
-
Merge conflict against
main(12-locale JSON migration)- The PR is currently
CONFLICTINGbecauseproducts/maka/workbench/app/locale-settings.tswas removed in #7224 (69af2805b2) in favor ofproducts/maka/workbench/locales/*.json. - Needs a rebase onto
main, adding"Back to app"and removing the unused"Close settings"key across all 12 locale JSON files.
- The PR is currently
-
Missed peer
previewDialogsuppression inRoomView.tsx(plus Escape leak)- Where:
plugins/agent/conversations/ui/RoomView.tsx:197-205vs. the change inproducts/maka/workbench/app/App.tsx:188-191, andproducts/maka/workbench/app/Workbench.tsx:271-278. - Trigger: In a narrow window (
< 912pt, where!canDockPreview()), open a Room, click a file/link to open the resource preview dialog (previewDialog), then pressmod+,to open Settings. - Impact:
App.tsxsuppresses Conversations'previewDialogwhensettingsOpened() || workspaceMode() !== 'conversations', but the peercreatePreviewDialoginRoomView.tsxstill only checkssuppressed: () => resources.imageViewer() !== nullwithout!input.visible(). As a result, the Room preview<Dialog>stays open on top of Settings. BecauseWorkbench.tsx:272's<Dialog>does not calltrackModalSurface(), pressingEscapecloses Settings underneath while the preview dialog remains stuck on screen. - Fix: Include
!input.visible()inRoomView.tsx'screatePreviewDialogsuppressedpredicate.
- Where:
-
Pressing
Escapeinside any focused Settings<Input>now exits Settings / triggers discard confirmation- Where:
products/maka/workbench/app/ModelSettings.tsx(keymap.bind('escape', () => back(backAction()), { when: 'always' })). - Trigger: Focus any text input inside Settings (e.g., General display name, Models/Skills/MCP search input, Connection API key / Base URL) and press
Escape. - Impact: Previously,
<ModalDialog>relied on NSH's nativenavigation::key_pressed, where macOS, Windows, and Linux all intentionally blur a focused text field on the firstEscapewithout navigating away from the screen. Bindingescapewith{ when: 'always' }intercepts the key in the platform keymap monitor ahead of field blur, so pressingEscapeto leave an input immediately closes Settings or pops upDiscard unsaved changes?. - Fix: Use
when: terminal ? 'always' : 'notEditing'(TUI'shandle_field_keydoes not consumeEscape, while desktop blurs the focused input first and then lets a secondEscapestep back / close Settings).
- Where:
-
QuickLauncher.tsxtrackModalSurface()is redundant and breaks main-window SettingsEscape- Where:
products/maka/workbench/app/QuickLauncher.tsx:1546-1548and:1568. - Trigger: Have Settings open in the main window -> open QuickLauncher and enter a Quick Tool page (
page() !== null, wherecloseOnBlur={!props.conversing() && page() === null}isfalse) -> click back to the main window -> pressEscapein Settings. - Impact:
Escapein main-window Settings stops working while QuickLauncher stays open in the background. Moreover, this tracking is unnecessary in the first place:Bootstrap.tsxmounts the main app inside an explicit<Window id="main">, soModelSettings'skeymap.bindis already window-scoped tomainin NSH and never fires in<Window id="quick-launcher">. - Fix: Remove the
trackModalSurface()addition fromQuickLauncher.tsx.
- Where:
-
SessionSurface.tsxbreaksmod+gidempotency when no session is selected (selected() === null)- Where:
plugins/agent/conversations/ui/SessionSurface.tsx:812-842. - Trigger: Start on an empty conversation (
selected() === null) -> open Settings, switch to General or make an unsaved form edit -> pressmod+g(Models). - Impact: The PR moved
if (request.kind === 'settings')aboveif (!(shell()?.visible() ?? false) && !shell()?.dismissRoute()) return;, but leftif (request.kind === 'models' && sessionId === null)below it. With Settings open,mod+ghitsdismissRoute()first—synchronously settingsettingsOpenedtofalseand unmountingModelSettings(wiping unsaved drafts and page state)—and then callsopenSettings()to remount it fresh on the default page. - Fix: Keep the original normalization (
const target = request.kind === 'models' && sessionId === null ? { kind: 'settings' as const, sessionId } : request;) before theif (target.kind === 'settings')early return. That fixes the bug and keepsopen()shorter.
- Where:
-
Stale
settings.noticetoast cleanup when converging onto the globaltoaststore- Where:
products/maka/workbench/app/ModelSettings.tsx:214-226andplugins/settings/settings/ui.tsx:303-312. - Trigger: Save preferences in General (
operations.notice.set('Preferences saved.')) -> close Settings (ModelSettingsunmounts, butoperationslives at plugin scope sooperations.notice()retains the string) -> reopen Settings later. - Impact:
ModelSettingsmounts fresh withlastNotice = '', so the effect immediately re-emits the stalePreferences saved.notice into the globaltoaststore. Also, clearingoperations.notice.set('')on category switch doesn't calltoast.dismiss('settings.notice')(unlikeComposer.tsxandSessionSurface.tsx). - Fix: Call
toast.dismiss('settings.notice')whenmessagebecomes empty, and clearoperations.noticeon Settings close/cleanup when there are no pending operations.
- Where:
Design & Cleanliness (cc @Astro-Han)
-
Global
trackModalSurface()ref-count inModalDialog.tsxis brittle- Maintaining a parallel
Symbol.for('maka.workbench.openModalSurfaces')counter manually acrossModalDialog,WorkspacePicker,ImageViewer, andQuickLauncherduplicates NSH's modal stack and easily misses raw<Dialog>call sites (Workbench.tsx:272,SessionSurface.tsx:3000,RoomView.tsx:235, or future plugin dialogs). - If workbench-side tracking is needed while NSH
<Dialog>handlesEscapeafter ordinarykeymap.bind, it would be much cleaner to funnel all main-window<Dialog>usages through one shared wrapper (and keep separate<Window>s out of it) rather than scattering manualtrackModalSurface()calls.
- Maintaining a parallel
-
Dark-mode panel surface token vs.
DESIGN.md(cc @Astro-Han)DESIGN.mdandWorkbench.tsxseparate sidebar (C.chrome) and main panel (C.panel) via a surface-fill step without a border, with cards onC.card.- Here, to avoid touching
SettingsPage.tsx(which still usesC.surface/C.background), the dark-mode Settings panel stays onC.background(identical#161719fill asC.chrome) and compensates with a dark-only1px C.linehairline border around the entire panel. That leaves dark-mode Settings visually distinct from Conversations and Rooms (visible inafter-wide-dark.png). - There are only ~15 token references across
SettingsPage.tsxandSettingsField.tsx. Would appreciate @Astro-Han's call on whether to alignSettingsPageontoC.panel/C.cardnow or keep the dark hairline as an intentional interim compromise.
-
Ad-hoc local transitions/scale and deep
<If>nesting inModelSettings.tsxModelSettings.tsxintroduces localnavTransition(),iconButtonTransition(),navActiveStyle(),navFocusStyle(), andtransform: [{ scale: 0.95 }]on the nested Back icon button. Shared styles already live inui.tsx(quietFocusStyle,quietActiveStyle,controlHoverStyle), and neitherWorkspaceBrowser.tsxnorRoomWorkspace.tsxapplies background transitions or press scaling to navigation chrome.- The 3-level nested
<If>in the narrow header (splittingrail(),ownTitleBar, and!terminal) could also be flattened into a small helper so the layout structure reads cleanly at a glance.
Tests
Test additions currently make up 51.6% of the diff (+360 test lines vs. +338 prod lines), with noticeable duplication and low-signal parts:
- Pure screenshot harness left in
native-desktop(settings.rs):desktop_settings_page_shell_preserves_state_and_overlayslaunches 4 separate real macOS AppKit windows. Window #2 (light, lines 97–111) has zero assertions—it only opens Settings, clicks General, writes a screenshot artifact, and closes. Windows #3 and #4 repeat the exact same narrow flex-layout checks in both Dark and Light purely to capture screenshots. - Verification claim vs. actual coverage gap: The PR description states
settings.rsverifies idempotentmod+,, butsettings.rsnever sendsmod+,. Meanwhile, several core behaviors changed by this PR aren't tested anywhere:mod+,idempotency, returning from Settings to Rooms (workspaceModepreservation), hiddenpreviewDialogsuppression, and focused-inputEscape. - Implementation-coupled fake & duplicated geometry checks:
models-settings.tsxadds a syntheticTrackedDialogthat directly invokestrackModalSurface()(testing the private counter mechanism rather than realWorkspacePicker/ImageViewermodals), andsettings.rs+lib.rsduplicate the same hardcoded coordinate checks (<= 224,>= 240,Close settingsabsent,SelectEscape).
Suggested test cleanup: Delete the pure-screenshot windows, the synthetic TrackedDialog, and the duplicated pixel-bound assertions, and rebuild around behavior:
- One compact single-window
native-desktoptest verifying end-to-end host/AppKit behavior: conversation draft + RoomsworkspaceModepreservation across Settings entry/exit, idempotentmod+,keeping the current category, focused-inputEscapeblurring without leaving Settings,SelectEscapeisolation, and clean-rootEscape/Back to appreturn (plus one narrow non-overlap check if needed). - One compact headless test in
lib.rscovering Settings' unsaved-draft confirmation (Escape/Back to app), nested subpageEscapestepping, and terminal folding without locking exact pixel constants.
简体中文
整体方向是对的:把 Settings 从 ModalDialog 移成与 Conversations、Rooms 平级的倒 L 形 WorkspaceSurface,把提示收敛到全局 toast,并顺手删掉只用一次的 ModalDialog size="page",思路很合理。不过合入前有几个真实可达的 bug、一些设计与整洁度问题(涉及 DESIGN.md 和视觉壳层取舍的部分 cc @Astro-Han 一起看下),以及测试信噪比问题需要收拾一下。
正确性与合入阻塞项
-
与
main存在合并冲突(12 语言 JSON 迁移)- 当前 PR 状态已是
CONFLICTING:products/maka/workbench/app/locale-settings.ts已在 #7224(69af2805b2)被移除并迁移至products/maka/workbench/locales/*.json。 - 需要 rebase 到最新
main,在全部 12 个 locale JSON 中补齐"Back to app"并清理不再使用的"Close settings"。
- 当前 PR 状态已是
-
漏修了
RoomView.tsx对等路径的previewDialog抑制(且会叠加 Escape 穿透)- 位置:
plugins/agent/conversations/ui/RoomView.tsx:197-205对比products/maka/workbench/app/App.tsx:188-191,以及products/maka/workbench/app/Workbench.tsx:271-278。 - 触发路径:在窄窗口(
< 912pt,!canDockPreview())下进入 Rooms -> 点击消息里的文件/链接打开资源预览弹窗(previewDialog)-> 按mod+,打开 Settings。 - 影响:
App.tsx为 Conversations 的previewDialog补了settingsOpened() || workspaceMode() !== 'conversations'抑制,但对等的RoomView.tsx仍只判断suppressed: () => resources.imageViewer() !== null,漏掉了!input.visible()。结果 Room 的资源预览<Dialog>会一直盖在 Settings 上方;而且Workbench.tsx:272的<Dialog>未接入trackModalSurface(),用户按Escape想关预览弹窗时,会直接触发底下的ModelSettingsEscape绑定,把 Settings 关掉而预览弹窗仍留在屏幕上。 - 修复:在
RoomView.tsx的createPreviewDialog的suppressed条件中补上!input.visible()。
- 位置:
-
在 Settings 任意文本框内按
Escape会直接退页或弹丢弃确认,破坏桌面端编辑习惯- 位置:
products/maka/workbench/app/ModelSettings.tsx(keymap.bind('escape', () => back(backAction()), { when: 'always' }))。 - 触发路径:聚焦 Settings 内任意输入框(如 General 的 Display name、Models/Skills/MCP 搜索框、Connection 的 Base URL / API Key 等)并按
Escape。 - 影响:改造前
<ModalDialog>走 NSH 原生navigation::key_pressed,macOS / Windows / Linux 三端桌面都明确约定「聚焦输入框按Escape只退焦,绝不直接离开当前页」。改为{ when: 'always' }后,按键在平台 keymap monitor 阶段就会提前截胡,用户在搜索框或表单里按Escape想退出输入,会直接关掉 Settings 或弹出Discard unsaved changes?。 - 修复:改为
when: terminal ? 'always' : 'notEditing'(终端 TUI 的handle_field_key不消费Escape,桌面端则先由原生逻辑退焦,第二次Escape再返回/关闭 Settings)。
- 位置:
-
QuickLauncher.tsx中的trackModalSurface()既多余,又会在后台搞死主窗口 Settings 的Escape- 位置:
products/maka/workbench/app/QuickLauncher.tsx:1546-1548及:1568。 - 触发路径:主窗口开着 Settings -> 唤起 QuickLauncher 并打开某个 Quick Tool 子页(此时
page() !== null,closeOnBlur={!props.conversing() && page() === null}为false,失焦不关闭)-> 点回主窗口 -> 在主窗口 Settings 按Escape。 - 影响:只要 QuickLauncher 还停在后台,
hasOpenModalSurface()就一直为true,主窗口 Settings 的Escape彻底失效。而且这段追踪本身就没必要:Bootstrap.tsx把主应用包在显式<Window id="main">里,ModelSettings的keymap.bind在 NSH 中已经自动 scope 到main窗口,本来就不会在独立窗口<Window id="quick-launcher">中触发。 - 修复:直接移除
QuickLauncher.tsx里的trackModalSurface()改动。
- 位置:
-
SessionSurface.tsx拆分models后,空会话下在 Settings 里按mod+g会拆掉重挂 Settings(丢草稿和当前页)- 位置:
plugins/agent/conversations/ui/SessionSurface.tsx:812-842。 - 触发路径:处于空白会话(
selected() === null)-> 打开 Settings,切到 General 或修改任意表单产生未保存草稿 -> 按mod+g(Models)。 - 影响:PR 只把
if (request.kind === 'settings')提到了if (!(shell()?.visible() ?? false) && !shell()?.dismissRoute()) return;之前,把if (request.kind === 'models' && sessionId === null)留在了后面。结果会先执行dismissRoute()同步把settingsOpened置为false,立刻卸载ModelSettings(丢失未保存草稿与页面状态),紧接着再调openSettings()重新挂载回默认页。 - 修复:把原来的归一化逻辑
const target = request.kind === 'models' && sessionId === null ? { kind: 'settings' as const, sessionId } : request;整体提到if (target.kind === 'settings')之前即可,代码还更简洁。
- 位置:
-
收敛到全局
toast后,settings.notice缺少清理与关闭重置- 位置:
products/maka/workbench/app/ModelSettings.tsx:214-226与plugins/settings/settings/ui.tsx:303-312。 - 触发路径:在 General 保存偏好(
operations.notice.set('Preferences saved.'))-> 关闭 Settings(ModelSettings卸载,但operations挂在插件层,operations.notice()仍保留旧文案)-> 之后再次打开 Settings。 - 影响:
ModelSettings重新挂载后lastNotice回到'',effect会把上一次的Preferences saved.再次弹进全局toast;此外切换分类清空operations.notice.set('')时也没有像Composer.tsx/SessionSurface.tsx那样调用toast.dismiss('settings.notice')。 - 修复:
message变空时调用toast.dismiss('settings.notice'),并在 Settings 关闭 / cleanup 且无 pending 操作时清空operations.notice。
- 位置:
设计与整洁度(cc @Astro-Han)
-
ModalDialog.tsx里的trackModalSurface()全局引用计数过于脆弱- 通过
Symbol.for('maka.workbench.openModalSurfaces')在ModalDialog、WorkspacePicker、ImageViewer、QuickLauncher四处手动维护一份平行于 NSH 原生 modal 栈的影子计数,既分散了单一事实来源,又容易漏掉仓库里的裸<Dialog>(Workbench.tsx:272、SessionSurface.tsx:3000、RoomView.tsx:235)以及后续插件里的弹窗。 - 如果短期内不改 NSH、仍需要在 workbench 侧协调弹窗与页面级
Escape,更干净的做法是把主窗口内所有<Dialog>收口到一个统一封装里自动记账(不要让调用方手动调用隐式协议,也不要把独立<Window>混进来)。
- 通过
-
深色模式主面板色阶与
DESIGN.md不一致(cc @Astro-Han)DESIGN.md和Workbench.tsx规定侧栏(C.chrome)与主面板(C.panel)通过无边框的色阶落差区分,卡片使用C.card。- 本 PR 为了不动
SettingsPage.tsx(内部仍在用C.surface/C.background),在深色模式下把 Settings 主面板留在与C.chrome同色的C.background(#161719),再额外套一圈深色专属的1px C.line框线(在after-wide-dark.png里对比 Conversations / Rooms 挺明显)。 SettingsPage.tsx与SettingsField.tsx里相关 token 统共约 15 处,方便的话请 @Astro-Han 拍个板:是这次顺手把SettingsPage对齐到C.panel/C.card,还是明确接受深色细线作为阶段性折中。
-
ModelSettings.tsx的局部过渡/缩放样式和嵌套<If>- 新增了局部
navTransition()、iconButtonTransition()、navActiveStyle()、navFocusStyle()以及子页返回按钮的transform: [{ scale: 0.95 }]。但ui.tsx已有共享的quietFocusStyle/quietActiveStyle/controlHoverStyle,且WorkspaceBrowser.tsx、RoomWorkspace.tsx的导航栏 chrome 均未使用背景过渡或按压缩放,这里显得风格跳戏。 - 窄屏头部为了放置
backToApp嵌套了三层<If>(rail()/ownTitleBar/!terminal),抽成扁平分支可读性会好很多。
- 新增了局部
测试质量
当前新增测试占总新增行数的 51.6%(测试 +360 vs. 生产代码 +338),但信噪比偏低、重复断言较多:
native-desktop里残留了纯截图用例(settings.rs):desktop_settings_page_shell_preserves_state_and_overlays连续启动了 4 个真实 macOS AppKit 窗口。其中第 2 个窗口(light,97–111 行)没有任何断言,只打开 Settings、点 General、截完图就关;第 3、4 个窗口(narrowDark/Light 循环)只是为了多截一张图把同一组窄屏坐标断言跑了两遍。- PR 描述与实际覆盖不符:PR 正文 Verification 写了
settings.rs验证了幂等mod+,,但整份settings.rs从未按过mod+,;同时本次改动里几项关键行为(mod+,幂等不重置当前页、从 Rooms 进出 Settings 保留workspaceMode、隐藏的previewDialog抑制、聚焦输入框内按Escape)目前都没有测试覆盖。 - 测试实现细节 + 跨套重复断言:
models-settings.tsx造了个假组件TrackedDialog直接调trackModalSurface()(测的是私有计数辅助函数本身,而不是真实的WorkspacePicker/ImageViewer),且settings.rs与lib.rs重复锁死了相同的像素坐标(<= 224、>= 240)、Close settings缺失以及SelectEscape。
建议重构测试:删掉纯截图窗口、假 TrackedDialog 和重复的像素坐标断言,围绕真实行为重新精简成两块高价值测试:
- 1 个单窗口
native-desktop行为测试:覆盖需要真实宿主与 AppKit 才能验到的行为——进出 Settings 保留会话草稿与 RoomsworkspaceMode、mod+,幂等停留在当前分类、输入框内按Escape只退焦不离页、SelectEscape隔离、clean root 按Escape/Back to app返回(如需防窄屏回归,补一次单主题640×480不重叠校验即可)。 - 1 个紧凑的
lib.rsheadless 测试:聚焦 Settings 自身的未保存草稿确认(Escape/Back to app)、嵌套子页逐级Escape返回与终端模式折叠行为,避免绑死具体像素常量。
…L page Move Settings out of ModalDialog into a peer WorkspaceSurface alongside Conversations and Rooms, preserving background session state (drafts, scroll positions, side panes, streaming turns, and workspaceMode). - Route Settings as a peer WorkspaceSurface in App.tsx, suppress hidden previewDialog modals in both Conversations (App.tsx) and Rooms (RoomView.tsx), update windowTitle, and keep mod+, and empty-draft mod+g idempotent when Settings is already open (SessionSurface.tsx). - Replace ModalDialog in ModelSettings.tsx with Maka's borderless inverted-L shell (C.chrome left rail with TitleBar and Back to app, rounded C.panel main panel with windowDrag and controlsRight clearance, shared ui.tsx chrome states, flat narrow 640x480 folding, and 8x16 terminal cell layout). - Align SettingsPage.tsx and Settings subpages inside SettingsSection onto Maka's C.panel -> C.card -> C.cardRaised surface ladder with clear Dark, Light, and Terminal hover/active/focus states, and update DESIGN.md accordingly. - Converge operations.notice() onto the global toast store with explicit dismissal and close/cleanup reset (ModelSettings.tsx, settings/ui.tsx), and remove the unused size="page" variant from ModalDialog. - Centralize main-window modal tracking behind a shared WindowDialog wrapper (ModalDialog.tsx) across all 6 main-window Dialog call sites, and bind Escape in ModelSettings with when: terminal ? 'always' : 'notEditing' so desktop inputs blur on first Escape before stepping back. - Add Back to app and remove unused Close settings across all 12 locale JSONs, update existing desktop tests, and add compact behavioral tests in settings.rs and lib.rs. Generated-by: Antigravity (Gemini)
…l/C.card shell
a1b18ec to
e4397cc
Compare
|
Thanks for the thorough review @M4n5ter! I've rebased onto
Ready for another look! 点击展开中文感谢 @M4n5ter 详尽的 Review!已 rebase 到最新
麻烦有空再看一眼! |
…aised styles - Use C.cardRaised hover fill on QuickCommands ShortcutRecorder inside SettingsSection cards. - Export cardRaisedHoverStyle/cardRaisedActiveStyle from SettingsPage and reuse them in RootUiSettings. - Drop the duplicate operations.notice reset in plugins/settings/settings/ui.tsx (already handled in ModelSettings cleanup on unmount).
There was a problem hiding this comment.
LGTM! Thanks for the thorough follow-up — all prior correctness, surface-ladder, modal-tracking, and test-quality items are cleanly addressed.
I pushed a small cleanup commit (1354e2494a) to handle three minor nits directly before merging:
- Switched
QuickCommands'sRecord shortcuthover fill insideSettingsSectionfromC.raisedtoC.cardRaised. - Exported
cardRaisedHoverStyle/cardRaisedActiveStylefromSettingsPage.tsxand reused them inRootUiSettings.tsx. - Dropped the duplicate
operations.noticereset inplugins/settings/settings/ui.tsx(already covered byModelSettingscleanup on unmount).
Summary
Problem
Settings previously rendered inside a floating
<ModalDialog size="page" height={800}>over a dimmed scrim on top of Conversations/Rooms:DESIGN.md §Window shell) and TS Maka's page-mode Settings layout, leaving a dimmed background sidebar, a redundant static"Settings"heading, and a modal top-right×close button.640×480), the modal chrome and outer scrim consumed scarce viewport height and squeezed settings rows below the visible viewport.<Toaster>instance instead of using the app's global toast store, andModalDialogcarried a one-offsize="page"variant solely for Settings.Solution
WorkspaceSurfacerouting (products/maka/workbench/app/App.tsx,plugins/agent/conversations/ui/RoomView.tsx,plugins/agent/conversations/ui/SessionSurface.tsx):conversationsandroomssurfaces on!settingsOpened()and rendersettingsViewContractinside a third peer<WorkspaceSurface visible={settingsOpened}>. Conversations and Rooms remain mounted (display: 'none') so streaming turns, scroll positions, composer drafts, side panes, andworkspaceModesurvive entering and leaving Settings.windowTitletotr('Settings')while open, suppress hiddenpreviewDialogoverlays when invisible in both Conversations (App.tsx) and Rooms (RoomView.tsx), and keep bothmod+,and empty-draftmod+g(selected() === null) idempotent when Settings is already open.C.panel/C.cardsurface ladder (products/maka/workbench/app/ModelSettings.tsx,SettingsPage.tsx,RootUiSettings.tsx,ComposerToolbarSettings.tsx,GeneralSettings.tsx,RemoteAccessSettings.tsx,CommunityPlugins.tsx,ConnectionModel.tsx,DESIGN.md):<ModalDialog>with Maka's inverted-L window shell: a224ptC.chromeleft rail with<TitleBar height={TITLE_BAR_HEIGHT}>clearing macOS traffic lights, a full-width← Back to appbutton, and a scrollable category list; plus a borderless rounded12ptC.panelmain panel (PANEL_INSET = 8,windowDrag,controlsRight(true)clearance, no modal×close button).SettingsPage.tsx(SettingsSection->C.card, in-card controls/badges/triggers/buttons ->C.cardRaisedwith Dark/Light/Terminal hover, active, andquietFocusStyle()focus states, in-card inputs & textarea fade ->C.panel, panel-levelSettingsSearch->C.background) and Settings subpages resting onSettingsSectiononto Maka's semantic surface ladder, keepingDESIGN.mdin sync.ui.tsxshared chrome styles (quietFocusStyle,quietActiveStyle,quietHoverStyle,controlHoverStyle), flatten narrow header folding (narrowBackBar()), and snap strictly to the8×16grid on terminal (platform.idiom === 'terminal').<WindowDialog>, and desktop-nativeEscape(products/maka/workbench/app/ModelSettings.tsx,ModalDialog.tsx,WorkspacePicker.tsx,ImageViewer.tsx,Workbench.tsx,plugins/settings/settings/ui.tsx,RoomView.tsx,SessionSurface.tsx):operations.notice()onto the globaltoaststore withtoast.dismiss('settings.notice')on clear/unmount and resetoperations.noticeon Settings close/cleanup when no operations are pending; remove the unusedsize="page"variant fromModalDialog.<Dialog>call sites through one shared<WindowDialog>wrapper inModalDialog.tsxsohasOpenModalSurface()automatically suspends the SettingsEscapebinding while any main-window modal dialog is open (without coupling separate<Window>s such asQuickLauncher).Escapewith{ when: terminal ? 'always' : 'notEditing' }so desktop blurs focused<Input>fields on the firstEscapebefore stepping back through nested subpages / unsaved-draft prompts and returning to the app, while terminal keeps'always'.products/maka/workbench/locales/*.json):"Back to app"across all 11 full locale JSONs (zh-HKinherits"返回應用"fromzh-TWper overlay rules) and remove the unused"Close settings"key.点击展开中文
要解决的问题
此前 Rust Maka 的 Settings 以浮动模态框(
<ModalDialog size="page" height={800}>)+ 遮罩层的形式叠在 Conversations/Rooms 之上:DESIGN.md §Window shell)以及 TS Maka 的页面模式设置布局不一致,存在遮罩层、冗余静态"Settings"标题与右上角×关闭按钮。640×480)下,弹窗外边距与遮罩消耗了大量可视高度,挤压设置项。<Toaster>,且ModalDialog仅为 Settings 保留了size="page"变体。当前解决方案
WorkspaceSurface路由(App.tsx、RoomView.tsx、SessionSurface.tsx):将 Settings 渲染为与 Conversations、Rooms 平级的第三个<WorkspaceSurface visible={settingsOpened}>,进入/离开 Settings 时保持 Conversations 与 Rooms 挂载以完整保留流式回复、滚动位置、输入框草稿、侧边面板与workspaceMode;同步抑制 Conversations 与 Rooms 不可见时的previewDialog,更新窗口标题为Settings,并保持mod+,以及空会话(selected() === null)下mod+g的幂等性。C.panel/C.card色阶对齐(ModelSettings.tsx、SettingsPage.tsx、RootUiSettings.tsx、ComposerToolbarSettings.tsx、GeneralSettings.tsx、RemoteAccessSettings.tsx、CommunityPlugins.tsx、ConnectionModel.tsx、DESIGN.md):移除<ModalDialog>,采用224ptC.chrome左侧栏(<TitleBar>+ 全宽← Back to app / 返回应用+ 可滚动分类)与右侧无边框12pt圆角C.panel主面板,并将SettingsSection与其内部控件对齐到C.card/C.cardRaised色阶(确保深/浅色与终端下的 hover、active 与quietFocusStyle()键盘焦点清晰可见),复用ui.tsx共享样式,扁平化窄屏头部折叠(narrowBackBar()),并严格对齐终端8×16字符网格。<WindowDialog>与原生桌面Escape行为(ModelSettings.tsx、ModalDialog.tsx、WorkspacePicker.tsx、ImageViewer.tsx、Workbench.tsx、plugins/settings/settings/ui.tsx、RoomView.tsx、SessionSurface.tsx):将operations.notice()收敛到全局toaststore 并在清空/关闭时调用toast.dismiss('settings.notice')与清理残留提示;用统一的<WindowDialog>封装收口主窗口全部 6 处<Dialog>调用,自动协调hasOpenModalSurface()(不影响独立<Window>的QuickLauncher);Settings 的Escape绑定使用{ when: terminal ? 'always' : 'notEditing' },桌面端在聚焦<Input>内首次按Escape仅退焦而不离页,再次按Escape再逐级返回子页、处理未保存草稿或回到应用。products/maka/workbench/locales/*.json):在全部 11 份完整 locale JSON 中新增自然翻译的"Back to app"(zh-HK按 overlay 规则继承zh-TW的"返回應用"),并移除不再使用的"Close settings"。验证情况
cargo fmt --all -- --check、涉及改动目录的biome format plugins/ products/、ASF 许可证头检查(2,785 个文件)、12 语言i18n/check.mjs、workbench 单元测试(304/304)、products/maka/bundle类型检查、maka-workbench单元测试(3/3,覆盖真实ModalDialogEscape隔离、未保存草稿保护、嵌套子页Escape逐级返回与终端窄屏折叠)、run product(31 个插件包 + 5/5 产品测试 + notices 检查)以及 macOS AppKitnative-desktop实机集成测试(desktop_settings_page_shell_preserves_state_and_overlays)。native-desktop实机渲染采集 Before(模态框)与 After(无边框C.chrome->C.panel->C.card倒 L 形页面)的深/浅色、宽屏(1120×900)与窄屏(640×480)对比截图(见下方 Verification 表格)。Verification
Visual Comparison (macOS AppKit
native-desktopcaptures)C.panel/C.cardpage)1120×900, General)1120×900, General)1120×900, Models)640×480, General)640×480, General)Automated Checks
cargo fmt --all -- --check— passednode node_modules/@biomejs/biome/bin/biome format plugins/ products/— passed (533files; untouched upstreamscripts/ci/suites.mjscurrently has a pre-existing formatting diff onorigin/main)node scripts/asf-license-headers.mjs check— passed (2785covered files audited)node scripts/i18n/check.mjs— passed (12locales,5catalogs,1doc set)node node_modules/typescript/bin/tsc -p products/maka/bundle/tsconfig.json— passed (note: fullnode scripts/ci.mjs run contractsalso verifiedpackages/plugin-sdkand allproducts/&plugins/against generatedui-typeswith 0 errors; untouched upstreamskills/maka-plugin-authoring/assets/composer-ui/index.tsxcurrently failstsconorigin/mainafter#7310)node --test products/maka/workbench/tests/*.test.mjs— passed (304/304)node scripts/ci.mjs run product— passed (31plugin packages built,5/5product tests,THIRD_PARTY_NOTICES.txtcheck)cargo test --locked -p maka-workbench --lib -- settings_page_shell models_settings— passed (3/3:settings_page_shell_navigation_and_terminal_foldingcovering realModalDialogEscapeisolation, dirty-draftEscape&Back to appconfirmation, nested subpageEscapestepping, and narrow terminal folding; plus existingmodels_settings_*tests)cargo test --locked -p maka-cli --features desktop-tests --test native-desktop -- --exact terminal::desktop_new_session::desktop_settings_page_shell_preserves_state_and_overlays— passed (1/1: real macOS AppKit verification of conversation draft preservation, RoomsworkspaceModepreservation, idempotentmod+,and empty-draftmod+g, focused<Input>Escapeblur before stepping back,SelectEscapeisolation, clean-rootEscape/Back to appreturn, and narrow640×480non-overlap folding)node scripts/ci.mjs check licenses(cargo-denyis not installed in the local toolchain; ASF header verification ran directly vianode scripts/asf-license-headers.mjs check).AI use
Select exactly one:
Tool(s) and scope: Antigravity (Gemini) — implemented the Settings full-window inverted-L shell refactor,
WorkspaceSurfacerouting,C.panel/C.card/C.cardRaisedsurface alignment, shared<WindowDialog>wrapper,Escapeand notice toast handling, 12-locale updates, and headless +native-desktopbehavioral tests (Generated-by: Antigravity (Gemini)commit trailer retained).Checklist
Does this PR entail a breaking change or persisted-data migration?
upgrade_compat.rscoverage under Summary aboveDoes this PR entail a change in behavior?