Skip to content

Commit 9a1c5d1

Browse files
author
CrewCode Test
committed
feat: add bridge handoff functionality and enhance mobile styles
- Implemented method in web-rpc-client for handling conversation handoffs. - Updated mission-control and system-monitor styles for improved mobile responsiveness. - Introduced new mobile settings styles to enhance user experience on smaller screens. - Added Tailwind CSS utility classes for better design consistency and responsiveness. - Extended session type definitions to include for branch provisioning.
1 parent 2a8f6cd commit 9a1c5d1

81 files changed

Lines changed: 4426 additions & 404 deletions

File tree

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ The self-hosted Hub is a separate `crewcode hub` process, not Electron renderer
157157

158158
The design system lives in `.design/crewcode-design-system/`. The canonical CSS tokens are in `src/renderer/src/styles/colors_and_type.css`.
159159

160+
Renderer components may use Tailwind v4 utilities through the utilities-only integration in `src/renderer/src/styles/tailwind.css`. Preflight must stay disabled so incremental conversions do not reset unrelated app surfaces. Use the `cc-*` semantic Tailwind colors, which map to the canonical live CSS tokens; see `docs/tailwind-renderer.md`.
161+
160162
**Hard rules:**
161163

162164
- Background: `#0f120f` (dark), never pure black
@@ -177,6 +179,8 @@ Three tsconfigs compose via project references:
177179

178180
Read this file only when working on any of the features below and need the Current state of them `CrewCoder provider`, `ACP Grok Build`, `Sidebar Folder Creation`, `Crew Supervisor`, `Delegated Threads`,`Chat Archiving`, `Hide work Logs`, `Realtime Voice Orb`, `Notifcation Sound`, `Agent Messages`, `Agent Task Activity`, `Cusromization Panel`, `Queued Messages`, `Composer Execution Modes & reasoning`, `Claude SDK Global skills isolation`, `Provider Switch Handoff & Compact`, `Chat`, `Markdown Editor`, `Code Editor`, `Workbench Mode`, `Git Workspace/Sidebar`, [Current State](docs/current-state.md)
179181

182+
Provider context handoff is initiated from the Solo Chat header or `/handoff`. Preserve the destination-card behavior, existing-chat provider/model/effort locking, visible destination meter, and disposable destination-provider summary flow documented in `docs/provider-context-handoff.md`.
183+
180184
## Plugin platform notes
181185

182186
CrewCode has a local-first plugin platform moving from v0 prototype to stable contract.

‎docs/crewcoder-provider.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ failure.
7777
CrewCoder ACP respects CrewCoder's persisted `autoCompact` setting. CrewCode does not force
7878
compaction or retry context-window failures. Automatic and provider-neutral safety compaction are
7979
reported live through `_crewcoder/compaction_update`, allowing CrewCode to show the compaction meter
80-
while CrewCoder summarizes in the background. When automatic compaction is off, the user explicitly
80+
while CrewCoder summarizes in the background. If the ACP child exits, CrewCode removes that dead
81+
bridge registration; the next composer submission uses normal missing-bridge recovery rather than
82+
attempting to write to closed stdin and surfacing `crewcoder acp: process not writable`. When automatic compaction is off, the user explicitly
8183
runs `/compact` before continuing; this policy does not affect Pi or other providers.
8284

8385
A prompt has a ten-minute **inactivity** watchdog rather than a wall-clock turn

