Skip to content

Polish desktop native chat view - #6641

Merged
Jinwoo-H merged 78 commits into
mainfrom
jinwoo/native-chat-polish
Jun 28, 2026
Merged

Jinwoo-H merged 78 commits into
mainfrom
jinwoo/native-chat-polish

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Gate desktop native chat behind the Experimental native chat setting, with a child toggle for opening new Claude/Codex tabs in chat view by default.
  • Polish the native chat composer, empty state, context menus, split-pane behavior, paste handling, image attachments, and dictation controls.
  • Preserve first-send optimistic messages through transcript/session transitions to avoid empty-state flashes.

Verification

  • pnpm run typecheck:web
  • pnpm run typecheck:node
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/settings/ExperimentalPane.test.tsx src/renderer/src/lib/native-chat-initial-view-mode.test.ts
  • pnpm exec vitest run src/renderer/src/components/native-chat/native-chat-pending.test.ts src/renderer/src/components/native-chat/native-chat-view-state.test.ts
  • pnpm exec vitest run src/main/menu/register-app-menu.test.ts src/main/window/createMainWindow.test.ts

Made with Orca 🐋

gsxdsm and others added 30 commits June 26, 2026 13:00
Long-press opens the tab menu as usual; agent tabs get a 'Switch to
chat/terminal view' item instead of toggling directly. Registers the
two menu strings in the localization catalog (also syncs prior
native-chat keys that were missing).
Implement the native chat view in the mobile React Native app, reaching the
agent transcript over a new windowed/paginated runtime RPC (nativeChat.*) and
sending input via terminal.send. Includes:

- Host RPC: nativeChat.readSession/subscribe/unsubscribe with tail windowing,
  per-block clipping, and a limit param for scroll-back pagination.
- Mobile chat: message list (folded tool runs, collapsible inline tools, inline
  diffs), controlled composer (slash/@ autocomplete, voice, image, white send),
  scroll controls, animated working indicator, queued messages, inverted user
  bubbles, larger prose, per-tab chat/terminal persistence.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Mobile: stream the agent's in-progress reply (agent-status preview), native
question + permission cards (heuristic parse of agent status, answered via
terminal.send), a Stop/interrupt control on the working bar, a tool-calls
expand/collapse toggle moved beside the working indicator, and tappable file
paths in agent markdown (open via files.open). Desktop: port the chat redesign
(folded collapsible tool runs, inline diffs, animated working indicator,
scroll controls, expand-all toggle) for parity.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Mobile: per-agent-message Copy (with confirm tint) and scroll-this-message-to-
top controls, and pinch-to-zoom font scaling across the chat. Desktop: Cmd/Ctrl
+/-/0 chat font-scale shortcut and a hover Copy button per assistant message.
Extract MobileMarkdown + message styles into focused files to stay within
max-lines.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The pinch onUpdate worklet touched React refs + clampFontScale on the UI
thread, crashing the app. Use Gesture.runOnJS(true) so the callbacks run on
the JS thread (drops the reanimated dependency). Also color the tool-run count
green instead of the link-like meta color.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude's AskUserQuestion records its full structured prompt (question, header,
multiSelect, options) in the transcript as a tool-call block, which already
streams to mobile. Detect the pending ask (latest AskUserQuestion call with no
following tool-result) and render it as a native selectable question card,
instead of heuristically parsing status text. Answering sends the chosen
labels to the agent.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…parser

Pipe an agent's pending AskUserQuestion as an untruncated interactivePrompt on
agent-status (the transcript isn't written until it's answered, so it can't
source a live card). Mobile parses it through an extensible per-tool registry
(registerQuestionTool) and renders the native question card; falls back to the
transcript tool-call, then the permission heuristic.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Background task-notifications, system reminders, local-command output, and
slash-command envelopes are injected into the agent conversation as user-role
turns and land in the transcript. They were rendering as the user's own
messages in the native chat — strip them (user/system turns with no tool
activity whose text leads with a harness marker).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…rols

