Merge remote-tracking branch 'origin/main' into fix/renderer-crash-white-screen

This commit is contained in:
Brennan Benson
2026-07-12 17:54:43 -07:00
10 changed files with 200 additions and 26 deletions
+49
View File
@@ -5,6 +5,7 @@ import {
extractAllOscTitles,
extractLastOscTitle,
getAgentLabel,
isCursorAgentTitle,
MAX_OSC_TITLE_CHARS,
normalizeTerminalTitle
} from './agent-detection'
@@ -14,6 +15,7 @@ import {
normalizeCompatibleAgentTitleForOwner,
resolveCompatibleAgentTypeForOwner
} from './agent-title-owner'
import { SYNTHETIC_AGENT_TITLE_PROFILES } from './synthetic-agent-title'
afterEach(() => {
vi.restoreAllMocks()
@@ -177,3 +179,50 @@ describe('Pi-compatible title detection', () => {
}
)
})
describe('Cursor agent title identity', () => {
// Why: the accepted vocabulary is the set of labels Orca actually synthesizes for Cursor.
// Pin it to that profile so renaming a label there cannot silently drop @cursor to zero
// recipients (and desync the auto-Enter suppression that shares this predicate).
it('accepts every label Orca synthesizes for Cursor', () => {
const profile = SYNTHETIC_AGENT_TITLE_PROFILES.cursor
for (const label of [
profile.workingLabel,
`⠋ ${profile.workingLabel}`,
profile.idleLabel,
profile.permissionLabel
]) {
expect(isCursorAgentTitle(label)).toBe(true)
}
})
it.each([
'Cursor Agent',
' cursor agent ',
'⠋ Cursor Agent',
'⣿ Cursor Agent',
'Cursor ready',
'Cursor - action required'
])('accepts the native or Orca-synthesized Cursor title %j', (title) => {
expect(isCursorAgentTitle(title)).toBe(true)
})
// Why: "cursor" is ordinary editor vocabulary in another agent's task-summary title,
// so a whole-token name match is not Cursor identity.
it.each([
'⠋ fix the text cursor blink',
'✳ Fix the text cursor blink',
'. fix cursor position',
'* cursor rendering done',
'Terminal Cursor and Orca slows down',
'cursor-agent',
'cursor.exe',
'~/cursor-rules',
'',
null,
undefined
])('rejects the non-Cursor title %j', (title) => {
expect(isCursorAgentTitle(title)).toBe(false)
})
})
+1
View File
@@ -11,6 +11,7 @@
export type { AgentStatus } from './agent-title-core'
export {
isClaudeManagementTitle,
isCursorAgentTitle,
isCursorNativeAgentTitle,
isGeminiTerminalTitle,
isPiTerminalTitle,
+22
View File
@@ -108,3 +108,25 @@ export function isClaudeManagementTitle(title: string): boolean {
export function isCursorNativeAgentTitle(title: string): boolean {
return title.trim().toLowerCase() === CURSOR_NATIVE_TITLE_LOWER
}
// Why: `cursor` is also an ordinary editor noun that other agents type into their own
// task-summary titles, so a name token is not identity. Cursor's identifying titles are
// a closed set (the native literal plus the labels Orca synthesizes from Cursor hooks),
// so match that vocabulary instead.
export function isCursorAgentTitle(title: string | null | undefined): boolean {
if (typeof title !== 'string') {
return false
}
const trimmed = title.trim()
const lower = trimmed.toLowerCase()
if (
lower === CURSOR_NATIVE_TITLE_LOWER ||
lower === 'cursor ready' ||
lower === 'cursor - action required'
) {
return true
}
// Why: display labels can mention Cursor in another agent's task text. Only
// treat the controlled synthetic Cursor spinner title as Cursor identity.
return /^[\u2800-\u28ff] Cursor Agent$/u.test(trimmed)
}