Skip to content

Commit fb34c2b

Browse files
author
CrewCoder
committed
Refactor WindowTabs component tests and implementation for mobile support; add WorkspaceDock tests and functionality for tab management; enhance WorkspaceRow to handle brain access states; update chat session handling for adaptive effort levels; improve web RPC client to preserve session states; adjust CSS for mobile layouts and workspace management; modify CrewCoder types for approval modes; increase HUB_RELAY_MAX_FRAME_BYTES for better data handling.
1 parent 4a836db commit fb34c2b

60 files changed

Lines changed: 809 additions & 204 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ Update corresponding Docs in [CrewCode Docs](/docs/), and [AGENTS.md](/AGENTS.md
2424

2525
## Agent Notes
2626

27+
Mobile window tabs use the bottom workspace dock's Tabs button and an on-demand
28+
sheet; never reserve a top tab-strip row on phones. Preserve exact tab selection,
29+
observed activity, pinned-tab close protection, built-in/plugin new-tab actions,
30+
and dismiss-on-selection. Desktop retains its tab strip. Mobile overlay offsets
31+
must not reserve the former 40px strip. See `docs/mobile-responsive-pages.md`.
32+
33+
34+
Claude effort menus include Off, Adaptive, Low, Medium, High, XHigh, and Max.
35+
Adaptive is a Claude-only UI selection: omit SDK `effort` and `thinking` so
36+
Claude Code retains its environment/settings/model resolution. Off explicitly
37+
disables thinking; named levels pass through as SDK effort values. Keep the
38+
session, crew, desktop/web, and SSH contracts aligned. See `docs/reasoning-effort.md`.
39+
2740
The context usage meter must prefer the active provider's reported full context
2841
window over model-catalog metadata and static limits. Codex app-server usage
2942
reports `modelContextWindow` as an effective prompt budget; when a known full
@@ -374,8 +387,20 @@ Brain catalogue without replacing genuine identities the Brain already owns, onc
374387
desktop catalogue authority exists. An explicit Background Brain enable is a new
375388
owner-observed handoff: before the enable-triggered reload, seed the exact foreground
376389
desktop chat/session catalogue even when an older authority marker exists. Reconcile
377-
the current desktop workspace registry first for matching ids/paths and preserve
378-
genuine Brain-only/browser-created workspaces. Until that marker is present, or while
390+
the current desktop workspace registry first for matching ids/paths. Preserve only
391+
Brain-only/browser-created workspaces whose observed creation time is newer than the
392+
desktop registry; never resurrect older entries missing from the current desktop list.
393+
Treat explicit Background Brain enable as an audited owner-local grant of each exact
394+
existing registered local project path, preserving scopes and never granting a broader
395+
parent; standalone Brain remains explicit-root-only and SSH stays desktop-only. Attached
396+
Electron must read the exact native registry. Brain/browser catalogue reads may expose
397+
registered metadata outside current roots as locked rows, but every content or execution
398+
operation still requires the existing scope, registered-workspace, and live-root gates.
399+
Never relay device-local project icon data in the workspace catalogue. Keep individual
400+
encrypted Hub frames within the existing 8 MiB connection-burst ceiling and preflight
401+
Brain output so an oversized RPC result closes only its logical browser tunnel, not the
402+
machine relay.
403+
Until that marker is present, or while
379404
the Brain still contains transcript-derived recovered rows, Electron reseeds the exact desktop
380405
names, active selection, tab-key order, and per-tab session order; drop unmatched
381406
recovered navigation rows while preserving transcript shards, and retain genuine
@@ -452,6 +477,12 @@ The composer PromptPicker has separate Prompts and Skills tabs backed by the sha
452477

453478
On phones, Code Editor keeps the code canvas primary and opens its file tree as a dismissible right overlay. Git Sidebar must remain the same stateful surface on desktop and mobile, becoming an off-canvas panel with backdrop/close controls instead of being hidden or squeezing chat/editor content. Changes by turn is a full-screen mobile review: its catalogue stacks above the diff when open, while a targeted changed-file route keeps the catalogue closed. Keep all JS/CSS decisions aligned at `≤768px`; see `docs/mobile-responsive-pages.md`.
454479

480+
Mobile/Hub typography must honor the live chat `--mono-size` and CodeMirror
481+
`--editor-size` settings. Keep the composer at `max(16px, --mono-size)` to prevent
482+
iOS focus zoom without blocking larger user-selected text, and keep the editor size
483+
authoritative over CodeMirror's runtime-injected theme. See
484+
`docs/mobile-responsive-pages.md`.
485+
455486
The Code Editor file tree is lazy and must expose dependency, build-output, cache,
456487
and workspace-local Python environment folders on demand for local and SSH roots.
457488
Keep `.git` and `.DS_Store` hidden from direct browsing. Do not widen bounded
@@ -502,7 +533,7 @@ CrewCoder `crew-tasks` activity remains provider-owned and optional. Preserve th
502533

503534
YuHeard PTY integration must remain bundle-safe. `PtyService` receives the active YuHeard server through an injected accessor and statically imports its shell-wrapper helpers; do not use runtime relative `require('./yuheard-*')` calls from PTY code because electron-vite can move that code into a chunk without emitting the required sibling modules. CLI launch, initial TUI paint, and prompt submission are not completed turns. Codex must use only its exact `approval-requested` and `agent-turn-complete` hook events—never generic PTY idle/BEL heuristics—while output fallback detection remains available for agents without an exact hook. Suppress every YuHeard surface only when the exact completing terminal owns keyboard focus in the focused CrewCode window; a different pane must still alert. See `docs/yuheard.md`.
504535

505-
CrewCoder agent profiles are separate from CrewCode execution modes. Show the desktop model-row profile picker only when the installed CrewCoder provider is active; disable it during a running turn, persist the optional session-scoped `crewcoderMode`, omit `--mode` for Configured default, and pass only `general | crewcoder | plugin | extension` to `crewcoder acp --mode`. A concrete profile locks the underlying CrewCode permission policy to Build and disables Ask/Plan/Build/Full on desktop and phone; Configured default re-enables those controls. Never retain a hidden prior Ask, Plan, or Full Access policy under a concrete profile. When the concrete `crewcoder` profile is active, show the separate desktop approval picker and persist `crewcoderApprovalMode`; expose only CrewCoder's `review`, `always`, `never`, `full-access`, and `sandboxed` values, with `review` as the fail-closed default. Treat approval changes as immutable launch authority: disable them during a running turn, drop only the idle bridge, include the value in custody, and native-resume on the next prompt. Never suppresses prompts but continues to block dangerous calls; Sandboxed applies the native sandbox policy where supported; Full access bypasses CrewCoder approval requests and dangerous-command blocking, so label that risk truthfully and never imply CrewCode Build still interposes. Never route Ask/Plan/Build/Full into CrewCoder's `--mode`. The `crewcoder` profile's plan gate is CrewCoder-owned: project `crewcoder_clarify` / `crewcoder_propose_plan` into the activity overlay and send `/approve-plan` as a prompt, never as a tool-permission Allow/Deny. See `docs/crewcoder-provider.md`.
536+
CrewCoder agent profiles are separate from CrewCode execution modes. Show the desktop model-row profile picker only when the installed CrewCoder provider is active; disable it during a running turn, persist the optional session-scoped `crewcoderMode`, omit `--mode` for Configured default, and pass only `general | crewcoder | plugin | extension` to `crewcoder acp --mode`. A concrete profile locks the underlying CrewCode permission policy to Build and disables Ask/Plan/Build/Full on desktop and phone; Configured default re-enables those controls. Never retain a hidden prior Ask, Plan, or Full Access policy under a concrete profile. When the installed CrewCoder provider is active, show the separate desktop approval picker across general, crewcoder, plugin, extension, and Configured default; persist `crewcoderApprovalMode` independently of profile changes and honor it at launch in every profile; expose only CrewCoder's `review`, `always`, `never`, `full-access`, and `sandboxed` values, with `review` as the fail-closed default. Treat approval changes as immutable launch authority: disable them during a running turn, drop only the idle bridge, include the value in custody, and native-resume on the next prompt. Never suppresses prompts but continues to block dangerous calls; Sandboxed applies the native sandbox policy where supported; Full access bypasses CrewCoder approval requests and dangerous-command blocking, so label that risk truthfully and never imply CrewCode Build still interposes. Never route Ask/Plan/Build/Full into CrewCoder's `--mode`. The `crewcoder` profile's plan gate is CrewCoder-owned: project `crewcoder_clarify` / `crewcoder_propose_plan` into the activity overlay and send `/approve-plan` as a prompt, never as a tool-permission Allow/Deny. See `docs/crewcoder-provider.md`.
506537

507538
CrewCoder manual compaction is capability-gated. Expose the bridge `compact()` path only after observing exact `initialize._meta["crewcoder/sessionCompact"].method === "session/compact"`; older CrewCoder versions retain summary-reset. Call the advertised method only while idle and keep CrewCoder's durable session id and ACP child after success. Use the returned summary to replace CrewCode's replay shard and add the visible compact-summary card while retaining the full rich display transcript. Treat `_crewcoder/compaction_update` as authoritative, never infer a duplicate from usage, never fabricate a turn for idle progress, and do not clear usage/replay when the provider reports a skipped compact. See `docs/crewcoder-provider.md` and `docs/conversation-storage.md`.
508539

‎docs/crewcoder-provider.md‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
CrewCoder is a first-class CrewCode chat and Crew provider implemented by
44
`src/main/agents/crewcoder-bridge.ts`. CrewCode is the ACP **client**: it spawns
5-
`crewcoder acp --approval review`, optionally adding a selected CrewCoder
5+
`crewcoder acp --approval <policy>` (defaulting to `review`), optionally adding a selected CrewCoder
66
`--mode`, and translates newline-delimited JSON-RPC 2.0 onto the shared
77
`AgentBridge` event stream. CrewCoder remains the ACP agent.
88

@@ -36,15 +36,17 @@ a turn is running so authority cannot change underneath live execution. It
3636
stays absent for unavailable or inactive providers and from the phone layout,
3737
where the desktop model-row reveal itself is intentionally hidden.
3838

39-
When the concrete **CrewCoder** profile is selected, the row also shows a
40-
session-scoped approval picker with all native policies:
39+
When CrewCoder is the active installed provider, the row also shows a
40+
session-scoped approval picker for **General**, **CrewCoder**, **Plugin**,
41+
**Extension**, and **Configured default**, with all native policies:
4142

4243
- **Review** (`review`) lets safe calls proceed and asks for mutations and dangerous calls.
4344
- **Always** (`always`) asks for every non-safe call.
4445
- **Never** (`never`) shows no prompts while continuing to block dangerous calls.
4546
- **Full access** (`full-access`) accepts calls without prompts.
4647
- **Sandboxed** (`sandboxed`) shows no prompts and runs non-dangerous calls through the sandbox policy where supported.
4748

49+
The selected policy survives profile changes, including Configured default.
4850
Older or invalid persisted values fail closed to Review. Changing the policy
4951
drops only the idle CrewCoder bridge and native-resumes it on the next prompt;
5052
both controls are disabled during a running turn. Full access is an explicit
@@ -219,8 +221,10 @@ CrewCoder TUI, including active → pending → completed ordering.
219221

220222
## Mode and permission enforcement
221223

222-
CrewCoder always starts with `--approval review`; CrewCode applies the current
223-
composer mode when each `session/request_permission` arrives:
224+
CrewCoder starts with the session's selected `--approval` policy in every agent
225+
profile, defaulting to `review`. CrewCode applies the current composer mode
226+
when a `session/request_permission` arrives; policies that emit no request
227+
bypass this permission overlay:
224228

225229
| CrewCode mode | Decision |
226230
| --- | --- |

‎docs/current-state.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Queued follow-up messages are also session-scoped. There is exactly ONE follow-u
147147

148148
Composer execution modes are `ask | plan | build | full`, where `full` is displayed as **Full Access**. A mode has an optional prompt preamble (`buildModePreamble`) **plus** a real per-provider permission policy; the preamble is advisory, not enforcement. Settings customizes the shared prompt text, while `Session.modePromptsEnabled` controls injection per Solo Chat from `ChatHeader`; it defaults true, copies on duplicate, and locks after startup context is sent because provider context cannot be revoked. Disabling it must never weaken provider-native permission policy, and skills/delegation context must still be delivered. Build approvals may grant **allow all (this turn ONLY)** only through main-issued `{bridgeId, turnId}` capability state: approve the current and later permission requests in that turn, clear on every turn/bridge termination boundary, and never use provider-native remembered choices that could outlive the turn. The wire value is `'full'` (renamed from `'yolo'`), the display token is `Mode` = `'Full'`, and the label is `MODE_LABEL` = `'Full Access'`. Because the wire value changed, persisted sessions and `defaultMode` can still hold `'yolo'`, so every read of a persisted mode goes through `normalizeModeLevel()` (`yolo` -> `full`, unknown -> `build`) — an unrecognized level returns `undefined` from `MODE_FROM_SETTINGS`, which crashes the composer mode picker and prepends a literal "undefined" to the prompt. Full Access means every tool is pre-approved: Claude uses `bypassPermissions`, Codex uses `workspace-write` + `never` approvals (deliberately NOT `danger-full-access` — worktree isolation stays), pi/hermes/CrewCoder auto-accept permission requests, and agents must never ask for tool permission. `toolPolicy: 'read-only'` always overrides the mode, so supervisor and completion bridges stay read-only even in Full Access, and real `AskUserQuestion` prompts still surface. See `docs/execution-modes.md`.
149149

150-
Reasoning effort choices are provider-native: Claude exposes `off/low/medium/high/xhigh/max`; Codex exposes `off/low/medium/high/xhigh/max/ultra`; other providers expose `off/low/medium/high/xhigh`. Claude `off` must explicitly disable SDK thinking, and its named levels map to SDK `effort`. Codex `xhigh/max/ultra` must pass through app-server unchanged rather than silently downgrade. Codex Ultra's automatic delegation is upstream provider behavior—CrewCode does not emulate it. See `docs/reasoning-effort.md`.
150+
Reasoning effort choices are provider-native: Claude exposes `off/adaptive/low/medium/high/xhigh/max`; Codex exposes `off/low/medium/high/xhigh/max/ultra`; other providers expose `off/low/medium/high/xhigh`. Claude `off` must explicitly disable SDK thinking; `adaptive` omits both SDK `effort` and `thinking` to retain Claude Code's settings/model resolution, and its named levels map to SDK `effort`. Codex `xhigh/max/ultra` must pass through app-server unchanged rather than silently downgrade. Codex Ultra's automatic delegation is upstream provider behavior—CrewCode does not emulate it. See `docs/reasoning-effort.md`.
151151

152152
## Claude SDK Global skills isolation
153153

‎docs/desktop-web-continuity.md‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ session and provider.
8181

8282
Every explicit enable also reconciles the current desktop workspace registry into the
8383
Brain before attachment: current desktop entries and ordering win for matching ids or
84-
paths, while genuine browser-created workspaces are retained. Immediately after the
84+
paths. A Brain-only workspace is retained only when its observed creation time is newer
85+
than the current desktop registry; older missing entries are treated as intentionally
86+
removed and are not resurrected. The same explicit local enable auditably adds each
87+
existing registered local project as an exact Brain authorization root while preserving
88+
the current scopes; it never grants a broader parent or adds a scope. SSH workspaces
89+
remain desktop-only. Immediately after the
8590
Brain attaches, but before Electron reloads, the foreground renderer sends its exact
8691
current chat/session and workspace-tab catalogue through the owner-loopback desktop
8792
control. This enable-time handoff supersedes an older persisted authority marker, so a
@@ -97,12 +102,23 @@ After attachment, the Brain store is authoritative for:
97102
- the workspace-tab and chat-session catalogue needed to find the same threads on
98103
another client.
99104

105+
Attached Electron continues to read the exact native desktop workspace catalogue so
106+
Brain attachment cannot hide local or SSH projects. Brain/browser `workspaces.list`
107+
returns that same registered catalogue after `workspace:read` is granted. Rows outside
108+
the currently authorized roots remain visible as **Authorize** and SSH rows as
109+
**Desktop**; they cannot be opened and no filesystem, Git, terminal, or agent operation
110+
may cross the existing root gate.
111+
Project icon data remains device-local and is omitted from relayed workspace catalogues
112+
so several large icons cannot disconnect the Brain during browser startup. Relay frames
113+
are bounded to the Hub's existing 8 MiB connection-burst budget; Brain rejects an
114+
oversized result on only the affected logical tunnel before it reaches the Hub.
115+
100116
Each renderer still uses localStorage as a bounded paint/navigation cache. At startup,
101117
it hydrates the catalogue plus bounded recent tails for active and locally cached
102118
conversation scopes from the Brain. A cold conversation hydrates its own bounded tail
103119
when opened. Each remote scope tail is capped at 96 KiB; the 32-scope startup window
104120
therefore stays below 3 MiB of transcript plaintext and leaves encryption and other
105-
startup RPCs headroom inside the Hub's shared 8 MiB relay burst. Full shards remain
121+
startup RPCs headroom inside the Hub's shared 8 MiB relay burst and frame ceiling. Full shards remain
106122
authoritative on the Brain. The renderer never requests `transcripts.loadAll` over the
107123
Brain/Hub relay: combining a large transcript store into one encrypted frame can exceed both
108124
the relay frame limit and the JavaScript string limit. Full per-scope shards remain

‎docs/mobile-responsive-pages.md‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ treat `≤768px` as mobile. The renderer is shared by direct `crewcode serve` an
55
Hub-relayed browser sessions; responsive work must not fork the underlying data
66
or privileged client paths.
77

8+
## Window tabs
9+
10+
On phones, the top window-tab strip is replaced by a **Tabs** button and open-tab
11+
count in the existing bottom workspace dock. It opens a scrollable bottom sheet
12+
with the active tab highlighted, observed agent/crew activity, and separate close
13+
buttons. Pinned tabs stay protected from closing. Selecting a tab dismisses the
14+
sheet; **New tab** exposes the same built-in and plugin destinations as desktop.
15+
Escape, the backdrop, the close button, and dragging the handle dismiss the sheet.
16+
Keyboard focus stays within the sheet and returns to its trigger on dismissal.
17+
Desktop retains its existing tab strip. Mobile workspace, Git, and file-tree
18+
overlays start at the top of the viewport without reserving the former 40px strip.
19+
20+
## Typography
21+
22+
Hub/mobile renderers apply the same live chat and Code Editor typography settings
23+
as desktop. Agent replies and user bubbles consume `--mono-size`; the phone composer
24+
uses the selected size with a 16px minimum to prevent iOS focus zoom. CodeMirror's
25+
runtime theme must not override `--editor-size`, including after the editor is already
26+
mounted. These preferences remain browser-device-local and update without a reload.
27+
828
## Code and Git review
929

1030
- **Code Editor** keeps the code canvas full width. Tabs and status metadata
@@ -21,7 +41,7 @@ or privileged client paths.
2141
stack above the diff, menus and branch selection use mobile overlay layers,
2242
and interactive controls/inputs remain touch-sized and iOS-safe.
2343
- **Changes by turn** becomes a full-screen review surface between the mobile
24-
tab bar and workspace dock. With its catalogue visible, turn/file selection
44+
viewport top and workspace dock. With its catalogue visible, turn/file selection
2545
stacks above the diff. Direct changed-file targets keep the catalogue closed
2646
so the selected Pierre diff receives the full viewport.
2747

0 commit comments

Comments
 (0)