Render each tool call with its matching result as one expandable block; the
global tools toggle now expands each line's detail (not just the group); and
the per-message copy / scroll-to-top controls sit inline with the tool run
header (or after the prose when there are no tools).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Stop now sends Escape twice (TUI agents interrupt on Escape, not Ctrl-C which
quits/clears). Tool calls that target a file (Read/Edit/Write/NotebookEdit)
render their path as a tappable link that opens the file — most file
references live in tool lines, which previously weren't tappable.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
applyAgentStatus rebuilt the hook payload with an explicit field list that
omitted interactivePrompt, so the live AskUserQuestion structure was dropped
between the main process and the renderer store — the native question card
never received it. Forward the field like the other tool/assistant fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Restyle the AskUserQuestion card to match the app (neutral surfaces, white
Send, subtle green only on the selected choice — no blue), add a free-text
"Other" field per question, and dismiss the card as soon as it's answered
(the live status lingers a beat, so hide until a different question arrives).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Capture a pending tool approval into the agent-status interactivePrompt as a
normalized { approval: { tool, summary } } envelope on PermissionRequest events
(Claude and Codex), alongside the existing AskUserQuestion question envelope.
Mobile parses it into an Allow/Deny card, preferring the heuristic permission
(which reads the real numbered options from the prompt text) and falling back
to the live envelope for reliable detection.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Parse the live question prompt on its own memo so it's referentially stable
across message ticks (a multi-question card was re-rendering on every update,
hanging the view), and remount the card on a genuinely new question. Compose
the pinch gesture Simultaneous with the list's native scroll so a two-finger
pinch is recognized instead of being swallowed by the scroll. Move Stop to the
far-right corner and the tools toggle next to the working indicator.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Render the AskUserQuestion card one question per step: tabs across the top
(tap to jump, green check when answered), a Next button that advances and
becomes Send on the last step, and a Cancel button that sends Escape to
dismiss the prompt.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Bring the desktop/web native chat to parity with mobile: parse the live
interactivePrompt envelope and render a wizard AskUserQuestion card (tabs,
Next/Send, Cancel→Escape, Other text input) and an Allow/Deny approval card
above the composer, reusing the composer's pty send path (so SSH panes work).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The card's dismissed-key persisted after answering, so a later question whose
first line matched a previously answered one stayed hidden. Reset the dismissal
once interactivePrompt clears (the agent moved on) so any subsequent question —
including an identical re-ask — renders again. Also add the deploy-android-wifi
helper + a fixed-port (5555) endpoint so reconnects don't rotate.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Render multi-select options as a square checkbox and single-select as a circle
radio so the selection mode reads clearly. Give the wizard tab row top padding
and a min height so labels and the active underline aren't clipped.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Jinwoo-H and others added 18 commits June 26, 2026 14:50
…ity)

Desktop native chat showed only a 'working' spinner while the agent generated a
reply — no content building in real time, while mobile already streamed it. Add
a synthetic streaming assistant bubble on desktop, fed by the pane's
agentStatus.lastAssistantMessage preview, shown while the agent works and the
preview leads the transcript; it's replaced cleanly once the real turn flushes.

