Skip to content

feat: direct acpmux React agent pane - #18068

Closed
azooz2003-bit wants to merge 40 commits into
feat/acpmux-ts-pane-basefrom
feat/acpmux-ts-pane-direct
Closed

azooz2003-bit wants to merge 40 commits into
feat/acpmux-ts-pane-basefrom
feat/acpmux-ts-pane-direct

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

This PR carries the React TypeScript agent pane over a direct authenticated acpmux WebSocket client. Swift hosts WKWebView and provides the endpoint, token, and initial session. React attaches, folds the versioned event stream, pages history, handles permissions and queue state, and sends ACP actions directly. Native remains the default renderer.

The renderer uses Pretext-style measurement, memoized row versions, typed-array geometry, binary-search virtualization, scroll anchoring, registry-based React row components, and hot-reloaded theme, layout, and user renderers. The standalone preview includes Claude and Codex recordings, real-speed streaming replay, seeded 5,000-row transcripts, permission and queue fixtures, theme controls, width controls, and fling timing.

Base and recovery

This PR uses the owned base branch feat/acpmux-ts-pane-base, which contains the pre-React acpmux pane snapshot. It does not use or update Lawrence's branches.

The earlier PR #16042 was opened against the wrong stacked base and auto-merged into that parent. This replacement PR is the direct-to-acpmux implementation on an owned base so it can be reviewed and merged independently.

The projections RFC is https://github.com/manaflow-ai/cmuxterm-hq#1051: acpmux owns sessions and event history, Swift hosts, and React and native are both clients.

Preview

cd webviews
bun run preview:dev
bun run preview:build

Static output: webviews/dist/acpmux-agent-session-preview/.

Validation

  • bun test src/agent-session/acpmux/model.test.ts src/agent-session/acpmux/direct.test.ts (8 passed)
  • bun x tsgo --noEmit
  • ./scripts/build-agent-session-web.sh
  • ./scripts/build-webviews-app.sh --check
  • Swift package tests require macOS CI because this Linux host cannot import the package's existing Darwin dependency.
  • Lawrence's native seeded-row fling reference is p50 and p95 8.33 ms at 120 Hz. Comparable TypeScript numbers still require macOS or fleet measurement.

Changelog

Added: React TypeScript agent pane over a direct authenticated acpmux event stream, with a standalone preview harness.


Summary by cubic

Adds a React TypeScript agent session pane that renders a direct authenticated acpmux WebSocket stream. Swift stays the WKWebView host and passes the authenticated loopback endpoint, per-launch token, and selected session through a new versioned bridge; React pages the event stream, merges in-flight events with paged history, creates sessions, merges daemon model, mode, and config catalogs, handles prompt acknowledgements and permission and queue state, sends ACP actions, and routes native-only actions (copy, open URL, open file, focus) back through the host bridge.

Lifecycle hardening ignores stale attach replies, session selections, and history pages, persists new sessions before prompting, settles optimistic sends, preserves tool update metadata, computes turn durations, pairs turn summaries without duplicate rows across daemon versions, preserves turn boundaries and duplicate queued prompts with their session defaults, retains implicit turn rows during history replay, keeps fallback transcript events visible during reconnects, and keeps non-edit tool activity visible alongside edited-file details. Every session change reopens the transcript at its latest turn, and the composer stays ready across live snapshots. The transcript uses Pretext measurement aligned with the rendered markdown blocks, coalesces streaming thoughts, binary-search virtualization, memoized rows, cached prepared markdown blocks, code copying, and LCS-based edited-file diff counts. Native rendering remains the default.

Renderer selection

  • New app.agentSession.renderer config selects native (default) or TypeScript for new agent session panes; the catalog key placement mirrors the schema nesting so validation stays consistent.
  • The session picker refreshes whenever the daemon session list changes, even if the selected session is unchanged, and new agent panes created from command-line tokens now resolve to the configured renderer instead of hardcoding React.

Preview

  • Standalone preview at webviews/src/agent-session/acpmux-preview replays recorded Claude and Codex streams with seeded 5,000-row transcripts, permission and queue fixtures, and theme and width controls.

Written for commit 00937c1. Summary will update on new commits.

Review in cubic


Migrated from #16203 after correcting the PR author identity. The original branch and commit history are preserved.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

teamleaderleo and others added 30 commits September 30, 2026 13:22
Add the versioned Swift bridge, React transcript renderer, Pretext layout model, customization registry, and standalone preview harness. Keep native rendering as the default.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Move transcript projection and ACP actions into the React client. Keep Swift as the WKWebView host and pass an authenticated loopback endpoint through the versioned handshake.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Handle permission envelopes, settle optimistic prompts, and reset streaming rows between turns. Install the webview lockfile before bundling Pretext resources in CI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merge in-flight events with attach pages, reconcile legacy prompt echoes, and mark rejected sends failed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Emit snapshots for session-list changes even when the selected session is unchanged, so the picker stays current for sessions created or purged elsewhere.\n\nCo-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Handle prompt acknowledgements, preserve tool update metadata, compute turn durations, and reset session-local reducer state. Restore the compiled Tailwind asset pipeline and align markdown measurement with the rendered blocks.\n\nCo-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pair turn_end and turn_result summaries without duplicate rows, preserve duration and state across session resets, and account for code block padding in precomputed geometry. Keep fallback transcript events visible during reconnects.\n\nCo-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merge daemon model catalogs, expose new-session creation, and show edited-file diff counts. Add code copying and keep the generated web assets aligned with the React renderer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ignore stale history responses after session changes and keep non-edit tool activity visible alongside edited-file details.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Use an LCS line diff for ACP edit blocks so replacement changes report both additions and deletions accurately.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reuse a pending turn-end summary when a later turn result supplies the turn id, avoiding duplicate transcript cards across daemon versions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Keep the shell, scroller, spacer, thread, row, composer, and markdown geometry rules in the source and generated WebKit assets.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reset virtual transcript anchors when the selected session changes so each session opens at its newest content.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Use the app section prefix required by the settings catalog so CmuxSettings validation and generated config schema stay consistent.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Move agentSession.renderer under app in the public and embedded cmux.json schemas so the catalog key and schema validation agree.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
teamleaderleo and others added 10 commits September 30, 2026 16:15
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​marked@​17.0.51001001009880
Addednpm/​@​chenglou/​pretext@​0.0.91001009990100

View full report

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.

2 participants