Skip to content

[twarp 07b] Claude Code panel: resurrect view + event model#67

Open
timomak wants to merge 2 commits into
masterfrom
twarp-07b-panel
Open

[twarp 07b] Claude Code panel: resurrect view + event model#67
timomak wants to merge 2 commits into
masterfrom
twarp-07b-panel

Conversation

@timomak
Copy link
Copy Markdown
Owner

@timomak timomak commented May 27, 2026

twarp 07b — Claude Code panel: resurrect view + event model

First implementation sub-phase of feature 07 (roadmap/07-claude-code-panel/). Specs (PRODUCT.md + TECH.md) merged in #66.

Framing: feature 02 removed Warp's AI service (accounts, LLM clients, billing, cloud storage). Feature 07 brings back only the rendering layer, driven by the local claude CLI the user already runs. 7b is the scaffold — the panel registers, opens, and renders its zero/unavailable states. It spawns no claude process; the live session is 7c. No LLM client, billing, or cloud sync comes back.

What's in this PR

  • crates/claude_code (new, headless): the contract both halves of the feature meet at — the thin twarp-native TranscriptEvent the 7c driver will emit and the Transcript / TranscriptItem model the panel renders. Transcript::apply (delta accumulation, in-place TodoWrite updates, tool-result matching, verbatim error surfacing) is unit-tested (6 tests) with no GPUI, per TECH §Parallelization. The subprocess + stream-json parser land in 7c.
  • app/src/claude_code_panel/ (new): a child View (the Warp Drive pattern, so 7c–7h have a home). Renders the zero state (explanation + message input + "Start session", PRODUCT §5) or, when claude is not on PATH, the unavailable state (PRODUCT §6, re-checked each render). The input is a styled, non-editable placeholder in 7b; real editing is 7c/7g.
  • Registration: ToolPanelView::ClaudeCode + LeftPanelDisplayedTab::ClaudeCode (both From directions), toolbelt button (Agent Mode icon), focus/render arms, and a compute_left_panel_views push gated on the new FeatureFlag::ClaudeCodePanel.
  • Feature flag (dogfood-only): FeatureFlag::ClaudeCodePanel in DOGFOOD_FLAGS + cargo feature claude_code_panel, intentionally absent from default so it stays hidden in stable.
  • Keybinding ⌘⌥K (Ctrl+Alt+K): WorkspaceAction::ToggleClaudeCodePanel + CustomAction::ToggleClaudeCodePanel. The default chord is registered in custom_tag_to_keystroke, not EditableBinding::with_key_binding — the feature-06 lesson (it would clobber Trigger::Custom and panic the mac menu). The binding stays an EditableBinding, so it remains remappable. Conflict check: cmd-alt-k / ctrl-alt-k were unbound. Per PRODUCT §2, re-pressing the chord while the tab is active returns focus to the terminal rather than collapsing the whole left panel.

Deferred to later sub-phases (so review scopes correctly)

  • 7c: spawn claude, stream assistant text, send messages, Stop/teardown, UniformList bottom-stick auto-scroll, markdown, cwd-in-header (§8–§22, §52–§57). The transcript renderer here is a placeholder.
  • 7d–7f: rich tool cards, diff cards, thinking blocks, in-place todo list (§23–§38).
  • 7g: permission prompts + permission-mode selector + editable multi-line input (§39–§45).
  • 7h: session list + resume + the zero-state "Resume…" entry point (§46–§51).

Validation

  • cargo check and cargo clippy clean with --features claude_code_panel; rustfmt clean; claude_code unit tests pass (6/6).
  • Built warp-oss --features claude_code_panel and launched it: app reaches steady state with no startup panic (the menu-build path the feature-06 keybinding bug tripped). claude_code_panel adds no menu item, so that lookup is never invoked.
  • Full ./script/presubmit is not runnable on this machine (clang-format / wgslfmt / nextest gaps); the checks above are the runnable subset.

Smoke test (reviewer)