‎docs/current-state.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ Real agent integration is wired through normalized bridges (pi, OpenCode, Claude
44

55
Workspaces, worktrees, git operations, terminals, settings, and crew sessions are all real and persisted (workspaces + tabs to disk, messages to localStorage).
66

7+
Settings → General stores a workspace-scoped default branch for newly created solo-chat sessions. The selector detects local branches from the active repository. A new session captures that setting once, reuses or creates the branch worktree, selects it for that chat surface, then clears the one-shot request so existing chats and later manual branch switches are never moved retroactively. Delegated threads retain their separate base/worktree contract.
8+
79
## CrewCoder
810

9-
CrewCoder is a first-class ACP provider implemented separately in `crewcoder-bridge.ts`; CrewCode is the client and spawns `crewcoder acp --approval review`. Keep Hermes untouched. CrewCoder is native-resume, discovers `provider:model` choices through `session/new`, maps namespaced usage `lastInputTokens` to live context occupancy, reports authoritative background compaction lifecycle through `_crewcoder/compaction_update` (never duplicate it with usage-drop inference), clears stale context occupancy on successful compaction until the next measured usage while retaining the full CrewCode transcript as display history, and uses once-only permission choices so remembered agent decisions cannot bypass later composer-mode changes. Its prompt watchdog measures ACP inactivity, not total turn duration, and pauses while Build permission is awaiting user input; a genuine timeout must send `session/cancel` before CrewCode ends the turn so another prompt cannot overlap live CrewCoder work. CrewCoder ACP must respect CrewCoder's persisted `autoCompact` setting; CrewCode must not force compaction or retry context-window failures for CrewCoder, Pi, or other providers. ACP `Internal error` responses can carry the actionable CrewCoder failure in `error.data.message`, which the bridge must prefer over the generic envelope text. Local ACP file reads currently use saved disk bytes while SSH reads/writes route through SFTP; do not claim dirty editor-buffer support until a renderer-host route exists. Session-scoped `externalDirectories` are synchronized after ACP new/load through `session/set_external_directories`, including `[]` to revoke stale native-session grants; changing them must restart the bridge. CrewCoder validates and persists the roots, while CrewCode's picker remains unavailable for SSH roots. It is deliberately excluded from disposable editor completion. See `docs/crewcoder-provider.md`.
11+
CrewCoder is a first-class ACP provider implemented separately in `crewcoder-bridge.ts`; CrewCode is the client and spawns `crewcoder acp --approval review`. Keep Hermes untouched. CrewCoder is native-resume, discovers `provider:model` choices through `session/new`, maps namespaced usage `lastInputTokens` to live context occupancy, reports authoritative background compaction lifecycle through `_crewcoder/compaction_update` (never duplicate it with usage-drop inference), clears stale context occupancy on successful compaction until the next measured usage while retaining the full CrewCode transcript as display history, and uses once-only permission choices so remembered agent decisions cannot bypass later composer-mode changes. Its prompt watchdog measures ACP inactivity, not total turn duration, and pauses while Build permission is awaiting user input; a genuine timeout must send `session/cancel` before CrewCode ends the turn so another prompt cannot overlap live CrewCoder work. A closed CrewCoder ACP child is removed from the bridge registry so the next composer submission follows the existing missing-bridge restart path instead of writing to dead stdin and reporting `process not writable`. CrewCoder ACP must respect CrewCoder's persisted `autoCompact` setting; CrewCode must not force compaction or retry context-window failures for CrewCoder, Pi, or other providers. ACP `Internal error` responses can carry the actionable CrewCoder failure in `error.data.message`, which the bridge must prefer over the generic envelope text. Local ACP file reads currently use saved disk bytes while SSH reads/writes route through SFTP; do not claim dirty editor-buffer support until a renderer-host route exists. Session-scoped `externalDirectories` are synchronized after ACP new/load through `session/set_external_directories`, including `[]` to revoke stale native-session grants; changing them must restart the bridge. CrewCoder validates and persists the roots, while CrewCode's picker remains unavailable for SSH roots. It is deliberately excluded from disposable editor completion. See `docs/crewcoder-provider.md`.
1012

1113
## ACP Grok Build
1214

@@ -38,7 +40,7 @@ Chat archiving (`Session.archived`) is non-destructive: archiving releases the s
3840

3941
## Hide work Logs
4042

41-
Settings include `hideVerboseAgentLogs`, which filters thinking/toolcall/worklog rows at the shared `Messages` renderer. Keep final agent replies, user messages, and important system/status meters visible; do not delete verbose messages from storage just because they are hidden in the UI.
43+
Settings include `hideVerboseAgentLogs`, which filters thinking/toolcall/worklog rows at the shared `Messages` renderer. Keep final agent replies, user messages, and important system/status meters visible; do not delete verbose messages from storage just because they are hidden in the UI. Work logs and thinking traces use the utilities-only Tailwind renderer integration while retaining their real message/tool mapping, expansion behavior, diagnostics, diffs, and file actions. During execution, tool runs remain visible in stream order; once a later agent response exists, all earlier tool calls in that turn consolidate into one initially expanded work log directly before the latest response. Keep layouts bounded on mobile and do not replace real data with template/demo content. See `docs/tailwind-renderer.md`.
4244

4345
## Realtime Voice Orb
4446

@@ -54,7 +56,7 @@ Completed-turn desktop notifications use the persisted `notificationSound` setti
5456

5557
## Agent Messages
5658

57-
Completed agent-message Markdown fenced code uses the shared safe Shiki `CodeBlock`; streaming text and inline code remain lightweight. Shiki and semantic Markdown accents (headings, list markers, emphasis, links, inline code) must use `--syntax-*` CSS-variable references derived from canonical theme tokens in `colors_and_type.css`, never a fixed bundled palette, so live theme changes recolor existing messages without re-tokenization. Keep body/list text readable, the 80,000-character fallback, and React-node rendering (no `innerHTML`). See `docs/agent-message-markdown.md`.
59+
Streaming answer presentation may use Tailwind utilities, but must remain one lightweight text node while live; do not reintroduce per-word animation or template citations/follow-ups that are not backed by real message data. Completed agent-message Markdown fenced code uses the shared safe Shiki `CodeBlock`; streaming text and inline code remain lightweight. Shiki and semantic Markdown accents (headings, list markers, emphasis, links, inline code) must use `--syntax-*` CSS-variable references derived from canonical theme tokens in `colors_and_type.css`, never a fixed bundled palette, so live theme changes recolor existing messages without re-tokenization. Keep body/list text readable, the 80,000-character fallback, and React-node rendering (no `innerHTML`). See `docs/agent-message-markdown.md`.
5860

5961
## Agent Task Activity
6062

@@ -88,6 +90,8 @@ Provider switching mid-chat is context handoff, not true provider state migratio
8890

8991
Manual `/compact` uses the same disposable-summary pattern: generate an AI summary from a bounded transcript in a temporary session, show the summary in chat, replace CrewCode's local replay history with that summary, clear the provider-native resume id, and start fresh on the next prompt.
9092

93+
Manual context handoff is available from the Solo Chat header and `/handoff`. Its card targets either a new chat (with provider/model/effort selection) or a used chat (retaining that chat's existing provider/model/effort). The destination immediately shows the handoff meter; a disposable destination-provider session summarizes the source, the packet is appended to destination local replay history, and the destination native resume id is cleared before continuation. Remote browser handoff refuses explicitly until Brain owns an equivalent cross-thread conversation store. See `docs/provider-context-handoff.md`.
94+
9195
## Chat
9296

9397
Visible chat transcripts persist in two layers (`src/renderer/src/stores/chat-messages-store.ts` + `src/main/transcript-store.ts`). **L2 — disk** is authoritative and unbounded: one file per scope under `userData/transcripts/transcript.<scope-digest>.json` holding the full rich `Message[]`, written back on the same settle/debounce cadence and via a synchronous IPC batch (`transcripts:saveSyncBatch`) on window teardown. **L1 — `crewcode:messagesByTab` localStorage** is a bounded, synchronous cache for instant paint on launch; it caps each scope's tail and, on `QuotaExceededError`, evicts the least-recently-touched scopes so the newest conversation always wins. On launch the store hydrates from L2, backfilling anything L1 evicted. Do NOT treat localStorage as the source of truth or let `persist()` swallow quota errors silently — that was the original "recent messages vanish on restart" data-loss bug. Growing turns stay memory-only: do not serialize L1 or structured-clone L2 for live thinking/agent/tool rows, because those synchronous renderer costs caused the workspace-wide hitch on structural stream events. A settled scope schedules both layers at bounded idle; pagehide/beforeunload/hidden visibility synchronously flushes even live scopes, which is the durability guarantee. User messages are settled and therefore persist before normal agent work, while a crash may lose only the partial in-progress response. Main's `transcripts:save` is a last-wins async queue (`fsp.writeFile`), never a sync write on the IPC handler; the teardown sync batch drops queued payloads for scopes it writes so a stale async write can't clobber it. Transcript mtimes are cached in main after the launch scan and updated on writes/removes—never re-read and JSON-parse every shard per `transcripts:mtimes` request (that blocked Browser main for 1.2–1.3s on Mission Control tool-state refreshes). Explicit session deletion must also call `transcripts:remove`; the reconciliation prune must NOT delete disk files.

‎docs/provider-context-handoff.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Provider context handoff
2+
3+
CrewCode exposes context handoff from the Solo Chat header and through `/handoff`.
4+
5+
The handoff card separates destinations into **New chat** and **Used chats** tabs. Opening **Used chats** loads the other chat sessions in the current workspace. New destinations allow provider, model, and reasoning effort selection. Existing destinations keep their already-selected provider, model, effort, and visible transcript.
6+
7+
A handoff is not provider-native session migration. CrewCode starts a disposable session using the destination provider, generates a bounded summary of the source conversation, and appends that packet to the destination's local replay history. The destination provider's native resume id is cleared so its next prompt starts fresh and receives both its prior local history and the imported handoff packet. The destination transcript displays a progress meter and the generated handoff summary.
8+
9+
If summarization fails, the destination meter is marked failed and CrewCode does not report success. Remote browser/Brain handoff currently refuses explicitly because that runtime does not own the desktop conversation store; `/compact` and normal prompting remain unchanged there.

‎docs/security-model.md‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,18 @@ per-peer limiter. Enrollment creates an Ed25519 identity on the brain and a sepa
7474
the Hub stores the public key and only SHA-256 of the bearer secret. Heartbeats are
7575
outbound HTTPS requests. Presence goes offline after 90 seconds without a successful
7676
heartbeat, and owner revocation immediately makes the bearer credential fail closed.
77-
Browser mutations retain exact-origin and CSRF enforcement.
77+
Browser mutations retain exact-origin and CSRF enforcement. The explicitly labeled
78+
first-owner QR carries the same short-lived, single-use bootstrap fragment already
79+
printed to the trusted terminal; it expires in ten minutes and is removed after
80+
registration. Normal mobile QR codes encode only the stable validated HTTPS Hub
81+
origin and are rendered in the authenticated dashboard; they contain no browser
82+
session, enrollment secret, or Brain ticket. Phone-approved enrollment keeps its
83+
Ed25519 private key on the PC, uses the short code only for human comparison, and
84+
protects polling/credential delivery with a separate 256-bit request secret. Pending
85+
requests are memory-only, bounded, rate-limited, ten-minute, owner-approved with
86+
CSRF, one-time on delivery, and audited.
87+
Tailscale setup refuses to overwrite an existing Serve configuration without an
88+
explicit replacement flag. QR transfer does not weaken normal passkey sign-in.
7889

7990
**Connection and execution gates:** only an authenticated Hub browser session plus
8091
CSRF can issue a 60-second memory-only ticket for one owned, active, relay-connected
@@ -87,11 +98,14 @@ handshake transcript with its enrolled Ed25519 key, and ordered application fram
8798
use direction-separated HKDF/AES-256-GCM keys. The Hub sees routing metadata and
8899
handshake public values, but not RPC, source, terminal, prompt, or response plaintext.
89100

90-
Hub identity still does not grant execution. `crewcode brain` grants no RPC scope by
91-
default and requires explicit local `--workspace-root` plus repeatable
92-
`--allow-scope` settings. Each decrypted method is classified at the Brain and must
93-
be included in both the ticket request and local grant. The reused backend then
94-
revalidates registered workspace roots for filesystem, Git, PTY, and agent calls.
101+
Hub identity still does not grant execution. The first `crewcode brain` start grants
102+
no RPC scope by default and seeds an owner-only persisted policy from explicit local
103+
`--workspace-root` and repeatable `--allow-scope` settings. Thereafter Settings →
104+
Brain Access manages it only through E2EE owner RPC. Reductions apply immediately,
105+
stop affected agents/terminals, and remove scopes from existing sessions; additions
106+
require a fresh ticket and handshake. Each decrypted method must be included in both
107+
the ticket request and current local grant. The backend revalidates live workspace
108+
roots for filesystem, Git, PTY, attachments, and agent calls.
95109

96110
**Tests:** `hub-server.test.ts` covers CSRF, issue/enroll, replay rejection, stale
97111
presence, heartbeat, and revocation. `hub-machine-enrollment.test.ts` covers URL

‎docs/tailwind-renderer.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Tailwind renderer compatibility
2+
3+
CrewCode's renderer supports Tailwind CSS v4 utilities through `@tailwindcss/vite`.
4+
5+
## Integration
6+
7+
- `electron.vite.config.ts` registers Tailwind only for the renderer build.
8+
- `src/renderer/src/styles/tailwind.css` imports Tailwind's theme and utility layers.
9+
- Tailwind Preflight is intentionally not imported. The existing application reset and component CSS remain authoritative, preventing an incremental Tailwind conversion from changing unrelated Electron and browser surfaces.
10+
- Semantic Tailwind colors (`cc-canvas`, `cc-surface`, `cc-field`, `cc-hover`, `cc-ink`, `cc-muted`, `cc-line`, `cc-accent`, `cc-success`, and `cc-danger`) resolve to CrewCode's live CSS design tokens. They therefore continue to follow theme customization.
11+
12+
## Usage rules
13+
14+
Use Tailwind utilities for new or converted renderer component layout and responsive behavior. Do not hardcode a second palette or bypass the tokens in `colors_and_type.css`. Technical values and tool output remain in the configured mono font.
15+
16+
Legacy root class names may remain when tests or integrations use them as stable row identities. In that case, keep compatibility selectors narrow and implement the component's internal layout with utilities.
17+
18+
The work-log, thinking trace, and streaming-answer surfaces are the first converted components. Their existing data mapping, file-open actions, diagnostics, syntax highlighting, and diff rendering remain unchanged. Tool runs stay in stream order while live; when the turn has a later agent response, its earlier tool calls consolidate into one initially expanded work log directly before the latest response. Responsive rules constrain long paths/output at narrow widths, and reduced-motion preferences collapse decorative transitions.

0 commit comments

Comments
 (0)