Skip to content

feat(canvas): Let an aux canvas pane detach into its own window - #1

Closed
Cinnnnnnndy wants to merge 3 commits into
mainfrom
openbitfun/detached-canvas-window
Closed

Cinnnnnnndy wants to merge 3 commits into
mainfrom
openbitfun/detached-canvas-window

Conversation

@Cinnnnnnndy

Copy link
Copy Markdown
Owner

Summary

Let an aux canvas pane detach into its own OS window. A canvas scope is owned by exactly one window at a time: detaching hands the scope over (the docked pane keeps a placeholder) and recalling hands it back, so neither side merges live edits from the other.

  • transfer/detachability.ts — which panes may detach, and when.
  • transfer/detachedCanvasProtocol.ts — the wire contract between the docked pane and the detached window (handshake, snapshot, recall).
  • infrastructure/runtime/canvasTransferChannel.ts — the transport, shared by Tauri events and BroadcastChannel.
  • infrastructure/runtime/detachedWindow.ts + useDetachedAuxPane.ts — window lifecycle and the React binding for moving ownership across the boundary.
  • DetachedCanvasWindow/ — the host that boots from ?openbitfunWindow=detached-canvas without the product shell, plus the desktop capability label detached-canvas-* and the en-US / zh-CN / zh-TW strings.

Type and Areas

Type: Feature.

Areas: desktop/Tauri, web UI.

Motivation / Impact

A canvas pane is currently confined to the session's docked layout. Detaching lets a user pull one canvas onto a second monitor and keep it there while the session window does something else. Ownership moves instead of being mirrored, so there is no dual-writer merge problem; the docked pane keeps a placeholder so the layout stays stable.

Verification

  • corepack pnpm --dir src/web-ui exec vitest run src/app/components/panels/content-canvas/transfer src/infrastructure/runtime/canvasTransferChannel.test.ts src/infrastructure/runtime/detachedWindow.test.ts — passed (4 files, 25 tests).
  • corepack pnpm --dir src/web-ui run type-check — blocked, honestly: 3 TS2307: Cannot find module '@/generated/api' errors in websocket-adapter.ts and ConfigAPI.ts, both untouched by this branch. src/web-ui/src/generated/ is absent in this checkout; that barrel is produced by pnpm run gen:types (cargo export). No error is reported in any file this branch changes.
  • Not run: an end-to-end detach/recall inside the Tauri shell. This branch is verified by unit tests only.

Reviewer Notes

AI-assisted change; testing level: lightly tested (unit tests pass, no Tauri end-to-end run).

  • The desktop capability now admits a wildcard window label, detached-canvas-*. Worth a look at the permission surface.
  • Detach handoff is token-scoped per session (sourceId + token), so a late message from a previous detach is ignored. Recall closes the detached window; if it crashes, the scope stays owned by a dead window until recall.
  • Rollback: revert the commit; nothing persists on disk.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Generated with OpenBitFun

Cinnnnnnndy and others added 3 commits October 13, 2026 17:29
Add a detached canvas window where one agent canvas scope is owned by
exactly one window at a time: detaching hands the scope over and recalling
hands it back, so neither side has to merge live edits. Define the
detachability rules, the cross-window protocol over a shared channel and
the window lifecycle helpers, host the detached canvas, and rewire the aux
pane and canvas store to move ownership across the boundary.

Boot the window from `?openbitfunWindow=detached-canvas` without the
product shell, allow the `detached-canvas-*` window label in the desktop
capability, and add the locale strings.

Cover the rules, protocol, channel and window lifecycle with tests.

Co-authored-by: OpenBitFun <[email protected]>
Carry the whole session on the branch: the mobile component set, the Lab's
surfaces and typography, the hero centring, the top air and the showcase
band with its revert all arrive from main, which stays untouched. The
branch's own work is still the detached canvas window alone, so the pull
request's diff against main does not change.

Co-authored-by: OpenBitFun <[email protected]>
Keep the branch carrying the whole session: the homepage wash arrives from
main. The branch's own work is unchanged, so the pull request's diff
against main does not move.

Co-authored-by: OpenBitFun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant