guanghu/docs/adr/0127-native-ai-workspace-window.md
冰朔 8739805f99
Some checks failed
Auto-update PR branches / Update open PR branches (push) Has been cancelled
CI / Frontend Static Quality Checks (push) Has been cancelled
CI / Frontend Tests & Coverage (push) Has been cancelled
CI / Rust Tests & Quality Checks (push) Has been cancelled
CI / Linux build verification (push) Has been cancelled
Release (Alpha) / Compute alpha version (push) Has been cancelled
Release (Alpha) / Build release artifacts (push) Has been cancelled
Release (Alpha) / GitHub Release (alpha) (push) Has been cancelled
Release (Alpha) / Update docs and release pages (push) Has been cancelled
Deploy docs / Build VitePress site (push) Has been cancelled
Deploy docs / Deploy to GitHub Pages (push) Has been cancelled
光湖开源源码快照 · Tolaria AGPL 分叉基线 · 独立更新链
2026-07-05 17:45:16 +08:00

2.2 KiB

type, id, title, status, date
type id title status date
ADR 0127 Native AI workspace window active 2026-05-26

Context

The AI panel used to behave like another right-side editor panel. That kept the agent UI inside the main Tolaria window even when the user undocked it, so the "floating" surface could not be moved to another macOS space or placed beside Tolaria as a real window.

The AI surface also needed to support multiple chat sessions, per-chat target selection, and a single header that does not duplicate the old panel title and permission controls.

Decision

The AI surface is a renderer-owned AiWorkspace that can run either docked in the main app or in a dedicated native Tauri webview window labeled ai-workspace.

The docked and native-window modes share the same React workspace component. The native window boots the normal App path with ?window=ai-workspace, skips main-window size constraints, and uses macOS overlay traffic lights. Close and minimize requests from that window emit a dock request back to the main window before destroying the pop-out window.

Options considered

  • Native Tauri window (chosen): gives macOS users real window movement, traffic lights, and normal desktop window management; requires route/window-mode plumbing and explicit dock events.
  • CSS floating panel inside the main window: simple and preserves component state in one renderer, but it cannot leave the main window bounds and fails the expected macOS behavior.
  • Separate full AI app shell: isolates the workspace, but would duplicate vault loading and settings flows more than necessary.

Consequences

  • The status-bar AI affordance opens the workspace; target selection now belongs in the workspace header.
  • AiWorkspace owns multi-chat sidebar state and filters target choices to installed local agents plus configured local/API model providers.
  • The old AiPanel remains the reusable transcript/composer surface, but its header and prompt/focus effects can be disabled when mounted inside workspace sessions.
  • Pop-out/dock currently transfers the workspace at the window level; future persistence can promote active conversations into a shared store if users need exact in-flight chat reparenting across renderer instances.