Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(onboarding): add a ⌘M chat-view step to the setup tour

reviewad0e1db8fe6e
diff --git a/src/renderer/components/onboarding/OnboardingFlow.tsx b/src/renderer/components/onboarding/OnboardingFlow.tsx
index 797c66904..12ebe18c6 100644
--- a/src/renderer/components/onboarding/OnboardingFlow.tsx
+++ b/src/renderer/components/onboarding/OnboardingFlow.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
import { DEFAULT_SETTINGS, type SpeechModelInfo } from '@shared/types'
-import { AGENT_CONFIG, BUILTIN_AGENT_IDS, type BuiltinAgentId } from '@shared/agents/config'
+import { AGENT_CONFIG, BUILTIN_AGENT_IDS, CHAT_CAPABLE, type BuiltinAgentId } from '@shared/agents/config'
import { isHoldChord, matchesShortcut, shortcutKeyParts } from '@shared/shortcut'
import { hasSpeechModel, SPEECH_MODEL_NONE } from '@shared/speech'
import { keyLabel } from '@shared/platform-utils'
@@ -21,6 +21,7 @@ import {
OnbCheck,
OnbGhostCanvas,
SceneAgents,
+ SceneChatView,
SceneDictation,
SceneKanban,
SceneKeepAwake,
@@ -53,6 +54,7 @@ const STEPS = [
'agents',
'dictation',
'kanban',
+ 'chatview',
'notify',
'keepawake',
...(isMac ? (['notch'] as const) : []),
@@ -63,8 +65,8 @@ type StepId = (typeof STEPS)[number]
const STEP_COUNT = STEPS.length
/**
- * First-run setup tour: welcome → agents → dictation → kanban → notifications → keep-awake →
- * (notch) → shortcuts → phone. Each step pairs an animated scene with ONE decision, and every
+ * First-run setup tour: welcome → agents → dictation → kanban → chat view → notifications →
+ * keep-awake → (notch) → shortcuts → phone. Each step pairs an animated scene with ONE decision, and every
* choice writes settings immediately (there is no final "save" — closing mid-way keeps what was
* chosen so far). Replaces both the auto-opened ShortcutsPanel and the standalone
* notification-consent dialog on first launch — which is why it owes the user its own
@@ -167,6 +169,36 @@ export function OnboardingFlow({ onClose }: { onClose: () => void }) {
return () => window.removeEventListener('keydown', onKey, true)
}, [step])
+ // ---- chat-view try-it: the ⌘M chord is DIFFERENT from the kanban one — on desktop main steals
+ // it in `before-input-event` (else macOS minimizes) and forwards `app:toggle-markdown`, so the
+ // page never sees a keydown; the subscription is how it arrives. The keydown listener is for
+ // the Server Edition, where the browser owns the key and the chord reaches the page (Ctrl+M on
+ // Linux/Windows; the bridge's subscription is a no-op there). Either lights the checkmark.
+ // Nothing under the tour reacts: TerminalNode's own ⌘M subscriber is gated on hover, and the
+ // tour overlay covers every node. ----
+ const [chatTried, setChatTried] = useState(false)
+ const [chatPulse, setChatPulse] = useState(0)
+ useEffect(() => {
+ if (STEPS[step] !== 'chatview') return
+ const hit = () => {
+ setChatTried(true)
+ setChatPulse((n) => n + 1)
+ }
+ const unsub = window.nodeTerminal.onMarkdownToggle(hit)
+ const onKey = (e: KeyboardEvent) => {
+ if (effectiveBindings('node.toggleMarkdown').some((s) => matchesShortcut(e, s, isMac))) {
+ e.preventDefault()
+ e.stopPropagation()
+ hit()
+ }
+ }
+ window.addEventListener('keydown', onKey, true)
+ return () => {
+ unsub()
+ window.removeEventListener('keydown', onKey, true)
+ }
+ }, [step])
+
// Esc skips the tour (settings chosen so far are already saved).
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
@@ -208,6 +240,14 @@ export function OnboardingFlow({ onClose }: { onClose: () => void }) {
// are live. `''` / `[]` mean the command is unbound — each site below says what it does then.
const newAgentChip = chipFor('node.newAgent')
const kanbanKeys = commandKeys('view.kanbanToggle')
+ const chatKeys = commandKeys('node.toggleMarkdown')
+ // The chat view is a CAPABILITY (`CHAT_CAPABLE`), not a hardcoded agent: the scene and the copy
+ // name whichever agents carry it (Claude Code today), and the scene is drawn with the FIRST
+ // one's identity rather than the default agent — a Codex default would otherwise show a chat
+ // face on a node that has none.
+ const chatAgentId: BuiltinAgentId = CHAT_CAPABLE[0]
+ const chatAgent = AGENT_CONFIG[chatAgentId]
+ const chatAgentsLabel = CHAT_CAPABLE.map((id) => AGENT_CONFIG[id].label).join(', ')
const paletteKeys = commandKeys('app.commandPalette')
const panelKeys = commandKeys('app.shortcutsPanel')
// The handful worth learning on day one, each with its EFFECTIVE chord. A command the user
@@ -280,6 +320,15 @@ export function OnboardingFlow({ onClose }: { onClose: () => void }) {
{stepId === 'agents' && <SceneAgents agentId={agentId} label={agent.label} color={agent.color} />}
{stepId === 'dictation' && <SceneDictation keys={dictKeys.map((k) => keyLabel(k, isMac))} hold={dictHold} />}
{stepId === 'kanban' && <SceneKanban pulseKey={kanbanPulse} />}
+ {stepId === 'chatview' && (
+ <SceneChatView
+ agentId={chatAgentId}
+ label={chatAgent.label}
+ color={chatAgent.color}
+ keys={chatKeys}
+ pulseKey={chatPulse}
+ />
+ )}
{stepId === 'notify' && <SceneNotify />}
{stepId === 'keepawake' && (
<SceneKeepAwake agentId={agentId} label={agent.label} color={agent.color} />
@@ -434,6 +483,56 @@ export function OnboardingFlow({ onClose }: { onClose: () => void }) {
</>
)}
+ {stepId === 'chatview' && (
+ <>
+ <h2>Read an agent like a chat</h2>
+ <p>
+ Hover a <strong>{chatAgentsLabel}</strong> node and{' '}
+ {chatKeys.length > 0 ? (
+ <>
+ press{' '}
+ {chatKeys.map((k, i) => (
+ <kbd key={i} className="kbd">
+ {k}
+ </kbd>
+ ))}
+ </>
+ ) : (
+ <>pick <strong>Markdown view</strong> from its right-click menu</>
+ )}
+ : the terminal flips into a chat view of the <em>same</em> session — your
+ prompts and its replies as a thread, with a composer at the bottom that types
+ straight into the running agent. Approve a plan or answer a question from
+ there, too.
+ </p>
+ {/* Same contract as the kanban try-it: no chord to press when the user unbound
+ it, so the prompt is dropped (kept while `chatTried` so an unbind mid-tour
+ doesn't retract an earned checkmark). */}
+ {(chatKeys.length > 0 || chatTried) && (
+ <div className={`onb-tryit ${chatTried ? 'is-done' : ''}`}>
+ {chatTried ? (
+ <>
+ <OnbCheck /> That's the toggle — press it again to get the terminal back.
+ </>
+ ) : (
+ <>
+ Try it now — press{' '}
+ {chatKeys.map((k, i) => (
+ <kbd key={i} className="kbd">
+ {k}
+ </kbd>
+ ))}
+ </>
+ )}
+ </div>
+ )}
+ <div className="onb-fineprint">
+ Same key, same view switch, on a plain terminal: it renders the output as
+ markdown instead. Press it again to return.
+ </div>
+ </>
+ )}
+
{stepId === 'notify' && (
<>
<h2>Know when an agent needs you</h2>
diff --git a/src/renderer/components/onboarding/scenes.chatview.test.tsx b/src/renderer/components/onboarding/scenes.chatview.test.tsx
new file mode 100644
index 000000000..51e651bda
--- /dev/null
+++ b/src/renderer/components/onboarding/scenes.chatview.test.tsx
@@ -0,0 +1,80 @@
+// @vitest-environment jsdom
+import { act } from 'react'
+import { createRoot, type Root } from 'react-dom/client'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { SceneChatView } from './scenes'
+
+;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
+
+// AgentMascot / AgentIcon pull brand SVGs; the scene only needs them to render something.
+vi.mock('../../lib/agentIcons', () => ({ AgentIcon: () => <span data-icon /> }))
+
+/**
+ * The ⌘M onboarding scene. Two contracts: (1) it draws BOTH faces of the same node (terminal
+ * + chat thread) so the crossfade has something to fade between, and (2) the user's real
+ * keystroke (`pulseKey`) flips the face — the animation answers the try-it, as kanban's does.
+ */
+describe('SceneChatView', () => {
+ let root: Root
+ let host: HTMLElement
+
+ beforeEach(() => {
+ vi.useFakeTimers()
+ // jsdom has no matchMedia; the scene reads it once to honour reduced motion.
+ window.matchMedia = ((q: string) => ({ matches: false, media: q })) as unknown as typeof window.matchMedia
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+ })
+
+ afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ vi.useRealTimers()
+ })
+
+ const render = async (pulseKey?: number): Promise<void> => {
+ await act(async () =>
+ root.render(
+ <SceneChatView agentId="claude" label="Claude Code" color="#d97757" keys={['⌘', 'M']} pulseKey={pulseKey} />
+ )
+ )
+ }
+
+ it('draws the chord, the node, and both faces of it', async () => {
+ await render(0)
+ expect(host.querySelectorAll('.onb-cview__key').length).toBe(2)
+ expect(host.querySelector('.onb-node__title')?.textContent).toBe('Claude Code')
+ expect(host.querySelector('.onb-cview__term')).not.toBeNull()
+ expect(host.querySelector('.onb-cview__chat')).not.toBeNull()
+ // starts on the terminal face
+ expect(host.querySelector('.onb-cview')?.classList.contains('is-chat')).toBe(false)
+ expect(host.querySelector('.onb-cview__mode')?.textContent).toBe('terminal')
+ })
+
+ it('flips to the chat face when the user presses the real chord (pulseKey)', async () => {
+ await render(0)
+ await render(1)
+ expect(host.querySelector('.onb-cview')?.classList.contains('is-chat')).toBe(true)
+ expect(host.querySelector('.onb-cview__mode')?.textContent).toBe('chat')
+ // and back on the next press — ⌘M is a toggle
+ await render(2)
+ expect(host.querySelector('.onb-cview')?.classList.contains('is-chat')).toBe(false)
+ })
+
+ it('loops on its own timer when nobody presses anything', async () => {
+ await render(0)
+ await act(async () => {
+ vi.advanceTimersByTime(2800)
+ })
+ expect(host.querySelector('.onb-cview')?.classList.contains('is-chat')).toBe(true)
+ })
+
+ it('drops the chord row when the toggle is unbound', async () => {
+ await act(async () =>
+ root.render(<SceneChatView agentId="claude" label="Claude Code" color="#d97757" keys={[]} />)
+ )
+ expect(host.querySelector('.onb-cview__keys')).toBeNull()
+ expect(host.querySelector('.onb-cview')).not.toBeNull()
+ })
+})
diff --git a/src/renderer/components/onboarding/scenes.tsx b/src/renderer/components/onboarding/scenes.tsx
index a329b0308..6d4ed0abe 100644
--- a/src/renderer/components/onboarding/scenes.tsx
+++ b/src/renderer/components/onboarding/scenes.tsx
@@ -228,6 +228,96 @@ export function SceneKanban({ pulseKey }: { pulseKey?: number }) {
)
}
+/** ⌘M on an agent node: the SAME node flips between its terminal face (prompt + output) and
+ * the chat view (the session's prompts and replies as a thread, composer at the bottom), on a
+ * timer — and on the user's real keystroke (`pulseKey`), exactly like the kanban scene. The
+ * node is the agents scene's `.onb-node` (held on screen via static inline overrides, as the
+ * keep-awake scene does) and the chat face mirrors the real `.term-chat__msg--user/--assistant`
+ * bubble look, so the tour never drifts from what ⌘M actually shows. */
+export function SceneChatView({
+ agentId,
+ label,
+ color,
+ keys,
+ pulseKey
+}: {
+ agentId: AgentId
+ label: string
+ color: string
+ keys: string[]
+ pulseKey?: number
+}) {
+ const [chat, setChat] = useState(false)
+ const reduced = useRef(
+ typeof matchMedia !== 'undefined' && matchMedia('(prefers-reduced-motion: reduce)').matches
+ )
+ useEffect(() => {
+ if (reduced.current) {
+ setChat(true) // static: show the chat face — the thing this step introduces
+ return
+ }
+ const t = setInterval(() => setChat((c) => !c), 2800)
+ return () => clearInterval(t)
+ }, [])
+ // the user pressing the real chord flips the scene too — the animation answers their keystroke
+ const lastPulse = useRef(pulseKey)
+ useEffect(() => {
+ if (pulseKey !== undefined && pulseKey !== lastPulse.current) {
+ lastPulse.current = pulseKey
+ setChat((c) => !c)
+ }
+ }, [pulseKey])
+
+ return (
+ <div className="onb-scene-canvas onb-scene--chat" aria-hidden="true">
+ {keys.length > 0 && (
+ <div className={`onb-kbd-row onb-cview__keys ${chat ? 'is-chat' : ''}`}>
+ {keys.map((k, i) => (
+ <kbd key={i} className="onb-kbd onb-cview__key">
+ {k}
+ </kbd>
+ ))}
+ </div>
+ )}
+ <div
+ className={`onb-node onb-cview ${chat ? 'is-chat' : ''}`}
+ style={{ position: 'relative', left: 'auto', top: 'auto', opacity: 1, animation: 'none', width: 236, borderTopColor: color }}
+ >
+ <div className="onb-node__head">
+ <span className="onb-node__color" style={{ background: color }} />
+ <AgentIcon agentId={agentId} size={13} />
+ <span className="onb-node__title">{label}</span>
+ <span className="onb-cview__mode">{chat ? 'chat' : 'terminal'}</span>
+ </div>
+ <div className="onb-cview__body">
+ {/* terminal face: a prompt line + output skeleton */}
+ <div className="onb-cview__face onb-cview__term">
+ <div className="onb-cview__prompt">
+ <span className="onb-term-prompt">❯</span>
+ <span>fix the failing test</span>
+ </div>
+ <div className="onb-line onb-line--w70" />
+ <div className="onb-line onb-line--w50" />
+ <div className="onb-line onb-line--w60" />
+ <div className="onb-line onb-line--w50" />
+ </div>
+ {/* chat face: the same session as a thread, composer underneath */}
+ <div className="onb-cview__face onb-cview__chat">
+ <div className="onb-cview__msg onb-cview__msg--user">fix the failing test</div>
+ <div className="onb-cview__msg onb-cview__msg--assistant">
+ <span className="onb-line onb-line--w70" />
+ <span className="onb-line onb-line--w50" />
+ </div>
+ <div className="onb-cview__compose">
+ <span className="onb-caret" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
/** A mock OS notification sliding in — what enabling notifications buys you. */
/**
* The macOS notch capsule: a laptop lid whose notch grows sideways into a black capsule with a
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index e03f1f177..7fb6bd5af 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -15637,6 +15637,106 @@ button.pull-checks__name {
flex: 0 0 46px;
}
+/* -- chat-view scene (⌘M on an agent node; the JS interval / the real keystroke flips .is-chat) --
+ The node is the agents scene's .onb-node held static; the two faces crossfade inside a fixed
+ body so the node never changes size, and the chat bubbles mirror .term-chat__msg--user /
+ --assistant (accent bubble right, tinted bubble left) so the tour draws what ⌘M shows. */
+.onb-scene--chat {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 22px;
+}
+.onb-cview__keys .onb-kbd {
+ animation: none;
+ transition: transform 0.12s ease, border-bottom-width 0.12s ease;
+}
+/* the chord "goes down" on every flip — the keys are what did it */
+.onb-cview__keys.is-chat .onb-kbd {
+ transform: translateY(2px);
+ border-bottom-width: 1px;
+}
+.onb-cview__mode {
+ margin-left: auto;
+ font-size: 8.5px;
+ font-weight: 700;
+ letter-spacing: 0.07em;
+ text-transform: uppercase;
+ color: var(--muted);
+}
+.onb-cview__body {
+ position: relative;
+ height: 112px;
+}
+.onb-cview__face {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ padding: 9px 10px 10px;
+ transition: opacity 0.45s ease, transform 0.45s ease;
+}
+.onb-cview__term {
+ opacity: 1;
+ transform: translateY(0);
+}
+.onb-cview__chat {
+ opacity: 0;
+ transform: translateY(6px);
+}
+.onb-cview.is-chat .onb-cview__term {
+ opacity: 0;
+ transform: translateY(-6px);
+}
+.onb-cview.is-chat .onb-cview__chat {
+ opacity: 1;
+ transform: translateY(0);
+}
+.onb-cview__prompt {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-family: Menlo, Monaco, monospace;
+ font-size: 10px;
+ color: rgba(235, 235, 245, 0.85);
+ margin-bottom: 2px;
+}
+.onb-cview__msg {
+ max-width: 82%;
+ padding: 6px 8px;
+ border-radius: 8px;
+ font-size: 10px;
+ line-height: 1.4;
+}
+.onb-cview__msg--user {
+ align-self: flex-end;
+ background: var(--accent, #0a84ff);
+ color: #fff;
+}
+.onb-cview__msg--assistant {
+ align-self: flex-start;
+ width: 72%;
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+ background: rgba(var(--tint-rgb), 0.06);
+}
+.onb-cview__compose {
+ margin-top: auto;
+ display: flex;
+ align-items: center;
+ height: 22px;
+ padding: 0 7px;
+ background: rgba(var(--tint-rgb), 0.06);
+ border: 1px solid rgba(var(--tint-rgb), 0.12);
+ border-radius: 6px;
+}
+.onb-cview__compose .onb-caret {
+ height: 11px;
+}
+
/* -- notify scene -- */
/* --- Step: the notch capsule (SceneNotch) ------------------------------------------------
A laptop lid seen from the front: the black top bar carries the notch, the capsule grows out
@@ -16005,6 +16105,10 @@ button.pull-checks__name {
.onb-mini {
transition: none;
}
+ .onb-cview__face,
+ .onb-cview__keys .onb-kbd {
+ transition: none;
+ }
.onb-phone,
.onb-soon {
animation: none;