Extract the show/hide rule into src/shared/native-chat-streaming.ts
(deriveNativeChatStreamingText + nativeChatStreamingMessage) so desktop and
mobile share ONE definition — mobile's private deriveStreaming is removed and
now calls the shared one, gated on the live working flag (so a stale preview
from a finished turn can't show).

Tests: shared derivation show/hide rule (no duplicate / no flicker).
Typechecks (web/node/mobile), lint, native-chat + render-data tests pass.

Co-authored-by: Orca <[email protected]>
… bullets

Three rendering-quality fixes from the native-chat audit:

- Mobile markdown nested lists no longer flatten: the parser now tracks each
  item's indent depth via an indent stack (tolerates 2- or 4-space conventions),
  and the renderer indents by depth, cycles bullet glyphs (-/◦/▪), and numbers
  ordered items per depth level. Previously every item rendered at one level.
- No more empty 'ghost' bubbles: a turn with no renderable content (e.g. an
  image-ref-only assistant turn on desktop, or a genuinely empty turn on mobile)
  is skipped instead of rendering an empty row. Guards sit after all hooks.
- Tool-run summary skips nameless tool calls so the ' · ' join can't produce
  orphan separators ('Tool  ·  ·').

Tests: nested-list depth (2-space/4-space/flat), orphan-bullet skip.
Typechecks (web/mobile), lint (incl. react-doctor), native-chat tests pass.

Co-authored-by: Orca <[email protected]>
In-app verification surfaced that native chat could not load Claude
conversations on Claude Code 2.1.195: the hook session_id (captured as
providerSession.id) no longer matches the transcript filename, so the resolver
glob ~/.claude/projects/*/<id>.jsonl missed it and the view showed 'Could not
load conversation' even though the agent had replied.

Capture the hook's authoritative transcript_path into providerSession and use
it to locate the file directly, falling back to the id-based glob when absent
(or when the path is stale/non-jsonl). Threaded end to end:
extractAgentProviderSession -> AgentProviderSessionMetadata.transcriptPath ->
agent-status -> pane/eligibility resolution -> read/subscribe RPC + IPC params
-> preload (electron + web) + mobile client -> session-file-resolver. id is
still used for CLI --resume.

Tests: resolver prefers transcriptPath / falls back when missing or non-jsonl;
extractAgentProviderSession captures transcript_path for claude/codex only;
normalize round-trips it; pane + mobile resolutions surface it.
Typechecks (web/node/mobile), lint, native-chat + resolver tests pass.

Co-authored-by: Orca <[email protected]>
The toggle button overlapped the pane split control and had a differentiating
card background + shadow. Make it a bare ghost icon identical to the split/close
controls (drop bg-card/shadow/backdrop) and offset it left of the split/close
cluster (right-14) so they sit beside each other without overlapping.

Co-authored-by: Orca <[email protected]>
The chat toggle was a separate floating overlay that overlapped and looked
different from the split/close pane controls. Move it INTO the pane header's
action row (TerminalPaneHeaderOverlay) as the first button, so it renders as an
identical ghost icon beside split/close — [chat][split][×] — sharing their
hover/active reveal. Gated to the tab's active pane so it isn't duplicated
across split panes. Removes the standalone NativeChatToggleButton overlay and
its now-unused plumbing in TerminalPaneOverlayLayer.

Eligibility (canToggleNativeChat) + viewMode + toggle now derive in TerminalPane
from the store and pass down to the header overlay.

Typecheck (web), lint, terminal-pane + native-chat tests pass; verified in-app
that the toggle sits beside split at identical size/position.

Co-authored-by: Orca <[email protected]>
The optimistic send echo showed a 'Queued' label + muted bubble immediately, so
a fast local turn flashed 'Queued' for a split second on its way into the
transcript. Gate the queued affordance behind a 500ms delay (useDelayedFlag):
the message bubble still renders instantly, but the 'Queued' label/muting only
appears if the send stays pending past the delay (slow/remote agent). Applied to
both desktop (NativeChatMessageList) and mobile (MobileNativeChatMessage).

Verified in-app: sending a message no longer flashes 'Queued' (sampled 12 frames
over 1.5s, label never appeared).

Co-authored-by: Orca <[email protected]>
… flicker)

The optimistic echo flickered normal -> 'Queued'/muted -> normal as the real
transcript turn caught up (the prior delayed-affordance attempt made it worse by
guaranteeing a flash at the delay mark). Drop the 'Queued' label + muting
entirely: the echo now renders identically to a real user turn, so when the real
turn lands and replaces it there is no visible state change. Removes the
now-dead pendingMessageIds/isPending/useDelayedFlag plumbing on desktop and the
queued tag/style on mobile (the copy-controls gate on `queued` stays).

Verified in-app: sending shows no 'Queued' label and no muted frame across 1.5s
of sampling.

Co-authored-by: Orca <[email protected]>
Slash commands (/clear, /compact, /model, …) dispatch to the agent's TUI but
left no trace in native chat — it looked like nothing happened. Surface a small
muted 'Ran <cmd>' system line as local feedback instead of a user bubble (slash
commands aren't chat turns). Wired from both composer dispatch paths (typed
Enter via send + autocomplete-menu Enter/Tab via dispatchSlash). Markers are
local-only, capped at the last 8, and reset per conversation; the 'Ran ' text
isn't a harness-noise prefix so stripNoiseMessages keeps it.

Tests: commandMarkersAsMessages shape + survives stripNoiseMessages.
Typecheck (web) + lint + native-chat tests pass; verified in-app that '/status'
renders a 'Ran /status' line.

Co-authored-by: Orca <[email protected]>
…lish

# Conflicts:
#	src/renderer/src/components/terminal-pane/TerminalContextMenu.tsx
#	src/renderer/src/components/terminal-pane/TerminalPane.tsx
@Jinwoo-H
Jinwoo-H marked this pull request as ready for review June 28, 2026 21:43
Jinwoo-H and others added 3 commits June 28, 2026 17:45
…lish

# Conflicts:
#	src/renderer/src/lib/worktree-activation.test.ts
#	src/renderer/src/lib/worktree-activation.ts
…lish

# Conflicts:
#	src/renderer/src/lib/worktree-activation.ts
@Jinwoo-H
Jinwoo-H merged commit b916248 into main Jun 28, 2026
6 checks passed
@Jinwoo-H
Jinwoo-H deleted the jinwoo/native-chat-polish branch June 28, 2026 22:43
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Orca <[email protected]>
Co-authored-by: gsxdsm <[email protected]>
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