Skip to content

The agent that grows with you

test: purge low-value tests, lane js06 (375 removed)

teknium138137d2b6e72
diff --git a/apps/desktop/src/store/session-watchdog.test.ts b/apps/desktop/src/store/session-watchdog.test.ts
index a78d606757a..c080985e884 100644
--- a/apps/desktop/src/store/session-watchdog.test.ts
+++ b/apps/desktop/src/store/session-watchdog.test.ts
@@ -5,11 +5,9 @@ import { createClientSessionState } from '@/lib/chat-runtime'
import { $activeSessionId, $selectedStoredSessionId, $unreadFinishedSessionIds } from './session'
import {
- $attentionSessionIds,
$stalledSessionIds,
$workingSessionIds,
clearAllSessionStates,
- getRecentlySettledSessionIds,
publishSessionState,
SESSION_WATCHDOG_TIMEOUT_MS
} from './session-states'
@@ -22,111 +20,6 @@ function state(over: Partial<ClientSessionState> = {}): ClientSessionState {
return { ...createClientSessionState(null), storedSessionId: 's1', ...over }
}
-describe('session status transitions', () => {
- beforeEach(() => {
- vi.useFakeTimers()
- vi.setSystemTime(0)
- clearAllSessionStates()
- $unreadFinishedSessionIds.set([])
- $selectedStoredSessionId.set(null)
- $activeSessionId.set(null)
- })
-
- afterEach(() => {
- vi.runOnlyPendingTimers()
- vi.useRealTimers()
- clearAllSessionStates()
- $unreadFinishedSessionIds.set([])
- $selectedStoredSessionId.set(null)
- $activeSessionId.set(null)
- })
-
- it('adds a session to $workingSessionIds when busy transitions to true', () => {
- const s = state({ busy: false, storedSessionId: 's1' })
- publishSessionState('rt1', s)
-
- publishSessionState('rt1', { ...s, busy: true })
-
- expect($workingSessionIds.get()).toContain('s1')
- })
-
- it('removes a session from $workingSessionIds when busy transitions to false', () => {
- const working = state({ busy: true, storedSessionId: 's1' })
- publishSessionState('rt1', working)
-
- expect($workingSessionIds.get()).toContain('s1')
-
- publishSessionState('rt1', { ...working, busy: false })
-
- expect($workingSessionIds.get()).not.toContain('s1')
- })
-
- it('adds a session to $attentionSessionIds when needsInput is true', () => {
- const s = state({ busy: true, needsInput: false, storedSessionId: 's1' })
- publishSessionState('rt1', s)
-
- publishSessionState('rt1', { ...s, needsInput: true })
-
- expect($attentionSessionIds.get()).toContain('s1')
- })
-
- it('marks a background session unread when its turn finishes', () => {
- $selectedStoredSessionId.set('other-session')
- const working = state({ busy: true, storedSessionId: 's1' })
- publishSessionState('rt1', working)
-
- publishSessionState('rt1', { ...working, busy: false })
-
- expect($unreadFinishedSessionIds.get()).toEqual(['s1'])
- })
-
- it('does NOT mark unread when the finishing session is the active one', () => {
- $selectedStoredSessionId.set('s1')
- const working = state({ busy: true, storedSessionId: 's1' })
- publishSessionState('rt1', working)
-
- publishSessionState('rt1', { ...working, busy: false })
-
- expect($unreadFinishedSessionIds.get()).toEqual([])
- })
-
- it('does NOT mark unread on idle→idle re-asserts (no prior working state)', () => {
- $selectedStoredSessionId.set('other-session')
- publishSessionState('rt1', state({ busy: false, storedSessionId: 's1' }))
-
- expect($unreadFinishedSessionIds.get()).toEqual([])
- })
-
- it('grants settle grace when a working session goes idle', () => {
- $selectedStoredSessionId.set('other')
- const working = state({ busy: true, storedSessionId: 's1' })
- publishSessionState('rt1', working)
-
- publishSessionState('rt1', { ...working, busy: false })
-
- expect(getRecentlySettledSessionIds()).toEqual(['s1'])
- })
-
- it('does not grant grace on idle→idle re-asserts', () => {
- publishSessionState('rt1', state({ busy: false, storedSessionId: 's1' }))
- expect(getRecentlySettledSessionIds()).toEqual([])
- })
-
- it('clears settle grace when the session goes busy again', () => {
- $selectedStoredSessionId.set('other')
- const working = state({ busy: true, storedSessionId: 's2' })
- publishSessionState('rt1', working)
- const idle = { ...working, busy: false }
- publishSessionState('rt1', idle)
-
- expect(getRecentlySettledSessionIds()).toEqual(['s2'])
-
- publishSessionState('rt1', { ...idle, busy: true })
-
- expect(getRecentlySettledSessionIds()).toEqual([])
- })
-})
-
describe('session watchdog', () => {
beforeEach(() => {
vi.useFakeTimers()
@@ -212,10 +105,6 @@ describe('computed $workingSessionIds', () => {
clearAllSessionStates()
})
- it('is empty when no sessions are busy', () => {
- expect($workingSessionIds.get()).toEqual([])
- })
-
it('reflects busy sessions under the id their surfaces key on', () => {
publishSessionState('rt1', state({ busy: true, storedSessionId: 's1' }))
publishSessionState('rt2', state({ busy: false, storedSessionId: 's2' }))
@@ -234,28 +123,3 @@ describe('computed $workingSessionIds', () => {
expect($workingSessionIds.get()).toEqual([])
})
})
-
-describe('computed $attentionSessionIds', () => {
- beforeEach(() => {
- clearAllSessionStates()
- })
-
- afterEach(() => {
- clearAllSessionStates()
- })
-
- it('reflects sessions with needsInput=true and a storedSessionId', () => {
- publishSessionState('rt1', state({ needsInput: true, storedSessionId: 's1' }))
- publishSessionState('rt2', state({ needsInput: false, storedSessionId: 's2' }))
-
- expect($attentionSessionIds.get()).toEqual(['s1'])
- })
-
- it('clears when $sessionStates is cleared', () => {
- publishSessionState('rt1', state({ needsInput: true, storedSessionId: 's1' }))
- expect($attentionSessionIds.get()).toEqual(['s1'])
-
- clearAllSessionStates()
- expect($attentionSessionIds.get()).toEqual([])
- })
-})
diff --git a/apps/desktop/src/store/subagents.test.ts b/apps/desktop/src/store/subagents.test.ts
index a5054d246ef..beb777d151c 100644
--- a/apps/desktop/src/store/subagents.test.ts
+++ b/apps/desktop/src/store/subagents.test.ts
@@ -287,7 +287,7 @@ describe('subagent store', () => {
const item = listFor('s1')[0]
expect(item?.status).toBe('failed')
expect(item?.durationSeconds).toBe(612.3)
- expect(item?.summary).toBe('Timed out after 612.3s')
+ expect(item?.summary).toContain('612.3')
// A timed-out row must be pruned at the next message.start boundary like
// any other finished row — it must not linger as a live spinner.
@@ -295,13 +295,6 @@ describe('subagent store', () => {
expect(listFor('s1')).toHaveLength(0)
})
- it('falls back to a placeholder when timeout duration is missing', () => {
- upsertSubagent('s1', { goal: 'scan files', status: 'running', subagent_id: 't2', task_index: 0 })
- upsertSubagent('s1', { status: 'timeout', subagent_id: 't2', task_index: 0 }, false, 'subagent.complete')
-
- expect(listFor('s1')[0]?.summary).toBe('Timed out after ?s')
- })
-
// Fail-closed guard: subagent.complete is terminal by definition, so an
// unrecognized status on it must not resurrect a row as 'running'. Live
// events keep the lenient fallback (a status we don't know is still active).
diff --git a/apps/desktop/src/store/suggestion-providers/mcp.test.ts b/apps/desktop/src/store/suggestion-providers/mcp.test.ts
index 8d643a1dbe5..51cc49c2802 100644
--- a/apps/desktop/src/store/suggestion-providers/mcp.test.ts
+++ b/apps/desktop/src/store/suggestion-providers/mcp.test.ts
@@ -114,16 +114,4 @@ describe('matchSuggestions', () => {
{ keyword: 'linear.app', server: 'linear' }
])
})
-
- it('does not offer GitHub: it is not in the catalog, so no index entry can match it', () => {
- // GitHub is not in optional-mcps (its hosted MCP needs a per-host OAuth app), so a
- // catalog-built index has no entry for it.
- const catalogIndex = [
- { hosts: ['linear.app'], keywords: ['linear'], server: 'linear' },
- { hosts: ['figma.com'], keywords: ['figma'], server: 'figma' }
- ]
-
- expect(matchSuggestions('connect github please', catalogIndex)).toEqual([])
- expect(matchSuggestions('connect github please', [])).toEqual([])
- })
})
diff --git a/apps/desktop/src/store/terminal-backend-warning.test.ts b/apps/desktop/src/store/terminal-backend-warning.test.ts
index 542e3382d81..d320ed9d43c 100644
--- a/apps/desktop/src/store/terminal-backend-warning.test.ts
+++ b/apps/desktop/src/store/terminal-backend-warning.test.ts
@@ -41,11 +41,8 @@ test('a selected non-local backend that is not ready warns once with Use Local /
const toast = $notifications.get()[0]
expect(toast?.kind).toBe('warning')
- expect(toast?.title).toMatch(/Terminal commands are unavailable/)
expect(toast?.message).toContain('Docker')
expect(toast?.detail).toBe('Docker daemon not reachable')
- // Plain language: the toast names the tool (Docker), never "backend".
- expect(`${toast?.title} ${toast?.message} ${toast?.action?.label}`).not.toMatch(/backend/i)
toast?.action?.onClick()
expect($routeRequest.get()?.path).toBe('/capabilities?tab=toolsets')
diff --git a/apps/desktop/src/store/titlebar-app-actions.test.ts b/apps/desktop/src/store/titlebar-app-actions.test.ts
index 97766f627bc..7bd2e6e896b 100644
--- a/apps/desktop/src/store/titlebar-app-actions.test.ts
+++ b/apps/desktop/src/store/titlebar-app-actions.test.ts
@@ -8,14 +8,11 @@ import {
} from './titlebar-app-actions'
describe('titlebarAppActionsClusterCounts', () => {
- it('puts the three app actions on the right by default', () => {
- expect(titlebarAppActionsClusterCounts('right')).toEqual({ left: 1, right: 5 })
- expect(titlebarAppActionsClusterCounts('left')).toEqual({ left: 4, right: 2 })
- })
-
it('adds extras to the cluster they belong to', () => {
- expect(titlebarAppActionsClusterCounts('right', 1, 2)).toEqual({ left: 2, right: 7 })
- expect(titlebarAppActionsClusterCounts('left', 1, 2)).toEqual({ left: 5, right: 4 })
+ for (const side of ['left', 'right'] as const) {
+ const base = titlebarAppActionsClusterCounts(side)
+ expect(titlebarAppActionsClusterCounts(side, 1, 2)).toEqual({ left: base.left + 1, right: base.right + 2 })
+ }
})
it('releases the space of every tool Simple mode hides, on both sides', () => {
@@ -31,10 +28,6 @@ describe('$titlebarAppActionsSide', () => {
setTitlebarAppActionsSide(TITLEBAR_APP_ACTIONS_DEFAULT)
})
- it('defaults to right', () => {
- expect($titlebarAppActionsSide.get()).toBe('right')
- })
-
it('persists left', () => {
setTitlebarAppActionsSide('left')
expect($titlebarAppActionsSide.get()).toBe('left')
diff --git a/apps/desktop/src/store/translucency.test.ts b/apps/desktop/src/store/translucency.test.ts
index 0aa334ae1d4..52bddfe288f 100644
--- a/apps/desktop/src/store/translucency.test.ts
+++ b/apps/desktop/src/store/translucency.test.ts
@@ -31,8 +31,7 @@ import {
setTranslucencyMode,
setTranslucencyScope,
TRANSLUCENCY_MAX,
- TRANSLUCENCY_MIN,
- TRANSLUCENCY_STEP
+ TRANSLUCENCY_MIN
} from './translucency'
const KEY = 'hermes.desktop.translucency.v2'
@@ -43,7 +42,6 @@ const LEGACY_KEY = 'hermes.desktop.translucency.v1'
// This suite pins navigator.platform to a Mac before import, so the Mac table
// is the one in play — `GLASS_IS_WINDOWS` resolves false throughout.
const DARK = defaultTranslucencyValues('dark', false)
-const LIGHT = defaultTranslucencyValues('light', false)
const glassAttr = () => document.documentElement.hasAttribute('data-hermes-glass')
const clearAttr = () => document.documentElement.hasAttribute('data-hermes-clear')
@@ -59,12 +57,6 @@ describe('window translucency lever', () => {
setTranslucency(TRANSLUCENCY_MIN)
})
- it('steps in single percent so the readable low end is reachable', () => {
- expect(TRANSLUCENCY_STEP).toBe(1)
- expect(TRANSLUCENCY_MIN).toBe(0)
- expect(TRANSLUCENCY_MAX).toBe(100)
- })
-
// NB: this asserts the module's INITIAL value, so it deliberately reads the
// atom before the beforeEach above can touch it — the previous version of
// this test ran after the reset and so proved nothing about the default.
@@ -72,13 +64,6 @@ describe('window translucency lever', () => {
expect(initialTranslucency).toEqual({ ...DARK, mode: GLASS_SUPPORTED ? 'glass' : 'clear' })
})
- it('accepts every step the slider can emit', () => {
- for (let intensity = TRANSLUCENCY_MIN; intensity <= TRANSLUCENCY_MAX; intensity += TRANSLUCENCY_STEP) {
- setTranslucency(intensity)
- expect($translucency.get().intensity).toBe(intensity)
- }
- })
-
it('clamps out-of-range input and rounds fractions', () => {
setTranslucency(-40)
expect($translucency.get().intensity).toBe(TRANSLUCENCY_MIN)
@@ -456,21 +441,6 @@ describe('per-appearance settings', () => {
afterEach(() => setAppearance('dark'))
- it('ships each appearance its own defaults', () => {
- expect($translucency.get()).toEqual({ ...DARK, mode: 'glass' })
-
- setAppearance('light')
- expect($translucency.get()).toEqual({ ...LIGHT, mode: 'glass' })
- })
-
- it('ships glass ON, so the feature is visible without being found first', () => {
- expect($translucency.get().mode).toBe('glass')
- expect($translucency.get().intensity).toBeGreaterThan(0)
-
- setAppearance('light')
- expect($translucency.get().intensity).toBeGreaterThan(0)
- })
-
it('scopes an edit to the appearance it was made in', () => {
setAppearance('light')
setTranslucency(90)
diff --git a/apps/desktop/src/store/updates.test.ts b/apps/desktop/src/store/updates.test.ts
index 92d17236776..9f4111000d5 100644
--- a/apps/desktop/src/store/updates.test.ts
+++ b/apps/desktop/src/store/updates.test.ts
@@ -145,7 +145,6 @@ describe('maybeNotifyUpdateAvailable', () => {
it('shows when an update is available and not snoozed', () => {
maybeNotifyUpdateAvailable(status())
expect(notifySpy).toHaveBeenCalledTimes(1)
- expect(notifySpy.mock.calls[0]?.[0]).toMatchObject({ icon: 'gift' })
})
it('stays quiet for new commits once the toast was closed', () => {
@@ -179,10 +178,9 @@ describe('maybeNotifyUpdateAvailable', () => {
// FAIL-BEFORE: a shallow installer clone reports behind:null + updateAvailable
// (exact count unknowable without a merge-base). The guard treated null as 0
// and silently swallowed the notification entirely.
- it('still notifies with generic copy when the exact behind count is unknown', () => {
+ it('still notifies when the exact behind count is unknown', () => {
maybeNotifyUpdateAvailable(status({ behind: null, updateAvailable: true }))
expect(notifySpy).toHaveBeenCalledTimes(1)
- expect(notifySpy.mock.calls[0]?.[0]).toMatchObject({ message: 'A new update is available.' })
})
})
diff --git a/apps/desktop/src/store/vibe-hearts-enabled.test.ts b/apps/desktop/src/store/vibe-hearts-enabled.test.ts
index a0a02070863..a7431c42218 100644
--- a/apps/desktop/src/store/vibe-hearts-enabled.test.ts
+++ b/apps/desktop/src/store/vibe-hearts-enabled.test.ts
@@ -12,20 +12,9 @@ describe('vibe hearts enabled', () => {
$vibeHeartsEnabled.set(true)
})
- it('defaults to on so existing installs keep hearts', () => {
- expect($vibeHeartsEnabled.get()).toBe(true)
- })
-
it('turns off and persists', () => {
setVibeHeartsEnabled(false)
expect($vibeHeartsEnabled.get()).toBe(false)
expect(window.localStorage.getItem(KEY)).toBe('off')
})
-
- it('turns back on and persists', () => {
- setVibeHeartsEnabled(false)
- setVibeHeartsEnabled(true)
- expect($vibeHeartsEnabled.get()).toBe(true)
- expect(window.localStorage.getItem(KEY)).toBe('on')
- })
})
diff --git a/apps/desktop/src/store/windows.test.ts b/apps/desktop/src/store/windows.test.ts
index f66d2733933..add77a363b5 100644
--- a/apps/desktop/src/store/windows.test.ts
+++ b/apps/desktop/src/store/windows.test.ts
@@ -3,9 +3,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { $activeGatewayProfile } from './profile'
import { $sessions } from './session'
import {
- canOpenBrowserWindow,
- canOpenNewWindow,
- canOpenSessionWindow,
isPeerInstanceWindow,
isProfilePinnedWindow,
openBrowserInNewWindow,
@@ -46,23 +43,6 @@ afterEach(() => {
}
})
-describe('canOpenSessionWindow', () => {
- it('is false when the desktop bridge is absent', () => {
- delete desktopWindow.hermesDesktop
- expect(canOpenSessionWindow()).toBe(false)
- })
-
- it('is false when the bridge lacks openSessionWindow', () => {
- installBridge(undefined)
- expect(canOpenSessionWindow()).toBe(false)
- })
-
- it('is true when the bridge exposes openSessionWindow', () => {
- installBridge(vi.fn().mockResolvedValue({ ok: true }))
- expect(canOpenSessionWindow()).toBe(true)
- })
-})
-
describe('isPeerInstanceWindow', () => {
it('recognizes only the full peer marker', () => {
expect(isPeerInstanceWindow('?peer=1')).toBe(true)
@@ -131,23 +111,6 @@ describe('openSessionInNewWindow', () => {
})
})
-describe('canOpenNewWindow', () => {
- it('is false when the desktop bridge is absent', () => {
- delete desktopWindow.hermesDesktop
- expect(canOpenNewWindow()).toBe(false)
- })
-
- it('is false when the bridge lacks openWindow', () => {
- installBridge(vi.fn().mockResolvedValue({ ok: true }))
- expect(canOpenNewWindow()).toBe(false)
- })
-
- it('is true when the bridge exposes openWindow', () => {
- installBridge(undefined, vi.fn().mockResolvedValue({ ok: true }))
- expect(canOpenNewWindow()).toBe(true)
- })
-})
-
describe('openNewWindow', () => {
it('no-ops gracefully when the bridge is absent (web fallback)', async () => {
delete desktopWindow.hermesDesktop
@@ -157,24 +120,6 @@ describe('openNewWindow', () => {
expect(notifyError).not.toHaveBeenCalled()
})
- it('no-ops when openWindow is missing', async () => {
- installBridge(vi.fn().mockResolvedValue({ ok: true }))
-
- await openNewWindow()
-
- expect(notifyError).not.toHaveBeenCalled()
- })
-
- it('invokes the bridge', async () => {
- const openWindow = vi.fn().mockResolvedValue({ ok: true })
- installBridge(undefined, openWindow)
-
- await openNewWindow()
-
- expect(openWindow).toHaveBeenCalledTimes(1)
- expect(notifyError).not.toHaveBeenCalled()
- })
-
it('notifies on an ok:false result', async () => {
installBridge(undefined, vi.fn().mockResolvedValue({ ok: false, error: 'nope' }))
@@ -184,23 +129,6 @@ describe('openNewWindow', () => {
})
})
-describe('canOpenBrowserWindow', () => {
- it('is false when the desktop bridge is absent', () => {
- delete desktopWindow.hermesDesktop
- expect(canOpenBrowserWindow()).toBe(false)
- })
-
- it('is false when the bridge lacks openBrowserWindow', () => {
- installBridge(vi.fn().mockResolvedValue({ ok: true }))
- expect(canOpenBrowserWindow()).toBe(false)
- })
-
- it('is true when the bridge exposes openBrowserWindow', () => {
- installBridge(undefined, undefined, vi.fn().mockResolvedValue({ ok: true }))
- expect(canOpenBrowserWindow()).toBe(true)
- })
-})
-
describe('openBrowserInNewWindow', () => {
it('returns false without a tab id', async () => {
const open = vi.fn().mockResolvedValue({ ok: true })
diff --git a/apps/desktop/src/store/working-ids-stored-id.test.ts b/apps/desktop/src/store/working-ids-stored-id.test.ts
deleted file mode 100644
index 23e1cf69df6..00000000000
--- a/apps/desktop/src/store/working-ids-stored-id.test.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { afterEach, describe, expect, it } from 'vitest'
-
-import { createClientSessionState } from '@/lib/chat-runtime'
-import { $workingSessionIds, clearAllSessionStates, publishSessionState } from '@/store/session-states'
-
-/**
- * The sidebar spinner and the row arc read `$workingSessionIds`, which projects
- * `$sessionStates` down to the ids surfaces actually key on. `message.start`
- * flips `busy` without carrying a stored id, so an unpersisted chat has none
- * yet — and until it does, its runtime id is that id.
- */
-describe('$workingSessionIds — a busy runtime with no stored id', () => {
- afterEach(() => {
- clearAllSessionStates()
- })
-
- it('shows a new chat as running under its runtime id before it is persisted', () => {
- publishSessionState('runtime-unmapped', { ...createClientSessionState(null), busy: true })
-
- expect($workingSessionIds.get()).toEqual(['runtime-unmapped'])
- })
-
- it('shows the spinner as soon as the stored id is known', () => {
- publishSessionState('runtime-mapped', { ...createClientSessionState('stored-x'), busy: true })
-
- expect($workingSessionIds.get()).toEqual(['stored-x'])
- })
-})
diff --git a/apps/desktop/src/themes/backend-sync.test.ts b/apps/desktop/src/themes/backend-sync.test.ts
index 24716f1d982..a12a74419dc 100644
--- a/apps/desktop/src/themes/backend-sync.test.ts
+++ b/apps/desktop/src/themes/backend-sync.test.ts
@@ -26,22 +26,6 @@ describe('ingestBackendSkin', () => {
expect($pendingSkinApply.get()).toBe('neon')
})
- it('does not re-apply the same skin name', () => {
- ingestBackendSkin(skin('neon'), { apply: true })
- $pendingSkinApply.set(null)
- ingestBackendSkin(skin('neon'), { apply: true })
-
- expect($pendingSkinApply.get()).toBeNull()
- })
-
- it('applies again when the skin name changes', () => {
- ingestBackendSkin(skin('neon'), { apply: true })
- $pendingSkinApply.set(null)
- ingestBackendSkin(skin('forest'), { apply: true })
-
- expect($pendingSkinApply.get()).toBe('forest')
- })
-
it('seed does not paint, but a later same-name skin.changed applies (missed-activation recovery)', () => {
// Connect while display.skin is already neon: seed records the baseline
// without painting (never stomp the persisted desktop theme on connect).
diff --git a/apps/desktop/src/themes/context.test.tsx b/apps/desktop/src/themes/context.test.tsx
index 0236fa853a3..780f9155625 100644
--- a/apps/desktop/src/themes/context.test.tsx
+++ b/apps/desktop/src/themes/context.test.tsx
@@ -2,8 +2,8 @@ import { act, cleanup, render } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { __resetBackendSkinSync, ingestBackendSkin } from './backend-sync'
-import { getBaseColors, skinPref, ThemeProvider, useTheme } from './context'
-import { BUILTIN_THEME_LIST, everforestTheme } from './presets'
+import { skinPref, ThemeProvider, useTheme } from './context'
+import { everforestTheme } from './presets'
// The live-authoring loop: Hermes writes/edits one skin file and every surface
// repaints. An in-place edit keeps the NAME — only the palette moves.
@@ -161,107 +161,3 @@ describe('ThemeProvider highlight preview', () => {
expect(cssVar('--theme-foreground')).toBe(painted)
})
})
-
-// `--dt-primary-solid` is the loud brand fill of every shipped preset. The
-// desktop's original ensureContrast ladder (5 rungs of 0.2 toward the pole
-// opposite the background, re-mixed from the ORIGINAL colour) is reproduced
-// here as a reference implementation; the shared @hermes/shared/color ladder
-// must land byte-identical for every preset in every mode, or presets change
-// colour under users on an "only math moved" refactor.
-describe('ThemeProvider --dt-primary-solid preset parity', () => {
- const hexToRgb = (hex: string): [number, number, number] =>
- [0, 2, 4].map(i => parseInt(hex.replace(/^#/, '').slice(i, i + 2), 16)) as [number, number, number]
-
- const rgbToHex = (rgb: [number, number, number]) =>
- `#${rgb
- .map(n =>
- Math.round(Math.min(255, Math.max(0, n)))
- .toString(16)
- .padStart(2, '0')
- )
- .join('')}`
-
- const oldMix = (a: string, b: string, amount: number) => {
- const ar = hexToRgb(a)
- const br = hexToRgb(b)
-
- return rgbToHex([
- ar[0] + (br[0] - ar[0]) * amount,
- ar[1] + (br[1] - ar[1]) * amount,
- ar[2] + (br[2] - ar[2]) * amount
- ])
- }
-
- const linearize = (c: number) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)
-
- const oldLuminance = (hex: string) => {
- const [r, g, b] = hexToRgb(hex).map(v => linearize(v / 255))
-
- return 0.2126 * r! + 0.7152 * g! + 0.0722 * b!
- }
-
- const oldContrast = (a: string, b: string) => {
- const la = oldLuminance(a)
- const lb = oldLuminance(b)
-
- return la >= lb ? (la + 0.05) / (lb + 0.05) : (lb + 0.05) / (la + 0.05)
- }
-
- const oldEnsureContrast = (color: string, bg: string, min: number) => {
- if (oldContrast(color, bg) >= min) {
- return color
- }
-
- const towards = oldLuminance(bg) < 0.5 ? '#ffffff' : '#000000'
- let best = color
-
- for (let amount = 0.2; amount <= 1.0001; amount += 0.2) {
- best = oldMix(color, towards, Math.min(amount, 1))
-
- if (oldContrast(best, bg) >= min) {
- return best
- }
- }
-
- return best
- }
-
- beforeEach(() => {
- window.localStorage.clear()
- __resetBackendSkinSync()
- })
-
- afterEach(cleanup)
-
- let ctx: ReturnType<typeof useTheme>
-
- function Probe() {
- ctx = useTheme()
-
- return null
- }
-
- const cases = BUILTIN_THEME_LIST.flatMap(theme =>
- (['light', 'dark'] as const).map(mode => [theme.name, mode] as const)
- )
-
- it.each(cases)('%s/%s keeps the pre-refactor loud fill', (name, mode) => {
- render(
- <ThemeProvider>
- <Probe />
- </ThemeProvider>
- )
-
- act(() => ctx.previewTheme(name, mode))
-
- const primary = getBaseColors(name, mode).primary
- const expected = oldEnsureContrast(primary, '#fcfcfc', 4.5)
-
- expect(cssVar('--dt-primary-solid')).toBe(expected)
-
- // At least some presets need a lift; the assertion must not be vacuous.
- if (name === 'nous' && mode === 'dark') {
- expect(expected).not.toBe(primary)
- }
- })
-})
diff --git a/apps/desktop/src/themes/install.test.ts b/apps/desktop/src/themes/install.test.ts
index 5231f764695..62c9550f0cf 100644
--- a/apps/desktop/src/themes/install.test.ts
+++ b/apps/desktop/src/themes/install.test.ts
@@ -125,8 +125,6 @@ describe('buildThemeFromMarketplace', () => {
})
it('throws when the extension contributes no themes', () => {
- expect(() => buildThemeFromMarketplace({ extensionId: 'x.y', displayName: 'X', themes: [] })).toThrow(
- /does not contribute/i
- )
+ expect(() => buildThemeFromMarketplace({ extensionId: 'x.y', displayName: 'X', themes: [] })).toThrow()
})
})
diff --git a/apps/desktop/src/themes/presets.test.ts b/apps/desktop/src/themes/presets.test.ts
index 9ca84f510c3..c9bdf006480 100644
--- a/apps/desktop/src/themes/presets.test.ts
+++ b/apps/desktop/src/themes/presets.test.ts
@@ -1,13 +1,6 @@
import { describe, expect, it } from 'vitest'
-import {
- BUILTIN_THEME_LIST,
- BUILTIN_THEMES,
- DEFAULT_SKIN_NAME,
- DEFAULT_TYPOGRAPHY,
- EMOJI_FALLBACK,
- nousAltTheme
-} from './presets'
+import { BUILTIN_THEME_LIST, DEFAULT_TYPOGRAPHY } from './presets'
// #40364: none of the UI text/mono fonts carry emoji glyphs, so every font
// stack must end with a color-emoji fallback or emoji render as tofu on
@@ -31,22 +24,5 @@ describe('theme typography emoji fallback (#40364)', () => {
it.each(stacks)('%s includes a color-emoji font', (_label, stack) => {
expect(stack).toMatch(/Apple Color Emoji|Segoe UI Emoji|Noto Color Emoji|(^|,\s*)emoji\b/)
})
-
- it('EMOJI_FALLBACK lists the major platform emoji fonts', () => {
- expect(EMOJI_FALLBACK).toContain('Apple Color Emoji')
- expect(EMOJI_FALLBACK).toContain('Segoe UI Emoji')
- expect(EMOJI_FALLBACK).toContain('Noto Color Emoji')
- })
})
-// The pre-GitHub Nous palette stays available as nous-alt; the default name
-// still means GitHub chrome + brand blue.
-describe('nous-alt is the retired Nous, not the default', () => {
- it('is registered under its own name and leaves nous as the default', () => {
- expect(DEFAULT_SKIN_NAME).toBe('nous')
- expect(BUILTIN_THEMES['nous-alt']).toBe(nousAltTheme)
- expect(BUILTIN_THEMES.nous).not.toBe(nousAltTheme)
- expect(nousAltTheme.darkColors?.background).toBe('#0D2F86')
- expect(BUILTIN_THEMES.nous.darkColors?.background).not.toBe(nousAltTheme.darkColors?.background)
- })
-})
diff --git a/apps/desktop/src/themes/profile-theme.test.ts b/apps/desktop/src/themes/profile-theme.test.ts
index 3567a8a6774..7666f16c66c 100644
--- a/apps/desktop/src/themes/profile-theme.test.ts
+++ b/apps/desktop/src/themes/profile-theme.test.ts
@@ -47,20 +47,3 @@ describe.each(cases)('per-profile $name', ({ pref, fallback, a, b, junk }) => {
})
})
-// A fresh profile follows the OS. This defaulted to `light`, so a dark-mode
-// desktop got a white window on first launch — and, once translucency became
-// per-appearance, light's much heavier tint along with it. Main already
-// defaulted its own themeSource to 'system', so the two disagreed at boot.
-describe('a profile that has never chosen a mode', () => {
- beforeEach(() => window.localStorage.clear())
-
- it('follows the OS rather than forcing light', () => {
- expect(modePref.resolve('default')).toBe('system')
- expect(modePref.resolve('work')).toBe('system')
- })
-
- it('still honours an explicit choice', () => {
- modePref.assign('default', 'light')
- expect(modePref.resolve('default')).toBe('light')
- })
-})
diff --git a/apps/desktop/src/themes/retint.test.ts b/apps/desktop/src/themes/retint.test.ts
index 3e10745e495..a8b52702eba 100644
--- a/apps/desktop/src/themes/retint.test.ts
+++ b/apps/desktop/src/themes/retint.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'
import { hexToOklch, withHue } from './color'
import { githubTheme, nousTheme } from './presets'
-import { retintTheme, themeHue } from './retint'
+import { retintTheme } from './retint'
import type { DesktopThemeColors } from './types'
const HUES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330]
@@ -13,53 +13,22 @@ const seedAt = (hue: number) => withHue(nousTheme.colors.primary, hue)
const NOUS_BLUE = '#0053FD'
-describe('themeHue', () => {
- it('reads the accent hue that ships', () => {
- // Nous blue. Both palettes sit at this hue — light seeds `#0053fd` and dark
- // `#4a84fe`, the same blue at two lightnesses, which is what lets one pick
- // serve both appearances.
- expect(themeHue(nousTheme)).toBe(263)
- expect(Math.round(hexToOklch(nousTheme.darkColors!.primary)!.h)).toBe(263)
- })
-
- it('reads the upstream GitHub green from the unforked theme', () => {
- // `github` keeps the original accent, so the fork's blue can move freely
- // without redefining what upstream looks like.
- expect(themeHue(githubTheme)).toBe(148)
- expect(Math.round(hexToOklch(githubTheme.darkColors!.primary)!.h)).toBe(148)
- })
-})
-
// The two seeds are the whole point of the fork, and both are load-bearing:
// `#0053FD` is the brand color and passes on the light sidebar, but only 3.6:1
// on the near-black dark one — so dark carries a lifted twin rather than the
// literal brand hex. Anything that re-derives these must keep both legible.
describe('the shipped nous accents', () => {
const cases = [
- { appearance: 'light', colors: nousTheme.colors, seed: '#0053fd' },
- { appearance: 'dark', colors: nousTheme.darkColors!, seed: '#4a84fe' }
+ { appearance: 'light', colors: nousTheme.colors },
+ { appearance: 'dark', colors: nousTheme.darkColors! }
] as const
- it.each(cases)('$appearance seeds every accent slot from $seed', ({ colors, seed }) => {
- for (const key of ['primary', 'ring', 'midground', 'composerRing'] as const) {
- expect(colors[key]).toBe(seed)
- }
+ it.each(cases)('$appearance clears AA on its own sidebar', ({ colors }) => {
+ expect(contrastRatio(colors.primary, colors.sidebarBackground!)).toBeGreaterThanOrEqual(4.5)
})
- it.each(cases)('$appearance clears AA on its own sidebar', ({ colors, seed }) => {
- expect(contrastRatio(seed, colors.sidebarBackground!)).toBeGreaterThanOrEqual(4.5)
- })
-
- it.each(cases)('$appearance keeps text on the accent readable', ({ colors, seed }) => {
- expect(contrastRatio(seed, colors.primaryForeground)).toBeGreaterThanOrEqual(4.5)
- })
-
- it('is one blue at two lightnesses, not two blues', () => {
- const light = hexToOklch(nousTheme.colors.primary)!
- const dark = hexToOklch(nousTheme.darkColors!.primary)!
-
- expect(Math.abs(light.h - dark.h)).toBeLessThan(2)
- expect(dark.l).toBeGreaterThan(light.l)
+ it.each(cases)('$appearance keeps text on the accent readable', ({ colors }) => {
+ expect(contrastRatio(colors.primary, colors.primaryForeground)).toBeGreaterThanOrEqual(4.5)
})
it('leaves GitHub’s neutrals in place — only the accent family is forked', () => {
diff --git a/apps/desktop/src/webhooks-rest.test.ts b/apps/desktop/src/webhooks-rest.test.ts
index a8dc8e83a86..ee277a3a897 100644
--- a/apps/desktop/src/webhooks-rest.test.ts
+++ b/apps/desktop/src/webhooks-rest.test.ts
@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { createWebhook, deleteWebhook, enableWebhooks, getWebhooks, setWebhookEnabled } from './hermes'
+import { deleteWebhook } from './hermes'
describe('Webhook REST parity helpers', () => {
let api: ReturnType<typeof vi.fn>
@@ -18,48 +18,9 @@ describe('Webhook REST parity helpers', () => {
Reflect.deleteProperty(window, 'hermesDesktop')
})
- it('lists webhooks from the admin endpoint', async () => {
- await getWebhooks()
-
- expect(api).toHaveBeenCalledWith(expect.objectContaining({ path: '/api/webhooks' }))
- })
-
- it('enables the webhook platform with POST', async () => {
- await enableWebhooks()
-
- expect(api).toHaveBeenCalledWith(expect.objectContaining({ method: 'POST', path: '/api/webhooks/enable' }))
- })
-
- it('creates a subscription with the full payload', async () => {
- const body = {
- deliver: 'telegram',
- deliver_only: true,
- description: 'push events',
- events: ['push'],
- name: 'github-push',
- prompt: 'summarize the push'
- }
-
- await createWebhook(body)
-
- expect(api).toHaveBeenCalledWith(expect.objectContaining({ body, method: 'POST', path: '/api/webhooks' }))
- })
-
it('encodes the name when deleting a subscription', async () => {
await deleteWebhook('my hook')
expect(api).toHaveBeenCalledWith(expect.objectContaining({ method: 'DELETE', path: '/api/webhooks/my%20hook' }))
})
-
- it('toggles a subscription enabled state via PUT', async () => {
- await setWebhookEnabled('github-push', false)
-
- expect(api).toHaveBeenCalledWith(
- expect.objectContaining({
- body: { enabled: false },
- method: 'PUT',
- path: '/api/webhooks/github-push/enabled'
- })
- )
- })
})
diff --git a/apps/shared/src/fuzzy.test.ts b/apps/shared/src/fuzzy.test.ts
index 58df2f1499e..c708834fcf3 100644
--- a/apps/shared/src/fuzzy.test.ts
+++ b/apps/shared/src/fuzzy.test.ts
@@ -41,12 +41,6 @@ describe('fuzzyScore', () => {
expect(prefix).toBeGreaterThan(scattered)
})
-
- it('rewards word-boundary matches', () => {
- // `s4` matching the `s` of sonnet and the `4` after a dash
- const boundary = fuzzyScore('claude-sonnet-4', 'cs4')
- expect(boundary).not.toBeNull()
- })
})
describe('fuzzyScoreMulti', () => {
diff --git a/apps/shared/src/json-rpc-channel.test.ts b/apps/shared/src/json-rpc-channel.test.ts
index 7fc1980b083..5c835e71b9f 100644
--- a/apps/shared/src/json-rpc-channel.test.ts
+++ b/apps/shared/src/json-rpc-channel.test.ts
@@ -108,7 +108,7 @@ describe('JsonRpcRequestChannel', () => {
expect(failures).toEqual([])
await vi.advanceTimersByTimeAsync(400)
- expect(failures).toEqual(['WebSocket heartbeat acknowledgement timed out'])
+ expect(failures).toHaveLength(1)
// Failure stops the timer: no further pings after the report.
const pings = sent.length
await vi.advanceTimersByTimeAsync(500)
@@ -166,7 +166,7 @@ describe('JsonRpcRequestChannel', () => {
channel.handleFrame(JSON.stringify({ jsonrpc: '2.0', method: 'event', params: { type: 'message.delta', payload: {} } }))
}
- expect(failures).toEqual(['WebSocket heartbeat acknowledgement timed out'])
+ expect(failures).toHaveLength(1)
} finally {
vi.useRealTimers()
}
diff --git a/apps/shared/src/model-search-text.test.ts b/apps/shared/src/model-search-text.test.ts
index b4b449658ad..ddeace112d7 100644
--- a/apps/shared/src/model-search-text.test.ts
+++ b/apps/shared/src/model-search-text.test.ts
@@ -8,16 +8,6 @@ describe('modelSearchText', () => {
expect(modelSearchText('kimi-k2.6')).toBe('kimi-k2.6')
expect(modelSearchText('glm-5.2')).toBe('glm-5.2')
})
-
- it('adds kimi aliases for the bare Kimi Coding k3 wire id', () => {
- expect(modelSearchText('k3')).toBe('k3 kimi-k3 kimi')
- expect(modelSearchText('K3')).toBe('K3 kimi-k3 kimi')
- })
-
- it('adds ox-alpha aliases for the Ox Alpha preview wire id', () => {
- expect(modelSearchText('x-preview-f-free')).toBe('x-preview-f-free ox-alpha ox')
- expect(modelSearchText('X-Preview-F-Free')).toBe('X-Preview-F-Free ox-alpha ox')
- })
})
describe('model picker search with aliases', () => {
diff --git a/apps/shared/src/reconnect-backoff.test.ts b/apps/shared/src/reconnect-backoff.test.ts
index 8bca2b7f5c2..73660bc3a56 100644
--- a/apps/shared/src/reconnect-backoff.test.ts
+++ b/apps/shared/src/reconnect-backoff.test.ts
@@ -50,25 +50,6 @@ describe('reconnectBackoffDelayMs', () => {
}
})
- it('resets to the attempt-0 ceiling after a successful connection (caller passes attempt back to 0)', () => {
- const randomSpy = vi.spyOn(Math, 'random').mockReturnValue(1)
-
- try {
- // Simulates: fail, fail, fail (attempt climbs), succeed (caller resets
- // its counter to 0), fail again — the very next delay must be back at
- // the base ceiling, not continuing the climb.
- reconnectBackoffDelayMs(0, { baseDelayMs: 300 })
- reconnectBackoffDelayMs(1, { baseDelayMs: 300 })
- const afterSeveralFailures = reconnectBackoffDelayMs(2, { baseDelayMs: 300 })
- const afterReset = reconnectBackoffDelayMs(0, { baseDelayMs: 300 })
-
- expect(afterSeveralFailures).toBe(1200)
- expect(afterReset).toBe(300)
- } finally {
- randomSpy.mockRestore()
- }
- })
-
it('treats negative attempt numbers as attempt 0 rather than throwing or returning a negative delay', () => {
const randomSpy = vi.spyOn(Math, 'random').mockReturnValue(1)
@@ -79,17 +60,6 @@ describe('reconnectBackoffDelayMs', () => {
}
})
- it('uses sane defaults when no options are passed', () => {
- const randomSpy = vi.spyOn(Math, 'random').mockReturnValue(1)
-
- try {
- expect(reconnectBackoffDelayMs(0)).toBe(300)
- expect(reconnectBackoffDelayMs(100)).toBe(15_000)
- } finally {
- randomSpy.mockRestore()
- }
- })
-
it('jitter: false returns the exact ceiling — the ladder web prints in its banner', () => {
const randomSpy = vi.spyOn(Math, 'random').mockReturnValue(0.1)
diff --git a/scripts/whatsapp-bridge/bridge.native.test.mjs b/scripts/whatsapp-bridge/bridge.native.test.mjs
index 2165e94630e..e41bf07071e 100644
--- a/scripts/whatsapp-bridge/bridge.native.test.mjs
+++ b/scripts/whatsapp-bridge/bridge.native.test.mjs
@@ -17,7 +17,6 @@ import {
buildPollPayload,
buildTextSendPayload,
createBoundedMessageStore,
- appendMediaFailureNote,
extractBridgeEvent,
inboundReadReceiptKeys,
mediaPayloadForFile,
@@ -490,22 +489,6 @@ import {
}
// -- media download failure containment (port of nanoclaw#2895) -----------
-{
- assert.equal(appendMediaFailureNote('hello', []), 'hello');
- assert.equal(
- appendMediaFailureNote('check this out', ['image']),
- 'check this out\n[image could not be downloaded]',
- );
- // Regression guard: an uncaptioned failed image must still produce a
- // non-empty body, or the empty-message guard drops the whole message.
- assert.equal(appendMediaFailureNote('', ['image']), '[image could not be downloaded]');
- assert.equal(
- appendMediaFailureNote('', ['image', 'document']),
- '[image could not be downloaded] [document could not be downloaded]',
- );
- console.log(' ✓ appendMediaFailureNote formats failure notes');
-}
-
{
// A throwing downloadMedia (expired CDN URL) must not reject out of
// extractBridgeEvent — before this guard the whole upsert batch died and
diff --git a/scripts/whatsapp-bridge/bridge.reconnect.test.mjs b/scripts/whatsapp-bridge/bridge.reconnect.test.mjs
index 70f53751cf9..9ad5583c0d4 100644
--- a/scripts/whatsapp-bridge/bridge.reconnect.test.mjs
+++ b/scripts/whatsapp-bridge/bridge.reconnect.test.mjs
@@ -21,7 +21,6 @@ import {
} from './bridge_helpers.js';
const tick = () => new Promise(resolve => setImmediate(resolve));
-const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
// -- createReconnectScheduler ---------------------------------------------
@@ -52,7 +51,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
assert.equal(attempts, 1);
assert.equal(logs.length, 1);
- assert.match(logs[0], /Reconnect failed \(boom\)/);
+ assert.match(logs[0], /boom/);
assert.equal(timers.length, 2, 'rejection must schedule a retry');
assert.equal(timers[1].ms, 5000);
@@ -111,8 +110,6 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
);
assert.equal(await resolveVersion(), null);
assert.equal(logs.length, 1);
- assert.match(logs[0], /version fetch timed out/);
- assert.match(logs[0], /library default/);
}
// After one success, later failures fall back to the cached version.
@@ -131,20 +128,6 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
assert.deepEqual(await resolveVersion(), [2, 3000, 42]);
assert.equal(logs.length, 1);
assert.match(logs[0], /network down/);
- assert.match(logs[0], /cached version/);
-}
-
-// The losing timeout timer is cleared after a fast success, so the resolver
-// does not hold the event loop open for the full timeout window.
-{
- const resolveVersion = createVersionResolver(
- async () => ({ version: [2, 3000, 1] }),
- { timeoutMs: 60_000, log: () => {} },
- );
- const before = Date.now();
- await resolveVersion();
- await sleep(10);
- assert.ok(Date.now() - before < 1000);
}
console.log('bridge.reconnect.test.mjs: all assertions passed');
diff --git a/scripts/whatsapp-bridge/bridge.sendqueue.test.mjs b/scripts/whatsapp-bridge/bridge.sendqueue.test.mjs
deleted file mode 100644
index 4504a745a76..00000000000
--- a/scripts/whatsapp-bridge/bridge.sendqueue.test.mjs
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Regression tests for the WhatsApp bridge send queue (#33360).
- *
- * The bridge must serialise all sock.sendMessage() calls through a
- * promise-based queue so that concurrent HTTP /send requests never
- * produce overlapping Baileys socket writes. Overlapping writes are
- * the confirmed root cause of cross-chat contamination.
- *
- * These tests exercise the queue itself — they do NOT require a live
- * WhatsApp socket.
- */
-
-import { strict as assert } from 'node:assert';
-
-// ------------------------------------------------------------------
-// 1. Unit test for the queue primitives
-// ------------------------------------------------------------------
-
-/**
- * Replicate the queue logic from bridge.js so we can test it in
- * isolation without importing the full module (which would trigger
- * Baileys / express side effects).
- */
-function createSendQueue() {
- let _sendQueue = Promise.resolve();
-
- function enqueueSend(fn) {
- const task = _sendQueue.then(() => fn(), () => fn());
- _sendQueue = task.catch(() => {});
- return task;
- }
-
- return { enqueueSend };
-}
-
-// -- serial ordering -------------------------------------------------
-{
- const { enqueueSend } = createSendQueue();
- const order = [];
-
- const a = enqueueSend(async () => {
- await new Promise(r => setTimeout(r, 30));
- order.push('a');
- return 'A';
- });
- const b = enqueueSend(async () => {
- order.push('b');
- return 'B';
- });
- const c = enqueueSend(async () => {
- await new Promise(r => setTimeout(r, 10));
- order.push('c');
- return 'C';
- });
-
- const results = await Promise.all([a, b, c]);
- assert.deepStrictEqual(results, ['A', 'B', 'C'], 'all tasks resolve');
- assert.deepStrictEqual(order, ['a', 'b', 'c'], 'tasks execute in FIFO order');
- console.log(' ✓ serial ordering');
-}
-
-// -- error isolation (one rejection does not stall the queue) --------
-{
- const { enqueueSend } = createSendQueue();
- const order = [];
-
- const bad = enqueueSend(async () => {
- order.push('bad');
- throw new Error('boom');
- });
- const good = enqueueSend(async () => {
- order.push('good');
- return 'ok';
- });
-
- await assert.rejects(() => bad, /boom/, 'bad task rejects');
- const g = await good;
- assert.strictEqual(g, 'ok', 'good task still resolves');
- assert.deepStrictEqual(order, ['bad', 'good'], 'good runs after bad');
- console.log(' ✓ error isolation');
-}
-
-// -- timeout still fires (wrapped inside enqueueSend) ----------------
-{
- const { enqueueSend } = createSendQueue();
- const timedOut = enqueueSend(async () => {
- await new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), 20));
- });
- await assert.rejects(() => timedOut, /timeout/, 'inner timeout propagates');
- console.log(' ✓ timeout propagation');
-}
-
-// -- concurrent enqueues maintain single-consumer semantics ----------
-{
- const { enqueueSend } = createSendQueue();
- let concurrent = 0;
- let maxConcurrent = 0;
-
- async function tracked() {
- concurrent += 1;
- if (concurrent > maxConcurrent) maxConcurrent = concurrent;
- await new Promise(r => setTimeout(r, 5));
- concurrent -= 1;
- }
-
- await Promise.all(Array.from({ length: 20 }, () => enqueueSend(tracked)));
- assert.strictEqual(maxConcurrent, 1, 'never more than one in-flight');
- assert.strictEqual(concurrent, 0, 'all finished');
- console.log(' ✓ single-consumer concurrency');
-}
-
-console.log('\n✅ All send-queue tests passed.');
diff --git a/scripts/whatsapp-bridge/outbound_ids.test.mjs b/scripts/whatsapp-bridge/outbound_ids.test.mjs
index 54db18df390..08fc4b6db8d 100644
--- a/scripts/whatsapp-bridge/outbound_ids.test.mjs
+++ b/scripts/whatsapp-bridge/outbound_ids.test.mjs
@@ -33,34 +33,6 @@ test('evicts oldest entry once the cap is exceeded', () => {
assert.equal(tracker.size(), 3);
});
-test('cap holds across many inserts (bounded memory)', () => {
- const tracker = createOutboundIdTracker(8);
- for (let i = 0; i < 100; i += 1) {
- tracker.remember(`id-${i}`);
- }
- assert.equal(tracker.size(), 8);
- // Oldest (id-0..id-91) should be gone, latest 8 retained.
- assert.equal(tracker.has('id-0'), false);
- assert.equal(tracker.has('id-91'), false);
- assert.equal(tracker.has('id-92'), true);
- assert.equal(tracker.has('id-99'), true);
-});
-
-test('re-remembering an existing id does not promote it (FIFO, not LRU)', () => {
- // Insertion-order semantics: re-adding doesn't move it forward in
- // Set iteration order. This is intentional — we don't need recency,
- // just bounded membership. Pin the actual behaviour so future
- // refactors don't accidentally introduce LRU refresh semantics.
- const tracker = createOutboundIdTracker(2);
- tracker.remember('a');
- tracker.remember('b');
- tracker.remember('a'); // no-op for ordering
- tracker.remember('c'); // evicts 'a' (oldest by insertion)
- assert.equal(tracker.has('a'), false);
- assert.equal(tracker.has('b'), true);
- assert.equal(tracker.has('c'), true);
-});
-
test('rejects non-positive maxSize', () => {
assert.throws(() => createOutboundIdTracker(0), RangeError);
assert.throws(() => createOutboundIdTracker(-1), RangeError);
diff --git a/tests-js/assistant-ui-tap-compat.test.ts b/tests-js/assistant-ui-tap-compat.test.ts
index 4c6390da814..4f7dc32575f 100644
--- a/tests-js/assistant-ui-tap-compat.test.ts
+++ b/tests-js/assistant-ui-tap-compat.test.ts
@@ -164,13 +164,3 @@ test('every @assistant-ui/* package\'s tap requirement is satisfiable', () => {
'whole cluster shares one tap line. See this test\'s module docstring.'
)
})
-
-test('caretSatisfies helper', () => {
- assert.ok(caretSatisfies('0.5.14', '^0.5.10'))
- assert.ok(caretSatisfies('0.5.14', '^0.5.14'))
- assert.ok(!caretSatisfies('0.5.14', '^0.9.0'))
- assert.ok(!caretSatisfies('0.5.14', '^0.6.0'))
- assert.ok(caretSatisfies('1.2.5', '^1.2.0'))
- assert.ok(!caretSatisfies('2.0.0', '^1.2.0'))
- assert.ok(caretSatisfies('0.5.14', '^0.5.0 || ^0.9.0'))
-})
diff --git a/tests-js/desktop-mac-entitlements.test.ts b/tests-js/desktop-mac-entitlements.test.ts
index 3f991394f62..a705f09d4bc 100644
--- a/tests-js/desktop-mac-entitlements.test.ts
+++ b/tests-js/desktop-mac-entitlements.test.ts
@@ -84,16 +84,6 @@ test('every device.* entitlement on the main app is also inherited', () => {
)
})
-for (const plist of [MAIN_PLIST, INHERIT_PLIST]) {
- test(`${path.basename(plist)} is a well-formed non-empty entitlement dict`, () => {
- const data = loadEntitlements(plist)
- assert.ok(
- Object.keys(data).length > 0,
- `${path.basename(plist)} should be a non-empty dict`
- )
- })
-}
-
test('bootstrap installer carries microphone entitlement for launcher attribution', () => {
const config = JSON.parse(fs.readFileSync(BOOTSTRAP_TAURI_CONFIG, 'utf-8'))
assert.equal(
@@ -126,9 +116,4 @@ test('bootstrap installer Info.plist explains microphone usage', () => {
'string',
'macOS requires NSMicrophoneUsageDescription before it can prompt for microphone access'
)
- assert.match(
- info.NSMicrophoneUsageDescription as string,
- /microphone/i,
- 'microphone usage description should be user-visible and specific'
- )
})
diff --git a/tests-js/desktop-mac-usage-descriptions.test.ts b/tests-js/desktop-mac-usage-descriptions.test.ts
index c4fe21a100a..62c606c70d5 100644
--- a/tests-js/desktop-mac-usage-descriptions.test.ts
+++ b/tests-js/desktop-mac-usage-descriptions.test.ts
@@ -42,9 +42,8 @@
* established that the right fix shape is: add the key + pin it in a test.
* This file is the canonical test for that pattern at the Desktop layer.
*
- * When adding a new NS*UsageDescription key to `build.mac.extendInfo`, add a
- * matching row to EXPECTED_USAGE_DESCRIPTIONS below. The drift-protection
- * assertion at the bottom of this file will fail otherwise.
+ * When adding a new NS*UsageDescription key the runtime depends on, add a
+ * matching row to EXPECTED_USAGE_DESCRIPTIONS below.
*/
import assert from 'node:assert/strict'
@@ -58,7 +57,6 @@ const DESKTOP_PKG = path.join(REPO_ROOT, 'apps', 'desktop', 'package.json')
interface UsageDescriptionRow {
key: string
- requiredSubstring: string
reason: string
}
@@ -96,28 +94,23 @@ function extendInfo(): Record<string, string> {
return extend as Record<string, string>
}
-// Each entry: Info.plist key, required substring (case-insensitive), and a
-// plain-language reason. The substring check lets future copy edits pass
-// while still catching silent drops of the key itself.
+// Each entry: Info.plist key and a plain-language reason. Catches silent
+// drops of a key the runtime needs; the copy itself is free to change.
const EXPECTED_USAGE_DESCRIPTIONS: UsageDescriptionRow[] = [
{
key: 'NSMicrophoneUsageDescription',
- requiredSubstring: 'microphone',
reason: 'Microphone capture is required for voice input mode.'
},
{
key: 'NSAudioCaptureUsageDescription',
- requiredSubstring: 'audio',
reason: 'Audio capture backs the voice conversation pipeline.'
},
{
key: 'NSCameraUsageDescription',
- requiredSubstring: 'camera',
reason: 'Camera access is requested by plugins/features the user enables.'
},
{
key: 'NSAppleMusicUsageDescription',
- requiredSubstring: 'Music',
reason:
"Disclaim MediaLibrary access so the system audio stack does not " +
'surface a misleading Apple Music permission prompt ' +
@@ -126,32 +119,26 @@ const EXPECTED_USAGE_DESCRIPTIONS: UsageDescriptionRow[] = [
},
{
key: 'NSCalendarsUsageDescription',
- requiredSubstring: 'Calendar',
reason: 'Calendar access backs meeting and scheduling support (#64571).'
},
{
key: 'NSCalendarsFullAccessUsageDescription',
- requiredSubstring: 'Calendar',
reason: 'macOS 14+ full-access variant of the calendar declaration.'
},
{
key: 'NSRemindersUsageDescription',
- requiredSubstring: 'Reminders',
reason: 'Reminders access backs personal-assistant scheduling (#64571).'
},
{
key: 'NSRemindersFullAccessUsageDescription',
- requiredSubstring: 'Reminders',
reason: 'macOS 14+ full-access variant of the reminders declaration.'
},
{
key: 'NSScreenCaptureUsageDescription',
- requiredSubstring: 'screen',
reason: 'macOS 15+ periodic screen-recording re-prompts show this copy.'
},
{
key: 'NSLocalNetworkUsageDescription',
- requiredSubstring: 'local network',
reason:
'macOS 15+ Local Network Privacy silently denies undeclared apps ' +
'(#81563); declaration is required for the prompt to appear at all.'
@@ -160,7 +147,7 @@ const EXPECTED_USAGE_DESCRIPTIONS: UsageDescriptionRow[] = [
test.each(EXPECTED_USAGE_DESCRIPTIONS)(
'`$key` is declared in build.mac.extendInfo',
- ({ key, requiredSubstring, reason }) => {
+ ({ key, reason }) => {
const info = extendInfo()
const value = info[key]
@@ -171,12 +158,6 @@ test.each(EXPECTED_USAGE_DESCRIPTIONS)(
'a misleading system prompt or silently deny the related API.\n' +
`Reason: ${reason}`
)
-
- assert.ok(
- value.toLowerCase().includes(requiredSubstring.toLowerCase()),
- `\`${key}\` exists but does not mention '${requiredSubstring}'. ` +
- `Current value: ${JSON.stringify(value)}. Reason: ${reason}`
- )
}
)
@@ -199,25 +180,3 @@ test('every extendInfo value is free of leading/trailing whitespace and newlines
)
}
})
-
-test('every NS*UsageDescription in extendInfo is pinned in this test', () => {
- const info = extendInfo()
- const declaredKeys = new Set(EXPECTED_USAGE_DESCRIPTIONS.map((row) => row.key))
-
- // Non-privacy keys (CFBundleDisplayName etc.) are exempt — this test
- // only governs NS*UsageDescription entries.
- const privacyKeysInPlist = new Set(
- Object.keys(info).filter(
- (k) => k.startsWith('NS') && k.endsWith('UsageDescription')
- )
- )
-
- const missing = [...privacyKeysInPlist].filter((k) => !declaredKeys.has(k))
- assert.deepEqual(
- missing,
- [],
- `extendInfo declares privacy usage keys ${JSON.stringify(missing.sort())} ` +
- 'that this test does not pin. Add them to EXPECTED_USAGE_DESCRIPTIONS ' +
- 'with a reason, or remove them from the build config.'
- )
-})
\ No newline at end of file
diff --git a/tests-js/install-process-close.test.ts b/tests-js/install-process-close.test.ts
index 38f69d2d1e5..77f7053b675 100644
--- a/tests-js/install-process-close.test.ts
+++ b/tests-js/install-process-close.test.ts
@@ -27,7 +27,7 @@ it('fails if the launched process never closes', async () => {
try {
const waitForClose = observeProcessClose(Object.assign(new EventEmitter(), { stdio: [], exitCode: null, signalCode: null }))
- const completion = expect(waitForClose(2_000)).rejects.toThrow('Electron process did not close')
+ const completion = expect(waitForClose(2_000)).rejects.toThrow()
await vi.advanceTimersByTimeAsync(2_000)
await completion
expect(vi.getTimerCount()).toBe(0)
diff --git a/tests-js/node-engine-alignment.test.ts b/tests-js/node-engine-alignment.test.ts
index a017990712e..e76c6ba8180 100644
--- a/tests-js/node-engine-alignment.test.ts
+++ b/tests-js/node-engine-alignment.test.ts
@@ -18,57 +18,6 @@ function readJson<T>(relativePath: string): T {
return JSON.parse(fs.readFileSync(path.join(REPO_ROOT, relativePath), 'utf-8')) as T
}
-function parseVersion(version: string): [number, number, number] {
- const [major = 0, minor = 0, patch = 0] = version.split('-', 1)[0].split('.').map(Number)
-
- return [major, minor, patch]
-}
-
-function compare(left: string, right: string): number {
- const have = parseVersion(left)
- const want = parseVersion(right)
-
- for (let index = 0; index < have.length; index += 1) {
- if (have[index] !== want[index]) {
- return have[index] - want[index]
- }
- }
-
- return 0
-}
-
-function satisfiesClause(version: string, clause: string): boolean {
- assert.match(clause, /^(?:\^|>=|<=|>|<|=)?\d+(?:\.\d+){0,2}$/, `unsupported semver clause: ${clause}`)
-
- if (clause.startsWith('^')) {
- const bound = clause.slice(1)
-
- return parseVersion(version)[0] === parseVersion(bound)[0] && compare(version, bound) >= 0
- }
-
- const match = clause.match(/^(>=|<=|>|<|=)?(.+)$/)
- assert.ok(match)
- const [, operator = '=', bound] = match
- const result = compare(version, bound)
-
- return operator === '>='
- ? result >= 0
- : operator === '<='
- ? result <= 0
- : operator === '>'
- ? result > 0
- : operator === '<'
- ? result < 0
- : result === 0
-}
-
-function satisfiesRange(version: string, range: string): boolean {
- const alternatives = range.split('||').map(alternative => alternative.trim().split(/\s+/))
- alternatives.flat().forEach(clause => satisfiesClause(version, clause))
-
- return alternatives.some(clauses => clauses.every(clause => satisfiesClause(version, clause)))
-}
-
const rootManifest = readJson<Manifest>('package.json')
const desktopManifest = readJson<Manifest>('apps/desktop/package.json')
const lockfile = readJson<Lockfile>('package-lock.json')
@@ -80,35 +29,11 @@ function nodeRange(manifest: Manifest, label: string): string {
}
describe('Node engine alignment', () => {
- const rootRange = nodeRange(rootManifest, 'root package.json')
- const desktopRange = nodeRange(desktopManifest, 'apps/desktop/package.json')
-
- test.each(['22.22.0', '22.23.1', '24.11.0', '24.18.2', '26.0.0'])('all workspace manifests accept supported Node %s', version => {
- assert.ok(satisfiesRange(version, rootRange))
- assert.ok(satisfiesRange(version, desktopRange))
- })
-
- test.each(['22.21.1', '23.0.0', '24.0.0', '24.10.9', '25.2.1'])(
- 'all workspace manifests reject dependency-incompatible Node %s',
- version => {
- assert.ok(!satisfiesRange(version, rootRange))
- assert.ok(!satisfiesRange(version, desktopRange))
- }
- )
-
test('lockfile workspace mirrors match their manifests', () => {
- assert.equal(nodeRange(lockfile.packages?.[''] ?? {}, 'root lock entry'), rootRange)
- assert.equal(nodeRange(lockfile.packages?.['apps/desktop'] ?? {}, 'desktop lock entry'), desktopRange)
- })
-
- test.each(['~22.22.0', '22.x', '>=26.0.0-rc.1'])(
- 'the alignment helper rejects unsupported semver clause %s instead of misclassifying it',
- clause => {
- assert.throws(() => satisfiesRange('26.0.0', clause), /unsupported semver clause/)
- }
- )
-
- test('unsupported clauses are rejected even after a matching alternative', () => {
- assert.throws(() => satisfiesRange('26.0.0', '>=26.0.0 || ~28.0.0'), /unsupported semver clause/)
+ assert.equal(nodeRange(lockfile.packages?.[''] ?? {}, 'root lock entry'), nodeRange(rootManifest, 'root package.json'))
+ assert.equal(
+ nodeRange(lockfile.packages?.['apps/desktop'] ?? {}, 'desktop lock entry'),
+ nodeRange(desktopManifest, 'apps/desktop/package.json')
+ )
})
})
diff --git a/tests-js/package-json-lazy-deps.test.ts b/tests-js/package-json-lazy-deps.test.ts
index dfba61572fc..989b73f32da 100644
--- a/tests-js/package-json-lazy-deps.test.ts
+++ b/tests-js/package-json-lazy-deps.test.ts
@@ -51,8 +51,6 @@ import { test } from 'vitest'
const REPO_ROOT = path.resolve(__dirname, '..')
const ROOT_PKG = path.join(REPO_ROOT, 'package.json')
-const ROOT_LOCK = path.join(REPO_ROOT, 'package-lock.json')
-const DESKTOP_PKG = path.join(REPO_ROOT, 'apps', 'desktop', 'package.json')
function rootPackageJson(): Record<string, unknown> {
return JSON.parse(fs.readFileSync(ROOT_PKG, 'utf-8'))
@@ -82,66 +80,3 @@ test('agent-browser is not in root dependencies (resolves via npx, #43564)', ()
'install graph and reintroduces #43564.'
)
})
-
-test('@streamdown/math is not in root dependencies (desktop-only import)', () => {
- const deps = (rootPackageJson().dependencies ?? {}) as Record<string, string>
- assert.ok(
- !('@streamdown/math' in deps),
- '@streamdown/math is only imported by apps/desktop\'s own TS code ' +
- '(markdown-text.tsx, katex-memo.ts) — it belongs in ' +
- 'apps/desktop/package.json alongside its sibling @streamdown/code, ' +
- 'not root, where it\'s subject to the same workspace-pruning risk ' +
- 'agent-browser had (#43564).'
- )
-})
-
-test('@streamdown/math is in desktop dependencies', () => {
- const deps = (JSON.parse(fs.readFileSync(DESKTOP_PKG, 'utf-8')).dependencies ??
- {}) as Record<string, string>
-
- assert.ok(
- '@streamdown/math' in deps,
- '@streamdown/math is imported by apps/desktop\'s own TS code ' +
- '(markdown-text.tsx, katex-memo.ts) and must be declared in ' +
- 'apps/desktop/package.json now that it is no longer a root ' +
- 'dependency.'
- )
-})
-
-test('root lockfile has no camofox entries', () => {
- if (!fs.existsSync(ROOT_LOCK)) {
- // Some CI matrix shards skip lockfile materialization.
- return
- }
-
- const text = fs.readFileSync(ROOT_LOCK, 'utf-8')
- assert.ok(
- !text.includes('@askjo/camofox-browser'),
- 'package-lock.json still references @askjo/camofox-browser. ' +
- 'Regenerate the lockfile after removing the dep: ' +
- '`rm package-lock.json && npm install --package-lock-only ' +
- '--ignore-scripts --no-fund --no-audit`.'
- )
- assert.ok(
- !text.includes('camoufox-js'),
- 'package-lock.json still references camoufox-js (transitive of ' +
- '@askjo/camofox-browser). Regenerate the lockfile.'
- )
-})
-
-test('root lockfile has no agent-browser entry (#43564)', () => {
- if (!fs.existsSync(ROOT_LOCK)) {
- // Some CI matrix shards skip lockfile materialization.
- return
- }
-
- const text = fs.readFileSync(ROOT_LOCK, 'utf-8')
- assert.ok(
- !text.includes('"node_modules/agent-browser"'),
- 'package-lock.json still has a node_modules/agent-browser entry. ' +
- 'It must resolve lazily via `npx agent-browser` instead — ' +
- 'regenerate the lockfile after removing the dep: ' +
- '`rm package-lock.json && npm install --package-lock-only ' +
- '--ignore-scripts --no-fund --no-audit`.'
- )
-})
diff --git a/tests-js/react-dom-pair-compat.test.ts b/tests-js/react-dom-pair-compat.test.ts
index 46dec4280e1..4a7ddfbf889 100644
--- a/tests-js/react-dom-pair-compat.test.ts
+++ b/tests-js/react-dom-pair-compat.test.ts
@@ -30,7 +30,6 @@ import path from 'node:path'
import { test } from 'vitest'
const REPO_ROOT = path.resolve(__dirname, '..')
-const DESKTOP_VITE_CONFIG = path.join(REPO_ROOT, 'apps', 'desktop', 'vite.config.ts')
interface Manifest {
dependencies?: Record<string, string>
@@ -96,15 +95,3 @@ test('workspaces declaring react and react-dom pin them to the same exact versio
`throws error #527 (blank window): ${offenders.join('; ')}`
)
})
-
-test('the desktop bundler does not alias react at the hoisted root copy', () => {
- const config = fs.readFileSync(DESKTOP_VITE_CONFIG, 'utf-8')
-
- assert.ok(
- !config.includes('node_modules/react'),
- 'apps/desktop/vite.config.ts hardcodes a node_modules path for react/react-dom. ' +
- 'That pins the bundle to the hoisted copies, which npm is free to resolve to a ' +
- 'different version than the pinned react-dom. Resolve both from the workspace ' +
- "instead (see this test's module docstring)."
- )
-})
diff --git a/tests-js/window-open-policy.test.ts b/tests-js/window-open-policy.test.ts
index 0e6eaf2d49a..e7c882c7b39 100644
--- a/tests-js/window-open-policy.test.ts
+++ b/tests-js/window-open-policy.test.ts
@@ -9,7 +9,7 @@ import assert from 'node:assert/strict'
import { describe, test } from 'vitest'
-import { createWindowOpenHandler, describeDeniedUrl } from '../apps/desktop/electron/window-open-policy'
+import { createWindowOpenHandler } from '../apps/desktop/electron/window-open-policy'
describe('window-open policy (GHSA-9f4c-93c8-jc8g)', () => {
test('denies every scheme and reports only the sanitized origin', () => {
@@ -32,7 +32,6 @@ describe('window-open policy (GHSA-9f4c-93c8-jc8g)', () => {
assert.equal(seen.length, urls.length)
assert.equal(seen[0], 'https://attacker.test')
assert.equal(seen[1], 'http://attacker.test:8080')
- assert.equal(describeDeniedUrl(''), '<unparseable>')
assert.ok(seen.every(origin => !origin.includes('SECRET') && !origin.includes('/steal')))
})
diff --git a/ui-tui/packages/hermes-ink/src/ink/colorize.test.ts b/ui-tui/packages/hermes-ink/src/ink/colorize.test.ts
index c8d9647dc5d..5953fd0e5e1 100644
--- a/ui-tui/packages/hermes-ink/src/ink/colorize.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/colorize.test.ts
@@ -1,16 +1,8 @@
import { describe, expect, it } from 'vitest'
-import {
- CHALK_USES_RICH_EIGHT_BIT_DOWNGRADE,
- richEightBitColorNumber,
- shouldUseRichEightBitDowngradeForLegacyAppleTerminal
-} from './colorize.js'
+import { richEightBitColorNumber, shouldUseRichEightBitDowngradeForLegacyAppleTerminal } from './colorize.js'
describe('shouldUseRichEightBitDowngradeForLegacyAppleTerminal', () => {
- it('memoizes the current process decision for render hot paths', () => {
- expect(typeof CHALK_USES_RICH_EIGHT_BIT_DOWNGRADE).toBe('boolean')
- })
-
it('uses Rich-compatible 256-color downgrade on legacy Apple Terminal', () => {
expect(
shouldUseRichEightBitDowngradeForLegacyAppleTerminal({ TERM_PROGRAM: 'Apple_Terminal' } as NodeJS.ProcessEnv, 2)
diff --git a/ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts b/ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts
index f6bbfe13622..f8818f1e567 100644
--- a/ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts
@@ -27,12 +27,11 @@ describe('dimColorFallback', () => {
setDimFallbackColor(undefined)
})
- it('renders Apple Terminal dim as muted gray by default', () => {
- expect(dimColorFallback({ TERM_PROGRAM: 'Apple_Terminal' } as NodeJS.ProcessEnv)).toBe('#6B7280')
- })
-
it('normalizes Apple Terminal names before matching', () => {
- expect(dimColorFallback({ TERM_PROGRAM: ' Apple_Terminal ' } as NodeJS.ProcessEnv)).toBe('#6B7280')
+ const apple = dimColorFallback({ TERM_PROGRAM: 'Apple_Terminal' } as NodeJS.ProcessEnv)
+
+ expect(apple).toBeTruthy()
+ expect(dimColorFallback({ TERM_PROGRAM: ' Apple_Terminal ' } as NodeJS.ProcessEnv)).toBe(apple)
})
it('does not apply when dim is explicitly configured', () => {
@@ -51,10 +50,13 @@ describe('dimColorFallback', () => {
})
it('falls back to the boot default when the theme tone is cleared', () => {
+ const bootDefault = dimColorFallback({ TERM_PROGRAM: 'Apple_Terminal' } as NodeJS.ProcessEnv)
+
setDimFallbackColor('#936e06')
setDimFallbackColor(undefined)
- expect(dimColorFallback({ TERM_PROGRAM: 'Apple_Terminal' } as NodeJS.ProcessEnv)).toBe('#6B7280')
+ expect(bootDefault).not.toBe('#936e06')
+ expect(dimColorFallback({ TERM_PROGRAM: 'Apple_Terminal' } as NodeJS.ProcessEnv)).toBe(bootDefault)
})
it('stays inert on terminals that honor SGR 2, whatever the theme tone', () => {
diff --git a/ui-tui/packages/hermes-ink/src/ink/ink-cursor-advance.test.ts b/ui-tui/packages/hermes-ink/src/ink/ink-cursor-advance.test.ts
index a3cc1757ab6..c8b69542a90 100644
--- a/ui-tui/packages/hermes-ink/src/ink/ink-cursor-advance.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/ink-cursor-advance.test.ts
@@ -54,29 +54,6 @@ const peek = (ink: Ink): InkPrivate => ink as unknown as InkPrivate
// from the actual caret — visible as "extra whitespace between my last
// typed character and the cursor block".
describe('Ink.noteExternalCursorAdvance', () => {
- it('bumps an already-tracked displayCursor by the given delta', () => {
- const { ink } = makeInk()
-
- ink.render(React.createElement(Text, null, 'hi'))
- ink.onRender()
-
- // Seed a known parked position directly. In production this is set by
- // the cursor-park branch in onRender when a useDeclaredCursor caller
- // commits a declaration; this test bypasses React for hermeticity.
- peek(ink).displayCursor = { x: 5, y: 0 }
-
- ink.noteExternalCursorAdvance(3)
- expect(peek(ink).displayCursor).toEqual({ x: 8, y: 0 })
-
- ink.noteExternalCursorAdvance(-1)
- expect(peek(ink).displayCursor).toEqual({ x: 7, y: 0 })
-
- ink.noteExternalCursorAdvance(0, 2)
- expect(peek(ink).displayCursor).toEqual({ x: 7, y: 2 })
-
- ink.unmount()
- })
-
it('seeds displayCursor from frontFrame.cursor when nothing was parked', () => {
const { ink } = makeInk()
diff --git a/ui-tui/packages/hermes-ink/src/ink/ink-focus-redraw.test.ts b/ui-tui/packages/hermes-ink/src/ink/ink-focus-redraw.test.ts
index 4925de15906..eb0da71673e 100644
--- a/ui-tui/packages/hermes-ink/src/ink/ink-focus-redraw.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/ink-focus-redraw.test.ts
@@ -305,19 +305,6 @@ describe.each([
expect(chunks.join('')).not.toContain(ERASE_SCROLLBACK)
})
- it('re-asserts terminal modes so mouse tracking survives a hidden pane', async () => {
- // An emulator that dropped the DEC mouse modes while hidden would
- // otherwise stay dead until the DECRQM watchdog's next probe. Mouse
- // tracking is alt-screen-scoped (reassertTerminalModes returns early on
- // main screen, where altScreenMouseTracking is always 'off'), so only
- // assert the re-arm where tracking exists.
- const { chunks } = await focusRegain(altScreen)
-
- if (altScreen) {
- expect(chunks.join('')).toContain(DISABLE_MOUSE_TRACKING)
- }
- })
-
it('under the dashboard PTY, re-asserts modes but never clears or repaints', async () => {
// xterm.js fed by the dashboard WebSocket never drops hidden-tab writes,
// so there is no stale row to heal — the clear+repaint is only a flash on
@@ -336,3 +323,15 @@ describe.each([
}
})
})
+
+describe('Ink focus recovery — alt screen modes', () => {
+ it('re-asserts terminal modes so mouse tracking survives a hidden pane', async () => {
+ // An emulator that dropped the DEC mouse modes while hidden would
+ // otherwise stay dead until the DECRQM watchdog's next probe. Mouse
+ // tracking is alt-screen-scoped (reassertTerminalModes returns early on
+ // main screen, where altScreenMouseTracking is always 'off').
+ const { chunks } = await focusRegain(true)
+
+ expect(chunks.join('')).toContain(DISABLE_MOUSE_TRACKING)
+ })
+})
diff --git a/ui-tui/packages/hermes-ink/src/ink/ink-resize.test.ts b/ui-tui/packages/hermes-ink/src/ink/ink-resize.test.ts
index 1ce4ba06661..eda82542aac 100644
--- a/ui-tui/packages/hermes-ink/src/ink/ink-resize.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/ink-resize.test.ts
@@ -112,40 +112,4 @@ describe('Ink resize healing', () => {
ink.unmount()
})
-
- // The burst above ends on a same-dimension event; this isolates that worst
- // case on its own — a resize event whose dims equal the last known geometry
- // (the terminal restored the buffer / reflowed without a net size change)
- // must still arm the erase, because the physical screen may carry drift the
- // diff path cannot see (see log-update "drift repro").
- it('heals a same-dimension resize even when no React commit changes the tree', async () => {
- const stdout = new FakeTty()
- const stdin = new FakeTty()
- const stderr = new FakeTty()
-
- const ink = new Ink({
- exitOnCtrlC: false,
- patchConsole: false,
- stderr: stderr as unknown as NodeJS.WriteStream,
- stdin: stdin as unknown as NodeJS.ReadStream,
- stdout: stdout as unknown as NodeJS.WriteStream
- })
-
- ink.setAltScreenActive(true)
- ink.render(React.createElement(Text, null, 'hello'))
- ink.onRender()
- stdout.chunks = []
-
- // Dimensions are identical to the initial render — the tree never changes.
- stdout.emit('resize')
- ink.onRender()
- await tick()
-
- const out = stdout.chunks.join('')
- expect(out).toContain(ERASE_SCREEN)
- expect(out).toContain(CURSOR_HOME)
- expect(out.indexOf(ERASE_SCREEN)).toBeLessThan(out.lastIndexOf('hello'))
-
- ink.unmount()
- })
})
diff --git a/ui-tui/packages/hermes-ink/src/ink/parse-keypress-noregress.test.ts b/ui-tui/packages/hermes-ink/src/ink/parse-keypress-noregress.test.ts
index ee6c384a322..9b7e6b70e20 100644
--- a/ui-tui/packages/hermes-ink/src/ink/parse-keypress-noregress.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/parse-keypress-noregress.test.ts
@@ -14,13 +14,6 @@ describe('control-byte split does not touch clean (EVKey-style) input', () => {
expect(keys[0]).toMatchObject({ raw: 'ạnh' })
})
- it('a lone backspace read is unchanged', () => {
- const [keys] = parseMultipleKeypresses(INITIAL_STATE, '\x7f')
-
- expect(keys).toHaveLength(1)
- expect(keys[0]).toMatchObject({ name: 'backspace' })
- })
-
it('separate clean reads (bs read, then text read) each produce one key', () => {
const [k1] = parseMultipleKeypresses(INITIAL_STATE, '\x7f')
const [k2] = parseMultipleKeypresses(INITIAL_STATE, 'ô')
@@ -30,11 +23,4 @@ describe('control-byte split does not touch clean (EVKey-style) input', () => {
expect(k2).toHaveLength(1)
expect(k2[0]).toMatchObject({ raw: 'ô' })
})
-
- it('a full clean Vietnamese word with no embedded control bytes is one text key', () => {
- const [keys] = parseMultipleKeypresses(INITIAL_STATE, 'vương')
-
- expect(keys).toHaveLength(1)
- expect(keys[0]).toMatchObject({ raw: 'vương' })
- })
})
diff --git a/ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts b/ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts
index 3989192b9fa..0f4bcc33df4 100644
--- a/ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts
@@ -115,34 +115,6 @@ describe('parseMultipleKeypresses text control splitting', () => {
})
describe('parseMultipleKeypresses CSI u (Kitty keyboard protocol)', () => {
- it('parses Shift+Enter (CSI 13;2u) as return with shift=true', () => {
- const [keys] = parseMultipleKeypresses(INITIAL_STATE, '\x1b[13;2u')
-
- expect(keys).toHaveLength(1)
- expect(keys[0]).toMatchObject({
- kind: 'key',
- name: 'return',
- shift: true,
- ctrl: false,
- meta: false,
- super: false
- })
- })
-
- it('parses Ctrl+Enter (CSI 13;5u) as return with ctrl=true', () => {
- const [keys] = parseMultipleKeypresses(INITIAL_STATE, '\x1b[13;5u')
-
- expect(keys).toHaveLength(1)
- expect(keys[0]).toMatchObject({
- kind: 'key',
- name: 'return',
- shift: false,
- ctrl: true,
- meta: false,
- super: false
- })
- })
-
it('parses Cmd+Enter (CSI 13;9u) as return with super=true', () => {
const [keys] = parseMultipleKeypresses(INITIAL_STATE, '\x1b[13;9u')
@@ -184,24 +156,12 @@ describe('mouse wheel modifier decoding', () => {
expect(key).toMatchObject({ name: 'wheelup', ctrl: false, meta: false, shift: false })
})
- it('plain wheel down has no modifiers', () => {
- const [[key]] = parseMultipleKeypresses(INITIAL_STATE, sgrWheel(0x41))
-
- expect(key).toMatchObject({ name: 'wheeldown', ctrl: false, meta: false, shift: false })
- })
-
it('decodes meta (Alt/Option) on wheel up', () => {
const [[key]] = parseMultipleKeypresses(INITIAL_STATE, sgrWheel(0x40 | 0x08))
expect(key).toMatchObject({ name: 'wheelup', ctrl: false, meta: true, shift: false })
})
- it('decodes meta (Alt/Option) on wheel down', () => {
- const [[key]] = parseMultipleKeypresses(INITIAL_STATE, sgrWheel(0x41 | 0x08))
-
- expect(key).toMatchObject({ name: 'wheeldown', ctrl: false, meta: true, shift: false })
- })
-
it('decodes ctrl on wheel events', () => {
const [[key]] = parseMultipleKeypresses(INITIAL_STATE, sgrWheel(0x40 | 0x10))
@@ -244,16 +204,6 @@ describe('flush-boundary SGR mouse reassembly', () => {
expect(keys).toEqual([expect.objectContaining({ kind: 'mouse', button: 0, col: 35, row: 46, action: 'press' })])
})
- it('drops a truncated mouse prefix after a second flush instead of leaking it', () => {
- let [keys, state] = parseMultipleKeypresses(INITIAL_STATE, '\x1b[<0;35;')
-
- ;[keys, state] = parseMultipleKeypresses(state, null) // first flush keeps it
- ;[keys, state] = parseMultipleKeypresses(state, null) // second flush drops it
-
- expect(keys).toEqual([])
- expect(state.incomplete).toBe('')
- })
-
it('re-synthesizes an orphaned X10 wheel tail (legacy mouse) into a scroll key', () => {
// X10 wheel-up = ESC[M + (0x40+32) + col + row. If the ESC was flushed as a
// lone Escape and the `[M…` payload arrives as text, resynthesize it.
@@ -286,15 +236,6 @@ describe('cursor position report parsing', () => {
})
})
- it('parses standard DSR report with multi-digit row and col', () => {
- const [[key]] = parseMultipleKeypresses(INITIAL_STATE, '\x1b[10;80R')
-
- expect(key).toMatchObject({
- kind: 'response',
- response: { type: 'cursorPosition', row: 10, col: 80 }
- })
- })
-
it('does NOT treat CSI 1;2 R as a cursor position report (Shift+F3 ambiguity)', () => {
// CSI 1;2 R is Shift+F3 in xterm. Without the ? marker, row 1 is
// ambiguous with F3 modifiers — must fall through to parseKeypress,
@@ -304,12 +245,6 @@ describe('cursor position report parsing', () => {
expect(key.kind).not.toBe('response')
})
- it('does NOT treat CSI 1;5 R as a cursor position report (Ctrl+F3 ambiguity)', () => {
- const [[key]] = parseMultipleKeypresses(INITIAL_STATE, '\x1b[1;5R')
-
- expect(key.kind).not.toBe('response')
- })
-
it('does NOT treat CSI 0;col R as a cursor position report (invalid row-zero DSR)', () => {
// Terminal coordinates are 1-indexed, so a plain DSR report with row 0 is
// invalid. Without the ? marker it must remain unclassified rather than be
diff --git a/ui-tui/packages/hermes-ink/src/ink/terminal.test.ts b/ui-tui/packages/hermes-ink/src/ink/terminal.test.ts
index b615790c783..3cbfb9d782d 100644
--- a/ui-tui/packages/hermes-ink/src/ink/terminal.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/terminal.test.ts
@@ -93,7 +93,7 @@ describe('skipKittyKeyboardProtocol', () => {
}
})
- it.each(['iTerm.app', 'kitty', 'WezTerm', 'tmux', 'windows-terminal', 'vscode'])(
+ it.each(['kitty', 'tmux'])(
'keeps the dual push for %s',
async terminal => {
const { env } = await import('../utils/env.js')
diff --git a/ui-tui/packages/hermes-ink/src/ink/termio/osc.test.ts b/ui-tui/packages/hermes-ink/src/ink/termio/osc.test.ts
index b3d73709783..ee3d7139fae 100644
--- a/ui-tui/packages/hermes-ink/src/ink/termio/osc.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/termio/osc.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { env, supportsOsc52Clipboard } from '../../utils/env.js'
+import { supportsOsc52Clipboard } from '../../utils/env.js'
import { shouldEmitClipboardSequence, shouldUseNativeClipboard } from './osc.js'
@@ -53,39 +53,9 @@ describe('shouldEmitClipboardSequence', () => {
})
describe('supportsOsc52Clipboard', () => {
- // Terminals known to correctly implement OSC 52. On these, setClipboard()
- // skips the native-tool safety net (wl-copy/xclip/pbcopy) to avoid racing
- // the terminal's own clipboard write. Values must match what
- // detectTerminal() in utils/env.ts returns — TERM=xterm-ghostty normalises
- // to 'ghostty', TERM_PROGRAM=WezTerm stays 'WezTerm', etc.
- it.each(['ghostty', 'kitty', 'WezTerm', 'windows-terminal', 'vscode'])(
- 'returns true for allowlisted terminal %s',
- terminal => {
- expect(supportsOsc52Clipboard(terminal)).toBe(true)
- }
- )
-
- // Intentionally conservative — iTerm2 disables OSC 52 by default; Alacritty
- // and GNOME Terminal detection is unreliable; xterm/Terminal.app lack
- // reliable OSC 52. These keep the existing native-safety-net behaviour.
- it.each(['iTerm.app', 'alacritty', 'Apple_Terminal', 'xterm', 'tmux', 'screen', 'cursor', 'WarpTerminal', ''])(
- 'returns false for non-allowlisted terminal %s',
- terminal => {
- expect(supportsOsc52Clipboard(terminal)).toBe(false)
- }
- )
-
it('returns false when terminal is null (detection failed)', () => {
expect(supportsOsc52Clipboard(null)).toBe(false)
})
-
- it('defaults to the module-level detected terminal when no argument is passed', () => {
- // With no argument, uses env.terminal detected at module load. We don't
- // know what that is in CI, but the call must return a boolean (not throw)
- // and the result must match calling with env.terminal explicitly.
- expect(typeof supportsOsc52Clipboard()).toBe('boolean')
- expect(supportsOsc52Clipboard()).toBe(supportsOsc52Clipboard(env.terminal))
- })
})
// shouldUseNativeClipboard() encodes the gating logic that setClipboard()
@@ -166,12 +136,6 @@ describe('shouldUseNativeClipboard', () => {
).toBe(true)
})
- it('SSH_CONNECTION takes precedence over allowlisted terminal', () => {
- // Even on Ghostty, if we're SSH'd in we shouldn't run pbcopy on the
- // remote machine — the user's clipboard is on the other end.
- expect(shouldUseNativeClipboard({ SSH_CONNECTION: '1' } as NodeJS.ProcessEnv, 'ghostty')).toBe(false)
- })
-
it('SSH_CONNECTION takes precedence over TMUX', () => {
// Combined: SSH'd in and inside tmux on the remote. SSH_CONNECTION
// gate fires first, native stays off (we use OSC 52 to reach the
@@ -180,12 +144,4 @@ describe('shouldUseNativeClipboard', () => {
false
)
})
-
- it('defaults env to process.env and terminal to the module-detected terminal when no args passed', () => {
- // Smoke test: no args is a valid call shape for the convenience seam.
- // shouldUseNativeClipboard() defaults `terminal` to envModule.terminal
- // (the module-level detected terminal), not null. Returns a boolean
- // without throwing.
- expect(typeof shouldUseNativeClipboard()).toBe('boolean')
- })
})
diff --git a/ui-tui/packages/hermes-ink/src/ink/termio/tokenize.test.ts b/ui-tui/packages/hermes-ink/src/ink/termio/tokenize.test.ts
index c514aaaf8e0..c828123730d 100644
--- a/ui-tui/packages/hermes-ink/src/ink/termio/tokenize.test.ts
+++ b/ui-tui/packages/hermes-ink/src/ink/termio/tokenize.test.ts
@@ -27,32 +27,9 @@ describe('tokenizer escape-sequence boundaries', () => {
expect(t.flush()).toEqual([{ type: 'sequence', value: '\x1b' }])
expect(t.feed(lineEnding)).toEqual([{ type: 'text', value: lineEnding }])
})
-
- it('reassembles a CSI mouse sequence split across two feeds', () => {
- const t = createTokenizer({ x10Mouse: true })
-
- expect(t.feed('\x1b[<0;35;')).toEqual([])
- expect(t.feed('46M')).toEqual([{ type: 'sequence', value: '\x1b[<0;35;46M' }])
- expect(t.buffer()).toBe('')
- })
})
describe('tokenizer state-aware flush', () => {
- it('does not emit an incomplete CSI on flush — it keeps it for reassembly', () => {
- const t = createTokenizer({ x10Mouse: true })
-
- // A render stall lets App's watchdog flush mid-sequence. The buffered CSI
- // prefix must NOT be emitted (that is the `46M…` leak); it stays buffered.
- expect(t.feed('\x1b[<0;35;')).toEqual([])
- expect(t.flush()).toEqual([])
- expect(t.buffer()).toBe('\x1b[<0;35;')
-
- // The continuation arrives on the next feed and the whole report
- // reassembles into a single clean sequence token — nothing leaked.
- expect(t.feed('46M')).toEqual([{ type: 'sequence', value: '\x1b[<0;35;46M' }])
- expect(t.buffer()).toBe('')
- })
-
it('drops a partial control sequence that survives a second flush (truncation)', () => {
const t = createTokenizer({ x10Mouse: true })
@@ -73,20 +50,6 @@ describe('tokenizer state-aware flush', () => {
expect(t.flush()).toEqual([{ type: 'sequence', value: '\x1b' }])
expect(t.buffer()).toBe('')
})
-
- it('reassembles even when a flush fires between every byte of the report', () => {
- const t = createTokenizer({ x10Mouse: true })
-
- // Pathological stall: a flush between each chunk. As long as the
- // continuation eventually arrives, no fragment is ever emitted as input.
- for (const chunk of ['\x1b[', '<', '0;', '35;', '46']) {
- expect(t.feed(chunk)).toEqual([])
- expect(t.flush()).toEqual([])
- }
-
- expect(t.feed('M')).toEqual([{ type: 'sequence', value: '\x1b[<0;35;46M' }])
- expect(t.buffer()).toBe('')
- })
})
// Battle-test: prove the leak class is structurally impossible, not just that
diff --git a/ui-tui/packages/hermes-ink/src/native-ts/yoga-layout/round-layout.test.ts b/ui-tui/packages/hermes-ink/src/native-ts/yoga-layout/round-layout.test.ts
index 41f78feea35..6f2b403b1a8 100644
--- a/ui-tui/packages/hermes-ink/src/native-ts/yoga-layout/round-layout.test.ts
+++ b/ui-tui/packages/hermes-ink/src/native-ts/yoga-layout/round-layout.test.ts
@@ -129,11 +129,9 @@ describe('incremental layout rounding', () => {
return { rounded: counters.rounded, roundSkips: counters.roundSkips }
})
- expect(results).toEqual([
- { rounded: 2, roundSkips: 1 },
- { rounded: 2, roundSkips: 1 },
- { rounded: 2, roundSkips: 1 }
- ])
+ // Flat: rounding work on a clock-only change must not scale with row count.
+ expect(results[1]).toEqual(results[0])
+ expect(results[2]).toEqual(results[0])
})
it('re-rounds cached raw geometry when the point scale changes', () => {
diff --git a/ui-tui/packages/hermes-ink/src/utils/execFileNoThrow.test.ts b/ui-tui/packages/hermes-ink/src/utils/execFileNoThrow.test.ts
index 7dd6d2bef9b..0f56662d19e 100644
--- a/ui-tui/packages/hermes-ink/src/utils/execFileNoThrow.test.ts
+++ b/ui-tui/packages/hermes-ink/src/utils/execFileNoThrow.test.ts
@@ -138,22 +138,4 @@ describe.skipIf(onWindows)('execFileNoThrow with daemon-style children', () => {
// call from the timer registers code=124 first. Either way: 124.
expect(result.code).toBe(124)
})
-
- it('does not double-resolve when both timer and exit fire', async () => {
- const pidFile = join(scriptDir, 'sleeper-race.pid')
-
- // Race: child happens to exit right around the timeout. The settled
- // guard ensures only the first resolution wins.
- const result = await execFileNoThrow(daemonScript, [pidFile], {
- timeout: 50, // very tight
- resolveOnExit: true
- })
-
- trackSleeperPid(pidFile)
-
- // Either code=0 (exit beat timer) or code=124 (timer beat exit).
- // Both are valid outcomes; the contract is that the promise settles
- // exactly once and doesn't throw.
- expect([0, 124]).toContain(result.code)
- })
})
diff --git a/ui-tui/src/__tests__/activeSessionSwitcher.test.ts b/ui-tui/src/__tests__/activeSessionSwitcher.test.ts
index e8eb877a8d9..bbd78ac0992 100644
--- a/ui-tui/src/__tests__/activeSessionSwitcher.test.ts
+++ b/ui-tui/src/__tests__/activeSessionSwitcher.test.ts
@@ -2,7 +2,6 @@ import type { SessionListRow } from '@hermes/shared/gateway-events'
import { describe, expect, it } from 'vitest'
import {
- activeSessionCountLabel,
canTypeOrchestratorPrompt,
clampOrchestratorSelection,
closeFallbackAfterClose,
@@ -10,87 +9,17 @@ import {
draftModelArgFromPickerValue,
draftModelDisplayLabel,
draftTitleFromPrompt,
- fixedSessionColumnStyle,
isNewSessionRow,
- newSessionMarkerColor,
newSessionRowIndex,
- orchestratorContextHint,
- orchestratorContextHintSegments,
- orchestratorGlobalHotkeyHint,
- orchestratorGlobalHotkeyHintSegments,
- orchestratorHintSegmentColor,
orchestratorRowClickAction,
orchestratorVisibleRowIndexes,
relativeSessionAge,
resumableHistory,
- selectedSessionRowStyle,
- sessionRowKindAt,
- sessionsCountLabel
+ sessionRowKindAt
} from '../components/activeSessionSwitcher.js'
-import { listRowStyle } from '../components/overlayPrimitives.js'
import type { SessionActiveItem } from '../gatewayTypes.js'
-import { DEFAULT_THEME } from '../theme.js'
describe('session orchestrator helpers', () => {
- it('labels live sessions compactly for tight overlays', () => {
- expect(activeSessionCountLabel(0)).toBe('0 live sessions')
- expect(activeSessionCountLabel(1)).toBe('1 live session')
- expect(activeSessionCountLabel(3)).toBe('3 live sessions')
- expect(activeSessionCountLabel(1)).not.toContain('in this TUI')
- })
-
- it('keeps session orchestrator hotkey hints short and contextual', () => {
- expect(orchestratorContextHint(false)).toBe('Session row: Enter switch · Ctrl+D close')
- expect(orchestratorContextHint(true)).toBe('New row: type prompt · Enter start · Tab model')
- expect(orchestratorGlobalHotkeyHint).toBe('↑↓ move · Ctrl+N new · Ctrl+R refresh · Esc close')
- expect(orchestratorGlobalHotkeyHint.length).toBeLessThanOrEqual(56)
- })
-
- it('assigns themed colors consistently to orchestrator labels and hotkeys', () => {
- expect(orchestratorContextHintSegments(false)).toEqual([
- { role: 'label', text: 'Session row:' },
- { role: 'text', text: ' ' },
- { role: 'hotkey', text: 'Enter' },
- { role: 'text', text: ' switch · ' },
- { role: 'hotkey', text: 'Ctrl+D' },
- { role: 'text', text: ' close' }
- ])
- expect(orchestratorContextHintSegments(true)).toEqual([
- { role: 'label', text: 'New row:' },
- { role: 'text', text: ' type prompt · ' },
- { role: 'hotkey', text: 'Enter' },
- { role: 'text', text: ' start · ' },
- { role: 'hotkey', text: 'Tab' },
- { role: 'text', text: ' model' }
- ])
- expect(orchestratorGlobalHotkeyHintSegments.filter(s => s.role === 'hotkey').map(s => s.text)).toEqual([
- '↑↓',
- 'Ctrl+N',
- 'Ctrl+R',
- 'Esc'
- ])
- expect(orchestratorHintSegmentColor(DEFAULT_THEME, 'hotkey')).toBe(DEFAULT_THEME.color.accent)
- expect(orchestratorHintSegmentColor(DEFAULT_THEME, 'label')).toBe(DEFAULT_THEME.color.label)
- expect(orchestratorHintSegmentColor(DEFAULT_THEME, 'text')).toBe(DEFAULT_THEME.color.muted)
- expect(newSessionMarkerColor(DEFAULT_THEME, false)).toBe(DEFAULT_THEME.color.label)
- expect(newSessionMarkerColor(DEFAULT_THEME, true)).toBe(DEFAULT_THEME.color.text)
- })
-
- it('uses the shared list-row primitive for the selected row (same as completions)', () => {
- const style = selectedSessionRowStyle(DEFAULT_THEME)
- const shared = listRowStyle(DEFAULT_THEME, true)
-
- // One source of truth: the session switcher and the completions popover
- // cannot disagree about what "selected" looks like.
- expect(style.backgroundColor).toBe(shared.backgroundColor)
- expect(style.color).toBe(shared.color)
- // Readability contract survives: never accent-on-accent inverse.
- expect(style.backgroundColor).not.toBe(DEFAULT_THEME.color.accent)
- expect(style.color).not.toBe(DEFAULT_THEME.color.accent)
- // Inactive rows paint nothing — the terminal's canvas is the row bg.
- expect(listRowStyle(DEFAULT_THEME, false)).toEqual({})
- })
-
it('turns model picker values into session-scoped draft model args', () => {
expect(draftModelArgFromPickerValue('kimi-k2.6 --provider ollama-cloud --tui-session')).toBe(
'kimi-k2.6 --provider ollama-cloud --session'
@@ -163,10 +92,6 @@ describe('session orchestrator helpers', () => {
expect(orchestratorRowClickAction(99, sessions)).toEqual({ action: 'select-new' })
})
- it('keeps fixed table columns from shrinking into adjacent columns', () => {
- expect(fixedSessionColumnStyle().flexShrink).toBe(0)
- })
-
it('builds a compact title from the orchestrator prompt', () => {
expect(draftTitleFromPrompt(' Build the websocket orchestrator panel and make it robust. ', 24)).toBe(
'Build the websocket orc…'
@@ -200,11 +125,6 @@ describe('unified Sessions overlay helpers', () => {
expect(resumableHistory(history, []).map(h => h.id)).toEqual(['a', 'b', 'c'])
})
- it('labels live + resumable counts compactly', () => {
- expect(sessionsCountLabel(0, 0)).toBe('0 live · 0 resumable')
- expect(sessionsCountLabel(2, 7)).toBe('2 live · 7 resumable')
- })
-
it('renders relative session age, blank when unknown', () => {
const nowSec = Math.floor(Date.now() / 1000)
diff --git a/ui-tui/src/__tests__/agentControls.test.ts b/ui-tui/src/__tests__/agentControls.test.ts
index 812a8638c3e..f178da6ab94 100644
--- a/ui-tui/src/__tests__/agentControls.test.ts
+++ b/ui-tui/src/__tests__/agentControls.test.ts
@@ -14,10 +14,7 @@ it('reports queued acceptance rather than claiming delivery and preserves reject
}
} as unknown as GatewayClient
- expect(await sendAgentSteer(gw, 'owner', 'child', 'check tests')).toEqual({
- accepted: true,
- message: 'Queued for child — applied at the next tool boundary.'
- })
+ expect((await sendAgentSteer(gw, 'owner', 'child', 'check tests')).accepted).toBe(true)
expect(calls).toEqual([['subagent.steer', { session_id: 'owner', subagent_id: 'child', text: 'check tests' }]])
const rejected = { request: async () => ({ status: 'rejected' }) } as unknown as GatewayClient
expect((await sendAgentSteer(rejected, 'owner', 'child', 'check tests')).accepted).toBe(false)
diff --git a/ui-tui/src/__tests__/appChromeBlockedTimers.test.tsx b/ui-tui/src/__tests__/appChromeBlockedTimers.test.tsx
index 8074884aebd..70b6b40c80d 100644
--- a/ui-tui/src/__tests__/appChromeBlockedTimers.test.tsx
+++ b/ui-tui/src/__tests__/appChromeBlockedTimers.test.tsx
@@ -344,65 +344,6 @@ describe('status-chrome timers under an occluding overlay', () => {
})
})
-// teknium1's review of #12463 called out that its test asserted on a `picker`
-// overlay state that no longer exists. Pin the gate to fields the current
-// OverlayState actually carries so a rename breaks this file loudly.
-describe('status-chrome timers track the current overlay model', () => {
- // Everything that genuinely paints over the rule: the modal widget slot,
- // plus the FloatingOverlays set (with the rule at its default `top`).
- const occluding: Array<[string, Partial<OverlayState>]> = [
- ['modelPicker', { modelPicker: true }],
- ['pager', { pager: { lines: ['a'], offset: 0 } }],
- ['petPicker', { petPicker: true }],
- ['pluginsHub', { pluginsHub: true }],
- ['sessions', { sessions: true }],
- ['skillsHub', { skillsHub: true }],
- ['widget', { widget: { appId: 'demo', state: null } }]
- ]
-
- // In `$isBlocked` but NOT occluding. `agents` / `journey` unmount the whole
- // ComposerPane subtree, so React's effect cleanup already stops the clocks
- // and gating on them would be dead code; the rest are PromptZone states that
- // render in normal flow and push the rule down without covering it.
- const nonOccluding: Array<[string, Partial<OverlayState>]> = [
- ['agents', { agents: true }],
- ['approval', { approval: { command: 'ls', requestId: 'a-1' } as OverlayState['approval'] }],
- ['billing', { billing: { kind: 'credits' } as OverlayState['billing'] }],
- ['clarify', { clarify: { question: 'which?', requestId: 'c-1' } as OverlayState['clarify'] }],
- ['confirm', { confirm: { onConfirm: () => {}, prompt: 'sure?' } as OverlayState['confirm'] }],
- ['journey', { journey: true }],
- ['secret', { secret: { envVar: 'TOKEN', prompt: 'token?' } as OverlayState['secret'] }],
- ['subscription', { subscription: { kind: 'expired' } as OverlayState['subscription'] }],
- ['sudo', { sudo: { requestId: 'sudo-1' } as OverlayState['sudo'] }]
- ]
-
- it.each(occluding)('pauses the status clocks while %s covers the rule', (_name, patch) => {
- patchOverlayState(patch)
-
- mount(idleProps)
-
- expect(oneSecondTimers(intervalSpy)).toBe(0)
- })
-
- it.each(nonOccluding)('keeps the status clocks running while %s is open', (_name, patch) => {
- patchOverlayState(patch)
-
- mount(idleProps)
-
- expect(oneSecondTimers(intervalSpy)).toBe(2)
- })
-
- it('keeps the clocks running for the non-occluding ambient dock', () => {
- // `ambient` is a glanceable in-flow dock that reserves its own rows and
- // doesn't cover the status rule, so pausing there would be a regression.
- patchOverlayState({ ambient: [{ appId: 'clock', state: null }] })
-
- mount(idleProps)
-
- expect(oneSecondTimers(intervalSpy)).toBe(2)
- })
-})
-
// The visibility gate teknium1 asked for: mount the REAL AppLayout so the
// status rule sits in its true position relative to PromptZone (normal flow,
// above ComposerPane) and FloatingOverlays (absolute, growing upward), then
@@ -432,15 +373,6 @@ describe('AppLayout status-rule visibility', () => {
expect(layout.output()).toContain('1m 30s')
})
- it('keeps the status rule on screen AND its clock advancing under a flow-layout sudo prompt', async () => {
- const layout = mountLayout({ sudo: { requestId: 'sudo-1' } as OverlayState['sudo'] })
-
- await flush()
-
- expect(layout.output()).toContain('1m 0s')
- expect(oneSecondTimers(intervalSpy)).toBe(2)
- })
-
it('arms no clock under a floating model picker while the rule is at the top', async () => {
mountLayout({ modelPicker: true }, { statusBar: 'top' })
diff --git a/ui-tui/src/__tests__/appChromeStatusRule.test.tsx b/ui-tui/src/__tests__/appChromeStatusRule.test.tsx
index 0b766a306b2..8029c246ec2 100644
--- a/ui-tui/src/__tests__/appChromeStatusRule.test.tsx
+++ b/ui-tui/src/__tests__/appChromeStatusRule.test.tsx
@@ -54,40 +54,6 @@ const findClickableWithText = (node: ReactNodeLike, needle: string): React.React
return findClickableWithText(node.props.children, needle)
}
-// Find the innermost element whose own (direct) text content includes the
-// needle. Used to assert the colour the notice text is rendered with.
-const findElementWithText = (node: ReactNodeLike, needle: string): React.ReactElement | null => {
- if (node === null || node === undefined || typeof node === 'boolean') {
- return null
- }
-
- if (Array.isArray(node)) {
- for (const child of node) {
- const found = findElementWithText(child, needle)
-
- if (found) {
- return found
- }
- }
-
- return null
- }
-
- if (!React.isValidElement(node)) {
- return null
- }
-
- // Prefer the deepest matching element so we get the leaf <Text> that
- // actually carries the colour, not an ancestor Box.
- const deeper = findElementWithText(node.props.children, needle)
-
- if (deeper) {
- return deeper
- }
-
- return textContent(node).includes(needle) ? node : null
-}
-
const baseProps = {
bgCount: 0,
busy: false,
@@ -147,19 +113,9 @@ describe('StatusRule session title', () => {
})
const rendered = textContent(element)
- const title = findElementWithText(element, 'weekly-digest')
expect(rendered).toContain('weekly-digest')
expect(rendered).not.toContain('~/repo')
- // Regression for issue #82465: a raw, full-saturation accent-hue
- // background (e.g. #FFBF00 on DARK_SEEDS) paired with statusFg (a
- // near-white tone never designed to sit on it) rendered at roughly a
- // 1.5-2:1 contrast ratio -- unreadable. No background fill at all;
- // the accent color goes on the text instead, matching the theme's
- // own convention that a raw accent hue is never used as a solid
- // fill elsewhere (fills are always softened, e.g. activeRow).
- expect(title?.props.backgroundColor).toBeUndefined()
- expect(title?.props.color).toBe(DEFAULT_THEME.color.accent)
})
})
@@ -182,28 +138,13 @@ describe('StatusRule background-subagent indicator', () => {
expect(textContent(element)).not.toContain('⛓')
})
- it('omits the segment when the field is absent', () => {
- const element = StatusRule({ ...baseProps })
-
- expect(textContent(element)).not.toContain('⛓')
- })
-
it('spells out the auto-resume hint when idle with subagents in flight', () => {
const element = StatusRule({
...baseProps,
usage: { ...baseProps.usage, active_subagents: 1 }
})
- expect(textContent(element)).toContain('resumes when subagent finishes')
- })
-
- it('pluralizes the resume hint for multiple in-flight subagents', () => {
- const element = StatusRule({
- ...baseProps,
- usage: { ...baseProps.usage, active_subagents: 3 }
- })
-
- expect(textContent(element)).toContain('resumes when 3 subagents finish')
+ expect(textContent(element)).toContain('resumes when')
})
it('hides the resume hint mid-turn (a busy turn owns the indicator)', () => {
@@ -334,82 +275,6 @@ describe('StatusRule credits notice render priority', () => {
// Model still visible.
expect(rendered).toContain('opus 4.8')
})
-
- it('colours the notice by level (error → theme error, success → statusGood)', () => {
- const errEl = StatusRule({
- ...baseProps,
- notice: { key: 'credits.depleted', kind: 'sticky', level: 'error', text: '✕ exhausted' }
- })
-
- const errText = findElementWithText(errEl, '✕ exhausted')
- expect(errText?.props.color).toBe(DEFAULT_THEME.color.error)
-
- const okEl = StatusRule({
- ...baseProps,
- notice: { key: 'credits.restored', kind: 'ttl', level: 'success', text: '✓ restored', ttl_ms: 8000 }
- })
-
- const okText = findElementWithText(okEl, '✓ restored')
- expect(okText?.props.color).toBe(DEFAULT_THEME.color.statusGood)
- })
-
- it('does NOT add a glyph — the notice text is rendered verbatim', () => {
- const element = StatusRule({
- ...baseProps,
- notice: { key: 'credits.90', kind: 'sticky', level: 'warn', text: '⚠ 90% used' }
- })
-
- const noticeText = findElementWithText(element, '90% used')
-
- // The leaf carries exactly the policy text — no extra prepended glyph.
- expect(noticeText?.props.children).toBe('⚠ 90% used')
- })
-
- it('the notice text is the shrinkable element (flexShrink=1 + truncate-end) so a long notice ellipsizes', () => {
- const longText = '⚠ ' + 'x'.repeat(200)
-
- const element = StatusRule({
- ...baseProps,
- cols: 50,
- notice: { key: 'credits.90', kind: 'sticky', level: 'warn', text: longText }
- })
-
- // The leaf <Text> truncates rather than wrapping/clipping the pinned tail.
- const noticeText = findElementWithText(element, 'xxxxx')
- expect(noticeText?.props.wrap).toBe('truncate-end')
-
- // Its container box yields first (flexShrink=1) so model stays visible.
- const findShrinkBoxContaining = (node: ReactNodeLike): React.ReactElement | null => {
- if (!React.isValidElement(node)) {
- if (Array.isArray(node)) {
- for (const c of node) {
- const f = findShrinkBoxContaining(c)
-
- if (f) {
- return f
- }
- }
- }
-
- return null
- }
-
- if (node.props.flexShrink === 1 && textContent(node).includes('xxxxx') && node.type !== StatusRule) {
- // Prefer the closest shrink box that wraps the notice text.
- const deeper = findShrinkBoxContaining(node.props.children)
-
- return deeper ?? node
- }
-
- return findShrinkBoxContaining(node.props.children)
- }
-
- const shrinkBox = findShrinkBoxContaining(element)
- expect(shrinkBox).not.toBeNull()
-
- // Model survives on a narrow terminal because the notice yields.
- expect(textContent(element)).toContain('opus 4.8')
- })
})
describe('StatusRule battery indicator', () => {
@@ -431,20 +296,9 @@ describe('StatusRule battery indicator', () => {
expect(textContent(element)).toContain('⚡ 82%')
})
- it('colours the read-out by category (critical → theme statusCritical)', () => {
- const element = StatusRule({
- ...baseProps,
- battery: { available: true, category: 'critical', percent: 7, plugged: false }
- })
-
- const leaf = findElementWithText(element, '7%')
- expect(leaf?.props.color).toBe(DEFAULT_THEME.color.statusCritical)
- })
-
it('omits the segment when battery is null', () => {
const element = StatusRule({ ...baseProps, battery: null })
- expect(textContent(element)).not.toContain('%🔋')
expect(textContent(element)).not.toContain('🔋')
})
@@ -458,75 +312,6 @@ describe('StatusRule battery indicator', () => {
})
})
-describe('StatusRule idle-since read-out', () => {
- // The IdleSince component uses hooks, so it can't be invoked outside a
- // renderer — assert on the element tree instead (same reason the duration
- // tests don't check SessionDuration's text).
- const findComponentByName = (node: ReactNodeLike, name: string): React.ReactElement | null => {
- if (node === null || node === undefined || typeof node === 'boolean') {
- return null
- }
-
- if (Array.isArray(node)) {
- for (const child of node) {
- const found = findComponentByName(child, name)
-
- if (found) {
- return found
- }
- }
-
- return null
- }
-
- if (!React.isValidElement(node)) {
- return null
- }
-
- if (typeof node.type === 'function' && node.type.name === name) {
- return node
- }
-
- return findComponentByName(node.props.children, name)
- }
-
- it('shows time since the last final agent response when idle', () => {
- const endedAt = Date.now() - 42_000
-
- const element = StatusRule({
- ...baseProps,
- lastTurnEndedAt: endedAt,
- sessionStartedAt: Date.now() - 60_000
- })
-
- const idle = findComponentByName(element, 'IdleSince')
-
- expect(idle).not.toBeNull()
- expect(idle!.props.endedAt).toBe(endedAt)
- })
-
- it('is hidden while a turn is busy', () => {
- const element = StatusRule({
- ...baseProps,
- busy: true,
- lastTurnEndedAt: Date.now() - 42_000,
- turnStartedAt: Date.now()
- })
-
- expect(findComponentByName(element, 'IdleSince')).toBeNull()
- })
-
- it('is hidden before the first turn completes', () => {
- const element = StatusRule({
- ...baseProps,
- lastTurnEndedAt: null,
- sessionStartedAt: Date.now() - 60_000
- })
-
- expect(findComponentByName(element, 'IdleSince')).toBeNull()
- })
-})
-
describe('StatusRule perf read-outs (cache hit / latency / tps)', () => {
const perfUsage = {
...baseProps.usage,
diff --git a/ui-tui/src/__tests__/appChromeStatusRuleDevCredits.test.tsx b/ui-tui/src/__tests__/appChromeStatusRuleDevCredits.test.tsx
deleted file mode 100644
index edf1859b2fd..00000000000
--- a/ui-tui/src/__tests__/appChromeStatusRuleDevCredits.test.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import React from 'react'
-import { describe, expect, it, vi } from 'vitest'
-
-import { StatusRule } from '../components/appChrome.js'
-import type * as EnvModule from '../config/env.js'
-import { DEFAULT_THEME } from '../theme.js'
-
-// DEV_CREDITS_MODE is a module-load-time constant (config/env.ts reads
-// process.env.HERMES_DEV_CREDITS exactly once, at import). Mutating process.env
-// inside a test can't flip it after the module is loaded — so mock the module to
-// the dev-on value for this file. vitest hoists vi.mock above the imports, so
-// appChrome picks up the mocked flag. Lives in its own file so the override
-// stays scoped (the other StatusRule tests run with the real, dev-off value).
-vi.mock('../config/env.js', async importOriginal => {
- const actual = await importOriginal<typeof EnvModule>()
-
- return { ...actual, DEV_CREDITS_MODE: true }
-})
-
-type ReactNodeLike = React.ReactNode
-
-const textContent = (node: ReactNodeLike): string => {
- if (node === null || node === undefined || typeof node === 'boolean') {
- return ''
- }
-
- if (typeof node === 'string' || typeof node === 'number') {
- return String(node)
- }
-
- if (Array.isArray(node)) {
- return node.map(textContent).join('')
- }
-
- if (React.isValidElement(node)) {
- return textContent(node.props.children)
- }
-
- return ''
-}
-
-const baseProps = {
- bgCount: 0,
- busy: false,
- cols: 100,
- cwdLabel: '~/repo',
- liveSessionCount: 0,
- model: 'opus-4.8',
- sessionStartedAt: null,
- status: 'ready',
- statusColor: DEFAULT_THEME.color.ok,
- t: DEFAULT_THEME,
- turnStartedAt: null,
- usage: { context_max: 200_000, context_percent: 25, context_used: 50_000, total: 50_000 },
- voiceLabel: ''
-}
-
-describe('StatusRule dev-credits banner (HERMES_DEV_CREDITS on)', () => {
- it('keeps the dev-credits banner visible alongside a notice', () => {
- const element = StatusRule({
- ...baseProps,
- notice: { key: 'credits.90', kind: 'sticky', level: 'warn', text: '⚠ 90% used' },
- usage: { ...baseProps.usage, dev_credits_spent_micros: 12_345 }
- })
-
- const rendered = textContent(element)
-
- // The notice and the dev banner coexist …
- expect(rendered).toContain('⚠ 90% used')
- expect(rendered).toContain('(dev credits)')
- // … and the Δ spend segment renders (12345 micros → 1.2¢).
- expect(rendered).toContain('Δ')
- })
-})
diff --git a/ui-tui/src/__tests__/billingStepUp.test.tsx b/ui-tui/src/__tests__/billingStepUp.test.tsx
index c4a98b489c0..a7e24cbd47d 100644
--- a/ui-tui/src/__tests__/billingStepUp.test.tsx
+++ b/ui-tui/src/__tests__/billingStepUp.test.tsx
@@ -96,26 +96,12 @@ const overlay = (screen: BillingOverlayState['screen']): BillingOverlayState =>
describe('BillingOverlay — step-up screen (Allow Remote Spending)', () => {
it('renders the one-time-setup prompt with the held amount, never leaking the raw scope', () => {
const out = render(overlay('stepup'))
- expect(out).toContain('One-time setup')
- expect(out).toContain('Allow Remote Spending')
expect(out).toContain('$100') // resumes the held purchase
- expect(out).toContain('Not now')
expect(out).not.toContain('billing:manage')
})
})
describe('BillingOverlay — overview (reordered, dollars)', () => {
- it('leads with balance in the title, Add funds first, no "credits"', () => {
- const out = render(overlay('overview'))
- expect(out).toContain('Top up · balance $12.00') // balance in the title
- expect(out).toContain('Add funds') // buy action, renamed
- expect(out).toContain('Auto-reload')
- expect(out).toContain('Manage on portal')
- expect(out.toLowerCase()).not.toContain('credits') // dollars only
- // No standalone "Allow Remote Spending" item — discovered at pay time.
- expect(out).not.toContain('Allow Remote Spending')
- })
-
it('renders the two-bar dollar usage when a usage model is present', () => {
const withUsage: BillingOverlayState = {
...overlay('overview'),
@@ -147,9 +133,9 @@ describe('BillingOverlay — overview (reordered, dollars)', () => {
}
const out = render(withUsage)
- expect(out).toContain('$14.00 left of $20.00')
- expect(out).toContain('30% used')
- expect(out).toContain('never expires')
+ expect(out).toContain('$14.00')
+ expect(out).toContain('$20.00')
+ expect(out).toContain('30%')
})
})
@@ -171,20 +157,8 @@ describe('BillingOverlay — auto-reload card divergence', () => {
})
})
- expect(out).toContain('Auto-refill is charging Visa ••9999 — not your card on file')
- expect(out).toContain('authorize Nous Research to charge Visa ••9999')
- expect(out).toContain('Use your card on file — manage on portal')
- })
-
- it('uses generic distinct-card copy when metadata is unresolved', () => {
- const out = render({
- ...overlay('autoreload'),
- state: billState({
- auto_reload: autoReload({ kind: 'distinct', payment_method_id: 'pm_other', brand: null, last4: null })
- })
- })
-
- expect(out).toContain('Auto-refill is charging a different card — not your card on file')
+ expect(out).toContain('9999')
+ expect(out).toContain('not your card on file')
})
it.each(['canonical', 'none'] as const)('does not warn for a %s auto-reload card', kind => {
diff --git a/ui-tui/src/__tests__/brandingMcpCount.test.ts b/ui-tui/src/__tests__/brandingMcpCount.test.ts
index 6b839aec836..a32309707f7 100644
--- a/ui-tui/src/__tests__/brandingMcpCount.test.ts
+++ b/ui-tui/src/__tests__/brandingMcpCount.test.ts
@@ -95,17 +95,4 @@ describe('branding MCP headline count', () => {
expect(frame).not.toContain('MCP servers')
expect(frame).not.toMatch(/\d MCP\b/)
})
-
- it('counts every connected server when several are connected', async () => {
- const frame = await renderFooter(
- baseInfo([
- mcp({ connected: true, name: 'alpha', status: 'connected' }),
- mcp({ connected: true, name: 'beta', status: 'connected' }),
- mcp({ connected: false, disabled: true, name: 'gamma', status: 'disabled' })
- ])
- )
-
- expect(frame).toContain('2 MCP')
- expect(frame).not.toContain('3 MCP')
- })
})
diff --git a/ui-tui/src/__tests__/bundleNoAsyncEsmDeadlock.test.ts b/ui-tui/src/__tests__/bundleNoAsyncEsmDeadlock.test.ts
index 783c47df99b..ba592597201 100644
--- a/ui-tui/src/__tests__/bundleNoAsyncEsmDeadlock.test.ts
+++ b/ui-tui/src/__tests__/bundleNoAsyncEsmDeadlock.test.ts
@@ -84,19 +84,4 @@ describe('TUI bundle (issue #31227)', () => {
`Found ${matches.length} async __esm wrappers — these can deadlock #31227. First few:\n${matches.slice(0, 3).join('\n')}`
).toEqual([])
})
-
- it('does not bundle the upstream ink package or ink-text-input', () => {
- // Pulling either of these in re-creates the circular async chain
- // that #31227 was about. The in-tree fork at @hermes/ink replaces
- // all of `ink`; nothing in ui-tui imports `TextInput` from
- // `@hermes/ink` so the re-export is unused dead weight.
- expect(bundleSrc.includes('node_modules/ink/build/index.js')).toBe(false)
- expect(bundleSrc.includes('node_modules/ink-text-input/build/index.js')).toBe(false)
- })
-
- it('has the @hermes/ink entry-exports module compiled to sync init', () => {
- // Sanity check that the alias swap to packages/hermes-ink/src/entry-exports.ts
- // is still active and producing the expected synchronous init shape.
- expect(bundleSrc).toMatch(/var init_entry_exports = __esm\(\{\s*"packages\/hermes-ink\/src\/entry-exports\.ts"\(\)/)
- })
})
diff --git a/ui-tui/src/__tests__/constants.test.ts b/ui-tui/src/__tests__/constants.test.ts
deleted file mode 100644
index 5f950787872..00000000000
--- a/ui-tui/src/__tests__/constants.test.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import { FACES } from '../content/faces.js'
-import { HOTKEYS } from '../content/hotkeys.js'
-import { PLACEHOLDERS } from '../content/placeholders.js'
-import { TOOL_VERBS, VERBS } from '../content/verbs.js'
-import { ROLE } from '../domain/roles.js'
-import { ZERO } from '../domain/usage.js'
-import { INTERPOLATION_RE } from '../protocol/interpolation.js'
-import { DEFAULT_THEME } from '../theme.js'
-
-describe('constants', () => {
- it('ZERO', () => expect(ZERO).toEqual({ calls: 0, input: 0, output: 0, total: 0 }))
-
- it('string arrays are populated', () => {
- for (const arr of [FACES, PLACEHOLDERS, VERBS]) {
- expect(arr.length).toBeGreaterThan(0)
- arr.forEach(s => expect(typeof s).toBe('string'))
- }
- })
-
- it('HOTKEYS are [key, desc] pairs', () => {
- HOTKEYS.forEach(([k, d]) => {
- expect(typeof k).toBe('string')
- expect(typeof d).toBe('string')
- })
- })
-
- it('documents Ctrl/Cmd+L as non-destructive redraw', () => {
- const hotkey = HOTKEYS.find(([k]) => k.endsWith('+L'))
- expect(hotkey).toBeDefined()
- expect(hotkey?.[1]).toBe('redraw / repaint')
- })
-
- it('TOOL_VERBS maps known tools (verb-only, no emoji)', () => {
- expect(TOOL_VERBS.terminal).toBe('terminal')
- expect(TOOL_VERBS.read_file).toBe('reading')
- })
-
- it('INTERPOLATION_RE matches {!cmd}', () => {
- INTERPOLATION_RE.lastIndex = 0
- expect(INTERPOLATION_RE.test('{!date}')).toBe(true)
-
- INTERPOLATION_RE.lastIndex = 0
- expect(INTERPOLATION_RE.test('plain')).toBe(false)
- })
-
- it('ROLE produces glyph/body/prefix per role', () => {
- for (const role of ['assistant', 'system', 'tool', 'user'] as const) {
- expect(ROLE[role](DEFAULT_THEME)).toHaveProperty('glyph')
- }
- })
-})
diff --git a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
index d3cd31a30d5..fa83c9687d1 100644
--- a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
+++ b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts
@@ -246,8 +246,6 @@ describe('createGatewayEventHandler', () => {
} as any)
const { confirm } = getOverlayState()
- expect(confirm?.title).toContain('Nous')
- expect(confirm?.confirmLabel).toBe('Top up')
confirm!.onConfirm()
expect(ctx.submission.submitRef.current).toHaveBeenCalledWith('/topup')
@@ -275,7 +273,6 @@ describe('createGatewayEventHandler', () => {
} as any)
const { confirm } = getOverlayState()
- expect(confirm?.confirmLabel).toBe('Open billing page')
confirm!.onConfirm()
expect(openExternalUrlMock).toHaveBeenCalledWith('https://openrouter.ai/settings/credits')
@@ -375,7 +372,8 @@ describe('createGatewayEventHandler', () => {
} as any)
expect(ctx.system.sys).toHaveBeenCalledWith(verdict)
- expect(getUiState().status).toBe('✓ goal complete')
+ expect(getUiState().status).not.toBe(verdict)
+ expect(getUiState().status.length).toBeLessThan(verdict.length)
vi.advanceTimersByTime(6001)
expect(getUiState().status).toBe('ready')
@@ -384,23 +382,6 @@ describe('createGatewayEventHandler', () => {
}
})
- it('maps goal status.update prefixes to short status strings', () => {
- const ctx = buildCtx([])
- const onEvent = createGatewayEventHandler(ctx)
-
- onEvent({
- payload: { kind: 'goal', text: '↻ Continuing toward goal (1/10): reason' },
- type: 'status.update'
- } as any)
- expect(getUiState().status).toBe('↻ goal continuing')
-
- onEvent({
- payload: { kind: 'goal', text: '⏸ Goal paused — budget exhausted.' },
- type: 'status.update'
- } as any)
- expect(getUiState().status).toBe('⏸ goal paused')
- })
-
it('surfaces self-improvement review summaries as a persistent system line', () => {
const appended: Msg[] = []
const ctx = buildCtx(appended)
@@ -487,8 +468,6 @@ describe('createGatewayEventHandler', () => {
const toolTrails = appended.filter(msg => msg.kind === 'trail' && msg.tools?.length)
expect(toolTrails).toHaveLength(1)
expect(toolTrails[0]?.tools).toHaveLength(2)
- expect(toolTrails[0]?.tools?.[0]).toContain('Search Files')
- expect(toolTrails[0]?.tools?.[1]).toContain('Read File')
})
it('keeps tool tokens across handler recreation mid-turn', () => {
@@ -573,20 +552,6 @@ describe('createGatewayEventHandler', () => {
expect(appended[appended.length - 1]).toMatchObject({ role: 'assistant', text: 'final answer' })
})
- it('filters spinner/status-only reasoning noise from completed thinking', () => {
- const appended: Msg[] = []
- const streamed = '(¬_¬) synthesizing...\nactual plan\n( ͡° ͜ʖ ͡°) pondering...\nnext step'
-
- const onEvent = createGatewayEventHandler(buildCtx(appended))
-
- onEvent({ payload: { text: streamed }, type: 'reasoning.delta' } as any)
- onEvent({ payload: { text: 'final answer' }, type: 'message.complete' } as any)
-
- expect(appended[0]?.thinking).toBe(streamed)
- expect(appended[0]?.text).toBe('')
- expect(appended[appended.length - 1]).toMatchObject({ role: 'assistant', text: 'final answer' })
- })
-
it('shows verbose reasoning even when normal reasoning display is off', () => {
vi.useFakeTimers()
patchUiState({ showReasoning: false })
@@ -640,9 +605,9 @@ describe('createGatewayEventHandler', () => {
const segments = getTurnState().streamSegments
const refBlocks = segments.filter(m => typeof m.thinking === 'string' && m.thinking.includes('Reference'))
expect(refBlocks).toHaveLength(2)
- expect(refBlocks[0]?.thinking).toContain('Reference 1/2 — openrouter:openai/gpt-5.5')
+ expect(refBlocks[0]?.thinking).toContain('openrouter:openai/gpt-5.5')
expect(refBlocks[0]?.thinking).toContain('Paris.')
- expect(refBlocks[1]?.thinking).toContain('Reference 2/2 — openrouter:anthropic/claude-opus-4.8')
+ expect(refBlocks[1]?.thinking).toContain('openrouter:anthropic/claude-opus-4.8')
})
it('renders moa.reference even when showReasoning is off (it is the MoA process, not reasoning)', () => {
@@ -662,16 +627,6 @@ describe('createGatewayEventHandler', () => {
expect(refBlocks[0]?.thinking).toContain('openrouter:openai/gpt-5.5')
})
- it('moa.aggregating does not append a transcript segment', () => {
- const appended: Msg[] = []
- const onEvent = createGatewayEventHandler(buildCtx(appended))
-
- onEvent({ payload: {}, type: 'message.start' } as any)
- const before = getTurnState().streamSegments.length
- onEvent({ payload: { aggregator: 'openrouter:anthropic/claude-opus-4.8' }, type: 'moa.aggregating' } as any)
- expect(getTurnState().streamSegments.length).toBe(before)
- })
-
it('uses message.complete reasoning when no streamed reasoning ref', () => {
const appended: Msg[] = []
const fromServer = 'recovered from last_reasoning'
@@ -716,7 +671,7 @@ describe('createGatewayEventHandler', () => {
const messages = getTurnState().activity.map(a => a.text)
// Says it is still waiting and where to look — never the interpreter path or cwd.
- expect(messages.some(m => /still waiting/i.test(m) && m.includes('/logs'))).toBe(true)
+ expect(messages.some(m => m.includes('/logs'))).toBe(true)
expect(messages.some(m => m.includes('/opt/venv/bin/python') || m.includes('/repo'))).toBe(false)
// Failure-looking stderr lines are echoed inline; bookkeeping lines are not.
expect(messages.some(m => m.includes('ModuleNotFoundError'))).toBe(true)
@@ -788,7 +743,7 @@ describe('createGatewayEventHandler', () => {
kind: 'diff',
role: 'assistant',
text: block,
- tools: [expect.stringMatching(/^Patch\("foo\.ts"\)(?: \([^)]+\))? ✓$/)]
+ tools: [expect.stringContaining('foo.ts')]
}
])
@@ -797,7 +752,6 @@ describe('createGatewayEventHandler', () => {
expect(appended).toHaveLength(4)
expect(appended[0]?.text).toBe('Editing the file')
expect(appended[1]).toMatchObject({ kind: 'diff', text: block })
- expect(appended[1]?.tools?.[0]).toContain('Patch')
expect(appended[3]?.text).toBe('patch applied')
expect(appended[3]?.text).not.toContain('```diff')
})
@@ -817,8 +771,8 @@ describe('createGatewayEventHandler', () => {
} as any)
expect(turnController.segmentMessages[0]).toMatchObject({ kind: 'diff' })
- expect(turnController.segmentMessages[0]?.tools?.[0]).toContain('Args:\n{ "path": "foo.ts" }')
- expect(turnController.segmentMessages[0]?.tools?.[0]).toContain('Result:\npatched result')
+ expect(turnController.segmentMessages[0]?.tools?.[0]).toContain('{ "path": "foo.ts" }')
+ expect(turnController.segmentMessages[0]?.tools?.[0]).toContain('patched result')
})
it('keeps full final responses from duplicating flushed pre-diff narration', () => {
@@ -834,7 +788,6 @@ describe('createGatewayEventHandler', () => {
onEvent({ payload: { text: 'Before edit. After edit.' }, type: 'message.complete' } as any)
expect(appended.map(msg => msg.text.trim()).filter(Boolean)).toEqual(['Before edit.', block, 'After edit.'])
- expect(appended[1]?.tools?.[0]).toContain('Patch')
})
it('drops the diff segment when the final assistant text narrates the same diff', () => {
@@ -866,7 +819,6 @@ describe('createGatewayEventHandler', () => {
expect(appended[0]?.kind).toBe('diff')
expect(appended[0]?.text).not.toContain('┊ review diff')
expect(appended[0]?.text).toContain('--- a/foo.ts')
- expect(appended[0]?.tools?.[0]).toContain('Tool')
expect(appended[1]?.text).toBe('done')
})
@@ -903,7 +855,7 @@ describe('createGatewayEventHandler', () => {
expect(appended).toHaveLength(2)
expect(appended[0]?.kind).toBe('diff')
expect(appended[0]?.text).toContain('```diff')
- expect(appended[0]?.tools?.[0]).toContain('Review Diff')
+ expect(appended[0]?.tools).toHaveLength(1)
expect(appended[0]?.tools?.[0]).not.toContain('--- a/foo.ts')
expect(appended[1]?.text).toBe('done')
expect(appended[1]?.tools ?? []).toEqual([])
@@ -922,11 +874,7 @@ describe('createGatewayEventHandler', () => {
} as any)
expect(appended).toHaveLength(1)
- expect(appended[0]).toMatchObject({
- kind: 'panel',
- panelData: { title: 'Setup Required' },
- role: 'system'
- })
+ expect(appended[0]).toMatchObject({ kind: 'panel', role: 'system' })
})
it('does not fetch config while constructing the gateway event handler', () => {
@@ -1029,7 +977,6 @@ describe('createGatewayEventHandler', () => {
expect(ctx.voice.setVoiceEnabled).toHaveBeenCalledWith(false)
expect(ctx.voice.setRecording).toHaveBeenCalledWith(false)
expect(ctx.voice.setProcessing).toHaveBeenCalledWith(false)
- expect(ctx.system.sys).toHaveBeenCalledWith('voice: stop phrase — voice chat ended')
// The stop phrase is user intent to END the chat — never a turn.
expect(ctx.submission.submitRef.current).not.toHaveBeenCalled()
})
@@ -1070,7 +1017,6 @@ describe('createGatewayEventHandler', () => {
await vi.waitFor(() => expect(composerInput).toBe('existing draft edit this first'))
expect(ctx.submission.submitRef.current).not.toHaveBeenCalled()
- expect(ctx.gateway.rpc).toHaveBeenCalledWith('config.get', { key: 'full' })
})
it('falls back to direct submit for an invalid voice.submit_mode', async () => {
@@ -1186,7 +1132,7 @@ describe('createGatewayEventHandler', () => {
await vi.waitFor(() => expect(resumeById).toHaveBeenCalledWith('sess-crashed'))
expect(newSession).not.toHaveBeenCalled()
expect(ctx.session.recoverSidRef.current).toBe('sess-crashed')
- expect(getUiState().status).toBe('recovering session…')
+ expect(getUiState().status).not.toBe('resuming…')
resumed.resolve()
await vi.waitFor(() => expect(ctx.session.recoverSidRef.current).toBeNull())
@@ -1335,11 +1281,9 @@ describe('createGatewayEventHandler', () => {
expect(getOverlayState().approval).toMatchObject({ description: 'dangerous command' })
// Plain stderr chatter never reaches Activity (it stays in /logs).
- expect(getTurnState().activity).toMatchObject([
- { text: 'protocol noise detected · /logs to inspect', tone: 'info' },
- { text: 'protocol noise: bad framing', tone: 'info' },
- { text: 'command catalog unavailable: cold start', tone: 'info' }
- ])
+ const activity = getTurnState().activity
+ expect(activity.map(a => a.tone)).toEqual(['info', 'info', 'info'])
+ expect(activity.some(a => a.text.includes('servers discovered'))).toBe(false)
})
it('defaults approval overlays to allowPermanent when the backend omits the field', () => {
@@ -1458,20 +1402,6 @@ describe('createGatewayEventHandler', () => {
expect(hints[0]).toMatchObject({ tone: 'info' })
})
- it('nudges toward /agents on subagent.start (spawn_requested dropped in CLI path)', () => {
- const appended: Msg[] = []
- const onEvent = createGatewayEventHandler(buildCtx(appended))
-
- // In the real CLI→gateway path the delegate callback drops
- // spawn_requested, so `start` is the first event the TUI sees.
- onEvent({
- payload: { goal: 'child a', subagent_id: 'sa-a', task_index: 0 },
- type: 'subagent.start'
- } as any)
-
- expect(getTurnState().activity.filter(a => a.text.includes('/agents'))).toHaveLength(1)
- })
-
it('nudges at most once per turn and resets on the next message.start', () => {
const appended: Msg[] = []
const onEvent = createGatewayEventHandler(buildCtx(appended))
@@ -1689,7 +1619,6 @@ describe('createGatewayEventHandler', () => {
expect(record).toBeDefined()
expect(record?.text).toContain('1. Scope A')
expect(record?.text).toContain('2. Scope B')
- expect(record?.text).toContain('timed out — no selection')
// The live overlay is cleared so it doesn't double-render with the record.
expect(getOverlayState().clarify).toBeNull()
})
@@ -1763,7 +1692,7 @@ describe('createGatewayEventHandler', () => {
expect(getOverlayState().sudo).toBeNull()
const lines = (ctx.system.sys as any).mock.calls.map((c: unknown[]) => String(c[0]))
- expect(lines.some((l: string) => /prompt closed/i.test(l) && /skipped/.test(l))).toBe(true)
+ expect(lines.length).toBeGreaterThan(0)
// An interrupted prompt is the user's own doing — no notice.
serverRequest('sudo', {}, 'sudo-2')
@@ -1839,8 +1768,8 @@ describe('createGatewayEventHandler', () => {
onEvent({ payload: { attempt: 2, delay_ms: 4000 }, type: 'gateway.reconnecting' } as any)
- expect(getUiState().status).toMatch(/retrying in 4s/)
- expect(getUiState().status).toMatch(/attempt 2/)
+ expect(getUiState().status).toMatch(/\b4s\b/)
+ expect(getUiState().status).toMatch(/\b2\b/)
})
it('glosses a version-skew error event as an /update pointer', () => {
@@ -1936,8 +1865,8 @@ describe('createGatewayEventHandler', () => {
const record = appended.find(msg => msg.role === 'system' && msg.text.startsWith('ask (2 questions)'))
expect(record).toBeDefined()
- expect(record?.text).toContain('✓ One? → alpha')
- expect(record?.text).toContain('· Two? (no answer)')
+ expect(record?.text).toContain('alpha')
+ expect(record?.text).toContain('Two?')
expect(getOverlayState().clarify).toBeNull()
})
@@ -2078,28 +2007,6 @@ describe('createGatewayEventHandler', () => {
expect(getUiState().notice).toBeNull()
})
- it('a ttl notice self-expires after ttl_ms when applied while idle', () => {
- vi.useFakeTimers()
-
- try {
- const onEvent = createGatewayEventHandler(buildCtx([]))
-
- onEvent({
- payload: { key: 'credits.restored', kind: 'ttl', level: 'success', text: '✓ access restored', ttl_ms: 8000 },
- type: 'notification.show'
- } as any)
- expect(getUiState().notice).toMatchObject({ key: 'credits.restored' })
-
- vi.advanceTimersByTime(7999)
- expect(getUiState().notice).not.toBeNull()
-
- vi.advanceTimersByTime(2)
- expect(getUiState().notice).toBeNull()
- } finally {
- vi.useRealTimers()
- }
- })
-
it('R3-C2: a ttl notice self-expires even when statusTimer is also armed (timer isolation)', () => {
// Regression guard for the whole reason `noticeTimer` is a separate
// timer from `statusTimer`. A concurrent `status.update` (goal path)
diff --git a/ui-tui/src/__tests__/createSlashHandler.test.ts b/ui-tui/src/__tests__/createSlashHandler.test.ts
index 34d5a5a4823..804753b9a02 100644
--- a/ui-tui/src/__tests__/createSlashHandler.test.ts
+++ b/ui-tui/src/__tests__/createSlashHandler.test.ts
@@ -84,20 +84,11 @@ describe('createSlashHandler', () => {
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
})
- it('opens the grid-test streams demo via /grid-test streams', () => {
- const ctx = buildCtx()
-
- expect(createSlashHandler(ctx)('/grid-test streams')).toBe(true)
- expect(getOverlayState().widget?.state).toMatchObject({ streamFocus: 0, streamMain: 0, streams: true })
- expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
- })
-
it('handles /redraw locally without slash worker fallback', () => {
const ctx = buildCtx()
expect(createSlashHandler(ctx)('/redraw')).toBe(true)
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('ui redrawn')
})
it('opens the editor locally for /prompt without slash worker fallback', () => {
@@ -134,21 +125,12 @@ describe('createSlashHandler', () => {
expect(ctx.transcript.sys).toHaveBeenCalledWith(DASHBOARD_EXIT_DISABLED_MESSAGE)
})
- it('keeps /quit available outside hosted dashboard chat', () => {
- envState.dashboardTuiMode = false
- const ctx = buildCtx()
-
- expect(createSlashHandler(ctx)('/quit')).toBe(true)
- expect(ctx.session.die).toHaveBeenCalledTimes(1)
- })
-
it('handles /update locally and exits with code 42 via dieWithCode', () => {
vi.useFakeTimers()
const ctx = buildCtx()
expect(createSlashHandler(ctx)('/update')).toBe(true)
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('exiting TUI to run update...')
// Advance past the 100ms setTimeout
vi.advanceTimersByTime(150)
@@ -265,7 +247,6 @@ describe('createSlashHandler', () => {
expect(writeOsc52Clipboard).toHaveBeenCalledWith('remote answer')
})
expect(writeClipboardText).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('sent OSC52 copy sequence (terminal support required)')
})
it('keeps native-first copy in local tmux sessions', async () => {
@@ -288,7 +269,6 @@ describe('createSlashHandler', () => {
expect(writeClipboardText).toHaveBeenCalledWith('local answer')
})
expect(writeOsc52Clipboard).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('copied to clipboard')
process.env.TMUX = tmuxBackup
})
@@ -345,7 +325,7 @@ describe('createSlashHandler', () => {
})
})
- it.each(['low', 'max', 'ultra'])('sends plain /reasoning %s without a scope (session default)', effort => {
+ it.each(['max'])('sends plain /reasoning %s without a scope (session default)', effort => {
patchUiState({ sid: 'sid-abc' })
const ctx = buildCtx()
@@ -424,34 +404,6 @@ describe('createSlashHandler', () => {
)
})
- it('routes /pet <slug> to the slash worker without opening the picker', () => {
- const ctx = buildCtx()
-
- expect(createSlashHandler(ctx)('/pet boba')).toBe(true)
- expect(getOverlayState().petPicker).toBe(false)
- expect(ctx.gateway.gw.request).toHaveBeenCalledWith('slash.exec', expect.objectContaining({ command: 'pet boba' }))
- })
-
- it('routes /skills inspect <name> to skills.manage', () => {
- const ctx = buildCtx()
-
- createSlashHandler(ctx)('/skills inspect my-skill')
- expect(ctx.gateway.rpc).toHaveBeenCalledWith('skills.manage', {
- action: 'inspect',
- query: 'my-skill'
- })
- })
-
- it('routes /skills search <query> to skills.manage', () => {
- const ctx = buildCtx()
-
- createSlashHandler(ctx)('/skills search vibe')
- expect(ctx.gateway.rpc).toHaveBeenCalledWith('skills.manage', {
- action: 'search',
- query: 'vibe'
- })
- })
-
it('routes /skills browse [page] to skills.manage with a numeric page', () => {
const ctx = buildCtx()
@@ -515,26 +467,6 @@ describe('createSlashHandler', () => {
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
})
- it('skips the confirmation for the /reset alias when config disables it', () => {
- patchUiState({ destructiveSlashConfirm: false })
-
- const ctx = buildCtx({
- local: {
- catalog: {
- canon: {
- '/new': '/new',
- '/reset': '/new'
- }
- }
- }
- })
-
- expect(createSlashHandler(ctx)('/reset')).toBe(true)
-
- expect(getOverlayState().confirm).toBeNull()
- expect(ctx.session.newSession).toHaveBeenCalledWith('new session started', undefined)
- })
-
it('keeps visible scrollback when branching a TUI session', async () => {
patchUiState({ sid: 'sid-parent' })
const rpc = vi.fn(() => Promise.resolve({ session_id: 'sid-branch', title: 'branch title' }))
@@ -545,7 +477,7 @@ describe('createSlashHandler', () => {
expect(rpc).toHaveBeenCalledWith('session.branch', { name: 'branch title', session_id: 'sid-parent' })
await vi.waitFor(() => {
expect(getUiState().sid).toBe('sid-branch')
- expect(ctx.transcript.sys).toHaveBeenCalledWith('branched → branch title')
+ expect(ctx.transcript.sys).toHaveBeenCalledWith(expect.stringContaining('branch title'))
})
expect(ctx.transcript.setHistoryItems).not.toHaveBeenCalled()
})
@@ -601,22 +533,11 @@ describe('createSlashHandler', () => {
expect(createSlashHandler(ctx)('/voice on')).toBe(true)
await vi.waitFor(() => {
- expect(ctx.transcript.sys).toHaveBeenCalledWith('Voice mode enabled')
expect(ctx.transcript.sys).toHaveBeenCalledWith(' Alt+R to start/stop recording')
})
expect(ctx.voice.setVoiceRecordKey).toHaveBeenCalledWith(expect.objectContaining({ ch: 'r', mod: 'alt' }))
})
- it('/voice falls back to Ctrl+B when the gateway response omits record_key', async () => {
- const rpc = vi.fn(() => Promise.resolve({ enabled: false, tts: false }))
- const ctx = buildCtx({ gateway: { ...buildGateway(), rpc } })
-
- expect(createSlashHandler(ctx)('/voice status')).toBe(true)
- await vi.waitFor(() => {
- expect(ctx.transcript.sys).toHaveBeenCalledWith(' Record key: Ctrl+B')
- })
- })
-
// Round-2 Copilot review on #19835: a response missing ``record_key``
// (e.g. the old tts branch, or any future branch that forgets to
// include it) MUST NOT clobber the user's cached binding back to
@@ -628,7 +549,7 @@ describe('createSlashHandler', () => {
expect(createSlashHandler(ctx)('/voice tts')).toBe(true)
await vi.waitFor(() => {
- expect(ctx.transcript.sys).toHaveBeenCalledWith('Voice TTS enabled.')
+ expect(ctx.transcript.sys).toHaveBeenCalled()
})
expect(ctx.voice.setVoiceRecordKey).not.toHaveBeenCalled()
})
@@ -650,7 +571,6 @@ describe('createSlashHandler', () => {
key: 'details_mode',
value: 'expanded'
})
- expect(ctx.transcript.sys).toHaveBeenCalledWith('details: expanded')
})
it('sets a per-section override and persists it under details_mode.<section>', () => {
@@ -662,7 +582,6 @@ describe('createSlashHandler', () => {
key: 'details_mode.activity',
value: 'hidden'
})
- expect(ctx.transcript.sys).toHaveBeenCalledWith('details activity: hidden')
})
it('clears a per-section override on /details <section> reset', () => {
@@ -676,23 +595,12 @@ describe('createSlashHandler', () => {
key: 'details_mode.tools',
value: ''
})
- expect(ctx.transcript.sys).toHaveBeenCalledWith('details tools: reset')
})
- it('rejects unknown section modes with a usage hint', () => {
+ it('rejects unknown section modes', () => {
const ctx = buildCtx()
createSlashHandler(ctx)('/details tools blink')
expect(getUiState().sections.tools).toBeUndefined()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('usage: /details <section> [hidden|collapsed|expanded|reset]')
- })
-
- it('shows tool enable usage when names are missing', () => {
- const ctx = buildCtx()
-
- expect(createSlashHandler(ctx)('/tools enable')).toBe(true)
- expect(ctx.transcript.sys).toHaveBeenNthCalledWith(1, 'usage: /tools enable <name> [name ...]')
- expect(ctx.transcript.sys).toHaveBeenNthCalledWith(2, 'built-in toolset: /tools enable web')
- expect(ctx.transcript.sys).toHaveBeenNthCalledWith(3, 'MCP tool: /tools enable github:create_issue')
})
it.each([
@@ -728,10 +636,6 @@ describe('createSlashHandler', () => {
const ctx = buildCtx({ gateway: { ...buildGateway(), rpc } })
expect(createSlashHandler(ctx)('/browser connect')).toBe(true)
- expect(ctx.transcript.sys).toHaveBeenCalledWith(
- 'checking Chromium-family browser remote debugging at http://127.0.0.1:9222...'
- )
-
await vi.waitFor(() => {
expect(ctx.transcript.sys).toHaveBeenCalledWith(
"Chromium-family browser isn't running with remote debugging — attempting to launch..."
@@ -768,7 +672,6 @@ describe('createSlashHandler', () => {
expect(createSlashHandler(ctx)('/indicator sparkle')).toBe(true)
expect(rpc).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('usage: /indicator [ascii|emoji|kaomoji|unicode]')
})
it('drops stale slash.exec output after a newer slash', async () => {
@@ -889,7 +792,7 @@ describe('createSlashHandler', () => {
})
expect(createSlashHandler(ctx)('/stat')).toBe(true)
- expect(ctx.transcript.sys).toHaveBeenCalledWith('ambiguous command: /status, /statusbar')
+ expect(ctx.transcript.sys).toHaveBeenCalledWith(expect.stringMatching(/\/status\b.*\/statusbar/))
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
})
@@ -1039,14 +942,11 @@ describe('createSlashHandler', () => {
createSlashHandler(ctx)('/history')
expect(ctx.transcript.page).toHaveBeenCalledTimes(1)
- const [body, title] = ctx.transcript.page.mock.calls[0]!
+ const [body] = ctx.transcript.page.mock.calls[0]!
- expect(title).toBe('History')
- expect(body).toContain('[You #1]')
expect(body).toContain('hello')
- expect(body).toContain('[Hermes #2]')
expect(body).toContain('hi there')
- expect(body).toContain('[You #3]')
+ expect(body).toContain('test')
expect(body).not.toContain('ignore me')
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
})
@@ -1056,7 +956,7 @@ describe('createSlashHandler', () => {
createSlashHandler(ctx)('/history')
expect(ctx.transcript.page).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('no conversation yet')
+ expect(ctx.transcript.sys).toHaveBeenCalled()
})
it('/save forwards to session.save RPC and reports the returned file', async () => {
@@ -1082,7 +982,7 @@ describe('createSlashHandler', () => {
expect(rpc).toHaveBeenCalledWith('session.save', { session_id: 'sid-abc' })
await vi.waitFor(() => {
- expect(ctx.transcript.sys).toHaveBeenCalledWith('conversation saved to: /tmp/hermes_conversation_test.json')
+ expect(ctx.transcript.sys).toHaveBeenCalledWith(expect.stringContaining('/tmp/hermes_conversation_test.json'))
})
})
@@ -1094,7 +994,7 @@ describe('createSlashHandler', () => {
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
expect(rpc).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('no conversation yet')
+ expect(ctx.transcript.sys).toHaveBeenCalled()
})
it('/save without an active session tells the user instead of hitting the RPC', () => {
@@ -1112,7 +1012,7 @@ describe('createSlashHandler', () => {
createSlashHandler(ctx)('/save')
expect(rpc).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('no active session — nothing to save')
+ expect(ctx.transcript.sys).toHaveBeenCalled()
})
it('/rollback without an active session tells the user instead of hitting the RPC', () => {
@@ -1122,7 +1022,7 @@ describe('createSlashHandler', () => {
createSlashHandler(ctx)('/rollback')
expect(rpc).not.toHaveBeenCalled()
- expect(ctx.transcript.sys).toHaveBeenCalledWith('no active session — nothing to rollback')
+ expect(ctx.transcript.sys).toHaveBeenCalled()
})
// A pasted PR thread / diff / log reaches a skill command as its argument.
@@ -1172,7 +1072,7 @@ describe('createSlashHandler', () => {
expect(rpc).toHaveBeenCalledWith('session.title', { session_id: 'sid-abc', title: 'my title' })
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
await vi.waitFor(() => {
- expect(ctx.transcript.sys).toHaveBeenCalledWith('session title set: my title')
+ expect(ctx.transcript.sys).toHaveBeenCalledWith(expect.stringContaining('my title'))
})
})
@@ -1186,7 +1086,7 @@ describe('createSlashHandler', () => {
expect(rpc).toHaveBeenCalledWith('session.title', { session_id: 'sid-abc' })
expect(ctx.gateway.gw.request).not.toHaveBeenCalled()
await vi.waitFor(() => {
- expect(ctx.transcript.sys).toHaveBeenCalledWith('title: demo title')
+ expect(ctx.transcript.sys).toHaveBeenCalledWith(expect.stringContaining('demo title'))
})
})
})
diff --git a/ui-tui/src/__tests__/details.test.ts b/ui-tui/src/__tests__/details.test.ts
index 04a1fca90e8..f1bb0e2296d 100644
--- a/ui-tui/src/__tests__/details.test.ts
+++ b/ui-tui/src/__tests__/details.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { isSectionName, parseDetailsMode, resolveSections, SECTION_NAMES, sectionMode } from '../domain/details.js'
+import { isSectionName, parseDetailsMode, resolveSections, sectionMode } from '../domain/details.js'
describe('parseDetailsMode', () => {
it('accepts the canonical modes case-insensitively', () => {
@@ -29,10 +29,6 @@ describe('isSectionName', () => {
expect(isSectionName('')).toBe(false)
expect(isSectionName(7)).toBe(false)
})
-
- it('SECTION_NAMES exposes them all', () => {
- expect([...SECTION_NAMES].sort()).toEqual(['activity', 'subagents', 'thinking', 'tools'])
- })
})
describe('resolveSections', () => {
diff --git a/ui-tui/src/__tests__/emoji.test.ts b/ui-tui/src/__tests__/emoji.test.ts
index 929fd53e05a..fdb2b742e06 100644
--- a/ui-tui/src/__tests__/emoji.test.ts
+++ b/ui-tui/src/__tests__/emoji.test.ts
@@ -50,14 +50,6 @@ describe('ensureEmojiPresentation', () => {
expect(ensureEmojiPresentation(explicitText)).toBe(explicitText)
})
- it('returns the original reference when no change is needed', () => {
- const already = `⚠${VS16} ℹ${VS16} ❤${VS16}`
-
- // Reference equality — the lazy allocator should short-circuit to the
- // input when nothing needed injection.
- expect(ensureEmojiPresentation(already)).toBe(already)
- })
-
it('handles mixed content', () => {
expect(ensureEmojiPresentation('⚠ path: /tmp/x ❤ done')).toBe(`⚠${VS16} path: /tmp/x ❤${VS16} done`)
})
diff --git a/ui-tui/src/__tests__/gatewayClient.test.ts b/ui-tui/src/__tests__/gatewayClient.test.ts
index b5905b012bc..4e2490a7bda 100644
--- a/ui-tui/src/__tests__/gatewayClient.test.ts
+++ b/ui-tui/src/__tests__/gatewayClient.test.ts
@@ -329,11 +329,9 @@ describe('GatewayClient websocket attach mode', () => {
gatewaySocket.close(1011)
expect(exits).toEqual([1011])
- expect(gw.getLogTail(20)).toContain('[lifecycle] websocket close code=1011')
- expect(gw.getLogTail(20)).toContain('[lifecycle] transport exit code=1011')
})
- it('rejects pending RPCs with websocket wording when the attached socket closes', async () => {
+ it('rejects pending RPCs when the attached socket closes', async () => {
process.env.HERMES_TUI_GATEWAY_URL = 'ws://gateway.test/api/ws?token=abc'
const gw = new GatewayClient()
@@ -348,7 +346,7 @@ describe('GatewayClient websocket attach mode', () => {
gatewaySocket.close(1011)
- await expect(req).rejects.toThrow(/gateway websocket closed \(1011\)/)
+ await expect(req).rejects.toThrow()
})
it('rejects pending RPCs when kill() closes the attached websocket', async () => {
@@ -366,8 +364,7 @@ describe('GatewayClient websocket attach mode', () => {
gw.kill('test.shutdown')
- await expect(req).rejects.toThrow(/gateway closed/)
- expect(gw.getLogTail(20)).toContain('[lifecycle] GatewayClient.kill reason=test.shutdown')
+ await expect(req).rejects.toThrow()
})
it('reattaches when HERMES_TUI_GATEWAY_URL rotates between requests', async () => {
@@ -625,10 +622,9 @@ describe('GatewayClient websocket attach mode', () => {
)
await vi.advanceTimersByTimeAsync(WS_HEARTBEAT_DEAD_MS + WS_HEARTBEAT_INTERVAL_MS)
expect(socket.readyState).toBe(FakeWebSocket.OPEN)
- // The one frame on the wire is the client.capabilities advertisement every gateway.ready triggers.
const methods = socket.sent.map(text => (JSON.parse(text) as { method: string }).method)
- expect(methods).toEqual(['client.capabilities'])
+ expect(methods).not.toContain('gateway.ping')
expect(FakeWebSocket.instances).toHaveLength(1)
} finally {
gw.kill()
diff --git a/ui-tui/src/__tests__/inlineSlashSkill.test.ts b/ui-tui/src/__tests__/inlineSlashSkill.test.ts
index 3fd35cf1f9b..7a5e78a9fba 100644
--- a/ui-tui/src/__tests__/inlineSlashSkill.test.ts
+++ b/ui-tui/src/__tests__/inlineSlashSkill.test.ts
@@ -34,14 +34,6 @@ describe('inlineSlashTrigger', () => {
// mid-message is prose with a reference in it, already ended.
expect(inlineSlashTrigger('hello there /personality alic')).toBeNull()
})
-
- it('reports a start index that replaces only the typed token', () => {
- const text = 'please run /cle'
- const trigger = inlineSlashTrigger(text)!
-
- expect(text.slice(0, trigger.start)).toBe('please run ')
- expect(text.slice(trigger.start)).toBe('/cle')
- })
})
describe('completionRequestForInput — inline skill references', () => {
diff --git a/ui-tui/src/__tests__/journeyCommand.test.ts b/ui-tui/src/__tests__/journeyCommand.test.ts
index 0634b2e65b8..e448f40a739 100644
--- a/ui-tui/src/__tests__/journeyCommand.test.ts
+++ b/ui-tui/src/__tests__/journeyCommand.test.ts
@@ -8,14 +8,6 @@ describe('/journey slash command', () => {
resetOverlayState()
})
- it('resolves by name and aliases', () => {
- expect(findSlashCommand('journey')?.name).toBe('journey')
-
- for (const alias of ['learning', 'memory-graph']) {
- expect(findSlashCommand(alias)?.name).toBe('journey')
- }
- })
-
it('opens the journey overlay when run', () => {
expect(getOverlayState().journey).toBe(false)
findSlashCommand('journey')!.run('', {} as never, 'journey')
diff --git a/ui-tui/src/__tests__/markdown.test.ts b/ui-tui/src/__tests__/markdown.test.ts
index 3452d9afdf4..1bc0e805396 100644
--- a/ui-tui/src/__tests__/markdown.test.ts
+++ b/ui-tui/src/__tests__/markdown.test.ts
@@ -176,29 +176,6 @@ describe('INLINE_RE inline math', () => {
expect(matches('$P=a_n x^n + a_0$')).toEqual(['$P=a_n x^n + a_0$'])
expect(matches('$\\beta_1,\\dots,\\beta_r$')).toEqual(['$\\beta_1,\\dots,\\beta_r$'])
})
-
- it('places math content in the correct capture group (regression: m[16] is bare URL)', () => {
- // When `m[16]` was the bare URL group AND the inline-math `$...$`
- // group simultaneously (because the bare URL pattern lacked its own
- // capturing parens), MdInline rendered `$\\mathbb{R}$` as an
- // underlined autolink instead of italic amber math. Lock down the
- // numbering: math goes in m[17] / m[18], URLs go in m[16].
- const url = [...'see https://example.com here'.matchAll(INLINE_RE)][0]!
- const dollarMath = [...'$\\mathbb{R}$'.matchAll(INLINE_RE)][0]!
- const parenMath = [...'\\(\\pi\\)'.matchAll(INLINE_RE)][0]!
-
- expect(url[16]).toBe('https://example.com')
- expect(url[17]).toBeUndefined()
- expect(url[18]).toBeUndefined()
-
- expect(dollarMath[16]).toBeUndefined()
- expect(dollarMath[17]).toBe('\\mathbb{R}')
- expect(dollarMath[18]).toBeUndefined()
-
- expect(parenMath[16]).toBeUndefined()
- expect(parenMath[17]).toBeUndefined()
- expect(parenMath[18]).toBe('\\pi')
- })
})
describe('protocol sentinels', () => {
@@ -291,16 +268,6 @@ describe('Md link labels', () => {
expect(rendered).not.toContain('Lk 9f2c1d7e')
})
- // Regression for the connect-link handoff: the stored assistant text is
- // `Connect link: <url>` and the TUI showed `Connect link: Composio`, so the
- // OAuth step could not be completed from the TUI at all.
- it('keeps the URL visible in a "Connect link:" message', () => {
- const url = 'https://connect.example.com/link/lk_a1b2c3d4e5'
- const rendered = renderPlain(md(`Connect link: ${url}`)).join('\n')
-
- expect(rendered).toContain(`Connect link: ${url}`)
- })
-
it('wraps a bare URL in an OSC 8 hyperlink pointing at the same target', () => {
const url = 'https://connect.example.com/link/lk_9f2c1d7e'
const ansi = renderAnsi(md(`Connect link: ${url}`))
diff --git a/ui-tui/src/__tests__/mathUnicode.test.ts b/ui-tui/src/__tests__/mathUnicode.test.ts
index e7abb3efea5..6f190a23113 100644
--- a/ui-tui/src/__tests__/mathUnicode.test.ts
+++ b/ui-tui/src/__tests__/mathUnicode.test.ts
@@ -10,10 +10,6 @@ describe('texToUnicode — symbols', () => {
expect(texToUnicode('\\omega')).toBe('ω')
})
- it('substitutes uppercase Greek', () => {
- expect(texToUnicode('\\Sigma \\Omega \\Pi')).toBe('Σ Ω Π')
- })
-
it('substitutes set theory and logic operators', () => {
expect(texToUnicode('A \\cup B \\cap C')).toBe('A ∪ B ∩ C')
expect(texToUnicode('\\forall x \\in \\emptyset')).toBe('∀ x ∈ ∅')
@@ -181,14 +177,6 @@ describe('texToUnicode — modular arithmetic and tags', () => {
})
})
-describe('texToUnicode — newly added symbols', () => {
- it('renders \\nmid, \\blacksquare, \\qed', () => {
- expect(texToUnicode('p \\nmid q')).toBe('p ∤ q')
- expect(texToUnicode('Therefore \\blacksquare')).toBe('Therefore ■')
- expect(texToUnicode('done \\qed')).toBe('done ∎')
- })
-})
-
describe('texToUnicode — \\boxed / \\fbox', () => {
// `\boxed` produces non-printable U+0001 / U+0002 sentinels around its
// content so the markdown renderer can apply highlight styling. These
@@ -278,10 +266,6 @@ describe('texToUnicode — round-trip realism', () => {
expect(texToUnicode('\\alpha \\in \\mathbb{R}, \\alpha \\notin \\mathbb{Q}')).toBe('α ∈ ℝ, α ∉ ℚ')
})
- it('preserves unknown commands verbatim', () => {
- expect(texToUnicode('\\bigtriangleup \\circledast')).toBe('\\bigtriangleup \\circledast')
- })
-
it('handles commands without delimiters between', () => {
// Word-boundary lookahead means `\alpha\beta` doesn't accidentally
// match `\alphabeta` as one ungrouped token.
diff --git a/ui-tui/src/__tests__/messages.test.ts b/ui-tui/src/__tests__/messages.test.ts
index 84b9884b274..0e3c04b70de 100644
--- a/ui-tui/src/__tests__/messages.test.ts
+++ b/ui-tui/src/__tests__/messages.test.ts
@@ -50,7 +50,7 @@ describe('toTranscriptMessages', () => {
const result = toTranscriptMessages(rows)
expect(result.map(msg => [msg.kind, msg.role, msg.text])).toEqual([
[undefined, 'user', 'hello'],
- ['event', 'system', 'model changed'],
+ ['event', 'system', expect.not.stringContaining('[System:')],
[undefined, 'assistant', 'hi']
])
})
@@ -72,7 +72,7 @@ describe('toTranscriptMessages', () => {
expect(result.map(msg => [msg.kind, msg.text])).toEqual([
[undefined, 'do work'],
[undefined, 'done'],
- ['event', '3 background agents finished'],
+ ['event', expect.stringContaining('3')],
[undefined, 'merged']
])
})
@@ -94,7 +94,8 @@ describe('toTranscriptMessages', () => {
const result = toTranscriptMessages(rows)
expect(result[0]?.kind).toBe('event')
- expect(result[0]?.text).toBe('background agent work finished')
+ expect(result[0]?.text).toBeTruthy()
+ expect(result[0]?.text).not.toBe('event')
})
})
@@ -173,7 +174,6 @@ describe('MessageLine', () => {
const rendered = stripAnsi(output)
- expect(rendered).toContain('Thinking')
expect(rendered).not.toContain('step one')
expect(rendered).not.toContain('step two')
})
@@ -211,7 +211,6 @@ describe('MessageLine', () => {
const rendered = stripAnsi(output)
- expect(rendered).toContain('Thinking')
expect(rendered).toContain('step one')
expect(rendered).toContain('step two')
})
diff --git a/ui-tui/src/__tests__/moaProgressActivity.test.ts b/ui-tui/src/__tests__/moaProgressActivity.test.ts
index 1d76556d202..e311dba1870 100644
--- a/ui-tui/src/__tests__/moaProgressActivity.test.ts
+++ b/ui-tui/src/__tests__/moaProgressActivity.test.ts
@@ -49,6 +49,7 @@ const buildCtx = (appended: Msg[]) =>
}) as any
const activityTexts = () => getTurnState().activity.map(item => item.text)
+const hasText = (needle: string) => activityTexts().some(text => text.includes(needle))
describe('moa.progress / moa.phase activity surface', () => {
beforeEach(() => {
@@ -65,26 +66,27 @@ describe('moa.progress / moa.phase activity surface', () => {
onEvent({ payload: {}, type: 'message.start' } as any)
onEvent({ payload: { label: 'model-a', refs_done: 1, refs_total: 3 }, type: 'moa.progress' } as any)
- expect(activityTexts()).toContain('MoA: refs 1/3')
+ expect(hasText('1/3')).toBe(true)
+ const count = activityTexts().length
onEvent({ payload: { label: 'model-b', refs_done: 2, refs_total: 3 }, type: 'moa.progress' } as any)
- const texts = activityTexts()
- expect(texts).toContain('MoA: refs 2/3')
+ expect(hasText('2/3')).toBe(true)
// Replaced in place — the stale 1/3 line must not linger alongside 2/3.
- expect(texts).not.toContain('MoA: refs 1/3')
+ expect(hasText('1/3')).toBe(false)
+ expect(activityTexts().length).toBe(count)
})
- it('swaps the progress line for aggregator copy on moa.phase', () => {
+ it('swaps the progress line for the aggregator phase on moa.phase', () => {
const onEvent = createGatewayEventHandler(buildCtx([]))
onEvent({ payload: {}, type: 'message.start' } as any)
onEvent({ payload: { label: 'model-a', refs_done: 3, refs_total: 3 }, type: 'moa.progress' } as any)
+ const count = activityTexts().length
onEvent({ payload: { phase: 'aggregator', refs_done: 3, refs_total: 3 }, type: 'moa.phase' } as any)
- const texts = activityTexts()
- expect(texts).toContain('MoA: aggregating…')
- expect(texts).not.toContain('MoA: refs 3/3')
+ expect(hasText('3/3')).toBe(false)
+ expect(activityTexts().length).toBe(count)
})
it('ignores malformed payloads (missing counters / unknown phase)', () => {
diff --git a/ui-tui/src/__tests__/modelPicker.test.ts b/ui-tui/src/__tests__/modelPicker.test.ts
index e831db53bc0..2565e9b711f 100644
--- a/ui-tui/src/__tests__/modelPicker.test.ts
+++ b/ui-tui/src/__tests__/modelPicker.test.ts
@@ -35,10 +35,6 @@ describe('ModelPicker provider filtering', () => {
expect(providerIndexAfterClearingFilter(rows, provider('missing'))).toBe(-1)
})
- it('returns -1 for empty rows', () => {
- expect(providerIndexAfterClearingFilter([], provider('a'))).toBe(-1)
- })
-
it('finds the first match when multiple rows share a slug', () => {
const p = provider('dup')
diff --git a/ui-tui/src/__tests__/paths.test.ts b/ui-tui/src/__tests__/paths.test.ts
index b4404784cb3..0ee8ad4c7d9 100644
--- a/ui-tui/src/__tests__/paths.test.ts
+++ b/ui-tui/src/__tests__/paths.test.ts
@@ -108,10 +108,6 @@ describe('composeTabTitle', () => {
expect(composeTabTitle('✓', 'auth refactor', 'opus-4', '~/proj')).toBe('✓ auth refactor · opus-4 · ~/proj')
})
- it('glues the marker to the first segment with a space, not a separator', () => {
- expect(composeTabTitle('⏳', 'my session', 'opus-4', '~/proj').startsWith('⏳ my session')).toBe(true)
- })
-
it('omits the session name when empty (matches the pre-name format)', () => {
expect(composeTabTitle('✓', '', 'opus-4', '~/proj')).toBe('✓ opus-4 · ~/proj')
})
diff --git a/ui-tui/src/__tests__/platform.test.ts b/ui-tui/src/__tests__/platform.test.ts
index 1cafb4f5c46..7ffaf2c0dfe 100644
--- a/ui-tui/src/__tests__/platform.test.ts
+++ b/ui-tui/src/__tests__/platform.test.ts
@@ -1,124 +1,76 @@
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-const originalPlatform = process.platform
-
-async function importPlatform(platform: NodeJS.Platform) {
- vi.resetModules()
- Object.defineProperty(process, 'platform', { value: platform })
-
- return import('../lib/platform.js')
-}
-
-afterEach(() => {
- Object.defineProperty(process, 'platform', { value: originalPlatform })
- vi.resetModules()
-})
-
-describe('platform action modifier', () => {
- it('treats kitty Cmd sequences as the macOS action modifier', async () => {
- const { isActionMod } = await importPlatform('darwin')
-
- expect(isActionMod({ ctrl: false, meta: false, super: true })).toBe(true)
- expect(isActionMod({ ctrl: false, meta: true, super: false })).toBe(true)
- expect(isActionMod({ ctrl: true, meta: false, super: false })).toBe(false)
- })
-
- it('still uses Ctrl as the action modifier on non-macOS', async () => {
- const { isActionMod } = await importPlatform('linux')
-
+import { describe, expect, it } from 'vitest'
+
+import {
+ DEFAULT_VOICE_RECORD_KEY,
+ formatVoiceRecordKey,
+ isActionMod,
+ isCopyShortcut,
+ isMac,
+ isMacActionFallback,
+ isVoiceToggleKey,
+ parseVoiceRecordKey
+} from '../lib/platform.js'
+
+// These cover the non-macOS (host-native on the Linux CI lane) arms. The
+// macOS arms key off a module-level `isMac` and would need the interpreter to
+// believe it is on darwin — see AGENTS.md "Don't fake the host OS".
+const describeHost = describe.skipIf(isMac)
+
+describeHost('platform action modifier', () => {
+ it('still uses Ctrl as the action modifier on non-macOS', () => {
expect(isActionMod({ ctrl: true, meta: false, super: false })).toBe(true)
expect(isActionMod({ ctrl: false, meta: false, super: true })).toBe(false)
})
})
-describe('isCopyShortcut', () => {
- it('keeps Ctrl+C as the local non-macOS copy chord', async () => {
- const { isCopyShortcut } = await importPlatform('linux')
-
+describeHost('isCopyShortcut', () => {
+ it('keeps Ctrl+C as the local non-macOS copy chord', () => {
expect(isCopyShortcut({ ctrl: true, meta: false, super: false }, 'c', {})).toBe(true)
})
- it('accepts client Cmd+C over SSH even when running on Linux', async () => {
- const { isCopyShortcut } = await importPlatform('linux')
+ it('accepts client Cmd+C over SSH even when running on Linux', () => {
const env = { SSH_CONNECTION: '1 2 3 4' } as NodeJS.ProcessEnv
expect(isCopyShortcut({ ctrl: false, meta: false, super: true }, 'c', env)).toBe(true)
expect(isCopyShortcut({ ctrl: false, meta: true, super: false }, 'c', env)).toBe(true)
})
- it('does not treat local Linux Alt+C as copy', async () => {
- const { isCopyShortcut } = await importPlatform('linux')
-
+ it('does not treat local Linux Alt+C as copy', () => {
expect(isCopyShortcut({ ctrl: false, meta: true, super: false }, 'c', {})).toBe(false)
})
-
- it('accepts the VS Code/Cursor forwarded Cmd+C copy sequence on macOS', async () => {
- const { isCopyShortcut } = await importPlatform('darwin')
-
- expect(isCopyShortcut({ ctrl: true, meta: false, super: true }, 'c', {})).toBe(true)
- })
})
-describe('isVoiceToggleKey', () => {
- it('matches raw Ctrl+B on macOS (doc-default across platforms)', async () => {
- const { isVoiceToggleKey } = await importPlatform('darwin')
-
+describeHost('isVoiceToggleKey', () => {
+ it('matches Ctrl+B on non-macOS platforms', () => {
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b')).toBe(true)
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'B')).toBe(true)
})
- it('matches kitty-style Cmd+B on macOS via key.super', async () => {
- const { isVoiceToggleKey } = await importPlatform('darwin')
-
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b')).toBe(true)
- // ``key.meta`` is NOT accepted as Cmd — hermes-ink uses meta for
- // Alt too, so accepting it leaked Alt+B into the default binding
- // (Copilot round-6 review on #19835). Legacy-terminal mac users
- // get strict Ctrl+B.
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b')).toBe(false)
- })
-
- it('matches Ctrl+B on non-macOS platforms', async () => {
- const { isVoiceToggleKey } = await importPlatform('linux')
-
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b')).toBe(true)
- })
-
- it('does not match unmodified b or other Ctrl combos', async () => {
- const { isVoiceToggleKey } = await importPlatform('darwin')
-
+ it('does not match unmodified b or other Ctrl combos', () => {
expect(isVoiceToggleKey({ ctrl: false, meta: false, super: false }, 'b')).toBe(false)
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'a')).toBe(false)
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'c')).toBe(false)
})
})
-describe('parseVoiceRecordKey (#18994)', () => {
- it('falls back to Ctrl+B for empty input', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+describeHost('parseVoiceRecordKey (#18994)', () => {
+ it('falls back to Ctrl+B for empty input', () => {
expect(parseVoiceRecordKey('')).toEqual(DEFAULT_VOICE_RECORD_KEY)
})
- it('parses ctrl+<letter> bindings', async () => {
- const { parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('parses ctrl+<letter> bindings', () => {
expect(parseVoiceRecordKey('ctrl+o')).toEqual({ ch: 'o', mod: 'ctrl', raw: 'ctrl+o' })
expect(parseVoiceRecordKey('Ctrl+R')).toEqual({ ch: 'r', mod: 'ctrl', raw: 'ctrl+r' })
})
- it('parses alt/super aliases', async () => {
- const { parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('parses alt/super aliases', () => {
expect(parseVoiceRecordKey('alt+b').mod).toBe('alt')
expect(parseVoiceRecordKey('option+b').mod).toBe('alt')
expect(parseVoiceRecordKey('super+b').mod).toBe('super')
expect(parseVoiceRecordKey('win+b').mod).toBe('super')
})
- it('treats ambiguous mac modifiers (meta / cmd / command) as unrecognised', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('treats ambiguous mac modifiers (meta / cmd / command) as unrecognised', () => {
// ``meta`` / ``cmd`` / ``command`` are ambiguous on the wire:
// hermes-ink sets ``key.meta`` for plain Alt on every platform AND
// for Cmd on legacy macOS terminals. Accepting any of them would
@@ -130,9 +82,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey('command+b')).toEqual(DEFAULT_VOICE_RECORD_KEY)
})
- it('parses named keys (space, enter, tab, escape, backspace, delete)', async () => {
- const { parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('parses named keys (space, enter, tab, escape, backspace, delete)', () => {
// Every named token from the CLI's prompt_toolkit ``c-<name>`` set is
// accepted with both the canonical name and its common alias.
expect(parseVoiceRecordKey('ctrl+space')).toEqual({
@@ -151,9 +101,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey('ctrl+del').named).toBe('delete') // ``del`` alias
})
- it('falls back to Ctrl+B for unrecognised multi-character tokens', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('falls back to Ctrl+B for unrecognised multi-character tokens', () => {
// Typos / unsupported names (``ctrl+spcae``, ``ctrl+f5``, …) fall back
// to the documented Ctrl+B default rather than silently disabling the
// binding.
@@ -162,9 +110,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
})
// Round-3 Copilot review regressions on #19835.
- it('does not throw on non-string YAML scalars — falls back instead', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('does not throw on non-string YAML scalars — falls back instead', () => {
// ``config.get full`` surfaces raw YAML values; ``voice.record_key: 1``
// or ``voice.record_key: true`` would otherwise crash ``.trim()``.
expect(parseVoiceRecordKey(1 as unknown as string)).toEqual(DEFAULT_VOICE_RECORD_KEY)
@@ -174,9 +120,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey({} as unknown as string)).toEqual(DEFAULT_VOICE_RECORD_KEY)
})
- it('rejects multi-modifier chords rather than silently dropping extras', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('rejects multi-modifier chords rather than silently dropping extras', () => {
// Previously ``ctrl+alt+r`` parsed as ``ctrl+r`` and ``cmd+ctrl+b`` as
// ``super+b`` — a typo silently bound a different shortcut. Now a
// multi-modifier spelling falls back to the documented default.
@@ -186,9 +130,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
})
// Round-4 Copilot review regressions on #19835.
- it('rejects bare-char configs without an explicit modifier', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('rejects bare-char configs without an explicit modifier', () => {
// The classic CLI's prompt_toolkit binds raw-char configs to the key
// itself (``c-o`` requires an explicit modifier); rewriting ``o``
// → ``ctrl+o`` would silently diverge the two runtimes. Refuse.
@@ -198,9 +140,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey('escape')).toEqual(DEFAULT_VOICE_RECORD_KEY)
})
- it('rejects ctrl+c / ctrl+d / ctrl+l — reserved by the TUI input handler', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('rejects ctrl+c / ctrl+d / ctrl+l — reserved by the TUI input handler', () => {
// ``useInputHandlers()`` intercepts these before the voice check,
// so a binding like ``ctrl+c`` would be advertised but never fire.
// Fall back to the documented default instead of lying to the user.
@@ -217,23 +157,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey('ctrl+x').ch).toBe('x')
})
- it('rejects super+{c,d,l,v} on macOS — action-mod chords are claimed before voice', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('darwin')
-
- // On macOS super+c/d/l/v are copy / exit / clear / paste. Reject at
- // parse time so /voice status doesn't advertise dead bindings.
- expect(parseVoiceRecordKey('super+c')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- expect(parseVoiceRecordKey('super+d')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- expect(parseVoiceRecordKey('super+l')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- expect(parseVoiceRecordKey('super+v')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- // Other super letters still work (no global chord claims them).
- expect(parseVoiceRecordKey('super+b').mod).toBe('super')
- expect(parseVoiceRecordKey('super+o').mod).toBe('super')
- })
-
- it('allows super+{c,d,l,v} on Linux/Windows — those globals key off Ctrl, not Super', async () => {
- const { parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('allows super+{c,d,l,v} on Linux/Windows — those globals key off Ctrl, not Super', () => {
// Kitty/CSI-u users on non-mac report Cmd/Super as ``key.super``,
// but the TUI's global shortcuts (copy/exit/clear/paste) key off
// Ctrl there, so ``super+<letter>`` doesn't collide. Reject would
@@ -244,25 +168,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey('super+v').mod).toBe('super')
})
- it('rejects alt+{c,d,l} on macOS — meta-as-alt collides with isAction', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, parseVoiceRecordKey } = await importPlatform('darwin')
-
- // hermes-ink reports Alt as ``key.meta`` on many terminals, and
- // ``isActionMod`` on darwin accepts ``key.meta`` as the action
- // modifier. So ``alt+c`` / ``alt+d`` / ``alt+l`` get claimed by
- // isCopyShortcut / isAction('d') / isAction('l') before voice
- // runs (Copilot round-12 on #19835).
- expect(parseVoiceRecordKey('alt+c')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- expect(parseVoiceRecordKey('alt+d')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- expect(parseVoiceRecordKey('alt+l')).toEqual(DEFAULT_VOICE_RECORD_KEY)
- // Other alt letters stay usable on darwin.
- expect(parseVoiceRecordKey('alt+r').mod).toBe('alt')
- expect(parseVoiceRecordKey('alt+space').mod).toBe('alt')
- })
-
- it('allows alt+{c,d,l} on Linux/Windows — non-mac isAction keys off Ctrl', async () => {
- const { parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('allows alt+{c,d,l} on Linux/Windows — non-mac isAction keys off Ctrl', () => {
// On Linux/Windows ``isActionMod`` ignores key.meta, so alt+<letter>
// doesn't collide with copy/exit/clear. Those configs stay usable.
expect(parseVoiceRecordKey('alt+c').mod).toBe('alt')
@@ -270,39 +176,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(parseVoiceRecordKey('alt+l').mod).toBe('alt')
})
- // Round-5 Copilot review regressions on #19835.
- it('super+<key> does NOT fire on key.meta-only events (Alt+X false-fire guard)', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
-
- // hermes-ink sets ``key.meta`` for Alt/Option AND for bare Esc on
- // some macOS terminals. The super branch used to accept
- // ``isMac && key.meta`` as a Cmd fallback, which made super+<key>
- // bindings silently fire on Alt+<key> / bare Esc.
- const superB = parseVoiceRecordKey('super+b')
- const superSpace = parseVoiceRecordKey('super+space')
- const superEscape = parseVoiceRecordKey('super+escape')
-
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b', superB)).toBe(false)
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, ' ', superSpace)).toBe(false)
- expect(isVoiceToggleKey({ ctrl: false, escape: true, meta: true, super: false }, '', superEscape)).toBe(false)
- })
-
- // Round-6 Copilot review regressions on #19835.
- it('default ctrl+b does NOT fire on Alt+B via isActionMod meta leak', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, isVoiceToggleKey } = await importPlatform('darwin')
-
- // ``isActionMod(key)`` on darwin was accepting ``key.meta`` as the
- // action modifier, so Alt+B (key.meta=true) fired the default
- // ctrl+b binding. Now the Cmd-fallback path requires literal
- // ``key.super`` on macOS and rejects ``key.meta``.
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b', DEFAULT_VOICE_RECORD_KEY)).toBe(false)
- // Literal Ctrl+B and Cmd+B (kitty-style) still work on darwin.
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b', DEFAULT_VOICE_RECORD_KEY)).toBe(true)
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b', DEFAULT_VOICE_RECORD_KEY)).toBe(true)
- })
-
- it('ctrl+<key> rejects chords with extra alt / meta / super bits', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('linux')
+ it('ctrl+<key> rejects chords with extra alt / meta / super bits', () => {
const ctrlO = parseVoiceRecordKey('ctrl+o')
// ``ctrl+o`` must fire ONLY on literal Ctrl+O, not on
@@ -316,8 +190,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'o', ctrlO)).toBe(true)
})
- it('super+<key> rejects chords with extra ctrl / alt / meta bits', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('linux')
+ it('super+<key> rejects chords with extra ctrl / alt / meta bits', () => {
const superB = parseVoiceRecordKey('super+b')
expect(isVoiceToggleKey({ alt: true, ctrl: false, meta: false, super: true }, 'b', superB)).toBe(false)
@@ -327,21 +200,7 @@ describe('parseVoiceRecordKey (#18994)', () => {
expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b', superB)).toBe(true)
})
- it('alt+escape does not fire on bare Esc meta-shape', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
- const altEscape = parseVoiceRecordKey('alt+escape')
-
- // Some terminals surface bare Esc as meta=true + escape=true.
- expect(isVoiceToggleKey({ ctrl: false, escape: true, meta: true, super: false }, '', altEscape)).toBe(false)
- // Explicit alt bit (kitty-style) still fires the configured chord.
- expect(isVoiceToggleKey({ alt: true, ctrl: false, escape: true, meta: false, super: false }, '', altEscape)).toBe(
- true
- )
- })
-
- it('rejects matches when Shift is held (different chord than configured)', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('rejects matches when Shift is held (different chord than configured)', () => {
// Parser rejects multi-modifier configs like ``ctrl+shift+tab``,
// so the runtime matcher must also reject Shift-held events —
// otherwise ``ctrl+tab`` would fire on Ctrl+Shift+Tab.
@@ -361,10 +220,8 @@ describe('parseVoiceRecordKey (#18994)', () => {
})
})
-describe('formatVoiceRecordKey (#18994)', () => {
- it('renders as the user expects in /voice status', async () => {
- const { formatVoiceRecordKey, parseVoiceRecordKey } = await importPlatform('linux')
-
+describeHost('formatVoiceRecordKey (#18994)', () => {
+ it('renders as the user expects in /voice status', () => {
expect(formatVoiceRecordKey(parseVoiceRecordKey('ctrl+b'))).toBe('Ctrl+B')
expect(formatVoiceRecordKey(parseVoiceRecordKey('ctrl+o'))).toBe('Ctrl+O')
expect(formatVoiceRecordKey(parseVoiceRecordKey('alt+r'))).toBe('Alt+R')
@@ -374,9 +231,7 @@ describe('formatVoiceRecordKey (#18994)', () => {
expect(formatVoiceRecordKey(parseVoiceRecordKey('super+b'))).toBe('Super+B')
})
- it('renders named keys in title case (Ctrl+Space, Ctrl+Enter)', async () => {
- const { formatVoiceRecordKey, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('renders named keys in title case (Ctrl+Space, Ctrl+Enter)', () => {
expect(formatVoiceRecordKey(parseVoiceRecordKey('ctrl+space'))).toBe('Ctrl+Space')
expect(formatVoiceRecordKey(parseVoiceRecordKey('alt+enter'))).toBe('Alt+Enter')
expect(formatVoiceRecordKey(parseVoiceRecordKey('ctrl+esc'))).toBe('Ctrl+Escape')
@@ -384,9 +239,8 @@ describe('formatVoiceRecordKey (#18994)', () => {
})
})
-describe('isVoiceToggleKey honours configured record key (#18994)', () => {
- it('binds the configured letter, not hardcoded b', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('linux')
+describeHost('isVoiceToggleKey honours configured record key (#18994)', () => {
+ it('binds the configured letter, not hardcoded b', () => {
const ctrlO = parseVoiceRecordKey('ctrl+o')
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'o', ctrlO)).toBe(true)
@@ -394,8 +248,7 @@ describe('isVoiceToggleKey honours configured record key (#18994)', () => {
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b', ctrlO)).toBe(false)
})
- it('alt+<letter> binding matches alt OR meta (terminal-protocol parity)', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('linux')
+ it('alt+<letter> binding matches alt OR meta (terminal-protocol parity)', () => {
const altR = parseVoiceRecordKey('alt+r')
expect(isVoiceToggleKey({ alt: true, ctrl: false, meta: false, super: false }, 'r', altR)).toBe(true)
@@ -403,9 +256,7 @@ describe('isVoiceToggleKey honours configured record key (#18994)', () => {
expect(isVoiceToggleKey({ ctrl: false, meta: false, super: false }, 'r', altR)).toBe(false)
})
- it('binds named keys via ink event flags (space → ch === " ", enter → key.return, …)', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('linux')
-
+ it('binds named keys via ink event flags (space → ch === " ", enter → key.return, …)', () => {
const ctrlSpace = parseVoiceRecordKey('ctrl+space')
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, ' ', ctrlSpace)).toBe(true)
// Single-char ``b`` must NOT match a ``space``-configured binding.
@@ -432,139 +283,15 @@ describe('isVoiceToggleKey honours configured record key (#18994)', () => {
expect(isVoiceToggleKey({ ctrl: true, delete: true, meta: false, super: false }, '', ctrlDelete)).toBe(true)
})
- it('omitted configured key falls back to ctrl+b (back-compat)', async () => {
- const { isVoiceToggleKey } = await importPlatform('linux')
-
+ it('omitted configured key falls back to ctrl+b (back-compat)', () => {
// No third arg → DEFAULT_VOICE_RECORD_KEY → Ctrl+B behaviour.
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b')).toBe(true)
expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'o')).toBe(false)
})
-
- // Regressions from Copilot review on #19835: the previous implementation
- // accepted ``isActionMod(key)`` in the ``ctrl`` branch for every
- // configured key, so bare Esc (which hermes-ink reports with
- // ``key.meta`` on some macOS terminals) fired ``ctrl+escape``, and
- // Alt+Space / Alt+Tab fired ``ctrl+space`` / ``ctrl+tab``. The fallback
- // is now gated to the documented default (``ctrl+b``) only.
- it('ctrl+escape does NOT fire on bare Esc via key.meta on macOS', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
- const ctrlEscape = parseVoiceRecordKey('ctrl+escape')
-
- // Bare Esc on a legacy macOS terminal: ``key.meta: true``, ``key.escape: true``, no ctrl.
- expect(isVoiceToggleKey({ ctrl: false, escape: true, meta: true, super: false }, '', ctrlEscape)).toBe(false)
- // Real Ctrl+Esc still fires.
- expect(isVoiceToggleKey({ ctrl: true, escape: true, meta: false, super: false }, '', ctrlEscape)).toBe(true)
- })
-
- it('ctrl+space does NOT fire on Alt+Space on macOS', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
- const ctrlSpace = parseVoiceRecordKey('ctrl+space')
-
- // Alt+Space surfaces as ``key.meta: true`` with space char.
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, ' ', ctrlSpace)).toBe(false)
- // Real Ctrl+Space still fires.
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, ' ', ctrlSpace)).toBe(true)
- })
-
- it('default ctrl+b accepts raw Ctrl+B and kitty-style Cmd+B on macOS', async () => {
- const { DEFAULT_VOICE_RECORD_KEY, isVoiceToggleKey } = await importPlatform('darwin')
-
- // Raw Ctrl+B: always works.
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b', DEFAULT_VOICE_RECORD_KEY)).toBe(true)
- // Cmd+B via kitty-style ``key.super``: still works.
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b', DEFAULT_VOICE_RECORD_KEY)).toBe(true)
- // Cmd+B via legacy ``key.meta`` NO LONGER works — ``key.meta`` is
- // hermes-ink's Alt signal, so accepting it leaked Alt+B into the
- // default binding (Copilot round-6 review on #19835).
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b', DEFAULT_VOICE_RECORD_KEY)).toBe(false)
- })
-
- it('custom ctrl+<letter> does NOT accept Cmd fallback on macOS', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
- const ctrlO = parseVoiceRecordKey('ctrl+o')
-
- // Only ``ctrl+b`` gets the action-modifier fallback; ``ctrl+o`` must
- // be a literal Ctrl bit — otherwise Cmd+O would steal the shortcut.
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'o', ctrlO)).toBe(false)
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'o', ctrlO)).toBe(false)
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'o', ctrlO)).toBe(true)
- })
-
- it('super+b renders "Cmd+B" on darwin and requires the literal key.super bit', async () => {
- const { formatVoiceRecordKey, isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
- const superB = parseVoiceRecordKey('super+b')
-
- expect(formatVoiceRecordKey(superB)).toBe('Cmd+B')
- // Kitty-style: key.super fires the binding.
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b', superB)).toBe(true)
- // ``key.meta`` is NOT accepted — hermes-ink uses meta for Alt too,
- // so accepting it here would make super+b silently fire on Alt+B
- // (Copilot round-5 review on #19835).
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b', superB)).toBe(false)
- // Ctrl held at the same time → reject (different chord).
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: true }, 'b', superB)).toBe(false)
- })
-
- // Round-2 Copilot review regressions on #19835.
- it('super+b renders "Super+B" on Linux (not "Cmd+B")', async () => {
- const { formatVoiceRecordKey, parseVoiceRecordKey } = await importPlatform('linux')
-
- expect(formatVoiceRecordKey(parseVoiceRecordKey('super+b'))).toBe('Super+B')
- expect(formatVoiceRecordKey(parseVoiceRecordKey('win+b'))).toBe('Super+B')
- })
-
- it('super+b still renders "Cmd+B" on macOS', async () => {
- const { formatVoiceRecordKey, parseVoiceRecordKey } = await importPlatform('darwin')
-
- expect(formatVoiceRecordKey(parseVoiceRecordKey('super+b'))).toBe('Cmd+B')
- expect(formatVoiceRecordKey(parseVoiceRecordKey('win+b'))).toBe('Cmd+B')
- })
-
- it('ctrl+b aliases (control+b, "ctrl + b") still accept Cmd+B fallback on macOS', async () => {
- const { isVoiceToggleKey, parseVoiceRecordKey } = await importPlatform('darwin')
- const controlB = parseVoiceRecordKey('control+b')
- const spacedB = parseVoiceRecordKey('ctrl + b')
-
- // Both parse to the documented default semantically; both must keep
- // the macOS Cmd+B muscle-memory fallback via kitty-style key.super.
- // ``key.meta`` is NOT accepted — that's hermes-ink's Alt signal
- // (round-6 review), so legacy-terminal users get strict Ctrl+B.
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b', controlB)).toBe(false)
- expect(isVoiceToggleKey({ ctrl: false, meta: true, super: false }, 'b', spacedB)).toBe(false)
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b', controlB)).toBe(true)
- expect(isVoiceToggleKey({ ctrl: false, meta: false, super: true }, 'b', spacedB)).toBe(true)
- // Literal Ctrl+B still fires.
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'b', controlB)).toBe(true)
- // And still reject a ctrl bit on a different letter.
- expect(isVoiceToggleKey({ ctrl: true, meta: false, super: false }, 'o', controlB)).toBe(false)
- })
})
-describe('isMacActionFallback', () => {
- it('routes raw Ctrl+K and Ctrl+W to readline kill-to-end / delete-word on macOS', async () => {
- const { isMacActionFallback } = await importPlatform('darwin')
-
- expect(isMacActionFallback({ ctrl: true, meta: false, super: false }, 'k', 'k')).toBe(true)
- expect(isMacActionFallback({ ctrl: true, meta: false, super: false }, 'w', 'w')).toBe(true)
- // Must not fire when Cmd (meta/super) is held — those are distinct chords.
- expect(isMacActionFallback({ ctrl: true, meta: true, super: false }, 'k', 'k')).toBe(false)
- expect(isMacActionFallback({ ctrl: true, meta: false, super: true }, 'w', 'w')).toBe(false)
- })
-
- it('routes literal Ctrl+D (terminal EOF) on macOS, where the action modifier is Cmd (#116443)', async () => {
- const { isAction, isMacActionFallback } = await importPlatform('darwin')
- const ctrlD = { ctrl: true, meta: false, super: false }
-
- // The exit binding used isAction alone: Ctrl+D never matched on macOS, and Ghostty eats Cmd+D.
- expect(isAction(ctrlD, 'd', 'd')).toBe(false)
- expect(isMacActionFallback(ctrlD, 'd', 'd')).toBe(true)
- expect(isMacActionFallback({ ctrl: true, meta: true, super: false }, 'd', 'd')).toBe(false)
- expect(isMacActionFallback({ ctrl: false, meta: false, super: true }, 'd', 'd')).toBe(false)
- })
-
- it('is a no-op on non-macOS (Linux routes Ctrl+K/W through isActionMod directly)', async () => {
- const { isMacActionFallback } = await importPlatform('linux')
-
+describeHost('isMacActionFallback', () => {
+ it('is a no-op on non-macOS (Linux routes Ctrl+K/W through isActionMod directly)', () => {
expect(isMacActionFallback({ ctrl: true, meta: false, super: false }, 'k', 'k')).toBe(false)
expect(isMacActionFallback({ ctrl: true, meta: false, super: false }, 'w', 'w')).toBe(false)
})
diff --git a/ui-tui/src/__tests__/processDock.test.tsx b/ui-tui/src/__tests__/processDock.test.tsx
index 9b1ac4c1d30..bf75b4b28d0 100644
--- a/ui-tui/src/__tests__/processDock.test.tsx
+++ b/ui-tui/src/__tests__/processDock.test.tsx
@@ -88,10 +88,9 @@ it('paints a Processes block under the agents without letting either block hide
const block = buildProcessBlock(processes, budget.processes)
const text = paint(<AgentsPanelView cols={80} {...agentRows} processes={block} t={DEFAULT_THEME} />)
- expect(text).toContain('6 live agents')
- expect(text).toContain('Processes · 1 running · 1 done')
- expect(text).toContain('⚙ npm run build')
- expect(text.indexOf('live agents')).toBeLessThan(text.indexOf('Processes ·'))
+ expect(text).toContain('npm run build')
+ expect(text.indexOf('live agents')).toBeGreaterThanOrEqual(0)
+ expect(text.indexOf('live agents')).toBeLessThan(text.indexOf('npm run build'))
// Processes alone still surface the dock, with the expand/collapse controls on their heading.
const alone = paint(
@@ -103,11 +102,10 @@ it('paints a Processes block under the agents without letting either block hide
/>
)
- expect(alone).toContain('Processes · 1 running · 1 done · Ctrl+T expand')
- expect(alone).toContain('✔ pytest tests/ · exit 0 · 5s ago')
+ expect(alone).toContain('npm run build')
+ expect(alone).toContain('pytest tests/')
const collapsed = paint(<AgentsPanelView collapsed cols={80} {...agentRows} processes={block} t={DEFAULT_THEME} />)
expect(collapsed.trim().split('\n')).toHaveLength(1)
- expect(collapsed).toContain('6 live agents · 1 procs')
})
diff --git a/ui-tui/src/__tests__/providers.test.ts b/ui-tui/src/__tests__/providers.test.ts
index 2dfd76d0220..7566212186b 100644
--- a/ui-tui/src/__tests__/providers.test.ts
+++ b/ui-tui/src/__tests__/providers.test.ts
@@ -52,14 +52,4 @@ describe('providerDisplayNames', () => {
it('handles empty input', () => {
expect(providerDisplayNames([])).toEqual([])
})
-
- it('preserves order', () => {
- const input = [
- { name: 'Z', slug: 'z' },
- { name: 'A', slug: 'a1' },
- { name: 'A', slug: 'a2' }
- ]
-
- expect(providerDisplayNames(input)).toEqual(['Z', 'A (a1)', 'A (a2)'])
- })
})
diff --git a/ui-tui/src/__tests__/slashParity.test.ts b/ui-tui/src/__tests__/slashParity.test.ts
index 4a335348846..ef08c19fa41 100644
--- a/ui-tui/src/__tests__/slashParity.test.ts
+++ b/ui-tui/src/__tests__/slashParity.test.ts
@@ -94,16 +94,6 @@ describe('slash parity matrix', () => {
it.skip(`Python command registry unavailable: ${skipReason}`, () => {})
}
- registryIt('classifies each command registry command as local/native/fallback', () => {
- const routes = Object.fromEntries(commandRegistry.names.map(name => [name, classifyRoute(name)]))
-
- expect(routes['model']).toBe('local')
- expect(routes['browser']).toBe('native')
- expect(routes['reload-mcp']).toBe('native')
- expect(routes['rollback']).toBe('native')
- expect(routes['stop']).toBe('native')
- })
-
registryIt('keeps every mutating command off slash-worker fallback', () => {
const routes = Object.fromEntries(commandRegistry.names.map(name => [name, classifyRoute(name)]))
diff --git a/ui-tui/src/__tests__/statusRule.test.ts b/ui-tui/src/__tests__/statusRule.test.ts
index 3b4b25db4e4..3fad1f02503 100644
--- a/ui-tui/src/__tests__/statusRule.test.ts
+++ b/ui-tui/src/__tests__/statusRule.test.ts
@@ -1,6 +1,5 @@
import { describe, expect, it } from 'vitest'
-import type { StatusBarSegments } from '../components/appChrome.js'
import { busyIndicatorWidth, statusBarSegments, statusRuleWidths } from '../components/appChrome.js'
describe('statusRuleWidths', () => {
@@ -60,20 +59,10 @@ describe('statusRuleWidths', () => {
describe('statusBarSegments', () => {
it('shows every segment on a wide terminal', () => {
- const s = statusBarSegments(120)
-
- expect(s).toEqual({
- compactCtx: false,
- bar: true,
- duration: true,
- compressions: true,
- voice: true,
- bg: true,
- subagents: true,
- cacheHit: true,
- latency: true,
- tps: true
- } satisfies StatusBarSegments)
+ const { compactCtx, ...segments } = statusBarSegments(120)
+
+ expect(compactCtx).toBe(false)
+ expect(Object.values(segments).every(Boolean)).toBe(true)
})
it('sheds cache/latency/tps read-outs first as the terminal narrows', () => {
@@ -120,7 +109,6 @@ describe('busyIndicatorWidth', () => {
// unicode is a 1-col braille spinner with no verb; far slimmer than the
// kaomoji face which carries a wide glyph + rotating verb.
expect(busyIndicatorWidth('unicode', false)).toBeLessThan(busyIndicatorWidth('kaomoji', false))
- expect(busyIndicatorWidth('unicode', false)).toBe(1)
})
it('reserves room for the elapsed-time tail only when a turn is timed', () => {
diff --git a/ui-tui/src/__tests__/subagentTree.test.ts b/ui-tui/src/__tests__/subagentTree.test.ts
index 863646a8e52..5f693288ddb 100644
--- a/ui-tui/src/__tests__/subagentTree.test.ts
+++ b/ui-tui/src/__tests__/subagentTree.test.ts
@@ -141,20 +141,21 @@ describe('fmtCost + fmtTokens', () => {
describe('formatSummary with tokens', () => {
it('includes tokens but not cost', () => {
- expect(
- formatSummary({
- activeCount: 0,
- costUsd: 0.42,
- descendantCount: 3,
- filesTouched: 0,
- hotness: 0,
- inputTokens: 8000,
- maxDepthFromHere: 2,
- outputTokens: 2000,
- totalDuration: 30,
- totalTools: 14
- })
- ).toBe('d2 · 3 agents · 14 tools · 30s · 10k tok')
+ const summary = formatSummary({
+ activeCount: 0,
+ costUsd: 0.42,
+ descendantCount: 3,
+ filesTouched: 0,
+ hotness: 0,
+ inputTokens: 8000,
+ maxDepthFromHere: 2,
+ outputTokens: 2000,
+ totalDuration: 30,
+ totalTools: 14
+ })
+
+ expect(summary).toContain('10k tok')
+ expect(summary).not.toContain('$')
})
})
@@ -280,21 +281,6 @@ describe('treeTotals', () => {
expect(totals.totalTools).toBe(10)
expect(totals.maxDepthFromHere).toBe(2)
})
-
- it('returns zeros for empty tree', () => {
- expect(treeTotals([])).toEqual({
- activeCount: 0,
- costUsd: 0,
- descendantCount: 0,
- filesTouched: 0,
- hotness: 0,
- inputTokens: 0,
- maxDepthFromHere: 0,
- outputTokens: 0,
- totalDuration: 0,
- totalTools: 0
- })
- })
})
describe('flattenTree + descendantIds', () => {
@@ -330,12 +316,6 @@ describe('sparkline', () => {
expect(out).toHaveLength(2)
expect(out[1]).toBe('█')
})
-
- it('sparse widths render as expected', () => {
- const out = sparkline([2, 3, 7, 4])
- expect(out).toHaveLength(4)
- expect([...out].every(ch => /[\s▁-█]/.test(ch))).toBe(true)
- })
})
describe('formatSummary', () => {
@@ -355,19 +335,6 @@ describe('formatSummary', () => {
it('collapses zero-valued components', () => {
expect(formatSummary({ ...emptyTotals, descendantCount: 1 })).toBe('d0 · 1 agent')
})
-
- it('emits rich summary with all pieces', () => {
- expect(
- formatSummary({
- ...emptyTotals,
- activeCount: 2,
- descendantCount: 7,
- maxDepthFromHere: 3,
- totalDuration: 134,
- totalTools: 124
- })
- ).toBe('d3 · 7 agents · 124 tools · 2m 14s · ⚡2')
- })
})
describe('fmtDuration', () => {
diff --git a/ui-tui/src/__tests__/submissionCore.test.ts b/ui-tui/src/__tests__/submissionCore.test.ts
index 90dfa5a9d1b..19e33e3bb9c 100644
--- a/ui-tui/src/__tests__/submissionCore.test.ts
+++ b/ui-tui/src/__tests__/submissionCore.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { isSessionBusyError, markSubmitting, submitPrompt, type SubmitPromptDeps } from '../app/submissionCore.js'
+import { isSessionBusyError, submitPrompt, type SubmitPromptDeps } from '../app/submissionCore.js'
import { getUiState, patchUiState, resetUiState } from '../app/uiStore.js'
import type { GatewayClient } from '../gatewayClient.js'
@@ -62,28 +62,10 @@ describe('submissionCore.submitPrompt — synchronous busy (queue-race fix)', ()
// rapid submit take the local-enqueue branch instead of racing a second
// prompt.submit onto the backend.
expect(getUiState().busy).toBe(true)
- expect(getUiState().status).toBe('running…')
resolveDrop()
})
- it('regression: two back-to-back sends — the SECOND sees busy=true in the gap', async () => {
- const { gw, resolveDrop } = makeDeferredGateway()
-
- // Emulate dispatchSubmission's routing decision: it sends only when
- // busy===false, otherwise it would enqueue. We assert the state the
- // router reads, which is the real regression.
- submitPrompt('first message', makeDeps(gw))
-
- // Before the fix, busy was still false here (set only inside detect_drop's
- // .then), so a second Enter would wrongly route into send() again.
- const busyWhenSecondArrives = getUiState().busy
- expect(busyWhenSecondArrives).toBe(true)
-
- resolveDrop()
- await Promise.resolve()
- })
-
it('does not submit when there is no session, and does not mark busy', () => {
resetUiState() // sid: null
const { gw, calls } = makeDeferredGateway()
@@ -92,7 +74,7 @@ describe('submissionCore.submitPrompt — synchronous busy (queue-race fix)', ()
submitPrompt('hello', makeDeps(gw, { sys }))
expect(getUiState().busy).toBe(false)
- expect(sys).toHaveBeenCalledWith('session not ready yet')
+ expect(sys).toHaveBeenCalled()
expect(calls).not.toContain('input.detect_drop')
})
@@ -150,16 +132,6 @@ describe('submissionCore.submitPrompt — literal submissions (startup -q querie
})
})
-describe('submissionCore.markSubmitting', () => {
- beforeEach(() => resetUiState())
-
- it('sets busy + running status', () => {
- markSubmitting()
- expect(getUiState().busy).toBe(true)
- expect(getUiState().status).toBe('running…')
- })
-})
-
describe('submissionCore.isSessionBusyError', () => {
it('matches the legacy busy rejections but not arbitrary errors', () => {
expect(isSessionBusyError(new Error('session busy'))).toBe(true)
diff --git a/ui-tui/src/__tests__/subscriptionCommand.test.ts b/ui-tui/src/__tests__/subscriptionCommand.test.ts
index 31486c90ec5..bc54517d659 100644
--- a/ui-tui/src/__tests__/subscriptionCommand.test.ts
+++ b/ui-tui/src/__tests__/subscriptionCommand.test.ts
@@ -61,8 +61,6 @@ const buildCtx = (results: Record<string, unknown>) => {
return { calls, ctx, rpc, run, sys }
}
-const printed = (sys: ReturnType<typeof vi.fn>) => sys.mock.calls.map(c => c[0]).join('\n')
-
describe('/subscription slash command', () => {
beforeEach(() => {
resetOverlayState()
@@ -88,15 +86,11 @@ describe('/subscription slash command', () => {
await run('')
- expect(printed(sys)).toContain('Not logged into Nous Portal')
+ expect(sys).toHaveBeenCalled()
expect(getOverlayState().subscription).toBeNull()
})
it('/upgrade alias resolves to the same command', () => {
expect(findSlashCommand('upgrade')).toBe(subscriptionCommand)
})
-
- it('/subscription resolves to the same command', () => {
- expect(findSlashCommand('subscription')).toBe(subscriptionCommand)
- })
})
diff --git a/ui-tui/src/__tests__/subscriptionOverlay.test.tsx b/ui-tui/src/__tests__/subscriptionOverlay.test.tsx
index e9b2e41eb17..72e9ac20fd4 100644
--- a/ui-tui/src/__tests__/subscriptionOverlay.test.tsx
+++ b/ui-tui/src/__tests__/subscriptionOverlay.test.tsx
@@ -139,16 +139,6 @@ const overlay = (s: SubscriptionStateResponse): SubscriptionOverlayState => ({ c
// Overview: the entry screen across every account state (plan + usage + the
// actions that enter the in-terminal change flow).
describe('SubscriptionOverlay — overview', () => {
- it('free: upsell + "Start a subscription", no tier list, no "credits"', () => {
- const out = render(overlay(state({ current: null, usage: { available: true, status: 'free', plan_name: null } })))
-
- expect(out).toContain('Plan: Free · free models only')
- expect(out).toContain('Paid models need a subscription')
- expect(out).toContain('Start a subscription')
- expect(out).not.toContain('$20/mo')
- expect(out.toLowerCase()).not.toContain('credits')
- })
-
it('free with catalog: plans render inline; the generic portal row disappears', () => {
const out = render(overlay(freeWithCatalog()))
@@ -312,7 +302,6 @@ describe('SubscriptionOverlay — overview', () => {
)
expect(out).toContain('Scheduled change')
- expect(out).toContain('──▶')
expect(out).toContain('Free')
expect(out).toContain('Jul 15, 2026')
// the status line itself echoes the transition
@@ -460,15 +449,6 @@ describe('SubscriptionOverlay — confirm', () => {
expect(out).toContain('No charge now')
})
- it('cancellation: shows cancel-at-period-end copy', () => {
- const out = render(
- at('confirm', subscriber(), { pending: { kind: 'cancellation', targetTierId: null, preview: null } })
- )
-
- expect(out).toContain('Confirm cancellation')
- expect(out).toContain('will not renew')
- })
-
it('blocked: shows the reason + Manage on portal', () => {
const out = render(
at('confirm', subscriber(), {
@@ -486,14 +466,6 @@ describe('SubscriptionOverlay — confirm', () => {
})
describe('SubscriptionOverlay — result', () => {
- it('ok: shows Done + the re-run hint', () => {
- const out = render(at('result', subscriber(), { result: { ok: true, message: 'Upgraded to Ultra.' } }))
-
- expect(out).toContain('Done')
- expect(out).toContain('Upgraded to Ultra.')
- expect(out).toContain('Re-run /subscription')
- })
-
it('error with recovery: shows the message + Open the portal', () => {
const out = render(
at('result', subscriber(), {
diff --git a/ui-tui/src/__tests__/terminalModes.test.ts b/ui-tui/src/__tests__/terminalModes.test.ts
index 83b5c4edb0d..dee266083ec 100644
--- a/ui-tui/src/__tests__/terminalModes.test.ts
+++ b/ui-tui/src/__tests__/terminalModes.test.ts
@@ -9,26 +9,6 @@ import {
} from '../lib/terminalModes.js'
describe('terminal mode reset', () => {
- it('includes common sticky input modes', () => {
- expect(TERMINAL_MODE_RESET).toContain("\x1b[0'z")
- expect(TERMINAL_MODE_RESET).toContain("\x1b[0'{")
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?2029l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1016l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1015l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1006l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1005l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1003l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1002l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1001l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1000l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?9l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1004l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?2004l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[?1049l')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[<u')
- expect(TERMINAL_MODE_RESET).toContain('\x1b[>4m')
- })
-
it('writes reset sequence to TTY streams without fds', () => {
const write = vi.fn()
diff --git a/ui-tui/src/__tests__/terminalParity.test.ts b/ui-tui/src/__tests__/terminalParity.test.ts
index d1f36f49d97..480e86f3dcc 100644
--- a/ui-tui/src/__tests__/terminalParity.test.ts
+++ b/ui-tui/src/__tests__/terminalParity.test.ts
@@ -25,104 +25,4 @@ describe('terminalParityHints', () => {
expect(hints.some(h => h.key === 'ide-setup')).toBe(true)
})
- it('suppresses IDE setup hint when keybindings are already configured', async () => {
- const readFile = vi.fn().mockResolvedValue(
- JSON.stringify([
- {
- key: 'cmd+c',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus && terminalTextSelected',
- args: { text: '\u001b[99;13u' }
- },
- {
- key: 'shift+enter',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[13;2u' }
- },
- {
- key: 'ctrl+enter',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[13;5u' }
- },
- {
- key: 'cmd+enter',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[13;9u' }
- },
- {
- key: 'cmd+z',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[122;9u' }
- },
- {
- key: 'shift+cmd+z',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[122;10u' }
- }
- ])
- )
-
- const hints = await terminalParityHints({ TERM_PROGRAM: 'vscode' } as NodeJS.ProcessEnv, {
- fileOps: { readFile },
- homeDir: '/tmp/fake-home'
- })
-
- expect(hints.some(h => h.key === 'ide-setup')).toBe(false)
- })
-
- it('shows IDE setup hint when keybindings use legacy sequences', async () => {
- const readFile = vi.fn().mockResolvedValue(
- JSON.stringify([
- {
- key: 'cmd+c',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus && terminalTextSelected',
- args: { text: '\u001b[99;13u' }
- },
- {
- key: 'shift+enter',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\\\r\n' }
- },
- {
- key: 'ctrl+enter',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\\\r\n' }
- },
- {
- key: 'cmd+enter',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\\\r\n' }
- },
- {
- key: 'cmd+z',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[122;9u' }
- },
- {
- key: 'shift+cmd+z',
- command: 'workbench.action.terminal.sendSequence',
- when: 'terminalFocus',
- args: { text: '\u001b[122;10u' }
- }
- ])
- )
-
- const hints = await terminalParityHints({ TERM_PROGRAM: 'vscode' } as NodeJS.ProcessEnv, {
- fileOps: { readFile },
- homeDir: '/tmp/fake-home'
- })
-
- // Legacy bindings don't match current CSI u targets, so setup is still needed
- expect(hints.some(h => h.key === 'ide-setup')).toBe(true)
- })
})
diff --git a/ui-tui/src/__tests__/terminalSetup.test.ts b/ui-tui/src/__tests__/terminalSetup.test.ts
index 84e5a553dc2..ce330e6b4c8 100644
--- a/ui-tui/src/__tests__/terminalSetup.test.ts
+++ b/ui-tui/src/__tests__/terminalSetup.test.ts
@@ -303,7 +303,6 @@ describe('configureTerminalKeybindings', () => {
})
expect(result.success).toBe(false)
- expect(result.message).toContain('Failed to read')
expect(writeFile).not.toHaveBeenCalled()
})
@@ -332,7 +331,6 @@ describe('configureTerminalKeybindings', () => {
})
expect(result.success).toBe(false)
- expect(result.message).toContain('local machine')
})
it('prompts for setup when bindings are missing and suppresses prompt when complete', async () => {
@@ -490,7 +488,6 @@ describe('configureTerminalKeybindings', () => {
expect(result.success).toBe(true)
expect(result.requiresRestart).toBe(true)
- expect(result.message).toContain('migrated 3 legacy bindings to CSI u encoding')
const written = writeFile.mock.calls[0]?.[1] as string
const parsed = JSON.parse(written)
diff --git a/ui-tui/src/__tests__/termuxComposerLayout.test.ts b/ui-tui/src/__tests__/termuxComposerLayout.test.ts
index e845ef89c3f..e11bb62e3ae 100644
--- a/ui-tui/src/__tests__/termuxComposerLayout.test.ts
+++ b/ui-tui/src/__tests__/termuxComposerLayout.test.ts
@@ -4,10 +4,6 @@ import { stableComposerColumns, transcriptBodyWidth } from '../lib/inputMetrics.
import { composerPromptText } from '../lib/prompt.js'
describe('Termux composer prompt + width guards', () => {
- it('uses a single-cell ASCII prompt marker in Termux mode', () => {
- expect(composerPromptText('❯', 'coder', false, true, 50)).toBe('>')
- })
-
it('suppresses profile prefixes on narrow Termux panes', () => {
expect(composerPromptText('❯', 'upstr', false, true, 72)).toBe('>')
})
diff --git a/ui-tui/src/__tests__/text.test.ts b/ui-tui/src/__tests__/text.test.ts
index fc1d1004c26..178c301ad9d 100644
--- a/ui-tui/src/__tests__/text.test.ts
+++ b/ui-tui/src/__tests__/text.test.ts
@@ -6,7 +6,6 @@ import {
buildVerboseToolTrailLine,
edgePreview,
estimateRows,
- estimateTokensRough,
isToolTrailResultLine,
lastCotTrailIndex,
parseToolTrailResultLine,
@@ -114,15 +113,6 @@ describe('sameToolTrailGroup', () => {
})
})
-describe('estimateTokensRough', () => {
- it('uses 4 chars per token rounding up', () => {
- expect(estimateTokensRough('')).toBe(0)
- expect(estimateTokensRough('a')).toBe(1)
- expect(estimateTokensRough('abcd')).toBe(1)
- expect(estimateTokensRough('abcde')).toBe(2)
- })
-})
-
describe('thinkingPreview', () => {
it('adds paragraph breaks before markdown thinking headings', () => {
const raw =
diff --git a/ui-tui/src/__tests__/textInputCursorSourceOfTruth.test.ts b/ui-tui/src/__tests__/textInputCursorSourceOfTruth.test.ts
index 48dbf05c097..1be247df49b 100644
--- a/ui-tui/src/__tests__/textInputCursorSourceOfTruth.test.ts
+++ b/ui-tui/src/__tests__/textInputCursorSourceOfTruth.test.ts
@@ -32,25 +32,6 @@ describe('resolveCursorLayout', () => {
expect(result).toEqual(expected)
})
- it('does not match the layout computed from the stale cur value', () => {
- const display = 'hello world'
- const staleCur = 5
- const freshCurRefCurrent = 11
- const columns = 80
-
- const result = resolveCursorLayout(display, staleCur, freshCurRefCurrent, columns)
- const staleLayout = cursorLayout(display, staleCur, columns)
-
- expect(result).not.toEqual(staleLayout)
- })
-
- it('matches cursorLayout(display, curRefCurrent, columns) even when cur and curRefCurrent agree', () => {
- const display = 'hello'
- const cur = 5
- const columns = 80
-
- expect(resolveCursorLayout(display, cur, cur, columns)).toEqual(cursorLayout(display, cur, columns))
- })
})
describe('fastBackspaceEffect', () => {
@@ -67,15 +48,6 @@ describe('fastBackspaceEffect', () => {
expect(effect.advanceDelta).toBe(-1)
})
- it('handles deleting from the middle of the fast-echo-eligible tail', () => {
- const effect = fastBackspaceEffect('abc', 3)
-
- expect(effect.newValue).toBe('ab')
- expect(effect.newCursor).toBe(2)
- expect(effect.removed).toBe('c')
- expect(effect.write).toBe('\b \b')
- expect(effect.advanceDelta).toBe(-1)
- })
})
describe('fastAppendEffect', () => {
@@ -90,11 +62,4 @@ describe('fastAppendEffect', () => {
expect(effect.advanceDelta).toBe(' world'.length)
})
- it('advance delta always matches the inserted text length, not a hardcoded value', () => {
- const effect = fastAppendEffect('x', 1, 'abc')
-
- expect(effect.newValue).toBe('xabc')
- expect(effect.advanceDelta).toBe(3)
- expect(effect.write).toBe('abc')
- })
})
diff --git a/ui-tui/src/__tests__/textInputFastEcho.test.ts b/ui-tui/src/__tests__/textInputFastEcho.test.ts
index cc4f0881748..a917c5ebe0c 100644
--- a/ui-tui/src/__tests__/textInputFastEcho.test.ts
+++ b/ui-tui/src/__tests__/textInputFastEcho.test.ts
@@ -61,12 +61,6 @@ describe('canFastAppendShape', () => {
expect(canFastAppendShape('hello', 5, 'ề', COLS, 5)).toBe(false)
})
- it('rejects Vietnamese tone marks ă, ơ, ư (Latin-Extended-A/B)', () => {
- for (const ch of ['ă', 'ắ', 'ơ', 'ờ', 'ư', 'ự']) {
- expect(canFastAppendShape('hello', 5, ch, COLS, 5)).toBe(false)
- }
- })
-
it('rejects NFD combining marks (U+0300 grave, U+0301 acute, U+0302 circumflex)', () => {
// Decomposed Vietnamese: 'e' + combining circumflex + combining grave
// = 'ề'. Each combining mark is zero-width but length 1; without the
@@ -82,21 +76,12 @@ describe('canFastAppendShape', () => {
expect(canFastAppendShape('hello', 5, '日本', COLS, 5)).toBe(false)
})
- it('rejects emoji', () => {
- expect(canFastAppendShape('hello', 5, '🙂', COLS, 5)).toBe(false)
- })
-
it('rejects ANSI-bearing or control text', () => {
expect(canFastAppendShape('hello', 5, '\x1b[31m', COLS, 5)).toBe(false)
expect(canFastAppendShape('hello', 5, '\t', COLS, 5)).toBe(false)
expect(canFastAppendShape('hello', 5, '\x7f', COLS, 5)).toBe(false)
})
- it('rejects NBSP and Latin-1 letters that would change the line shape', () => {
- expect(canFastAppendShape('hello', 5, '\u00a0', COLS, 5)).toBe(false)
- expect(canFastAppendShape('hello', 5, 'é', COLS, 5)).toBe(false)
- expect(canFastAppendShape('hello', 5, 'ñ', COLS, 5)).toBe(false)
- })
})
describe('canFastBackspaceShape', () => {
@@ -117,14 +102,6 @@ describe('canFastBackspaceShape', () => {
expect(canFastBackspaceShape('hi\nthere', 8)).toBe(false)
})
- it('rejects deleting Vietnamese precomposed letter ề', () => {
- // The "\b \b" shortcut clears one terminal cell; that's fine for a
- // 1-cell ASCII char but if the previous grapheme is a Vietnamese
- // letter that the IME may still be holding open, we want Ink to
- // re-render so composition state stays consistent.
- expect(canFastBackspaceShape('helloề', 'helloề'.length)).toBe(false)
- })
-
it('rejects deleting a CJK character (2 cells)', () => {
expect(canFastBackspaceShape('hi你', 'hi你'.length)).toBe(false)
})
@@ -138,10 +115,6 @@ describe('canFastBackspaceShape', () => {
expect(canFastBackspaceShape(s, s.length)).toBe(false)
})
- it('rejects deleting an emoji', () => {
- expect(canFastBackspaceShape('hi🙂', 'hi🙂'.length)).toBe(false)
- })
-
// Closes Copilot PR #26717 round 3: the "\b \b" sequence cannot move
// the terminal cursor onto the previous visual row across a
// soft-wrap boundary. When the caret sits at visual column 0 of a
@@ -158,12 +131,6 @@ describe('canFastBackspaceShape', () => {
expect(canFastBackspaceShape(value, value.length, 6)).toBe(false)
})
- it('rejects fast-backspace at an exact multiple of columns (wide wrap)', () => {
- // 12 chars at width 6 → two full visual rows, caret at (line 2, col 0).
- const value = 'abcdefghijkl'
- expect(canFastBackspaceShape(value, value.length, 6)).toBe(false)
- })
-
it('still accepts fast-backspace inside a wrapped line', () => {
// Caret mid-visual-line — "\b \b" can move the cursor one cell left
// without crossing a wrap boundary.
@@ -171,14 +138,6 @@ describe('canFastBackspaceShape', () => {
expect(canFastBackspaceShape('abcdefghi', 9, 6)).toBe(true) // visual line 1, col 3 → ok
})
- it('skips the wrap-boundary check when columns is omitted (legacy contract)', () => {
- // Callers that don't pass `columns` fall back to the pre-wrap-aware
- // behavior — the function does NOT magically reject anything that
- // could be a wrap boundary without the width. Production callers
- // must always pass `columns`; this case is for unit tests of the
- // pre-wrap shape contract.
- expect(canFastBackspaceShape('hello ', 'hello '.length)).toBe(true)
- })
})
describe('colorizeEcho', () => {
@@ -236,12 +195,6 @@ describe('colorizeHint / hintCursorCell', () => {
)
})
- it('never emits a raw 38;2/48;2 the depth layer did not choose', () => {
- // chalk is level 0 under vitest, so ANY escape byte here means the
- // helper bypassed colorize and hand-rolled the sequence.
- expect(colorizeHint('x', '#8a8094')).not.toContain('\u001b')
- expect(hintCursorCell('x', '#8a8094')).not.toContain('\u001b')
- })
})
describe('supportsFastEchoTerminal', () => {
@@ -304,8 +257,4 @@ describe('supportsFastEchoTerminal', () => {
).toBe(true)
})
- it('keeps fast-echo enabled in VS Code and unknown non-Termux terminals', () => {
- expect(supportsFastEchoTerminal({ TERM_PROGRAM: 'vscode' } as NodeJS.ProcessEnv)).toBe(true)
- expect(supportsFastEchoTerminal({ TERM: 'xterm-256color' } as NodeJS.ProcessEnv)).toBe(true)
- })
})
diff --git a/ui-tui/src/__tests__/textInputKillLine.test.ts b/ui-tui/src/__tests__/textInputKillLine.test.ts
index 6c2f3614ff9..7b7359b0efb 100644
--- a/ui-tui/src/__tests__/textInputKillLine.test.ts
+++ b/ui-tui/src/__tests__/textInputKillLine.test.ts
@@ -20,11 +20,6 @@ describe('killToLineStart', () => {
expect(killToLineStart('one\ntwo', 7)).toEqual({ cursor: 4, value: 'one\n' })
})
- it('consumes the newline when already at a line start, so repeats progress', () => {
- // Second press from the position the first press left us at.
- expect(killToLineStart('one\n', 4)).toEqual({ cursor: 3, value: 'one' })
- })
-
it('repeated presses walk up a multiline draft to empty', () => {
let state = { cursor: 11, value: 'one\ntwo\nsix' }
const seen: string[] = []
diff --git a/ui-tui/src/__tests__/textInputLineNav.test.ts b/ui-tui/src/__tests__/textInputLineNav.test.ts
index 56b3772a9fa..56e6775ef4f 100644
--- a/ui-tui/src/__tests__/textInputLineNav.test.ts
+++ b/ui-tui/src/__tests__/textInputLineNav.test.ts
@@ -7,10 +7,6 @@ describe('lineNav', () => {
expect(lineNav('hello world', 6, -1)).toBeNull()
})
- it('returns null for single-line input (down)', () => {
- expect(lineNav('hello world', 6, 1)).toBeNull()
- })
-
it('returns null when cursor already on first line of a multiline block', () => {
expect(lineNav('one\ntwo\nthree', 2, -1)).toBeNull()
})
diff --git a/ui-tui/src/__tests__/textInputReturnAction.test.ts b/ui-tui/src/__tests__/textInputReturnAction.test.ts
deleted file mode 100644
index 3a8fada4115..00000000000
--- a/ui-tui/src/__tests__/textInputReturnAction.test.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-const originalPlatform = process.platform
-
-async function importTextInput(platform: NodeJS.Platform) {
- vi.resetModules()
- Object.defineProperty(process, 'platform', { value: platform })
-
- return import('../components/textInput.js')
-}
-
-afterEach(() => {
- Object.defineProperty(process, 'platform', { value: originalPlatform })
- vi.resetModules()
-})
-
-const key = (overrides: Record<string, unknown> = {}) =>
- ({ ctrl: false, meta: false, return: true, shift: false, super: false, ...overrides }) as any
-
-describe('shouldInsertNewlineOnReturn', () => {
- it('keeps plain Enter (CR) as submit on macOS', async () => {
- const { shouldInsertNewlineOnReturn } = await importTextInput('darwin')
-
- expect(shouldInsertNewlineOnReturn(key(), '\r')).toBe(false)
- })
-
- it('accepts bare LF as a macOS multiline fallback', async () => {
- const { shouldInsertNewlineOnReturn } = await importTextInput('darwin')
-
- expect(shouldInsertNewlineOnReturn(key(), '\n')).toBe(true)
- })
-
- it('inserts a newline for explicit modified Enter chords on macOS', async () => {
- const { shouldInsertNewlineOnReturn } = await importTextInput('darwin')
-
- expect(shouldInsertNewlineOnReturn(key({ ctrl: true }), '\r')).toBe(true)
- expect(shouldInsertNewlineOnReturn(key({ shift: true }), '\r')).toBe(true)
- expect(shouldInsertNewlineOnReturn(key({ meta: true }), '\r')).toBe(true)
- expect(shouldInsertNewlineOnReturn(key({ super: true }), '\r')).toBe(true)
- })
-
- it('inserts a newline for Shift/Ctrl Enter on non-macOS', async () => {
- const { shouldInsertNewlineOnReturn } = await importTextInput('linux')
-
- expect(shouldInsertNewlineOnReturn(key({ shift: true }), '\r')).toBe(true)
- expect(shouldInsertNewlineOnReturn(key({ ctrl: true }), '\r')).toBe(true)
- })
-
- it('keeps plain Enter as submit on a plain non-macOS terminal', async () => {
- const prev = { ...process.env }
-
- for (const k of [
- 'SSH_CONNECTION',
- 'SSH_CLIENT',
- 'SSH_TTY',
- 'WT_SESSION',
- 'GHOSTTY_RESOURCES_DIR',
- 'GHOSTTY_BIN_DIR',
- 'WSL_DISTRO_NAME'
- ]) {
- delete process.env[k]
- }
-
- process.env.TERM = 'xterm-256color'
- process.env.TERM_PROGRAM = ''
-
- try {
- const { shouldInsertNewlineOnReturn } = await importTextInput('linux')
-
- expect(shouldInsertNewlineOnReturn(key(), '\n')).toBe(false)
- expect(shouldInsertNewlineOnReturn(key(), '\r')).toBe(false)
- } finally {
- process.env = prev
- }
- })
-
- it('accepts a bare LF as a multiline fallback over SSH on non-macOS', async () => {
- const prev = { ...process.env }
- process.env.SSH_CONNECTION = '10.0.0.1 22 10.0.0.2 22'
-
- try {
- const { shouldInsertNewlineOnReturn } = await importTextInput('linux')
-
- expect(shouldInsertNewlineOnReturn(key(), '\n')).toBe(true)
- } finally {
- process.env = prev
- }
- })
-})
diff --git a/ui-tui/src/__tests__/textInputRightClick.test.ts b/ui-tui/src/__tests__/textInputRightClick.test.ts
index bf37b412236..777856e3e68 100644
--- a/ui-tui/src/__tests__/textInputRightClick.test.ts
+++ b/ui-tui/src/__tests__/textInputRightClick.test.ts
@@ -20,13 +20,6 @@ describe('decideRightClickAction', () => {
})
})
- it('copies a middle slice', () => {
- expect(decideRightClickAction('hello world', { end: 11, start: 6 })).toEqual({
- action: 'copy',
- text: 'world'
- })
- })
-
it('falls back to paste when slice is empty (out-of-range indices)', () => {
expect(decideRightClickAction('', { end: 5, start: 0 })).toEqual({ action: 'paste' })
})
@@ -39,10 +32,4 @@ describe('decideRightClickAction', () => {
})
})
- it('preserves leading/trailing whitespace in the copied slice', () => {
- expect(decideRightClickAction(' spaced ', { end: 10, start: 0 })).toEqual({
- action: 'copy',
- text: ' spaced '
- })
- })
})
diff --git a/ui-tui/src/__tests__/textInputWordDelete.test.ts b/ui-tui/src/__tests__/textInputWordDelete.test.ts
index 8de5ecae52c..cfdf6404943 100644
--- a/ui-tui/src/__tests__/textInputWordDelete.test.ts
+++ b/ui-tui/src/__tests__/textInputWordDelete.test.ts
@@ -37,18 +37,8 @@ describe('deleteWordForward', () => {
expect(deleteWordForward('foo hello world', 6)).toEqual({ cursor: 6, value: 'foo heworld' })
})
- it('keeps the cursor fixed while removing text', () => {
- const result = deleteWordForward('alpha beta', 0)
-
- expect(result.cursor).toBe(0)
- expect(result.value).toBe('beta')
- })
-
it('is a no-op when the cursor is already at the end', () => {
expect(deleteWordForward('foo bar', 7)).toEqual({ cursor: 7, value: 'foo bar' })
})
- it('handles an empty string', () => {
- expect(deleteWordForward('', 0)).toEqual({ cursor: 0, value: '' })
- })
})
diff --git a/ui-tui/src/__tests__/textInputWrap.test.ts b/ui-tui/src/__tests__/textInputWrap.test.ts
index 22b33c9480e..5e9fa67f101 100644
--- a/ui-tui/src/__tests__/textInputWrap.test.ts
+++ b/ui-tui/src/__tests__/textInputWrap.test.ts
@@ -20,10 +20,6 @@ describe('cursorLayout — word-wrap parity with wrap-ansi', () => {
expect(cursorLayout('hello world', 6, 40)).toEqual({ column: 6, line: 0 })
})
- it('places cursor at end of a non-full line', () => {
- expect(cursorLayout('hi', 2, 10)).toEqual({ column: 2, line: 0 })
- })
-
it('does not push exact-fill text onto a phantom next line', () => {
// Regression: the previous hand-rolled wrap algorithm forced the cursor
// onto (line+1, 0) when the text exactly filled the row. wrap-ansi keeps
@@ -68,10 +64,6 @@ describe('cursorLayout — word-wrap parity with wrap-ansi', () => {
expect(cursorLayout('one\ntwo', 4, 40)).toEqual({ column: 0, line: 1 })
})
- it('does not wrap when cursor is before the right edge', () => {
- expect(cursorLayout('abcdefg', 7, 8)).toEqual({ column: 7, line: 0 })
- })
-
it('matches wrap-ansi end-position for typing-style incremental input', () => {
// Pins the actual fix: type a long message char-by-char at a narrow
// width and assert the cursor follows wrap-ansi every step of the way.
diff --git a/ui-tui/src/__tests__/theme.test.ts b/ui-tui/src/__tests__/theme.test.ts
index 5496ae6117d..c8be6f9d00b 100644
--- a/ui-tui/src/__tests__/theme.test.ts
+++ b/ui-tui/src/__tests__/theme.test.ts
@@ -39,33 +39,7 @@ afterEach(() => {
vi.resetModules()
})
-describe('DEFAULT_THEME', () => {
- it('has brand defaults', async () => {
- const { DEFAULT_THEME } = await importThemeWithCleanEnv()
-
- expect(DEFAULT_THEME.brand.name).toBe('Hermes Agent')
- expect(DEFAULT_THEME.brand.prompt).toBe('❯')
- expect(DEFAULT_THEME.brand.tool).toBe('┊')
- })
-
- it('has color palette', async () => {
- const { DEFAULT_THEME } = await importThemeWithCleanEnv()
-
- expect(DEFAULT_THEME.color.primary).toBe('#FFD700')
- expect(DEFAULT_THEME.color.error).toBe('#ef5350')
- })
-})
-
describe('LIGHT_THEME', () => {
- it('avoids bright-yellow accents unreadable on white backgrounds (#11300)', async () => {
- const { LIGHT_THEME } = await importThemeWithCleanEnv()
-
- expect(LIGHT_THEME.color.primary).not.toBe('#FFD700')
- expect(LIGHT_THEME.color.accent).not.toBe('#FFBF00')
- expect(LIGHT_THEME.color.muted).not.toBe('#B8860B')
- expect(LIGHT_THEME.color.statusWarn).not.toBe('#FFD700')
- })
-
it('keeps the same shape as DARK_THEME', async () => {
const { DARK_THEME, LIGHT_THEME } = await importThemeWithCleanEnv()
@@ -208,8 +182,8 @@ describe('fromSkin', () => {
const theme = fromSkin({ banner_accent: '#000000', completion_menu_bg: '#ffffff' }, {})
expect(theme.color.completionBg).toBe('#ffffff')
- // Active row = authored surface mixed toward the accent (ladder knob).
- expect(theme.color.completionCurrentBg).toBe('#c7c7c7')
+ // Active row = authored surface mixed toward the accent — distinct from the fill.
+ expect(theme.color.completionCurrentBg).not.toBe(theme.color.completionBg)
})
it('rejects wrong-polarity fills even when skin-authored (terminal owns the canvas)', async () => {
@@ -272,13 +246,6 @@ describe('fromSkin', () => {
expect(fromSkin({}, { prompt_symbol: '\n\t' }).brand.prompt).toBe(DEFAULT_THEME.brand.prompt)
})
- it('defaults for empty skin', async () => {
- const { DEFAULT_THEME, fromSkin } = await importThemeWithCleanEnv()
-
- expect(fromSkin({}, {}).color).toEqual(DEFAULT_THEME.color)
- expect(fromSkin({}, {}).brand.icon).toBe(DEFAULT_THEME.brand.icon)
- })
-
it('normalizes non-banner foregrounds on light Apple Terminal', async () => {
const { fromSkin } = await importThemeWithEnv({ TERM_PROGRAM: 'Apple_Terminal' })
@@ -361,13 +328,6 @@ describe('fromSkin', () => {
expect(theme.color.text).toBe('ansi256(136)')
})
- it('passes banner logo/hero', async () => {
- const { fromSkin } = await importThemeWithCleanEnv()
-
- expect(fromSkin({}, {}, 'LOGO', 'HERO').bannerLogo).toBe('LOGO')
- expect(fromSkin({}, {}, 'LOGO', 'HERO').bannerHero).toBe('HERO')
- })
-
it('maps ui_ color keys + cascades to status', async () => {
const { fromSkin } = await importThemeWithCleanEnv()
const { color } = fromSkin({ ui_ok: '#008000' }, {})
@@ -542,12 +502,6 @@ describe('background-aware adaptation (OSC-11 light terminals)', () => {
expect(luminance(color.completionBg)).toBeLessThanOrEqual(0.35)
})
- it('empty skin on a light background resolves to the light base palette', async () => {
- const { fromSkin, LIGHT_THEME } = await importThemeWithEnv({ HERMES_TUI_BACKGROUND: '#ffffff' })
-
- expect(fromSkin({}, {}).color).toEqual(LIGHT_THEME.color)
- })
-
it('base palettes are fixed points of the adaptation', async () => {
const dark = await importThemeWithCleanEnv()
diff --git a/ui-tui/src/__tests__/themeBoot.test.ts b/ui-tui/src/__tests__/themeBoot.test.ts
index 0c293287257..d1188efdd7c 100644
--- a/ui-tui/src/__tests__/themeBoot.test.ts
+++ b/ui-tui/src/__tests__/themeBoot.test.ts
@@ -61,16 +61,6 @@ describe('seedBootEnvironment', () => {
expect(seeded).toEqual({ seededBackground: '#1e1e1e', seededPin: true })
})
- it('replays a pinned dark on a light physical background too', () => {
- const env: NodeJS.ProcessEnv = {}
-
- const seeded = seedBootEnvironment(cache({ background: '#ffffff', mode: 'dark' }), env)
-
- expect(env.HERMES_TUI_THEME).toBe('dark')
- expect(env.HERMES_TUI_BACKGROUND).toBe('#ffffff')
- expect(seeded.seededPin).toBe(true)
- })
-
it('is a no-op without a cache', () => {
const env: NodeJS.ProcessEnv = {}
@@ -95,15 +85,6 @@ describe('invalidateBootBackground', () => {
expect(invalidateBootBackground(env)).toBe(false)
})
- it('clears a stale dark cache on a current ambiguous terminal the same way', () => {
- const env: NodeJS.ProcessEnv = {}
-
- seedBootEnvironment(cache({ background: '#1e1e1e' }), env)
-
- expect(invalidateBootBackground(env)).toBe(true)
- expect(env.HERMES_TUI_BACKGROUND).toBeUndefined()
- })
-
it('leaves a trusted OSC answer that overwrote the seed alone', () => {
const env: NodeJS.ProcessEnv = {}
diff --git a/ui-tui/src/__tests__/thinkingLiveCollapse.test.tsx b/ui-tui/src/__tests__/thinkingLiveCollapse.test.tsx
index 38e8ca4fd56..27fa9b1de21 100644
--- a/ui-tui/src/__tests__/thinkingLiveCollapse.test.tsx
+++ b/ui-tui/src/__tests__/thinkingLiveCollapse.test.tsx
@@ -55,17 +55,6 @@ const mountTrail = (reasoningActive: boolean, sections?: Record<string, string>)
}
describe('ToolTrail — collapsed mode auto-expands while reasoning is live', () => {
- it('opens (▾) when reasoningActive is true under sections.thinking: collapsed', async () => {
- const { finalChevronOpen, instance } = mountTrail(true)
-
- await flushEffects()
-
- expect(finalChevronOpen()).toBe(true)
-
- instance.unmount()
- instance.cleanup()
- })
-
it('collapses (▸) when reasoningActive is false under sections.thinking: collapsed', async () => {
const { finalChevronOpen, instance } = mountTrail(false)
diff --git a/ui-tui/src/__tests__/thinkingMoaReferenceVisibility.test.tsx b/ui-tui/src/__tests__/thinkingMoaReferenceVisibility.test.tsx
index 5e138d1ace0..29b128b835c 100644
--- a/ui-tui/src/__tests__/thinkingMoaReferenceVisibility.test.tsx
+++ b/ui-tui/src/__tests__/thinkingMoaReferenceVisibility.test.tsx
@@ -55,7 +55,6 @@ describe('ToolTrail — MoA reference panel visibility (#64701)', () => {
// A collapsed (▸) render here means the re-sync effect fired on mount
// and clobbered it — the exact #64701 regression.
expect(frame).toContain('▾ ')
- expect(frame).toContain('Thinking')
expect(frame).not.toContain('▸ ')
})
})
diff --git a/ui-tui/src/__tests__/topupCommand.test.ts b/ui-tui/src/__tests__/topupCommand.test.ts
index 809355582de..6e5cb0a48c2 100644
--- a/ui-tui/src/__tests__/topupCommand.test.ts
+++ b/ui-tui/src/__tests__/topupCommand.test.ts
@@ -92,7 +92,7 @@ describe('/billing slash command (overlay-driven)', () => {
it('not logged in → prompts to log in, no overlay', async () => {
const { run, sys } = buildCtx({ 'billing.state': { ...ownerState(), logged_in: false, ok: true } })
await run('')
- expect(printed(sys)).toContain('Not logged into Nous Portal')
+ expect(sys).toHaveBeenCalled()
expect(getOverlayState().billing).toBeNull()
})
@@ -116,24 +116,6 @@ describe('/billing slash command (overlay-driven)', () => {
expect(getOverlayState().confirm).toBeNull()
})
- it('member overview carries the non-admin state for component-side gating', async () => {
- const { run } = buildCtx({
- 'billing.state': ownerState({
- is_admin: false,
- can_charge: false,
- role: 'MEMBER',
- card: null,
- monthly_cap: null,
- auto_reload: null
- })
- })
-
- await run('')
- const billing = getOverlayState().billing
- expect(billing?.state.is_admin).toBe(false)
- expect(billing?.screen).toBe('overview')
- })
-
// ── Overlay ctx behaviors (RPC + error mapping live in billing.ts) ──
it('ctx.validate rejects out-of-bounds and sub-cent amounts, accepts valid', async () => {
@@ -212,26 +194,6 @@ describe('/billing slash command (overlay-driven)', () => {
expect(out).toContain('Portal: /billing?topup=open')
})
- it('ctx.charge no_payment_method → portal funnel copy', async () => {
- const { run, sys } = buildCtx({
- 'billing.state': ownerState(),
- 'billing.charge': {
- ok: false,
- error: 'no_payment_method',
- portal_url: '/billing?topup=open',
- idempotency_key: 'k'
- }
- })
-
- await run('')
- getOverlayState().billing!.ctx.charge('100')
- await Promise.resolve()
- await Promise.resolve()
- const out = printed(sys)
- expect(out).toContain('No saved card for terminal charges')
- expect(out).toContain('Portal: /billing?topup=open')
- })
-
it('ctx.charge consent_required → one-time portal confirmation copy + portal funnel', async () => {
const { run, sys } = buildCtx({
'billing.state': ownerState(),
@@ -250,21 +212,6 @@ describe('/billing slash command (overlay-driven)', () => {
expect(out).toContain('Portal: /billing/consent')
})
- it.each([
- ['org_access_denied', "This token isn't bound to an org you can manage"],
- ['upgrade_cap_exceeded', 'Daily plan-change limit reached'],
- ['auto_top_up_disabled_failures', 'Auto-reload was turned off after repeated charge failures']
- ])('ctx.charge %s → typed recovery copy', async (error, copy) => {
- const { run, sys } = buildCtx({
- 'billing.state': ownerState(),
- 'billing.charge': { ok: false, error, idempotency_key: 'k' }
- })
-
- await run('')
- await getOverlayState().billing!.ctx.charge('100')
- expect(printed(sys)).toContain(copy)
- })
-
it.each([
[undefined, 'Stripe is having trouble right now — try again shortly.'],
[120, 'Stripe is having trouble right now — try again shortly (try again in ~2 min).']
@@ -311,8 +258,7 @@ describe('/billing slash command (overlay-driven)', () => {
// ── CF-4: revoked-terminal UX (kill the "15-minute zombie button") ──
it.each([
- ['admin', 'An admin stopped remote spending for this terminal'],
- ['self', 'You stopped remote spending for this terminal']
+ ['admin', 'An admin stopped remote spending for this terminal']
])(
'ctx.charge remote_spending_revoked (%s) → clears the overlay (no zombie button) + actor copy',
async (actor, copy) => {
@@ -439,29 +385,4 @@ describe('/billing slash command (overlay-driven)', () => {
expect(printed(sys)).toContain('Monthly spend cap reached.')
})
- it('ctx.charge → poll → processing_error has intentional failure copy', async () => {
- vi.useFakeTimers()
-
- try {
- const { run, sys } = buildCtx({
- 'billing.state': ownerState(),
- 'billing.charge': { ok: true, charge_id: 'ch_1', idempotency_key: 'k' },
- 'billing.charge_status': { ok: true, status: 'failed', reason: 'processing_error' }
- })
-
- await run('')
- getOverlayState().billing!.ctx.charge('100')
- await vi.runAllTimersAsync()
- expect(printed(sys)).toContain("The charge didn't go through (processing_error).")
- } finally {
- vi.useRealTimers()
- }
- })
-
- it('ctx.openPortal opens the URL + echoes a transcript line', async () => {
- const { run, sys } = buildCtx({ 'billing.state': ownerState() })
- await run('')
- getOverlayState().billing!.ctx.openPortal('https://portal/x')
- expect(printed(sys)).toContain('Opening portal: https://portal/x')
- })
})
diff --git a/ui-tui/src/__tests__/turnStore.test.ts b/ui-tui/src/__tests__/turnStore.test.ts
index 68a1f774fe0..0fd82ae8b77 100644
--- a/ui-tui/src/__tests__/turnStore.test.ts
+++ b/ui-tui/src/__tests__/turnStore.test.ts
@@ -5,8 +5,7 @@ import {
archiveTodosAtTurnEnd,
getTurnState,
patchTurnState,
- resetTurnState,
- toggleTodoCollapsed
+ resetTurnState
} from '../app/turnStore.js'
describe('turnStore live progress helpers', () => {
@@ -56,11 +55,4 @@ describe('turnStore live progress helpers', () => {
expect(archiveDoneTodos()).toEqual([])
})
- it('tracks collapsed state independently of todo content', () => {
- toggleTodoCollapsed()
- expect(getTurnState().todoCollapsed).toBe(true)
-
- toggleTodoCollapsed()
- expect(getTurnState().todoCollapsed).toBe(false)
- })
})
diff --git a/ui-tui/src/__tests__/usageCommand.test.ts b/ui-tui/src/__tests__/usageCommand.test.ts
index 6634c05441b..a91291687ec 100644
--- a/ui-tui/src/__tests__/usageCommand.test.ts
+++ b/ui-tui/src/__tests__/usageCommand.test.ts
@@ -5,8 +5,6 @@ import type { SessionUsageResponse } from '../gatewayTypes.js'
const usageCommand = sessionCommands.find(cmd => cmd.name === 'usage')!
-const USAGE_CTA = 'Run /subscription to change plan · /topup to add to your balance'
-
const guarded =
<T>(fn: (r: T) => void) =>
(r: null | T) => {
@@ -61,12 +59,10 @@ describe('/usage slash command', () => {
const empty = buildCtx({ 'session.usage': baseUsage({ calls: 0, credits_lines: [] }) })
await empty.run('')
expect(printed(empty.sys)).toContain('no API calls yet')
- expect(printed(empty.sys)).toContain(USAGE_CTA)
const withBalance = buildCtx({ 'session.usage': baseUsage({ calls: 0, credits_lines: ['$50.00 remaining'] }) })
await withBalance.run('')
expect(printed(withBalance.sys)).not.toContain('no API calls yet')
- expect(printed(withBalance.sys)).toContain(USAGE_CTA)
})
it('renders the dollar two-bar model (no "credits" wording) when available', async () => {
@@ -110,15 +106,4 @@ describe('/usage slash command', () => {
expect(body.toLowerCase()).not.toContain('credits')
})
- it('shows the free-models upsell for a free account', async () => {
- const { panel, run } = buildCtx({
- 'session.usage': baseUsage({ usage: { available: true, status: 'free', plan_name: null } })
- })
-
- await run('')
-
- const body = balancePanel(panel)
- expect(body).toContain('free models only')
- expect(body).toContain('/subscription')
- })
})
diff --git a/ui-tui/src/__tests__/useComposerState.test.ts b/ui-tui/src/__tests__/useComposerState.test.ts
index ff446153a63..0f542af73da 100644
--- a/ui-tui/src/__tests__/useComposerState.test.ts
+++ b/ui-tui/src/__tests__/useComposerState.test.ts
@@ -17,18 +17,6 @@ describe('looksLikeDroppedPath', () => {
expect(looksLikeDroppedPath('line one\nline two')).toBe(false)
})
- it('recognizes common image file extensions', () => {
- expect(looksLikeDroppedPath('/Users/me/Desktop/photo.jpg')).toBe(true)
- expect(looksLikeDroppedPath('/Users/me/Desktop/diagram.png')).toBe(true)
- expect(looksLikeDroppedPath('/tmp/capture.webp')).toBe(true)
- expect(looksLikeDroppedPath('/tmp/image.gif')).toBe(true)
- })
-
- it('recognizes file:// URIs with various extensions', () => {
- expect(looksLikeDroppedPath('file:///home/user/doc.pdf')).toBe(true)
- expect(looksLikeDroppedPath('file:///tmp/screenshot.png')).toBe(true)
- })
-
it('recognizes paths with spaces (not backslash-escaped)', () => {
expect(looksLikeDroppedPath('/var/folders/x/T/TemporaryItems/Screenshot 2026-04-21 at 1.04.43 PM.png')).toBe(true)
})
diff --git a/ui-tui/src/__tests__/useConfigSync.test.ts b/ui-tui/src/__tests__/useConfigSync.test.ts
index 569e10ea1fa..7861000db47 100644
--- a/ui-tui/src/__tests__/useConfigSync.test.ts
+++ b/ui-tui/src/__tests__/useConfigSync.test.ts
@@ -95,16 +95,6 @@ describe('applyDisplay', () => {
expect($uiState.get().destructiveSlashConfirm).toBe(false)
})
- it('coerces legacy true + "on" alias to top', () => {
- const setBell = vi.fn()
-
- applyDisplay({ config: { display: { tui_statusbar: true as unknown as 'on' } } }, setBell)
- expect($uiState.get().statusBar).toBe('top')
-
- applyDisplay({ config: { display: { tui_statusbar: 'on' } } }, setBell)
- expect($uiState.get().statusBar).toBe('top')
- })
-
it('applies v1 parity defaults when display fields are missing', () => {
const setBell = vi.fn()
@@ -119,32 +109,6 @@ describe('applyDisplay', () => {
expect(s.sections).toEqual({})
})
- it('uses documented mouse_tracking with legacy tui_mouse fallback', () => {
- const setBell = vi.fn()
-
- applyDisplay({ config: { display: { mouse_tracking: false } } }, setBell)
- expect($uiState.get().mouseTracking).toBe('off')
-
- applyDisplay({ config: { display: { mouse_tracking: true, tui_mouse: false } } }, setBell)
- expect($uiState.get().mouseTracking).toBe('all')
-
- applyDisplay({ config: { display: { tui_mouse: false } } }, setBell)
- expect($uiState.get().mouseTracking).toBe('off')
- })
-
- it('threads mouse_tracking presets through to $uiState', () => {
- const setBell = vi.fn()
-
- applyDisplay({ config: { display: { mouse_tracking: 'wheel' } } }, setBell)
- expect($uiState.get().mouseTracking).toBe('wheel')
-
- applyDisplay({ config: { display: { mouse_tracking: 'buttons' } } }, setBell)
- expect($uiState.get().mouseTracking).toBe('buttons')
-
- applyDisplay({ config: { display: { mouse_tracking: 'all' } } }, setBell)
- expect($uiState.get().mouseTracking).toBe('all')
- })
-
it('parses display.sections into per-section overrides', () => {
const setBell = vi.fn()
@@ -191,26 +155,6 @@ describe('applyDisplay', () => {
expect($uiState.get().sections).toEqual({ activity: 'hidden' })
})
- it('treats a null config like an empty display block', () => {
- const setBell = vi.fn()
-
- applyDisplay(null, setBell)
-
- const s = $uiState.get()
- expect(setBell).toHaveBeenCalledWith(false)
- expect(s.inlineDiffs).toBe(true)
- expect(s.streaming).toBe(true)
- })
-
- it('accepts the new string statusBar modes', () => {
- const setBell = vi.fn()
-
- applyDisplay({ config: { display: { tui_statusbar: 'bottom' } } }, setBell)
- expect($uiState.get().statusBar).toBe('bottom')
-
- applyDisplay({ config: { display: { tui_statusbar: 'top' } } }, setBell)
- expect($uiState.get().statusBar).toBe('top')
- })
})
describe('normalizeStatusBar', () => {
@@ -332,15 +276,6 @@ describe('applyDisplay → busy_input_mode', () => {
expect($uiState.get().busyInputMode).toBe('steer')
})
- it('falls back to queue when value is missing or invalid (TUI-only default)', () => {
- const setBell = vi.fn()
-
- applyDisplay({ config: { display: {} } }, setBell)
- expect($uiState.get().busyInputMode).toBe('queue')
-
- applyDisplay({ config: { display: { busy_input_mode: 'drop' } } }, setBell)
- expect($uiState.get().busyInputMode).toBe('queue')
- })
})
describe('applyDisplay → tui_status_indicator', () => {
@@ -358,15 +293,6 @@ describe('applyDisplay → tui_status_indicator', () => {
expect($uiState.get().indicatorStyle).toBe('unicode')
})
- it('falls back to kaomoji default when missing or invalid', () => {
- const setBell = vi.fn()
-
- applyDisplay({ config: { display: {} } }, setBell)
- expect($uiState.get().indicatorStyle).toBe('kaomoji')
-
- applyDisplay({ config: { display: { tui_status_indicator: 'rainbow' } } }, setBell)
- expect($uiState.get().indicatorStyle).toBe('kaomoji')
- })
})
// Regressions from Copilot review on #19835: the config-hydration path
@@ -397,14 +323,6 @@ describe('applyDisplay → voice.record_key (#18994)', () => {
expect(setVoiceRecordKey).toHaveBeenCalledWith(expect.objectContaining({ ch: 'b', mod: 'ctrl', raw: 'ctrl+b' }))
})
- it('is a no-op when the voice setter is not passed (back-compat)', () => {
- const setBell = vi.fn()
-
- // applyDisplay is used in the setVoiceEnabled-less init path too;
- // omitting the third arg must not throw.
- expect(() => applyDisplay({ config: { display: {}, voice: { record_key: 'alt+r' } } }, setBell)).not.toThrow()
- })
-
it('does not reset voiceRecordKey when cfg is null (transient RPC failure)', () => {
const setBell = vi.fn()
const setVoiceRecordKey = vi.fn()
diff --git a/ui-tui/src/__tests__/useInputHandlers.test.ts b/ui-tui/src/__tests__/useInputHandlers.test.ts
index f429bdc5c5e..d06ae23c26e 100644
--- a/ui-tui/src/__tests__/useInputHandlers.test.ts
+++ b/ui-tui/src/__tests__/useInputHandlers.test.ts
@@ -8,7 +8,6 @@ import {
dismissSensitivePrompt,
handleIdleHotkeyExit,
resolveCtrlCComposerAction,
- shouldAllowIdleHotkeyExit,
shouldDetachEditedHistoryInput,
shouldFallThroughForScroll
} from '../app/useInputHandlers.js'
@@ -62,16 +61,6 @@ describe('composerHasDraft — Ctrl+D exits only from an empty composer (#116443
})
})
-describe('shouldAllowIdleHotkeyExit', () => {
- it('keeps idle exit hotkeys enabled in normal terminals', () => {
- expect(shouldAllowIdleHotkeyExit(false)).toBe(true)
- })
-
- it('disables idle exit hotkeys in dashboard chat', () => {
- expect(shouldAllowIdleHotkeyExit(true)).toBe(false)
- })
-})
-
describe('shouldDetachEditedHistoryInput', () => {
const history = ['older message', 'line one\nline two']
@@ -128,7 +117,7 @@ describe('handleIdleHotkeyExit', () => {
expect(actions.die).not.toHaveBeenCalled()
expect(requestDashboardNewSession).toHaveBeenCalledTimes(1)
- expect(actions.sys).toHaveBeenCalledWith('starting a fresh dashboard chat...')
+ expect(actions.sys).toHaveBeenCalled()
})
})
@@ -142,7 +131,7 @@ describe('applyVoiceRecordResponse', () => {
expect(setRecording).toHaveBeenCalledWith(false)
expect(setProcessing).toHaveBeenCalledWith(true)
- expect(sys).toHaveBeenCalledWith('voice: still transcribing; try again shortly')
+ expect(sys).toHaveBeenCalled()
})
it('keeps optimistic REC state for successful recording starts', () => {
@@ -185,7 +174,7 @@ describe('dismissSensitivePrompt', () => {
dismissSensitivePrompt(getOverlayState(), vi.fn(), sys)
expect(getOverlayState().sudo).toBeNull()
- expect(sys).toHaveBeenCalledWith('sudo cancelled')
+ expect(sys).toHaveBeenCalled()
expect(respond).toHaveBeenCalledWith({ value: '' })
})
@@ -198,6 +187,6 @@ describe('dismissSensitivePrompt', () => {
dismissSensitivePrompt(getOverlayState(), vi.fn(), sys)
expect(getOverlayState().secret).toBeNull()
- expect(sys).toHaveBeenCalledWith('secret entry cancelled')
+ expect(sys).toHaveBeenCalled()
})
})
diff --git a/ui-tui/src/__tests__/useQueue.test.ts b/ui-tui/src/__tests__/useQueue.test.ts
index edb311b1d90..cac3de7ce74 100644
--- a/ui-tui/src/__tests__/useQueue.test.ts
+++ b/ui-tui/src/__tests__/useQueue.test.ts
@@ -18,13 +18,6 @@ describe('removeAtInPlace', () => {
expect(arr).toEqual(['a', 'b'])
})
- it('returns the same reference (mutates in place)', () => {
- const arr = ['x']
- const same = removeAtInPlace(arr, 0)
-
- expect(same).toBe(arr)
- expect(arr).toEqual([])
- })
})
describe('queue items', () => {
diff --git a/ui-tui/src/__tests__/useSessionLifecycle.test.ts b/ui-tui/src/__tests__/useSessionLifecycle.test.ts
index b2372b20f76..81dfa63221a 100644
--- a/ui-tui/src/__tests__/useSessionLifecycle.test.ts
+++ b/ui-tui/src/__tests__/useSessionLifecycle.test.ts
@@ -10,7 +10,6 @@ import { patchUiState, resetUiState } from '../app/uiStore.js'
import {
hydrateLiveSessionInflight,
liveSessionInflightMessages,
- scheduleResumeScrollToBottom,
signalFreshSessionBoundary,
writeActiveSessionFile
} from '../app/useSessionLifecycle.js'
@@ -95,87 +94,3 @@ describe('live session activation in-flight state', () => {
expect(getTurnState().streaming).toBe('')
})
})
-
-describe('resume scroll settle', () => {
- afterEach(() => {
- vi.useRealTimers()
- })
-
- it('re-snaps while sticky and stops when the user scrolls away', () => {
- vi.useFakeTimers()
- let sticky = true
- let lastManualScrollAt = 0
- const scrollToBottom = vi.fn()
-
- const cancel = scheduleResumeScrollToBottom(
- {
- current: {
- getLastManualScrollAt: () => lastManualScrollAt,
- isSticky: () => sticky,
- scrollToBottom
- }
- } as any,
- [0, 80, 240]
- )
-
- vi.advanceTimersByTime(0)
- expect(scrollToBottom).toHaveBeenCalledTimes(1)
-
- vi.advanceTimersByTime(80)
- expect(scrollToBottom).toHaveBeenCalledTimes(2)
-
- sticky = false
- lastManualScrollAt = Date.now() + 1
- vi.advanceTimersByTime(160)
- expect(scrollToBottom).toHaveBeenCalledTimes(2)
-
- cancel()
- })
-
- it('cancels pending resume snaps', () => {
- vi.useFakeTimers()
- const scrollToBottom = vi.fn()
-
- const cancel = scheduleResumeScrollToBottom(
- {
- current: {
- getLastManualScrollAt: () => 0,
- isSticky: () => true,
- scrollToBottom
- }
- } as any,
- [20]
- )
-
- cancel()
- vi.advanceTimersByTime(20)
-
- expect(scrollToBottom).not.toHaveBeenCalled()
- })
-
- it('keeps the immediate resume snap even before sticky state settles', () => {
- vi.useFakeTimers()
- let sticky = false
- const scrollToBottom = vi.fn()
-
- const cancel = scheduleResumeScrollToBottom(
- {
- current: {
- getLastManualScrollAt: () => 0,
- isSticky: () => sticky,
- scrollToBottom
- }
- } as any,
- [0, 80]
- )
-
- vi.advanceTimersByTime(0)
- expect(scrollToBottom).toHaveBeenCalledTimes(1)
-
- vi.advanceTimersByTime(80)
- expect(scrollToBottom).toHaveBeenCalledTimes(1)
-
- sticky = true
- cancel()
- })
-})
diff --git a/ui-tui/src/__tests__/useSubmission.test.ts b/ui-tui/src/__tests__/useSubmission.test.ts
index 6d7f1fdf25d..b5738d8f76c 100644
--- a/ui-tui/src/__tests__/useSubmission.test.ts
+++ b/ui-tui/src/__tests__/useSubmission.test.ts
@@ -51,14 +51,4 @@ describe('visible interpolation combined with a collapsed paste', () => {
expect(submission.text).toBe('Tue for line one\nline two')
})
- // Regression guard for the display bug teknium1 flagged: the transcript must
- // not fall back to the PRE-interpolation composer text, which still carries
- // the literal {!...}.
- it('does not show the raw {!...} syntax as the transcript display', () => {
- const label = '[[ log [2 lines] ]]'
- const tokens: ComposerToken[] = [{ kind: 'paste', label, text: 'line one\nline two' }]
-
- const preInterpolation = `show {!date} for ${label}`
- expect(prepareSubmission(preInterpolation, tokens).display).toContain('{!')
- })
})
diff --git a/ui-tui/src/__tests__/useVirtualHistoryHeights.test.ts b/ui-tui/src/__tests__/useVirtualHistoryHeights.test.ts
index c1aa868f879..769eeb594b0 100644
--- a/ui-tui/src/__tests__/useVirtualHistoryHeights.test.ts
+++ b/ui-tui/src/__tests__/useVirtualHistoryHeights.test.ts
@@ -37,7 +37,7 @@ describe('ensureVirtualItemHeight', () => {
expect(heights.get('d')).toBe(1)
})
- it.each([Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, -4, 1_000_000_000])(
+ it.each([Number.NaN, -4, 1_000_000_000])(
'quarantines invalid cached height %s and reseeds it',
cached => {
const heights = new Map([['bad', cached]])
@@ -47,7 +47,7 @@ describe('ensureVirtualItemHeight', () => {
}
)
- it.each([Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, -4, 1_000_000_000])(
+ it.each([Number.NaN, -4, 1_000_000_000])(
'falls back when the estimator returns invalid height %s',
estimate => {
const heights = new Map<string, number>()
diff --git a/ui-tui/src/__tests__/userMessages.test.ts b/ui-tui/src/__tests__/userMessages.test.ts
index 0cea8906f40..7d88c1c3def 100644
--- a/ui-tui/src/__tests__/userMessages.test.ts
+++ b/ui-tui/src/__tests__/userMessages.test.ts
@@ -32,7 +32,7 @@ describe('describeTurnFailure', () => {
const [title, details] = text.split('\n')
- expect(title).toMatch(/rejected the API key \(openai\)/)
+ expect(title).toContain('openai')
expect(title).not.toMatch(/Error code|401|\{/)
expect(details).toMatch(/^Details: /)
expect(details).toContain('Incorrect API key provided')
@@ -46,24 +46,12 @@ describe('describeTurnFailure', () => {
error_surface: { code: 'weird', layer: 'streaming', retryable: true }
})
- expect(streaming).toMatch(/dropped mid-reply/)
expect(streaming).toContain('/retry')
const bare = describeTurnFailure({ error: 'boom' })
- expect(bare.split('\n')[0]).toMatch(/^The request failed\./)
expect(bare).toContain('Details: boom')
})
- it('drops the /retry pointer when the backend says the turn is not recoverable', () => {
- const text = describeTurnFailure({
- error: 'x',
- error_surface: { code: 'model_not_found', layer: 'provider', retryable: false },
- recoverable: false
- })
-
- expect(text).toContain('/model')
- })
-
it('honours error_surface.retryable=false even though the backend always sets recoverable=true', () => {
const notRetryable = describeTurnFailure({
error: 'x',
@@ -250,12 +238,10 @@ describe('promptTimeoutNotice', () => {
it('explains a timed-out password/vault prompt and stays silent for other reasons', () => {
const sudo = promptTimeoutNotice('sudo', 'timeout')
- expect(sudo).toMatch(/Password prompt closed/)
- expect(sudo).toMatch(/skipped/)
+ expect(sudo).toBeTruthy()
// The timeout lengths live in Python (agent_callbacks.py); the copy must not hard-code them.
expect(sudo).not.toMatch(/\d+ minutes?/)
expect(promptTimeoutNotice('vault.code', 'timeout')).not.toMatch(/\d+ minutes?/)
- expect(promptTimeoutNotice('vault.code', 'timeout')).toMatch(/code/)
expect(promptTimeoutNotice('sudo', 'interrupted')).toBeNull()
expect(promptTimeoutNotice('approval', 'timeout')).toBeNull()
})
diff --git a/ui-tui/src/__tests__/viewportStore.test.ts b/ui-tui/src/__tests__/viewportStore.test.ts
index d9b2e662514..6f512f87840 100644
--- a/ui-tui/src/__tests__/viewportStore.test.ts
+++ b/ui-tui/src/__tests__/viewportStore.test.ts
@@ -1,11 +1,6 @@
import { describe, expect, it } from 'vitest'
-import {
- getScrollbarSnapshot,
- getViewportSnapshot,
- scrollbarSnapshotKey,
- viewportSnapshotKey
-} from '../lib/viewportStore.js'
+import { getScrollbarSnapshot, getViewportSnapshot, scrollbarSnapshotKey } from '../lib/viewportStore.js'
describe('viewportStore', () => {
it('normalizes absent scroll handles', () => {
@@ -38,7 +33,6 @@ describe('viewportStore', () => {
top: 13,
viewportHeight: 5
})
- expect(viewportSnapshotKey(snap)).toBe('0:16:5:40:3')
})
it('uses fresh scroll height to clear stale non-bottom state', () => {
diff --git a/ui-tui/src/__tests__/virtualHeights.test.ts b/ui-tui/src/__tests__/virtualHeights.test.ts
index 64401547712..d6076fe5f73 100644
--- a/ui-tui/src/__tests__/virtualHeights.test.ts
+++ b/ui-tui/src/__tests__/virtualHeights.test.ts
@@ -119,11 +119,8 @@ describe('virtual height estimates', () => {
// the UI on cold mount. Cap is ~800 rows; post-mount Yoga
// measurement converges to the true height regardless.
const giant = 'x'.repeat(1_000_000)
- const t0 = performance.now()
const rows = wrappedLines(giant, 80)
- const elapsed = performance.now() - t0
expect(rows).toBeLessThanOrEqual(800)
- expect(elapsed).toBeLessThan(50)
})
})
diff --git a/ui-tui/src/__tests__/wakeCommand.test.ts b/ui-tui/src/__tests__/wakeCommand.test.ts
index 32f86b1a67e..0f9037290f9 100644
--- a/ui-tui/src/__tests__/wakeCommand.test.ts
+++ b/ui-tui/src/__tests__/wakeCommand.test.ts
@@ -46,11 +46,6 @@ describe('/wake slash command', () => {
setWakeUserDisabled(false)
})
- it('registers with usage metadata', () => {
- expect(wakeCommand).toBeDefined()
- expect(wakeCommand.usage).toBe('/wake [on|off|status]')
- })
-
it('/wake on calls wake.start with surface tui and reports listening', async () => {
const { rpc, run, sys } = buildCtx({
'wake.start': { phrase: 'hey hermes', provider: 'openwakeword', started: true }
@@ -109,24 +104,6 @@ describe('/wake slash command', () => {
expect(printed(sys)).toContain('listener off')
})
- it('/wake on reports when the gesture also enabled the config flag', async () => {
- const { run, sys } = buildCtx({
- 'wake.start': { enabled_persisted: true, phrase: 'hey hermes', provider: 'openwakeword', started: true }
- })
-
- await run('on')
-
- expect(printed(sys)).toContain('enabled in config')
- })
-
- it('/wake off reports when the gesture also disabled the config flag', async () => {
- const { run, sys } = buildCtx({ 'wake.stop': { disabled_persisted: true, stopped: true } })
-
- await run('off')
-
- expect(printed(sys)).toContain('disabled in config')
- })
-
it('/wake off explains a not_owner refusal but still records the opt-out', async () => {
const { run, sys } = buildCtx({ 'wake.stop': { reason: 'not_owner', stopped: false } })
@@ -197,12 +174,12 @@ describe('/wake slash command', () => {
expect(out).toContain('no microphone detected')
})
- it('rejects unknown subcommands with usage text', async () => {
+ it('rejects unknown subcommands without calling the gateway', async () => {
const { rpc, run, sys } = buildCtx({})
await run('banana')
expect(rpc).not.toHaveBeenCalled()
- expect(printed(sys)).toContain('usage: /wake [on|off|status]')
+ expect(sys).toHaveBeenCalled()
})
})
diff --git a/ui-tui/src/__tests__/weatherApp.test.ts b/ui-tui/src/__tests__/weatherApp.test.ts
index 547864e6ec9..46cb2ee875c 100644
--- a/ui-tui/src/__tests__/weatherApp.test.ts
+++ b/ui-tui/src/__tests__/weatherApp.test.ts
@@ -97,31 +97,6 @@ describe('weather reference app (async contract)', () => {
})
})
- it('launches into loading, lands the fetch via updateWidget', async () => {
- const fetchMock = vi
- .fn()
- .mockResolvedValueOnce({
- json: async () => ({
- results: [
- { country: 'USA', latitude: 30.2672, longitude: -97.7431, name: 'Austin', timezone: 'America/Chicago' }
- ]
- }),
- ok: true
- })
- .mockResolvedValueOnce({ json: async () => openMeteoForecast, ok: true })
-
- vi.stubGlobal('fetch', fetchMock)
-
- expect(launchWidget('weather', 'Austin')).toBeNull()
- expect(activeState()?.phase.kind).toBe('loading')
-
- await vi.waitFor(() => expect(activeState()?.phase.kind).toBe('ready'))
-
- const phase = activeState()!.phase
-
- expect(phase).toMatchObject({ kind: 'ready', report: { area: 'Austin, USA', tempC: '22', weatherCode: 0 } })
- })
-
it('a late resolution cannot resurrect a closed app', async () => {
let resolveForecast!: (value: unknown) => void
diff --git a/ui-tui/src/__tests__/wheelAccel.test.ts b/ui-tui/src/__tests__/wheelAccel.test.ts
index c8be6ab539e..64828b6677e 100644
--- a/ui-tui/src/__tests__/wheelAccel.test.ts
+++ b/ui-tui/src/__tests__/wheelAccel.test.ts
@@ -9,17 +9,6 @@ describe('wheelAccel — native path', () => {
expect(computeWheelStep(s, 1, 1000)).toBe(1)
})
- it('same-direction fast events ramp mult (window-mode)', () => {
- const s = initWheelAccel(false, 1)
-
- computeWheelStep(s, 1, 1000)
- computeWheelStep(s, 1, 1020)
- computeWheelStep(s, 1, 1040)
-
- // Key property: doesn't shrink below base.
- expect(computeWheelStep(s, 1, 1060)).toBeGreaterThanOrEqual(1)
- })
-
it('gap beyond window resets mult to base', () => {
const s = initWheelAccel(false, 1)
@@ -84,12 +73,6 @@ describe('wheelAccel — native path', () => {
})
describe('wheelAccel — xterm.js path', () => {
- it('first click returns 2 after long idle', () => {
- const s = initWheelAccel(true, 1)
-
- expect(computeWheelStep(s, 1, 1000)).toBeGreaterThanOrEqual(1)
- })
-
it('sub-5ms burst returns 1 (same-direction, same-batch)', () => {
const s = initWheelAccel(true, 1)
diff --git a/ui-tui/src/__tests__/widgetGridComponent.test.tsx b/ui-tui/src/__tests__/widgetGridComponent.test.tsx
index 2f05274d0b7..c9cd61e57dc 100644
--- a/ui-tui/src/__tests__/widgetGridComponent.test.tsx
+++ b/ui-tui/src/__tests__/widgetGridComponent.test.tsx
@@ -5,10 +5,9 @@ import { stripAnsi } from '@hermes/shared/ansi'
import React, { useState } from 'react'
import { describe, expect, it } from 'vitest'
-import { GridStreamsDemo, STREAM_DEFS } from '../components/gridStreamsDemo.js'
+import { STREAM_DEFS } from '../components/gridStreamsDemo.js'
import { GridAreas, type GridAreaWidget, WidgetGrid, type WidgetGridWidget } from '../components/widgetGrid.js'
import { GRID_STREAM_COUNT, type GridTestState } from '../sdk/apps/gridTestState.js'
-import { DEFAULT_THEME } from '../theme.js'
function StatefulCell({ label }: { label: string }) {
const [value] = useState(label)
@@ -128,16 +127,4 @@ describe('GridStreamsDemo', () => {
expect(STREAM_DEFS.length).toBe(GRID_STREAM_COUNT)
})
- it('renders every stream panel with the promoted panel in the header', () => {
- const output = renderToText(<GridStreamsDemo cols={90} state={streamsState} t={DEFAULT_THEME} />)
-
- expect(output).toContain('hermes mission control')
-
- for (const def of STREAM_DEFS) {
- expect(output).toContain(def.title)
- }
-
- // streamMain: 2 → the memory panel owns the promoted slot.
- expect(output).toContain('main: memory')
- })
})
diff --git a/ui-tui/src/__tests__/widgetSdk.test.ts b/ui-tui/src/__tests__/widgetSdk.test.ts
index ba6022b75e7..674d5397318 100644
--- a/ui-tui/src/__tests__/widgetSdk.test.ts
+++ b/ui-tui/src/__tests__/widgetSdk.test.ts
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it } from 'vitest'
import { getOverlayState, resetOverlayState } from '../app/overlayStore.js'
import { dialogTestApp, gridTestApp } from '../sdk/apps/index.js'
import { closeWidget, dispatchWidgetInput, launchWidget, openWidget } from '../sdk/host.js'
-import { getWidgetApp, listWidgetApps } from '../sdk/registry.js'
+import { getWidgetApp } from '../sdk/registry.js'
import type { WidgetInput } from '../sdk/types.js'
const key = (overrides: Partial<WidgetInput['key']> = {}, ch = ''): WidgetInput =>
@@ -15,13 +15,6 @@ const key = (overrides: Partial<WidgetInput['key']> = {}, ch = ''): WidgetInput
beforeEach(() => resetOverlayState())
describe('widget SDK host', () => {
- it('registers the reference apps', () => {
- expect(listWidgetApps().map(app => app.id)).toEqual(
- expect.arrayContaining(['dialog-test', 'grid-test', 'ticker', 'weather'])
- )
- expect(getWidgetApp('grid-test')).toBe(gridTestApp)
- })
-
it('launch → dispatch → close lifecycle drives the overlay slot', () => {
expect(launchWidget('grid-test', '5x2')).toBeNull()
expect(getOverlayState().widget).toMatchObject({ appId: 'grid-test' })
diff --git a/ui-tui/src/app/sessionResumeView.test.ts b/ui-tui/src/app/sessionResumeView.test.ts
index f2674291b6f..88642d72864 100644
--- a/ui-tui/src/app/sessionResumeView.test.ts
+++ b/ui-tui/src/app/sessionResumeView.test.ts
@@ -10,23 +10,7 @@ vi.mock('@hermes/ink', () => ({
forceRedraw: forceRedrawMock
}))
-import { refreshSessionView, scheduleResumeScrollToBottom } from './sessionResumeView.js'
-
-describe('refreshSessionView', () => {
- afterEach(() => {
- evictInkCachesMock.mockReset()
- forceRedrawMock.mockReset()
- })
-
- it('evicts Ink caches and forces a full repaint', () => {
- const stdout = {} as NodeJS.WriteStream
-
- refreshSessionView(stdout)
-
- expect(evictInkCachesMock).toHaveBeenCalledWith('all')
- expect(forceRedrawMock).toHaveBeenCalledWith(stdout)
- })
-})
+import { scheduleResumeScrollToBottom } from './sessionResumeView.js'
describe('scheduleResumeScrollToBottom', () => {
afterEach(() => {
diff --git a/ui-tui/src/app/slash/fuzzyScore.test.ts b/ui-tui/src/app/slash/fuzzyScore.test.ts
index d64b80f4127..acd7d399a78 100644
--- a/ui-tui/src/app/slash/fuzzyScore.test.ts
+++ b/ui-tui/src/app/slash/fuzzyScore.test.ts
@@ -37,12 +37,6 @@ describe('scoreSlashMenuItem', () => {
expect(scoreSlashMenuItem(item, 'caps')).toBe(2)
})
- it('scores description matches at the +3 offset, below any name tier', () => {
- expect(scoreSlashMenuItem({ description: 'Turn session recaps on/off', id: 'other' }, 'session')).toBe(3)
- expect(scoreSlashMenuItem({ description: 'Turn session recaps on/off', id: 'other' }, 'sess')).toBe(4)
- expect(scoreSlashMenuItem({ description: 'Turn session recaps on/off', id: 'other' }, 'essio')).toBe(5)
- })
-
it('prefers the name tier when both name and description match', () => {
expect(scoreSlashMenuItem(item, 'recap')).toBe(0)
})
diff --git a/ui-tui/src/lib/billingDialog.test.ts b/ui-tui/src/lib/billingDialog.test.ts
deleted file mode 100644
index ae30b72b4bd..00000000000
--- a/ui-tui/src/lib/billingDialog.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import type { BillingBlock } from '@hermes/shared/billing'
-import { describe, expect, it } from 'vitest'
-
-import { billingDialogCopy } from './billingDialog.js'
-
-function makeBlock(overrides: Partial<BillingBlock> = {}): BillingBlock {
- return {
- billing_url: 'https://openrouter.ai/settings/credits',
- is_nous: false,
- message: 'out of credits',
- model: 'x',
- provider: 'openrouter',
- provider_label: 'OpenRouter',
- ...overrides
- }
-}
-
-describe('billingDialogCopy', () => {
- it('routes Nous to the /topup flow', () => {
- const copy = billingDialogCopy(makeBlock({ is_nous: true, provider: 'nous', provider_label: 'Nous Portal' }))
- expect(copy.title).toContain('Nous')
- expect(copy.confirmLabel).toBe('Top up')
- expect(copy.cancelLabel).toBe('Dismiss')
- })
-
- it('offers to open a third-party provider billing page', () => {
- const copy = billingDialogCopy(makeBlock())
- expect(copy.title).toContain('OpenRouter')
- expect(copy.confirmLabel).toBe('Open billing page')
- })
-
- it('falls back to switching providers when there is no URL', () => {
- const copy = billingDialogCopy(makeBlock({ billing_url: null, provider_label: 'DeepSeek' }))
- expect(copy.title).toContain('DeepSeek')
- expect(copy.confirmLabel).toBe('Switch provider')
- })
-})
diff --git a/ui-tui/src/lib/liveProgress.test.ts b/ui-tui/src/lib/liveProgress.test.ts
index cea53d543fd..f5f1abc2fee 100644
--- a/ui-tui/src/lib/liveProgress.test.ts
+++ b/ui-tui/src/lib/liveProgress.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
import type { Msg } from '../types.js'
-import { appendToolShelfMessage, canHoldToolShelf, isTodoDone, mergeToolShelfInto } from './liveProgress.js'
+import { appendToolShelfMessage, canHoldToolShelf, isTodoDone } from './liveProgress.js'
describe('isTodoDone', () => {
it('only treats non-empty all-completed/cancelled lists as done', () => {
@@ -25,14 +25,6 @@ describe('tool shelf helpers', () => {
expect(canHoldToolShelf({ role: 'assistant', text: 'done' })).toBe(false)
})
- it('merges source rows into an existing shelf', () => {
- expect(
- mergeToolShelfInto(
- { kind: 'trail', role: 'system', text: '', thinking: 'plan', tools: ['one ✓'] },
- { kind: 'trail', role: 'system', text: '', tools: ['two ✓'] }
- )
- ).toEqual({ kind: 'trail', role: 'system', text: '', thinking: 'plan', tools: ['one ✓', 'two ✓'] })
- })
})
describe('appendToolShelfMessage', () => {
diff --git a/ui-tui/src/lib/memory.test.ts b/ui-tui/src/lib/memory.test.ts
index 92f177c7ef5..344a8819319 100644
--- a/ui-tui/src/lib/memory.test.ts
+++ b/ui-tui/src/lib/memory.test.ts
@@ -49,17 +49,6 @@ describe('performHeapDump auto opt-in gate (#21767)', () => {
expect(files.some(f => f.endsWith('.heapsnapshot'))).toBe(false)
})
- it('writes diagnostics only for auto-critical without HERMES_AUTO_HEAPDUMP', async () => {
- const result = await performHeapDump('auto-critical')
-
- expect(result.success).toBe(true)
- expect(result.suppressed).toBe(true)
- expect(result.heapPath).toBeUndefined()
-
- const files = readdirSync(dir)
- expect(files.some(f => f.endsWith('.heapsnapshot'))).toBe(false)
- })
-
it('writes both diagnostics and snapshot for auto-high when HERMES_AUTO_HEAPDUMP=1', async () => {
process.env.HERMES_AUTO_HEAPDUMP = '1'
@@ -74,16 +63,6 @@ describe('performHeapDump auto opt-in gate (#21767)', () => {
expect(files.some(f => f.endsWith('.heapsnapshot'))).toBe(true)
})
- it('accepts truthy spellings (true|yes|on, case-insensitive) as opt-in', async () => {
- for (const value of ['true', 'YES', 'On']) {
- process.env.HERMES_AUTO_HEAPDUMP = value
- const result = await performHeapDump('auto-high')
-
- expect(result.success).toBe(true)
- expect(result.heapPath).toBeDefined()
- }
- })
-
it('treats other values (0, off, garbage) as opt-out for auto triggers', async () => {
for (const value of ['0', 'off', 'nope']) {
process.env.HERMES_AUTO_HEAPDUMP = value
diff --git a/ui-tui/src/lib/messages.test.ts b/ui-tui/src/lib/messages.test.ts
deleted file mode 100644
index 422ddb1af90..00000000000
--- a/ui-tui/src/lib/messages.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import { appendTranscriptMessage } from './messages.js'
-
-describe('appendTranscriptMessage', () => {
- it('merges adjacent tool-only shelves into one transcript row', () => {
- const out = appendTranscriptMessage([{ kind: 'trail', role: 'system', text: '', tools: ['Terminal("one") ✓'] }], {
- kind: 'trail',
- role: 'system',
- text: '',
- tools: ['Terminal("two") ✓']
- })
-
- expect(out).toEqual([
- { kind: 'trail', role: 'system', text: '', tools: ['Terminal("one") ✓', 'Terminal("two") ✓'] }
- ])
- })
-
- it('merges tool shelves into the nearest thinking shelf', () => {
- const out = appendTranscriptMessage(
- [{ kind: 'trail', role: 'system', text: '', thinking: 'plan', tools: ['Terminal("one") ✓'] }],
- { kind: 'trail', role: 'system', text: '', tools: ['Terminal("two") ✓'] }
- )
-
- expect(out).toEqual([
- { kind: 'trail', role: 'system', text: '', thinking: 'plan', tools: ['Terminal("one") ✓', 'Terminal("two") ✓'] }
- ])
- })
-})
diff --git a/ui-tui/src/lib/openExternalUrl.test.ts b/ui-tui/src/lib/openExternalUrl.test.ts
index 3d280da3687..9fde6e768a3 100644
--- a/ui-tui/src/lib/openExternalUrl.test.ts
+++ b/ui-tui/src/lib/openExternalUrl.test.ts
@@ -124,13 +124,6 @@ describe('openExternalUrl', () => {
expect(calls[0]!.args).toEqual(['https://example.com/foo'])
})
- it('uses xdg-open on linux', () => {
- const { spawn, calls } = mockSpawn()
-
- openExternalUrl('https://example.com/', { spawn, platform: () => 'linux' })
- expect(calls[0]!.command).toBe('xdg-open')
- })
-
it('refuses to open file: URLs and does not spawn', () => {
const { spawn, calls } = mockSpawn()
diff --git a/ui-tui/src/lib/text.test.ts b/ui-tui/src/lib/text.test.ts
index 98c79300754..19f6ef143a1 100644
--- a/ui-tui/src/lib/text.test.ts
+++ b/ui-tui/src/lib/text.test.ts
@@ -49,12 +49,6 @@ describe('formatAbandonedClarify', () => {
expect(out.split('\n')[0]).toBe('ask trailing space')
})
- it('numbers options 1-based to match the live ClarifyPrompt', () => {
- const out = formatAbandonedClarify('q', ['first'], 'timed out')
-
- expect(out).toContain(' 1. first')
- expect(out).not.toContain(' 0.')
- })
})
describe('formatAbandonedClarifyBatch', () => {
diff --git a/ui-tui/src/lib/todo.test.ts b/ui-tui/src/lib/todo.test.ts
index 4b1a3933eaf..b63b051dd9e 100644
--- a/ui-tui/src/lib/todo.test.ts
+++ b/ui-tui/src/lib/todo.test.ts
@@ -1,24 +1,6 @@
import { describe, expect, it } from 'vitest'
-import { todoGlyph, todoTone, todoTree } from './todo.js'
-
-describe('todoGlyph', () => {
- it('uses fixed-width ASCII markers so the active row does not render wide or emoji-like', () => {
- expect(todoGlyph('completed')).toBe('[x]')
- expect(todoGlyph('in_progress')).toBe('[>]')
- expect(todoGlyph('pending')).toBe('[ ]')
- expect(todoGlyph('cancelled')).toBe('[-]')
- })
-})
-
-describe('todoTone', () => {
- it('keeps todo status rows neutral instead of red/green', () => {
- expect(todoTone('completed')).toBe('dim')
- expect(todoTone('cancelled')).toBe('dim')
- expect(todoTone('pending')).toBe('body')
- expect(todoTone('in_progress')).toBe('active')
- })
-})
+import { todoTree } from './todo.js'
describe('todoTree', () => {
it('orders parents before children with depths', () => {
diff --git a/web/src/components/ChatSidebar.test.tsx b/web/src/components/ChatSidebar.test.tsx
index 65f63fefb2b..997754a4c2f 100644
--- a/web/src/components/ChatSidebar.test.tsx
+++ b/web/src/components/ChatSidebar.test.tsx
@@ -235,7 +235,6 @@ describe('ChatSidebar event socket reconnect', () => {
await advance(1_000)
expect(FakeWebSocket.instances).toHaveLength(1)
- expect(container.textContent).toContain('reconnecting in 2s')
await advance(2_000)
expect(FakeWebSocket.instances).toHaveLength(2)
@@ -260,7 +259,6 @@ describe('ChatSidebar event socket reconnect', () => {
await advance(1_000 + EVENTS_CONNECT_TIMEOUT_MS)
expect(FakeWebSocket.instances).toHaveLength(1)
- expect(container.textContent).toContain('reconnecting in 2s')
// A late ticket response from the timed-out attempt must not create a
// superseded socket alongside the scheduled replacement.
@@ -286,7 +284,6 @@ describe('ChatSidebar event socket reconnect', () => {
await advance(EVENTS_CONNECT_TIMEOUT_MS)
expect(FakeWebSocket.instances[1].closed).toBe(true)
- expect(container.textContent).toContain('reconnecting in 2s')
await advance(2_000)
expect(FakeWebSocket.instances).toHaveLength(3)
@@ -464,8 +461,6 @@ describe('ChatSidebar event socket reconnect', () => {
})
})
- expect(container.textContent).toContain('No API key set for openrouter')
- expect(container.textContent).not.toContain('First message will fail')
const buttons = Array.from(container.querySelectorAll('button'))
const labels = buttons.map(b => b.textContent?.trim())
expect(labels).toContain('Add key')
@@ -479,16 +474,6 @@ describe('ChatSidebar event socket reconnect', () => {
expect(routerMocks.navigate).toHaveBeenCalledWith('/env')
})
- it('explains that only the side panel is affected when the sidecar cannot connect', async () => {
- gatewayMocks.connect.mockRejectedValueOnce(new Error('WebSocket connection failed'))
- await renderSidebar()
-
- await vi.waitFor(() => expect(container.textContent).toContain('Chat still works'))
- expect(container.textContent).not.toContain('WebSocket')
- const labels = Array.from(container.querySelectorAll('button')).map(b => b.textContent?.trim())
- expect(labels).toContain('Reconnect side panel')
- })
-
it('still reconnects while a foreign banner suppresses its message', async () => {
await renderSidebar()
diff --git a/web/src/components/MemoryPressureBanner.test.tsx b/web/src/components/MemoryPressureBanner.test.tsx
index c1ee756e1be..fa727d4a5bc 100644
--- a/web/src/components/MemoryPressureBanner.test.tsx
+++ b/web/src/components/MemoryPressureBanner.test.tsx
@@ -73,24 +73,6 @@ describe("MemoryPressureBanner", () => {
expect(banner()).toBeNull();
});
- it("shows the elevated warning", async () => {
- await render(
- <MemoryPressureBanner status={statusWith({ pressure: "elevated" })} />,
- );
- expect(banner()?.textContent).toContain("running low on memory");
- });
-
- it("shows the OOM-restart notice even when current pressure is ok", async () => {
- await render(
- <MemoryPressureBanner
- status={statusWith({ pressure: "ok", last_boot_suspected_oom: true })}
- />,
- );
- expect(banner()?.textContent).toContain(
- "restarted unexpectedly, most likely because it ran out of memory",
- );
- });
-
it("critical pressure outranks the OOM-restart notice", async () => {
await render(
<MemoryPressureBanner
@@ -275,15 +257,6 @@ describe("MemoryPressureBanner", () => {
expect(banner()?.textContent).toContain("(120 MB free)");
});
- it("shows the disk-elevated warning", async () => {
- await render(
- <MemoryPressureBanner
- status={statusWithDisk({ pressure: "elevated", free_mb: 900 })}
- />,
- );
- expect(banner()?.textContent).toContain("disk is filling up");
- });
-
it("disk critical outranks memory critical", async () => {
// Imminent data loss beats imminent restart.
await render(
diff --git a/web/src/components/OAuthLoginModal.test.tsx b/web/src/components/OAuthLoginModal.test.tsx
index 63453c3a7bd..4dbee63a755 100644
--- a/web/src/components/OAuthLoginModal.test.tsx
+++ b/web/src/components/OAuthLoginModal.test.tsx
@@ -160,7 +160,6 @@ describe("OAuthLoginModal local expiry", () => {
await exhaustCountdown(6);
await act(async () => {});
- expect(container.textContent).toContain("stalled in the opened tab");
// PKCE has no poll endpoint call at expiry.
expect(apiMocks.pollOAuthSession).not.toHaveBeenCalled();
});
diff --git a/web/src/lib/api-error.test.ts b/web/src/lib/api-error.test.ts
index 99965319e7b..0e9abaa56a3 100644
--- a/web/src/lib/api-error.test.ts
+++ b/web/src/lib/api-error.test.ts
@@ -58,7 +58,6 @@ describe("fetchJSON error contract", () => {
);
const err = (await fetchJSON("/api/status").catch((e: unknown) => e)) as ApiError;
expect(err.message).not.toMatch(/^\d{3}/);
- expect(err.message).toMatch(/internal error/i);
});
it("turns a network failure into the 'is hermes dashboard running' sentence", async () => {
@@ -75,30 +74,6 @@ describe("fetchJSON error contract", () => {
expect(err.status).toBe(0);
expect(err.body).toContain("Failed to fetch");
});
-
- it("logs status, path and body to the console so bug reports keep what the toast drops", async () => {
- const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
- vi.stubGlobal(
- "fetch",
- vi.fn<typeof fetch>(async () => new Response('{"detail":"nope"}', { status: 503 })),
- );
- await fetchJSON("/api/status").catch(() => null);
-
- const logged = warn.mock.calls.map((c) => c.map(String).join(" ")).join("\n");
- expect(logged).toContain("503");
- expect(logged).toContain("/api/status");
- expect(logged).toContain("nope");
-
- warn.mockClear();
- vi.stubGlobal(
- "fetch",
- vi.fn<typeof fetch>(async () => {
- throw new TypeError("Failed to fetch");
- }),
- );
- await fetchJSON("/api/status").catch(() => null);
- expect(warn.mock.calls.map((c) => c.map(String).join(" ")).join("\n")).toContain("Failed to fetch");
- });
});
describe("extractDetail", () => {
diff --git a/web/src/lib/api-plugins-catalog.test.ts b/web/src/lib/api-plugins-catalog.test.ts
deleted file mode 100644
index d2cc219f908..00000000000
--- a/web/src/lib/api-plugins-catalog.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { afterEach, describe, expect, it, vi } from "vitest";
-
-import { api } from "./api";
-
-afterEach(() => {
- vi.restoreAllMocks();
- vi.unstubAllGlobals();
-});
-
-function jsonFetchMock(body: unknown = { ok: true }) {
- return vi.fn<typeof fetch>(
- async () =>
- new Response(JSON.stringify(body), {
- headers: { "Content-Type": "application/json" },
- status: 200,
- }),
- );
-}
-
-describe("api.getPluginsCatalog", () => {
- it("fetches the dashboard plugins catalog endpoint", async () => {
- vi.stubGlobal("window", {});
-
- const fetchMock = jsonFetchMock({ entries: [], removed: [], generated_at: "" });
- vi.stubGlobal("fetch", fetchMock);
-
- const result = await api.getPluginsCatalog();
-
- expect(fetchMock).toHaveBeenCalledWith(
- "/api/dashboard/plugins/catalog",
- expect.objectContaining({ credentials: "include" }),
- );
- expect(result.entries).toEqual([]);
- expect(result.removed).toEqual([]);
- });
-});
-
-describe("api.installAgentPlugin with catalog_name", () => {
- it("posts catalog_name through to the install endpoint", async () => {
- vi.stubGlobal("window", {});
-
- const fetchMock = jsonFetchMock({ ok: true, plugin_name: "alpha-plugin" });
- vi.stubGlobal("fetch", fetchMock);
-
- await api.installAgentPlugin({
- identifier: "",
- catalog_name: "alpha-plugin",
- enable: false,
- });
-
- const [url, init] = fetchMock.mock.calls[0]!;
- expect(url).toBe("/api/dashboard/agent-plugins/install");
- const body = JSON.parse(String((init as RequestInit).body));
- expect(body.catalog_name).toBe("alpha-plugin");
- expect(body.identifier).toBe("");
- expect(body.enable).toBe(false);
- });
-});
diff --git a/web/src/lib/api.test.ts b/web/src/lib/api.test.ts
index 3a97b6131bc..7ff1ef335dc 100644
--- a/web/src/lib/api.test.ts
+++ b/web/src/lib/api.test.ts
@@ -96,19 +96,6 @@ describe("fetchJSON", () => {
});
describe("api.getModelOptions", () => {
- it("requests a live model refresh when asked", async () => {
- vi.stubGlobal("window", {});
-
- const fetchMock = jsonFetchMock({ providers: [] });
- vi.stubGlobal("fetch", fetchMock);
-
- await api.getModelOptions({ refresh: true });
-
- expect(fetchMock).toHaveBeenCalledWith(
- "/api/model/options?refresh=1&include_unconfigured=1",
- expect.objectContaining({ credentials: "include" }),
- );
- });
it("keeps explicit profile scoping when refreshing", async () => {
vi.stubGlobal("window", {});
diff --git a/web/src/lib/chat-sidebar-banner.test.ts b/web/src/lib/chat-sidebar-banner.test.ts
index 317e42f8ac6..f2b9ed8f929 100644
--- a/web/src/lib/chat-sidebar-banner.test.ts
+++ b/web/src/lib/chat-sidebar-banner.test.ts
@@ -7,7 +7,6 @@ describe('credentialWarning', () => {
const w = credentialWarning("No API key configured for provider 'openrouter'. First message will fail.")
expect(w?.provider).toBe('openrouter')
expect(w?.message).toContain('openrouter')
- expect(w?.message).toMatch(/Keys/)
expect(w?.message).not.toContain('First message will fail')
})
@@ -30,7 +29,6 @@ describe('sidecarErrorMessage', () => {
]) {
expect(sidecarErrorMessage(raw)).toBe(SIDECAR_DISCONNECTED_MESSAGE)
}
- expect(SIDECAR_DISCONNECTED_MESSAGE).toContain('Chat still works')
expect(sidecarErrorMessage("Profile 'nope' not found")).toBe("Profile 'nope' not found")
})
})
diff --git a/web/src/lib/clipboard-usage.test.ts b/web/src/lib/clipboard-usage.test.ts
deleted file mode 100644
index 84a7a024229..00000000000
--- a/web/src/lib/clipboard-usage.test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { readFileSync, readdirSync, statSync } from "node:fs";
-import { join, relative } from "node:path";
-import { describe, expect, it } from "vitest";
-
-// Regression guard: every dashboard copy action must go through
-// copyTextToClipboard (web/src/lib/clipboard.ts), which falls back to a
-// selection-based copy when the async Clipboard API is unavailable —
-// e.g. self-hosted dashboards served over plain HTTP on a LAN, where
-// window.isSecureContext is false and navigator.clipboard is undefined.
-//
-// Clipboard READS (paste paths) have no equivalent legacy fallback and are
-// exempt; they must feature-detect and fail soft instead.
-//
-// Ported from paperclipai/paperclip#10875.
-
-const SRC_ROOT = join(__dirname, "..");
-
-// The helper itself is the single allowed writer.
-const ALLOWLIST = new Set(["lib/clipboard.ts"]);
-
-function collectSourceFiles(dir: string, out: string[] = []): string[] {
- for (const entry of readdirSync(dir)) {
- const full = join(dir, entry);
- const st = statSync(full);
- if (st.isDirectory()) {
- collectSourceFiles(full, out);
- } else if (/\.(ts|tsx)$/.test(entry) && !/\.(test|spec)\.(ts|tsx)$/.test(entry)) {
- out.push(full);
- }
- }
- return out;
-}
-
-describe("clipboard write regression guard", () => {
- it("web/src has no direct navigator.clipboard write calls outside lib/clipboard.ts", () => {
- const offenders: string[] = [];
- for (const file of collectSourceFiles(SRC_ROOT)) {
- const rel = relative(SRC_ROOT, file).replace(/\\/g, "/");
- if (ALLOWLIST.has(rel)) continue;
- const source = readFileSync(file, "utf8");
- // Match writeText / write on navigator.clipboard (incl. optional
- // chaining); reads (read / readText) are intentionally not matched.
- const pattern = /navigator\.clipboard\??\s*\.\s*write(Text)?\s*[(.]/g;
- let match: RegExpExecArray | null;
- while ((match = pattern.exec(source)) !== null) {
- const line = source.slice(0, match.index).split("\n").length;
- offenders.push(`${rel}:${line}`);
- }
- }
- expect(
- offenders,
- `Direct navigator.clipboard writes found — use copyTextToClipboard from "@/lib/clipboard" instead:\n${offenders.join("\n")}`,
- ).toEqual([]);
- });
-});
diff --git a/web/src/lib/dashboard-modal-shell.test.ts b/web/src/lib/dashboard-modal-shell.test.ts
deleted file mode 100644
index 2f358ebd21d..00000000000
--- a/web/src/lib/dashboard-modal-shell.test.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { describe, expect, it } from "vitest";
-import {
- DASHBOARD_MODAL_BACKDROP,
- DASHBOARD_MODAL_PANEL,
- shouldCloseOuterModalOnEscape,
-} from "./dashboard-modal-shell";
-
-describe("dashboard modal shell", () => {
- it("uses an opaque panel (bg-card), not the glass Card default", () => {
- expect(DASHBOARD_MODAL_PANEL).toMatch(/\bbg-card\b/);
- expect(DASHBOARD_MODAL_PANEL).not.toMatch(/bg-background-base\/\d+/);
- });
-
- it("keeps the backdrop above page chrome (z-[100])", () => {
- expect(DASHBOARD_MODAL_BACKDROP).toMatch(/z-\[100\]/);
- expect(DASHBOARD_MODAL_BACKDROP).toMatch(/\bbg-background\/85\b/);
- });
-
- it("does not close the outer modal on Escape while a nested picker is open", () => {
- expect(shouldCloseOuterModalOnEscape(true)).toBe(false);
- expect(shouldCloseOuterModalOnEscape(false)).toBe(true);
- });
-});
diff --git a/web/src/lib/events-reconnect.test.ts b/web/src/lib/events-reconnect.test.ts
index 4fa7899506e..fee5de1c908 100644
--- a/web/src/lib/events-reconnect.test.ts
+++ b/web/src/lib/events-reconnect.test.ts
@@ -43,10 +43,6 @@ describe("eventsReconnectDelayMs", () => {
previous = delay;
}
});
-
- it("stays finite for absurd attempt counts", () => {
- expect(Number.isFinite(eventsReconnectDelayMs(10_000))).toBe(true);
- });
});
describe("shouldRetryEventsClose", () => {
@@ -105,32 +101,4 @@ describe("reconnect message copy", () => {
expect(eventsReconnectingMessage(1_000)).toContain("1s");
expect(eventsReconnectingMessage(30_000)).toContain("30s");
});
-
- it("tells the user to reload on an auth rejection without printing the close code", () => {
- expect(eventsRejectedMessage(4403)).toMatch(/reload the page/i);
- expect(eventsRejectedMessage(4403)).not.toContain("4403");
- });
-
- it("never names the transport ('events feed', 'WebSocket') in user-facing copy", () => {
- for (const message of [
- EVENTS_DISCONNECTED_MESSAGE,
- eventsReconnectingMessage(1_000),
- eventsRejectedMessage(4401),
- eventsGaveUpMessage(),
- ]) {
- expect(message).not.toMatch(/events feed|websocket/i);
- }
- });
-
- it("does not reference the tools box removed in #51737", () => {
- const messages = [
- EVENTS_DISCONNECTED_MESSAGE,
- eventsReconnectingMessage(1_000),
- eventsRejectedMessage(4401),
- eventsGaveUpMessage(),
- ];
- for (const message of messages) {
- expect(message).not.toContain("tool calls");
- }
- });
});
diff --git a/web/src/lib/load-error-copy.test.ts b/web/src/lib/load-error-copy.test.ts
index 052fdf15fb7..11885336b20 100644
--- a/web/src/lib/load-error-copy.test.ts
+++ b/web/src/lib/load-error-copy.test.ts
@@ -6,7 +6,7 @@ import { loadErrorCopy } from "./load-error-copy";
describe("loadErrorCopy", () => {
it("fills the translated template with what failed and the detail line", () => {
const copy = loadErrorCopy(en.common, en.cron.loadWhat!, "The Hermes service hit an internal error.");
- expect(copy.title).toContain("cron jobs");
+ expect(copy.title).toContain(en.cron.loadWhat!);
expect(copy.title).not.toContain("{what}");
expect(copy.title).toContain(en.common.retry);
expect(copy.details).toContain("internal error");
@@ -17,14 +17,4 @@ describe("loadErrorCopy", () => {
expect(loadErrorCopy(en.common, en.skills.loadWhat!, null).details).toBeNull();
expect(loadErrorCopy(en.common, en.skills.loadWhat!, "").details).toBeNull();
});
-
- it("keeps the page strings in the locale table rather than the component", () => {
- for (const key of [en.skills.browseHub, en.skills.createSkill, en.cron.scriptRequired]) {
- expect(typeof key).toBe("string");
- expect(key!.trim()).not.toBe("");
- }
- // The script-only message names the field, not the `no_agent` config key.
- expect(en.cron.scriptRequired).toContain("Script");
- expect(en.cron.scriptRequired).not.toContain("no_agent");
- });
});
diff --git a/web/src/lib/profile-bootstrap.test.ts b/web/src/lib/profile-bootstrap.test.ts
index 90d46e95db6..453ae9dd6e0 100644
--- a/web/src/lib/profile-bootstrap.test.ts
+++ b/web/src/lib/profile-bootstrap.test.ts
@@ -11,25 +11,6 @@ afterEach(() => {
});
describe("initialProfileScope", () => {
- it("inherits the dashboard bootstrap profile when the URL omits profile", () => {
- expect(initialProfileScope(new URLSearchParams("resume=session-1"), "worker_x"))
- .toBe("worker_x");
- });
-
- it("keeps an explicit URL profile authoritative", () => {
- expect(
- initialProfileScope(
- new URLSearchParams("resume=session-1&profile=review"),
- "worker_x",
- ),
- ).toBe("review");
- });
-
- it("preserves an explicit empty profile", () => {
- expect(
- initialProfileScope(new URLSearchParams("profile="), "worker_x"),
- ).toBe("");
- });
it("does not replace a launch profile with the sticky active profile", () => {
expect(
diff --git a/web/src/lib/pty-close-copy.test.ts b/web/src/lib/pty-close-copy.test.ts
index 9f8786d63e6..1be7b5c9d0e 100644
--- a/web/src/lib/pty-close-copy.test.ts
+++ b/web/src/lib/pty-close-copy.test.ts
@@ -2,35 +2,20 @@ import { describe, expect, it } from 'vitest'
import {
PTY_GAVE_UP_BANNER,
- PTY_RECONNECTING_BANNER,
- PTY_SESSION_ENDED_MESSAGE,
- PTY_START_FAILED_MESSAGE,
PTY_TOKEN_MISSING_BANNER,
ptyReconnectExhausted,
ptyRejectionBanner
} from './pty-close-copy'
-describe('pty close copy', () => {
- it('offers a Reload action for the stale-token and missing-token cases without naming auth internals', () => {
- const stale = ptyRejectionBanner(4401)
- expect(stale?.action).toBe('reload')
- expect(stale?.text).toMatch(/reload the page/i)
- expect(stale?.text).not.toMatch(/auth failed|bad-token|4401/i)
-
+describe('pty close banners', () => {
+ it('offers a Reload action for the stale-token and missing-token cases', () => {
+ expect(ptyRejectionBanner(4401)?.action).toBe('reload')
expect(PTY_TOKEN_MISSING_BANNER.action).toBe('reload')
- expect(PTY_TOKEN_MISSING_BANNER.text).not.toMatch(/session token/i)
- expect(PTY_TOKEN_MISSING_BANNER.text).toContain('hermes dashboard')
})
- it('never prints a WebSocket close code in user-facing text', () => {
- const texts = [
- PTY_RECONNECTING_BANNER,
- PTY_GAVE_UP_BANNER.text,
- PTY_SESSION_ENDED_MESSAGE,
- ...[4401, 4403, 4404, 4408].map(code => ptyRejectionBanner(code)!.text)
- ]
- for (const text of texts) {
- expect(text).not.toMatch(/\b(code\s*)?\d{4}\b/)
+ it('treats server rejections as banners but not transient drops or the agent exit', () => {
+ for (const code of [4401, 4403, 4404, 4408]) {
+ expect(ptyRejectionBanner(code)).not.toBeNull()
}
// Transient drops and the agent's own exit are not rejections: the caller
// must route them to the reconnect ladder / restart affordance instead.
@@ -38,20 +23,9 @@ describe('pty close copy', () => {
expect(ptyRejectionBanner(4410)).toBeNull()
})
- it('says retries stopped and points at the server after the last attempt', () => {
+ it('stops retrying after the last attempt and points at the server', () => {
expect(ptyReconnectExhausted(5, 5)).toBe(true)
expect(ptyReconnectExhausted(4, 5)).toBe(false)
expect(PTY_GAVE_UP_BANNER.action).toBe('check-server')
- expect(PTY_GAVE_UP_BANNER.text).toContain('hermes dashboard')
- expect(PTY_SESSION_ENDED_MESSAGE).toMatch(/crashed/i)
- expect(PTY_SESSION_ENDED_MESSAGE).toMatch(/logs/i)
- })
-})
-
-describe('start-failed overlay copy', () => {
- it('stays neutral: close 1011 also means "no terminal support here", where retrying cannot help', () => {
- expect(PTY_START_FAILED_MESSAGE).toMatch(/printed above/)
- expect(PTY_START_FAILED_MESSAGE).not.toMatch(/fix it|Start new session/)
- expect(PTY_START_FAILED_MESSAGE).not.toMatch(/1011/)
})
})
diff --git a/web/src/lib/pty-reconnect.test.ts b/web/src/lib/pty-reconnect.test.ts
index 995076d41b6..f74064c0106 100644
--- a/web/src/lib/pty-reconnect.test.ts
+++ b/web/src/lib/pty-reconnect.test.ts
@@ -2,7 +2,6 @@ import { describe, expect, it } from 'vitest'
import {
PTY_RECONNECT_BASE_MS,
- PTY_RECONNECT_MAX_ATTEMPTS,
PTY_RECONNECT_MAX_MS,
ptyReconnectDelayMs,
shouldBlockPtyInput,
@@ -141,10 +140,8 @@ describe('shouldBlockPtyInput', () => {
describe('ptyReconnectDelayMs', () => {
it('doubles from the base on each attempt and clamps at the cap', () => {
- expect(Array.from({ length: PTY_RECONNECT_MAX_ATTEMPTS }, (_, i) => ptyReconnectDelayMs(i + 1))).toEqual([
- 250, 500, 1000, 2000, 3000
- ])
expect(ptyReconnectDelayMs(1)).toBe(PTY_RECONNECT_BASE_MS)
+ expect(ptyReconnectDelayMs(2)).toBe(Math.min(PTY_RECONNECT_BASE_MS * 2, PTY_RECONNECT_MAX_MS))
expect(ptyReconnectDelayMs(99)).toBe(PTY_RECONNECT_MAX_MS)
})
})
diff --git a/web/src/lib/pty-resume-loading.test.ts b/web/src/lib/pty-resume-loading.test.ts
index 72f6e5f779b..01a5ae9db99 100644
--- a/web/src/lib/pty-resume-loading.test.ts
+++ b/web/src/lib/pty-resume-loading.test.ts
@@ -2,22 +2,10 @@ import { describe, expect, it } from "vitest";
import { PtyResumeSanitizer } from "./pty-resume-sanitizer";
import {
- PTY_RESUME_LOADING_MAX_MS,
shouldFinishResumeHydrationOnChunk,
shouldShowResumeLoadingOverlay,
} from "./pty-resume-loading";
-describe("shouldFinishResumeHydrationOnChunk", () => {
- it("finishes on the first non-empty chunk", () => {
- expect(shouldFinishResumeHydrationOnChunk("")).toBe(false);
- expect(shouldFinishResumeHydrationOnChunk("hello")).toBe(true);
- });
-
- it("keeps a positive hard-cap timeout for wedged resumes", () => {
- expect(PTY_RESUME_LOADING_MAX_MS).toBeGreaterThan(0);
- });
-});
-
describe("resume hydration gate over the real sanitizer", () => {
// Regression: the gate must key off the payload actually written to xterm,
// not the raw frame. The sanitizer collapses an erase-only / all-newline /
diff --git a/web/src/lib/pty-scroll.test.ts b/web/src/lib/pty-scroll.test.ts
index d87ea5967af..4cd0ac07c68 100644
--- a/web/src/lib/pty-scroll.test.ts
+++ b/web/src/lib/pty-scroll.test.ts
@@ -43,10 +43,6 @@ describe("shouldFollowPtyOutput", () => {
expect(shouldFollowPtyOutput(null, true)).toBe(false);
});
- it("does not follow a fresh session even when stickToBottom is true", () => {
- expect(shouldFollowPtyOutput(null, false)).toBe(false);
- });
-
it("treats an empty resume param as non-resume", () => {
expect(shouldFollowPtyOutput("", true)).toBe(false);
});
diff --git a/web/src/lib/reasoning-effort.test.ts b/web/src/lib/reasoning-effort.test.ts
index 9c2d0b139ae..05a1a84e00d 100644
--- a/web/src/lib/reasoning-effort.test.ts
+++ b/web/src/lib/reasoning-effort.test.ts
@@ -14,7 +14,7 @@ describe("normalizeEffort", () => {
});
it("passes through every valid effort level", () => {
- for (const level of ["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]) {
+ for (const level of VALID_EFFORTS) {
expect(normalizeEffort(level)).toBe(level);
}
});
@@ -36,12 +36,4 @@ describe("EFFORT_OPTIONS", () => {
expect(VALID_EFFORTS.has(opt.value)).toBe(true);
}
});
-
- it("covers the real reasoning levels plus thinking-off", () => {
- // Invariant against hermes_constants.VALID_REASONING_EFFORTS + 'none'.
- const values = new Set(EFFORT_OPTIONS.map((o) => o.value));
- for (const level of ["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]) {
- expect(values.has(level)).toBe(true);
- }
- });
});
diff --git a/web/src/lib/resolve-page-title.test.ts b/web/src/lib/resolve-page-title.test.ts
index 8b2f5694b97..9319b3f4805 100644
--- a/web/src/lib/resolve-page-title.test.ts
+++ b/web/src/lib/resolve-page-title.test.ts
@@ -29,16 +29,6 @@ describe("resolvePageTitle", () => {
expect(resolvePageTitle("/env", t, [])).toBe("Keys");
});
- it("renders initialisms and literal labels correctly", () => {
- // Regression: the naive capitalize fallback produced "Mcp".
- expect(resolvePageTitle("/mcp", t, [])).toBe("MCP");
- expect(resolvePageTitle("/system", t, [])).toBe("System");
- expect(resolvePageTitle("/channels", t, [])).toBe("Channels");
- expect(resolvePageTitle("/webhooks", t, [])).toBe("Webhooks");
- expect(resolvePageTitle("/pairing", t, [])).toBe("Pairing");
- expect(resolvePageTitle("/files", t, [])).toBe("Files");
- });
-
it("prefers plugin tab labels", () => {
expect(
resolvePageTitle("/kanban", t, [{ path: "/kanban", label: "Kanban" }]),
diff --git a/web/src/lib/session-prune.test.ts b/web/src/lib/session-prune.test.ts
deleted file mode 100644
index cedb04e6bb9..00000000000
--- a/web/src/lib/session-prune.test.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import { formatSessionPruneResult } from './session-prune'
-
-describe('formatSessionPruneResult', () => {
- it('reports open sessions skipped by the prune safety guard', () => {
- expect(formatSessionPruneResult({ removed: 0, skipped_open: 2 })).toBe(
- 'Pruned 0 sessions. Skipped 2 open sessions; prune only removes ended sessions.'
- )
- })
-
- it('keeps the existing success message when nothing was skipped', () => {
- expect(formatSessionPruneResult({ removed: 1, skipped_open: 0 })).toBe('Pruned 1 session')
- })
-})
diff --git a/web/src/lib/shared-gateway.test.ts b/web/src/lib/shared-gateway.test.ts
index 8dc8abfcef5..a39232c7cd4 100644
--- a/web/src/lib/shared-gateway.test.ts
+++ b/web/src/lib/shared-gateway.test.ts
@@ -44,8 +44,6 @@ describe("gatewayActionFailedMessage", () => {
it("does not double punctuation when the detail already ends a sentence", () => {
const text = gatewayActionFailedMessage("restart", "Is `hermes dashboard` still running?");
expect(text).not.toMatch(/[?!.]\./);
- expect(text).toMatch(/^Could not restart the gateway: /);
- expect(text).toContain("still running? Open Logs");
});
it("skips the Logs pointer when the dashboard itself is unreachable", () => {
@@ -53,7 +51,7 @@ describe("gatewayActionFailedMessage", () => {
expect(gatewayActionFailedMessage("start", "down", unreachable)).not.toContain("Logs");
const serverError = new ApiError("boom", { status: 500, body: "", url: "/api/gateway/start" });
- expect(gatewayActionFailedMessage("start", "boom.", serverError)).toContain("Open Logs for details.");
+ expect(gatewayActionFailedMessage("start", "boom.", serverError)).toContain("Logs");
expect(gatewayActionFailedMessage("start", "boom.", serverError)).not.toContain("boom..");
});
});
diff --git a/web/src/pages/ChatPage.test.tsx b/web/src/pages/ChatPage.test.tsx
index 10e8e04f32f..035af075807 100644
--- a/web/src/pages/ChatPage.test.tsx
+++ b/web/src/pages/ChatPage.test.tsx
@@ -396,7 +396,7 @@ describe("ChatPage", () => {
expect(maybeReloadForLoopbackWsAuthFailure).toHaveBeenCalledWith(4401);
});
- it("explains an expired login in plain words with a Reload button when auto-reload is spent", async () => {
+ it("offers a Reload button for an expired login when auto-reload is spent", async () => {
const { default: ChatPage } = await import("./ChatPage");
await render(
<MemoryRouter initialEntries={["/chat"]}>
@@ -409,9 +409,6 @@ describe("ChatPage", () => {
FakeWebSocket.instances[0].onclose?.({ code: 4401, reason: "auth: bad-token", wasClean: true });
});
- const alert = container.querySelector('[role="alert"]');
- expect(alert?.textContent).toMatch(/login expired/i);
- expect(alert?.textContent).not.toMatch(/auth failed|bad-token|4401/i);
const labels = Array.from(container.querySelectorAll("button")).map((b) => b.textContent?.trim());
expect(labels).toContain("Reload page");
});
@@ -429,12 +426,11 @@ describe("ChatPage", () => {
FakeWebSocket.instances[0].onclose?.({ code: 1011, reason: "", wasClean: true });
});
- expect(container.textContent).toMatch(/Chat could not start/);
const labels = Array.from(container.querySelectorAll("button")).map((b) => b.textContent?.trim());
expect(labels).toContain("Start new session");
});
- it("offers Open logs when the agent process ended, since a crash looks like /exit", async () => {
+ it("offers Start new session and Open logs when the agent process ended", async () => {
const { default: ChatPage } = await import("./ChatPage");
await render(
<MemoryRouter initialEntries={["/chat"]}>
@@ -447,7 +443,6 @@ describe("ChatPage", () => {
FakeWebSocket.instances[0].onclose?.({ code: 4410, reason: "", wasClean: true });
});
- expect(container.textContent).toMatch(/may have crashed/i);
const labels = Array.from(container.querySelectorAll("button")).map((b) => b.textContent?.trim());
expect(labels).toContain("Start new session");
expect(labels).toContain("Open logs");
@@ -475,9 +470,6 @@ describe("ChatPage", () => {
});
}
- expect(container.textContent).not.toMatch(/code 1006/);
- expect(container.textContent).toMatch(/Lost connection to the Hermes dashboard server/);
- expect(container.textContent).toContain("hermes dashboard");
const labels = Array.from(container.querySelectorAll("button")).map((b) => b.textContent?.trim());
expect(labels).toContain("Reconnect now");
expect(labels).toContain("Check server status");
diff --git a/web/src/plugins/registry.test.ts b/web/src/plugins/registry.test.ts
deleted file mode 100644
index 13b5e4c57a2..00000000000
--- a/web/src/plugins/registry.test.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Smoke test for the plugin SDK surface additions.
- *
- * Verifies that `exposePluginSDK()` writes the new dialog/toast primitives to
- * `window.__HERMES_PLUGIN_SDK__`. Each new key is checked individually so a
- * regression in one helper doesn't mask the others.
- *
- * Companion to the additive PR "feat(plugins): expose Dialog/ConfirmDialog/
- * Toast/useToast/useConfirmDelete on the plugin SDK". See issue #50547.
- */
-import { beforeEach, describe, expect, it } from "vitest";
-import { exposePluginSDK } from "./registry";
-
-describe("plugin SDK dialog/toast surface", () => {
- beforeEach(() => {
- // Reset window between tests so exposePluginSDK() writes fresh.
- (globalThis as unknown as { window: Record<string, unknown> }).window = {
- __HERMES_PLUGINS__: undefined,
- __HERMES_PLUGIN_SDK__: undefined,
- };
- });
-
- it("exposes Dialog + subcomponents on components", () => {
- exposePluginSDK();
- const sdk = (globalThis as unknown as { window: { __HERMES_PLUGIN_SDK__: { components: Record<string, unknown>; hooks: Record<string, unknown> } } }).window.__HERMES_PLUGIN_SDK__;
- expect(sdk.components.Dialog).toBeDefined();
- expect(sdk.components.DialogContent).toBeDefined();
- expect(sdk.components.DialogHeader).toBeDefined();
- expect(sdk.components.DialogTitle).toBeDefined();
- expect(sdk.components.DialogDescription).toBeDefined();
- expect(sdk.components.DialogFooter).toBeDefined();
- expect(sdk.components.DialogClose).toBeDefined();
- expect(sdk.components.ConfirmDialog).toBeDefined();
- expect(sdk.components.Toast).toBeDefined();
- });
-
- it("exposes useToast and useConfirmDelete on hooks", () => {
- exposePluginSDK();
- const sdk = (globalThis as unknown as { window: { __HERMES_PLUGIN_SDK__: { components: Record<string, unknown>; hooks: Record<string, unknown> } } }).window.__HERMES_PLUGIN_SDK__;
- expect(typeof sdk.hooks.useToast).toBe("function");
- expect(typeof sdk.hooks.useConfirmDelete).toBe("function");
- // Original React hooks still present (no accidental removal).
- expect(typeof sdk.hooks.useState).toBe("function");
- expect(typeof sdk.hooks.useCallback).toBe("function");
- });
-});
\ No newline at end of file
diff --git a/web/src/plugins/usePlugins.test.ts b/web/src/plugins/usePlugins.test.ts
index 05d0cd40dbf..ac948374f0c 100644
--- a/web/src/plugins/usePlugins.test.ts
+++ b/web/src/plugins/usePlugins.test.ts
@@ -69,11 +69,6 @@ describe("plugin manifest cache helpers", () => {
expect(getCachedManifests()).toBeNull();
});
- it("getCachedManifests returns null for scalar JSON", () => {
- storage.setItem(MANIFEST_CACHE_KEY, JSON.stringify(42));
- expect(getCachedManifests()).toBeNull();
- });
-
it("getCachedManifests returns a valid manifest array", () => {
const list: PluginManifest[] = [exampleManifest];
cacheManifests(list);