You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "testikun (via GitHub)" <gi...@apache.org> on 2026/09/18 08:46:33 UTC

[PR] feat(desktop): focus file and browser previews with shared composer [maka]

testikun opened a new pull request, #5482:
URL: https://github.com/apache/maka/pull/5482

   ## Summary
   
   - Add a content-area focus/restore mode for existing Files previews and Browser pages. Keep the same mounted session composer and draft while the conversation column is hidden; provide a drag handle and an accessible click/keyboard control.
   - Attach a collapsible latest-turn stream to the composer while running, then show the settled reply in place. The panel and attachment drawer share a continuous edge with the input. A minimize/restore control and measured scroll clearance keep the document's last lines and native Browser viewport usable.
   - Preserve the current artifact renderers and read/security limits for Markdown, source, diff, HTML, image, and PDF. Office binaries get an explicit unsupported fallback rather than accidental text decoding. Document the format boundaries and future CSV/Office/Notebook requirements.
   
   Fixes #5469. Workspace-reference opening remains tracked by #2664; this PR does not claim dedicated Office/Notebook/table viewers.
   
   Split view:
   
   ![Split conversation and file](https://raw.githubusercontent.com/testikun/maka/codex/desktop-focused-preview/docs/images/pr/desktop-focused-preview/split.png)
   
   Focused view with the latest reply attached to the same composer:
   
   ![Focused file with composer](https://raw.githubusercontent.com/testikun/maka/codex/desktop-focused-preview/docs/images/pr/desktop-focused-preview/focused.png)
   
   Minimized reading mode:
   
   ![Reading clearance with minimized composer](https://raw.githubusercontent.com/testikun/maka/codex/desktop-focused-preview/docs/images/pr/desktop-focused-preview/reading.png)
   
   ## Verification
   
   - Integrated the commit onto `upstream/main` (19971f3f2) in an isolated worktree without conflicts; checked the proposed merge tree.
   - Renderer TypeScript check, renderer architecture suite (112 tests), locale hygiene, and Biome on changed source files pass with Node 24.
   - Storybook production build passes. Every new Files/Browser focus, latest-turn, attachment, and reading-clearance story passed in the full visual smoke run, including its `play` assertions.
   - Full `npm run build` remains blocked by `packages/ui` type errors (`settledText`, `autoScroll`, `trailingAction`) outside this patch. The full Storybook smoke reports four failures in unchanged sidebar/AppShell/Composer stories; therefore neither whole-repo build nor whole-catalog smoke is claimed as passing. Native Electron `WebContentsView` behavior still needs a desktop manual pass.
   
   ## AI use
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: Codex analyzed the screenshots and local Desktop bundle, authored the implementation, Chinese design document, Storybook coverage, and PR text. The commit includes `Generated-by: Codex`; human review is required before merging.
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [ ] Lint, format, typecheck and the affected suites pass locally
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5791991012

   @M4n5ter @me2seeks Follow-up on current head `02d89aeb9`:
   
   - The earlier review fixes remain in place after merging current `main`: focused-preview Escape dismisses local popups first and then restores the split view without stopping a run; completed replies open at the start, live replies follow only at the end, and collapse/restore retains the reading position. Bounded output shows truncation with a path to the full conversation. The composer width now follows its container without the 990/991px jump, and the compact status vocabulary matches WorkHub.
   - The composer dock is located through the stable marker and focus is refused when it is absent. Only an actual pointer drag can trigger divider focus; keyboard End remains a resize, with a separate explicit focus control. The shared ProgressCard status is a sibling live region, not inside a button.
   - The latest merge conflicted only in the generated Astryx inventory. Regeneration/check now agrees on 295 files; no additional UI abstraction was needed. Local checks passed: UI build and 621 tests, Desktop build/typecheck, architecture and locale checks, Storybook build, and 7 focused story renders (including keyboard resize, missing host, reading/truncation, and WorkHub in light/dark). Hosted CI on this new head is pending.
   
   Please re-review the updated head when CI finishes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5770105716

   Resolved: merged current `main` (`8bde344b1`, 2026-09-22), resolved the WorkHub E2E/inventory conflicts, and isolated the foreground floating-window draft assertion from host keyboard input. Local typecheck, renderer architecture, production build, Astryx inventory, and all 3 WorkHub E2E tests pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5758630797

   已解决:已合入 2026-09-21 当前 `main`,Skill draft 与 Astryx inventory 冲突已按 `main` 现有行为解决,inventory 已重新生成。
   
   本地验证通过:Astryx inventory、UI/Desktop typecheck、renderer architecture、生产 Desktop build,以及 WorkHub/Skill draft 5 个 Electron 用例。新 CI 已启动。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5754142816

   @me2seeks 已按这轮 review 完成并推送到 `9937a20dd`:
   
   - 聚焦入口现在依赖 `ChatSurfaceLayout` 暴露的稳定 composer dock 标记;目标缺失时不会进入或显示“假聚焦”状态,并补了宿主缺失回归故事。
   - divider 只有真实 pointer 拖动越过阈值才会进入聚焦;键盘 `End` 保持普通 resize,显式“聚焦文件/网页”按钮仍是可发现的键盘入口,并补了 800px 窄窗口真实 `ResizeHandle` 回归。
   - `ProgressCard` 的 `role="status"` 已移回独立 live region,展开/打开动作使用相邻 IconButton;WorkHub 故事断言 status 不再嵌套于 button。
   - 已合入 2026-09-21 最新 `upstream/main` (`feb9cf22f`) 并解决冲突。
   
   验证:完整 Desktop typecheck、UI typecheck/538 tests、renderer architecture、locale hygiene、Storybook build,以及 5 个聚焦/WorkHub 相关 play 均通过。消融后删除了重复的 dock `position: relative` 覆盖,相关故事仍通过。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5770174815

   Resolved: CI exposed a linkedom event-realm mismatch in the preview Escape bridge. The custom event now comes from the editor document's window; all 615 UI tests and the 3 WorkHub E2E tests pass locally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5806091277

   审查意见已汇总处理,最新 main 合并已推送到 `8467f1e5c`:
   
   - focused mode 只有在 composer host 存在时才能进入;拖动入口只响应 pointer,键盘 End 不再意外聚焦。
   - Escape 先由 composer 处理局部弹层,再通知 focused-preview host 退出;不会触发 Stop,显式 Stop 行为不变。
   - `role="status"` 已移到按钮外的 sibling live region,WorkHub 无障碍语义恢复。
   - 已完成回复首次从头展示;live 仅在读者位于尾部时跟随;折叠、最小化/恢复保留阅读位置。
   - 截断提示、View full conversation、连续容器宽度,以及 990/991px 回归均已覆盖。对应修复提交为 `333906445`、`0fc0491ee`、`9fd2ae11c`。
   - 本轮合并解决 Astryx inventory 冲突(295 covered / 2 exclusions)。workspace build/typecheck、renderer architecture、102 项协议/epoch 测试和 Storybook production build 通过;所有 focused-preview/workbar/WorkHub/File/Browser 故事通过。全目录 smoke 唯一可复现失败是未由本 PR 修改的 Functional Motion Spinner 断言,已在 PR 描述中如实记录。
   
   当前没有未解决的行内线程,烦请基于新 head 复核。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "me2seeks (via GitHub)" <gi...@apache.org>.
me2seeks merged PR #5482:
URL: https://github.com/apache/maka/pull/5482


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] feat(desktop): focus previews with a shared composer and progress card [maka]

Posted by "me2seeks (via GitHub)" <gi...@apache.org>.
me2seeks commented on PR #5482:
URL: https://github.com/apache/maka/pull/5482#issuecomment-5748778687

   ## Review(对抗式复核,基于 `main @ 0117d76c5`)
   
   方向是好的:让文档成为主视图,同时保留同一个输入框、草稿和附件;与 WorkHub 共享 `ProgressCard` 也值得保留。上一轮 review 提的 4 条交互问题,我逐条核对过,**已修好的部分确认如下**:
   
   - **Escape 语义**:`composer.tsx` 新增 `maka-composer-escape` 自定义事件,预览宿主先于「流式中断」获得处理权,顺序正确。
   - **990px 跳变**:旧的 990px viewport override 已删除,改为 `width: min(960px, calc(100% - 2 * var(--space-4)))` 的连续容器宽度。
   - **截断提示 + 查看完整对话**:`recent-turn-overlay.tsx` 有 `truncated` 判定、`role="note"` 提示和「查看完整对话」按钮。
   
   不过还有 2 个真实缺陷和 1 个无障碍回归,建议合并前处理。
   
   ---
   
   ### P1 — 聚焦状态可能「假聚焦」:UI 说已聚焦,布局却没生效,且没有兜底
   
   `apps/desktop/src/renderer/features/workbar/controller/use-focused-preview.ts:57-60`:
   
   ```ts
   useLayoutEffect(() => {
     const frame = surfaceRef.current?.closest('.maka-detail-with-artifacts');
     setComposerTarget(frame?.querySelector<HTMLElement>(':scope > .mainColumn .maka-chat-layout > :last-child > :last-child') ?? null);
   }, [input.host.activeId]);
   ```
   
   这个 effect 只在 `activeId` 变化时运行一次。如果这一次 commit 里 `surfaceRef.current` 为 null,或选择器没命中,`composerTarget` 会**整个会话保持 null**。所有布局 effect 都在 `!composerTarget` 时静默 return,但 `focusedPreview` 仍然为真,并一路传到 `workbar-host.tsx:221` → `workbar-surface.tsx:559/572`,于是面板按钮变成「还原分栏」、`aria-pressed=true`,而**实际的聚焦布局从未发生**。用户处在一个「声称已聚焦但并未聚焦」的状态,只能靠点那个按钮退出,没有重试、没有断言、没有 fallback。
   
   另外这个深层选择器本身也脆弱:它依赖 Astryx `ChatLayout` 的内部 DOM(root → messageArea + dockContainer → dock → dockInner → composer)。我核对过,`:last-child > :last-child` 实际解析到的是 **`.dock`,而不是 composer 本身**,语义已经和注释不符。上游结构一变就会静默返回 null(或拿到错误的节点),直接触发上面的坏状态。
   
   建议:进入聚焦前断言 `composerTarget` 存在;用稳定的 `data-testid` / class 替代深层选择器;找不到宿主时不要进入聚焦态。
   
   ---
   
   ### P1 — 键盘 `End` 键会意外进入聚焦模式
   
   `use-focused-preview.ts:245-256` 的进入条件是「拖动后剩余对话宽度 ≤ 240px」:
   
   ```ts
   drag.width = Math.max(input.host.rightResizable._minSizePx,
     Math.min(drag.frame.clientWidth - 120, drag.startWidth + delta));
   if (drag.width > drag.startWidth && drag.frame.clientWidth - drag.width <= 240) {
     drag.frame.dataset.previewCollapseReady = 'true';
   }
   ```
   
   而 Astryx `ResizeHandle` 的键盘处理(`ResizeHandle.tsx:555-560`)里,按 `End` 会调用 `_onResizeMove(_maxSizePx - _size)`,即 `600 - 当前宽度`。由于 `SESSION_WORKBAR_MAX_WIDTH = 600`,**只要窗口宽度 ≤ 840px**,条件 `clientWidth - 600 ≤ 240` 就成立——按一下 `End`(一个正常的「展开面板」操作)就会静默把对话折叠进聚焦模式。这是纯键盘可触发的意外进入,恰恰是这轮想避免的情况。
   
   附带问题:**唯一**能进入聚焦的键盘路径就是这个意外路径,没有任何可发现的键盘入口;而折叠提示(`.maka-preview-collapse-hint`)只在拖拽越过阈值时才出现——功能既难发现又易误触。建议给聚焦一个明确、可发现的键盘入口,并把「进入聚焦」与普通 resize 手势区分开。
   
   ---
   
   ### P2 — 共享 `ProgressCard` 把 `role="status"` 挪进 `<button>`,WorkHub 无障碍回归
   
   对比 base:原 `workhub-progress-card.tsx` 里 `role="status"` 是**独立 `<span>`**,与 IconButton 平级;新的共享组件 `packages/ui/src/progress-card.tsx:52-56` 把状态 span **塞进了 `<Button>` 内部**。`role="status"` 是一个 live region,嵌在按钮里会改变读屏语义,属于共享抽象顺带引入的回归,而不是纯收益。建议把状态文本移出按钮,或明确说明这是有意为之并补上无障碍验证。
   
   ---
   
   ### P3 — 测试未覆盖上述两条真实路径
   
   `apps/desktop/stories/session-workbar.stories.tsx` 里用的是 `_onResizeEnd: noop` 的 mock,既没走真实键盘 `End` 路径,也没测 `composerTarget` 为 null 的降级。建议补一个真实 `ResizeHandle` 键盘用例和一个宿主缺失用例。
   
   ---
   
   **小结**:P1 两条 + P2 一条建议修完再合;P3 可作为后续补强。上面每一条都附了文件与行号,方便核对。
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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