Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(home): the Workspace dock, showing each employee's Canvas board
trohitg83d941397303
diff --git a/CLAUDE.md b/CLAUDE.mdindex 3a4fa515..03a3ecf5 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -41,7 +41,7 @@ This is a React Flow-based workflow automation platform implementing n8n-inspire| **[Speech Provider RFC](./docs-internal/speech_provider_rfc.md)** | Provider-abstracted speech — two nodes (`textToSpeech`, `speechToText`) with a `provider` dropdown, backed by **two registries, one per direction** (registry membership IS the capability: a synthesis-only vendor simply never appears in the transcription enum). Everything vendor-specific lives in the plugin folder [`server/nodes/speech/`](./server/nodes/speech/) — protocol, registries, dispatch, per-vendor modules; only the generic `services/provider_registry.py` and the vendor-neutral `services/media/` are shared. v1 providers: OpenAI (both directions), ElevenLabs (TTS), Deepgram + Groq (STT), Sarvam (both). Capabilities are JSON (`server/config/speech_defaults.json`) with per-model overrides, so no shared code branches on a provider name. **Audio never travels as bytes** — nodes return an `AudioRef` (a ~400 B reference) because a 12 MB base64 result blows Temporal's 2 MiB blob limit and retries 3× re-billing the provider each time. Backing routes: `GET/POST /api/workspace/{workflow_id}/…` in [`routers/workspace.py`](./server/routers/workspace.py). || **[Media Transport](./docs-internal/media_transport.md)** | How files move through the engine, and why they move as **references rather than bytes**. `services/media/` — `FileRef` (the base; `FileKind = file\|audio\|image\|video\|document`) with `AudioRef(FileRef)` as the probed-container narrowing (~400 B, `extra="forbid"` so adding a bytes field is a `ValidationError` rather than a silent regression), `write_audio` / `resolve_media` / `coerce_file_param` (the one nodes should call — accepts a `FileRef`/`AudioRef`, a bare path, or the legacy base64 envelope), `inspect_audio` (tinytag → stdlib `wave` → PCM arithmetic, **never raises**), `limits.py`, and **`preview.py` — the single owner of the inline-vs-attachment rule**, with two consumers: `routers/workspace.py` picks its `Content-Disposition` from `serves_inline`, and the gallery listing sets each row's `preview` from `preview_kind`, so the panel can never offer a preview the route refuses to serve. Containment runs through `resolve_within`, which closed a live vulnerability: a node joined a user path onto the workspace root unchecked, so `audio_file="../../credentials.db"` read the encrypted credential store and uploaded it. **The id/slug asymmetry is the trap** — workspace dirs are named by the mutable `Workflow.slug` while a ref stores the immutable `workflow_id` so refs survive rename; the lookup lives in [`services/workspace_locator.py`](./server/services/workspace_locator.py) (`resolve_workspace_root(..., allow_default=)`), and **every mutating caller must pass `allow_default=False`** or an unresolvable id silently lands the write in the shared anonymous workspace. HTTP surface in [`routers/workspace.py`](./server/routers/workspace.py): Range support comes free from Starlette's `FileResponse`; `NEVER_INLINE` is `{image/svg+xml, text/html, text/xml, application/xhtml+xml}` because `shell` / `fileDownloader` / `fileModify` can write arbitrary files into a workspace. || **[Data Node & Vision](./docs-internal/data_node.md)** | The `dataSource` agent tool (raw local data over two namespaces: workspace paths + operator-approved `mnt/<name>/...` external mounts with per-mount writable flags; typed bounded read tiers text/csv/json/pdf/html/xlsx/image-metadata/binary; write/append but **no delete**; `copy_to_workspace` imports mount files as real FileRefs), the machine-wide `data_mounts` allowlist (`services/data/mount_store.py` — refuses `DATA_DIR` overlap, drive roots, home dir), the `visionAnalyze` delegate tool (vision for every host model via openai/anthropic/gemini official SDK shapes + the `services/media/image_fit.py` visual-token budget), and the first native-image-blocks increment: `ContentBlock.source` (durable `file_ref` vs transient `bytes` — the wire codec raises on bytes), the `llm_media` tool-result opt-in, capability-gated `hydrate_image_blocks` in `run_native_llm_step`, Anthropic `tool_result` image encoding (openai/gemini encoders pending; their `vision.enabled` stays false until then). |-| **[Canvas Node](./docs-internal/canvas_node.md)** | The `canvas` node — pushed-content display board (the Claude/ChatGPT-Canvas analog) in [`server/nodes/tool/canvas/`](./server/nodes/tool/canvas/). Dual control: agents call the locked `canvas(...)` tool (paths / url / 64KB-capped markdown notes, append/replace), workflow edges auto-display upstream FileRefs via a structural scan of `connected_outputs` (`tts → canvas` is a zero-config edge; the node is the one addition to `NodeExecutor._NEEDS_CONNECTED_OUTPUTS`). Board = plugin-owned `canvas_boards`/`canvas_items` tables (mount_store mechanism, 200-item FIFO), identity-only `canvas_updated` broadcast (direct, no canary consumer), `canvas_list/remove/clear` WS handlers with the simple_memory security preamble. **Two frontend hosts share one renderer**: the `isCanvasPanel` parameter panel and the new docked resizable right sidebar (`CanvasDock` + `canvasDockStore`; auto-open via `notifyPushed`, ephemeral click-to-preview from the gallery dialog, `usePanelResize` extracted from ConsolePanel). Renders media carousel with follow-latest image poll, markdown/code/JSON via the repo's first capped client-side text fetch (`useWorkspaceText`, 512KB), external URLs + workspace HTML in strictly sandboxed iframes (never `allow-same-origin`; `NEVER_INLINE` untouched), and inline PDF via the `INLINE_EXACT` exact-match addition to `preview.py`. Browser screenshots became displayable in the same change: both browser plugins persist shots as workspace FileRefs via the tolerant `nodes/browser/_screenshots.py`. |+| **[Canvas Node](./docs-internal/canvas_node.md)** | The `canvas` node — pushed-content display board (the Claude/ChatGPT-Canvas analog) in [`server/nodes/tool/canvas/`](./server/nodes/tool/canvas/). Dual control: agents call the locked `canvas(...)` tool (paths / url / 64KB-capped markdown notes, append/replace), workflow edges auto-display upstream FileRefs via a structural scan of `connected_outputs` (`tts → canvas` is a zero-config edge; the node is the one addition to `NodeExecutor._NEEDS_CONNECTED_OUTPUTS`). Board = plugin-owned `canvas_boards`/`canvas_items` tables (mount_store mechanism, 200-item FIFO), identity-only `canvas_updated` broadcast (direct, no canary consumer), `canvas_list/remove/clear` WS handlers with the simple_memory security preamble. **Three frontend hosts share one renderer**: the `isCanvasPanel` parameter panel, the docked resizable right sidebar (`CanvasDock` + `canvasDockStore`; auto-open via `notifyPushed`, ephemeral click-to-preview from the gallery dialog, `usePanelResize` extracted from ConsolePanel), and the Canvas tab of Home's Workspace dock (`features/home/workspace/`). Renders media carousel with follow-latest image poll, markdown/code/JSON via the repo's first capped client-side text fetch (`useWorkspaceText`, 512KB), external URLs + workspace HTML in strictly sandboxed iframes (never `allow-same-origin`; `NEVER_INLINE` untouched), and inline PDF via the `INLINE_EXACT` exact-match addition to `preview.py`. Browser screenshots became displayable in the same change: both browser plugins persist shots as workspace FileRefs via the tolerant `nodes/browser/_screenshots.py`. || **[Translate / Transliterate / Detect](./docs-internal/speech_provider_rfc.md#8-what-this-pattern-should-absorb-next)** | The second application of the multi-vendor pattern, and the one that retired `nodes/sarvam/`. Three nodes (`translateText`, `transliterateText`, `detectLanguage`) in [`server/nodes/translate/`](./server/nodes/translate/), backed by **three registries — one per capability**, because the asymmetry is sharper than speech's: DeepL translates and does nothing else, while Sarvam and LLM-backed providers do all three. Membership makes an unsupported selection unrepresentable rather than a runtime failure inside a paid call. Providers: **deepl** (`Authorization: DeepL-Auth-Key`, `text` is an array, free keys ending `:fx` route to a different host, and it returns `billed_characters` so cost is the provider's own figure), **sarvam** (all three over dedicated REST), **openai** (all three via `ChatUnifier` — proves the Protocol does not care what a provider does internally; billing deliberately NOT recorded because that path bills tokens the LLM layer already costs). Capabilities in `server/config/translate_defaults.json`. || **[Desktop App](./docs-internal/desktop_app.md)** | Electron shell in [`desktop/`](./desktop/) — a standalone bun package (NOT a root workspace member; `cli/tests/test_release_pipeline_config.py` locks `workspaces`). Bundles pinned `uv`, python-build-standalone CPython 3.12 and bun 1.4.0 — the only JavaScript runtime shipped; no Node, no npm (`desktop/runtimes.json`, verified against upstream checksum manifests by `scripts/fetch-runtimes.ts`, which also fetches bun's `LICENSE.md` from the bun repo — the release zip carries none — and prunes stale runtime dirs such as a leftover `node/`), stages the backend sibling layout from `bun pm pack --dry-run` (`scripts/stage.ts`, which runs the sidecar package's own `bun run build` — `bun build --target=bun`, express inlined — and copies `dist/index.js`), sets `OPENCOMPANY_BUN_BIN` / `BUN_INSTALL=<userData>/bun` / `BUN_INSTALL_CACHE_DIR` and prepends the bundled bun dir (then uv) to PATH for the backend (`env.ts`; `OPENCOMPANY_NODE_BIN` no longer exists), provisions the venv into Electron `userData` on first launch with `uv sync --frozen --python <bundled>` (stamp = sha256 of uv.lock + pyproject + Python + uv versions; falls back to `uv python install 3.12`), pre-warms `PYTHONPYCACHEPREFIX` (with a prefix set Python ignores in-tree .pyc — 32 s vs 3 s first boot), spawns uvicorn on `127.0.0.1:5678` (persisted port; attaches to a running `company serve` instead of double-spawning), waits on `/health/ready`, loads the backend-served SPA (zero frontend changes), routes `window.open` / `_blank` to the OS browser. Quit = `POST /api/desktop/shutdown` + stdin EOF, 30 s, then tree-kill. electron-builder: NSIS x64, DMG+zip arm64/x64, AppImage+deb x64, unsigned first (`mac.identity: null`; macOS auto-update notify-only until signed — Squirrel.Mac refuses unsigned). CI: `desktop-release.yml` (tag-triggered: `prepare` drafts the GitHub Release from the annotated tag's message, three legs build and upload version-less OS-named installers such as `OpenCompany-windows-x64.exe` / `OpenCompany-macos-arm64.dmg` / `OpenCompany-linux-x86_64.AppImage` so the README can link `releases/latest/download/<file>`, each leg refuses a desktop version that differs from the tag, `finalize` undrafts) and `desktop-ci.yml` (typecheck/unit/invariants/Playwright smoke). **Gotcha: editor-hosted terminals export `ELECTRON_RUN_AS_NODE=1`, which makes Electron boot as plain Node (`electron.app` undefined) — strip it before launching; the e2e test does.** || **[Desktop Host Contract](./docs-internal/desktop_host_contract.md)** | The backend's side of being owned by a GUI shell. `core/approot.py` is the ONE module that locates the app tree (`OPENCOMPANY_APP_ROOT` / `OPENCOMPANY_CLIENT_DIST` / `OPENCOMPANY_ENV_FILE` / `OPENCOMPANY_ENV_TEMPLATE`); `tests/test_no_root_climb.py` forbids any other `Path(__file__).parents[N]` climb above `server/` and any `"client"/"dist"` / `.env.template` / `package.json` path join. `core/env_defaults.apply_file_defaults_to_environ()` does the CLI's `.env.template < .env < process env` layering at the top of `main.py`, and `Settings.env_file` is the absolute `(template, .env)` tuple — so a shell spawns `python -m uvicorn` from any cwd without the CLI package. Desktop mode (`OPENCOMPANY_DESKTOP=1`, `core/desktop.py`): parent-PID watchdog with create-time PID-reuse guard, stdin-EOF watchdog (polling via `PeekNamedPipe`/`select`, never a blocking read — a daemon thread parked in `ReadFile` at finalisation crashed exit with 0xC0000005), ctypes Job Object so children die with the backend (no pywin32 in the server venv), token-gated `POST /api/desktop/shutdown` (`routers/desktop.py`, public path; raises the signal uvicorn handles so the lifespan reaps Temporal/the bun sidecar/edgymeow), 45 s hard deadline. `GET /health/ready` (public) = DB up AND (Temporal disabled OR worker manager started), with `phase` written by `services/temporal/lifecycle.py` (`installing_temporal` / `starting_temporal` / `connecting` / `starting_workers` / `ready`). Plugin shutdown hooks now run under a 10 s per-hook timeout (`HOOK_TIMEOUT_SECONDS`), and the browser hook reads the module singleton instead of `get_browser_service()`, which lazily ran the `agent-browser` package install (`npm install` at the time; `bun add` via `core/js_runtime.add_package` today) AT SHUTDOWN and wedged every graceful exit (masked under the CLI by its 5 s grace + tree-kill). `server/uv.lock` is committed; `predeploy.yml` runs `uv lock --check`. |@@ -2750,7 +2750,7 @@ This function:- **`NodeUserError` (services.plugin)**: typed exception for user/LLM-correctable failures (string not found, command not found, bad cwd, missing required field, operator-only Twitter query, Python sandbox `import`, JS executor sidecar down). `BaseNode.execute()` catches it specifically: single WARN line in the operator log (no traceback) + structured `{success: False, error_type: "NodeUserError", error: ...}` envelope. Genuine bugs still flow through the generic `except Exception` branch and keep their full stacktrace via `logger.exception`. Adopted across `fileRead` / `fileModify` / `fsSearch` / `gallery` / `process_manager` / `pythonExecutor` / `javascriptExecutor` / `typescriptExecutor`. **Plugin WS handlers that can fail user-correctably must use `@ws_response` (from `services.plugin.ws`), not `@ws_handler`** — the latter logs every exception at ERROR with a full traceback, which breaks the one-WARN-line `NodeUserError` contract. `gallery/_handlers.py` is the reference. Reach for it whenever the LLM (or user) can fix the input and retry — never for actual server bugs.- **Process manager Windows shim resolution**: `process_service.start()` resolves `argv[0]` via `shutil.which()` before `asyncio.create_subprocess_exec`. On Windows, `shutil.which` honours `PATHEXT` and returns the absolute path including the extension (e.g. a `C:\...\npm.cmd` for a generic `.cmd` shim; the shims bun writes for the plugin CLIs in the shared packages tree are `<name>.exe` launchers plus a `<name>.bunx` file, never `.cmd`); `CreateProcessW` then launches it directly. No `cmd /c` wrap — same canonical idiom used by `nodes/browser/`, `nodes/agent/claude_code_agent/_pool.py`, `nodes/agent/claude_code_agent/_oauth.py`, `nodes/email/_himalaya.py`. Without this, bare `argv[0]="npm"` raises `WinError 2` because `CreateProcessW` does NOT apply `PATHEXT` to bare names. Missing binary → early `Command not found: '<bin>'. Check spelling or ensure the binary is on PATH.` envelope (no traceback).- **Gallery — the workspace file explorer (`gallery`, `nodes/filesystem/gallery/`)**: sibling of the process-manager pattern below — the `isGalleryPanel` uiHint gives it a full-height MiddleSection panel (breadcrumbs, grid/list, image thumbnails, search, preview, upload) instead of the plain params list. It pairs the hint with `hideInputSection` but **keeps** the Output section, because unlike `processManager` it produces output worth seeing and dragging. Four rules worth knowing before touching it: (1) **The panel edits the node's own params** — navigating writes `path`, pinning writes `selection` — so what you browse is what the node emits, rather than a second copy of that state free to drift. (2) **The backend decides; the panel renders.** Each listing row arrives with a finished `ref` (a serialized `FileRef`, `null` for directories) and a `preview` verdict from `services/media/preview.py`; breadcrumbs arrive as `crumbs`; a search term is turned into a glob by `search_to_pattern` server-side. Re-deriving any of these client-side would be a second copy of a server rule — and for `preview` specifically, a second copy of a *security* decision. (3) **Drag uses its own `workspaceFile` discriminator, never the existing `nodeOutput`** — that branch calls `onChange(value)` unconditionally, so reusing it would mean dropping a file into a half-written prompt destroys the prompt. `ParameterRenderer.handleDrop` therefore branches: a `file` param takes the ref whole, everything else appends the path with smart spacing. (4) **`isFileRef` accepts every `FileKind`, not just `audio`** — the gallery emits `kind: "file"` even for a `.wav`, because `kind: "audio"` asserts `inspect_audio` probed the container and a fabricated duration would mis-bill a per-second provider downstream; narrowing the check back would render a dropped file as raw JSON. Listing rides the WebSocket (`list_workspace_files`) because the consumer already holds an authenticated socket with request correlation; `GET /api/workspace/{id}/files/{path}` stays the *content* channel (preview, download, Range). Frontend: [GalleryPanel.tsx](./client/src/components/parameterPanel/GalleryPanel.tsx) + `parameterPanel/gallery/`, [useDragWorkspaceFile.ts](./client/src/hooks/useDragWorkspaceFile.ts), [types/workspaceFiles.ts](./client/src/types/workspaceFiles.ts).-- **Canvas — the pushed-content display board (`canvas`, `nodes/tool/canvas/`)**: the third full-height-panel sibling (gallery / processManager / canvas), and the first with a SECOND host — a docked resizable right sidebar ([CanvasDock.tsx](./client/src/components/ui/CanvasDock.tsx) + [canvasDockStore.ts](./client/src/stores/canvasDockStore.ts)) that auto-opens on push and serves ephemeral click-to-preview from the gallery dialog. Both hosts render one shared component ([parameterPanel/canvas/CanvasContent.tsx](./client/src/components/parameterPanel/canvas/CanvasContent.tsx)). Rules worth knowing before touching it: (1) **The broadcast is identity-only** — `canvas_updated` carries `{workflow_id, node_id, revision}`; content flows solely through the authorized `canvas_list` handler (simple_memory security preamble: external socket + owner + graph-ownership, exactly-one-node-of-type check). (2) **The board stores references, never bytes** — `display(paths=…)` builds refs via `resolve_media` + stat (never `coerce_file_param`; don't read content to make a pointer), notes cap at 64KB with a visible marker, the board FIFO-caps at 200, and the op's Output is ids+counts only. (3) **Iframe sandboxes are test-locked security decisions**: external URLs get exactly `sandbox="allow-scripts allow-forms"` + `no-referrer`; workspace HTML renders ONLY as `srcDoc` + `sandbox="allow-scripts"` (opaque origin, no cookies — `NEVER_INLINE` respected, not worked around); PDF is a plain same-origin iframe enabled by the `INLINE_EXACT` exact-match set in `preview.py`. (4) **Never `addEventListener('canvas_updated')`** — the WebSocketContext switch case shadows the default-case fan-out. (5) The `tool` group auto-derives `isConfigNode: True`; canvas declares it `False` because `input-main` is real dataflow. (6) `hooks/useWorkspaceText.ts` is the repo's first client-side file-content fetch (streamed, cancelled at 512KB, key self-busts on `size_bytes`+`modified_at`) — attachment disposition doesn't block `fetch()`. Browser screenshots became its feedstock: both browser plugins persist shots as workspace FileRefs via the tolerant, containment-checked [nodes/browser/_screenshots.py](./server/nodes/browser/_screenshots.py). Full reference: [docs-internal/canvas_node.md](./docs-internal/canvas_node.md).+- **Canvas — the pushed-content display board (`canvas`, `nodes/tool/canvas/`)**: the third full-height-panel sibling (gallery / processManager / canvas), and the first with a SECOND host — a docked resizable right sidebar ([CanvasDock.tsx](./client/src/components/ui/CanvasDock.tsx) + [canvasDockStore.ts](./client/src/stores/canvasDockStore.ts)) that auto-opens on push and serves ephemeral click-to-preview from the gallery dialog. Both hosts render one shared component ([parameterPanel/canvas/CanvasContent.tsx](./client/src/components/parameterPanel/canvas/CanvasContent.tsx)), as does Home's Workspace dock, a third host. Rules worth knowing before touching it: (1) **The broadcast is identity-only** — `canvas_updated` carries `{workflow_id, node_id, revision}`; content flows solely through the authorized `canvas_list` handler (simple_memory security preamble: external socket + owner + graph-ownership, exactly-one-node-of-type check). (2) **The board stores references, never bytes** — `display(paths=…)` builds refs via `resolve_media` + stat (never `coerce_file_param`; don't read content to make a pointer), notes cap at 64KB with a visible marker, the board FIFO-caps at 200, and the op's Output is ids+counts only. (3) **Iframe sandboxes are test-locked security decisions**: external URLs get exactly `sandbox="allow-scripts allow-forms"` + `no-referrer`; workspace HTML renders ONLY as `srcDoc` + `sandbox="allow-scripts"` (opaque origin, no cookies — `NEVER_INLINE` respected, not worked around); PDF is a plain same-origin iframe enabled by the `INLINE_EXACT` exact-match set in `preview.py`. (4) **Never `addEventListener('canvas_updated')`** — the WebSocketContext switch case shadows the default-case fan-out. (5) The `tool` group auto-derives `isConfigNode: True`; canvas declares it `False` because `input-main` is real dataflow. (6) `hooks/useWorkspaceText.ts` is the repo's first client-side file-content fetch (streamed, cancelled at 512KB, key self-busts on `size_bytes`+`modified_at`) — attachment disposition doesn't block `fetch()`. Browser screenshots became its feedstock: both browser plugins persist shots as workspace FileRefs via the tolerant, containment-checked [nodes/browser/_screenshots.py](./server/nodes/browser/_screenshots.py). Full reference: [docs-internal/canvas_node.md](./docs-internal/canvas_node.md).- **Process manager port admission + middle panel**: server commands declare listener `ports` (with compatibility inference for `--port`, `-p`, `PORT`, and `*_PORT`). `ProcessService.start()` serializes admission, checks managed reservations plus OS TCP listeners, and returns structured `PORT_IN_USE` without killing the owner or allowing framework auto-port fallback. Explicit ports/environment survive restart. The `isProcessManagerPanel` UI hint gives only `processManager` a full-height workflow-scoped process table with PID/ports/timestamps/elapsed/output and stop/restart controls. See [docs-internal/process_manager.md](./docs-internal/process_manager.md).- **Telegram message auto-split + caption spill**: the Bot API caps `sendMessage.text` at 4096 and media captions at 1024 (constants `_TG_TEXT_LIMIT` / `_TG_CAPTION_LIMIT` in `nodes/telegram/_service.py`; per https://core.telegram.org/bots/api). **Both limits are measured in UTF-16 code units, not characters** — an emoji costs 2 — so length goes through `_tg_len`, never `len()`. `_split_head` cuts one chunk at the cleanest paragraph → line → sentence → space boundary past the halfway mark, else hard-cuts; `_split_text` loops it. `send_message` chunks long text and threads each part under the previous (`reply_to_message_id` cascade), returning the first message's metadata + `parts` + `message_ids[]`. `_send_captioned_media` (used by `send_photo` / `send_document`) truncates an over-long caption at the cap and sends the remainder as a threaded reply with `disable_notification=True`, reporting `caption_truncated` + `follow_up_message_ids` — previously the whole send just failed with `BadRequest("Message caption is too long")`. **Ordering invariant: split the RAW body before `_resolve_body` runs markdown→HTML.** Splitting after conversion can separate a `<b>` from its closing tag, which Telegram rejects with "can't find end of the entity"; Telegram measures the cap against entity-parsed text, so truncating raw markdown is conservative. Locked by `tests/nodes/test_telegram_service.py`.- **Telegram inbound content types**: `_format_message` extracts detail dicts for all 11 types via the `_CONTENT_PROBES` / `_DETAIL_EXTRACTORS` tables, plus a normalized `media` block (`kind` / `file_id` / `mime_type` / `file_name` / …) that downstream nodes read instead of branching per type; MIME and filename are synthesised where Telegram omits them. **Probe order is load-bearing**: Telegram sets `message.document` on animation messages too, so `animation` and `video_note` must be probed before `document` and `video` or every GIF classifies as a document. The trigger never downloads — media travels as a `file_id`, never bytes or base64, because node results are persisted, broadcast, and replayed into the LLM conversation every turn.diff --git a/client/src/components/parameterPanel/__tests__/CanvasPanel.test.tsx b/client/src/components/parameterPanel/__tests__/CanvasPanel.test.tsxindex 27b10ff6..3e323d7f 100644--- a/client/src/components/parameterPanel/__tests__/CanvasPanel.test.tsx+++ b/client/src/components/parameterPanel/__tests__/CanvasPanel.test.tsx@@ -9,6 +9,7 @@ const { wsMock } = vi.hoisted(() => ({}));vi.mock('../../../contexts/WebSocketContext', () => ({useWebSocket: () => wsMock,+ useWebSocketActions: () => wsMock,}));import CanvasPanel from '../CanvasPanel';diff --git a/client/src/components/parameterPanel/canvas/CanvasContent.tsx b/client/src/components/parameterPanel/canvas/CanvasContent.tsxindex 162d7a59..f6b1e508 100644--- a/client/src/components/parameterPanel/canvas/CanvasContent.tsx+++ b/client/src/components/parameterPanel/canvas/CanvasContent.tsx@@ -29,7 +29,7 @@ import { Button } from '@/components/ui/button';import { Label } from '@/components/ui/label';import { Switch } from '@/components/ui/switch';import { buildApiUrl } from '../../../config/api';-import { useWebSocket } from '../../../contexts/WebSocketContext';+import { useWebSocketActions } from '../../../contexts/WebSocketContext';import type { CanvasItem } from '../../../lib/canvasBoard';import type {ListWorkspaceFilesResponse,@@ -104,7 +104,7 @@ const CanvasContent: React.FC<Props> = ({followLatestDefault = false,onFollowLatestChange,}) => {- const { sendRequest, isReady } = useWebSocket();+ const { sendRequest, isReady } = useWebSocketActions();const [pinnedId, setPinnedId] = useState<string | null>(null);const [followLatest, setFollowLatest] = useState(followLatestDefault);const [mediaFailed, setMediaFailed] = useState(false);diff --git a/client/src/components/parameterPanel/canvas/__tests__/CanvasContent.test.tsx b/client/src/components/parameterPanel/canvas/__tests__/CanvasContent.test.tsxindex 9ab13a80..7c8b658d 100644--- a/client/src/components/parameterPanel/canvas/__tests__/CanvasContent.test.tsx+++ b/client/src/components/parameterPanel/canvas/__tests__/CanvasContent.test.tsx@@ -9,6 +9,7 @@ const { wsMock } = vi.hoisted(() => ({}));vi.mock('../../../../contexts/WebSocketContext', () => ({useWebSocket: () => wsMock,+ useWebSocketActions: () => wsMock,}));// Isolate iframe/sandbox assertions from real fetches.diff --git a/client/src/features/home/HomeShell.tsx b/client/src/features/home/HomeShell.tsxindex d3c04a1c..481a81b8 100644--- a/client/src/features/home/HomeShell.tsx+++ b/client/src/features/home/HomeShell.tsx@@ -5,8 +5,8 @@* current view, either hiring a new employee or one employee's card.** The shell owns what spans views: the employee broadcasts that keep the- * team current, the orb behind the content, the Settings dialog, and the- * connect dialog any view can open. Switching views scrolls to the top and+ * team current, the orb behind the content, the Workspace dock on the+ * right, the Settings dialog, and the connect dialog any view can open. Switching views scrolls to the top and* plays the view swap.*/@@ -23,6 +23,7 @@ import { ConnectDialog } from './settings/ConnectDialog';import { HomeSettings } from './settings/HomeSettings';import { HomeSidebar } from './sidebar/HomeSidebar';import { useHomeStore } from './state/homeStore';+import { WorkspaceDock } from './workspace/WorkspaceDock';/** Scrolled further than this, the header draws its bottom border. */const HEADER_BORDER_AFTER_PX = 6;@@ -66,7 +67,7 @@ export default function HomeShell() {}, [viewKey]);return (- <div className="flex min-h-0 flex-1 antialiased">+ <div className="relative flex min-h-0 flex-1 antialiased"><HomeSidebar /><main className="relative flex min-w-0 flex-1 flex-col"><OrbStage />@@ -90,6 +91,7 @@ export default function HomeShell() {</div></div></main>+ <WorkspaceDock /><HomeSettings onConnect={openConnect} /><ConnectDialog providerId={connectId} onClose={() => setConnectId(null)} /></div>diff --git a/client/src/features/home/__tests__/employeeView.test.tsx b/client/src/features/home/__tests__/employeeView.test.tsxindex cc9b687b..4521ac51 100644--- a/client/src/features/home/__tests__/employeeView.test.tsx+++ b/client/src/features/home/__tests__/employeeView.test.tsx@@ -2,7 +2,7 @@* The employee card's main button: Connect goes to the provider's connect* dialog, Pause sends the summary's revision, and the button says* "Pausing…" until the summary shows the pause (never flashing "Pause"- * again in between).+ * again in between). Watch live opens the Workspace on the employee.*/import { beforeEach, describe, expect, it, vi } from 'vitest';@@ -31,6 +31,7 @@ import { EMPLOYEES_QUERY_KEY } from '../data/employees';import { parseEmployee, type EmployeeSummary } from '../data/schemas';import { ThemeProvider } from '@/contexts/ThemeContext';import { EmployeeView } from '../employee/EmployeeView';+import { useHomeStore } from '../state/homeStore';function summary(patch: Record<string, unknown>, control: Record<string, unknown>): EmployeeSummary {return parseEmployee({@@ -91,6 +92,13 @@ describe('EmployeeView', () => {expect(await screen.findByRole('button', { name: 'Resume' })).toBeEnabled();});+ it('opens the Workspace on this employee', () => {+ useHomeStore.setState({ workspaceOpen: false, workspaceFor: null });+ renderCard(summary({ status: 'working' }, { state: 'running' }));+ fireEvent.click(screen.getByRole('button', { name: 'Watch live' }));+ expect(useHomeStore.getState()).toMatchObject({ workspaceOpen: true, workspaceFor: 'w1' });+ });+it('opens the workflow in the editor', () => {renderCard(summary({ status: 'working' }, { state: 'running' }));fireEvent.click(screen.getByRole('button', { name: 'Open workflow' }));diff --git a/client/src/features/home/__tests__/workspace.test.tsx b/client/src/features/home/__tests__/workspace.test.tsxnew file mode 100644index 00000000..43ecb82b--- /dev/null+++ b/client/src/features/home/__tests__/workspace.test.tsx@@ -0,0 +1,209 @@+/**+ * The Workspace dock: what it saves and how it reads that back, the orb+ * spike on opening, whose workspace it shows, the header's pill, the+ * placeholder tabs, the Canvas tab (no request without a Canvas, the board+ * with one), closing, and the header pill's dot.+ */++import { beforeEach, describe, expect, it, vi } from 'vitest';+import { act, fireEvent, render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';+import type { ReactElement } from 'react';++const actions = { isReady: true, sendRequest: vi.fn(), addEventListener: () => () => {} };++vi.mock('@/contexts/WebSocketContext', async (importOriginal) => ({+ ...(await importOriginal<typeof import('@/contexts/WebSocketContext')>()),+ useWebSocketActions: () => actions,+}));++vi.mock('../../../app/useShellActions', () => ({ enterDev: vi.fn() }));++import { normalizeWorkflowControlStatus } from '@/contexts/WebSocketContext';+import { ThemeProvider } from '@/contexts/ThemeContext';+import { enterDev } from '../../../app/useShellActions';+import { EMPLOYEES_QUERY_KEY } from '../data/employees';+import { parseEmployee, type EmployeeSummary } from '../data/schemas';+import { SPIKE, orbState } from '../orb/orb';+import { WORKSPACE_MIN_WIDTH, loadWorkspacePrefs, useHomeStore } from '../state/homeStore';+import { WorkspaceButton } from '../workspace/WorkspaceButton';+import { WorkspaceDock } from '../workspace/WorkspaceDock';+// Loaded up front so the dock's lazy import resolves from the module cache:+// importing the board's viewers cold can outlast findBy's wait on a busy machine.+import '../workspace/WorkspaceCanvas';++const PREFS_KEY = 'home_workspace_v1';+const DEFAULTS = { open: false, widthPx: 460, tab: 'board' };++function employee(patch: Record<string, unknown> = {}): EmployeeSummary {+ const id = typeof patch.workflow_id === 'string' ? patch.workflow_id : 'w1';+ const state = patch.status === 'paused' ? 'paused' : 'running';+ return parseEmployee({+ workflow_id: id,+ name: 'Maya',+ role: 'Receptionist',+ status: 'working',+ task: { label: 'Now', text: 'Replying to Priya' },+ canvas_node_id: `${id}:canvas:1`,+ control: normalizeWorkflowControlStatus({ generation: 1, state }, id),+ ...patch,+ })!;+}++function renderWith(team: EmployeeSummary[], ui: ReactElement = <WorkspaceDock />) {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });+ client.setQueryData(EMPLOYEES_QUERY_KEY, team);+ render(+ <ThemeProvider>+ <QueryClientProvider client={client}>{ui}</QueryClientProvider>+ </ThemeProvider>,+ );+}++beforeEach(() => {+ localStorage.clear();+ actions.sendRequest.mockReset();+ actions.sendRequest.mockResolvedValue({ success: true, items: [], revision: 0 });+ vi.mocked(enterDev).mockClear();+ useHomeStore.setState({+ workspaceOpen: false,+ workspaceWidth: 460,+ workspaceTab: 'board',+ workspaceWide: false,+ workspaceFor: null,+ });+});++describe('Workspace preferences', () => {+ it('start closed on the Canvas tab at 460px', () => {+ expect(loadWorkspacePrefs()).toEqual(DEFAULTS);+ });++ it('fall back field by field, and wholly on unreadable JSON', () => {+ localStorage.setItem(PREFS_KEY, JSON.stringify({ open: true, widthPx: 'wide', tab: 'desk' }));+ expect(loadWorkspacePrefs()).toEqual({ ...DEFAULTS, open: true });+ localStorage.setItem(PREFS_KEY, '{not json');+ expect(loadWorkspacePrefs()).toEqual(DEFAULTS);+ });++ it('save what they restore, and keep a drag inside the window', () => {+ const store = useHomeStore.getState();+ store.openWorkspace();+ store.setWorkspaceTab('android');+ store.toggleWorkspaceWide();+ store.setWorkspaceWidth(99_999);+ expect(useHomeStore.getState()).toMatchObject({ workspaceWidth: window.innerWidth - 420, workspaceWide: false });+ store.setWorkspaceWidth(10);+ expect(useHomeStore.getState().workspaceWidth).toBe(WORKSPACE_MIN_WIDTH);+ expect(loadWorkspacePrefs()).toEqual({ open: true, widthPx: WORKSPACE_MIN_WIDTH, tab: 'android' });+ });++ it('spike the orb only when the dock opens', () => {+ orbState.spike = 0;+ useHomeStore.getState().openWorkspace();+ expect(orbState.spike).toBe(SPIKE.workspace);+ orbState.spike = 0;+ useHomeStore.getState().openWorkspace('w2');+ expect(orbState.spike).toBe(0);+ expect(useHomeStore.getState().workspaceFor).toBe('w2');+ });+});++describe('WorkspaceDock', () => {+ it('mounts nothing before it first opens, and closes out of reach', () => {+ useHomeStore.setState({ workspaceTab: 'browser' });+ renderWith([employee()]);+ // A hidden element has no accessible name, so it is found by role alone.+ const dock = screen.getByRole('complementary', { hidden: true });+ expect(dock).toHaveAttribute('aria-hidden', 'true');+ expect(screen.queryByText('Maya’s workspace')).toBeNull();++ act(() => useHomeStore.getState().openWorkspace());+ expect(dock).not.toHaveAttribute('aria-hidden', 'true');+ fireEvent.click(screen.getByRole('button', { name: 'Close workspace' }));+ expect(useHomeStore.getState().workspaceOpen).toBe(false);+ expect(dock).toHaveAttribute('aria-hidden', 'true');+ expect(dock).toHaveAttribute('inert');+ });++ it('shows who it is for, what they are doing, and Live while they work', () => {+ useHomeStore.setState({ workspaceOpen: true, workspaceTab: 'browser' });+ renderWith([employee()]);+ expect(screen.getByText('Maya’s workspace')).toBeInTheDocument();+ expect(screen.getByText('Replying to Priya')).toBeInTheDocument();+ expect(screen.getByText('Live')).toBeInTheDocument();++ fireEvent.click(screen.getByRole('button', { name: 'Expand' }));+ expect(useHomeStore.getState().workspaceWide).toBe(true);+ expect(screen.getByRole('button', { name: 'Restore size' })).toBeInTheDocument();+ });++ it('shows the card’s pill when the employee is not working', () => {+ useHomeStore.setState({ workspaceOpen: true, workspaceTab: 'browser' });+ renderWith([employee({ status: 'paused' })]);+ expect(screen.getByText('Paused')).toBeInTheDocument();+ expect(screen.queryByText('Live')).toBeNull();+ });++ it('follows the employee last opened, else the first', () => {+ useHomeStore.setState({ workspaceOpen: true, workspaceTab: 'browser' });+ renderWith([employee(), employee({ workflow_id: 'w2', name: 'Leo' })]);+ expect(screen.getByText('Maya’s workspace')).toBeInTheDocument();+ act(() => useHomeStore.getState().showEmployee('w2'));+ expect(screen.getByText('Leo’s workspace')).toBeInTheDocument();+ });++ it('says plainly that Browser and Android are not built yet', async () => {+ useHomeStore.setState({ workspaceOpen: true, workspaceTab: 'browser' });+ renderWith([employee()]);+ expect(screen.getByText('The live browser view isn’t available yet')).toBeInTheDocument();+ await userEvent.click(screen.getByRole('tab', { name: 'Android' }));+ expect(screen.getByText('The Android mirror isn’t available yet')).toBeInTheDocument();+ expect(useHomeStore.getState().workspaceTab).toBe('android');+ });++ it('asks for no board when the employee has no Canvas', () => {+ useHomeStore.setState({ workspaceOpen: true });+ renderWith([employee({ canvas_node_id: null })]);+ expect(screen.getByText('Maya has no Canvas')).toBeInTheDocument();+ fireEvent.click(screen.getByRole('button', { name: 'Open workflow' }));+ expect(enterDev).toHaveBeenCalledWith({ workflowId: 'w1' });+ expect(actions.sendRequest).not.toHaveBeenCalledWith('canvas_list', expect.anything());+ });++ it('shows the board of the employee’s Canvas node', async () => {+ useHomeStore.setState({ workspaceOpen: true });+ renderWith([employee()]);+ expect(await screen.findByText(/^Nothing here yet\. When Maya finishes something/)).toBeInTheDocument();+ expect(actions.sendRequest).toHaveBeenCalledWith('canvas_list', { workflow_id: 'w1', node_id: 'w1:canvas:1' });+ });++ it('says so when no one is on the team', () => {+ useHomeStore.setState({ workspaceOpen: true });+ renderWith([]);+ expect(screen.getByText('No one on your team yet')).toBeInTheDocument();+ });+});++describe('WorkspaceButton', () => {+ it('opens and closes the dock, with a live dot while it is closed and someone works', () => {+ renderWith([employee()], <WorkspaceButton />);+ const button = screen.getByRole('button', { name: 'Workspace' });+ expect(button).toHaveAttribute('aria-pressed', 'false');+ expect(button.querySelector('.opencompany-pip-pulse')).not.toBeNull();++ fireEvent.click(button);+ expect(useHomeStore.getState().workspaceOpen).toBe(true);+ expect(button).toHaveAttribute('aria-pressed', 'true');+ expect(button.querySelector('.opencompany-pip-pulse')).toBeNull();++ fireEvent.click(button);+ expect(useHomeStore.getState().workspaceOpen).toBe(false);+ });++ it('shows no dot when no one is working', () => {+ renderWith([employee({ status: 'paused' })], <WorkspaceButton />);+ expect(screen.getByRole('button', { name: 'Workspace' }).querySelector('.opencompany-pip-pulse')).toBeNull();+ });+});diff --git a/client/src/features/home/data/presentation.ts b/client/src/features/home/data/presentation.tsindex 82ec996a..bee3321e 100644--- a/client/src/features/home/data/presentation.ts+++ b/client/src/features/home/data/presentation.ts@@ -18,7 +18,8 @@import type { AppRef, ColorRole, EmployeeSummary } from './schemas';import type { WorkflowControlPendingMutation } from '@/contexts/WebSocketContext';-export type StatusTone = 'working' | 'ready' | 'paused' | 'attention' | 'waiting';+/** `live` is the Workspace's "watching now" pill, not an employee state. */+export type StatusTone = 'working' | 'ready' | 'paused' | 'attention' | 'waiting' | 'live';export type PrimaryAction =| { kind: 'pause' }@@ -113,6 +114,7 @@ export const STATUS_PILL_CLASS: Record<StatusTone, string> = {paused: 'bg-status-paused-fill border-status-paused-border text-status-paused-ink',attention: 'bg-status-attention-fill border-status-attention-border text-status-attention-ink',waiting: 'bg-status-waiting-fill border-status-waiting-border text-status-waiting-ink',+ live: 'bg-node-trigger-fill border-node-trigger-edge text-node-trigger-ink',};/** Status dot (the sidebar pip, the pill's dot). */@@ -122,6 +124,9 @@ export const STATUS_DOT_CLASS: Record<StatusTone, string> = {paused: 'bg-status-paused-dot',attention: 'bg-status-attention-dot',waiting: 'bg-status-waiting-dot',+ // Blinks rather than rings (design handoff "Live"); animations.css+ // stops it under reduced motion.+ live: 'bg-node-trigger opencompany-pip-pulse',};/** Avatar: the employee's role colour at the soft-button tint. */diff --git a/client/src/features/home/data/schemas.ts b/client/src/features/home/data/schemas.tsindex b6e30e5e..f1b54683 100644--- a/client/src/features/home/data/schemas.ts+++ b/client/src/features/home/data/schemas.ts@@ -51,6 +51,8 @@ export const employeeSummarySchema = z.object({// without one normalizes to "never started".control: z.unknown().optional(),watch_node_ids: z.array(z.string()).catch([]),+ /** The Canvas board the Workspace shows; null when the graph has none. */+ canvas_node_id: z.string().nullable().catch(null),revision: z.number().catch(0),hired_at: z.string().nullable().catch(null),});diff --git a/client/src/features/home/employee/EmployeeView.tsx b/client/src/features/home/employee/EmployeeView.tsxindex 6ed29bc8..4cba1022 100644--- a/client/src/features/home/employee/EmployeeView.tsx+++ b/client/src/features/home/employee/EmployeeView.tsx@@ -9,11 +9,11 @@* "Pausing…" label until the summary has caught up with the new state (or* a few seconds pass and the list is refetched), so it never flashes the* old label in between. "Open workflow" opens this employee's graph in Dev- * mode.+ * mode, and "Watch live" opens the Workspace on this employee.*/import { useQueryClient } from '@tanstack/react-query';-import { Code } from 'lucide-react';+import { Code, Monitor } from 'lucide-react';import { useEffect, useLayoutEffect, useRef, useState } from 'react';import { ActionButton } from '@/components/ui/action-button';import { Button } from '@/components/ui/button';@@ -93,6 +93,7 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCoconst actions = useWebSocketActions();const queryClient = useQueryClient();const openSettings = useHomeStore((s) => s.openSettings);+ const openWorkspace = useHomeStore((s) => s.openWorkspace);const [running, setRunning] = useState<ControlKind | null>(null);const [awaiting, setAwaiting] = useState<{ kind: ControlKind; target: WorkflowControlStatus } | null>(null);const cardRef = useRef<HTMLDivElement>(null);@@ -243,6 +244,10 @@ function EmployeeCard({ employee, onConnect }: { employee: EmployeeSummary; onCoOpen workflow</Button>)}+ <ActionButton intent="tools" onClick={() => openWorkspace(employee.workflow_id)} className="h-9 gap-2 rounded-row px-3.5">+ <Monitor aria-hidden className="size-3.5" />+ Watch live+ </ActionButton></div></div>);diff --git a/client/src/features/home/header/HomeHeader.tsx b/client/src/features/home/header/HomeHeader.tsxindex 6c692d07..b813628c 100644--- a/client/src/features/home/header/HomeHeader.tsx+++ b/client/src/features/home/header/HomeHeader.tsx@@ -1,7 +1,7 @@/*** Normal mode's header (design handoff "Main header"): with the sidebar- * collapsed, an open button and the logo; the view's title; the Normal/Dev- * switch and the theme button. The bottom border appears only once the+ * collapsed, an open button and the logo; the view's title; the Workspace+ * pill, the Normal/Dev switch and the theme button. The bottom border appears only once the* content has scrolled, so the hero reads as one surface.*/@@ -11,6 +11,7 @@ import { ModeToggle } from '@/components/shell/ModeToggle';import { Button } from '@/components/ui/button';import { cn } from '@/lib/utils';import { useHomeStore } from '../state/homeStore';+import { WorkspaceButton } from '../workspace/WorkspaceButton';import { ThemeButton } from './ThemeButton';export function HomeHeader({ title, scrolled }: { title: string; scrolled: boolean }) {@@ -36,6 +37,7 @@ export function HomeHeader({ title, scrolled }: { title: string; scrolled: boole)}<h2 className="truncate px-1.5 text-lead font-semibold text-fg-default">{title}</h2><div className="ml-auto flex shrink-0 items-center gap-2">+ <WorkspaceButton /><ModeToggle /><ThemeButton /></div>diff --git a/client/src/features/home/state/homeStore.ts b/client/src/features/home/state/homeStore.tsindex 38371e54..c4f75c30 100644--- a/client/src/features/home/state/homeStore.ts+++ b/client/src/features/home/state/homeStore.ts@@ -1,17 +1,57 @@/*** Normal mode's UI state: which view is showing, the sidebar, the Settings- * dialog, and the one-shot "look here" signals (a sidebar row's glow, the- * logo pulse) that the hire choreography fires. Server data lives in- * TanStack Query (features/home/data), never here.+ * dialog, the Workspace dock, and the one-shot "look here" signals (a+ * sidebar row's glow, the logo pulse) that the hire choreography fires.+ * Server data lives in TanStack Query (features/home/data), never here.*/+import { z } from 'zod';import { create } from 'zustand';import { SPIKE, spikeOrb } from '../orb/orb';export type HomeView = { kind: 'hire' } | { kind: 'employee'; workflowId: string };export type SettingsTab = 'profile' | 'billing' | 'skills' | 'connectors' | 'plugins';+// View ids, not node types: the Canvas tab is 'board' so no id reads as the+// `canvas` node type (tests/test_frontend_no_node_type_copies.py).+const WORKSPACE_TABS = ['browser', 'board', 'android'] as const;+export type WorkspaceTab = (typeof WORKSPACE_TABS)[number];+const SIDEBAR_KEY = 'home_sidebar_open';+const WORKSPACE_KEY = 'home_workspace_v1';+/** Narrowest the Workspace drags to (design handoff "Workspace panel"). */+export const WORKSPACE_MIN_WIDTH = 360;+/** Room a drag always leaves for the rest of the screen. */+const WORKSPACE_KEEP_PX = 420;++const workspacePrefsSchema = z.object({+ open: z.boolean().catch(false),+ // A bound for stored values only; while dragging, the window sets the limit.+ widthPx: z.number().min(WORKSPACE_MIN_WIDTH).max(4000).catch(460),+ tab: z.enum(WORKSPACE_TABS).catch('board'),+});+type WorkspacePrefs = z.infer<typeof workspacePrefsSchema>;++/** The Workspace's saved open state, width and tab. A bad field falls back+ * on its own; unreadable storage gives the defaults. */+export function loadWorkspacePrefs(): WorkspacePrefs {+ try {+ const raw = localStorage.getItem(WORKSPACE_KEY);+ if (raw) return workspacePrefsSchema.parse(JSON.parse(raw));+ } catch {+ // Unreadable or blocked storage: the defaults below.+ }+ return workspacePrefsSchema.parse({});+}++function saveWorkspacePrefs(state: HomeState): void {+ const prefs: WorkspacePrefs = { open: state.workspaceOpen, widthPx: state.workspaceWidth, tab: state.workspaceTab };+ try {+ localStorage.setItem(WORKSPACE_KEY, JSON.stringify(prefs));+ } catch {+ // Storage blocked: the dock still works for this session.+ }+}function loadSidebarOpen(): boolean {try {@@ -35,6 +75,14 @@ interface HomeState {logoPulse: number;/** Bumped to ask the composer to take focus. */composerFocus: number;+ /** The Workspace dock. Open, width and tab persist; the rest is this+ * session's. */+ workspaceOpen: boolean;+ workspaceWidth: number;+ workspaceTab: WorkspaceTab;+ workspaceWide: boolean;+ /** Whose workspace it shows: the employee last opened or watched. */+ workspaceFor: string | null;showHire: (options?: { focus?: boolean }) => void;showEmployee: (workflowId: string) => void;@@ -47,8 +95,16 @@ interface HomeState {/** The composer took the focus it was asked for; a remount must not* take it again. */consumeComposerFocus: () => void;+ openWorkspace: (workflowId?: string) => void;+ closeWorkspace: () => void;+ setWorkspaceTab: (tab: WorkspaceTab) => void;+ /** Clamped to 360px .. the window less 420px; ends Expand. */+ setWorkspaceWidth: (px: number) => void;+ toggleWorkspaceWide: () => void;}+const workspace = loadWorkspacePrefs();+export const useHomeStore = create<HomeState>((set, get) => ({view: { kind: 'hire' },sidebarOpen: loadSidebarOpen(),@@ -58,13 +114,18 @@ export const useHomeStore = create<HomeState>((set, get) => ({glow: null,logoPulse: 0,composerFocus: 0,+ workspaceOpen: workspace.open,+ workspaceWidth: workspace.widthPx,+ workspaceTab: workspace.tab,+ workspaceWide: false,+ workspaceFor: null,showHire: (options) =>set((state) => ({view: { kind: 'hire' },composerFocus: options?.focus ? state.composerFocus + 1 : state.composerFocus,})),- showEmployee: (workflowId) => set({ view: { kind: 'employee', workflowId } }),+ showEmployee: (workflowId) => set({ view: { kind: 'employee', workflowId }, workspaceFor: workflowId }),toggleSidebar: () =>set((state) => {const next = !state.sidebarOpen;@@ -85,4 +146,23 @@ export const useHomeStore = create<HomeState>((set, get) => ({set((state) => ({ glow: { workflowId, nonce: (state.glow?.nonce ?? 0) + 1 } })),pulseLogo: () => set((state) => ({ logoPulse: state.logoPulse + 1 })),consumeComposerFocus: () => set((state) => (state.composerFocus === 0 ? state : { composerFocus: 0 })),+ openWorkspace: (workflowId) => {+ if (!get().workspaceOpen) spikeOrb(SPIKE.workspace);+ set((state) => ({ workspaceOpen: true, workspaceFor: workflowId ?? state.workspaceFor }));+ saveWorkspacePrefs(get());+ },+ closeWorkspace: () => {+ set({ workspaceOpen: false });+ saveWorkspacePrefs(get());+ },+ setWorkspaceTab: (tab) => {+ set({ workspaceTab: tab });+ saveWorkspacePrefs(get());+ },+ setWorkspaceWidth: (px) => {+ const max = Math.max(WORKSPACE_MIN_WIDTH, window.innerWidth - WORKSPACE_KEEP_PX);+ set({ workspaceWidth: Math.round(Math.min(max, Math.max(WORKSPACE_MIN_WIDTH, px))), workspaceWide: false });+ saveWorkspacePrefs(get());+ },+ toggleWorkspaceWide: () => set((state) => ({ workspaceWide: !state.workspaceWide })),}));diff --git a/client/src/features/home/ui/primitives.tsx b/client/src/features/home/ui/primitives.tsxindex 198c8d03..a88dcffb 100644--- a/client/src/features/home/ui/primitives.tsx+++ b/client/src/features/home/ui/primitives.tsx@@ -73,11 +73,28 @@ export function StatusDot({ tone, pulse = false, className }: { tone: StatusTone);}-export function StatusPill({ tone, label, pulse = false }: { tone: StatusTone; label: string; pulse?: boolean }) {+const PILL_SIZE = {+ md: 'h-7.5 px-3 text-sm',+ /** The Workspace header's mono micro pill. */+ sm: 'h-5.5 px-2 font-mono text-2xs tracking-label uppercase',+} as const;++export function StatusPill({+ tone,+ label,+ pulse = false,+ size = 'md',+}: {+ tone: StatusTone;+ label: string;+ pulse?: boolean;+ size?: keyof typeof PILL_SIZE;+}) {return (<spanclassName={cn(- 'inline-flex h-7.5 shrink-0 items-center gap-1.5 rounded-pill border px-3 text-sm font-medium transition-colors',+ 'inline-flex shrink-0 items-center gap-1.5 rounded-pill border font-medium transition-colors',+ PILL_SIZE[size],STATUS_PILL_CLASS[tone],)}>diff --git a/client/src/features/home/workspace/WorkspaceButton.tsx b/client/src/features/home/workspace/WorkspaceButton.tsxnew file mode 100644index 00000000..5e1696fd--- /dev/null+++ b/client/src/features/home/workspace/WorkspaceButton.tsx@@ -0,0 +1,42 @@+/**+ * The header's Workspace pill (design handoff "Workspace panel"): opens and+ * closes the dock. Tinted purple while the dock is open; while it is+ * closed, a blinking dot says someone on the team is working.+ */++import { Monitor } from 'lucide-react';+import { Button } from '@/components/ui/button';+import { cn } from '@/lib/utils';+import { useEmployeesQuery } from '../data/employees';+import { useHomeStore } from '../state/homeStore';+import { StatusDot } from '../ui/primitives';++export function WorkspaceButton() {+ const open = useHomeStore((s) => s.workspaceOpen);+ const openWorkspace = useHomeStore((s) => s.openWorkspace);+ const closeWorkspace = useHomeStore((s) => s.closeWorkspace);+ const { data: team } = useEmployeesQuery();+ const someoneWorking = !open && (team ?? []).some((employee) => employee.status === 'working');++ return (+ <Button+ variant="quiet"+ aria-pressed={open}+ title="Workspace: see what your employees are working on"+ onClick={() => (open ? closeWorkspace() : openWorkspace())}+ className={cn(+ 'h-8.5 gap-1.75 rounded-pill px-3 text-sm',+ // Open keeps its purple on hover, where the quiet variant would grey it.+ open+ ? 'border-node-agent-border bg-node-agent-soft text-node-agent-ink hover:bg-node-agent-hover hover:text-node-agent-ink'+ : 'border-border-default text-fg-default hover:border-border-strong',+ )}+ >+ <Monitor aria-hidden className="size-3.75" strokeWidth={1.75} />+ Workspace+ {someoneWorking && <StatusDot tone="live" />}+ </Button>+ );+}++export default WorkspaceButton;diff --git a/client/src/features/home/workspace/WorkspaceCanvas.tsx b/client/src/features/home/workspace/WorkspaceCanvas.tsxnew file mode 100644index 00000000..d7d0a9a6--- /dev/null+++ b/client/src/features/home/workspace/WorkspaceCanvas.tsx@@ -0,0 +1,37 @@+/**+ * The Workspace's Canvas tab: one employee's Canvas board, through the+ * renderer the editor's Canvas panel and dock use (CanvasPanel.tsx is the+ * template). The board refreshes on the `canvas_updated` broadcast, like+ * everywhere else it shows. Loaded lazily by WorkspaceDock.+ */++import { Button } from '@/components/ui/button';+import { Skeleton } from '@/components/ui/skeleton';+import CanvasContent from '@/components/parameterPanel/canvas/CanvasContent';+import { useCanvasBoardQuery, useCanvasRemove } from '@/hooks/useCanvasBoard';+import { pillToast } from '../ui/pillToast';++export default function WorkspaceCanvas({ workflowId, nodeId, name }: { workflowId: string; nodeId: string; name: string }) {+ const board = useCanvasBoardQuery(workflowId, nodeId);+ const remove = useCanvasRemove(workflowId, nodeId);++ if (board.isPending) return <Skeleton className="flex-1 rounded-card" />;+ if (board.isError) {+ return (+ <div className="m-auto flex flex-col items-center gap-3 p-6 text-center">+ <p className="m-0 text-sm text-fg-muted">Couldn’t load the canvas.</p>+ <Button variant="quiet" onClick={() => void board.refetch()} className="border-border-default text-fg-default">+ Try again+ </Button>+ </div>+ );+ }+ return (+ <CanvasContent+ items={board.data.items}+ workflowId={workflowId}+ emptyHint={`Nothing here yet. When ${name} finishes something you’ll want to see, it shows up here.`}+ onRemove={(itemId) => remove.mutate(itemId, { onError: () => pillToast('Couldn’t remove that. Try again.', { tone: 'error' }) })}+ />+ );+}diff --git a/client/src/features/home/workspace/WorkspaceDock.tsx b/client/src/features/home/workspace/WorkspaceDock.tsxnew file mode 100644index 00000000..1e36c520--- /dev/null+++ b/client/src/features/home/workspace/WorkspaceDock.tsx@@ -0,0 +1,287 @@+/**+ * The Workspace (design handoff "Workspace panel"): a dock on the right of+ * Home showing what one employee is working on. Canvas shows the+ * employee's Canvas board through the renderer the editor's Canvas panel+ * uses; Browser and Android say plainly that their live views are not+ * built yet.+ *+ * At 1100px and wider the dock pushes the page aside; narrower, it lies+ * over the page with a shadow. The left edge drags from 360px to the+ * window less 420px, and Expand gives a bigger dock without a drag. Like+ * the sidebar it stays mounted and opens and closes by transitioning its+ * width, so a reload with it open does not animate and reopening it+ * mid-close turns it around. Its contents mount on the first open. Open,+ * width and tab persist (state/homeStore).+ */++import type { LucideIcon } from 'lucide-react';+import { Code, Globe, Maximize2, Minimize2, Monitor, PanelsTopLeft, Smartphone, X } from 'lucide-react';+import { Tabs as TabsPrimitive } from 'radix-ui';+import { Suspense, lazy, useCallback, useLayoutEffect, useRef, useState, type ReactNode } from 'react';+import { Button } from '@/components/ui/button';+import { Skeleton } from '@/components/ui/skeleton';+import { usePanelResize } from '@/hooks/usePanelResize';+import { animate } from '@/lib/motion';+import { cn } from '@/lib/utils';+import { enterDev } from '../../../app/useShellActions';+import { useEmployeesQuery } from '../data/employees';+import { useLiveTask } from '../data/liveTask';+import { presentEmployee } from '../data/presentation';+import type { EmployeeSummary } from '../data/schemas';+import { useHomeStore, type WorkspaceTab } from '../state/homeStore';+import { Avatar, StatusPill } from '../ui/primitives';++// Its own chunk: the board's viewers (markdown, code, JSON) stay out of Home's.+const WorkspaceCanvas = lazy(() => import('./WorkspaceCanvas'));++/** The dragged width, or Expand's, always leaving the window some room. */+function dockWidth(widthPx: number, wide: boolean): string {+ return wide ? 'max(420px, min(1100px, 100vw - 420px))' : `min(${widthPx}px, max(340px, 100vw - 40px))`;+}++const TABS: { tab: WorkspaceTab; label: string; icon: LucideIcon }[] = [+ { tab: 'browser', label: 'Browser', icon: Globe },+ { tab: 'board', label: 'Canvas', icon: PanelsTopLeft },+ { tab: 'android', label: 'Android', icon: Smartphone },+];++const TAB_TRIGGER =+ 'flex h-10 items-center gap-1.75 border-b-2 border-transparent px-2.5 text-sm font-medium whitespace-nowrap text-fg-muted outline-none transition-colors hover:text-fg-default focus-visible:ring-3 focus-visible:ring-ring/50 data-[state=active]:border-node-agent data-[state=active]:text-fg-default';++const PANEL = 'flex min-h-0 flex-1 flex-col bg-bg-app p-3 outline-none';++function Note({ icon: Icon, title, detail, children }: { icon: LucideIcon; title: string; detail: string; children?: ReactNode }) {+ return (+ <div className="m-auto flex max-w-80 flex-col items-center gap-2 p-6 text-center">+ <Icon aria-hidden className="size-6 text-fg-faint" strokeWidth={1.5} />+ <p className="m-0 text-base font-medium text-fg-default">{title}</p>+ <p className="m-0 text-sm text-fg-muted">{detail}</p>+ {children && <div className="pt-2">{children}</div>}+ </div>+ );+}++function DockButtons() {+ const wide = useHomeStore((s) => s.workspaceWide);+ const toggleWide = useHomeStore((s) => s.toggleWorkspaceWide);+ const close = useHomeStore((s) => s.closeWorkspace);+ const wideLabel = wide ? 'Restore size' : 'Expand';+ return (+ <>+ <Button variant="quiet" size="icon-sm" onClick={toggleWide} aria-label={wideLabel} title={wideLabel} className="size-7.5 rounded-lg">+ {wide ? <Minimize2 aria-hidden strokeWidth={1.75} /> : <Maximize2 aria-hidden strokeWidth={1.75} />}+ </Button>+ <Button variant="quiet" size="icon-sm" onClick={close} aria-label="Close workspace" title="Close workspace" className="size-7.5 rounded-lg">+ <X aria-hidden strokeWidth={1.75} />+ </Button>+ </>+ );+}++/** Who, what they are doing, and a Live pill while they work. */+function Identity({ employee }: { employee: EmployeeSummary }) {+ const live = useLiveTask(employee);+ const pill = employee.status === 'working' ? { tone: 'live' as const, label: 'Live' } : presentEmployee(employee).pill;+ return (+ <>+ <Avatar name={employee.name} colorRole={employee.color_role} size="sm" />+ <div className="flex min-w-0 flex-1 flex-col gap-px">+ <span className="truncate text-base font-semibold text-fg-default">{employee.name}’s workspace</span>+ <span className="truncate font-mono text-2xs text-fg-muted">{(live ?? employee.task).text}</span>+ </div>+ <StatusPill size="sm" tone={pill.tone} label={pill.label} />+ </>+ );+}++function CanvasTab({ employee }: { employee: EmployeeSummary }) {+ if (!employee.canvas_node_id) {+ return (+ <Note+ icon={PanelsTopLeft}+ title={`${employee.name} has no Canvas`}+ detail="Add a Canvas node to their workflow, and what they put on it shows up here."+ >+ <Button+ variant="quiet"+ onClick={() => void enterDev({ workflowId: employee.workflow_id })}+ className="h-9 gap-2 rounded-row border-border-strong px-3.5 font-semibold text-fg-default"+ >+ <Code aria-hidden className="size-3.25" />+ Open workflow+ </Button>+ </Note>+ );+ }+ return (+ <Suspense fallback={<Skeleton className="flex-1 rounded-card" />}>+ <WorkspaceCanvas workflowId={employee.workflow_id} nodeId={employee.canvas_node_id} name={employee.name} />+ </Suspense>+ );+}++function DockTabs({ employee }: { employee: EmployeeSummary }) {+ const tab = useHomeStore((s) => s.workspaceTab);+ const setTab = useHomeStore((s) => s.setWorkspaceTab);+ // Only the active panel is mounted, so the shared ref is always it.+ const panelRef = useRef<HTMLDivElement>(null);+ const shownTab = useRef(tab);+ // A new tab's panel rises out of a blur (design handoff "Tabs").+ useLayoutEffect(() => {+ if (shownTab.current === tab) return;+ shownTab.current = tab;+ animate(+ panelRef.current,+ [+ { opacity: 0, transform: 'translateY(6px)', filter: 'blur(3px)' },+ { opacity: 1, transform: 'none', filter: 'blur(0)' },+ ],+ { duration: 'slow', easing: 'spring' },+ );+ }, [tab]);++ return (+ <TabsPrimitive.Root value={tab} onValueChange={(next) => setTab(next as WorkspaceTab)} className="flex min-h-0 flex-1 flex-col">+ <TabsPrimitive.List aria-label="Views" className="flex h-10 shrink-0 gap-0.5 overflow-x-auto border-b border-border-default px-2">+ {TABS.map(({ tab: value, label, icon: Icon }) => (+ <TabsPrimitive.Trigger key={value} value={value} className={TAB_TRIGGER}>+ <Icon aria-hidden className="size-3.75" strokeWidth={1.75} />+ {label}+ </TabsPrimitive.Trigger>+ ))}+ </TabsPrimitive.List>+ <TabsPrimitive.Content ref={panelRef} value="browser" className={PANEL}>+ <Note+ icon={Globe}+ title="The live browser view isn’t available yet"+ detail={`When ${employee.name} works in a browser, you’ll be able to watch here.`}+ />+ </TabsPrimitive.Content>+ <TabsPrimitive.Content ref={panelRef} value="board" className={PANEL}>+ <CanvasTab employee={employee} />+ </TabsPrimitive.Content>+ <TabsPrimitive.Content ref={panelRef} value="android" className={PANEL}>+ <Note+ icon={Smartphone}+ title="The Android mirror isn’t available yet"+ detail={`When ${employee.name} uses your phone, you’ll be able to watch here.`}+ />+ </TabsPrimitive.Content>+ </TabsPrimitive.Root>+ );+}++function NoEmployee({ status }: { status: 'pending' | 'error' | 'success' }) {+ if (status === 'pending') {+ return (+ <div className={PANEL}>+ <Skeleton className="flex-1 rounded-card" />+ </div>+ );+ }+ return (+ <div className={PANEL}>+ {status === 'error' ? (+ <Note icon={Monitor} title="Couldn’t load your team" detail="Check your connection, then open the Workspace again." />+ ) : (+ <Note icon={Monitor} title="No one on your team yet" detail="Hire someone, and you’ll see what they are working on here." />+ )}+ </div>+ );+}++export function WorkspaceDock() {+ const open = useHomeStore((s) => s.workspaceOpen);+ const widthPx = useHomeStore((s) => s.workspaceWidth);+ const wide = useHomeStore((s) => s.workspaceWide);+ const workspaceFor = useHomeStore((s) => s.workspaceFor);+ const setWidth = useHomeStore((s) => s.setWorkspaceWidth);+ const team = useEmployeesQuery();+ const asideRef = useRef<HTMLElement>(null);+ const bodyRef = useRef<HTMLDivElement>(null);++ // The contents mount on the first open and stay through a close.+ const [visited, setVisited] = useState(open);+ if (open && !visited) setVisited(true);++ // Opening slides the contents in behind the widening edge; a reload with+ // the dock open does not.+ const shownOpen = useRef(open);+ useLayoutEffect(() => {+ if (shownOpen.current === open) return;+ shownOpen.current = open;+ if (!open) return;+ animate(+ bodyRef.current,+ [+ { opacity: 0, transform: 'translateX(24px)' },+ { opacity: 1, transform: 'none' },+ ],+ { duration: 'dock-in', delay: 80, easing: 'spring' },+ );+ }, [open]);++ // The handle is the left edge, so dragging left widens. A drag starts+ // from the width on screen, which is Expand's while that is on.+ const onMove = useCallback((deltaPx: number, startPx: number) => setWidth(startPx - deltaPx), [setWidth]);+ const getStartValue = useCallback(+ () => asideRef.current?.getBoundingClientRect().width ?? useHomeStore.getState().workspaceWidth,+ [],+ );+ const resize = usePanelResize({ axis: 'x', cursor: 'ew-resize', onMove, getStartValue });++ const employee = team.data?.find((e) => e.workflow_id === workspaceFor) ?? team.data?.[0] ?? null;+ const width = dockWidth(widthPx, wide);++ return (+ <aside+ ref={asideRef}+ aria-label="Workspace"+ aria-hidden={!open}+ inert={!open}+ style={{ width: open ? width : 0 }}+ className={cn(+ 'relative flex shrink-0 justify-end overflow-hidden bg-bg-panel',+ 'max-[1100px]:absolute max-[1100px]:inset-y-0 max-[1100px]:right-0 max-[1100px]:z-30',+ resize.isResizing ? 'transition-none' : 'transition-[width,opacity] motion-reduce:transition-none',+ open+ ? 'border-l border-border-default opacity-100 duration-(--dur-dock-in) ease-spring max-[1100px]:shadow-dock'+ : 'opacity-0 duration-(--dur-sidebar-out) ease-(--ease-default)',+ )}+ >+ <div+ role="separator"+ aria-orientation="vertical"+ aria-label="Resize workspace"+ title="Drag to resize"+ onMouseDown={resize.start}+ className={cn(+ 'absolute inset-y-0 left-0 z-10 w-1.5 cursor-ew-resize transition-colors hover:bg-node-agent-soft',+ resize.isResizing && 'bg-node-agent-soft',+ )}+ />+ {visited && (+ // Laid out at the full width and clipped while the dock animates,+ // so nothing reflows. No pointer events while dragging: a web or+ // PDF item's iframe would swallow the mouse moves.+ <div+ ref={bodyRef}+ style={{ width }}+ className={cn('flex h-full shrink-0 flex-col', resize.isResizing && 'pointer-events-none')}+ >+ <header className="flex h-(--h-home-header) shrink-0 items-center gap-2.5 border-b border-border-default pr-2.5 pl-4">+ {employee ? (+ <Identity employee={employee} />+ ) : (+ <span className="min-w-0 flex-1 truncate text-base font-semibold text-fg-default">Workspace</span>+ )}+ <DockButtons />+ </header>+ {employee ? <DockTabs employee={employee} /> : <NoEmployee status={team.status} />}+ </div>+ )}+ </aside>+ );+}++export default WorkspaceDock;diff --git a/client/src/hooks/useCanvasBoard.ts b/client/src/hooks/useCanvasBoard.tsindex 1740d874..77c98516 100644--- a/client/src/hooks/useCanvasBoard.ts+++ b/client/src/hooks/useCanvasBoard.ts@@ -15,7 +15,7 @@ import {type CanvasListResponse,canvasBoardQueryKey,} from '../lib/canvasBoard';-import { useWebSocket } from '../contexts/WebSocketContext';+import { useWebSocketActions } from '../contexts/WebSocketContext';export interface CanvasBoard {items: CanvasItem[];@@ -26,7 +26,7 @@ export function useCanvasBoardQuery(workflowId: string | null | undefined,nodeId: string | null | undefined,) {- const { sendRequest, isReady } = useWebSocket();+ const { sendRequest, isReady } = useWebSocketActions();return useQuery<CanvasBoard, Error>({queryKey: nodeId? canvasBoardQueryKey(workflowId, nodeId)@@ -52,7 +52,7 @@ export function useCanvasRemove(workflowId: string | null | undefined,nodeId: string | null | undefined,) {- const { sendRequest } = useWebSocket();+ const { sendRequest } = useWebSocketActions();const queryClient = useQueryClient();return useMutation({mutationFn: async (itemId: string) => {@@ -80,7 +80,7 @@ export function useCanvasClear(workflowId: string | null | undefined,nodeId: string | null | undefined,) {- const { sendRequest } = useWebSocket();+ const { sendRequest } = useWebSocketActions();const queryClient = useQueryClient();return useMutation({mutationFn: async () => {diff --git a/client/src/index.css b/client/src/index.cssindex 86ce014c..992c21b2 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -261,6 +261,7 @@--shadow-float: var(--shadow-float);--shadow-popover: var(--shadow-popover);--shadow-dialog: var(--shadow-dialog);+ --shadow-dock: var(--shadow-dock);--blur-scrim: var(--blur-scrim);diff --git a/client/src/lib/motion.ts b/client/src/lib/motion.tsindex 50a44f57..1980eb70 100644--- a/client/src/lib/motion.ts+++ b/client/src/lib/motion.ts@@ -38,6 +38,7 @@ export type DurName =| 'scrim-in'| 'sidebar-in'| 'sidebar-out'+ | 'dock-in'| 'toast-in'| 'toast-hold'| 'toast-out'@@ -72,6 +73,7 @@ const DUR_FALLBACK: Record<DurName, number> = {'scrim-in': 280,'sidebar-in': 380,'sidebar-out': 300,+ 'dock-in': 480,'toast-in': 420,'toast-hold': 2600,'toast-out': 240,diff --git a/client/src/lib/utils.ts b/client/src/lib/utils.tsindex 13be5cfd..ab1bac0e 100644--- a/client/src/lib/utils.ts+++ b/client/src/lib/utils.ts@@ -15,7 +15,7 @@ const twMerge = extendTailwindMerge({theme: {text: ["meta", "row", "lead", "title", "hero"],radius: ["pill", "row", "card", "panel", "draft", "composer"],- shadow: ["float", "popover", "dialog"],+ shadow: ["float", "popover", "dialog", "dock"],ease: ["spring", "overshoot", "reveal"],tracking: ["label", "hero", "wordmark"],leading: ["hero"],diff --git a/client/src/themes/base.css b/client/src/themes/base.cssindex 78f7b768..138c97bc 100644--- a/client/src/themes/base.css+++ b/client/src/themes/base.css@@ -134,6 +134,7 @@--dur-scrim-in: 280ms;--dur-sidebar-in: 380ms;--dur-sidebar-out: 300ms;+ --dur-dock-in: 480ms; /* Home Workspace dock: width + content slide */--dur-toast-in: 420ms;--dur-toast-hold: 2600ms;--dur-toast-out: 240ms;diff --git a/client/src/themes/dark.css b/client/src/themes/dark.cssindex d25045c2..442d3195 100644--- a/client/src/themes/dark.css+++ b/client/src/themes/dark.css@@ -133,6 +133,7 @@--shadow-float: 0 12px 40px rgb(0 0 0 / 0.5);--shadow-popover: 0 12px 32px rgb(0 0 0 / 0.5);--shadow-dialog: 0 24px 80px rgb(0 0 0 / 0.6);+ --shadow-dock: -24px 0 60px rgb(0 0 0 / 0.5);/* Home glows and the working pip's ring, in the neon (light.css has the* ink versions for white surfaces). */diff --git a/client/src/themes/light.css b/client/src/themes/light.cssindex 0011c35f..1e1a6ac0 100644--- a/client/src/themes/light.css+++ b/client/src/themes/light.css@@ -223,6 +223,7 @@--shadow-float: 0 12px 40px rgb(15 23 42 / 0.10);--shadow-popover: 0 12px 32px rgb(15 23 42 / 0.12);--shadow-dialog: 0 24px 80px rgb(15 23 42 / 0.16);+ --shadow-dock: -24px 0 60px rgb(15 23 42 / 0.10);/* ── Home glows (a connect, a new hire's row, the refine ring, a new* task) and the working pip's ring. On white the design swaps each neondiff --git a/docs-internal/canvas_node.md b/docs-internal/canvas_node.mdindex d8911e09..835e6ca0 100644--- a/docs-internal/canvas_node.md+++ b/docs-internal/canvas_node.md@@ -3,10 +3,11 @@The `canvas` node is the platform's viewing surface — the Claude/ChatGPT-Canvasanalog. Agents and workflow runs push content onto a per-node **board**(workspace file references, external URLs, small markdown notes), and the-board renders in two hosts that share one renderer: the node's full-height-parameter panel, and a **docked, resizable right-side sidebar** that stays+board renders in three hosts that share one renderer: the node's full-height+parameter panel, a **docked, resizable right-side sidebar** that staysopen while working on the graph, auto-opens when content is pushed, and-doubles as the click-to-preview surface for workspace files.+doubles as the click-to-preview surface for workspace files, and the Canvas+tab of Home's Workspace dock.Everything here composes existing patterns; the doc records which one eachpiece copies and the few places where a *new* decision had to be made (the@@ -229,7 +230,7 @@ Client-side types + query keys live in`canvasBoardQueryKey(workflowId ?? 'unsaved', nodeId)` (todoQuery shape),prefix `['canvasBoard']` for broadcast-driven invalidation.-## Frontend — two hosts, one renderer+## Frontend — three hosts, one renderer### Hosts@@ -253,6 +254,13 @@ prefix `['canvasBoard']` for broadcast-driven invalidation.string), ephemeral "Preview" badge + Back, close. TopToolbar carries thetoggle button (Monitor icon, `aria-pressed`, action-tools tokens),reading the dock store directly — the state is not Dashboard's to thread.+- **[`WorkspaceCanvas.tsx`](../client/src/features/home/workspace/WorkspaceCanvas.tsx)**+ — the Canvas tab of Normal mode's Workspace dock+ ([normal_mode.md](./normal_mode.md#the-workspace)). It shows one+ employee's board, named by the employee summary's `canvas_node_id`,+ loads lazily so the renderer's viewers stay out of Home's chunk, and+ passes an owner-facing empty hint. Hires get a Canvas node from the+ Hire builder.### Dock state — [`stores/canvasDockStore.ts`](../client/src/stores/canvasDockStore.ts)diff --git a/docs-internal/normal_mode.md b/docs-internal/normal_mode.mdindex c5b80c36..1ec8ab2f 100644--- a/docs-internal/normal_mode.md+++ b/docs-internal/normal_mode.md@@ -57,17 +57,18 @@ out of git). Where its token values differ from the repo's, the repo wins.| Folder | Contents ||---|---|-| `HomeShell.tsx` | Sidebar, header, the current view (hire or one employee), Settings, the connect dialog, the orb's stage |-| `sidebar/`, `header/` | The team list, New employee, the profile row; the view title, mode toggle and theme button |+| `HomeShell.tsx` | Sidebar, header, the current view (hire or one employee), the Workspace dock, Settings, the connect dialog, the orb's stage |+| `sidebar/`, `header/` | The team list, New employee, the profile row; the view title, the Workspace pill, mode toggle and theme button || `hire/` | The hero, the composer, starter jobs || `genui/` | The setup draft under the composer (below) |-| `employee/` | One employee's card: status, the current task, apps, "done today", Start / Pause / Resume, the drafts waiting for the owner |+| `employee/` | One employee's card: status, the current task, apps, "done today", Start / Pause / Resume, Watch live, the drafts waiting for the owner |+| `workspace/` | The Workspace dock (below), its header pill, and its Canvas tab, which loads in its own chunk || `settings/` | The Settings pages (Profile, Billing, Skills, Connectors, Plugins), the shared catalog page the last three build on, and `ConnectDialog` (the editor's credential panel for one provider, in its compact variant) || `approvals/` | The drafts query, the decide mutation (optimistic), the approval broadcast listener || `data/` | zod-parsed queries for employees, connectors and the profile; `presentation.ts` maps server state to pills and actions without deriving new rules || `orb/` | The 3D orb (below) || `ui/` | Small shared pieces (avatar, status dot and pill, app mark) and the pill toast |-| `state/homeStore.ts` | UI state only: the view, the sidebar, Settings, one-shot glow and pulse signals |+| `state/homeStore.ts` | UI state only: the view, the sidebar, Settings, the Workspace dock, one-shot glow and pulse signals |Status comes from the server: an employee summary is `working`, `ready`,`paused` or `attention` (an automatic pause, see below), and a pending draft@@ -88,14 +89,42 @@ and its lifecycle: leaving Home keeps the renderer, the app shell disposes it.`OrbStage` is the canvas host below the header; each view's `OrbSlot` reservesthe square the orb glides into. The composer sets the energy target (focused,holding text, a setup being written). These spike it: a hire, a theme or mode-switch, a connect, a task change, opening Settings, a setup arriving or-failing, and saving the profile (`SPIKE` in orb.ts). In dark the orb keeps the+switch, a connect, a task change, opening Settings or the Workspace, a setup+arriving or failing, and saving the profile (`SPIKE` in orb.ts). In dark the orb keeps thelogo's colours with white particles and packets; in light it is glossypiano-black under a white rim light. Its glows and particles blend additivelyin dark and normally in light (additive glow vanishes on white), fading throughzero at the midpoint of a theme change. Without WebGL, under reduced motion, orafter a lost WebGL context, the slot shows the static mark.+## The Workspace++A dock on the right of Home ([workspace/WorkspaceDock.tsx](../client/src/features/home/workspace/WorkspaceDock.tsx))+that shows what one employee is working on. The header's Workspace pill+opens and closes it, and carries a blinking dot while it is closed and+someone is working. Watch live on an employee's card opens it on that+employee. It shows the employee last opened or watched, else the first on+the team.++- **Header**: the avatar, "{Name}’s workspace", the live task line+ (`useLiveTask`, else the summary's task), and a pill: Live while the+ employee works, otherwise the card's own pill. Expand and Close.+- **Canvas**: the board named by the summary's `canvas_node_id`, drawn by+ the editor's Canvas renderer (`CanvasContent`, see [Canvas Node](./canvas_node.md)).+ It loads in its own chunk, which keeps the board's markdown, code and+ JSON viewers out of Home's, and refreshes on `canvas_updated` like the+ editor's hosts. An employee without a Canvas gets a note and Open+ workflow.+- **Browser** and **Android** say that their live views are not built yet.+- **Size and motion**: 460px wide by default. The left edge drags from+ 360px to the window less 420px, and Expand gives a bigger dock without+ a drag. At 1100px and wider the dock pushes the page aside; narrower, it+ lies over it with `--shadow-dock`. Like the sidebar it stays mounted and+ transitions its width (`--dur-dock-in` to open, `--dur-sidebar-out` to+ close), so a reload with it open does not animate, and its contents+ mount on the first open. Open, width and tab persist under+ `home_workspace_v1`; Expand and the employee last only for the session.+## Hiring### 1. The setup screen@@ -330,5 +359,14 @@ history). Client: `features/home/**/__tests__`, `app/__tests__`,library is shared across users in multi-user mode, like the team list.- An employee hired before Canvas has no Canvas node, so its`canvas_node_id` is null. Adding one in Dev mode fills it in.+- The Workspace's Browser and Android tabs have no live view yet, and it+ has no timeline, replay or Take over.+- With login on, an agent's Canvas writes land under the default owner:+ its tool call carries no user id+ ([agent_workflow.py](../server/services/temporal/agent_workflow.py)).+ The Workspace reads the signed-in owner's board, so it shows nothing+ there. This predates the Workspace and applies to the editor's Memory+ and Data Source tools as well. Fixing it moves existing memories to a+ different owner, so it needs its own change.- A manual-chat employee cannot be given work from Home yet; the setup promptsteers towards app and schedule triggers.diff --git a/docs-internal/theme_system.md b/docs-internal/theme_system.mdindex 6dbcdd36..691379c8 100644--- a/docs-internal/theme_system.md+++ b/docs-internal/theme_system.md@@ -136,7 +136,8 @@ tokens are used directly, as `w-(--w-home-sidebar)` or `duration-(--dur-slow)`):- **Motion**: `--ease-spring | overshoot | reveal` and the choreographydurations (`--dur-intro`, `--dur-view-swap`, `--dur-panel-in/-out`,`--dur-toast-in/-hold/-out`, `--dur-mode-in/-out`, `--dur-theme-reveal`,- `--dur-glow`, `--dur-pip-loop`, …). Web Animations read them through+ `--dur-glow`, `--dur-pip-loop`, `--dur-dock-in` for the Workspace dock,+ …). Web Animations read them through[lib/motion.ts](../client/src/lib/motion.ts), whose fallbacks mirrorbase.css.- **Radii**: `--radius-row | card | panel | draft | composer`, multiples of each@@ -148,7 +149,8 @@ tokens are used directly, as `w-(--w-home-sidebar)` or `duration-(--dur-slow)`):- **Status**: `--status-{working,ready,paused,attention,waiting}-{dot,fill,border,ink}`for the employee pills and dots. The dot is the raw role colour; light.csskeeps the paused dot at the design's mid grey.-- **Per family** (light.css / dark.css): `--shadow-float | popover | dialog`,+- **Per family** (light.css / dark.css): `--shadow-float | popover | dialog |+ dock` (`dock` is the Workspace's left shadow when it lies over the page),the logo palette `--lg-*`, the node-role `-fill / -edge / -hover / -ink`variants, and Home's glows: `--glow-connect | hire | hire-settle | refine |refine-out | task` plus the working pip's `--tint-pip-ring`. Dark keeps the