The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Add companion engine choice and unify desktop controls (#498)
Dee5c723f0e4478
diff --git a/cli/src/cli.ts b/cli/src/cli.tsindex fcd0bc9cf..e7369b99e 100644--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@ -94,6 +94,7 @@ import { pairCommand as pairControlCommand, pairRequest, pairVerb, type PairClieimport { serveMcp } from './pair/mcp.js'import { PairHarness, type PairEngine } from './pair/pairHarness.js'import { CompanionIntelligence } from './pair/intelligence.js'+import { CompanionStartupProfile } from './pair/startupProfile.js'import { ConversationReview } from './pair/learn/conversationReview.js'import { individualName, pairedIndividual } from './pair/individuals.js'import { PlateService } from './pair/plateService.js'@@ -4454,9 +4455,10 @@ async function runForeground(session: AuthSession | null): Promise<void> {pairedName: () => pairSensor.pairedName(),pairedUid: () => zooPair.known ? companionZoo.identity?.uid ?? null : guestCompanion?.uid ?? null,collectionUids: () => zooPair.known ? companionZoo.uids : guestCompanion ? [guestCompanion.uid] : [],- engine: async () => {- const found = await probeEngines(['claude', 'codex']).catch(() => [])- return (['claude', 'codex'] as PairEngine[]).find((engine) => found.some((e) => e.engine === engine && e.installed)) ?? null+ engine: async (preferred) => {+ if (!preferred) return null // A new collection chooses its engine in the viewer.+ const found = await probeEngines([preferred]).catch(() => [])+ return found.some(e => e.engine === preferred && e.installed) ? preferred : null},// The launcher when this daemon is the installed release it runs; otherwise exactly this process.mcpCommand: () => {@@ -4500,6 +4502,14 @@ async function runForeground(session: AuthSession | null): Promise<void> {isCollectionAgent = (agentId) => agentId === pairHarness.agentId()companionPromptContext = (agentId) => daemons.on() ? pairHarness.context(agentId) : nullpairHarnessActivity = (agentId) => { if (daemons.on()) pairHarness.activity(agentId) }+ const companionStartupProfile = new CompanionStartupProfile({+ current: () => {+ if (!daemons.on() || !pairSensor.pairedDaemon()) return null+ const session = registry.advertised().find(s => s.agentId === pairHarness.agentId())+ return session?.dsh === PAIR_HARNESS_DSH ? session : null+ },+ capture: (id) => captureTerminal(id, 60),+ })const companionIntelligence = new CompanionIntelligence({enabled: () => daemons.on() && !!pairSensor.pairedDaemon(),current: () => {@@ -4510,6 +4520,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {if (!session || session.dsh !== PAIR_HARNESS_DSH) return nullreturn { agentId, sessionId: session.sessionId, engine: session.engine,profile: runtimeProfiles.selectedModel(session), stopped: !live,+ startup: live ? companionStartupProfile.selected(session) : null,codexHome: session.codexHome, customProvider: !!(session.grid || session.gridLaunch || session.gateway) }},directory: join(env.ADAPTER_DATA_DIR, 'pair', 'reasoning'),@@ -4523,7 +4534,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {const lessonDistiller = new LessonDistiller({ oneshot: companionIntelligence.run, modelEnabled: () => companionIntelligence.ready(), now: Date.now, home: homedir() })const conversationReview = new ConversationReview({directory: join(env.ADAPTER_DATA_DIR, 'pair', 'learn'),- scope: () => daemons.on() && pairSensor.pairedDaemon() ? pairHarness.agentId() : null,+ scope: () => daemons.on() && pairSensor.pairedDaemon() ? pairHarness.learningScope() : null,pairedDaemon: () => pairSensor.pairedDaemon(), intelligence: () => companionIntelligence.status(),turns: (from, to) => sessionSearch?.recentConversations(from, to) ?? null,cwd: (id) => registry.resolve(id)?.cwd ?? stoppedAgents.get(id)?.cwd ?? null,@@ -4536,7 +4547,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {history: conversationReview,intelligence: () => companionIntelligence.status(),queueFile: () => {- const id = pairHarness.agentId()+ const id = pairHarness.learningScope()return id ? join(env.ADAPTER_DATA_DIR, 'pair', 'learn', `queue-${id}.json`) : null},pairedDaemon: () => pairSensor.pairedDaemon(),@@ -4588,7 +4599,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {fleet: pairFleet,// Template first, then this collection's selected model when it is ready.triage: new PairTriage({ oneshot: companionIntelligence.run, modelEnabled: () => companionIntelligence.ready(), now: Date.now, budgetMs: 30_000 }),- companionHarness: () => ({ agentId: pairHarness.agentId(), ...companionIntelligence.status() }),+ companionHarness: () => ({ ...companionIntelligence.status(), agentId: pairHarness.agentId(), engine: pairHarness.engine() }),voice: pairVoice,proposals: joinProposals(pairControl, pairLearner),autonomy: () => pairAutonomy(),@@ -4614,7 +4625,19 @@ async function runForeground(session: AuthSession | null): Promise<void> {onGuestConsent: (watching) => { guestConsent = watching; applyPair() },onActiveChanged: (active) => setVoiceRouterDeviceConnected(backend.hasCommander() || active),talk: (text, uid) => pairTalk(text, uid),- open: (uid) => pairHarness.open(uid),+ open: async (uid, engine) => {+ const previousEngine = pairHarness.engine()+ const result = await pairHarness.open(uid, engine)+ if (result.ok) {+ if (engine && engine !== previousEngine) {+ companionIntelligence.cancel()+ conversationReview.engineChanged()+ }+ pairBrain?.stateChanged()+ return { ...result, engine: pairHarness.engine() }+ }+ return result+ },now: Date.now,})// DAEMONS ON AND OFF (lib/daemonsSwitch.ts): the only timers the pair keeps whatever happens — the learner's@@ -5423,6 +5446,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {const PANE_POLLED_ENGINES = new Set(['devin', 'cursor', 'grok', 'agy', 'opencode', 'kilo'])const PANE_POLL_MS = 15_000setInterval(() => {+ void companionStartupProfile.refresh().then(() => companionProfileChanged()).catch(() => undefined)for (const session of registry.list()) {if (!PANE_POLLED_ENGINES.has(session.engine)) continuevoid captureTerminal(session.agentId, 60)diff --git a/cli/src/lib/runtimeProfile.ts b/cli/src/lib/runtimeProfile.tsindex d11b0a78e..e1b4603f6 100644--- a/cli/src/lib/runtimeProfile.ts+++ b/cli/src/lib/runtimeProfile.ts@@ -585,6 +585,51 @@ async function claudeConfiguredEffort(session: RegisteredSession): Promise<strinreturn configured ?? 'auto'}+/** The first-run banner names the model before Claude writes a conversation transcript. */+function claudeStartupBanner(pane: string): { model: string; effort?: string } | null {+ const lines = pane.split('\n')+ const start = lines.findLastIndex(line => /\bClaude Code v\d+\.\d+/.test(line))+ if (start < 0) return null+ const banner = lines.slice(start, start + 4).join('\n')+ const match = /\b(Fable|Opus|Sonnet|Haiku)\s+(\d+(?:\.\d+)*)(\s+\(1M context\))?(?:\s+with\s+(low|medium|high|xhigh|max|ultracode)\s+effort)?\s*·\s*Claude\s+(?:Max|Pro|Team|Enterprise)\b/i.exec(banner)+ if (!match) return null+ return {+ model: `claude-${match[1].toLowerCase()}-${match[2].replace(/\./g, '-')}${match[3] ? '[1m]' : ''}`,+ ...(match[4] ? { effort: match[4].toLowerCase() } : {}),+ }+}++/**+ * Read-only evidence for a ready, pre-conversation CLI. Callers must scope this to the live process;+ * it deliberately never enters RuntimeProfileManager's conversation cache under an empty session ID.+ */+export async function readStartupProfile(session: RegisteredSession, pane: string): Promise<string | null> {+ if (session.sessionId || !session.active || session.grid || session.gridLaunch || session.gateway) return null+ pane = stripAnsi(pane).trimEnd()+ // A banner above an onboarding dialog is not a ready agent. Do not accept a numbered menu cursor.+ if (/trust this (?:folder|directory)|trust the files|sign in|log in|select a login|choose.*theme/i.test(pane)) return null+ if (session.engine === 'claude') {+ const banner = claudeStartupBanner(pane)+ if (!banner || !/^\s*❯\s*(?:Try\s+[^\n]*)?$/mu.test(pane)) return null+ // Slash commands can change the selection before a first conversational turn binds the session.+ const change = [...pane.matchAll(/(?:^|\n)\s*(?:⎿\s*)?Set model to\s+([^\n]+)/gi)].at(-1)+ const model = change ? normalizeClaudeDisplay(change[1]) : banner.model+ if (!model) return null+ const effort = banner.effort ?? await claudeConfiguredEffort(session)+ return encodeRuntimeProfile({ sessionId: session.agentId, engine: 'claude',+ model: claudeAliasForModel(model) ?? model, effort })+ }+ if (session.engine === 'codex') {+ if (!/\bOpenAI Codex\b/.test(pane) || !/^\s*›(?!\s*\d+\.)[^\n]*$/mu.test(pane)) return null+ const matches = [...pane.matchAll(/\b(gpt-[a-z0-9][a-z0-9._-]*)\s+(low|medium|high|xhigh|max|ultra|default)\s*[·│]/gi)]+ const match = matches.at(-1)+ if (!match) return null+ return encodeRuntimeProfile({ sessionId: session.agentId, engine: 'codex', model: match[1].toLowerCase(),+ effort: match[2].toLowerCase() === 'default' ? 'auto' : match[2].toLowerCase() })+ }+ return null+}+function addOption(output: RuntimeModelOption[],seen: Set<string>,@@ -899,6 +944,12 @@ export class RuntimeProfileManager {state.observedAt = Date.now()}} else {+ const banner = !state.model ? claudeStartupBanner(paneText) : null+ if (banner) {+ state.model = banner.model+ if (banner.effort) state.effort = banner.effort+ state.observedAt = Date.now()+ }const header = /(Fable|Opus|Sonnet|Haiku)\s+(\d+(?:\.\d+)*)(\s+\(1M context\))?\s+with\s+(low|medium|high|xhigh|max|ultracode)\s+effort/giconst matches = [...paneText.matchAll(header)]const latest = matches[matches.length - 1]@@ -1093,9 +1144,10 @@ export class RuntimeProfileManager {* first. The claude pane came home with `ANTHROPIC_MODEL=opencode/big-pickle` and Claude Code* answered "There's an issue with the selected model (opencode/big-pickle). It may not exist".*- * So `''` gets no entry. Reads answer "nothing observed", which is TRUE — an agent with no engine- * session has no model to report — and writes land in a throwaway rather than in a bucket the next- * agent will read. Everything real is re-read once the session binds, moments later.+ * So `''` gets no entry in this conversation cache, and writes land in a throwaway rather than a+ * bucket the next agent will read. A ready startup banner can be read separately with+ * readStartupProfile, whose caller must scope that observation to the live process. Transcript+ * state is re-read once a real conversation binds.*/private unbound(sessionId: string): boolean {return !sessionIddiff --git a/cli/src/pair/brain.spec.ts b/cli/src/pair/brain.spec.tsindex f47c3bb9c..3c9ec9570 100644--- a/cli/src/pair/brain.spec.ts+++ b/cli/src/pair/brain.spec.ts@@ -333,8 +333,15 @@ describe('the brain', () => {await w.brain.onOpen('window', { requestId: 'o2' }, send)expect(replies.pop()?.payload).toMatchObject({ ok: false, error: 'STALE_COMPANION' })await w.brain.onOpen('window', { requestId: 'o3', companionUid: 'tim-one' }, send)- expect(open).toHaveBeenCalledWith('tim-one')+ expect(open).toHaveBeenCalledWith('tim-one', undefined)expect(replies.pop()).toEqual({ type: 'daemon_open_result', payload: { requestId: 'o3', ok: true, agentId: 'pair-tim' } })+ await w.brain.onOpen('window', { requestId: 'o4', companionUid: 'tim-one', engine: 'codex' }, send)+ expect(open).toHaveBeenLastCalledWith('tim-one', 'codex')+ await w.brain.onOpen('window', { requestId: 'o5', companionUid: 'tim-one', engine: 'unknown' }, send)+ expect(replies.pop()?.payload).toMatchObject({ error: 'BAD_ENGINE' })+ await w.brain.onOpen('tool', { requestId: 'o6', companionUid: 'tim-one', engine: 'codex' }, send)+ expect(replies.pop()?.payload).toMatchObject({ error: 'UI_ONLY' })+ expect(open).toHaveBeenCalledTimes(2)})it('a key counts only from the window that was shown the line, a moment after it was shown', async () => {diff --git a/cli/src/pair/brain.ts b/cli/src/pair/brain.tsindex 44e8db0fd..7cf2ee527 100644--- a/cli/src/pair/brain.ts+++ b/cli/src/pair/brain.ts@@ -90,7 +90,7 @@ export interface PairBrainDeps {/** `daemon_talk`: the person's words to the pair harness (pair/pairHarness.ts), which starts or wakes. */talk?: (text: string, companionUid?: string) => Promise<Record<string, unknown>>/** Open the pair's terminal without typing into it or starting a model turn. */- open?: (companionUid?: string) => Promise<Record<string, unknown>>+ open?: (companionUid?: string, engine?: 'claude' | 'codex') => Promise<Record<string, unknown>>/** The collection's persistent agent and its observed model. Local windows only. */companionHarness?: () => Record<string, unknown>/** How many keys may be relayed to other machines, per window (RELAY_LIMITS unless a spec says). */@@ -533,7 +533,9 @@ export class PairBrain {if (!this.deps.open) { reply({ ok: false, error: 'UNSUPPORTED' }); return }const uid = str(payload.companionUid, 64)if (!uid) { reply({ ok: false, error: 'STALE_COMPANION' }); return }- const result = await this.deps.open(uid).catch((err): Record<string, unknown> => ({ ok: false, error: 'FAILED', detail: err instanceof Error ? err.message.slice(0, 200) : undefined }))+ const engine = payload.engine+ if (engine !== undefined && engine !== 'claude' && engine !== 'codex') { reply({ ok: false, error: 'BAD_ENGINE' }); return }+ const result = await this.deps.open(uid, engine).catch((err): Record<string, unknown> => ({ ok: false, error: 'FAILED', detail: err instanceof Error ? err.message.slice(0, 200) : undefined }))reply(result)}diff --git a/cli/src/pair/intelligence.spec.ts b/cli/src/pair/intelligence.spec.tsindex 39d07bb31..6602370bb 100644--- a/cli/src/pair/intelligence.spec.ts+++ b/cli/src/pair/intelligence.spec.ts@@ -1,5 +1,5 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'-import { mkdtempSync, readFileSync, rmSync } from 'node:fs'+import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'import { tmpdir } from 'node:os'import { join } from 'node:path'import { CompanionIntelligence, type CompanionRuntime } from './intelligence.js'@@ -41,6 +41,30 @@ describe('the collection DSH supplies its intelligence', () => {expect(readFileSync(w.deps.stateFile, 'utf8')).not.toContain('prompt')})+ it('can review before the first message with live startup evidence, without persisting a fake conversation', async () => {+ const w = world()+ const startup = { processKey: 'live-process-1', profile: w.get().profile! }+ w.set({ ...w.get(), sessionId: '', profile: null, startup })+ expect(w.brain.status()).toMatchObject({ state: 'ready', model: 'opus' })+ expect(await w.brain.run('evidence', { timeoutMs: 1000, signal: new AbortController().signal })).toBe('{"lesson":null}')+ expect(existsSync(w.deps.stateFile)).toBe(false)+ w.set({ ...w.get(), stopped: true })+ expect(new CompanionIntelligence(w.deps).status().state).toBe('waiting')+ w.set({ ...w.get(), stopped: false, startup: null })+ expect(w.brain.status().state).toBe('waiting')+ })++ it('rejects an unbound review result from a replaced process even with the same agent and model', async () => {+ const w = world(), startup = { processKey: 'live-process-1', profile: w.get().profile! }+ w.set({ ...w.get(), sessionId: '', profile: null, startup })+ let finish!: (result: { text: string }) => void+ w.run.mockImplementation(() => new Promise(resolve => { finish = resolve }))+ const result = w.brain.run('evidence', { timeoutMs: 1000, signal: new AbortController().signal })+ w.set({ ...w.get(), startup: { ...startup, processKey: 'live-process-2' } })+ finish({ text: 'old answer' })+ expect(await result).toBeNull()+ })+it('does not guess a model from another agent, setup, unsupported credentials, or a missing DSH', async () => {const w = world()w.set({ ...w.get(), profile: encodeRuntimeProfile({ sessionId: 'other-agent', engine: 'claude', model: 'haiku', effort: 'low' }) })diff --git a/cli/src/pair/intelligence.ts b/cli/src/pair/intelligence.tsindex 4df0bad99..6bb84054f 100644--- a/cli/src/pair/intelligence.ts+++ b/cli/src/pair/intelligence.ts@@ -4,6 +4,7 @@ import { dirname } from 'node:path'import { parseRuntimeProfile, type RuntimeProfile } from '../lib/runtimeProfile.js'import { runClaudeOneShot, runCodexOneShot, type OneShotOptions } from '../lib/oneshot.js'import type { PairOneShot } from './triage.js'+import type { StartupProfile } from './startupProfile.js'export interface CompanionRuntime {agentId: string@@ -13,6 +14,7 @@ export interface CompanionRuntime {stopped: booleancodexHome?: string | nullcustomProvider?: boolean+ startup?: StartupProfile | null}export interface IntelligenceStatus {@@ -67,6 +69,7 @@ export class CompanionIntelligence {// A result from an old model, account, or conversation is never accepted under the new one.if (controller.signal.aborted || current.status.state !== 'ready' ||current.runtime?.sessionId !== runtime.sessionId || current.profile?.id !== profile.id ||+ (!runtime.sessionId && current.runtime?.startup?.processKey !== runtime.startup?.processKey) ||current.runtime?.codexHome !== runtime.codexHome) return nullreturn result.text} finally {@@ -80,18 +83,21 @@ export class CompanionIntelligence {const runtime = this.deps.current()if (!runtime) return { status: { state: 'unopened' } }const status: IntelligenceStatus = { state: 'waiting', agentId: runtime.agentId, engine: runtime.engine }- if (!runtime.sessionId) return { status }// Custom provider credentials must not silently fall back to the local subscription.if (!['claude', 'codex'].includes(runtime.engine) || runtime.customProvider) return { status: { ...status, state: 'unsupported' } }+ if (!runtime.sessionId && (runtime.stopped || !runtime.startup)) return { status }this.load()const cached = this.saved![runtime.agentId]- const value = runtime.profile ?? (runtime.stopped && cached?.sessionId === runtime.sessionId ? cached.profile : null)+ const value = runtime.sessionId+ ? runtime.profile ?? (runtime.stopped && cached?.sessionId === runtime.sessionId ? cached.profile : null)+ : runtime.startup?.profileconst profile = parseRuntimeProfile(value)const efforts = runtime.engine === 'claude'? ['auto', 'low', 'medium', 'high', 'xhigh', 'max', 'ultracode']: ['auto', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra']if (!profile || profile.sessionId !== runtime.agentId || profile.engine !== runtime.engine || !efforts.includes(profile.effort)) return { status }- if (cached?.profile !== profile.id || cached.sessionId !== runtime.sessionId) {+ // Pre-conversation readiness is live evidence, never a durable substitute for a conversation ID.+ if (runtime.sessionId && (cached?.profile !== profile.id || cached.sessionId !== runtime.sessionId)) {this.saved![runtime.agentId] = { sessionId: runtime.sessionId, profile: profile.id }mkdirSync(dirname(this.deps.stateFile), { recursive: true, mode: 0o700 })const tmp = `${this.deps.stateFile}.tmp`diff --git a/cli/src/pair/learn/conversationReview.spec.ts b/cli/src/pair/learn/conversationReview.spec.tsindex 19c5e7fda..1f9d1e862 100644--- a/cli/src/pair/learn/conversationReview.spec.ts+++ b/cli/src/pair/learn/conversationReview.spec.ts@@ -39,6 +39,51 @@ function world(rows = [row()], response: string | null = candidate()) {}describe('explicit conversation review', () => {+ it('changing engines resumes the existing quota-blocked review with its original window', async () => {+ const w = world()+ w.review.mockResolvedValueOnce({ text: null, failure: 'usage-limit' })+ w.history.start(24); await w.settled()+ expect(w.history.status()).toMatchObject({ state: 'waiting', error: 'usage-limit', total: 1, reviewed: 0 })+ w.history.engineChanged()+ w.set({ ready: false })+ await w.history.tick()+ expect(w.history.status()).toMatchObject({ state: 'waiting', error: 'no-model', total: 1, remaining: 1 })+ expect(w.review).toHaveBeenCalledTimes(1)+ w.set({ ready: true })+ await w.history.tick()+ expect(w.history.status()).toMatchObject({ state: 'complete', from: NOW - 24 * HOUR, to: NOW, reviewed: 1 })+ expect(w.turns).toHaveBeenCalledTimes(1)+ expect(w.store.approved()).toHaveLength(0)+ expect(w.store.pending()).toHaveLength(1)+ })++ it('changing engines cannot bypass the hourly budget or revive a cancelled review', async () => {+ const w = world()+ w.review.mockResolvedValueOnce({ text: null, failure: 'cap' })+ w.history.start(24); await w.settled()+ w.history.engineChanged(); await w.history.tick()+ expect(w.review).toHaveBeenCalledTimes(1)+ expect(w.history.status()).toMatchObject({ error: 'cap', retryAt: NOW + HOUR })+ w.history.cancel()+ w.history.engineChanged(); await w.history.tick()+ expect(w.history.status()).toMatchObject({ state: 'cancelled' })+ expect(w.review).toHaveBeenCalledTimes(1)+ })++ it('discards an in-flight old-engine result and keeps the batch for the chosen engine', async () => {+ const w = world()+ let finish!: (value: { text: string }) => void+ w.review.mockImplementationOnce(async () => new Promise(resolve => { finish = resolve }))+ w.history.start(24)+ w.history.engineChanged()+ expect(w.review.mock.calls[0][1]?.aborted).toBe(true)+ finish({ text: candidate() }); await new Promise(resolve => setTimeout(resolve, 0))+ expect(w.store.pending()).toHaveLength(0)+ expect(w.history.status()).toMatchObject({ state: 'queued', remaining: 1 })+ await w.history.tick()+ expect(w.store.pending()).toHaveLength(1)+ })+it('uses only dated turns from the requested 24 hours and creates pending, sourced lessons', async () => {const w = world([row(), row(2, { at: NOW - 25 * HOUR }), row(3, { at: NOW + 1 }), row(4, { at: null })])expect(w.history.start(24)).toMatchObject({ ok: true })diff --git a/cli/src/pair/learn/conversationReview.ts b/cli/src/pair/learn/conversationReview.tsindex 0102afd19..53b4cd9b2 100644--- a/cli/src/pair/learn/conversationReview.ts+++ b/cli/src/pair/learn/conversationReview.ts@@ -137,6 +137,19 @@ export class ConversationReview {return { ok: true, review: this.status() }}+ /** An explicit engine change keeps the pending review, but its old provider's quota wait no+ * longer applies. Never starts a new review or revives a cancelled/completed one. */+ engineChanged(): void {+ this.load()+ const job = this.saved.job+ if (!job || !['queued', 'reviewing', 'waiting'].includes(job.state)) return+ this.generation++; this.abort?.abort()+ // The local hourly budget applies across engines; changing providers cannot bypass it.+ if (job.error !== 'cap') { job.retryAt = 0; job.error = undefined }+ job.state = 'queued'+ this.save()+ }+/** Experimental-off cancels the old scope before that scope is cleared. */stop(): void {this.generation++; this.abort?.abort()diff --git a/cli/src/pair/pairHarness.engine.spec.ts b/cli/src/pair/pairHarness.engine.spec.tsnew file mode 100644index 000000000..0157c3ffd--- /dev/null+++ b/cli/src/pair/pairHarness.engine.spec.ts@@ -0,0 +1,117 @@+import { afterEach, beforeEach, expect, it, vi } from 'vitest'+import { mkdtempSync, readFileSync, rmSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { PairHarness, type PairHarnessDeps, type PairHarnessRow } from './pairHarness.js'+import { PairToken } from './token.js'++let dir: string+beforeEach(() => { dir = mkdtempSync(join(tmpdir(), 'pair-engine-')); vi.useFakeTimers() })+afterEach(() => { vi.useRealTimers(); rmSync(dir, { recursive: true, force: true }) })++function world() {+ let uid = 'tim-one'+ const rows: PairHarnessRow[] = []+ const deps: PairHarnessDeps = {+ pairedDaemon: () => 'tim', pairedUid: () => uid,+ collectionUids: () => uid === 'other-account' ? [uid] : ['tim-one', 'gnu-one'],+ engine: vi.fn(async preferred => preferred ?? null),+ mcpCommand: () => ['/bin/harness'], token: new PairToken(join(dir, 'token')),+ workspace: join(dir, 'workspace'), stateFile: join(dir, 'harness.json'),+ install: vi.fn(() => true), find: () => rows,+ create: vi.fn<PairHarnessDeps['create']>(async ({ engine }) => {+ const agentId = `agent-${rows.length + 1}`+ rows.push({ agentId, engine, status: 'live', hasConversation: true })+ return { ok: true, agentId }+ }),+ resume: vi.fn<PairHarnessDeps['resume']>(async id => { rows.find(r => r.agentId === id)!.status = 'live'; return { ok: true } }),+ stop: vi.fn(async id => { rows.find(r => r.agentId === id)!.status = 'stopped' }),+ send: vi.fn(), working: () => false, now: Date.now,+ }+ return { deps, rows, harness: new PairHarness(deps), select: (id: string) => { uid = id } }+}++it('asks for the first engine, remembers the choice, and resumes each engine’s own transcript', async () => {+ const w = world()+ expect(await w.harness.open('tim-one')).toMatchObject({ error: 'ENGINE_REQUIRED' })+ expect(w.deps.create).not.toHaveBeenCalled()+ await w.harness.open('tim-one', 'claude')+ expect(w.harness.learningScope()).toBe('agent-1')+ await w.harness.open('tim-one', 'codex')+ expect(w.harness.engine()).toBe('codex')+ expect(w.harness.learningScope()).toBe('agent-1')+ expect(w.rows).toMatchObject([{ status: 'stopped', engine: 'claude' }, { status: 'live', engine: 'codex' }])+ expect(w.deps.create).toHaveBeenLastCalledWith(expect.objectContaining({ engine: 'codex', prompt: '' }))+ const restarted = new PairHarness(w.deps)+ w.select('gnu-one')+ await restarted.open('gnu-one')+ expect(restarted.engine()).toBe('codex')+ expect(w.deps.create).toHaveBeenCalledTimes(2)+ expect(await restarted.open('gnu-one', 'claude')).toMatchObject({ resumed: true, agentId: 'agent-1' })+ expect(restarted.learningScope()).toBe('agent-1')+ expect(w.deps.send).not.toHaveBeenCalled()+ const saved = JSON.parse(readFileSync(w.deps.stateFile, 'utf8'))+ expect(saved.collections).toHaveLength(2)+ expect(saved.engine).toBe('claude')+})++it('keeps an unavailable or busy engine choice from interrupting the current conversation', async () => {+ const w = world()+ await w.harness.open('tim-one', 'claude')+ vi.mocked(w.deps.engine).mockResolvedValue(null)+ expect(await w.harness.open('tim-one', 'codex')).toMatchObject({ error: 'NO_ENGINE' })+ expect(w.deps.stop).not.toHaveBeenCalled()+ w.deps.working = () => true+ expect(await w.harness.open('tim-one', 'codex')).toMatchObject({ error: 'BUSY' })+ expect(w.harness.engine()).toBe('claude')+ expect(w.deps.stop).not.toHaveBeenCalled()+})++it('does not substitute a different engine if discovery returns the wrong one', async () => {+ const w = world()+ vi.mocked(w.deps.engine).mockResolvedValue('claude')+ expect(await w.harness.open('tim-one', 'codex')).toMatchObject({ error: 'NO_ENGINE' })+ expect(w.deps.create).not.toHaveBeenCalled()+})++it('keeps the old choice and history when launching the new engine fails', async () => {+ const w = world()+ await w.harness.open('tim-one', 'claude')+ vi.mocked(w.deps.create).mockResolvedValueOnce({ ok: false, error: 'LAUNCH_FAILED' })+ expect(await w.harness.open('tim-one', 'codex')).toMatchObject({ error: 'LAUNCH_FAILED' })+ expect(w.harness.engine()).toBe('claude')+ expect(w.harness.learningScope()).toBe('agent-1')+ expect(await w.harness.open('tim-one')).toMatchObject({ resumed: true, agentId: 'agent-1' })+})++it('isolates engine preferences, transcripts and review scopes between collections', async () => {+ const w = world()+ await w.harness.open('tim-one', 'claude')+ await w.harness.open('tim-one', 'codex')+ w.select('other-account')+ expect(w.harness.engine()).toBeNull()+ expect(w.harness.learningScope()).toBeNull()+ expect(await w.harness.open('tim-one', 'codex')).toMatchObject({ error: 'STALE_COMPANION' })+ await w.harness.open('other-account', 'codex')+ expect(w.harness.learningScope()).toBe('agent-3')+ w.select('tim-one')+ expect(w.harness.engine()).toBe('codex')+ expect(w.harness.learningScope()).toBe('agent-1')+ await w.harness.open('tim-one', 'claude')+ expect(w.harness.agentId()).toBe('agent-1')+})++it('does not bind a late engine launch to another account', async () => {+ const w = world()+ await w.harness.open('tim-one', 'claude')+ let finish!: (value: { ok: true; agentId: string }) => void+ vi.mocked(w.deps.create).mockImplementationOnce(async () => new Promise(resolve => { finish = resolve }))+ const opening = w.harness.open('tim-one', 'codex')+ await vi.waitFor(() => expect(finish).toBeDefined())+ w.select('other-account')+ w.rows.push({ agentId: 'late-codex', engine: 'codex', status: 'live' })+ finish({ ok: true, agentId: 'late-codex' })+ expect(await opening).toMatchObject({ error: 'STALE_COMPANION' })+ expect(w.deps.stop).toHaveBeenCalledWith('late-codex')+ expect(w.harness.agentId()).toBeNull()+})diff --git a/cli/src/pair/pairHarness.spec.ts b/cli/src/pair/pairHarness.spec.tsindex 92c73e9dc..31bac8ae3 100644--- a/cli/src/pair/pairHarness.spec.ts+++ b/cli/src/pair/pairHarness.spec.ts@@ -184,6 +184,19 @@ describe('talking to it', () => {expect(readFileSync(join(dir, 'pair', 'token'), 'utf8')).not.toBe(first)})+ it('keeps a pre-conversation companion available instead of pausing a session that cannot resume', async () => {+ const w = world()+ await w.harness.open()+ w.rows[0]!.hasConversation = false+ await vi.advanceTimersByTimeAsync(PAIR_IDLE_MS * 2)+ expect(w.deps.stop).not.toHaveBeenCalled()+ expect(w.deps.send).not.toHaveBeenCalled()+ w.rows[0]!.hasConversation = true+ w.harness.activity('pair-1')+ await vi.advanceTimersByTimeAsync(PAIR_IDLE_MS + 60_000)+ expect(w.deps.stop).toHaveBeenCalledWith('pair-1')+ })+it('a new paired daemon keeps the collection conversation and does not interrupt its terminal', async () => {const w = world()await w.harness.talk('hi tim')@@ -209,7 +222,7 @@ describe('talking to it', () => {it('says why it cannot: nothing paired, no engine, nothing said', async () => {expect(await world({ pair: null }).harness.talk('hi')).toMatchObject({ ok: false, error: 'PAIR_OFF' })- expect(await world({ engine: null }).harness.talk('hi')).toMatchObject({ ok: false, error: 'NO_ENGINE' })+ expect(await world({ engine: null }).harness.talk('hi')).toMatchObject({ ok: false, error: 'ENGINE_REQUIRED' })expect(await world().harness.talk(' ')).toMatchObject({ ok: false, error: 'EMPTY' })})})diff --git a/cli/src/pair/pairHarness.ts b/cli/src/pair/pairHarness.tsindex 5ebbd8579..db2f44ee6 100644--- a/cli/src/pair/pairHarness.ts+++ b/cli/src/pair/pairHarness.ts@@ -1,6 +1,6 @@/*** The pair harness (daemons/BRAIN.md, tier 2): the paired daemon as a conversation you can have. A- * built-in harness, `autonomous/pair`, that runs a coding engine (Claude Code, else Codex) with the+ * built-in harness, `autonomous/pair`, that runs the person's chosen coding engine with the* `harnessd` MCP server — the control interface (pair/control.ts) — and instructions that give it the* paired daemon's voice (roster lore, first words, lines) and the floor.*@@ -188,8 +188,8 @@ export interface PairHarnessDeps {pairedUid?: () => string | null/** All individuals in this collection. Membership isolates signed-in and guest histories. */collectionUids?: () => readonly string[]- /** An installed engine to run it on, Claude first; null when neither is here. */- engine: () => Promise<PairEngine | null>+ /** Verify the person's chosen engine is installed. Never substitute another engine. */+ engine: (preferred?: PairEngine) => Promise<PairEngine | null>/** How this machine runs `harness` (the launcher, else this process's node and cli.js). */mcpCommand: () => string[]token: PairToken@@ -214,7 +214,7 @@ export interface PairHarnessDeps {idleMs?: number}-interface Saved { agentId: string; revision: string; uid?: string; members?: string[] }+interface Saved { agentId: string; revision: string; uid?: string; members?: string[]; engine?: PairEngine; learningScope?: string }export class PairHarness {private lastActivity = 0@@ -232,18 +232,18 @@ export class PairHarness {}/** Open the real terminal, including first-run setup, without sending a model turn. */- open(expectedUid?: string): Promise<Record<string, unknown>> {- return this.enqueue(null, expectedUid)+ open(expectedUid?: string, engine?: PairEngine): Promise<Record<string, unknown>> {+ return this.enqueue(null, expectedUid, engine)}- private enqueue(text: string | null, expectedUid?: string): Promise<Record<string, unknown>> {- const requested = { daemonId: this.deps.pairedDaemon(), uid: expectedUid ?? this.deps.pairedUid?.(), generation: this.generation }+ private enqueue(text: string | null, expectedUid?: string, engine?: PairEngine): Promise<Record<string, unknown>> {+ const requested = { daemonId: this.deps.pairedDaemon(), uid: expectedUid ?? this.deps.pairedUid?.(), generation: this.generation, engine }const next = this.talking.then(() => this.talkNow(text, requested), () => this.talkNow(text, requested))this.talking = next.catch(() => ({}))return next}- private async talkNow(text: string | null, requested: { daemonId: string | null; uid: string | null | undefined; generation: number }): Promise<Record<string, unknown>> {+ private async talkNow(text: string | null, requested: { daemonId: string | null; uid: string | null | undefined; generation: number; engine?: PairEngine }): Promise<Record<string, unknown>> {const words = text?.trim() ?? ''const daemonId = this.deps.pairedDaemon()if (!daemonId) return { ok: false, error: 'PAIR_OFF', detail: 'Nothing is paired: hatch or pair a daemon first.' }@@ -251,9 +251,14 @@ export class PairHarness {(requested.uid == null || this.deps.pairedUid?.() === requested.uid)const stale = { ok: false, error: 'STALE_COMPANION', detail: 'Your companion changed before the message was sent. Send it again to the companion shown.' }if (!current()) return stale- const saved = this.saved()+ const previous = this.saved()+ const previousEngine = this.engine()+ const switching = !!requested.engine && requested.engine !== previousEngine+ const saved = switching ? this.saved(requested.engine) : previousconst conversation = this.deps.find().find((row) => row.agentId === saved?.agentId) ?? null- if (this.activeAgentId && this.activeAgentId !== saved?.agentId && this.deps.find().some(row => row.agentId === this.activeAgentId && row.status === 'live')) {+ if (switching && previous && this.deps.working(previous.agentId)) return { ok: false, error: 'BUSY',+ detail: 'Finish or stop the current turn before switching agents.' }+ if (this.activeAgentId && this.activeAgentId !== previous?.agentId && this.deps.find().some(row => row.agentId === this.activeAgentId && row.status === 'live')) {await this.deps.stop(this.activeAgentId)if (!current()) return stale}@@ -261,8 +266,11 @@ export class PairHarness {// character, or updating its artwork must never replace the person's conversation.if (saved && !conversation) return { ok: false, error: 'CONVERSATION_UNAVAILABLE',detail: 'The collection’s saved conversation is unavailable. Its history has been kept.' }- const engine = conversation?.engine ?? await this.deps.engine()- if (!engine) return { ok: false, error: 'NO_ENGINE', detail: 'The pair runs on Claude Code or Codex; neither is installed here.' }+ const preferred = requested.engine ?? saved?.engine+ const engine = switching ? await this.deps.engine(preferred) : conversation?.engine ?? saved?.engine ?? await this.deps.engine(preferred)+ if (!engine || (preferred && engine !== preferred)) return preferred+ ? { ok: false, error: 'NO_ENGINE', detail: `${preferred === 'codex' ? 'Codex' : 'Claude Code'} is not installed on this computer.` }+ : { ok: false, error: 'ENGINE_REQUIRED', detail: 'Choose the agent that powers your companion.' }if (!current()) return staleconst identity = this.deps.pairedUid?.()const uid = identity && /^[A-Za-z0-9_-]{1,64}$/.test(identity) ? identity : undefined@@ -270,9 +278,21 @@ export class PairHarness {if (!this.deps.install(files)) return { ok: false, error: 'INSTALL_FAILED', detail: 'The pair harness could not be installed. Try again.' }const revision = packageRevision(files)if (!current()) return stale+ // Each engine keeps its own transcript. The review queue and deduplication history belong+ // to the collection, so switching engines must not change their storage key.+ const learningScope = previous?.learningScope ?? previous?.agentId+ if (switching && previous) {+ this.save({ ...previous, ...(previousEngine ? { engine: previousEngine } : {}) })+ if (this.deps.find().some(row => row.agentId === previous.agentId && row.status === 'live')) {+ await this.deps.stop(previous.agentId)+ if (!current()) return stale+ }+ }+ const save = (agentId: string): void => this.save({ agentId, revision, engine,+ learningScope: learningScope ?? agentId, ...(uid ? { uid } : {}) })this.touch()if (conversation?.status === 'live') {- this.save({ agentId: conversation.agentId, revision, ...(uid ? { uid } : {}) })+ save(conversation.agentId)// Never paste words (or an automatic Enter) into an engine's trust/setup// screen. The first prompt was passed at launch and waits for that screen.if (text === null) { this.watchIdle(); return { ok: true, agentId: conversation.agentId } }@@ -285,7 +305,7 @@ export class PairHarness {const resumed = await this.deps.resume(conversation.agentId)if (resumed.ok) {if (!current()) { await this.deps.stop(conversation.agentId).catch(() => {}); return stale }- this.save({ agentId: conversation.agentId, revision, ...(uid ? { uid } : {}) })+ save(conversation.agentId)if (text !== null) this.deps.send(conversation.agentId, words)this.watchIdle()return { ok: true, agentId: conversation.agentId, resumed: true }@@ -299,7 +319,7 @@ export class PairHarness {const created = await this.deps.create({ engine, cwd: workspace, prompt: words, name: 'companions' })if (!created.ok) return createdif (!current()) { await this.deps.stop(created.agentId).catch(() => {}); return stale }- this.save({ agentId: created.agentId, revision, ...(uid ? { uid } : {}) })+ save(created.agentId)this.watchIdle()const setupRequired = this.deps.find().some(row => row.agentId === created.agentId && row.hasConversation === false)return { ok: true, agentId: created.agentId, started: true, ...(setupRequired ? { setupRequired } : {}) }@@ -314,6 +334,16 @@ export class PairHarness {return saved?.agentId ?? null}+ engine(): PairEngine | null {+ const saved = this.saved()+ return this.deps.find().find(row => row.agentId === saved?.agentId)?.engine ?? saved?.engine ?? null+ }++ learningScope(): string | null {+ const saved = this.saved()+ return saved?.learningScope ?? saved?.agentId ?? null+ }+/** Fresh context for the verified collection agent's next real user turn. Never a synthetic turn. */context(agentId: string): string | null {const daemonId = this.deps.pairedDaemon()@@ -342,6 +372,9 @@ export class PairHarness {const agentId = this.activeAgentId ?? this.saved()?.agentIdconst row = agentId ? this.deps.find().find((r) => r.agentId === agentId) : nullif (!agentId || row?.status !== 'live') { this.unwatch(); return false }+ // An empty/setup terminal has no conversation to resume. Pausing it discards its selected model+ // and strands a pending memory review; leave it open until a real conversation can be preserved.+ if (row.hasConversation === false) return falseif (this.deps.working(agentId) || this.deps.now() - this.lastActivity < (this.deps.idleMs ?? PAIR_IDLE_MS)) return falsetry {await this.deps.stop(agentId)@@ -378,24 +411,25 @@ export class PairHarness {if (this.timer) { clearInterval(this.timer); this.timer = null }}- private saved(): Saved | null {+ private saved(engine?: PairEngine): Saved | null {try {const value = JSON.parse(readFileSync(this.deps.stateFile, 'utf8')) as Record<string, unknown>const members = this.members()const collections = Array.isArray(value.collections) ? value.collections : []+ const matches = (row: Saved): boolean => !engine || (row.engine ?? this.deps.find().find(item => item.agentId === row.agentId)?.engine) === enginefor (const item of collections.toReversed()) {const row = this.readSaved(item)- if (row?.members?.some(uid => members.includes(uid))) return row+ if (row?.members?.some(uid => members.includes(uid)) && matches(row)) return row}// Adopt the selected individual's existing chat on the first open. Keep every other// legacy pointer (and all engine transcripts) as an archive, never combine transcripts.const legacy = this.conversations()const selected = this.deps.pairedUid?.()- if (selected && members.includes(selected) && legacy[selected]) return legacy[selected]+ if (selected && members.includes(selected) && legacy[selected] && matches(legacy[selected])) return legacy[selected]const current = this.readSaved(value)- if (current?.uid && members.includes(current.uid)) return current- if (!this.deps.collectionUids && !selected && !current?.members) return current- return Object.values(legacy).reverse().find(row => row.uid && members.includes(row.uid)) ?? null+ if (current?.uid && members.includes(current.uid) && matches(current)) return current+ if (!this.deps.collectionUids && !selected && !current?.members && current && matches(current)) return current+ return Object.values(legacy).reverse().find(row => row.uid && members.includes(row.uid) && matches(row)) ?? null} catch {return null}@@ -407,6 +441,8 @@ export class PairHarness {return typeof row.agentId === 'string' && /^[A-Za-z0-9_-]{1,128}$/.test(row.agentId) && typeof row.revision === 'string'? { agentId: row.agentId, revision: row.revision, ...(typeof row.uid === 'string' ? { uid: row.uid } : {}),...(Array.isArray(row.members) ? { members: row.members.filter(uid => typeof uid === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(uid)) } : {}),+ ...(['claude', 'codex'].includes(row.engine ?? '') ? { engine: row.engine } : {}),+ ...(typeof row.learningScope === 'string' && /^[A-Za-z0-9_-]{1,128}$/.test(row.learningScope) ? { learningScope: row.learningScope } : {}),} : null}diff --git a/cli/src/pair/startupProfile.spec.ts b/cli/src/pair/startupProfile.spec.tsnew file mode 100644index 000000000..c0e8b276f--- /dev/null+++ b/cli/src/pair/startupProfile.spec.ts@@ -0,0 +1,158 @@+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import type { RegisteredSession } from '../lib/registry.js'+import { parseRuntimeProfile, readStartupProfile, RuntimeProfileManager } from '../lib/runtimeProfile.js'+import { CompanionStartupProfile } from './startupProfile.js'+import { CompanionIntelligence } from './intelligence.js'+import { ConversationReview } from './learn/conversationReview.js'+import { LessonDistiller } from './learn/distill.js'+import { LessonStore } from './learn/store.js'++let directory: string+beforeEach(() => {+ directory = mkdtempSync(join(tmpdir(), 'companion-startup-'))+ mkdirSync(join(directory, '.claude'))+ writeFileSync(join(directory, '.claude', 'settings.local.json'), '{"effortLevel":"default"}')+})+afterEach(() => { rmSync(directory, { recursive: true, force: true }) })++const CLAUDE_READY = [+ ' ▐▛███▛█ Claude Code v2.1.285',+ '▝▜██████▀ Opus 5.5 · Claude Max',+ ' ▝▝ ▝▝ ~/collection',+ '', '─────────────────────────────────',+ '❯\u00a0Try "edit <filepath> to..."',+ '─────────────────────────────────',+ ' ⏵⏵ auto mode on (shift+tab to cycle) · ← for agents',+].join('\n')++function session(extra: Partial<RegisteredSession> = {}): RegisteredSession {+ return { schemaVersion: 2, active: true, launch: { state: 'ready' }, agentId: 'companion', sessionId: '',+ engine: 'claude', boundAt: null, transcriptPath: null, projectDir: '', cwd: directory,+ tmuxPane: '%1', source: null, title: null, model: null, cliVersion: null,+ runtimes: [{ backend: 'tmux', paneId: '%1' }], primaryRuntimeKey: 'tmux\u0000%1',+ processIdentity: { pid: 1234, executable: '/bin/claude', startMarker: 'first-start' },+ registeredAt: 1, touchedAt: 1, lastHookAt: 1, lastTranscriptAt: 1, ...extra }+}++describe('companion readiness before its first message', () => {+ it('reads the actual Claude startup banner and effective effort without an engine session ID', async () => {+ const value = session()+ expect(parseRuntimeProfile(await readStartupProfile(value, CLAUDE_READY))).toMatchObject({+ sessionId: 'companion', engine: 'claude', model: 'opus', effort: 'auto',+ })+ writeFileSync(join(directory, '.claude', 'settings.local.json'), '{"effortLevel":"xhigh"}')+ expect(parseRuntimeProfile(await readStartupProfile(value, CLAUDE_READY))?.effort).toBe('xhigh')+ expect(parseRuntimeProfile(await readStartupProfile(value,+ CLAUDE_READY.replace('Opus 5.5', 'Sonnet 5.5 with low effort')))).toMatchObject({ model: 'sonnet', effort: 'low' })+ expect(parseRuntimeProfile(await readStartupProfile(value,+ CLAUDE_READY + '\n⎿ Set model to Sonnet 5.5\n❯ '))?.model).toBe('sonnet')+ // The ordinary cache still refuses the shared empty engine-session ID.+ const profiles = new RuntimeProfileManager()+ profiles.ingestPane(value, CLAUDE_READY)+ expect(profiles.selectedModel(value)).toBeNull()+ expect(value.sessionId).toBe('')+ })++ it('does not mistake setup dialogs, unknown models or other providers for readiness', async () => {+ for (const pane of [+ CLAUDE_READY.replace('❯\u00a0Try "edit <filepath> to..."', '❯ 1. Yes, I trust this folder'),+ CLAUDE_READY + '\nPlease sign in to continue',+ CLAUDE_READY.replace('Opus 5.5 · Claude Max', 'Unknown subscription'),+ CLAUDE_READY.replace('❯\u00a0Try "edit <filepath> to..."', ''),+ ]) expect(await readStartupProfile(session(), pane)).toBeNull()+ expect(await readStartupProfile(session({ gateway: 'ori' }), CLAUDE_READY)).toBeNull()+ expect(await readStartupProfile(session({ active: false }), CLAUDE_READY)).toBeNull()+ expect(await readStartupProfile(session({ sessionId: 'now-bound' }), CLAUDE_READY)).toBeNull()+ })++ it('reads the Codex model and effort only at its ready prompt', async () => {+ const value = session({ engine: 'codex', codexHome: '/profiles/companion' })+ const pane = 'OpenAI Codex (v0.144.5)\n› Implement a feature\n gpt-5.6-terra xhigh · 100% context left'+ expect(parseRuntimeProfile(await readStartupProfile(value, pane))).toMatchObject({+ sessionId: 'companion', engine: 'codex', model: 'gpt-5.6-terra', effort: 'xhigh',+ })+ expect(await readStartupProfile(value, pane.replace('› Implement a feature', '› 1. Sign in with ChatGPT'))).toBeNull()+ })++ it('expires evidence and isolates agents, process restarts, homes, and newly bound conversations', async () => {+ let current: RegisteredSession | null = session(), now = 1_000+ const capture = vi.fn(async () => CLAUDE_READY)+ const observer = new CompanionStartupProfile({ current: () => current, capture, now: () => now })+ await observer.refresh()+ const original = current+ expect(observer.selected(original)?.profile).toContain(':claude:opus@auto')+ for (const replacement of [+ session({ agentId: 'other' }),+ session({ processIdentity: { ...original.processIdentity!, startMarker: 'reused-pid' } }),+ session({ codexHome: '/another/account' }),+ session({ sessionId: 'first-conversation' }),+ session({ active: false }),+ session({ launch: { state: 'starting' } }),+ null,+ ]) {+ current = replacement+ expect(observer.selected(original)).toBeNull()+ if (replacement) expect(observer.selected(replacement)).toBeNull()+ }+ current = original; now += 45_001+ expect(observer.selected(original)).toBeNull()+ await observer.refresh()+ expect(observer.selected(original)).not.toBeNull()+ capture.mockRejectedValueOnce(new Error('pane unavailable'))+ await observer.refresh()+ expect(observer.selected(original)).toBeNull()+ })++ it('discards a capture that finishes after the companion changes', async () => {+ let current = session(), finish!: (pane: string) => void+ const observer = new CompanionStartupProfile({ current: () => current,+ capture: () => new Promise(resolve => { finish = resolve }) })+ const pending = observer.refresh()+ current = session({ agentId: 'other' })+ finish(CLAUDE_READY); await pending+ expect(observer.selected(current)).toBeNull()+ })++ it('fills an unknown bound profile from the banner without overriding a later model choice', async () => {+ const value = session({ sessionId: 'conversation' }), profiles = new RuntimeProfileManager()+ await profiles.ingestConfig(value, true)+ profiles.ingestPane(value, CLAUDE_READY, true)+ expect(parseRuntimeProfile(profiles.selectedModel(value))).toMatchObject({ model: 'opus', effort: 'auto' })+ profiles.ingest(value, JSON.stringify({ type: 'assistant', message: { model: 'claude-sonnet-5-5' } }), true)+ profiles.ingestPane(value, CLAUDE_READY, true)+ expect(parseRuntimeProfile(profiles.selectedModel(value))?.model).toBe('sonnet')+ })++ it('resumes a queued history review into pending memories without sending a first message', async () => {+ const value = session(), now = Date.now()+ const observer = new CompanionStartupProfile({ current: () => value, capture: async () => CLAUDE_READY })+ const run = vi.fn(async () => ({ text: JSON.stringify({ lessons: [{ sources: ['1'],+ reason: 'The person specified the editor layout.',+ lesson: { kind: 'note', lines: ['Keep DSH viewers on the left and the agent terminal on the right.'] },+ }] }) }))+ const intelligence = new CompanionIntelligence({ enabled: () => true,+ current: () => ({ agentId: value.agentId, sessionId: value.sessionId, engine: value.engine,+ stopped: false, profile: null, startup: observer.selected(value) }),+ directory, stateFile: join(directory, 'intelligence.json'), run })+ const store = new LessonStore({ root: join(directory, 'lessons'), now: () => now, git: null })+ const distiller = new LessonDistiller({ oneshot: intelligence.run, modelEnabled: () => intelligence.ready(), now: () => now })+ const review = new ConversationReview({ directory, scope: () => value.agentId, pairedDaemon: () => 'tim',+ intelligence: () => intelligence.status(), store, distiller, now: () => now, cwd: () => null, machine: () => 'Desk',+ turns: () => ({ more: false, indexing: 0, rows: [{ agentId: 'work', sessionId: 'work-chat', engine: 'claude',+ cwd: '/code/app', title: 'Editor layout', turn: 1, at: now - 1_000, tools: '',+ ask: 'Keep the viewer on the left and the agent terminal on the right.', answer: 'I will keep that split.' }] }) })+ review.start(24)+ expect(review.status()).toMatchObject({ state: 'waiting', reviewed: 0, error: 'no-model' })+ expect(run).not.toHaveBeenCalled()+ await observer.refresh()+ await review.tick()+ expect(review.status()).toMatchObject({ state: 'complete', reviewed: 1, proposed: 1 })+ expect(run).toHaveBeenCalledWith('claude', expect.objectContaining({ model: 'opus' }))+ expect(store.pending()).toHaveLength(1)+ expect(store.approved()).toHaveLength(0)+ expect(value.sessionId).toBe('')+ })+})diff --git a/cli/src/pair/startupProfile.ts b/cli/src/pair/startupProfile.tsnew file mode 100644index 000000000..7290037be--- /dev/null+++ b/cli/src/pair/startupProfile.ts@@ -0,0 +1,52 @@+import type { RegisteredSession } from '../lib/registry.js'+import { readStartupProfile } from '../lib/runtimeProfile.js'+import { processIdentityKey } from '../lib/terminalRuntime.js'++export interface StartupProfile { processKey: string; profile: string }++interface StartupDeps {+ current: () => RegisteredSession | null+ capture: (agentId: string) => Promise<string | null>+ read?: typeof readStartupProfile+ now?: () => number+}++/** Only the current companion's live, pre-conversation process can supply this short-lived evidence. */+export class CompanionStartupProfile {+ private observed: (StartupProfile & { expires: number }) | null = null+ private refreshing = false+ constructor(private readonly deps: StartupDeps) {}++ private key(session: RegisteredSession | null): string | null {+ if (!session || session.sessionId || !session.active || !session.processIdentity?.startMarker ||+ session.launch?.state === 'starting' || session.launch?.state === 'failed' ||+ !['claude', 'codex'].includes(session.engine) || session.grid || session.gridLaunch || session.gateway) return null+ return JSON.stringify([session.agentId, processIdentityKey(session.engine, session.processIdentity),+ session.primaryRuntimeKey, session.cwd, session.codexHome ?? null])+ }++ selected(session: RegisteredSession): StartupProfile | null {+ const key = this.key(session)+ if (!key || key !== this.key(this.deps.current()) || key !== this.observed?.processKey ||+ this.observed.expires <= (this.deps.now?.() ?? Date.now())) return null+ return { processKey: key, profile: this.observed.profile }+ }++ async refresh(): Promise<void> {+ if (this.refreshing) return+ const session = this.deps.current(), key = this.key(session)+ if (!session || !key) { this.observed = null; return }+ this.refreshing = true+ try {+ const pane = await this.deps.capture(session.agentId)+ const profile = pane ? await (this.deps.read ?? readStartupProfile)(session, pane) : null+ // Capturing a pane and reading configuration are async. Never attach their result to a new agent.+ this.observed = key === this.key(this.deps.current()) && profile+ ? { processKey: key, profile, expires: (this.deps.now?.() ?? Date.now()) + 45_000 } : null+ } catch {+ this.observed = null+ } finally {+ this.refreshing = false+ }+ }+}diff --git a/daemons/LEARNING.md b/daemons/LEARNING.mdindex 1b853d918..197ee9b4f 100644--- a/daemons/LEARNING.md+++ b/daemons/LEARNING.md@@ -67,6 +67,19 @@ on the machine is working — or after an hour regardless. One signal becomes at**Before the DSH is ready:** observations wait. Opening Companions and completing its real agent setupsupplies the learning engine, model, and effort; changing the agent's model changes learning too.+The companion home's **Powered by** menu explicitly selects Codex or Claude Code.+That choice is remembered per collection, without a Claude-first default for new+collections or automatic provider fallback. Engine conversations remain separate;+the persisted observation queue, history-review window, and deduplication state use+one stable collection key, retained when changing engines. An explicit switch can+retry a provider quota wait with the newly selected engine once it is ready. It+does not bypass the hourly cap or revive cancelled/completed reviews.+The ready CLI banner can supply that profile before the first message binds a conversation. This+startup observation is scoped to the live agent and process, refreshed every 15 seconds, and expires+after 45 seconds without a successful read. It is never saved as an empty conversation or reused by+another process; a dummy first message is not required.+An agent without a conversation is not automatically paused by the idle timer, since there is no+conversation to resume. Explicit stop and experimental-off still stop it.Experimental-off and watching consent remain the gates. The legacy `pair.jsonc.model` field is nolonger a separate intelligence switch. An observed profile is retained for that conversation's idlepause, never borrowed from another agent or account. Custom provider connections without a supporteddiff --git a/desktop/AGENTS.md b/desktop/AGENTS.mdindex 6d9bd3a6a..d8654d75c 100644--- a/desktop/AGENTS.md+++ b/desktop/AGENTS.md@@ -7,6 +7,11 @@ For all UI outside terminal panes, follow theMac-friendly direction supersedes earlier BIOS, fixed-cell, bracket-button,and all-monospace presentation rules.+Every app icon follows the [icon system](design/icon-design-system.md).+Use the shared catalogue and pane variants; run `python3 scripts/audit-icons.py`+from `desktop/` after changing icons. Review the full rendered catalogue when+changing shared icon geometry, weight or size.+Keep terminal content and terminal interaction intact. Pane boundaries arecovered by [terminal-workspace.md](design/terminal-workspace.md); shared dialogbehavior and data ownership by [terminal-dialogs.md](design/terminal-dialogs.md)diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.mdindex 856640854..40a996083 100644--- a/desktop/CLAUDE.md+++ b/desktop/CLAUDE.md@@ -41,7 +41,7 @@ flutter test # whole unit/widget suite (tesflutter test test/terminal_session_test.dart # one fileflutter test test/ws_conn_test.dart --plain-name "reconnects" # one test by name substringflutter run -d macos # or: flutter run -d linux-flutter build macos --debug+bash scripts/build-macos-debug.sh # pins the host's release rendererflutter build macos --releaseflutter build linux --release # Ubuntu build host only — no cross-compiling```@@ -58,7 +58,15 @@ creation and machine-link responses. They refuse to run without `FLUTTER_TEST=1`production-only pollers and persistence. The workspace fixture exercises the native macOS titlebar; its injectedFlutter keys do not establish physical AppKit keyboard/IME behavior. A fixture build replaces`Harness.app`, so rebuild the normal review artifact afterward with-`flutter build macos --debug --no-pub --target lib/main.dart`.+`bash scripts/build-macos-debug.sh --no-pub --target lib/main.dart`.++**Local macOS renderer:** Intel review builds need Skia, just like the Intel release.+Plain `flutter build macos --debug` leaves Impeller enabled and can produce invisible+bitmap artwork on Intel. The script above pins the built bundle's renderer and re-signs+it so Finder launches work too; Apple Silicon keeps Impeller. For `flutter run` and+native integration tests on Intel, add `--no-enable-impeller`. Check companion artwork+on the real renderer with `integration_test/companion_art_native_test.dart`; headless+image tests alone do not catch this failure.Local stack / E2E scripts (the CLI comes from this repo's `../cli`; the backend from a sibling`autonomous-code` checkout next to `autonomous-harness` — override with `AUTONOMOUS_CODE_ROOT` /@@ -303,8 +311,9 @@ its headless debug timings do not establish native display or network latency.with subscription usage remaining at the bottom left and focused machine/repo/branch/PR at the bottom right.Tabs center their name/status group without permanent number prefixes; Command replacesthe status with the resolved shortcut beside the name. Tab and pane close marks are small- and quiet, with larger click targets. Each pane places its model control before its- always-visible close icon. Usage has no dot separators and colors only low/exhausted+ and quiet, with larger click targets. Each pane ends with model, split down,+ split right, zoom, close. Split opens New Harness directly for the clicked pane.+ Usage has no dot separators and colors only low/exhaustedpercentages. Automatic names use the strongest shared harness type,project, or machine, preferring traits that distinguish tabs and excluding dependent viewers.The context follows a viewer's owner and uses the compact project label, never a worktree pathdiff --git a/desktop/README.md b/desktop/README.mdindex e8d431bcb..e11caff1d 100644--- a/desktop/README.md+++ b/desktop/README.md@@ -171,11 +171,16 @@ Useful validation commands:```bashdart analyze-flutter build macos --debug+bash scripts/build-macos-debug.shflutter build macos --releaseflutter build linux --release # must run on an Ubuntu host — no cross-compiling```+The macOS debug script uses the same renderer as the host's release build: Skia on+Intel, Impeller on Apple Silicon. It also pins that choice for opening `Harness.app`+directly. On Intel, add `--no-enable-impeller` to `flutter run` and native integration+test commands; the default renderer can make bitmap artwork disappear.+The terminal core is vendored at `third_party/xterm`. Do not replace it with anupstream package upgrade without preserving the local rendering and IME fixes.diff --git a/desktop/design/companions.md b/desktop/design/companions.mdindex a1241f146..ea70185c0 100644--- a/desktop/design/companions.md+++ b/desktop/design/companions.md@@ -46,7 +46,14 @@ computer; this is not cross-machine memory sync.-Opening the home starts or resumes the existing pair DSH through a UI-only local+The header's **Powered by** menu chooses Codex or Claude Code for the collection.+A new collection asks the person to choose; there is no Claude-first default or+automatic fallback when usage runs out. Existing collections keep their agent.+The choice stays visible across Story, Collection and Memories, and moves below+the title in a narrow viewer. Selecting an uninstalled agent explains which one+is missing and keeps the current choice.++Opening the home starts or resumes the selected pair DSH through a UI-only localsocket request, without a prompt, pasted text or Enter key. The complete engineconversation appears in the right pane. First-time login, folder trust and toolpermission prompts are visible and interactive there, like any other DSH. No@@ -54,7 +61,13 @@ separate Pair tab or full-conversation button is needed. No trust prompt isauto-accepted. The experiment being off, or a background restored tab, cannotstart an engine.-One persistent DSH workspace and conversation serves the owned collection.+One selected DSH serves the owned collection. Each engine keeps its own+conversation; switching back resumes that engine's history. Saved lessons and the+pending review queue remain with the collection across engine changes. An explicit+switch clears the old provider's quota wait, but never bypasses the local hourly+review budget or restarts a cancelled review. A working turn must finish or be+stopped before switching. No synthetic prompt is sent to initialize an agent.+Switching companions keeps the same terminal, conversation, model and sharedlessons; the selected character's context updates on the next real user prompt.Each individual retains its own name, story, appearance and growth. Existingdiff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.mdindex 3168f52d8..fbd2535ef 100644--- a/desktop/design/desktop-design-system.md+++ b/desktop/design/desktop-design-system.md@@ -164,12 +164,21 @@ of the native footer. Popovers have no independent full-window veil.## Icons+The [icon design system](icon-design-system.md) defines the complete vocabulary,+size roles, state treatment, deliberate exceptions and audit workflow.+`AppIcons` owns one monochrome outline vocabulary: the regular (400) Lucidefamily with rounded ends and joins. Use its named constants, never raw Materialicons, alternate stroke weights or text characters for app actions. A closebutton always uses `AppIcons.close`; plus, search, back, disclosure, folder,branch and check retain one silhouette everywhere.+Small pane split/zoom controls use the shared `AppPaneIcon` optical variants:+the same 24-unit grid, two-unit outline and round caps, with four-unit corners+so their rounding remains visible at 14 points. This includes Restore. The+close mark remains the unchanged Lucide ×; keep this adjustment in the shared+icon implementation, not in individual pane widgets.+Use 16-point icons beside text, 20 for standalone controls, and 24 for a featureillustration. Center the drawing optically inside its role's target; icon-onlycontrols retain a 32-point target and a descriptive tooltip/accessibility label.@@ -202,6 +211,7 @@ dots remain solid at their intended size; color is accompanied by status text.| Tab upper corner / outward lower shoulder | 10 / 8 || Tab top inset | 6 || Tab close target inset from outer bounds | 8 |+| Pane close target trailing inset | 4 || Dialog content inset | 24 || Group / control gap | 16 / 8 || Menu inset | 6 |@@ -265,7 +275,9 @@ are different states; keep existing results visible while refreshing.the “Harness anything” prompt; model, approvals and profile below; Worktree andbranch together.The dialog is frameless over its veil. New Tab uses the same width on the page.-Machine stays inside the repo search row.+Agent and project capsules use an opaque neutral surface beneath their state+tints, so workspace text never shows through them. Machine stays inside the+repo search row.**Welcome and New Tab hierarchy** — creation is primary. Show at most six rowsunder “Recent harnesses”, separated from creation controls by 56 points. Use@@ -314,12 +326,19 @@ inner edge beneath their 1-point rim. Only their frame changes: terminal contentinput, selection and status typography remain the terminal's own. AppKit mirrorsthese shared geometry values; Flutter uses AppDesktop directly.-**Pane header** — the current model is a quiet text control immediately before-an always-visible close icon at the right edge. Clicking the model focuses that+**Pane header** — the right-hand controls read model, split down, split right,+zoom, close. Use the rounded 14-point `AppPaneIcon` split/zoom variants and the+shared 12-point close glyph in 28-point targets. The close target sits 4 points+inside the header's trailing edge. Resting ink is 45%; hover and keyboard focus+brighten the glyph without a fill, border, or movement. Keep the controls on one+line; model and title text truncate before icon targets shrink. Zoom becomes+Restore while enlarged. Unavailable controls stay in place with disabled ink.+Split opens New Harness directly, inheriting the clicked pane's agent, machine,+and project; the pane is created only after submission. Clicking the model focuses thatpane and opens the same Models picker as Cmd-:. Selection stays bound to thatharness; a closed or replaced pane cannot receive a stale selection. Long modelnames truncate and retain their full-name tooltip. Keep effort in the terminal,-and keep the close target clear at narrow widths. Tab-strip close behavior is+and keep the icon targets clear at narrow widths. Tab-strip close behavior isseparate and remains hover-revealed.**Focused workspace footer** — remaining subscription usage at the left,@@ -330,8 +349,8 @@ pane headers. Do not repeat model or effort in the footer. Context honors Customstatus face, fields, colors and shell/Powerline treatment. Recent-harnesscontext uses that same renderer's monochrome presentation to stay secondary.Use compact labels such as “Claude 0% Codex 50%”, separated by whitespace only.-Provider names stay neutral. Color only the remaining percentage: red at 0%,-amber above 0% through 20%, neutral above 20% or when unavailable. Use shared+Provider names stay neutral. Color only the remaining percentage: quiet amber+from 0% through 20%, neutral above 20% or when unavailable. Use sharedsemantic ink adjusted to remain readable on the selected workspace surface;the number always conveys the state independently of color. These percentages areremaining, not used. Use the same deduplicated accounts, limiting window anddiff --git a/desktop/design/friendly-desktop-experiment.md b/desktop/design/friendly-desktop-experiment.mdindex 280a863e9..a03394beb 100644--- a/desktop/design/friendly-desktop-experiment.md+++ b/desktop/design/friendly-desktop-experiment.md@@ -28,7 +28,7 @@ Desktop 1.2.27 and must not be merged without the user's approval.so the unframed labels remain readable. Cmd-P retains its floating frame.Both use system typography and visible focus boundaries without shifting controls.- Agent and Repo are compact capsule selectors above the editor, with the- agent's existing brand mark and Close at the right. The always-visible message+ agent's existing brand mark, opaque neutral fills, and Close at the right. The always-visible messageeditor says “Harness anything”; New Harness sits inside its lower-right corner,works without a message, and has no visible Return symbol.Model, Approvals, and Codex Profile sit below the composer on the left;diff --git a/desktop/design/icon-design-system.md b/desktop/design/icon-design-system.mdnew file mode 100644index 000000000..be84ed86b--- /dev/null+++ b/desktop/design/icon-design-system.md@@ -0,0 +1,157 @@+# Harness icon system++This is the icon contract for the desktop app on macOS, Linux and Windows,+and the web UI built from `desktop/lib`. It applies to every screen, dialog,+menu, picker, toolbar and workspace control. Use it with the+[desktop design system](desktop-design-system.md).++## Character++Quiet, precise, rounded outlines. Symbols support the content and remain+recognizable when repeated across many panes. Use one stroke weight, rounded+ends and joins, and an optically centered drawing. Never stretch an icon or+change its weight on hover. Rounding should soften a shape without losing its+meaning: a warning triangle remains a triangle, a chevron remains a chevron.++## Source of truth++- `lib/shared/theme/app_icons.dart` names the regular **400** Lucide symbols.+ Import `AppIcons`; never import Lucide directly from a screen, use raw+ Material/Cupertino icons, or substitute a text character for a control.+- `AppPaneIcon` supplies the approved small split, zoom and restore outlines.+ They use a **24-unit grid, 2-unit stroke, 4-unit corners**, with round caps+ and joins. Use the same drawings in pane headers, menus and search preview+ controls. `reload` and `close` delegate to the canonical Lucide glyphs.+- `AgentActionIcons.create` is plus; `.open` is the diagonal arrow. A search+ lens means searching, not creating. Close always resolves to `AppIcons.close`.+- AppKit controls use `HarnessControlSymbols`: regular monochrome SF Symbols+ at the shared 16-point size. Native menu items and the title bar share this+ factory. Native tab close is the optically matched 8-point regular `xmark`.++Add a missing semantic symbol to the catalogue, then reuse it. Do not create+a local font alias or duplicate a drawing. A new optical variant belongs in+the shared implementation and must be reviewed beside the existing family.++## Size and targets++| Role | Drawing size | Target |+| --- | --- | --- |+| Workspace close | 12 pt | Existing 28 pt pane / native tab target |+| Dense pane actions and metadata | 14 pt | 28 pt for pane actions |+| Inline actions, compact menus, ordinary selectors | 16 pt | 32 pt when independently clickable |+| Roomy picker rows, labeled buttons, dialog dismiss | 18 pt | Shared control/row target |+| Global toolbar or standalone navigation | 20 pt | At least 32 pt |+| Feature/empty-state mark | 24 pt | Inert unless explicitly an action |++Choose a role, not an arbitrary 13, 15, 17 or 19-point size. A small glyph does+not mean a small click target. Keep the target fixed on hover, focus, selection+and disablement. Platform text scaling may grow the containing control; terminal+font size never changes the surrounding app icons. Identity artwork and+illustrations have their own layout dimensions.++The pane close target has a 4-point trailing inset. Tabs retain their 8-point+inset. Glyphs stay centered inside the target; do not move the drawing itself+to compensate for excess container padding.++## Ink and state++- Use semantic theme ink or `IconTheme`. An ordinary icon is monochrome and+ follows its label. Active menu rows use the selected row's foreground.+- Pane controls rest at 45% foreground, or 70% with Increase Contrast.+ Hover and keyboard focus restore full ink. Disabled controls use 22%, or+ 45% with Increase Contrast. They have no extra fill, border or movement.+- Other icon buttons use `AppIconButton` and its shared rounded hover/focus+ treatment. Do not reproduce a slightly different button in each panel.+- Keep a selected state legible without color: checkmarks, labels and shape+ changes carry meaning. Zoom becomes Restore; loading can animate only while+ work is actually pending, respecting Reduce Motion.+- Reserve red for errors and destructive actions. Workspace subscription+ allowance at **0–20%** uses quiet amber (`AppPalette.usageLow`), including+ exhausted allowance. Names and healthy/unknown percentages stay neutral.+ The figure and tooltip explain the limit; color is secondary. The same+ contrast-adjusted ink is sent to Flutter and the native footer.++## Deliberate exceptions++These are content or identities, not a second action-icon library:++- Agent/provider/product marks retain their authentic artwork and color.+ Codex and Claude should be distinguishable at a glance. Use `EngineMark`+ and the existing model identity renderer; keep letters only as the existing+ unknown-identity fallback.+- GitHub PR state marks retain the shared Primer assets and state silhouettes+ (open, draft, closed, merged), along with status text. The GitHub logo is a+ brand mark. Neither is a substitute for generic action glyphs.+- `AppRatingStar` uses a rounded outline and proportional fill to encode a+ number. Layout thumbnails use the real pane geometry. Connection dots,+ progress indicators and activity marks encode state.+- QR codes, companion artwork, explanatory diagrams, wallpaper, terminal+ output and user-selected status/Powerline artwork are content. Keep their+ function and authorship; do not round QR modules or replace terminal glyphs.++## Accessibility++Every icon-only action has a descriptive tooltip and accessible name. Keep+the label on the enclosing button and exclude duplicate decorative semantics.+Keyboard activation, disabled state and focus remain owned by the existing+control. Icons embedded in text do not create additional Tab stops. Show full+tooltip text when the associated label truncates.++## Review and prevention++Run from the repository root:++```sh+python3 desktop/scripts/audit-icons.py --output /tmp/harness-icons.json+```++This scans **all first-party Dart files**, including the web UI and Linux+menus, and reports every catalogue reference and source location. It fails+on direct Material/Cupertino/Lucide references and non-regular catalogue+weights. The icon catalogue widget test also checks this source contract.++Render the full catalogue from `desktop/`:++```sh+HARNESS_ICON_CAPTURE_DIR=/tmp/harness-icon-review \+ flutter test --no-pub test/icon_catalog_render_test.dart+```++The renderer reads every catalogue entry, including unused entries, from the+actual installed icon font. It includes all pane variants, in light and dark+appearances, at 14/16/20/24 points. Inspect every page at actual size. Review+changed symbols in their real screens too: dense grids, menus, long labels,+hover/focus/disabled states, Increase Contrast and text scaling. A contact+sheet does not replace interaction checks.++## Audit record — 2026-09-30++Reviewed the complete catalogue, all custom painters and SVG call sites,+native menu/title-bar symbols and every icon-bearing desktop/web surface.+The source inventory covers 492 Dart files and 143 shared symbols, alongside+native SF Symbols. Rendered every catalogue entry and native symbol in light+and dark; checked pane grids, Companions and Settings in context.++Corrected Material icons in Companions, wallpaper settings and the web tab+menu; 300/default-weight Lucide references in Linux menus, compact Settings,+web navigation and tab close; incidental odd-sized control glyphs; the old+SVG toolbar renderer; and the separate viewer toolbar treatment. Native+application-menu icons now use the same regular-symbol configuration as other+native menus. Brand, PR, quantitative and content exceptions above were+reviewed and retained deliberately.++Validation: 241 targeted widget tests pass, including keyboard/mouse menu+behavior, pane creation/zoom/close, viewer controls, companion memories,+enlarged Settings text, attachment handling, sharing/header placement,+notification grouping, tab scrolling and+subscription contrast across workspace palettes. Linux window controls,+web share badges and tab scroller arrows also use the shared catalogue.+First-party app code and the changed tests pass static analysis.++Review captures use synthetic fixtures: [repeated pane controls](review/2026-09-30-pane-icons.png),+[subscription allowance](review/2026-09-30-usage-ink.png) and+[companion engine selection](review/2026-09-30-companion-engine.png).++The historical toolbar SVG assets are still bundled for existing identity+references; app toolbar controls now render catalogue symbols. New UI must+not use those legacy assets as action icons.diff --git a/desktop/design/new-harness-entry-rules.md b/desktop/design/new-harness-entry-rules.mdindex 941d89e27..1f0d154f7 100644--- a/desktop/design/new-harness-entry-rules.md+++ b/desktop/design/new-harness-entry-rules.md@@ -40,7 +40,7 @@ Opening, searching, and cancelling never send input to an existing harness.| Cmd-T, then Cmd-N | Last explicit agent, local machine, last selected project on that machine | The blank tab opened by Cmd-T || Cmd-Shift-P → New Harness | Last explicit agent, local machine, last selected project on that machine | Current tab || Cmd-N or the New Harness command | Last explicit agent, local machine, last selected project on that machine; retain explicit task and destination | Current tab unless its source requests a new tab |-| Explicit pane split | Focused pane's defaults | Requested split in that tab |+| Pane-header split, Split Right/Down command, or shortcut | Opens creation directly with the clicked/focused pane's agent, machine, and project | Requested split in that tab after submission || Store New Harness, or a product's Open action in the pane or native Models menu | Explicit product and machine; suggested project named for that product | New tab || Store Resume Harness | Existing harness and its machine; choose from a menu when several match | Focus its existing tab or reopen a view of the same harness || Store Try this prompt | Same as Open, with the example as the editable task | New tab |diff --git a/desktop/design/review/2026-09-30-companion-engine.png b/desktop/design/review/2026-09-30-companion-engine.pngnew file mode 100644index 000000000..7569d09f0Binary files /dev/null and b/desktop/design/review/2026-09-30-companion-engine.png differdiff --git a/desktop/design/review/2026-09-30-pane-icons.png b/desktop/design/review/2026-09-30-pane-icons.pngnew file mode 100644index 000000000..f6c3d1d85Binary files /dev/null and b/desktop/design/review/2026-09-30-pane-icons.png differdiff --git a/desktop/design/review/2026-09-30-usage-ink.png b/desktop/design/review/2026-09-30-usage-ink.pngnew file mode 100644index 000000000..d58469706Binary files /dev/null and b/desktop/design/review/2026-09-30-usage-ink.png differdiff --git a/desktop/design/terminal-workspace.md b/desktop/design/terminal-workspace.mdindex e0bce261e..2dee2639c 100644--- a/desktop/design/terminal-workspace.md+++ b/desktop/design/terminal-workspace.md@@ -31,8 +31,11 @@ retain their notification bell. Show a count badge only when something is unreadTooltips explain icon actions and resolve shortcuts from the live keymap.The footer shows remaining subscription usage on the left. Its right-hand context follows the focused pane: machine, project, branch, and PR-at the right. Each pane header shows its model immediately before an always-visible-close icon. Clicking the model opens the shared Models picker for that harness;+at the right. Each pane header ends with model, split down, split right, zoom,+and close, in that order. The icons stay visible with quiet ink and no button+chrome. Splitting opens New Harness directly with that pane's agent, machine,+and project, then creates into the chosen split on submission. Clicking the+model opens the shared Models picker for that harness;the footer does not repeat model or effort. Do not show worktree implementationpaths in everyday labels. User-selected shell/Powerline status styles remainavailable, including PR state colors and the option to disable color.diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.mdindex 81fbdafa8..3cf62fca2 100644--- a/desktop/design/workspace-status-bar.md+++ b/desktop/design/workspace-status-bar.md@@ -140,8 +140,9 @@ use the shared system-type scale.## Pane controls-Each pane header shows its model immediately before an always-visible × at the-right edge. Tab and pane close marks share a small regular glyph (12-point+Each pane header ends with model, split down, split right, zoom and × at the+right edge. The 14-point split/zoom glyphs and 12-point close glyph each have a+28-point target, with no resting fill or border. Tab and pane close marks share a small regular glyph (12-pointLucide, optically matched 10-point SF Symbol) and quiet 45% resting ink, withfull ink on hover/focus and the existing larger clicktargets. The close control removes that pane view while keeping its harness@@ -157,7 +158,7 @@ uses the limiting window and expires under the same rules. Different accountsremain distinct. Unknown usage shows “—”; exhausted usage shows “0%”. Hoverexplains remaining percentages and reset windows; click opens Subscriptions.Separate accounts with whitespace, without dot separators. Provider names stay-neutral; only percentages carry warning ink: red at zero, amber through 20%,+neutral; only percentages carry quiet amber ink from zero through 20%,neutral above 20% or when unavailable. Resolve the same readable colors for theFlutter and native footers against the chosen workspace background.No account or usage reading is invented for this footer.@@ -177,14 +178,16 @@ while offline, but do not advertise switching when it is disabled.A model update must repaint the label without reopening or retargeting the pane.The observed subscription model does not select a Local row in the picker.-Zoom and Stop remain keyboard/menu actions. Cmd-Shift-W closes the focused pane+Zoom is also available in the header and becomes Restore while enlarged.+Stop remains a keyboard/menu action. Cmd-Shift-W closes the focused paneview, Cmd-W closes the tab, and Cmd-Enter toggles pane zoom. Closing a viewkeeps its harness running; Stop Harness remains a separate command with itsexisting confirmation. Preserve explicit user keymap overrides.-Pane edges have no floating split buttons. Split Right and Split Down remain-keyboard commands (Cmd-R and Cmd-D by default), with File menu and command-search-access. Keep the resize gaps available for resizing.+Pane edges have no floating split buttons. Split Right and Split Down use the+header, keyboard commands (Cmd-R and Cmd-D by default), File menu, and command+search. All open New Harness directly with the source pane's defaults, without+an existing-harness search step. Keep the resize gaps available for resizing.Settings → Experimental → Share button is off by default on desktop and web.The choice persists locally and updates the bar immediately; when off, no buttondiff --git a/desktop/integration_test/companion_art_native_test.dart b/desktop/integration_test/companion_art_native_test.dartnew file mode 100644index 000000000..85af43b00--- /dev/null+++ b/desktop/integration_test/companion_art_native_test.dart@@ -0,0 +1,134 @@+import 'dart:io';+import 'dart:ui' as ui;++import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/core/test_run.dart';+import 'package:harness/daemons/illustrated_art.dart';+import 'package:harness/daemons/illustrated_image.dart';+import 'package:harness/daemons/individuals.dart';+import 'package:harness/daemons/roster.dart';+import 'package:harness/widgets/daemon_illustration.dart';+import 'package:integration_test/integration_test.dart';+import 'package:window_manager/window_manager.dart';++// Real native decoding/painting: headless tests passed while Impeller on Intel+// produced transparent images. Use the release renderer for the test host:+// FLUTTER_TEST=1 flutter test -d macos --no-pub \+// integration_test/companion_art_native_test.dart+// Add --no-enable-impeller on Intel. COMPANION_ART_CAPTURE_DIR optionally saves+// the rendered grids. Only synthetic companions are mounted; no CLI or zoo IO.+void main() {+ if (!kUnderTest) {+ throw StateError('Companion fixtures require FLUTTER_TEST=1');+ }+ IntegrationTestWidgetsFlutterBinding.ensureInitialized().framePolicy =+ LiveTestWidgetsFlutterBindingFramePolicy.onlyPumps;+ setUpAll(() async {+ await windowManager.ensureInitialized();+ await windowManager.setSize(const Size(1200, 920));+ await windowManager.setAlwaysOnTop(true);+ await windowManager.show();+ await windowManager.focus();+ });+ tearDownAll(() => windowManager.setAlwaysOnTop(false));++ for (final version in ['0.1', '1.0', '2.0']) {+ testWidgets('all companions at $version paint on the native renderer', (+ tester,+ ) async {+ final page = GlobalKey();+ final shots = <String, GlobalKey>{};+ final art = <String, IllustratedArt>{+ for (final id in IllustratedArt.species) ...{+ '$id original': IllustratedArt.daemon(id, version: version),+ '$id individual': IllustratedArt.daemon(+ id,+ version: version,+ traits: rollTraits(daemonRoster, id, 42),+ ),+ },+ };+ await tester.pumpWidget(+ RepaintBoundary(+ key: page,+ child: MaterialApp(+ theme: ThemeData.dark(),+ debugShowCheckedModeBanner: false,+ home: Scaffold(+ backgroundColor: const Color(0xff202020),+ body: Wrap(+ children: [+ for (final entry in art.entries)+ Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(entry.key),+ RepaintBoundary(+ key: shots[entry.key] = GlobalKey(),+ child: DaemonIllustration(+ art: entry.value,+ size: 180,+ ),+ ),+ ],+ ),+ ],+ ),+ ),+ ),+ ),+ );+ for (final entry in art.entries) {+ final a = entry.value;+ final ImageProvider provider = a.styled+ ? IllustratedImage(a.asset(0), a.colour, a.mark)+ : AssetImage(a.asset(0));+ await precacheImage(+ provider,+ shots[entry.key]!.currentContext!,+ ).timeout(const Duration(seconds: 15));+ }+ await tester.pumpAndSettle();+ for (final entry in shots.entries) {+ final boundary =+ entry.value.currentContext!.findRenderObject()+ as RenderRepaintBoundary;+ final shot = await boundary.toImage();+ try {+ final pixels = (await shot.toByteData(+ format: ui.ImageByteFormat.rawRgba,+ ))!.buffer.asUint8List();+ var opaque = 0;+ for (var i = 3; i < pixels.length; i += 4) {+ if (pixels[i] > 200) opaque++;+ }+ expect(+ opaque,+ greaterThan(500),+ reason: '${entry.key} at $version must paint visible artwork',+ );+ } finally {+ shot.dispose();+ }+ }+ final captureDir = Platform.environment['COMPANION_ART_CAPTURE_DIR'];+ if (captureDir != null) {+ final shot =+ await (page.currentContext!.findRenderObject()+ as RenderRepaintBoundary)+ .toImage();+ try {+ final png = await shot.toByteData(format: ui.ImageByteFormat.png);+ final file = File('$captureDir/companion-art-$version.png');+ await file.parent.create(recursive: true);+ await file.writeAsBytes(png!.buffer.asUint8List());+ } finally {+ shot.dispose();+ }+ }+ expect(tester.takeException(), isNull);+ });+ }+}diff --git a/desktop/lib/companions/companion_dial.dart b/desktop/lib/companions/companion_dial.dartindex 698d1751f..d06e07a0f 100644--- a/desktop/lib/companions/companion_dial.dart+++ b/desktop/lib/companions/companion_dial.dart@@ -1,3 +1,4 @@+import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';import '../daemons/illustrated_art.dart';@@ -127,7 +128,7 @@ class CompanionDial extends StatelessWidget {),),icon: Icon(- syncing ? Icons.sync_rounded : Icons.favorite_outline_rounded,+ syncing ? AppIcons.refreshCw : AppIcons.heart,size: 16,),label: Text(@@ -159,11 +160,7 @@ class CompanionDial extends StatelessWidget {children: [Row(children: [- Icon(- Icons.radio_button_checked_rounded,- size: 19,- color: AppColors.textSoft,- ),+ Icon(AppIcons.circleDot, size: 20, color: AppColors.textSoft),const SizedBox(width: 10),Expanded(child: Text(diff --git a/desktop/lib/companions/companion_engine_picker.dart b/desktop/lib/companions/companion_engine_picker.dartnew file mode 100644index 000000000..fc6a34b67--- /dev/null+++ b/desktop/lib/companions/companion_engine_picker.dart@@ -0,0 +1,112 @@+import 'package:harness/shared/theme/app_icons.dart';+import 'package:flutter/material.dart';++import '../shared/widgets/app_menu.dart';+import '../theme/app_theme.dart';+import '../widgets/engine_identity.dart';+import '../widgets/transient_menus.dart';++/// The collection's agent. Models and permissions remain in its real terminal.+class CompanionEnginePicker extends StatefulWidget {+ const CompanionEnginePicker({+ super.key,+ required this.engine,+ required this.onSelected,+ this.busy = false,+ });++ final String? engine;+ final ValueChanged<String>? onSelected;+ final bool busy;++ static String label(String engine) =>+ engine == 'claude' ? 'Claude Code' : 'Codex';++ @override+ State<CompanionEnginePicker> createState() => _CompanionEnginePickerState();+}++class _CompanionEnginePickerState extends State<CompanionEnginePicker> {+ final _menu = MenuController();+ final _trigger = FocusNode();+ final _choices = {'codex': FocusNode(), 'claude': FocusNode()};+ VoidCallback? _unregister;++ @override+ void dispose() {+ _unregister?.call();+ _trigger.dispose();+ for (final focus in _choices.values) {+ focus.dispose();+ }+ super.dispose();+ }++ @override+ Widget build(BuildContext context) => Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ 'Powered by',+ style: Theme.of(context).textTheme.bodySmall+ ?.copyWith(color: AppColors.textSoft),+ ),+ const SizedBox(width: 4),+ MenuAnchor(+ controller: _menu,+ childFocusNode: _trigger,+ onOpen: () {+ _unregister = registerTransientMenu(_menu.close);+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted && _menu.isOpen) {+ (_choices[widget.engine] ?? _choices['codex'])!.requestFocus();+ }+ });+ },+ onClose: () {+ _unregister?.call();+ _unregister = null;+ },+ menuChildren: [+ for (final choice in ['codex', 'claude'])+ AppMenuItem(+ label: CompanionEnginePicker.label(choice),+ leading: EngineMark(engine: choice),+ selected: widget.engine == choice,+ focusNode: _choices[choice],+ onPressed: () {+ _menu.close();+ widget.onSelected?.call(choice);+ },+ ),+ ],+ builder: (context, controller, child) => TextButton(+ key: const ValueKey('companion-engine-picker'),+ focusNode: _trigger,+ onPressed: widget.busy || widget.onSelected == null+ ? null+ : () =>+ controller.isOpen ? controller.close() : controller.open(),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (widget.engine != null) ...[+ EngineMark(engine: widget.engine, size: 16),+ const SizedBox(width: 7),+ ],+ Text(+ widget.busy+ ? 'Opening…'+ : widget.engine == null+ ? 'Choose agent'+ : CompanionEnginePicker.label(widget.engine!),+ ),+ const SizedBox(width: 4),+ const Icon(AppIcons.chevronDown, size: 16),+ ],+ ),+ ),+ ),+ ],+ );+}diff --git a/desktop/lib/companions/companion_home.dart b/desktop/lib/companions/companion_home.dartindex 9034e9d55..715af151b 100644--- a/desktop/lib/companions/companion_home.dart+++ b/desktop/lib/companions/companion_home.dart@@ -1,3 +1,5 @@+import 'package:harness/shared/theme/app_icons.dart';+import 'dart:async';import 'dart:math' as math;@@ -16,6 +18,7 @@ import '../state/dial_status.dart';import '../theme/app_theme.dart';import '../widgets/daemon_illustration.dart';import 'companion_dial.dart';+import 'companion_engine_picker.dart';import 'companion_story.dart';import 'memory_review_text.dart';@@ -31,6 +34,8 @@ class CompanionHome extends StatefulWidget {required this.onHatch,required this.onOpenControls,this.onOpenConversation,+ this.onSelectEngine,+ this.openingTerminal = false,this.terminalStatus,this.dial,this.onDeviceSettings,@@ -40,6 +45,8 @@ class CompanionHome extends StatefulWidget {final ValueChanged<ZooEgg> onHatch;final ValueChanged<String> onOpenControls;final VoidCallback? onOpenConversation;+ final ValueChanged<String>? onSelectEngine;+ final bool openingTerminal;final String? terminalStatus;final DialState? dial;final void Function(String, Map<String, Object?>)? onDeviceSettings;@@ -59,6 +66,7 @@ class _CompanionHomeState extends State<CompanionHome> {final _memoryViewport = GlobalKey();late final _lessons = DaemonLessons(widget.brain)..addListener(_changed);Timer? _memoryRefresh;+ String? _lastPairEngine;ZooController get zoo => widget.face.zoo;ZooDaemon? get individual =>_previewSpecies != null ? null : zoo.zoo.byUid(_viewingUid) ?? zoo.paired;@@ -74,10 +82,17 @@ class _CompanionHomeState extends State<CompanionHome> {zoo.addListener(_changed);widget.face.addListener(_changed);widget.brain.addListener(_changed);+ _lastPairEngine = widget.brain.pairEngine;}void _changed() {- if (mounted) setState(() {});+ if (!mounted) return;+ final engineChanged = _lastPairEngine != widget.brain.pairEngine;+ _lastPairEngine = widget.brain.pairEngine;+ setState(() {});+ if (engineChanged && _section == 'Memories' && !_lessons.busy) {+ unawaited(_lessons.refresh());+ }}TextStyle ink([double size = 14, Color? color]) => TextStyle(@@ -177,28 +192,41 @@ class _CompanionHomeState extends State<CompanionHome> {color: AppColors.background,child: LayoutBuilder(builder: (context, constraints) {+ final enginePicker = CompanionEnginePicker(+ engine: widget.brain.pairEngine,+ onSelected: widget.onSelectEngine,+ busy: widget.openingTerminal,+ );final viewer = Column(children: [Padding(padding: const EdgeInsets.fromLTRB(28, 20, 18, 14),- child: Row(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,children: [- Expanded(- child: Text(- 'Companions',- style: ink(17).copyWith(fontWeight: FontWeight.w600),- ),- ),- IconButton(- tooltip: 'Companion settings',- key: const ValueKey('companion-settings'),- onPressed: () => widget.onOpenControls('settings'),- icon: Icon(- Icons.tune_rounded,- size: 19,- color: AppColors.textSoft,- ),+ Row(+ children: [+ Expanded(+ child: Text(+ 'Companions',+ style: ink(17)+ .copyWith(fontWeight: FontWeight.w600),+ ),+ ),+ if (constraints.maxWidth >= 500) enginePicker,+ IconButton(+ tooltip: 'Companion settings',+ key: const ValueKey('companion-settings'),+ onPressed: () => widget.onOpenControls('settings'),+ icon: Icon(+ AppIcons.slidersHorizontal,+ size: 20,+ color: AppColors.textSoft,+ ),+ ),+ ],),+ if (constraints.maxWidth < 500) enginePicker,],),),@@ -313,9 +341,7 @@ class _CompanionHomeState extends State<CompanionHome> {_button(isPaired ? 'By your side' : 'Make my companion',isPaired ? null : () => zoo.pair(daemon.uid),- icon: isPaired- ? Icons.favorite_outline_rounded- : Icons.favorite_border_rounded,+ icon: AppIcons.heart,primary: true,key: const ValueKey('companion-pair'),),@@ -327,13 +353,13 @@ class _CompanionHomeState extends State<CompanionHome> {_renameError = null;_renaming = true;}),- icon: Icons.edit_outlined,+ icon: AppIcons.pencil,),if (daemon == null)_button('Collection preview',null,- icon: Icons.auto_awesome_outlined,+ icon: AppIcons.sparkles,primary: true,),],@@ -464,7 +490,7 @@ class _CompanionHomeState extends State<CompanionHome> {_button('Meet the collection',() => _selectSection('Collection'),- icon: Icons.arrow_forward_rounded,+ icon: AppIcons.arrowRight,),],);@@ -692,7 +718,7 @@ class _CompanionHomeState extends State<CompanionHome> {_button(_exploring ? 'Hide the gallery' : 'Meet all ten companions',() => setState(() => _exploring = !_exploring),- icon: Icons.auto_awesome_outlined,+ icon: AppIcons.sparkles,),if (_exploring) ...[const SizedBox(height: 10),@@ -796,7 +822,7 @@ class _CompanionHomeState extends State<CompanionHome> {const SizedBox(height: 28),if (widget.brain.active) ...[_memoryCard(- Icons.history_rounded,+ AppIcons.history,history?.title ?? 'A little time to look back',history?.detail ?? 'Your recent conversations can hold the beginnings of a useful memory. Review the last 24 hours on this computer with your companion’s chosen model.',),@@ -816,12 +842,13 @@ class _CompanionHomeState extends State<CompanionHome> {? 'Retry review': 'Look back over 24 hours',_lessons.busy ||+ _lessons.learning?.state == 'unopened' ||(history?.active == true && history?.canRetry != true)? null: () => unawaited(_lessons.reviewRecent()),key: const ValueKey('memory-review-recent'),primary: true,- icon: Icons.history_rounded,+ icon: AppIcons.history,),if (history?.active == true)_button(@@ -858,13 +885,13 @@ class _CompanionHomeState extends State<CompanionHome> {)else if (learned.isEmpty && _lessons.learning == null)_memoryCard(- Icons.auto_stories_outlined,+ AppIcons.bookOpen,'Room for a first memory','When a useful lesson is proposed and you approve it, it will appear here. No memories are invented.',),if (widget.brain.active && _lessons.learning != null) ...[_memoryCard(- Icons.auto_stories_outlined,+ AppIcons.bookOpen,_lessons.learning!.title,_lessons.learning!.detail,),@@ -965,7 +992,7 @@ class _CompanionHomeState extends State<CompanionHome> {],if (d != null) ...[_memoryCard(- Icons.wb_sunny_outlined,+ AppIcons.sun,'The day you met',date == null? '${companionName(d)} joined your collection.'@@ -973,7 +1000,7 @@ class _CompanionHomeState extends State<CompanionHome> {),const SizedBox(height: 12),_memoryCard(- Icons.favorite_border_rounded,+ AppIcons.heart,'A bond that keeps growing','${d.xp} XP together · ${companionAge(d.version)}',),@@ -985,7 +1012,7 @@ class _CompanionHomeState extends State<CompanionHome> {_button('Refresh memories',_lessons.busy ? null : () => unawaited(_lessons.refresh()),- icon: Icons.refresh_rounded,+ icon: AppIcons.refreshCw,),],);@@ -1098,7 +1125,7 @@ class _CompanionHomeState extends State<CompanionHome> {: _lessons.approveReviewed,key: ValueKey('memory-approve-${lesson.id}'),primary: true,- icon: Icons.check_rounded,+ icon: AppIcons.check,)else_button(@@ -1135,7 +1162,7 @@ class _CompanionHomeState extends State<CompanionHome> {child: Row(crossAxisAlignment: CrossAxisAlignment.start,children: [- Icon(icon, size: 23, color: accentInk),+ Icon(icon, size: 24, color: accentInk),const SizedBox(width: 16),Expanded(child: Column(@@ -1178,7 +1205,7 @@ class _CompanionHomeState extends State<CompanionHome> {'Meet your companion',() => widget.onHatch(egg),primary: true,- icon: Icons.auto_awesome_outlined,+ icon: AppIcons.sparkles,)else_button(diff --git a/desktop/lib/daemons/daemon_brain.dart b/desktop/lib/daemons/daemon_brain.dartindex b7296278b..d0fa138ed 100644--- a/desktop/lib/daemons/daemon_brain.dart+++ b/desktop/lib/daemons/daemon_brain.dart@@ -819,6 +819,7 @@ class DaemonBrain extends ChangeNotifier {DateTime? _talkRetryAt;Timer? _talkRetryTimer;String? _pairAgentId;+ String? _pairEngine;String? _conversationScope, _companionUid;int _conversationGeneration = 0;bool _historyLoading = false;@@ -866,6 +867,7 @@ class DaemonBrain extends ChangeNotifier {/// The pair harness's agent id on this computer, once a talk reached it.String? get pairAgentId => _pairAgentId;+ String? get pairEngine => _pairEngine;/// The talk so far, oldest first: what you said and what it answered.List<DaemonTalkEntry> get talk => List.unmodifiable(_talk);@@ -885,7 +887,10 @@ class DaemonBrain extends ChangeNotifier {_talkPhase = DaemonTalkPhase.idle;_talkNeedsSetup = false;_talkError = null;- if (!sameCollection || uid == null) _pairAgentId = null;+ if (!sameCollection || uid == null) {+ _pairAgentId = null;+ _pairEngine = null;+ }_talk.clear();_heardReplies.clear();notifyListeners();@@ -1038,7 +1043,10 @@ class DaemonBrain extends ChangeNotifier {case 'daemon_state':_state = DaemonBrainState.fromJson(payload);final harness = payload['companionHarness'];- if (harness is Map) _pairAgentId = _opt(harness['agentId']);+ if (harness is Map) {+ _pairAgentId = _opt(harness['agentId']);+ _pairEngine = _opt(harness['engine']);+ }notifyListeners();case 'daemon_say':final say = DaemonSay.fromJson(payload);@@ -1264,16 +1272,20 @@ class DaemonBrain extends ChangeNotifier {/// Opening a DSH starts/resumes its terminal without sending any words or/// Enter key. Trust, login and permissions remain in the engine's own UI.- Future<Map<String, dynamic>> openConversation() async {+ Future<Map<String, dynamic>> openConversation({String? engine}) async {final generation = _conversationGeneration;final uid = _companionUid;if (uid == null) return {'ok': false, 'error': 'PAIR_OFF'};- final result = await _requestFrame('daemon_open', {'companionUid': uid});+ final result = await _requestFrame('daemon_open', {+ 'companionUid': uid,+ 'engine': ?engine,+ });if (_disposed || generation != _conversationGeneration) {return {'ok': false, 'error': 'STALE_COMPANION'};}if (result['ok'] == true) {_pairAgentId = _opt(result['agentId']);+ _pairEngine = _opt(result['engine']) ?? _pairEngine;notifyListeners();}return result;@@ -1456,6 +1468,7 @@ class DaemonBrain extends ChangeNotifier {_talkRetryTimer = null;_talkRetryAt = null;_pairAgentId = null;+ _pairEngine = null;_talk.clear();if (!_disposed) notifyListeners();}diff --git a/desktop/lib/daemons/daemon_lessons.dart b/desktop/lib/daemons/daemon_lessons.dartindex 2860bac81..c3a8e1a95 100644--- a/desktop/lib/daemons/daemon_lessons.dart+++ b/desktop/lib/daemons/daemon_lessons.dart@@ -150,7 +150,7 @@ class DaemonHistoryReview {return '$reviewed of $total conversation turns reviewed. The rest will continue when the hourly review allowance resets.';}if (state == 'waiting' && error == 'usage-limit') {- return 'Your chosen model has reached its usage limit. Your conversations are queued and we’ll check again later. You can also choose another model in the agent pane, then retry this review.';+ return 'Your chosen agent has reached its usage limit. Your conversations stay queued. Choose another agent above or retry later.';}if (state == 'failed') {return 'The review could not finish. Your progress and any proposed lessons are kept. Retry to continue.';@@ -222,6 +222,9 @@ class DaemonLearning {if (state == 'unsupported') {return 'Background learning cannot use this agent connection yet. Your conversation and approved lessons are kept.';}+ if (state == 'unopened') {+ return 'Choose Codex or Claude Code above to power your companion and its memories.';+ }if (state != 'ready') {return 'Finish setting up the agent on the right. Learning follows the model you choose there.';}diff --git a/desktop/lib/models/models_panel.dart b/desktop/lib/models/models_panel.dartindex 6939a44f3..ec80e17af 100644--- a/desktop/lib/models/models_panel.dart+++ b/desktop/lib/models/models_panel.dart@@ -197,7 +197,7 @@ class _ModelsPanelState extends State<ModelsPanel> with SectionWakes {),prefixIcon: Icon(AppIcons.search,- size: 15,+ size: 16,color: AppPalette.textFaint,),prefixIconConstraints: const BoxConstraints(@@ -623,7 +623,7 @@ class _ModelsPanelState extends State<ModelsPanel> with SectionWakes {: () => unawaited(controller.toggle(model)),icon: Icon(icon,- size: 17,+ size: 16,semanticLabel: '$action ${model.name}',),style: IconButton.styleFrom(@@ -793,7 +793,7 @@ class LocalModelInvitation extends StatelessWidget {tooltip: 'Dismiss',onPressed: () =>unawaited(controller.dismissIntroduction()),- icon: const Icon(AppIcons.close, size: 17),+ icon: const Icon(AppIcons.close, size: 16),),],),diff --git a/desktop/lib/orchestrator/orchestrator_workspace.dart b/desktop/lib/orchestrator/orchestrator_workspace.dartindex 671c9d426..7f571e285 100644--- a/desktop/lib/orchestrator/orchestrator_workspace.dart+++ b/desktop/lib/orchestrator/orchestrator_workspace.dart@@ -122,7 +122,7 @@ class _OrchestratorWorkspaceState extends State<OrchestratorWorkspace> {children: [Icon(AppIcons.sparkles,- size: 17,+ size: 16,color: grid.AppPalette.swarmAccent,),const SizedBox(width: 10),diff --git a/desktop/lib/screens/login_screen.dart b/desktop/lib/screens/login_screen.dartindex 9dabdb102..dc98317ee 100644--- a/desktop/lib/screens/login_screen.dart+++ b/desktop/lib/screens/login_screen.dart@@ -575,7 +575,7 @@ class _Seal extends StatelessWidget {Row(mainAxisAlignment: MainAxisAlignment.center,children: [- Icon(AppIcons.lock, size: 13, color: grid.AppPalette.teal),+ Icon(AppIcons.lock, size: 14, color: grid.AppPalette.teal),const SizedBox(width: 8),Text('End-to-end encrypted',diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex c413171e8..763abc9fd 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -2755,19 +2755,19 @@ class _SwarmScreenState extends State<SwarmScreen> {? app.projectHistory.selected(id) ??app.projectHistory.recent(id).firstOrNull: null);+ final inherited = agent?.engine;if (!newHarnessOpensInBox) {await _newAgentForm(machineId: id,folder: initialFolder,swarmId: target,split: requestedSplit,- engine: engine,+ engine: engine ?? (isTerminalEngine(inherited) ? null : inherited),placement: placement,task: task ?? fallbackTask,);return;}- final inherited = agent?.engine;final embedded =source == _NewHarnessSource.workspace &&requestedSplit == null &&@@ -3329,10 +3329,18 @@ class _SwarmScreenState extends State<SwarmScreen> {}}- Future<void> _splitAgent(PaneResizeAxis axis) async {- final split = app.preparePaneSplit(axis);+ Future<void> _splitAgent(PaneResizeAxis axis, {int? paneId}) async {+ if (app.activeSwarm.isUtility || app.activeSwarm.isOrchestrator) return;+ final split = app.preparePaneSplit(axis, paneId: paneId);if (split == null) return;- _openSearch(adding: true, split: split);+ // Header actions belong to the clicked pane, even if its neighbor held+ // the keyboard. The shared creation flow inherits that pane's context.+ app.focusPane(split.paneId);+ await _newAgent(+ swarmId: split.swarmId,+ split: split,+ stillCurrent: () => app.isPaneSplitCurrent(split),+ );}Future<void> _showHistory() async {@@ -3833,16 +3841,18 @@ class _SwarmScreenState extends State<SwarmScreen> {unawaited(_openCompanionTerminal(key));}- Future<void> _openCompanionTerminal(String key) async {- final result = await _brain.openConversation();+ Future<void> _openCompanionTerminal(String key, {String? engine}) async {+ final result = await _brain.openConversation(engine: engine);if (!mounted || _companionOpeningKey != key) return;_companionOpeningKey = null;if (key != '${_zoo.scope}:${_zoo.paired?.uid}' || !_creatureEnabled) return;if (result['ok'] != true) {_companionTerminalError = switch (result['error']) {+ 'ENGINE_REQUIRED' => null,'UNSUPPORTED' => 'Update Harness CLI to open the companion terminal.','NO_ENGINE' =>- 'Install Claude Code or Codex to talk with your companion.',+ result['detail'] as String? ??+ 'Install Claude Code or Codex to talk with your companion.',_ =>result['detail'] as String? ??'The terminal could not connect. Try opening it again.',@@ -3852,12 +3862,28 @@ class _SwarmScreenState extends State<SwarmScreen> {_scheduleCompanionWorkspace();}+ void _selectCompanionEngine(String engine) {+ final uid = _zoo.paired?.uid;+ if (uid == null || _companionOpeningKey != null || _zoo.isPreview) return;+ final key = '${_zoo.scope}:$uid';+ setState(() {+ _companionAttemptedKey = key;+ _companionOpeningKey = key;+ _companionTerminalError = null;+ });+ unawaited(_openCompanionTerminal(key, engine: engine));+ }+Widget _companionViewer(BuildContext context) => CompanionHome(key: ValueKey('companion-home:${_zoo.scope}'),face: _face,brain: _brain,onHatch: _hatch,onOpenControls: _openCompanionControls,+ onSelectEngine: _zoo.isPreview || !_brain.active || _zoo.paired == null+ ? null+ : _selectCompanionEngine,+ openingTerminal: _companionOpeningKey != null,terminalStatus:_companionTerminalError ??(_companionOpeningKey != null@@ -6083,10 +6109,14 @@ class _SwarmScreenState extends State<SwarmScreen> {return app.panes.length > 1 && app.zoomedPaneId == null;}if (id == 'pane.split_right') {- return app.preparePaneSplit(PaneResizeAxis.x) != null;+ return !app.activeSwarm.isUtility &&+ !app.activeSwarm.isOrchestrator &&+ app.preparePaneSplit(PaneResizeAxis.x) != null;}if (id == 'pane.split_down') {- return app.preparePaneSplit(PaneResizeAxis.y) != null;+ return !app.activeSwarm.isUtility &&+ !app.activeSwarm.isOrchestrator &&+ app.preparePaneSplit(PaneResizeAxis.y) != null;}if (id == 'pane.reset_sizes') {return app.activeSwarm.paneSizes.keys.any(@@ -6574,6 +6604,13 @@ class _SwarmScreenState extends State<SwarmScreen> {notifier: app,swarmMode: true,onOpenModels: _openPaneModels,+ onSplitPane: (paneId, axis) =>+ unawaited(+ _splitAgent(+ axis,+ paneId: paneId,+ ),+ ),companionViewer:_creatureEnabled &&_zoo.loaded@@ -7248,7 +7285,7 @@ class _SwarmScreenState extends State<SwarmScreen> {height: workspaceBarControlHeight(context),child: Icon(AppIcons.search,- size: 17,+ size: 16,color: theme.foreground.withValues(alpha: !_shortcutsEnabled? .28diff --git a/desktop/lib/settings/appearance/wallpaper_section.dart b/desktop/lib/settings/appearance/wallpaper_section.dartindex 7ebc136d6..15a651883 100644--- a/desktop/lib/settings/appearance/wallpaper_section.dart+++ b/desktop/lib/settings/appearance/wallpaper_section.dart@@ -297,7 +297,7 @@ class _CustomCardState extends State<_CustomCard> {mainAxisSize: MainAxisSize.min,children: [Icon(- Icons.add_photo_alternate_outlined,+ AppIcons.imagePlus,color: grid.AppPalette.textSecondary,),const SizedBox(height: 6),diff --git a/desktop/lib/settings/sections/debug_log_tile.dart b/desktop/lib/settings/sections/debug_log_tile.dartindex 7e3a0a2f2..831f57ee3 100644--- a/desktop/lib/settings/sections/debug_log_tile.dart+++ b/desktop/lib/settings/sections/debug_log_tile.dart@@ -78,7 +78,7 @@ class _DebugLogTileState extends State<DebugLogTile> {child: _hovered? Icon(AppIcons.chevronRight,- size: 15,+ size: 16,color: AppPalette.textSecondary,): null,@@ -135,24 +135,24 @@ class DebugStatusIcon extends StatelessWidget {),LogStatus.ok => Icon(AppIcons.circleCheck,- size: 15,+ size: 16,color: AppPalette.online,),LogStatus.failed => Icon(AppIcons.circleAlert,- size: 15,+ size: 16,color: debugDangerInk(context),),LogStatus.warned => Icon(AppIcons.triangleAlert,- size: 15,+ size: 16,color: AppPalette.warn,),// An ordinary line the app chose to write. A dot, not a tick: it did not// succeed at anything, it happened.LogStatus.event => Icon(AppIcons.dot,- size: 15,+ size: 16,color: AppPalette.textFaint,),};diff --git a/desktop/lib/settings/sections/debug_paths_card.dart b/desktop/lib/settings/sections/debug_paths_card.dartindex 6e00e312d..adc03077f 100644--- a/desktop/lib/settings/sections/debug_paths_card.dart+++ b/desktop/lib/settings/sections/debug_paths_card.dart@@ -72,7 +72,7 @@ class _DebugPathsCardState extends State<DebugPathsCard> {children: [Row(children: [- Icon(AppIcons.terminal, size: 15, color: AppPalette.textFaint),+ Icon(AppIcons.terminal, size: 16, color: AppPalette.textFaint),const SizedBox(width: 8),Expanded(child: Text(diff --git a/desktop/lib/settings/sections/debug_section.dart b/desktop/lib/settings/sections/debug_section.dartindex 3a53ea2fe..d9dad553a 100644--- a/desktop/lib/settings/sections/debug_section.dart+++ b/desktop/lib/settings/sections/debug_section.dart@@ -125,7 +125,7 @@ class _DebugSectionState extends State<DebugSection> {).copyWith(prefixIcon: Icon(AppIcons.search,- size: 15,+ size: 16,color: AppPalette.textFaint,),prefixIconConstraints: const BoxConstraints(diff --git a/desktop/lib/settings/sections/debug_toolbar.dart b/desktop/lib/settings/sections/debug_toolbar.dartindex 1424aaee0..866a87f9d 100644--- a/desktop/lib/settings/sections/debug_toolbar.dart+++ b/desktop/lib/settings/sections/debug_toolbar.dart@@ -134,7 +134,7 @@ class DebugPillLabel extends StatelessWidget {return Row(mainAxisSize: MainAxisSize.min,children: [- Icon(icon, size: 13, color: ink),+ Icon(icon, size: 14, color: ink),const SizedBox(width: 6),Text(label, style: AppType.label(color: ink)),],diff --git a/desktop/lib/settings/sections/usage_panels.dart b/desktop/lib/settings/sections/usage_panels.dartindex 70b2f90a9..2aee3fbe0 100644--- a/desktop/lib/settings/sections/usage_panels.dart+++ b/desktop/lib/settings/sections/usage_panels.dart@@ -6,7 +6,6 @@/// handed — none reads a store — so the pane can be driven from a fixture.library;-import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';@@ -737,7 +736,7 @@ class UsageEmptyState extends StatelessWidget {children: [Icon(AppIcons.chartNoAxesColumn,- size: 15,+ size: 16,color: AppPalette.textFaint,),const SizedBox(width: 8),diff --git a/desktop/lib/settings/settings_compact.dart b/desktop/lib/settings/settings_compact.dartindex 7cde27d13..e83da2949 100644--- a/desktop/lib/settings/settings_compact.dart+++ b/desktop/lib/settings/settings_compact.dart@@ -1,5 +1,5 @@+import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';import '../shared/layouts/widgets/sidebar_item.dart';import '../shared/theme/app_theme.dart' as grid;@@ -36,7 +36,7 @@ class SettingsCompactSection extends StatelessWidget {child: Center(child: SidebarItem(key: const Key('settings-compact-back'),- icon: LucideIcons.arrowLeft300,+ icon: AppIcons.arrowLeft,label: 'Settings',onTap: onBack,),diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dartindex d56929afc..b3b90d906 100644--- a/desktop/lib/shared/theme/app_icons.dart+++ b/desktop/lib/shared/theme/app_icons.dart@@ -14,16 +14,20 @@ abstract final class AppIcons {/// A quiet close mark in tabs and pane headers, inside the full click target.static const double closeSize = 12;+ static const aArrowDown = LucideIcons.aArrowDown400;+ static const aArrowUp = LucideIcons.aArrowUp400;static const activity = LucideIcons.activity400;static const arrowDownToLine = LucideIcons.arrowDownToLine400;static const arrowDownWideNarrow = LucideIcons.arrowDownWideNarrow400;static const arrowLeft = LucideIcons.arrowLeft400;static const arrowRight = LucideIcons.arrowRight400;+ static const arrowRightLeft = LucideIcons.arrowRightLeft400;static const arrowRightToLine = LucideIcons.arrowRightToLine400;static const arrowUp = LucideIcons.arrowUp400;static const arrowUpRight = LucideIcons.arrowUpRight400;static const bell = LucideIcons.bell400;static const bellRing = LucideIcons.bellRing400;+ static const bookOpen = LucideIcons.bookOpen400;static const bot = LucideIcons.bot400;static const box = LucideIcons.box400;static const brainCircuit = LucideIcons.brainCircuit400;@@ -56,6 +60,7 @@ abstract final class AppIcons {static const columns2 = LucideIcons.columns2400;static const command = LucideIcons.command400;static const copy = LucideIcons.copy400;+ static const copyPlus = LucideIcons.copyPlus400;static const cornerDownLeft = LucideIcons.cornerDownLeft400;static const cpu = LucideIcons.cpu400;static const database = LucideIcons.database400;@@ -66,6 +71,7 @@ abstract final class AppIcons {static const eye = LucideIcons.eye400;static const eyeOff = LucideIcons.eyeOff400;static const file = LucideIcons.file400;+ static const fileDown = LucideIcons.fileDown400;static const fileText = LucideIcons.fileText400;static const film = LucideIcons.film400;static const flaskConical = LucideIcons.flaskConical400;@@ -78,9 +84,11 @@ abstract final class AppIcons {static const gitBranch = LucideIcons.gitBranch400;static const globe = LucideIcons.globe400;static const hand = LucideIcons.hand400;+ static const heart = LucideIcons.heart400;static const history = LucideIcons.history400;static const hourglass = LucideIcons.hourglass400;static const house = LucideIcons.house400;+ static const imagePlus = LucideIcons.imagePlus400;static const info = LucideIcons.info400;static const keyboard = LucideIcons.keyboard400;static const laptop = LucideIcons.laptop400;@@ -93,6 +101,7 @@ abstract final class AppIcons {static const logIn = LucideIcons.logIn400;static const logOut = LucideIcons.logOut400;static const maximize = LucideIcons.maximize400;+ static const menu = LucideIcons.menu400;static const messageCircleQuestionMark =LucideIcons.messageCircleQuestionMark400;static const messagesSquare = LucideIcons.messagesSquare400;@@ -114,12 +123,17 @@ abstract final class AppIcons {static const power = LucideIcons.power400;static const radioTower = LucideIcons.radioTower400;static const refreshCw = LucideIcons.refreshCw400;+ static const rocket = LucideIcons.rocket400;static const rotateCcw = LucideIcons.rotateCcw400;+ static const rotateCw = LucideIcons.rotateCw400;+ static const rows2 = LucideIcons.rows2400;static const search = LucideIcons.search400;static const searchX = LucideIcons.searchX400;static const send = LucideIcons.send400;static const server = LucideIcons.server400;+ static const settings = LucideIcons.settings400;static const shapes = LucideIcons.shapes400;+ static const share = LucideIcons.share400;static const shield = LucideIcons.shield400;static const shieldCheck = LucideIcons.shieldCheck400;static const shieldOff = LucideIcons.shieldOff400;@@ -133,9 +147,11 @@ abstract final class AppIcons {static const squareTerminal = LucideIcons.squareTerminal400;static const star = LucideIcons.star400;static const starHalf = LucideIcons.starHalf400;+ static const sun = LucideIcons.sun400;static const terminal = LucideIcons.terminal400;static const trash2 = LucideIcons.trash2400;static const triangleAlert = LucideIcons.triangleAlert400;+ static const type = LucideIcons.type400;static const unlink = LucideIcons.unlink400;static const unplug = LucideIcons.unplug400;static const usb = LucideIcons.usb400;diff --git a/desktop/lib/shared/theme/app_pane_icon.dart b/desktop/lib/shared/theme/app_pane_icon.dartnew file mode 100644index 000000000..2329c5979--- /dev/null+++ b/desktop/lib/shared/theme/app_pane_icon.dart@@ -0,0 +1,99 @@+import 'dart:math' as math;++import 'package:flutter/material.dart';++import 'app_icons.dart';++enum AppPaneSymbol { splitDown, splitRight, zoom, restore, reload, close }++/// Optical variants for the small, repeated pane controls. The split and zoom+/// outlines keep Lucide's 24-unit grid, two-unit stroke and round caps, with+/// four-unit corners that remain visibly rounded at 14 points.+class AppPaneIcon extends StatelessWidget {+ const AppPaneIcon(this.symbol, {super.key, this.color, this.size = 14});++ final AppPaneSymbol symbol;+ final Color? color;+ final double size;++ @override+ Widget build(BuildContext context) {+ final glyph = switch (symbol) {+ AppPaneSymbol.close => AppIcons.close,+ AppPaneSymbol.reload => AppIcons.refreshCw,+ _ => null,+ };+ if (glyph != null) return Icon(glyph, color: color, size: size);+ final theme = IconTheme.of(context);+ final ink = color ?? theme.color ?? const Color(0xFF000000);+ return CustomPaint(+ size: Size.square(size),+ painter: _PaneIconPainter(+ symbol,+ ink.withValues(alpha: ink.a * (theme.opacity ?? 1)),+ ),+ );+ }+}++class _PaneIconPainter extends CustomPainter {+ const _PaneIconPainter(this.symbol, this.color);++ final AppPaneSymbol symbol;+ final Color color;++ @override+ void paint(Canvas canvas, Size size) {+ final stroke = Paint()+ ..color = color+ ..style = PaintingStyle.stroke+ ..strokeWidth = 2+ ..strokeCap = StrokeCap.round+ ..strokeJoin = StrokeJoin.round;+ canvas.save();+ canvas.scale(size.width / 24, size.height / 24);+ switch (symbol) {+ case AppPaneSymbol.splitDown:+ case AppPaneSymbol.splitRight:+ final outline = Path()+ ..addRRect(+ RRect.fromRectAndRadius(+ const Rect.fromLTRB(3, 3, 21, 21),+ const Radius.circular(4),+ ),+ );+ final horizontal = symbol == AppPaneSymbol.splitDown;+ outline+ ..moveTo(horizontal ? 3 : 12, horizontal ? 12 : 3)+ ..lineTo(horizontal ? 21 : 12, horizontal ? 12 : 21);+ canvas.drawPath(outline, stroke);+ case AppPaneSymbol.zoom:+ case AppPaneSymbol.restore:+ final corner = symbol == AppPaneSymbol.zoom+ ? (Path()+ ..moveTo(9, 3)+ ..lineTo(7, 3)+ ..quadraticBezierTo(3, 3, 3, 7)+ ..lineTo(3, 9))+ : (Path()+ ..moveTo(3, 9)+ ..lineTo(5, 9)+ ..quadraticBezierTo(9, 9, 9, 5)+ ..lineTo(9, 3));+ for (var i = 0; i < 4; i++) {+ canvas.drawPath(corner, stroke);+ canvas.translate(12, 12);+ canvas.rotate(math.pi / 2);+ canvas.translate(-12, -12);+ }+ case AppPaneSymbol.close:+ case AppPaneSymbol.reload:+ break; // These delegate to the catalogue's font glyphs above.+ }+ canvas.restore();+ }++ @override+ bool shouldRepaint(_PaneIconPainter oldDelegate) =>+ oldDelegate.symbol != symbol || oldDelegate.color != color;+}diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dartindex b860c0b06..b30c0e8d2 100644--- a/desktop/lib/shared/theme/app_theme.dart+++ b/desktop/lib/shared/theme/app_theme.dart@@ -343,6 +343,10 @@ abstract final class AppPalette {static Color get warn =>AppTheme.pick(const Color(0xFF9A4708), const Color(0xFFFFB020));+ /// A quiet allowance limit in workspace chrome, distinct from an app error.+ static Color get usageLow =>+ AppTheme.pick(const Color(0xFF87632A), const Color(0xFFC4A46C));+// grey dot — a state mark, so ≥3:1 in light (3.14 on Paper's search ground).static Color get offline =>AppTheme.pick(const Color(0xFF7F7E78), const Color(0xFF6E6E6E));@@ -1415,6 +1419,7 @@ abstract final class AppDesktop {static const double tabShoulder = 8;static const double tabTopInset = 6;static const double tabCloseInset = 8;+ static const double paneCloseInset = 4;static const double panelPadding = 24;static const double groupGap = 16;static const double controlGap = 8;diff --git a/desktop/lib/shared/widgets/app_icon_button.dart b/desktop/lib/shared/widgets/app_icon_button.dartindex d92072b9a..7cda7032c 100644--- a/desktop/lib/shared/widgets/app_icon_button.dart+++ b/desktop/lib/shared/widgets/app_icon_button.dart@@ -1,5 +1,6 @@import 'package:flutter/material.dart';+import '../theme/app_icons.dart';import '../theme/app_theme.dart';/// A compact icon button with the same rounded hover and focus well as the@@ -10,7 +11,7 @@ class AppIconButton extends StatefulWidget {required this.icon,required this.onPressed,this.tooltip,- this.size = 15,+ this.size = AppIcons.inlineSize,this.color,this.hoverColor,this.hoverFill,@@ -35,8 +36,8 @@ class AppIconButton extends StatefulWidget {/// it is about to be pressable again.final bool spinning;- /// Glyph size. 15 is the inline default — a ✕ that clears a field, a dismiss- /// on a row. A dialog's own close is 18, the size the app draws it at.+ /// Glyph size, independent of the 32-point target. Inline actions use 16;+ /// workspace close marks use AppIcons.closeSize inside their existing target.final double size;/// Resting ink. Defaults to [AppPalette.textSecondary].@@ -88,8 +89,7 @@ class AppIconButton extends StatefulWidget {/// A normal desktop target, independent of terminal cell size.static const double _box = 32;- /// 7 — the app's radius for a small inline button (`ghost_button.dart`,- /// `chat_header.dart`), and never rounder than the 8 of a control it sits in.+ /// The same rounded control geometry as the rest of the desktop chrome.static const double _radius = AppDesktop.fieldRadius;@overridediff --git a/desktop/lib/shared/widgets/app_menu.dart b/desktop/lib/shared/widgets/app_menu.dartindex 08789a9e3..5106cb80f 100644--- a/desktop/lib/shared/widgets/app_menu.dart+++ b/desktop/lib/shared/widgets/app_menu.dart@@ -193,15 +193,21 @@ class _AppMenuItemState extends State<AppMenuItem> {// ticked row would sit a few pixels off an unticked one.SizedBox(width: widget.metrics.iconSize,- child:- widget.leading ??- (glyph == null- ? null- : Icon(- glyph,- size: widget.metrics.iconSize,- color: tint,- )),+ child: widget.leading != null+ ? IconTheme.merge(+ data: IconThemeData(+ color: tint,+ size: widget.metrics.iconSize,+ ),+ child: widget.leading!,+ )+ : (glyph == null+ ? null+ : Icon(+ glyph,+ size: widget.metrics.iconSize,+ color: tint,+ )),),const SizedBox(width: 9),Flexible(diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex c5693b6d0..ee67ee287 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -10859,7 +10859,12 @@ class AppNotifier extends ChangeNotifier {if (focus) {target.focusedPaneId = pane.id;target.zoomedPaneId = null;- if (target == activeSwarm) selectedMachineId = machineId;+ if (target == activeSwarm) {+ selectedMachineId = machineId;+ // A manual split can grow the canvas beyond the viewport. Announce+ // its reveal just as opening an existing pane does, before notifying.+ if (split != null) _paneFocusRequest++;+ }}_dismissedLinkPrompts.remove(machineId);if (focus) machine.activeAgentId = agentId;diff --git a/desktop/lib/store/store_discover.dart b/desktop/lib/store/store_discover.dartindex 10a28bbc4..3f4a22879 100644--- a/desktop/lib/store/store_discover.dart+++ b/desktop/lib/store/store_discover.dart@@ -333,7 +333,7 @@ class _FeaturedStory extends StatelessWidget {),Icon(AppIcons.arrowRight,- size: 15,+ size: 16,color: grid.AppPalette.textSecondary,),],diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dartindex 7c0764348..114eb9191 100644--- a/desktop/lib/store/store_screen.dart+++ b/desktop/lib/store/store_screen.dart@@ -1689,7 +1689,7 @@ class _QuietLinkState extends State<_QuietLink> {widget.child ?? Text(widget.label!),if (url != null) ...[const SizedBox(width: 3),- Icon(AppIcons.arrowUpRight, size: 13, color: color),+ Icon(AppIcons.arrowUpRight, size: 14, color: color),],],),diff --git a/desktop/lib/store/store_search.dart b/desktop/lib/store/store_search.dartindex 5ebe838fc..76ceac258 100644--- a/desktop/lib/store/store_search.dart+++ b/desktop/lib/store/store_search.dart@@ -239,7 +239,7 @@ class _Field extends StatelessWidget {children: [Icon(AppIcons.search,- size: 15,+ size: 16,color: grid.AppPalette.textSecondary,),const SizedBox(width: 8),diff --git a/desktop/lib/store/store_sessions.dart b/desktop/lib/store/store_sessions.dartindex 46f32e7da..0226a533d 100644--- a/desktop/lib/store/store_sessions.dart+++ b/desktop/lib/store/store_sessions.dart@@ -161,7 +161,7 @@ class _SessionCard extends StatelessWidget {children: [const Icon(AppIcons.play,- size: 15,+ size: 16,color: Colors.white,),const SizedBox(width: 8),@@ -262,7 +262,7 @@ class _SessionCard extends StatelessWidget {foregroundColor: grid.AppPalette.accentOnSurface,),iconAlignment: IconAlignment.end,- icon: const Icon(AppIcons.arrowRight, size: 15),+ icon: const Icon(AppIcons.arrowRight, size: 16),label: const Text('Explore harness'),),],diff --git a/desktop/lib/store/store_showcase.dart b/desktop/lib/store/store_showcase.dartindex 5c7eaf912..f649fee3d 100644--- a/desktop/lib/store/store_showcase.dart+++ b/desktop/lib/store/store_showcase.dart@@ -129,7 +129,7 @@ class _ExampleBlockState extends State<_ExampleBlock> {onPressed: widget.onTry == null? null: () => widget.onTry!(example.prompt),- icon: const Icon(AppIcons.sparkles, size: 17),+ icon: const Icon(AppIcons.sparkles, size: 16),label: const Text('Try this prompt'),style: FilledButton.styleFrom(backgroundColor: grid.AppPalette.accent,@@ -150,7 +150,7 @@ class _ExampleBlockState extends State<_ExampleBlock> {entry: widget.entry,example: example,),- icon: const Icon(AppIcons.play, size: 17),+ icon: const Icon(AppIcons.play, size: 16),label: const Text('Watch recorded run'),style: OutlinedButton.styleFrom(minimumSize: const Size(0, 46),diff --git a/desktop/lib/web/shell/web_app_menu.dart b/desktop/lib/web/shell/web_app_menu.dartindex ef0aa2d0a..6624a57cd 100644--- a/desktop/lib/web/shell/web_app_menu.dart+++ b/desktop/lib/web/shell/web_app_menu.dart@@ -1,7 +1,8 @@+import 'package:harness/shared/theme/app_icons.dart';+import 'dart:async';import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';import '../../shared/theme/app_theme.dart' as grid;import '../../shared/theme/workspace_bar_style.dart';@@ -46,8 +47,8 @@ class WebAppMenuButton extends StatelessWidget {width: widthOf(context),height: workspaceBarControlHeight(context),child: Icon(- LucideIcons.menu,- size: 17,+ AppIcons.menu,+ size: 16,color: theme.foreground.withValues(alpha: !enabled? .28diff --git a/desktop/lib/web/tabs/web_tab_menu.dart b/desktop/lib/web/tabs/web_tab_menu.dartindex 09d745899..51560f751 100644--- a/desktop/lib/web/tabs/web_tab_menu.dart+++ b/desktop/lib/web/tabs/web_tab_menu.dart@@ -1,3 +1,4 @@+import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';import '../../state/app_state.dart';@@ -83,7 +84,7 @@ List<Widget> webTabMenuRows(visualDensity: VisualDensity.compact,iconSize: 16,onPressed: () => close(closeChoice),- icon: const Icon(Icons.close),+ icon: const Icon(AppIcons.close),),],),diff --git a/desktop/lib/web/tabs/web_tab_switcher.dart b/desktop/lib/web/tabs/web_tab_switcher.dartindex 4b20ab88e..a59971bfa 100644--- a/desktop/lib/web/tabs/web_tab_switcher.dart+++ b/desktop/lib/web/tabs/web_tab_switcher.dart@@ -1,7 +1,8 @@+import 'package:harness/shared/theme/app_icons.dart';+import 'dart:async';import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:xterm/xterm.dart' show TerminalTheme;import '../../shared/theme/app_theme.dart' as grid;@@ -84,7 +85,7 @@ class WebTabSwitcher extends StatelessWidget {),// An icon, not "▾": the terminal face may have no such glyph.Icon(- LucideIcons.chevronDown,+ AppIcons.chevronDown,size: 14,color: theme.foreground.withValues(alpha: .75),),diff --git a/desktop/lib/widgets/agent_drag.dart b/desktop/lib/widgets/agent_drag.dartindex 3b34c2dd4..f6aace916 100644--- a/desktop/lib/widgets/agent_drag.dart+++ b/desktop/lib/widgets/agent_drag.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import '../shared/theme/app_icons.dart';+import '../shared/theme/app_pane_icon.dart';import '../shared/theme/app_theme.dart' as grid;import '../shortcuts/app_keymap.dart';@@ -77,10 +78,25 @@ final agentDrag = ValueNotifier<AgentDragRef?>(null);/// a pane drag offers the other tiles to trade places with.final paneDragging = ValueNotifier<PaneDragRef?>(null);-class PaneCloseButton extends StatelessWidget {- const PaneCloseButton({super.key, required this.onPressed});+/// Small, quiet glyphs with a stable mouse and keyboard target. Pane controls+/// share the close button's emphasis without adding a row of button chrome.+class PaneHeaderButton extends StatelessWidget {+ const PaneHeaderButton({+ super.key,+ required this.label,+ this.command,+ required this.icon,+ this.iconSize = 14,+ this.onPressed,+ });- final VoidCallback onPressed;+ static const width = 28.0;++ final String label;+ final String? command;+ final AppPaneSymbol icon;+ final double iconSize;+ final VoidCallback? onPressed;@overrideWidget build(BuildContext context) {@@ -89,24 +105,27 @@ class PaneCloseButton extends StatelessWidget {grid.AppTheme.palette.value,terminalThemeStore.value,);- final hint = KeymapTheme.of(context)?.hint('pane.close');+ final hint = command == null+ ? null+ : KeymapTheme.of(context)?.hint(command!);return WorkspaceBarControl(- label: 'Close Pane',- tooltip: [- 'Close Pane',- if (hint != null && hint.isNotEmpty) hint,- ].join(' · '),+ label: label,+ tooltip: [label, if (hint != null && hint.isNotEmpty) hint].join(' · '),foreground: theme.foreground,onPressed: onPressed,builder: (context, emphasized) => SizedBox(- width: workspaceBarCellSizeOf(context).width * 3,+ width: width,height: workspaceBarControlHeight(context),child: Center(- child: Icon(- AppIcons.close,- size: AppIcons.closeSize,+ child: AppPaneIcon(+ icon,+ size: iconSize,color: theme.foreground.withValues(- alpha: emphasized+ alpha: onPressed == null+ ? MediaQuery.highContrastOf(context)+ ? .45+ : .22+ : emphasized? 1: MediaQuery.highContrastOf(context)? .7@@ -118,3 +137,18 @@ class PaneCloseButton extends StatelessWidget {);}}++class PaneCloseButton extends StatelessWidget {+ const PaneCloseButton({super.key, required this.onPressed});++ final VoidCallback onPressed;++ @override+ Widget build(BuildContext context) => PaneHeaderButton(+ label: 'Close Pane',+ command: 'pane.close',+ icon: AppPaneSymbol.close,+ iconSize: AppIcons.closeSize,+ onPressed: onPressed,+ );+}diff --git a/desktop/lib/widgets/api_picker_form.dart b/desktop/lib/widgets/api_picker_form.dartindex 6504d5760..970ba1dcd 100644--- a/desktop/lib/widgets/api_picker_form.dart+++ b/desktop/lib/widgets/api_picker_form.dart@@ -528,7 +528,7 @@ class ApiPickerFormState extends State<ApiPickerForm> {Icon(AppIcons.cloud, size: 16, color: DesktopChrome.muted),const SizedBox(width: 10),Expanded(child: Text(action.label)),- Icon(AppIcons.chevronRight, size: 17, color: DesktopChrome.muted),+ Icon(AppIcons.chevronRight, size: 16, color: DesktopChrome.muted),],),);diff --git a/desktop/lib/widgets/desktop_chrome.dart b/desktop/lib/widgets/desktop_chrome.dartindex 9d68b8407..095daab9a 100644--- a/desktop/lib/widgets/desktop_chrome.dart+++ b/desktop/lib/widgets/desktop_chrome.dart@@ -128,6 +128,7 @@ class DesktopPill extends StatelessWidget {this.semanticHint,this.focusNode,this.foregroundColor,+ this.surfaceColor,this.compact = false,this.quiet = false,this.capsule = true,@@ -148,6 +149,9 @@ class DesktopPill extends StatelessWidget {final String? semanticHint;final FocusNode? focusNode;final Color? foregroundColor;++ /// An opaque base for pills that float directly above workspace content.+ final Color? surfaceColor;final bool compact;final bool quiet, capsule;final double textSize;@@ -160,6 +164,8 @@ class DesktopPill extends StatelessWidget {grid.AppTheme.watch(context);final ink = foregroundColor ?? DesktopChrome.foreground;final highContrast = MediaQuery.highContrastOf(context);+ Color fill(Color tint) =>+ surfaceColor == null ? tint : Color.alphaBlend(tint, surfaceColor!);final button = TextButton(focusNode: focusNode,onPressed: onPressed,@@ -169,9 +175,6 @@ class DesktopPill extends StatelessWidget {disabledForegroundColor: ink.withValues(alpha: .38),enabledMouseCursor: SystemMouseCursors.click,disabledMouseCursor: SystemMouseCursors.basic,- backgroundColor: quiet- ? Colors.transparent- : ink.withValues(alpha: selected == true ? .13 : .055),minimumSize: Size(0,compact@@ -217,14 +220,16 @@ class DesktopPill extends StatelessWidget {),),backgroundColor: WidgetStateProperty.resolveWith(- (states) => selected == true- ? ink.withValues(alpha: .13)- : states.contains(WidgetState.focused) &&- !states.contains(WidgetState.disabled)- ? ink.withValues(alpha: .10)- : quiet- ? Colors.transparent- : ink.withValues(alpha: selected == true ? .13 : .055),+ (states) => fill(+ selected == true+ ? ink.withValues(alpha: .13)+ : states.contains(WidgetState.focused) &&+ !states.contains(WidgetState.disabled)+ ? ink.withValues(alpha: .10)+ : quiet+ ? Colors.transparent+ : ink.withValues(alpha: .055),+ ),),overlayColor: WidgetStateProperty.resolveWith((states) => states.contains(WidgetState.disabled)diff --git a/desktop/lib/widgets/desktop_search_panel.dart b/desktop/lib/widgets/desktop_search_panel.dartindex dfb1b57be..2b212f5e4 100644--- a/desktop/lib/widgets/desktop_search_panel.dart+++ b/desktop/lib/widgets/desktop_search_panel.dart@@ -2,6 +2,7 @@ import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';+import '../shared/theme/app_pane_icon.dart';import '../shared/theme/app_theme.dart' as grid;import '../shortcuts/app_keymap.dart';import '../shortcuts/keymap.dart';@@ -92,7 +93,7 @@ class DesktopSearchPanel extends StatelessWidget {children: [Icon(AppIcons.search,- size: 21,+ size: 20,color: DesktopChrome.muted,),const SizedBox(width: 12),@@ -147,7 +148,10 @@ class DesktopSearchPanel extends StatelessWidget {onRefocus();}: null,- icon: const Icon(AppIcons.columns2, size: 18),+ icon: const AppPaneIcon(+ AppPaneSymbol.splitRight,+ size: 18,+ ),),),if (hostBar == null)diff --git a/desktop/lib/widgets/flash_firmware_dialog.dart b/desktop/lib/widgets/flash_firmware_dialog.dartindex be63b86b0..66771a4f3 100644--- a/desktop/lib/widgets/flash_firmware_dialog.dart+++ b/desktop/lib/widgets/flash_firmware_dialog.dart@@ -447,7 +447,7 @@ class _FlashDialogState extends State<_FlashDialog> {children: [Icon(AppIcons.squareTerminal,- size: 13,+ size: 14,color: grid.AppPalette.textFaint,),const SizedBox(width: 8),diff --git a/desktop/lib/widgets/harness_command_bar.dart b/desktop/lib/widgets/harness_command_bar.dartindex 5e36ac24b..9a8dfe2ef 100644--- a/desktop/lib/widgets/harness_command_bar.dart+++ b/desktop/lib/widgets/harness_command_bar.dart@@ -234,7 +234,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {icon: const Icon(AppIcons.close,color: grid.AppPalette.commandMuted,- size: 19,+ size: 20,),),if (!narrow)@@ -430,7 +430,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {? null: controller.dismiss,tooltip: 'Dismiss results',- icon: const Icon(AppIcons.close, size: 15),+ icon: const Icon(AppIcons.close, size: 16),),],),@@ -626,7 +626,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {children: [Icon(AppIcons.bell,- size: 17,+ size: 16,color: grid.AppPalette.swarmAccent,),const SizedBox(width: 10),diff --git a/desktop/lib/widgets/harness_session_manager.dart b/desktop/lib/widgets/harness_session_manager.dartindex 023d1ce0e..97717057a 100644--- a/desktop/lib/widgets/harness_session_manager.dart+++ b/desktop/lib/widgets/harness_session_manager.dart@@ -430,7 +430,7 @@ class _HarnessSessionManagerState extends State<HarnessSessionManager> {children: [Icon(AppIcons.layers,- size: 25,+ size: 24,color: AppPalette.textFaint,),const SizedBox(height: 12),diff --git a/desktop/lib/widgets/linux_menu_bar.dart b/desktop/lib/widgets/linux_menu_bar.dartindex 8e74efdf0..be5cdad08 100644--- a/desktop/lib/widgets/linux_menu_bar.dart+++ b/desktop/lib/widgets/linux_menu_bar.dart@@ -1,9 +1,10 @@+import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:window_manager/window_manager.dart';import '../core/runtime_platform.dart';+import '../shared/theme/app_pane_icon.dart';import '../core/test_run.dart';import '../screens/swarm_menu_bus.dart';import '../shared/theme/app_theme.dart' as grid;@@ -230,39 +231,39 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {return [_appRow(key: 'menu-bar-about',- icon: LucideIcons.info300,+ icon: AppIcons.info,label: 'About Harness',action: 'showAbout',),const AppMenuDivider(),_swarmRow(key: 'menu-bar-customize',- icon: LucideIcons.palette300,+ icon: AppIcons.palette,label: 'Customize Harness',action: 'customize',),_swarmRow(key: 'menu-bar-settings',- icon: LucideIcons.settings300,+ icon: AppIcons.settings,label: 'Settings…',action: 'settings',),const AppMenuDivider(),_appRow(key: 'menu-bar-shortcuts',- icon: LucideIcons.keyboard300,+ icon: AppIcons.keyboard,label: 'Keyboard Shortcuts…',action: 'showShortcuts',),_appRow(key: 'menu-bar-check-for-updates',- icon: LucideIcons.refreshCw300,+ icon: AppIcons.refreshCw,label: 'Check for Updates…',action: 'checkForUpdates',),_appRow(key: 'menu-bar-flash-firmware',- icon: LucideIcons.zap300,+ icon: AppIcons.zap,label: 'Flash Firmware…',action: 'flashFirmware',),@@ -286,32 +287,32 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {return [_swarmRow(key: 'menu-bar-new-harness',- icon: LucideIcons.plus300,+ icon: AppIcons.plus,label: 'New Harness',action: 'newAgent',),_swarmRow(key: 'menu-bar-open-harness',- icon: LucideIcons.folderOpen300,+ icon: AppIcons.folderOpen,label: 'Open Harness',action: 'addAgent',),_swarmRow(key: 'menu-bar-clone-agent',- icon: LucideIcons.copyPlus300,+ icon: AppIcons.copyPlus,label: 'Clone Harness',action: 'cloneAgent',),_swarmRow(key: 'menu-bar-restart-agent',- icon: LucideIcons.rotateCw300,+ icon: AppIcons.rotateCw,label: 'Restart Harness',action: 'restartAgent',enabled: _paneAction('restartAgent'),),_swarmRow(key: 'menu-bar-share-agent',- icon: LucideIcons.share300,+ icon: AppIcons.share,label: 'Share Harness',action: 'shareAgent',enabled: _paneAction('shareAgent'),@@ -319,54 +320,54 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {const AppMenuDivider(),_swarmRow(key: 'menu-bar-new-tab',- icon: LucideIcons.squarePlus300,+ icon: AppIcons.squarePlus,label: 'New Tab',action: 'new',),_swarmRow(key: 'menu-bar-rename-tab',- icon: LucideIcons.pencil300,+ icon: AppIcons.pencil,label: 'Rename Tab',action: 'renameActive',),_swarmRow(key: 'menu-bar-close-tab',- icon: LucideIcons.x300,+ icon: AppIcons.close,label: 'Close Tab',action: 'closeActive',),const AppMenuDivider(),_swarmRow(key: 'menu-bar-split-right',- icon: LucideIcons.panelRight300,+ leading: const AppPaneIcon(AppPaneSymbol.splitRight, size: 16),label: 'Split Right',action: 'splitRight',enabled: state.enabled && state.canFind,),_swarmRow(key: 'menu-bar-split-down',- icon: LucideIcons.panelBottom300,+ leading: const AppPaneIcon(AppPaneSymbol.splitDown, size: 16),label: 'Split Down',action: 'splitDown',enabled: state.enabled && state.canFind,),_swarmRow(key: 'menu-bar-zoom-pane',- icon: LucideIcons.focus300,+ leading: const AppPaneIcon(AppPaneSymbol.zoom, size: 16),label: 'Zoom Pane',action: 'zoomPane',enabled: state.enabled && state.canFind,),_swarmRow(key: 'menu-bar-move-pane',- icon: LucideIcons.arrowRightLeft300,+ icon: AppIcons.arrowRightLeft,label: 'Move Pane to Tab',action: 'movePaneToTab',enabled: state.enabled && state.canFind,),_swarmRow(key: 'menu-bar-close-pane',- icon: LucideIcons.x300,+ icon: AppIcons.close,label: 'Close Pane',action: 'closePane',enabled: state.enabled && state.canClosePane,@@ -401,7 +402,7 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {const AppMenuDivider(),_swarmRow(key: 'menu-bar-commands',- icon: LucideIcons.command300,+ icon: AppIcons.command,label: 'Search Commands…',action: 'commands',),@@ -414,26 +415,26 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {return [_appRow(key: 'menu-bar-layout',- icon: LucideIcons.layoutGrid300,+ icon: AppIcons.layoutGrid,label: 'Layout…',action: 'showLayout',),const AppMenuDivider(),_appRow(key: 'menu-bar-reset-font-size',- icon: LucideIcons.type300,+ icon: AppIcons.type,label: 'Default Font Size',action: 'resetTerminalFontSize',),_appRow(key: 'menu-bar-bigger-font',- icon: LucideIcons.aArrowUp300,+ icon: AppIcons.aArrowUp,label: 'Bigger',action: 'increaseTerminalFontSize',),_appRow(key: 'menu-bar-smaller-font',- icon: LucideIcons.aArrowDown300,+ icon: AppIcons.aArrowDown,label: 'Smaller',action: 'decreaseTerminalFontSize',),@@ -452,31 +453,31 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {const AppMenuDivider(),_swarmRow(key: 'menu-bar-sessions',- icon: LucideIcons.terminal300,+ icon: AppIcons.terminal,label: 'Harnesses',action: 'sessions',),_swarmRow(key: 'menu-bar-notifications',- icon: LucideIcons.bell300,+ icon: AppIcons.bell,label: 'Harnesses Needing Input…',action: 'notifications',),_swarmRow(key: 'menu-bar-machines',- icon: LucideIcons.server300,+ icon: AppIcons.server,label: 'Machines',action: 'machineList',),_swarmRow(key: 'menu-bar-models',- icon: LucideIcons.cpu300,+ icon: AppIcons.cpu,label: 'Models',action: 'models',),_swarmRow(key: 'menu-bar-machine-monitor',- icon: LucideIcons.activity300,+ icon: AppIcons.activity,label: 'Machine Monitor',action: 'manageMachines',),@@ -599,7 +600,7 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {// over the swarm channel as `keymapCommand`._swarmRow(key: 'menu-bar-quick-start',- icon: LucideIcons.rocket300,+ icon: AppIcons.rocket,label: 'Quick Start',action: 'keymapCommand',args: const {'command': 'keyboard.quick_start'},@@ -607,14 +608,14 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {),_appRow(key: 'menu-bar-keyboard-practice',- icon: LucideIcons.keyboard300,+ icon: AppIcons.keyboard,label: 'Keyboard Practice',action: 'keyboardPractice',),const AppMenuDivider(),_appRow(key: 'menu-bar-export-logs',- icon: LucideIcons.fileDown300,+ icon: AppIcons.fileDown,label: 'Export Logs…',action: 'exportLogs',),@@ -904,13 +905,13 @@ class _WindowButtonsState extends State<_WindowButtons> with WindowListener {_WindowButton(key: const ValueKey('linux-window-minimize'),tooltip: 'Minimize',- icon: LucideIcons.minus,+ icon: AppIcons.minus,onPressed: windowManager.minimize,),_WindowButton(key: const ValueKey('linux-window-maximize'),tooltip: _maximized ? 'Restore' : 'Maximize',- icon: _maximized ? LucideIcons.copy : LucideIcons.square,+ icon: _maximized ? AppIcons.copy : AppIcons.square,onPressed: () => _maximized? windowManager.unmaximize(): windowManager.maximize(),@@ -918,7 +919,7 @@ class _WindowButtonsState extends State<_WindowButtons> with WindowListener {_WindowButton(key: const ValueKey('linux-window-close'),tooltip: 'Close',- icon: LucideIcons.x,+ icon: AppIcons.close,// Through window_manager, as Quit does, so the exit lifecycle runs.onPressed: windowManager.close,),diff --git a/desktop/lib/widgets/machines_panel.dart b/desktop/lib/widgets/machines_panel.dartindex 69e4ebdf6..1478f850e 100644--- a/desktop/lib/widgets/machines_panel.dart+++ b/desktop/lib/widgets/machines_panel.dart@@ -1506,7 +1506,7 @@ class _MachinePasswordState extends State<_MachinePassword> {icon: const Icon(AppIcons.circleHelp,semanticLabel: 'Password help',- size: 15,+ size: 16,),),],diff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dartindex 8d578fbbe..946e3d083 100644--- a/desktop/lib/widgets/new_harness_form.dart+++ b/desktop/lib/widgets/new_harness_form.dart@@ -2048,6 +2048,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {textSize: capsule ? 13 : 12,truncateFromStart: row == _Row.branch,foregroundColor: capsule ? null : DesktopChrome.muted,+ surfaceColor: capsule ? DesktopChrome.surface : null,tooltip: _desktopChoiceTooltip(row),onPressed: box.locked || _blocked(row) != null? nulldiff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex 05e1e1ffe..673b9e80d 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -53,6 +53,7 @@ class PaneGrid extends StatelessWidget {this.swarmMode = false,this.empty,this.onOpenModels,+ this.onSplitPane,this.soloFocused = false,this.companionViewer,});@@ -62,6 +63,7 @@ class PaneGrid extends StatelessWidget {final Widget? empty;final void Function(int paneId, String machineId, String agentId)?onOpenModels;+ final void Function(int paneId, PaneResizeAxis axis)? onSplitPane;/// Draw only the focused view, full size, as if zoomed — without zooming:/// the tab's saved layout and zoom stay as they are (a phone shows one@@ -83,6 +85,7 @@ class PaneGrid extends StatelessWidget {dragging: dragging,empty: empty,onOpenModels: onOpenModels,+ onSplitPane: onSplitPane,soloFocused: soloFocused,companionViewer: companionViewer,);@@ -100,6 +103,7 @@ class PaneGrid extends StatelessWidget {visible: visible,swarmMode: swarmMode,onOpenModels: onOpenModels,+ onSplitPane: onSplitPane,companionViewer: companionViewer,);final cells = <Widget>[@@ -248,6 +252,7 @@ class _SwarmCanvas extends StatefulWidget {required this.dragging,this.empty,this.onOpenModels,+ this.onSplitPane,this.soloFocused = false,this.companionViewer,});@@ -256,6 +261,7 @@ class _SwarmCanvas extends StatefulWidget {final Widget? empty;final void Function(int paneId, String machineId, String agentId)?onOpenModels;+ final void Function(int paneId, PaneResizeAxis axis)? onSplitPane;final bool soloFocused;final WidgetBuilder? companionViewer;@override@@ -594,6 +600,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {visible: rectangles.containsKey(pane.id),swarmMode: true,onOpenModels: widget.onOpenModels,+ onSplitPane: widget.onSplitPane,solo: widget.soloFocused,companionViewer: widget.companionViewer,),@@ -1194,6 +1201,7 @@ class _PaneCell extends StatelessWidget {this.visible = true,this.swarmMode = false,this.onOpenModels,+ this.onSplitPane,this.solo = false,this.companionViewer,});@@ -1205,6 +1213,7 @@ class _PaneCell extends StatelessWidget {final bool swarmMode;final void Function(int paneId, String machineId, String agentId)?onOpenModels;+ final void Function(int paneId, PaneResizeAxis axis)? onSplitPane;final WidgetBuilder? companionViewer;/// Drawn alone under [PaneGrid.soloFocused]: it reads as the only view — no@@ -1321,6 +1330,7 @@ class _PaneCell extends StatelessWidget {visible: visible,swarmMode: swarmMode,onOpenModels: onOpenModels,+ onSplitPane: onSplitPane,),),),@@ -1341,6 +1351,7 @@ class _PaneContent extends StatelessWidget {required this.visible,required this.swarmMode,this.onOpenModels,+ this.onSplitPane,});final AppNotifier notifier;@@ -1350,6 +1361,7 @@ class _PaneContent extends StatelessWidget {final bool swarmMode;final void Function(int paneId, String machineId, String agentId)?onOpenModels;+ final void Function(int paneId, PaneResizeAxis axis)? onSplitPane;@overrideWidget build(BuildContext context) {@@ -1359,6 +1371,15 @@ class _PaneContent extends StatelessWidget {notifier.closePane(pane.id);}+ VoidCallback? split(PaneResizeAxis axis) =>+ swarmMode &&+ onSplitPane != null &&+ !notifier.activeSwarm.isUtility &&+ !notifier.activeSwarm.isOrchestrator &&+ notifier.preparePaneSplit(axis, paneId: pane.id) != null+ ? () => onSplitPane!(pane.id, axis)+ : null;+if (pane.sharedHarness case final grant?) {return SharedHarnessPanel(key: ValueKey('shared-pane-${pane.id}'),@@ -1544,6 +1565,8 @@ class _PaneContent extends StatelessWidget {? null: () =>onOpenModels!(pane.id, session.machineId, session.agentId),+ onSplitDown: split(PaneResizeAxis.y),+ onSplitRight: split(PaneResizeAxis.x),// The same confirmation the rail's row menu opens. Only for an// agent the machine still lists — a pane whose agent is already// gone has nothing to end.@@ -2185,7 +2208,7 @@ class _PaneStatus extends StatelessWidget {child: CircularProgressIndicator(strokeWidth: 2),),)- : Icon(icon, size: 26, color: AppColors.mutedStrong),+ : Icon(icon, size: 24, color: AppColors.mutedStrong),),const SizedBox(height: 10),Flexible(diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dartindex 14e337a39..888471c52 100644--- a/desktop/lib/widgets/pane_header_actions.dart+++ b/desktop/lib/widgets/pane_header_actions.dart@@ -1,7 +1,7 @@import 'package:flutter/widgets.dart';/// Pane-local model selection and optional standalone terminal context.-/// The pane keeps its fixed close target outside this flexible group.+/// The pane keeps its fixed split, zoom and close targets outside this group.class PaneHeaderActions extends StatelessWidget {const PaneHeaderActions({super.key,diff --git a/desktop/lib/widgets/pane_share_badge.dart b/desktop/lib/widgets/pane_share_badge.dartindex b18a50e12..46f05a69c 100644--- a/desktop/lib/widgets/pane_share_badge.dart+++ b/desktop/lib/widgets/pane_share_badge.dart@@ -1,8 +1,8 @@import 'dart:async';import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';+import '../shared/theme/app_icons.dart';import '../shared/theme/app_theme.dart' as grid;import '../sharing/share_harness_dialog.dart';import '../state/app_state.dart';@@ -120,9 +120,9 @@ class _PaneShareBadgeState extends State<PaneShareBadge> {children: [Icon(share.access == HarnessShareAccess.public- ? LucideIcons.globe- : LucideIcons.lock,- size: 13,+ ? AppIcons.globe+ : AppIcons.lock,+ size: 14,),if (!widget.compact) ...[const SizedBox(width: 6),diff --git a/desktop/lib/widgets/swarm_dialogs.dart b/desktop/lib/widgets/swarm_dialogs.dartindex 624e17d7a..fb49c3d7f 100644--- a/desktop/lib/widgets/swarm_dialogs.dart+++ b/desktop/lib/widgets/swarm_dialogs.dart@@ -182,7 +182,7 @@ class _ProjectDialogState extends State<_ProjectDialog> {onPressed: machineId == null || picking? null: browse,- icon: const Icon(AppIcons.folderOpen, size: 17),+ icon: const Icon(AppIcons.folderOpen, size: 16),label: Text(path ?? 'Choose folder',maxLines: 1,diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex ac8486783..d04e9a8a1 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -7,6 +7,7 @@ import 'dart:convert';import 'dart:math' as math;import 'package:harness/shared/theme/app_icons.dart';+import 'package:harness/shared/theme/app_pane_icon.dart';import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';@@ -117,6 +118,9 @@ class TerminalPanel extends StatefulWidget {/// Opens the workspace's shared model picker for this exact pane.final VoidCallback? onOpenModels;+ /// Creates a new harness beside this exact pane.+ final VoidCallback? onSplitDown, onSplitRight;+final VoidCallback? onDelete;final VoidCallback? onToggleZoom;@@ -190,6 +194,8 @@ class TerminalPanel extends StatefulWidget {this.onToggleComposer,this.onClose,this.onOpenModels,+ this.onSplitDown,+ this.onSplitRight,this.onDelete,this.onToggleZoom,this.zoomed = false,@@ -2466,6 +2472,8 @@ class _TerminalPanelState extends State<TerminalPanel>compact: widget.compactHeader,close: widget.onClose != null,openModels: widget.onOpenModels != null,+ splitDown: widget.onSplitDown != null,+ splitRight: widget.onSplitRight != null,delete: widget.onDelete != null,composer: widget.composerVisible,toggleComposer: widget.onToggleComposer != null,@@ -2491,6 +2499,12 @@ class _TerminalPanelState extends State<TerminalPanel>onOpenModels: widget.onOpenModels == null? null: () => widget.onOpenModels?.call(),+ onSplitDown: widget.onSplitDown == null+ ? null+ : () => widget.onSplitDown?.call(),+ onSplitRight: widget.onSplitRight == null+ ? null+ : () => widget.onSplitRight?.call(),onDelete: widget.onDelete == null? null: () => widget.onDelete?.call(),@@ -2568,6 +2582,7 @@ class _TerminalHeader extends StatelessWidget {final bool readOnly;final VoidCallback? onClose;final VoidCallback? onOpenModels;+ final VoidCallback? onSplitDown, onSplitRight;/// Ends the agent (with a confirmation), as the rail's row menu does. Null/// where the pane cannot name a live agent to end.@@ -2605,6 +2620,8 @@ class _TerminalHeader extends StatelessWidget {this.readOnly = false,this.onClose,this.onOpenModels,+ this.onSplitDown,+ this.onSplitRight,this.onDelete,required this.onReconnect,this.compact = false,@@ -2706,21 +2723,46 @@ class _TerminalHeader extends StatelessWidget {final showModelPicker = modelPickerSupports(session.engineId);// The picker: a model id up to 220px and its padding.final pickerWidth = showModelPicker ? 250.0 : 0.0;- final closeWidth = onClose == null- ? 0.0- : workspaceBarCellSizeOf(context).width * 3;- final actionsWidth = pickerWidth + closeWidth;+ final showSplit = compact || onSplitDown != null || onSplitRight != null;+ final showZoom = compact || onToggleZoom != null;+ final controlsWidth =+ ((showSplit ? 2 : 0) + (showZoom ? 1 : 0) + (onClose != null ? 1 : 0)) *+ PaneHeaderButton.width;+ final actionsWidth = pickerWidth + controlsWidth;// A fork says so first: "forked from X" is the one fact about this pane// that the folder and the branch — shared with its source — cannot tell.final forkedFrom = agent?.forkedFrom;final header = SizedBox(height: compact ? 38 : 46,child: Padding(- padding: const EdgeInsets.symmetric(horizontal: _stripPadding),+ padding: const EdgeInsets.only(+ left: _stripPadding,+ right: grid.AppDesktop.paneCloseInset,+ ),child: LayoutBuilder(builder: (context, constraints) {final scale = grid.appTextScaleOf(context);final narrow = constraints.maxWidth < 560 * math.max(1, scale);+ // At the smallest widths, connection state takes the leading+ // mark's place so the pane name survives beside the fixed tools.+ final leadingStatus =+ compact && constraints.maxWidth < 280 && status != null;+ Widget statusButton() => Tooltip(+ message: '${status!.label}: ${status.detail}',+ child: IconButton(+ tooltip: status.actionLabel ?? status.label,+ onPressed: statusAction,+ icon: Icon(status.icon, size: 14),+ style: IconButton.styleFrom(+ foregroundColor: color,+ disabledForegroundColor: color,+ fixedSize: const Size(28, 28),+ minimumSize: const Size(28, 28),+ padding: EdgeInsets.zero,+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,+ ),+ ),+ );// Workspace panes show PR state once in the main status bar.// Standalone terminals retain their own PR badge.final showPr =@@ -2757,7 +2799,7 @@ class _TerminalHeader extends StatelessWidget {final desiredRightWidth = narrow? math.max(- (showModelPicker ? 96.0 : 0.0) + badgeWidth,+ controlsWidth + (showModelPicker ? 96.0 : 0.0) + badgeWidth,constraints.maxWidth * .36,): math.max(@@ -2769,20 +2811,29 @@ class _TerminalHeader extends StatelessWidget {// The name/status retain space while model and project text yield.final rightWidth = math.min(compact- ? math.min(actionsWidth, constraints.maxWidth * .38)+ ? controlsWidth ++ math.min(+ pickerWidth,+ math.max(+ 56.0,+ (constraints.maxWidth - controlsWidth) * .38,+ ),+ ): desiredRightWidth,math.max(0.0, constraints.maxWidth - 99),);return Row(children: [- if (agent != null)+ if (leadingStatus)+ statusButton()+ else if (agent != null)EngineMark.forAgent(agent, size: 17)elseEngineMark(engine: session.engineId, size: 17),// Icon and name, the same as every other pane (owner,// 2026-09-15): a harness agent is its harness here, and the// engine it runs on is the dialog's and the tooltip's to say.- const SizedBox(width: 10),+ SizedBox(width: leadingStatus ? 6 : 10),Expanded(child: Row(children: [@@ -2816,26 +2867,13 @@ class _TerminalHeader extends StatelessWidget {machineId: session.machineId,agentId: session.agentId,),- if (status != null || starting != null || !compact)+ if ((status != null && !leadingStatus) ||+ starting != null ||+ !compact)const SizedBox(width: 8),- if (status != null && narrow)- Tooltip(- message: '${status.label}: ${status.detail}',- child: IconButton(- tooltip: status.actionLabel ?? status.label,- onPressed: statusAction,- icon: Icon(status.icon, size: 14),- style: IconButton.styleFrom(- foregroundColor: color,- disabledForegroundColor: color,- fixedSize: const Size(28, 28),- minimumSize: const Size(28, 28),- padding: EdgeInsets.zero,- tapTargetSize: MaterialTapTargetSize.shrinkWrap,- ),- ),- )- else if (status != null)+ if (status != null && narrow && !leadingStatus)+ statusButton()+ else if (status != null && !leadingStatus)ConstrainedBox(constraints: BoxConstraints(maxWidth: math.max(@@ -2890,9 +2928,9 @@ class _TerminalHeader extends StatelessWidget {),),)- else if (starting != null && narrow)+ else if (status == null && starting != null && narrow)PaneStartingChip(phase: starting, narrow: true)- else if (starting != null)+ else if (status == null && starting != null)// Never wider than the room this row is sure to have: the name's// share (at most 45%) or what the actions and the PR badge leave —// less [_headerFurniture]. Its words shorten rather than push the@@ -2931,9 +2969,8 @@ class _TerminalHeader extends StatelessWidget {),),const SizedBox(width: 8),- // At the right edge, outside the right side's width budget:- // a workspace pane's compact header leaves that only its close- // button, and a status beside the name fills the name's row.+ // Keep sharing status outside the model/action width budget.+ // It follows the title and precedes the model and pane controls.if (agent != null && PaneShareStatus.visibleOf(context))PaneShareBadge(notifier: notifier,@@ -2956,7 +2993,7 @@ class _TerminalHeader extends StatelessWidget {),ConstrainedBox(constraints: BoxConstraints(- maxWidth: math.max(0, rightWidth - closeWidth),+ maxWidth: math.max(0, rightWidth - controlsWidth),),child: PaneHeaderActions(trailing: showPr@@ -3049,6 +3086,30 @@ class _TerminalHeader extends StatelessWidget {),),),+ if (showSplit) ...[+ PaneHeaderButton(+ key: const ValueKey('pane-split-down'),+ label: 'New Pane Below',+ command: 'pane.split_down',+ icon: AppPaneSymbol.splitDown,+ onPressed: onSplitDown,+ ),+ PaneHeaderButton(+ key: const ValueKey('pane-split-right'),+ label: 'New Pane to the Right',+ command: 'pane.split_right',+ icon: AppPaneSymbol.splitRight,+ onPressed: onSplitRight,+ ),+ ],+ if (showZoom)+ PaneHeaderButton(+ key: const ValueKey('pane-zoom'),+ label: zoomed ? 'Restore Pane' : 'Zoom Pane',+ command: 'pane.zoom',+ icon: zoomed ? AppPaneSymbol.restore : AppPaneSymbol.zoom,+ onPressed: onToggleZoom,+ ),if (onClose != null) PaneCloseButton(onPressed: onClose!),],);diff --git a/desktop/lib/widgets/toolbar_icon.dart b/desktop/lib/widgets/toolbar_icon.dartindex 54bc2b76c..906abcaaa 100644--- a/desktop/lib/widgets/toolbar_icon.dart+++ b/desktop/lib/widgets/toolbar_icon.dart@@ -1,21 +1,21 @@import 'package:flutter/material.dart';-import 'package:flutter_svg/flutter_svg.dart';-/// Shared vector marks inherit the toolbar button's quiet or notified tint.+import '../shared/theme/app_icons.dart';++/// Toolbar destinations use the same outline vocabulary as menus and search.class ToolbarIcon extends StatelessWidget {const ToolbarIcon({super.key, required this.name});final String name;@override- Widget build(BuildContext context) => SvgPicture.asset(- 'assets/${name.toLowerCase()}.svg',- width: 20,- height: 20,- colorFilter: ColorFilter.mode(- IconTheme.of(context).color ?? const Color(0xff999999),- BlendMode.srcIn,- ),- semanticsLabel: name,+ Widget build(BuildContext context) => Icon(+ switch (name.toLowerCase()) {+ 'machines' => AppIcons.monitor,+ 'models' => AppIcons.brainCircuit,+ _ => AppIcons.squareTerminal,+ },+ size: AppIcons.controlSize,+ semanticLabel: name,);}diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dartindex 245064d6b..91afe9e49 100644--- a/desktop/lib/widgets/web_pane_panel.dart+++ b/desktop/lib/widgets/web_pane_panel.dart@@ -8,12 +8,14 @@ import '../core/open_in_browser.dart';import '../core/runtime_platform.dart';import '../core/models.dart' show AgentVerdict;import '../core/test_run.dart';+import '../shared/theme/app_pane_icon.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/theme/workspace_bar_style.dart';import '../state/app_state.dart';import '../state/terminal_pane.dart';import '../theme/app_theme.dart';import '../viewer/interactive_viewer.dart';+import 'agent_drag.dart';import 'engine_identity.dart';import 'harness_activity_mark.dart';import '../terminal/terminal_text.dart';@@ -272,7 +274,10 @@ class _WebPanePanelState extends State<WebPanePanel> {return SizedBox(height: compact ? 38 : 46,child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 14),+ padding: const EdgeInsets.only(+ left: 14,+ right: grid.AppDesktop.paneCloseInset,+ ),child: Row(children: [EngineMark(@@ -418,45 +423,27 @@ class _ViewerActions extends StatelessWidget {@overrideWidget build(BuildContext context) {- Widget action(String tooltip, IconData icon, VoidCallback? callback) =>- IconButton(- tooltip: tooltip,- onPressed: callback,- icon: Icon(icon, size: 16),- style: ButtonStyle(- fixedSize: const WidgetStatePropertyAll(Size(28, 28)),- minimumSize: const WidgetStatePropertyAll(Size(28, 28)),- padding: const WidgetStatePropertyAll(EdgeInsets.zero),- tapTargetSize: MaterialTapTargetSize.shrinkWrap,- visualDensity: VisualDensity.standard,- shape: WidgetStatePropertyAll(- RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),- ),- foregroundColor: WidgetStateProperty.resolveWith((states) {- if (states.contains(WidgetState.disabled)) {- return grid.AppPalette.textFaint;- }- if (states.contains(WidgetState.hovered) ||- states.contains(WidgetState.focused)) {- return AppColors.text;- }- return AppColors.mutedStrong.withValues(alpha: .8);- }),- overlayColor: WidgetStatePropertyAll(grid.AppSurface.hoverFill),- ),- );return Row(mainAxisSize: MainAxisSize.min,children: [- action('Reload viewer', AppIcons.refreshCw, onReload),- const SizedBox(width: 2),- action(- zoomed ? 'Restore harnesses' : 'Zoom viewer',- zoomed ? AppIcons.minimize : AppIcons.maximize,- onZoom,+ PaneHeaderButton(+ label: 'Reload viewer',+ icon: AppPaneSymbol.reload,+ onPressed: onReload,+ ),+ PaneHeaderButton(+ label: zoomed ? 'Restore harnesses' : 'Zoom viewer',+ command: 'pane.zoom',+ icon: zoomed ? AppPaneSymbol.restore : AppPaneSymbol.zoom,+ onPressed: onZoom,+ ),+ PaneHeaderButton(+ label: 'Close viewer',+ command: 'pane.close',+ icon: AppPaneSymbol.close,+ iconSize: AppIcons.closeSize,+ onPressed: onClose,),- const SizedBox(width: 2),- action('Close viewer', AppIcons.close, onClose),],);}@@ -484,7 +471,7 @@ class _Notice extends StatelessWidget {child: Column(mainAxisSize: MainAxisSize.min,children: [- Icon(icon, size: 26, color: AppColors.mutedStrong),+ Icon(icon, size: 24, color: AppColors.mutedStrong),const SizedBox(height: 10),Text(title,diff --git a/desktop/lib/widgets/workspace_notifications_button.dart b/desktop/lib/widgets/workspace_notifications_button.dartindex 0bbeb4992..7efa55800 100644--- a/desktop/lib/widgets/workspace_notifications_button.dart+++ b/desktop/lib/widgets/workspace_notifications_button.dart@@ -42,7 +42,7 @@ class WorkspaceNotificationsButton extends StatelessWidget {),child: Icon(AppIcons.bell,- size: 17,+ size: 16,color: foreground.withValues(alpha: onPressed == null? .28diff --git a/desktop/lib/widgets/workspace_subscription_usage.dart b/desktop/lib/widgets/workspace_subscription_usage.dartindex 42d0c6b2c..584be0f52 100644--- a/desktop/lib/widgets/workspace_subscription_usage.dart+++ b/desktop/lib/widgets/workspace_subscription_usage.dart@@ -1,7 +1,7 @@import 'package:flutter/painting.dart';import '../shared/theme/status_line_style.dart';-import '../theme/app_theme.dart';+import '../shared/theme/app_theme.dart';enum WorkspaceUsageTone { normal, low, exhausted }@@ -14,8 +14,8 @@ class WorkspaceSubscriptionUsage {String get text => segments.map((part) => part.text).join();final String detail;- /// Names stay neutral. Only a known remaining percentage carries urgency;- /// use the model picker's 20% low-water mark and reserve red for exhaustion.+ /// Names stay neutral. Low and exhausted allowance share quiet amber;+ /// a subscription limit is not an application error.List<StatusLinePaintSegment> paintSegments({required Color foreground,required Color surface,@@ -25,8 +25,8 @@ class WorkspaceSubscriptionUsage {part.text,statusLineInkOnSurface(switch (part.tone) {WorkspaceUsageTone.normal => foreground,- WorkspaceUsageTone.low => AppColors.warning,- WorkspaceUsageTone.exhausted => AppColors.danger,+ WorkspaceUsageTone.low ||+ WorkspaceUsageTone.exhausted => AppPalette.usageLow,}, surface),null,),diff --git a/desktop/lib/widgets/workspace_tab_scroller.dart b/desktop/lib/widgets/workspace_tab_scroller.dartindex 1ad5a0f3b..72987c025 100644--- a/desktop/lib/widgets/workspace_tab_scroller.dart+++ b/desktop/lib/widgets/workspace_tab_scroller.dart@@ -1,7 +1,7 @@import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';+import '../shared/theme/app_icons.dart';import '../shared/theme/workspace_bar_style.dart';import 'workspace_bar_control.dart';@@ -112,7 +112,7 @@ class _WorkspaceTabScrollerState extends State<WorkspaceTabScroller> {width: cell.width * kWorkspaceTabArrowCells,height: workspaceBarControlHeight(context),child: Icon(- left ? LucideIcons.chevronLeft : LucideIcons.chevronRight,+ left ? AppIcons.chevronLeft : AppIcons.chevronRight,size: 16,color: widget.color.withValues(alpha: !enableddiff --git a/desktop/macos/Runner/MainFlutterWindow.swift b/desktop/macos/Runner/MainFlutterWindow.swiftindex ac71d5f82..392edea9b 100644--- a/desktop/macos/Runner/MainFlutterWindow.swift+++ b/desktop/macos/Runner/MainFlutterWindow.swift@@ -253,7 +253,7 @@ class MainFlutterWindow: NSWindow {}// Every other row in this menu carries a glyph, so one without reads as// unfinished — the gutter stays but nothing sits in it.- item.image = NSImage(systemSymbolName: symbol, accessibilityDescription: title)+ item.image = HarnessControlSymbols.image(symbol, description: title)return item}diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex 34a972245..b668cc8aa 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -4,7 +4,7 @@ import ImageIO/// The native counterpart of AppIcons: regular monochrome system outlines./// Controls share one optical size; hover changes ink, never the silhouette.-private enum HarnessControlSymbols {+enum HarnessControlSymbols {static let size: CGFloat = 16static let configuration = NSImage.SymbolConfiguration(pointSize: size, weight: .regular)static func image(_ name: String, description: String? = nil) -> NSImage? {diff --git a/desktop/scripts/audit-icons.py b/desktop/scripts/audit-icons.pynew file mode 100644index 000000000..a753d2a2f--- /dev/null+++ b/desktop/scripts/audit-icons.py@@ -0,0 +1,69 @@+#!/usr/bin/env python3+"""Audit every first-party desktop/web Dart icon; optionally save its inventory."""++import argparse+import json+from pathlib import Path+import re+++ROOT = Path(__file__).resolve().parents[1]+CATALOG = ROOT / 'lib/shared/theme/app_icons.dart'+++def audit():+ catalogue = dict(re.findall(+ r'static const (\w+)\s*=\s*LucideIcons\.(\w+);',+ CATALOG.read_text(),+ ))+ errors = []+ uses = {name: [] for name in catalogue}+ special = {}+ files = list((ROOT / 'lib').rglob('*.dart'))+ for name, glyph in catalogue.items():+ if not glyph.endswith('400'):+ errors.append(f'AppIcons.{name}: use the regular 400 outline')+ for file in sorted(files):+ if file == CATALOG:+ continue+ relative = str(file.relative_to(ROOT))+ for number, line in enumerate(file.read_text().splitlines(), 1):+ code = line.split('//', 1)[0]+ location = f'{relative}:{number}'+ for match in re.finditer(r'\b(?:Icons|CupertinoIcons|LucideIcons)\.\w+', code):+ errors.append(f'{location}: {match.group()} bypasses AppIcons')+ if 'package:lucide_icons_flutter/' in code:+ errors.append(f'{location}: import AppIcons instead of the font package')+ for name in re.findall(r'\bAppIcons\.(\w+)', code):+ if name in uses:+ uses[name].append(location)+ for name in re.findall(r'\bAppPaneSymbol\.(\w+)', code):+ special.setdefault(name, []).append(location)+ return {+ 'scope': 'desktop/lib, including Linux menus and the shared web UI',+ 'dart_files_scanned': len(files),+ 'catalogue_symbols': len(catalogue),+ 'symbols_used': sum(bool(locations) for locations in uses.values()),+ 'references': sum(map(len, uses.values())),+ 'symbols': {name: {'glyph': catalogue[name], 'locations': locations}+ for name, locations in sorted(uses.items())},+ 'pane_symbols': dict(sorted(special.items())),+ 'errors': errors,+ }+++if __name__ == '__main__':+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument('--output', type=Path, help='Write the complete JSON inventory')+ args = parser.parse_args()+ report = audit()+ if args.output:+ args.output.parent.mkdir(parents=True, exist_ok=True)+ args.output.write_text(json.dumps(report, indent=2) + '\n')+ print(f"Scanned {report['dart_files_scanned']} Dart files; "+ f"{report['catalogue_symbols']} catalogue symbols, "+ f"{report['references']} references.")+ if report['errors']:+ print('\n'.join(report['errors']))+ raise SystemExit(1)+ print('All action icons use the shared catalogue and regular outline weight.')diff --git a/desktop/scripts/build-macos-debug.sh b/desktop/scripts/build-macos-debug.shnew file mode 100755index 000000000..bca6d60a6--- /dev/null+++ b/desktop/scripts/build-macos-debug.sh@@ -0,0 +1,31 @@+#!/usr/bin/env bash+# Build the local review app with the renderer used by the matching release.+# Flutter's macOS default is Impeller, including on Intel where bitmap artwork+# can disappear. A Finder launch cannot inherit `flutter run --no-enable-impeller`.+set -euo pipefail++DESKTOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+APP_BUNDLE="$DESKTOP_DIR/build/macos/Build/Products/Debug/Harness.app"+PLIST="$APP_BUNDLE/Contents/Info.plist"++[[ "$(uname -s)" == Darwin ]] || { echo 'This build requires macOS.' >&2; exit 1; }+case "$(uname -m)" in+ x86_64) IMPELLER=false; RENDERER=Skia ;;+ arm64) IMPELLER=true; RENDERER=Impeller ;;+ *) echo 'A local macOS build requires an Intel or Apple Silicon Mac.' >&2; exit 1 ;;+esac++(cd "$DESKTOP_DIR" && flutter build macos --debug "$@")++# Only the built debug bundle changes; release renderer selection still belongs+# to publish-macos-variant.sh. Re-sign the bundle after changing its Info.plist.+if /usr/libexec/PlistBuddy -c 'Print :FLTEnableImpeller' "$PLIST" >/dev/null 2>&1; then+ /usr/libexec/PlistBuddy -c "Set :FLTEnableImpeller $IMPELLER" "$PLIST"+else+ /usr/libexec/PlistBuddy -c "Add :FLTEnableImpeller bool $IMPELLER" "$PLIST"+fi+[[ "$(/usr/libexec/PlistBuddy -c 'Print :FLTEnableImpeller' "$PLIST")" == "$IMPELLER" ]]+codesign --force --sign - \+ --preserve-metadata=identifier,entitlements,requirements,flags,runtime "$APP_BUNDLE"+codesign --verify --deep --strict "$APP_BUNDLE"+echo "Local review build ready ($RENDERER): $APP_BUNDLE"diff --git a/desktop/test/companion_engine_picker_test.dart b/desktop/test/companion_engine_picker_test.dartnew file mode 100644index 000000000..600778ce4--- /dev/null+++ b/desktop/test/companion_engine_picker_test.dart@@ -0,0 +1,90 @@+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/companions/companion_engine_picker.dart';+import 'package:harness/shared/theme/app_theme.dart';+import 'package:harness/shared/widgets/app_menu.dart';++void main() {+ testWidgets('first choice, switching, dismissal and a pending launch', (+ tester,+ ) async {+ String? selected;+ var busy = false;+ late StateSetter update;+ await tester.pumpWidget(+ MaterialApp(+ theme: buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: StatefulBuilder(+ builder: (context, setState) {+ update = setState;+ return CompanionEnginePicker(+ engine: selected,+ busy: busy,+ onSelected: (engine) => setState(() => selected = engine),+ );+ },+ ),+ ),+ ),+ );+ final trigger = find.byKey(const ValueKey('companion-engine-picker'));+ expect(find.text('Choose agent'), findsOneWidget);+ await tester.tap(trigger);+ await tester.pumpAndSettle();+ await tester.tap(find.text('Codex'));+ await tester.pumpAndSettle();+ expect(selected, 'codex');+ expect(find.byType(AppMenuItem), findsNothing);+ await tester.tap(trigger);+ await tester.pumpAndSettle();+ expect(+ tester+ .widgetList<AppMenuItem>(find.byType(AppMenuItem))+ .where((row) => row.selected)+ .single+ .label,+ 'Codex',+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(selected, 'codex');+ expect(find.byType(AppMenuItem), findsNothing);+ await tester.tap(trigger);+ await tester.pumpAndSettle();+ await tester.tap(find.text('Claude Code'));+ await tester.pumpAndSettle();+ expect(selected, 'claude');+ update(() => busy = true);+ await tester.pumpAndSettle();+ expect(tester.widget<TextButton>(trigger).onPressed, isNull);+ expect(find.text('Opening…'), findsOneWidget);+ expect(tester.takeException(), isNull);+ });++ testWidgets('keyboard users can open, choose and dismiss the agent menu', (+ tester,+ ) async {+ String? chosen;+ await tester.pumpWidget(+ MaterialApp(+ home: Scaffold(+ body: CompanionEnginePicker(+ engine: null,+ onSelected: (engine) => chosen = engine,+ ),+ ),+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(find.byType(AppMenuItem), findsNWidgets(2));+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(chosen, isNotNull);+ expect(find.byType(AppMenuItem), findsNothing);+ });+}diff --git a/desktop/test/companion_home_test.dart b/desktop/test/companion_home_test.dartindex 0db140fe4..23a5899d1 100644--- a/desktop/test/companion_home_test.dart+++ b/desktop/test/companion_home_test.dart@@ -40,6 +40,12 @@ void main() {await (FontLoader('MaterialIcons',)..addFont(rootBundle.load('fonts/MaterialIcons-Regular.otf'))).load();+ await (FontLoader('packages/lucide_icons_flutter/Lucide400')..addFont(+ rootBundle.load(+ 'packages/lucide_icons_flutter/assets/build_font/LucideVariable-w400.ttf',+ ),+ ))+ .load();final serif = ['/System/Library/Fonts/Supplemental/Georgia.ttf','/usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf',@@ -175,13 +181,17 @@ void main() {face = DaemonFace(zoo)..setEnvironment(foreground: true, reduceMotion: true);sent = [];- brain = DaemonBrain(- now: tester.binding.clock.now,- send: (type, payload) {- sent.add((type, payload));- return true;- },- )..receive('daemon_state', {'pair': 'tim'});+ brain =+ DaemonBrain(+ now: tester.binding.clock.now,+ send: (type, payload) {+ sent.add((type, payload));+ return true;+ },+ )..receive('daemon_state', {+ 'pair': 'tim',+ 'companionHarness': {'agentId': 'a0', 'engine': 'codex'},+ });zoo.bind('account:fixture', remote: remote);await tester.pump();face.sync(const DaemonWatch());@@ -253,6 +263,7 @@ void main() {brain: brain,onHatch: (_) {},onOpenControls: (_) {},+ onSelectEngine: (_) {},),),),@@ -584,7 +595,7 @@ void main() {});await tester.pump();expect(- find.textContaining('Your chosen model has reached its usage limit.'),+ find.textContaining('Your chosen agent has reached its usage limit.'),findsOneWidget,);expect(find.text('Retry review'), findsOneWidget);diff --git a/desktop/test/daemons/daemon_brain_test.dart b/desktop/test/daemons/daemon_brain_test.dartindex 818ecc0d1..5f681d3df 100644--- a/desktop/test/daemons/daemon_brain_test.dart+++ b/desktop/test/daemons/daemon_brain_test.dart@@ -79,15 +79,57 @@ void main() {'agentId': 'collection-agent','state': 'ready','model': 'opus',+ 'engine': 'claude',},});expect(brain.pairAgentId, 'collection-agent');+ expect(brain.pairEngine, 'claude');brain.bindConversation('account:test', 'gnu-one');expect(brain.pairAgentId, 'collection-agent');brain.bindConversation(null, null);expect(brain.pairAgentId, isNull);+ expect(brain.pairEngine, isNull);});+ test('an explicit engine choice commits only after success and cannot cross accounts', () async {+ brain.bindConversation('account:test', 'tim-one');+ brain.receive('daemon_state', {+ 'pair': 'tim',+ 'companionHarness': {'agentId': 'old-agent', 'engine': 'claude'},+ });+ final failed = brain.openConversation(engine: 'codex');+ expect(sent.last.$2['engine'], 'codex');+ expect(brain.pairEngine, 'claude');+ brain.receive('daemon_open_result', {+ 'requestId': sent.last.$2['requestId'],+ 'ok': false,+ 'error': 'BUSY',+ });+ await failed;+ expect(brain.pairEngine, 'claude');+ final opening = brain.openConversation(engine: 'codex');+ brain.receive('daemon_open_result', {+ 'requestId': sent.last.$2['requestId'],+ 'ok': true,+ 'agentId': 'codex-agent',+ 'engine': 'codex',+ });+ await opening;+ expect(brain.pairEngine, 'codex');+ expect(brain.pairAgentId, 'codex-agent');+ final stale = brain.openConversation(engine: 'claude');+ final request = sent.last.$2['requestId'];+ brain.bindConversation('account:other', 'other-tim');+ brain.receive('daemon_open_result', {+ 'requestId': request,+ 'ok': true,+ 'agentId': 'old-agent',+ 'engine': 'claude',+ });+ expect((await stale)['error'], 'STALE_COMPANION');+ expect(brain.pairEngine, isNull);+ expect(brain.pairAgentId, isNull);+ });test('recent conversation survives a window restart, scoped to account and individual', () async {brain.bindConversation('account:one', 'tim-one');diff --git a/desktop/test/icon_catalog_render_test.dart b/desktop/test/icon_catalog_render_test.dartnew file mode 100644index 000000000..ecd51944e--- /dev/null+++ b/desktop/test/icon_catalog_render_test.dart@@ -0,0 +1,206 @@+import 'dart:convert';+import 'dart:io';+import 'dart:math' as math;+import 'dart:ui' as ui;++import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_pane_icon.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;++import 'support/real_fonts.dart';++/// Draw the entire checked-in catalogue using the installed icon font. New+/// AppIcons constants are included automatically; no hand-picked showcase can+/// silently miss a screen's symbols. The Python audit checks all call sites.+void main() {+ test('every action icon uses the shared regular catalogue', () {+ final violations = <String>[];+ for (final file in Directory(+ 'lib',+ ).listSync(recursive: true).whereType<File>()) {+ if (!file.path.endsWith('.dart') ||+ file.path.endsWith('/app_icons.dart')) {+ continue;+ }+ final lines = file.readAsLinesSync();+ for (var i = 0; i < lines.length; i++) {+ final code = lines[i].split('//').first;+ if (RegExp(r'\b(?:Icons|CupertinoIcons|LucideIcons)\.\w+')+ .hasMatch(code) ||+ code.contains('package:lucide_icons_flutter/')) {+ violations.add('${file.path}:${i + 1}');+ }+ }+ }+ final catalogue = File('lib/shared/theme/app_icons.dart')+ .readAsStringSync();+ for (final glyph in RegExp(r'LucideIcons\.(\w+)').allMatches(catalogue)) {+ if (!glyph[1]!.endsWith('400')) violations.add('AppIcons: ${glyph[1]}');+ }+ expect(violations, isEmpty, reason: 'Use the shared icon design system.');+ });+ final output = Platform.environment['HARNESS_ICON_CAPTURE_DIR'];+ late List<(String, IconData)> icons;+ setUpAll(() async {+ await loadRealFonts();+ await (FontLoader('packages/lucide_icons_flutter/Lucide400')..addFont(+ rootBundle.load(+ 'packages/lucide_icons_flutter/assets/build_font/LucideVariable-w400.ttf',+ ),+ ))+ .load();+ final config = File('.dart_tool/package_config.json').absolute;+ final packages =+ (jsonDecode(config.readAsStringSync()) as Map)['packages'] as List;+ final package = packages.cast<Map>().singleWhere(+ (p) => p['name'] == 'lucide_icons_flutter',+ );+ final source = File.fromUri(+ Directory.fromUri(config.uri.resolve(package['rootUri'] as String)).uri+ .resolve('lib/lucide_icons.dart'),+ ).readAsStringSync();+ final glyphs = {+ for (final match in RegExp(+ r'static const IconData (\w+) = const IconData\((\d+),',+ ).allMatches(source))+ match[1]!: int.parse(match[2]!),+ };+ final catalogue = File('lib/shared/theme/app_icons.dart')+ .readAsStringSync();+ icons = [+ for (final match in RegExp(+ r'static const (\w+)\s*=\s*LucideIcons\.(\w+);',+ ).allMatches(catalogue))+ (+ match[1]!,+ IconData(+ // Test-only inventory: production retains constant, tree-shaken icons.+ // ignore: non_const_argument_for_const_parameter+ glyphs[match[2]]!,+ fontFamily: 'Lucide400',+ fontPackage: 'lucide_icons_flutter',+ ),+ ),+ ];+ expect(icons, isNotEmpty);+ });++ for (final brightness in Brightness.values) {+ testWidgets('every catalogue icon renders in ${brightness.name}', (+ tester,+ ) async {+ final oldBrightness = grid.AppTheme.brightness.value;+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = oldBrightness);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1200, 960);+ addTearDown(tester.view.reset);+ final ink = brightness == Brightness.dark+ ? const Color(0xffdddddd)+ : const Color(0xff292929);+ final surface = brightness == Brightness.dark+ ? const Color(0xff202020)+ : const Color(0xfffafafa);+ final entries = <(String, Widget Function(double))>[+ for (final (name, icon) in icons)+ (name, (size) => Icon(icon, size: size, color: ink)),+ for (final symbol in AppPaneSymbol.values)+ (+ 'pane.${symbol.name}',+ (size) => AppPaneIcon(symbol, size: size, color: ink),+ ),+ ];+ const perPage = 40;+ for (var start = 0; start < entries.length; start += perPage) {+ final boundaryKey = GlobalKey();+ await tester.pumpWidget(+ MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: brightness),+ home: RepaintBoundary(+ key: boundaryKey,+ child: Material(+ color: surface,+ child: Padding(+ padding: const EdgeInsets.all(28),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ 'Harness icons / ${brightness.name} / ${start ~/ perPage + 1}',+ style: TextStyle(color: ink, fontSize: 20),+ ),+ const SizedBox(height: 8),+ Text(+ 'Regular outlines. Actual sizes: 14, 16, 20, 24 pt.',+ style: TextStyle(color: ink, fontSize: 13),+ ),+ const SizedBox(height: 20),+ Expanded(+ child: GridView.count(+ crossAxisCount: 5,+ childAspectRatio: 2.15,+ physics: const NeverScrollableScrollPhysics(),+ children: [+ for (final (name, draw) in entries.sublist(+ start,+ math.min(start + perPage, entries.length),+ ))+ Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ name,+ style: TextStyle(color: ink, fontSize: 12),+ ),+ const SizedBox(height: 14),+ Row(+ children: [+ for (final size in [+ 14.0,+ 16.0,+ 20.0,+ 24.0,+ ])+ SizedBox(+ width: 42,+ height: 28,+ child: Center(child: draw(size)),+ ),+ ],+ ),+ ],+ ),+ ],+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ ),+ );+ await tester.pump();+ expect(tester.takeException(), isNull);+ if (output != null) {+ final boundary =+ boundaryKey.currentContext!.findRenderObject()!+ as RenderRepaintBoundary;+ await tester.runAsync(() async {+ final image = await boundary.toImage(pixelRatio: 2);+ final data = await image.toByteData(format: ui.ImageByteFormat.png);+ await Directory(output).create(recursive: true);+ await File(+ '$output/icons-${brightness.name}-${start ~/ perPage + 1}.png',+ ).writeAsBytes(data!.buffer.asUint8List());+ image.dispose();+ });+ }+ }+ });+ }+}diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dartindex 7163cd3b6..6a3b0c6f8 100644--- a/desktop/test/swarm_split_test.dart+++ b/desktop/test/swarm_split_test.dart@@ -12,7 +12,8 @@ import 'package:harness/state/pane_arrangement.dart';import 'package:harness/state/pane_preset.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:harness/widgets/new_harness_form.dart';-import 'package:harness/widgets/swarm_switcher.dart';+import 'package:harness/state/app_state.dart';+import 'package:harness/widgets/agent_drag.dart';import 'package:harness/ws/ws_conn.dart';import 'package:xterm/xterm.dart';@@ -34,6 +35,7 @@ class _Creation extends WsConn {);final reply = Completer<Map<String, dynamic>>();final calls = <String>[];+ Map<String, dynamic>? creation;@overrideFuture<Map<String, dynamic>> request(String type, {@@ -44,48 +46,80 @@ class _Creation extends WsConn {if (type == 'engines_probe') {return Future.value({'engines': [- {'engine': 'claude', 'installed': true},+ for (final engine in ['claude', 'codex'])+ {'engine': engine, 'installed': true},],});}+ if (type == 'agent_create') creation = Map.of(payload);return type == 'agent_create' ? reply.future : Future.value({});}void complete() => reply.complete({- 'agent': {'id': 'created', 'name': 'Created', 'engine': 'claude'},+ 'agent': {+ 'id': 'created',+ 'name': 'Created',+ 'engine': creation?['engine'] ?? 'claude',+ },});}+(AppNotifier, _Creation) _splitApp({MemoryStore? store}) {+ newHarnessOpensInBox = true;+ addTearDown(() => newHarnessOpensInBox = false);+ final connection = _Creation();+ final app = createApp(store: store, connectionForTest: (_) => connection);+ app.gitProjectReaderForTest = (_, _) async => {'isGit': false};+ final machine = app.machineStates['m']!;+ machine.nodeOnline = true;+ machine.localOnly = true;+ machine.agents = [+ for (final agent in machine.agents)+ Agent(+ id: agent.id,+ name: agent.name,+ engine: agent.id == 'a0' ? 'claude' : 'codex',+ terminalAvailable: true,+ project: AgentProject(name: 'work', cwd: '/work/${agent.id}'),+ ),+ ];+ return (app, connection);+}++NewHarnessController _form(WidgetTester tester) =>+ tester.widget<NewHarnessForm>(find.byType(NewHarnessForm)).controller;++Future<void> _create(WidgetTester tester, _Creation connection) async {+ await startHarness(tester);+ expect(+ connection.calls.where((call) => call == 'agent_create'),+ hasLength(1),+ );+ connection.complete();+ await tester.pump();+ // The fake transport does not attach the created terminal, so its loading+ // indicator keeps animating after the receipt has settled.+ await tester.pump(const Duration(milliseconds: 300));+ await tester.pump();+}+void main() {for (final axis in PaneResizeAxis.values) {final direction = axis == PaneResizeAxis.x ? 'right' : 'down';- final title = axis == PaneResizeAxis.x- ? 'New Pane to the Right'- : 'New Pane Below';- testWidgets('five-pane side tile can split $direction with scrolling', (+ final shortcut = axis == PaneResizeAxis.x+ ? LogicalKeyboardKey.keyR+ : LogicalKeyboardKey.keyD;+ testWidgets('five-pane side tile can create $direction with scrolling', (tester,) async {final store = MemoryStore();- final app = createApp(store: store);- final machine = app.machineStates['m']!;- machine.nodeOnline = true;- machine.localOnly = true;- machine.agents[5] = const Agent(- id: 'a5',- name: 'Sixth helper',- engine: 'codex',- terminalAvailable: true,- );+ final (app, connection) = _splitApp(store: store);final frames = <TerminalBinaryFrame>[];final original = [for (var i = 0; i < 5; i++)app.adoptSessionForTest(terminal('a$i', frames)),];- final swarm = app.activeSwarm;app.setPreset(5, PanePreset.middleMain);- app.newSwarm();- final helper = app.adoptSessionForTest(terminal('a5', frames));- app.selectSwarm(swarm.id);final target = original[3];app.focusPane(target.id);await mount(tester, app);@@ -94,46 +128,20 @@ void main() {matching: find.byType(TerminalView),);final retained = tester.element(view);- final button = find.descendant(- of: find.byKey(target.cellKey),- matching: find.byKey(ValueKey('pane-split-$direction')),- );- expect(button, findsNothing);- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);- final targetRect = tester.getRect(find.byKey(target.cellKey));- await mouse.addPointer(location: targetRect.center);- await mouse.moveTo(- axis == PaneResizeAxis.x- ? Offset(targetRect.right - 2, targetRect.center.dy)- : Offset(targetRect.center.dx, targetRect.bottom - 2),- );- await tester.pump();- await tester.pump(const Duration(milliseconds: 120));- expect(button, findsNothing);- await chord(- tester,- axis == PaneResizeAxis.x- ? LogicalKeyboardKey.keyR- : LogicalKeyboardKey.keyD,- );+ final rect = tester.getRect(find.byKey(target.cellKey));+ await chord(tester, shortcut);await tester.pump();- expect(find.text(title), findsOneWidget);+ expect(_form(tester).split?.paneId, target.id);+ expect(_form(tester).project.folder, '/work/a3');+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pump();expect(app.panes, original);- await chord(- tester,- axis == PaneResizeAxis.x- ? LogicalKeyboardKey.keyR- : LogicalKeyboardKey.keyD,- );- final search = find.byKey(const ValueKey('swarm-search-input'));- expect(search, findsOneWidget);- await tester.enterText(search, 'Sixth helper');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- await tester.pump(const Duration(milliseconds: 100));+ expect(tester.getRect(find.byKey(target.cellKey)), rect);+ expect(tester.element(view), same(retained));+ await chord(tester, shortcut);+ await _create(tester, connection);+ final helper = app.panes.singleWhere((pane) => pane.agentId == 'created');expect(app.panes, [...original.take(4), helper, original.last]);expect(tester.element(view), same(retained));final before = tester.getRect(find.byKey(target.cellKey));@@ -145,6 +153,11 @@ void main() {expect(after.top, greaterThan(before.bottom));expect(after.left, before.left);}+ expect(+ app.focusedPaneId,+ helper.id,+ reason: 'creation reveals its new pane',+ );final viewport = tester.view.physicalSize;expect(after.left, greaterThanOrEqualTo(0));expect(after.top, greaterThanOrEqualTo(0));@@ -161,15 +174,9 @@ void main() {).controller!;expect(scroll.position.maxScrollExtent, greaterThan(0));- // Directional focus also reveals an existing pane outside the viewport.app.focusPane(original[2].id);await chord(tester, LogicalKeyboardKey.arrowDown);- await tester.pump();expect(app.focusedPaneId, original.last.id);- expect(- tester.getRect(find.byKey(original.last.cellKey)).right,- lessThanOrEqualTo(viewport.width + .001),- );app.focusPane(original.last.id);await chord(tester, LogicalKeyboardKey.arrowLeft);await tester.pump();@@ -177,16 +184,13 @@ void main() {final focused = tester.getRect(find.byKey(original[1].cellKey));expect(focused.left, greaterThanOrEqualTo(0));expect(focused.right, lessThanOrEqualTo(viewport.width + .001));- app.focusPane(helper.id, reveal: true);- await tester.pump();expect(frames, isEmpty);await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);await tester.pump(const Duration(milliseconds: 10));- expect(frames.single.streamId, helper.session!.streamId);+ expect(frames.single.streamId, original[1].session!.streamId);final savedTiles = app.activeSwarm.manualLayout!.tiles;final savedExtent = scroll.position.maxScrollExtent;await app.flushPaneLayout();- await mouse.removePointer();await tester.pumpWidget(const SizedBox());app.dispose();final restored = createApp(store: store);@@ -211,26 +215,12 @@ void main() {});for (final trigger in ['shortcut', 'palette', 'native menu']) {- testWidgets('$trigger splits the focused pane $direction', (+ testWidgets('$trigger creates a new pane $direction without searching', (tester,) async {- final app = createApp();- final machine = app.machineStates['m']!;- machine.nodeOnline = true;- machine.localOnly = true;- machine.agents[2] = const Agent(- id: 'a2',- name: 'New split helper',- engine: 'codex',- terminalAvailable: true,- );+ final (app, connection) = _splitApp();final frames = <TerminalBinaryFrame>[];final first = app.adoptSessionForTest(terminal('a0', frames));- final original = app.activeSwarmId;- app.newSwarm();- final helper = app.adoptSessionForTest(terminal('a2', frames));- app.selectSwarm(original);- app.focusPane(first.id);const channel = MethodChannel('harness/swarm_tabs');final messenger = tester.binding.defaultBinaryMessenger;messenger.setMockMethodCallHandler(channel, (_) async => true);@@ -240,12 +230,7 @@ void main() {await tester.pump();switch (trigger) {case 'shortcut':- await chord(- tester,- axis == PaneResizeAxis.x- ? LogicalKeyboardKey.keyR- : LogicalKeyboardKey.keyD,- );+ await chord(tester, shortcut);case 'palette':await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(@@ -266,17 +251,19 @@ void main() {);}await tester.pump();- final search = find.byKey(const ValueKey('swarm-search-input'));- expect(search, findsOneWidget);- expect(find.text(title), findsOneWidget);+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);+ final form = _form(tester);+ expect(form.split?.axis, axis);+ expect(form.split?.paneId, first.id);+ expect(form.engine, 'claude');+ expect(form.machineId, 'm');+ expect(form.project.folder, '/work/a0');expect(app.panes, [first]);- await tester.enterText(search, 'New split helper');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(app.panes, [first, helper]);+ expect(connection.creation, isNull);+ await _create(tester, connection);+ expect(app.panes.map((pane) => pane.agentId), ['a0', 'created']);final before = tester.getRect(find.byKey(first.cellKey));- final after = tester.getRect(find.byKey(helper.cellKey));+ final after = tester.getRect(find.byKey(app.panes.last.cellKey));if (axis == PaneResizeAxis.x) {expect(after.left, greaterThan(before.right));expect(after.top, before.top);@@ -290,181 +277,126 @@ void main() {});}- testWidgets(- 'hovering the $direction edge stays quiet and the shortcut splits the focused pane',- (tester) async {- final app = createApp();- final machine = app.machineStates['m']!;- machine.nodeOnline = true;- machine.localOnly = true;- machine.agents[2] = const Agent(- id: 'a2',- name: 'Existing helper',- engine: 'codex',- terminalAvailable: true,- );- final frames = <TerminalBinaryFrame>[];- final first = app.adoptSessionForTest(terminal('a0', frames));- final neighbor = app.adoptSessionForTest(terminal('a1', frames));- final original = app.activeSwarmId;- app.newSwarm();- final helper = app.adoptSessionForTest(terminal('a2', frames));- app.selectSwarm(original);- app.focusPane(neighbor.id);- await mountWide(tester, app);- tester.view.physicalSize = const Size(3000, 1800);- await tester.pump();- final target = find.byKey(first.cellKey);- final rect = tester.getRect(target);- final neighborRect = tester.getRect(find.byKey(neighbor.cellKey));- final view = find.descendant(- of: target,- matching: find.byType(TerminalView),- );- final retained = tester.element(view);- final previousFocus = FocusManager.instance.primaryFocus;- final button = find.descendant(- of: target,- matching: find.byKey(ValueKey('pane-split-$direction')),- );- expect(button, findsNothing);- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);- await mouse.addPointer(location: rect.center);- await mouse.moveTo(- axis == PaneResizeAxis.x- ? Offset(rect.right - 2, rect.center.dy)- : Offset(rect.center.dx, rect.bottom - 2),- );- await tester.pump(const Duration(milliseconds: 120));- expect(button, findsNothing);- expect(app.focusedPaneId, neighbor.id);- expect(FocusManager.instance.primaryFocus, same(previousFocus));- expect(tester.element(view), same(retained));- expect(tester.getRect(target), rect);- expect(frames, isEmpty);-- await chord(tester, LogicalKeyboardKey.arrowLeft);- expect(app.focusedPaneId, first.id);- await chord(- tester,- axis == PaneResizeAxis.x- ? LogicalKeyboardKey.keyR- : LogicalKeyboardKey.keyD,- );- await tester.pump();- final search = find.byKey(const ValueKey('swarm-search-input'));- expect(search, findsOneWidget);- expect(find.text(title), findsOneWidget);- expect(app.focusedPaneId, first.id);- await tester.enterText(search, 'Existing helper');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(search, findsNothing);- expect(app.panes, [first, helper, neighbor]);- expect(tester.element(view), same(retained));- expect(tester.getRect(find.byKey(neighbor.cellKey)), neighborRect);- final splitRect = tester.getRect(target);- final addedRect = tester.getRect(find.byKey(helper.cellKey));- if (axis == PaneResizeAxis.x) {- expect(addedRect.left, greaterThan(splitRect.right));- expect(addedRect.top, splitRect.top);- expect(addedRect.height, splitRect.height);- } else {- expect(addedRect.top, greaterThan(splitRect.bottom));- expect(addedRect.left, splitRect.left);- expect(addedRect.width, splitRect.width);- }- expect(frames, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);- await tester.pump(const Duration(milliseconds: 10));- expect(frames.single.streamId, helper.session!.streamId);- expect(frames.single.bytes, [27, 91, 67]);- await mouse.removePointer();- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );-- testWidgets('split $direction creates through the same picker as Cmd-P', (+ testWidgets('header creates $direction from the clicked, unfocused pane', (tester,) async {- newHarnessOpensInBox = true;- addTearDown(() => newHarnessOpensInBox = false);- final connection = _Creation();- final app = createApp(connectionForTest: (_) => connection);- app.gitProjectReaderForTest = (_, _) async => {'isGit': false};- final machine = app.machineStates['m']!;- machine.nodeOnline = true;- machine.localOnly = true;- machine.agents[0] = const Agent(- id: 'a0',- name: 'Checkout',- engine: 'claude',- project: AgentProject(name: 'work', cwd: '/work/checkout'),- );+ final (app, connection) = _splitApp();final frames = <TerminalBinaryFrame>[];- final pane = app.adoptSessionForTest(terminal('a0', frames));- final original = app.activeSwarmId;+ final first = app.adoptSessionForTest(terminal('a0', frames));+ final neighbor = app.adoptSessionForTest(terminal('a1', frames));+ app.focusPane(neighbor.id);await mountWide(tester, app);- final rect = tester.getRect(find.byKey(pane.cellKey));- final shortcut = axis == PaneResizeAxis.x- ? LogicalKeyboardKey.keyR- : LogicalKeyboardKey.keyD;- await chord(tester, shortcut);- expect(find.text(title), findsOneWidget);+ tester.view.physicalSize = const Size(3000, 1800);+ await tester.pump();+ final target = find.byKey(first.cellKey);+ final rect = tester.getRect(target);+ final neighborRect = tester.getRect(find.byKey(neighbor.cellKey));+ final view = find.descendant(+ of: target,+ matching: find.byType(TerminalView),+ );+ final retained = tester.element(view);+ final previousFocus = FocusManager.instance.primaryFocus;+ final button = find.descendant(+ of: target,+ matching: find.byKey(ValueKey('pane-split-$direction')),+ );+ expect(button.hitTestable(), findsOneWidget);+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);+ await mouse.addPointer(location: rect.center);+ await mouse.moveTo(tester.getCenter(button));+ await tester.pump();+ expect(app.focusedPaneId, neighbor.id);+ expect(FocusManager.instance.primaryFocus, same(previousFocus));+ expect(tester.element(view), same(retained));+ expect(tester.getRect(target), rect);+ await tester.tap(button);+ await tester.pump();+ expect(_form(tester).split?.paneId, first.id);+ expect(_form(tester).engine, 'claude');+ expect(_form(tester).project.folder, '/work/a0');+ expect(app.focusedPaneId, first.id);+ expect(connection.creation, isNull);await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pump();- expect(app.panes, [pane]);- expect(tester.getRect(find.byKey(pane.cellKey)), rect);+ expect(app.panes, [first, neighbor]);+ expect(tester.getRect(target), rect);+ expect(tester.element(view), same(retained));await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);await tester.pump(const Duration(milliseconds: 10));- expect(frames.single.bytes, [27, 91, 67]);+ expect(frames.single.streamId, first.session!.streamId);frames.clear();-- // Empty search selects creation, just as New Pane does.- await chord(tester, shortcut);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- final box = tester- .widget<NewHarnessForm>(find.byType(NewHarnessForm))- .controller;- expect(box.split?.axis, axis);- expect(box.split?.paneId, pane.id);- expect(box.engine, 'claude');- expect(box.machineId, 'm');- expect(box.project.folder, '/work/checkout');- expect(app.panes, [pane]);- expect(connection.calls, isNot(contains('agent_create')));- await startHarness(tester);+ await tester.tap(button);await tester.pump();- expect(- connection.calls.where((call) => call == 'agent_create'),- hasLength(1),- );- expect(app.panes, [pane]);- connection.complete();- await tester.pump();- // The fake connection never attaches the new terminal, whose loading- // indicator keeps animating after creation has already completed.- await tester.pump(const Duration(milliseconds: 200));- expect(app.activeSwarmId, original);- expect(app.panes.map((pane) => pane.agentId), ['a0', 'created']);- final before = tester.getRect(find.byKey(pane.cellKey));- final after = tester.getRect(find.byKey(app.panes.last.cellKey));+ await _create(tester, connection);+ expect(app.panes.map((pane) => pane.agentId), ['a0', 'created', 'a1']);+ expect(tester.element(view), same(retained));+ expect(tester.getRect(find.byKey(neighbor.cellKey)), neighborRect);+ final splitRect = tester.getRect(target);+ final addedRect = tester.getRect(find.byKey(app.panes[1].cellKey));if (axis == PaneResizeAxis.x) {- expect(after.left, greaterThan(before.right));- expect(after.top, before.top);+ expect(addedRect.left, greaterThan(splitRect.right));+ expect(addedRect.top, splitRect.top);+ expect(addedRect.height, splitRect.height);} else {- expect(after.top, greaterThan(before.bottom));- expect(after.left, before.left);+ expect(addedRect.top, greaterThan(splitRect.bottom));+ expect(addedRect.left, splitRect.left);+ expect(addedRect.width, splitRect.width);}expect(frames, isEmpty);+ await mouse.removePointer();await tester.pumpWidget(const SizedBox());app.dispose();});}+ testWidgets('zoom restores the layout and keeps terminal renderers alive', (+ tester,+ ) async {+ final (app, connection) = _splitApp();+ final frames = <TerminalBinaryFrame>[];+ final first = app.adoptSessionForTest(terminal('a0', frames));+ final neighbor = app.adoptSessionForTest(terminal('a1', frames));+ await mountWide(tester, app);+ final pane = find.byKey(first.cellKey);+ final view = find.descendant(of: pane, matching: find.byType(TerminalView));+ final retained = tester.element(view);+ final rect = tester.getRect(pane);+ final zoom = find.descendant(+ of: pane,+ matching: find.byKey(const ValueKey('pane-zoom')),+ );+ await tester.tap(zoom);+ await tester.pump();+ expect(app.focusedPaneId, first.id);+ expect(app.zoomedPaneId, first.id);+ expect(tester.element(view), same(retained));+ expect(tester.getSize(pane).width, greaterThan(rect.width));+ final split = find.descendant(+ of: pane,+ matching: find.byKey(const ValueKey('pane-split-right')),+ );+ expect(tester.widget<PaneHeaderButton>(split).onPressed, isNull);+ await tester.tap(split);+ await tester.pump();+ expect(find.byType(NewHarnessForm), findsNothing);+ expect(connection.creation, isNull);+ await tester.tap(zoom);+ await tester.pump();+ expect(app.zoomedPaneId, isNull);+ expect(tester.getRect(pane), rect);+ expect(tester.element(view), same(retained));+ expect(frames, isEmpty);+ await tester.tap(+ find.descendant(of: pane, matching: find.byType(PaneCloseButton)),+ );+ await tester.pump();+ expect(app.panes, [neighbor]);+ expect(neighbor.session, isNotNull);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+testWidgets('manual split keeps neighboring terminals and pins, restores offline and closes/reopens precisely',(tester) async {@@ -630,6 +562,8 @@ void main() {testWidgets('split creation dismissal restores terminal input immediately', (tester,) async {+ newHarnessOpensInBox = true;+ addTearDown(() => newHarnessOpensInBox = false);final connection = _Creation();final app = createApp(connectionForTest: (_) => connection);final machine = app.machineStates['m']!;@@ -653,25 +587,8 @@ void main() {await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();- expect(find.text('New Pane to the Right'), findsOneWidget);- expect(- tester- .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))- .search- .canAccept,- isTrue,- );- expect(find.byType(AlertDialog), findsNothing);- await chord(tester, LogicalKeyboardKey.keyN);- await tester.pump();- expect(find.text('New Harness to the right'), findsOneWidget);- expect(- find.descendant(- of: find.byKey(const Key('new-agent-project-browse')),- matching: find.text('checkout'),- ),- findsOneWidget,- );+ expect(_form(tester).split?.paneId, pane.id);+ expect(_form(tester).project.folder, '/work/checkout');expect(app.panes, [pane]);await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pump();diff --git a/desktop/test/terminal_panel_header_test.dart b/desktop/test/terminal_panel_header_test.dartindex 46ae68eb9..e41456b7d 100644--- a/desktop/test/terminal_panel_header_test.dart+++ b/desktop/test/terminal_panel_header_test.dart@@ -11,6 +11,7 @@ import 'package:harness/core/models.dart';import 'package:harness/state/app_state.dart';import 'package:harness/terminal/terminal_session.dart';import 'package:harness/theme/app_theme.dart';+import 'package:harness/widgets/agent_drag.dart';import 'package:harness/widgets/pane_share_badge.dart';import 'package:harness/widgets/terminal_panel.dart';@@ -107,6 +108,7 @@ void main() {session: session,focused: true,compactHeader: compactHeader,+ onClose: compactHeader ? () {} : null,),),),@@ -134,16 +136,15 @@ void main() {'shares': [],};- // A workspace pane's header is compact: its right side's budget holds only- // the close button, and a status beside the name fills the name's row. The- // mark sits at the right edge either way.+ // Sharing stays beside the trailing model and pane controls, including when+ // a connection status fills the title row. It must not overlap either group.for (final width in [420.0, 900.0]) {for (final status in [TerminalSessionStatus.controlling,TerminalSessionStatus.takenOver,]) {testWidgets(- 'a shared pane says so at the right edge, ${status.name}, width $width',+ 'a shared pane keeps its badge before model and controls, ${status.name}, width $width',(tester) async {final session = sessionNamed('Desktop')..status = status;addTearDown(session.dispose);@@ -163,9 +164,24 @@ void main() {rect.left,greaterThan(tester.getRect(find.text('Desktop')).right),);- // Only the header's own right-side controls (the close icon) follow.- expect(rect.right, greaterThan(width - 100));- expect(rect.right, lessThanOrEqualTo(width));+ final model = tester.getRect(+ find.byKey(const ValueKey(('pane-model', 'local', 'agent-1'))),+ );+ final controls = [+ for (final key in [+ 'pane-split-down',+ 'pane-split-right',+ 'pane-zoom',+ ])+ tester.getRect(find.byKey(ValueKey(key))),+ tester.getRect(find.byType(PaneCloseButton)),+ ];+ expect(rect.right, closeTo(model.left, 1));+ expect(model.right, closeTo(controls.first.left, 1));+ for (var i = 1; i < controls.length; i++) {+ expect(controls[i - 1].right, closeTo(controls[i].left, 1));+ }+ expect(controls.last.right, closeTo(width - 4, 1));if (width > 560) expect(find.text('Public'), findsOneWidget);expect(tester.takeException(), isNull);await tester.pumpWidget(const SizedBox());diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dartindex 12bbfe427..18bdbafe9 100644--- a/desktop/test/terminal_panel_presentation_test.dart+++ b/desktop/test/terminal_panel_presentation_test.dart@@ -27,6 +27,7 @@ void main() {final closed = <int>[];final deleted = <int>[];final zoomed = <int>[];+ final splits = <(String, int)>[];tester.view.devicePixelRatio = 1;tester.view.physicalSize = const Size(1100, 700);addTearDown(tester.view.reset);@@ -42,6 +43,8 @@ void main() {onClose: () => closed.add(version),onDelete: () => deleted.add(version),onToggleZoom: () => zoomed.add(version),+ onSplitDown: () => splits.add(('down', version)),+ onSplitRight: () => splits.add(('right', version)),zoomed: version >= 2,),),@@ -55,12 +58,15 @@ void main() {await mouse.moveTo(tester.getCenter(find.text(session.agentName)));await tester.pump();expect(find.byTooltip('Close Pane').hitTestable(), findsOneWidget);- for (final label in ['Zoom Pane', 'Stop Harness']) {+ for (final label in ['Stop Harness']) {expect(find.byTooltip(label), findsNothing);}expect(closed, isEmpty);expect(deleted, isEmpty);expect(zoomed, isEmpty);+ await tester.tap(find.byTooltip('New Pane Below'));+ await tester.tap(find.byTooltip('New Pane to the Right'));+ expect(splits, [('down', 1), ('right', 1)]);expect(find.byTooltip('Pane actions'), findsNothing);expect(find.byTooltip('Restart Harness'), findsNothing);expect(find.byTooltip('Share harness'), findsNothing);@@ -172,7 +178,9 @@ void main() {);revision.value = 2;await tester.pump();- expect(find.byTooltip('Restore Pane'), findsNothing);+ expect(find.byTooltip('Restore Pane').hitTestable(), findsOneWidget);+ await tester.tap(find.byTooltip('Restore Pane'));+ expect(zoomed, [2]);session.status = TerminalSessionStatus.takenOver;revision.value = 3;await tester.pump();@@ -272,7 +280,7 @@ void main() {reason: 'The model belongs to its pane header.',);expect(find.byTooltip('Close Pane').hitTestable(), findsOneWidget);- for (final label in ['Zoom Pane', 'Stop Harness']) {+ for (final label in ['Stop Harness']) {expect(find.byTooltip(label).hitTestable(), findsNothing);}final controlsBounds = tester.getRect(controls);@@ -281,14 +289,14 @@ void main() {await mouse.moveTo(tester.getCenter(title));await tester.pump();expect(find.byTooltip('Close Pane').hitTestable(), findsOneWidget);- for (final label in ['Zoom Pane', 'Stop Harness']) {+ for (final label in ['Stop Harness']) {expect(find.byTooltip(label), findsNothing);}expect(tester.getRect(title), titleBounds);expect(tester.getRect(controls), controlsBounds);await mouse.moveTo(tester.getCenter(find.byType(TerminalView)));await tester.pump();- for (final label in ['Zoom Pane', 'Stop Harness']) {+ for (final label in ['Stop Harness']) {expect(find.byTooltip(label).hitTestable(), findsNothing);}expect(find.byTooltip('Share harness'), findsNothing);@@ -354,7 +362,7 @@ void main() {);await tester.pump();final title = find.text(session.agentName);- expect(tester.getSize(title).width, greaterThan(64));+ expect(tester.getSize(title).width, greaterThan(40));expect(tester.takeException(), isNull);final titleBefore = tester.getRect(title);expect(find.byType(GridModelPicker), findsOneWidget);@@ -365,7 +373,7 @@ void main() {expect(find.byTooltip('Close Pane').hitTestable(), findsOneWidget);await mouse.removePointer();expect(find.byTooltip('Stop Harness'), findsNothing);- expect(find.byTooltip('Zoom Pane'), findsNothing);+ expect(find.byTooltip('Zoom Pane').hitTestable(), findsOneWidget);expect(tester.getRect(title), titleBefore);for (final status in [TerminalSessionStatus.opening,diff --git a/desktop/test/web_pane_test.dart b/desktop/test/web_pane_test.dartindex b982177c2..dcd81a166 100644--- a/desktop/test/web_pane_test.dart+++ b/desktop/test/web_pane_test.dart@@ -339,7 +339,8 @@ void main() {await tester.pump();expect(opened, [Uri.parse('http://127.0.0.1:4179/')]);// Its own close control, and no way to end an agent from it.- expect(find.byTooltip('Close viewer'), findsOneWidget);+ final closeViewer = find.byTooltip(RegExp(r'^Close viewer(?: · .+)?$'));+ expect(closeViewer, findsOneWidget);// Stop remains a command, not a pane-header control. Viewer visibility// is also available through View and command search.expect(find.byTooltip('Stop Harness'), findsNothing);@@ -368,7 +369,7 @@ void main() {// One status in the viewer's title, and nothing on the terminal's: the// phase under way here, since the deck is neither ready nor failing.final viewerHeader = find.ancestor(- of: find.byTooltip('Close viewer'),+ of: closeViewer,matching: find.byType(WebPanePanel),);expect(@@ -383,7 +384,7 @@ void main() {expect(find.text('Build'), findsNothing);expect(find.text('1 warning'), findsNothing, reason: 'the phase wins');expect(find.textContaining('· Viewer'), findsNothing);- await tester.tap(find.byTooltip('Close viewer'));+ await tester.tap(closeViewer);await tester.pumpAndSettle();expect(_viewers(app), isEmpty);expect(tester.takeException(), isNull);diff --git a/desktop/test/workspace_status_test.dart b/desktop/test/workspace_status_test.dartindex 6dedbd6e3..71ec0cd5f 100644--- a/desktop/test/workspace_status_test.dart+++ b/desktop/test/workspace_status_test.dart@@ -17,6 +17,7 @@ import 'package:harness/shared/theme/color_palette.dart';import 'package:harness/shared/theme/prompt_style.dart';import 'package:harness/shared/theme/status_line_style.dart';import 'package:harness/state/swarm.dart';+import 'package:harness/state/pane_preset.dart';import 'package:harness/state/terminal_pane.dart';import 'package:harness/state/workspace_status.dart';import 'package:harness/screens/swarm_screen.dart';@@ -168,6 +169,93 @@ void main() {}}});+ for (final brightness in Brightness.values) {+ for (final count in [4, 9]) {+ testWidgets('$count pane toolbars stay aligned in ${brightness.name}', (+ tester,+ ) async {+ final oldBrightness = grid.AppTheme.brightness.value;+ final oldPalette = grid.AppTheme.palette.value;+ grid.AppTheme.palette.value = brightness == Brightness.dark+ ? HarnessPalette.graphite+ : HarnessPalette.paper;+ addTearDown(() => grid.AppTheme.palette.value = oldPalette);+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = oldBrightness);+ final app = createApp();+ final names = [+ 'Composer polish',+ 'Review changes',+ 'API cleanup',+ 'Improve search',+ 'Keyboard shortcuts',+ 'Docs',+ 'Release notes',+ 'Test coverage',+ 'Model picker',+ ];+ app.machineStates['m']!.localOnly = true;+ app.machineStates['m']!.nodeOnline = true;+ app.machineStates['m']!.agents = [+ for (var i = 0; i < count; i++)+ Agent.fromJson({+ 'id': 'a$i',+ 'name': names[i],+ 'engine': i.isEven ? 'codex' : 'claude',+ 'selectedModel': i.isEven+ ? 'runtime-v1:a$i:codex:gpt-6-astra@high'+ : 'runtime-v1:a$i:claude:fable@high',+ 'terminal': {'available': true},+ }),+ ];+ for (var i = 0; i < count; i++) {+ final session = terminal('a$i', [])..agentName = names[i];+ session.terminal.write('~/code/harness\r\n\r\nReady.\r\n');+ app.adoptSessionForTest(session);+ }+ app.setPreset(count, count == 4 ? PanePreset.quad : PanePreset.cols3);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1560, 1000);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: brightness),+ home: SwarmScreen(notifier: app),+ ),+ );+ await tester.pump(const Duration(milliseconds: 100));+ for (final pane in app.panes) {+ final cell = find.byKey(pane.cellKey);+ final controls = [+ find.byKey(ValueKey(('pane-model', 'm', pane.agentId!))),+ for (final key in [+ 'pane-split-down',+ 'pane-split-right',+ 'pane-zoom',+ ])+ find.descendant(of: cell, matching: find.byKey(ValueKey(key))),+ find.descendant(of: cell, matching: find.byType(PaneCloseButton)),+ ];+ for (var i = 1; i < controls.length; i++) {+ final previous = tester.getRect(controls[i - 1]);+ final rect = tester.getRect(controls[i]);+ expect(rect.left, greaterThanOrEqualTo(previous.right));+ expect(rect.center.dy, closeTo(previous.center.dy, .1));+ expect(rect.width, 28);+ expect(rect.height, greaterThanOrEqualTo(28));+ }+ final close = tester.getRect(controls.last);+ expect(close.right, lessThan(tester.getRect(cell).right));+ }+ expect(tester.takeException(), isNull);+ await tester.pump(const Duration(milliseconds: 100));+ await captureControls(tester, 'pane-toolbar-$count-${brightness.name}');+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+ }+ }for (final native in [false, true]) {testWidgets('pane model opens shared picker for its harness (native=$native)',@@ -336,6 +424,11 @@ void main() {);expect(parts[1].foreground, isNot(palette.foreground));expect(parts[3].foreground, isNot(palette.foreground));+ expect(+ parts[1].foreground,+ parts[3].foreground,+ reason: 'Exhausted allowance shares quiet amber with low allowance.',+ );for (final index in [0, 2, 4, 5]) {expect(parts[index].foreground, palette.foreground);}