Run the 7b section of the Smoke test in roadmap/07-claude-code-panel/PRODUCT.md against a dogfood build (./script/run of the local warp bin, or --features claude_code_panel): toolbelt entry shows ("Claude Code"); ⌘⌥K toggles (opens+focuses when inactive, returns focus when active) and is rebindable; left-panel width persists across restart; zero state shows with no claude subprocess spawned; renaming/hiding claude on PATH shows the unavailable state.

🤖 Generated with Claude Code

timomak and others added 2 commits May 27, 2026 13:42
7b scaffolds feature 07's Claude Code left-panel. It registers as a
left-panel tab, opens, and renders its zero state (PRODUCT §5) or, when
`claude` is not on PATH, its unavailable state (PRODUCT §6) — but it
spawns no `claude` process: merely showing the panel starts no subprocess
(PRODUCT §7). The live session, streaming, cards, permissions, and session
list are 7c–7h.

New headless crate `crates/claude_code` defines the contract both halves
of the feature meet at (TECH §Parallelization): the thin twarp-native
`TranscriptEvent` the 7c driver will emit and the `Transcript` /
`TranscriptItem` model the panel renders. `Transcript::apply` — delta
accumulation, in-place TodoWrite updates, tool-result matching, verbatim
error surfacing — is unit-tested (6 tests) with no GPUI, so the event→model
mapping is verifiable before any live `claude` exists.

The panel (`app/src/claude_code_panel/`) is a proper child View (the Warp
Drive pattern) so 7c–7h have a home to grow into. It re-checks `claude` on
PATH at render time (PRODUCT §6). The message input is a styled,
non-editable placeholder in 7b; real editing + Enter-to-send is 7c (§8) and
7g (§43).

Registration: `ToolPanelView::ClaudeCode` + `LeftPanelDisplayedTab::ClaudeCode`
(both From directions), a toolbelt button (Agent Mode icon), focus/render
arms, and a `compute_left_panel_views` push gated on the new
`FeatureFlag::ClaudeCodePanel`. The flag is dogfood-only: DOGFOOD_FLAGS +
cargo feature `claude_code_panel`, intentionally absent from `default`, so
it stays hidden in stable.

Keybinding: ⌘⌥K (Ctrl+Alt+K) toggles the panel via
`WorkspaceAction::ToggleClaudeCodePanel` + `CustomAction::ToggleClaudeCodePanel`.
Per the feature-06 lesson, the default chord is registered in
`custom_tag_to_keystroke`, NOT `EditableBinding::with_key_binding` (which
would clobber `Trigger::Custom` and panic the mac menu builder); the binding
stays an `EditableBinding` so it remains remappable, and is flag-gated via
`.with_enabled`. Conflict check: `cmd-alt-k` / `ctrl-alt-k` were unbound.
Per PRODUCT §2, re-pressing the chord while the tab is active returns focus
to the terminal rather than collapsing the whole left panel.

Deferred to later sub-phases (noted so review scopes correctly): live
session / streaming / Stop / UniformList auto-scroll (7c, §8–§22); rich
tool / diff / thinking / todo cards (7d–7f — the transcript renderer is a
placeholder); permission prompts + editable multi-line input (7g, §39–§45);
session list, resume, and the cwd-in-header + zero-state "Resume…" entry
point (7h / 7c, §4, §46–§51).

Validation: `cargo check` and `cargo clippy` clean with the feature;
rustfmt clean; `claude_code` unit tests pass. Full `./script/presubmit` is
not runnable on this Mac (clang-format/wgslfmt/nextest gaps).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reconcile STATUS to git (spec #66 merged) and record the 7b impl PR. Tick the 7b sub-phase, flip the feature phase to impl-in-review, and note the resolved decisions: ⌘⌥K conflict-free (cmd-alt-k/ctrl-alt-k unbound), FeatureFlag::ClaudeCodePanel dogfood-only, launch-verified no startup panic, and the 7c–7h deferrals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant