mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 08:01:56 +00:00
test: retire the last private-predicate duplicates in the leaked-internals sweep (#23949)
Sixth and final wave over the modules that export symbols only tests import.
Deletes private-predicate cases whose behavior is already asserted through the
module's real entry point, then makes the symbol private again.
Also removes three distinct junk shapes the earlier detectors missed:
- a self-comparison whose expected empty row was produced by the helper under
test (`worktree-palette-search`), now a literal;
- expected values computed by a sibling helper rather than asserted
(`terminal-theme`), now read through the production `getBuiltinTheme`;
- a negative control that cannot fail — `expect('json' in jsonlMonarchLanguage)
.toBe(false)`, where `IMonarchLanguage` has no such key, so it guarded nothing
while appearing to guard "does not attach the JSON language service".
Dead production code removed where tests were its only callers:
`refreshWindowsTerminalCapabilities` (a one-line alias for
`loadWindowsTerminalCapabilities({force: true})`), `readSpoolRecords`,
`buildAgentPromptSubmitBytes`, and `getCommitMessageModelCapability`.
About 70% of everything this detector flagged across the whole vein was a false
positive, so most modules were left untouched. Bounds consumed as test input,
`*ForTests` seams, non-hook cores of `useSyncExternalStore` hooks, and
value-position registrations all look identical to a leaked internal from the
outside and are not.
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
||||
AGENT_HOOK_SPOOL_MAX_FILES,
|
||||
drainAgentHookSpool,
|
||||
launchTokenHash,
|
||||
readSpoolRecords,
|
||||
type SpoolRecord
|
||||
} from '../../shared/agent-hook-spool'
|
||||
import { AgentHookServer, _internals } from './server'
|
||||
@@ -35,16 +34,6 @@ describe('agent hook spool', () => {
|
||||
expect(spoolLine).toContain('"$spool_now" "$payload"')
|
||||
})
|
||||
|
||||
it('drops torn lines while retaining complete records', () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'orca-spool-'))
|
||||
const file = join(dir, 'pane.jsonl')
|
||||
writeFileSync(
|
||||
file,
|
||||
'\n{"paneKey":"tab:1","source":"codex","receivedAt":1,"payload":{}}\n{"paneKey":'
|
||||
)
|
||||
expect(readSpoolRecords(file, 1)).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('waits for a newline before replaying a complete-looking final record', () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'orca-spool-unterminated-'))
|
||||
const spool = join(dir, 'spool')
|
||||
@@ -63,7 +52,6 @@ describe('agent hook spool', () => {
|
||||
getPersistedLaunchTokenHash: () => undefined,
|
||||
ingest: (value: SpoolRecord) => ingested.push(value)
|
||||
}
|
||||
expect(readSpoolRecords(file)).toHaveLength(0)
|
||||
expect(drainAgentHookSpool(options)).toBe(0)
|
||||
expect(readFileSync(file, 'utf8')).toBe(record)
|
||||
|
||||
|
||||
@@ -45,13 +45,6 @@ describe('registerJsonlLanguage', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('does not attach the JSON language service / diagnostics', () => {
|
||||
// Why: whole-document JSON validation would flag every record after line one
|
||||
// as trailing content. A Monarch tokens provider is presentation-only.
|
||||
expect(jsonlMonarchLanguage.tokenizer).toBeDefined()
|
||||
expect('json' in jsonlMonarchLanguage).toBe(false)
|
||||
})
|
||||
|
||||
it('registers once and is idempotent when the language already exists', () => {
|
||||
const monaco = createMonacoMock([JSONL_LANGUAGE_ID])
|
||||
|
||||
|
||||
@@ -4,29 +4,9 @@ import {
|
||||
configureLazyArabicShapingJoiner,
|
||||
ensureArabicShapingJoinerForText,
|
||||
findRtlJoinRanges,
|
||||
isStrongRtlCodePoint,
|
||||
registerArabicShapingJoiner
|
||||
} from './terminal-arabic-shaping-joiner'
|
||||
|
||||
describe('isStrongRtlCodePoint', () => {
|
||||
it('classifies Arabic and Hebrew letters as strong RTL', () => {
|
||||
expect(isStrongRtlCodePoint('م'.codePointAt(0)!)).toBe(true)
|
||||
expect(isStrongRtlCodePoint('ش'.codePointAt(0)!)).toBe(true)
|
||||
expect(isStrongRtlCodePoint('א'.codePointAt(0)!)).toBe(true)
|
||||
// Arabic presentation forms (legacy shaped codepoints).
|
||||
expect(isStrongRtlCodePoint(0xfe8d)).toBe(true)
|
||||
// Adlam (supplementary plane).
|
||||
expect(isStrongRtlCodePoint(0x1e900)).toBe(true)
|
||||
})
|
||||
|
||||
it('does not classify Latin, box drawing, CJK, or emoji as RTL', () => {
|
||||
expect(isStrongRtlCodePoint('a'.codePointAt(0)!)).toBe(false)
|
||||
expect(isStrongRtlCodePoint('│'.codePointAt(0)!)).toBe(false)
|
||||
expect(isStrongRtlCodePoint('漢'.codePointAt(0)!)).toBe(false)
|
||||
expect(isStrongRtlCodePoint(0x1f600)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('findRtlJoinRanges', () => {
|
||||
it('returns no ranges for plain ASCII text', () => {
|
||||
expect(findRtlJoinRanges('ls -la | grep foo && echo done')).toEqual([])
|
||||
|
||||
@@ -19,7 +19,7 @@ const lazyArabicShapingJoinerByTerminal = new WeakMap<
|
||||
// Every strong-RTL block sits at/above U+0590, so ASCII/Latin bails out with a single charCodeAt sweep.
|
||||
const RTL_SCAN_FLOOR = 0x0590
|
||||
|
||||
export function isStrongRtlCodePoint(codePoint: number): boolean {
|
||||
function isStrongRtlCodePoint(codePoint: number): boolean {
|
||||
return (
|
||||
// One contiguous strong-RTL span (Hebrew through Arabic Extended-A).
|
||||
(codePoint >= 0x0590 && codePoint <= 0x08ff) ||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
buildTerminalKeyboardProtocolOptions,
|
||||
prefersKittyKeyboardDespiteWindowsConpty,
|
||||
shouldDisableKittyKeyboardForTerminal
|
||||
} from './terminal-keyboard-protocol'
|
||||
|
||||
@@ -18,16 +17,6 @@ const localWindowsConpty = {
|
||||
executionHostId: 'local' as const
|
||||
}
|
||||
|
||||
describe('prefersKittyKeyboardDespiteWindowsConpty', () => {
|
||||
it('is true only for Grok (needs KKP for modified Enter on ConPTY)', () => {
|
||||
expect(prefersKittyKeyboardDespiteWindowsConpty('grok')).toBe(true)
|
||||
expect(prefersKittyKeyboardDespiteWindowsConpty('claude')).toBe(false)
|
||||
expect(prefersKittyKeyboardDespiteWindowsConpty('codex')).toBe(false)
|
||||
expect(prefersKittyKeyboardDespiteWindowsConpty(null)).toBe(false)
|
||||
expect(prefersKittyKeyboardDespiteWindowsConpty(undefined)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('shouldDisableKittyKeyboardForTerminal', () => {
|
||||
it('disables Kitty keyboard for a local native Windows ConPTY pane', () => {
|
||||
// Regression for #2434: local Windows CLIs (e.g. Antigravity agy) read the
|
||||
|
||||
@@ -21,9 +21,7 @@ export type TerminalKeyboardProtocolContext = WindowsPtyCompatibilityContext & {
|
||||
* targets CSI-u-blind CLIs (e.g. Antigravity); Grok is not in that set and
|
||||
* relies on KKP for interject vs newline (official Grok Build keyboard docs).
|
||||
*/
|
||||
export function prefersKittyKeyboardDespiteWindowsConpty(
|
||||
agent: TuiAgent | null | undefined
|
||||
): boolean {
|
||||
function prefersKittyKeyboardDespiteWindowsConpty(agent: TuiAgent | null | undefined): boolean {
|
||||
return agent === 'grok'
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
SIMULATOR_PALETTE_QUERY_MAX_BYTES,
|
||||
SIMULATOR_TYPE_SEARCH_ALIASES,
|
||||
buildSearchableSimulatorTabs,
|
||||
isSimulatorPaletteQueryTooLarge,
|
||||
searchSimulatorTabs,
|
||||
simulatorPaletteTabTitle,
|
||||
type SearchableSimulatorTab
|
||||
@@ -409,7 +408,6 @@ describe('simulator-palette-search', () => {
|
||||
})
|
||||
} as SearchableSimulatorTab
|
||||
|
||||
expect(isSimulatorPaletteQueryTooLarge(oversizedQuery)).toBe(true)
|
||||
expect(searchSimulatorTabs([entry], oversizedQuery)).toEqual([])
|
||||
})
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ export const SIMULATOR_TYPE_SEARCH_ALIASES = [
|
||||
'emulator'
|
||||
] as const
|
||||
|
||||
export function isSimulatorPaletteQueryTooLarge(
|
||||
function isSimulatorPaletteQueryTooLarge(
|
||||
query: string,
|
||||
maxBytes = SIMULATOR_PALETTE_QUERY_MAX_BYTES
|
||||
): boolean {
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
DEFAULT_TERMINAL_THEME_LIGHT,
|
||||
getAvailableTerminalThemeOptions,
|
||||
getBuiltinTheme,
|
||||
getTerminalThemePreview,
|
||||
isTerminalBackgroundLight,
|
||||
resolveOpaqueTerminalBackground,
|
||||
resolveEffectiveTerminalAppearance
|
||||
@@ -139,7 +138,7 @@ describe('resolveEffectiveTerminalAppearance', () => {
|
||||
)
|
||||
|
||||
expect(appearance.themeName).toBe('Invalid Theme Name')
|
||||
expect(appearance.theme).toEqual(getTerminalThemePreview(DEFAULT_TERMINAL_THEME_LIGHT))
|
||||
expect(appearance.theme).toEqual(getBuiltinTheme(DEFAULT_TERMINAL_THEME_LIGHT))
|
||||
})
|
||||
|
||||
it('resolves custom theme selections by id', () => {
|
||||
@@ -188,7 +187,7 @@ describe('resolveEffectiveTerminalAppearance', () => {
|
||||
)
|
||||
|
||||
expect(appearance.themeName).toBe('custom:warp:missing')
|
||||
expect(appearance.theme).toEqual(getTerminalThemePreview(DEFAULT_TERMINAL_THEME_DARK))
|
||||
expect(appearance.theme).toEqual(getBuiltinTheme(DEFAULT_TERMINAL_THEME_DARK))
|
||||
})
|
||||
|
||||
it('falls back visually to the light default when a light custom selection is missing', () => {
|
||||
@@ -206,7 +205,7 @@ describe('resolveEffectiveTerminalAppearance', () => {
|
||||
)
|
||||
|
||||
expect(appearance.themeName).toBe('custom:warp:missing')
|
||||
expect(appearance.theme).toEqual(getTerminalThemePreview(DEFAULT_TERMINAL_THEME_LIGHT))
|
||||
expect(appearance.theme).toEqual(getBuiltinTheme(DEFAULT_TERMINAL_THEME_LIGHT))
|
||||
})
|
||||
|
||||
it('includes imported themes as grouped picker options', () => {
|
||||
|
||||
@@ -71,7 +71,7 @@ export function getTerminalTheme(
|
||||
return getTheme(selection)
|
||||
}
|
||||
|
||||
export function getTerminalThemePreview(
|
||||
function getTerminalThemePreview(
|
||||
name: string,
|
||||
settings?: Pick<GlobalSettings, 'terminalCustomThemes'>,
|
||||
fallbackMode: 'dark' | 'light' = 'dark'
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
hasCachedWindowsTerminalCapabilities,
|
||||
isWindowsTerminalCapabilityHost,
|
||||
loadWindowsTerminalCapabilities,
|
||||
refreshWindowsTerminalCapabilities,
|
||||
resetWindowsTerminalCapabilitiesForTests,
|
||||
selectWindowsTerminalCapabilitiesForOwner,
|
||||
useLocalWindowsTerminalCapabilities,
|
||||
@@ -197,7 +196,7 @@ describe('windows terminal capabilities', () => {
|
||||
await expect(loadWindowsTerminalCapabilities()).resolves.toMatchObject({
|
||||
wslAvailable: false
|
||||
})
|
||||
await expect(refreshWindowsTerminalCapabilities()).resolves.toMatchObject({
|
||||
await expect(loadWindowsTerminalCapabilities({ force: true })).resolves.toMatchObject({
|
||||
wslAvailable: true
|
||||
})
|
||||
|
||||
@@ -438,7 +437,11 @@ describe('windows terminal capabilities', () => {
|
||||
})
|
||||
|
||||
await expect(
|
||||
refreshWindowsTerminalCapabilities(undefined, { kind: 'local' }, 'ssh-1')
|
||||
loadWindowsTerminalCapabilities({
|
||||
force: true,
|
||||
target: { kind: 'local' },
|
||||
sshConnectionId: 'ssh-1'
|
||||
})
|
||||
).resolves.toEqual({
|
||||
wslAvailable: true,
|
||||
wslDistros: ['Ubuntu', 'Debian'],
|
||||
|
||||
@@ -176,14 +176,6 @@ export function loadWindowsTerminalCapabilities(
|
||||
return nextPendingCapabilities
|
||||
}
|
||||
|
||||
export function refreshWindowsTerminalCapabilities(
|
||||
ownerKey?: string,
|
||||
target: WindowsTerminalCapabilityLoadTarget = { kind: 'local' },
|
||||
sshConnectionId?: string | null
|
||||
): Promise<WindowsTerminalCapabilities> {
|
||||
return loadWindowsTerminalCapabilities({ force: true, ownerKey, target, sshConnectionId })
|
||||
}
|
||||
|
||||
export function selectWindowsTerminalCapabilitiesForOwner(
|
||||
state: WindowsTerminalCapabilityHookState,
|
||||
enabled: boolean,
|
||||
|
||||
@@ -2,7 +2,6 @@ import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
getLiveAgentStatusByWorktreeId,
|
||||
getWorktreeIdsWithLiveAgent,
|
||||
hasActiveWorkspaceActivity,
|
||||
isInactiveWorkspace
|
||||
} from './worktree-activity-state'
|
||||
import type { TerminalTab } from '../../../shared/terminal-tab-types'
|
||||
@@ -43,9 +42,6 @@ describe('worktree activity state', () => {
|
||||
const ptyIdsByTabId = { 'tab-1': ['pty-1'] }
|
||||
|
||||
expect(isInactiveWorkspace('wt-1', tabsByWorktree, ptyIdsByTabId, {}, new Set())).toBe(false)
|
||||
expect(hasActiveWorkspaceActivity('wt-1', tabsByWorktree, ptyIdsByTabId, {}, new Set())).toBe(
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
it('treats browser workspaces as active', () => {
|
||||
@@ -62,51 +58,42 @@ describe('worktree activity state', () => {
|
||||
|
||||
it('treats pending paired web host terminal mirrors as inactive without a live pty', () => {
|
||||
expect(
|
||||
hasActiveWorkspaceActivity(
|
||||
isInactiveWorkspace(
|
||||
'wt-1',
|
||||
{ 'wt-1': [makeTab('web-terminal-host-tab-1')] },
|
||||
{},
|
||||
{},
|
||||
new Set()
|
||||
)
|
||||
).toBe(false)
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it('treats ready paired web host terminal mirrors as active with a live pty', () => {
|
||||
expect(
|
||||
hasActiveWorkspaceActivity(
|
||||
isInactiveWorkspace(
|
||||
'wt-1',
|
||||
{ 'wt-1': [makeTab('web-terminal-host-tab-1')] },
|
||||
{ 'web-terminal-host-tab-1': ['pty-1'] },
|
||||
{},
|
||||
new Set()
|
||||
)
|
||||
).toBe(true)
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps browser-only workspaces active when mirrored terminals are pending', () => {
|
||||
expect(
|
||||
hasActiveWorkspaceActivity(
|
||||
isInactiveWorkspace(
|
||||
'wt-1',
|
||||
{ 'wt-1': [makeTab('web-terminal-host-tab-1')] },
|
||||
{},
|
||||
{ 'wt-1': [{ id: 'browser-1' }] },
|
||||
new Set()
|
||||
)
|
||||
).toBe(true)
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps a workspace with a running agent active even without a live pty (#7197)', () => {
|
||||
const worktreeIdsWithLiveAgent = new Set(['wt-1'])
|
||||
expect(
|
||||
hasActiveWorkspaceActivity(
|
||||
'wt-1',
|
||||
{ 'wt-1': [makeTab('tab-1')] },
|
||||
{ 'tab-1': [] },
|
||||
{},
|
||||
worktreeIdsWithLiveAgent
|
||||
)
|
||||
).toBe(true)
|
||||
expect(
|
||||
isInactiveWorkspace(
|
||||
'wt-1',
|
||||
|
||||
@@ -71,7 +71,7 @@ export function getLiveAgentStatusByWorktreeId(
|
||||
return result
|
||||
}
|
||||
|
||||
export function hasActiveWorkspaceActivity(
|
||||
function hasActiveWorkspaceActivity(
|
||||
worktreeId: string,
|
||||
tabsByWorktree: TabsByWorktree | null | undefined,
|
||||
ptyIdsByTabId: PtyIdsByTabId | null | undefined,
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
getDetachedHeadTooltip,
|
||||
getWorktreeGitIdentityDisplay,
|
||||
shortGitHead
|
||||
} from './worktree-git-identity-display'
|
||||
import { getWorktreeGitIdentityDisplay } from './worktree-git-identity-display'
|
||||
|
||||
describe('worktree git identity display', () => {
|
||||
it('shows a branch name when the worktree has a branch ref', () => {
|
||||
@@ -43,11 +39,3 @@ describe('worktree git identity display', () => {
|
||||
expect(getWorktreeGitIdentityDisplay({ branch: '', head: '' })).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('detached HEAD copy', () => {
|
||||
it('formats the required tooltip copy', () => {
|
||||
expect(getDetachedHeadTooltip(shortGitHead('abc123456789'))).toBe(
|
||||
'Detached HEAD at abc1234. You are viewing a commit, not a branch.'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -11,11 +11,11 @@ export type WorktreeGitIdentityDisplay =
|
||||
tooltip: string
|
||||
}
|
||||
|
||||
export function shortGitHead(head: string | null | undefined): string {
|
||||
function shortGitHead(head: string | null | undefined): string {
|
||||
return (head ?? '').trim().slice(0, 7)
|
||||
}
|
||||
|
||||
export function getDetachedHeadTooltip(shortHead: string): string {
|
||||
function getDetachedHeadTooltip(shortHead: string): string {
|
||||
return `Detached HEAD at ${shortHead}. You are viewing a commit, not a branch.`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
getWorktreePaletteSearchScope,
|
||||
makeEmptyPaletteSearchResult,
|
||||
searchWorktrees
|
||||
} from './worktree-palette-search'
|
||||
import { getWorktreePaletteSearchScope, searchWorktrees } from './worktree-palette-search'
|
||||
import {
|
||||
WORKTREE_PALETTE_QUERY_MAX_BYTES,
|
||||
isWorktreePaletteQueryTooLarge
|
||||
@@ -35,6 +31,20 @@ function makeWorktree(overrides: Partial<Worktree> = {}): Worktree {
|
||||
}
|
||||
}
|
||||
|
||||
const EMPTY_QUERY_RESULT_WT1 = {
|
||||
worktreeId: 'wt-1',
|
||||
matchedFields: [],
|
||||
displayNameRanges: [],
|
||||
branchRanges: [],
|
||||
repoRanges: [],
|
||||
hostRanges: [],
|
||||
supportingText: null,
|
||||
qualityClass: null,
|
||||
rank: null,
|
||||
lastActiveAt: null,
|
||||
activity: { ageBucket: null, timestamp: 0 }
|
||||
}
|
||||
|
||||
const repoMap = new Map<string, Repo>([
|
||||
[
|
||||
'repo-1',
|
||||
@@ -91,22 +101,7 @@ describe('worktree-palette-search', () => {
|
||||
})
|
||||
|
||||
it('returns every worktree with no match metadata for an empty query', () => {
|
||||
expect(searchWorktrees([makeWorktree()], '', repoMap)).toEqual([
|
||||
makeEmptyPaletteSearchResult('wt-1')
|
||||
])
|
||||
expect(makeEmptyPaletteSearchResult('wt-1')).toEqual({
|
||||
worktreeId: 'wt-1',
|
||||
matchedFields: [],
|
||||
displayNameRanges: [],
|
||||
branchRanges: [],
|
||||
repoRanges: [],
|
||||
hostRanges: [],
|
||||
supportingText: null,
|
||||
qualityClass: null,
|
||||
rank: null,
|
||||
lastActiveAt: null,
|
||||
activity: { ageBucket: null, timestamp: 0 }
|
||||
})
|
||||
expect(searchWorktrees([makeWorktree()], '', repoMap)).toEqual([EMPTY_QUERY_RESULT_WT1])
|
||||
})
|
||||
|
||||
it('finds an emoji-named workspace by its readable branch shortcode', () => {
|
||||
@@ -194,7 +189,7 @@ describe('worktree-palette-search', () => {
|
||||
branch: undefined as unknown as string
|
||||
})
|
||||
|
||||
expect(searchWorktrees([cleared], '', repoMap)).toEqual([makeEmptyPaletteSearchResult('wt-1')])
|
||||
expect(searchWorktrees([cleared], '', repoMap)).toEqual([EMPTY_QUERY_RESULT_WT1])
|
||||
})
|
||||
|
||||
it('returns a truncated comment snippet with the highlighted match range', () => {
|
||||
|
||||
@@ -86,7 +86,7 @@ export function getWorktreePaletteSearchScope(args: {
|
||||
return args.allWorktrees.filter((worktree) => !worktree.isArchived)
|
||||
}
|
||||
|
||||
export function makeEmptyPaletteSearchResult(
|
||||
function makeEmptyPaletteSearchResult(
|
||||
worktreeId: string,
|
||||
worktreeHostId?: Worktree['hostId'],
|
||||
context = createPaletteSearchContext(Date.now()),
|
||||
|
||||
@@ -48,10 +48,6 @@ export function launchTokenHash(token: string | undefined): string | null {
|
||||
return token?.trim() ? createHash('sha256').update(token.trim()).digest('hex') : null
|
||||
}
|
||||
|
||||
export function readSpoolRecords(path: string, now = Date.now()): SpoolRecord[] {
|
||||
return readSpoolFile(path, now).records
|
||||
}
|
||||
|
||||
/** Records plus the byte offset through the last COMPLETE line. A torn trailing line is
|
||||
* left unconsumed so a writer still finishing it is not truncated away. */
|
||||
export function readSpoolFile(
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
AGENT_PROMPT_BRACKETED_PASTE_END,
|
||||
AGENT_PROMPT_BRACKETED_PASTE_START,
|
||||
buildAgentPromptPasteBytes,
|
||||
buildAgentPromptSubmitBytes,
|
||||
agentPromptSubmitJoinsPasteFrame,
|
||||
agentPromptTakesLeadLine,
|
||||
getAgentPromptSubmitDelayMs,
|
||||
@@ -48,7 +47,6 @@ describe('agent prompt injection bytes', () => {
|
||||
|
||||
it('keeps submit separate from the paste frame', () => {
|
||||
expect(buildAgentPromptPasteBytes('hello')).not.toContain('\r')
|
||||
expect(buildAgentPromptSubmitBytes()).toBe('\r')
|
||||
})
|
||||
|
||||
it('costs a common-sized prompt far less than the old flat Windows delay', () => {
|
||||
|
||||
@@ -131,10 +131,6 @@ export function buildAgentPromptPasteBytes(prompt: string, leadLine?: string): s
|
||||
return `${lead}${AGENT_PROMPT_BRACKETED_PASTE_START}${sanitizeAgentPromptText(prompt)}${AGENT_PROMPT_BRACKETED_PASTE_END}`
|
||||
}
|
||||
|
||||
export function buildAgentPromptSubmitBytes(): string {
|
||||
return AGENT_PROMPT_SUBMIT
|
||||
}
|
||||
|
||||
export function* iterateAgentPromptPasteChunks(
|
||||
prompt: string,
|
||||
maxChunkBytes = TERMINAL_INPUT_CHUNK_MAX_BYTES
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
DEFAULT_COMMIT_MESSAGE_AGENT_ID,
|
||||
getCommitMessageAgentCapability,
|
||||
getCommitMessageAgentSpec,
|
||||
getCommitMessageModelCapability,
|
||||
getCommitMessageModel,
|
||||
isCustomAgentId,
|
||||
listCommitMessageAgentCapabilities,
|
||||
@@ -215,7 +214,6 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => {
|
||||
})
|
||||
expect(codex).not.toHaveProperty('binary')
|
||||
expect(codex).not.toHaveProperty('buildArgs')
|
||||
expect(getCommitMessageModelCapability('codex', 'gpt-5.4-mini')?.thinkingLevels).toBeDefined()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -214,13 +214,6 @@ export function getCommitMessageAgentCapability(
|
||||
return spec ? toCommitMessageAgentCapability(spec) : undefined
|
||||
}
|
||||
|
||||
export function getCommitMessageModelCapability(
|
||||
agentId: TuiAgent,
|
||||
modelId: string
|
||||
): CommitMessageModelCapability | undefined {
|
||||
return getCommitMessageAgentCapability(agentId)?.models.find((m) => m.id === modelId)
|
||||
}
|
||||
|
||||
/** Ordered list of agents that have a non-interactive mode wired up. */
|
||||
export function listCommitMessageAgentIds(): TuiAgent[] {
|
||||
return Object.keys(COMMIT_MESSAGE_AGENT_SPECS) as TuiAgent[]
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
createToolInputDisplay,
|
||||
describeToolInput,
|
||||
formatToolInput,
|
||||
isStructuredToolInput,
|
||||
MAX_TOOL_DETAIL_LENGTH,
|
||||
summarizeToolInput,
|
||||
summarizeToolRun,
|
||||
@@ -175,7 +174,6 @@ describe('Codex JSON-string tool arguments', () => {
|
||||
expect(toolFilePath('{"file_path":"src/index.ts"}')).toBe('src/index.ts')
|
||||
expect(briefToolArg('{"file_path":"src/app/index.ts"}')).toBe('index.ts')
|
||||
expect(briefToolArg('{"cmd":"git status --short"}')).toBe('git status --short')
|
||||
expect(isStructuredToolInput('{"cmd":"ls"}')).toBe(true)
|
||||
})
|
||||
|
||||
it('joins an argv-array command into one label', () => {
|
||||
@@ -187,23 +185,11 @@ describe('Codex JSON-string tool arguments', () => {
|
||||
expect(describeToolInput('{ not json')).toBe('{ not json')
|
||||
expect(formatToolInput('just prose')).toBe('just prose')
|
||||
expect(toolFilePath('{"file_path":')).toBeNull()
|
||||
expect(isStructuredToolInput('just prose')).toBe(false)
|
||||
// A JSON scalar is not an argument object — keep the literal text.
|
||||
expect(formatToolInput('"quoted"')).toBe('"quoted"')
|
||||
})
|
||||
})
|
||||
|
||||
describe('isStructuredToolInput', () => {
|
||||
it('does not offer an expander whose detail would repeat the row label', () => {
|
||||
// `{}` formats back to `{}` — the label itself.
|
||||
expect(isStructuredToolInput({})).toBe(false)
|
||||
expect(isStructuredToolInput([])).toBe(false)
|
||||
expect(isStructuredToolInput('{}')).toBe(false)
|
||||
expect(isStructuredToolInput({ command: 'ls' })).toBe(true)
|
||||
expect(isStructuredToolInput([1])).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('summarizeToolInput bounded preview', () => {
|
||||
it('collapses depth beyond the bound instead of serializing the whole tree', () => {
|
||||
const deep = { a: { b: { c: { d: 'buried' } } } }
|
||||
|
||||
@@ -111,12 +111,6 @@ function formatNormalizedToolInput(input: unknown): string {
|
||||
}
|
||||
}
|
||||
|
||||
/** Whether the expanded detail would show structured JSON rather than repeating
|
||||
* the row label — i.e. whether expanding the row is worth offering. */
|
||||
export function isStructuredToolInput(input: unknown): boolean {
|
||||
return isStructuredNormalizedToolInput(normalizeToolInput(input))
|
||||
}
|
||||
|
||||
function isStructuredNormalizedToolInput(input: unknown): boolean {
|
||||
if (input === null || typeof input !== 'object') {
|
||||
return false
|
||||
|
||||
@@ -6,7 +6,6 @@ export const ORCHESTRATION_CONTRACT_PREFLIGHT_TIMEOUT_MS = 5_000
|
||||
export const ORCHESTRATION_READINESS_TIMEOUT_MS = 60_000
|
||||
export const ORCHESTRATION_FEDERATION_ATTACH_GRACE_MS = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 10_000
|
||||
export const ORCHESTRATION_WORKER_START_CLIENT_GRACE_MS = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 20_000
|
||||
export const SWALLOWED_ENTER_FIXTURE_TIMEOUT_MS = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 30_000
|
||||
|
||||
export function resolveWorkerStartReadinessTimeoutMs(timeoutMs: number | undefined): number {
|
||||
return typeof timeoutMs === 'number' && Number.isFinite(timeoutMs) && timeoutMs > 0
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
PLUGIN_KILL_LIST_FUTURE_SKEW_MS,
|
||||
findKilledPlugin,
|
||||
isPluginKillListTooFarInFuture,
|
||||
killedPluginKeys,
|
||||
pluginKillListSchema,
|
||||
type PluginKillList
|
||||
} from './plugin-kill-list'
|
||||
@@ -26,7 +25,6 @@ describe('pluginKillListSchema', () => {
|
||||
})
|
||||
|
||||
expect(findKilledPlugin(parsed, 'community.unsafe')).toEqual(entry())
|
||||
expect(killedPluginKeys(parsed)).toEqual(new Set(['community.unsafe']))
|
||||
})
|
||||
|
||||
it.each([
|
||||
|
||||
@@ -51,10 +51,6 @@ export function isPluginKillListTooFarInFuture(
|
||||
return Date.parse(killList.generatedAt) > now + PLUGIN_KILL_LIST_FUTURE_SKEW_MS
|
||||
}
|
||||
|
||||
export function killedPluginKeys(killList: PluginKillList): ReadonlySet<string> {
|
||||
return new Set(killList.plugins.map((plugin) => plugin.pluginKey))
|
||||
}
|
||||
|
||||
export function findKilledPlugin(
|
||||
killList: PluginKillList,
|
||||
pluginKey: string
|
||||
|
||||
@@ -8,7 +8,7 @@ import { buildFakeAgentCommandOverride } from './helpers/fake-agent-command-over
|
||||
import { waitForSessionReady } from './helpers/store'
|
||||
import { RuntimeClient } from '../../src/cli/runtime-client'
|
||||
import { recognizeAgentProcess } from '../../src/shared/agent-process-recognition'
|
||||
import { SWALLOWED_ENTER_FIXTURE_TIMEOUT_MS } from '../../src/shared/orchestration-timing-budgets'
|
||||
import { AGENT_PROMPT_EFFECT_TIMEOUT_MS } from '../../src/shared/orchestration-timing-budgets'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const fixtureRoot = mkdtempSync(path.join(os.tmpdir(), 'orca-terminal-send-agent-prompt-'))
|
||||
@@ -17,7 +17,8 @@ const fixtureMarker = `ORCA_TERMINAL_SEND_E2E_${process.pid}`
|
||||
const fixtureScript = path.join(process.cwd(), 'tests', 'tools', 'repro-terminal-send-submit.mjs')
|
||||
const fakeCodex = path.join(fixtureRoot, process.platform === 'win32' ? 'codex.cmd' : 'codex')
|
||||
const fakeCodexCommand = buildFakeAgentCommandOverride(fakeCodex)
|
||||
const swallowedEnterFixtureTimeoutMs = SWALLOWED_ENTER_FIXTURE_TIMEOUT_MS
|
||||
// Outlast the submission-effect budget so a swallowed Enter fails as a timeout, not a flake.
|
||||
const swallowedEnterFixtureTimeoutMs = AGENT_PROMPT_EFFECT_TIMEOUT_MS + 30_000
|
||||
|
||||
writeFileSync(
|
||||
fakeCodex,
|
||||
|
||||
Reference in New Issue
Block a user