Files
orca/src/shared/agent-title-decoration.ts
T
Jinjing 7caa582841 Show coding agent icons on mobile terminal tabs (#6792)
* Show coding agent icons on mobile terminal tabs

Move agent title decoration and terminal title parsing utilities
from the desktop renderer to shared code for reuse on mobile.

* Extract agent title stripping and terminal agent resolution to shared
* Implement mobile agent identity resolution and title-cleaning helpers
* Render agent icons on mobile terminal tabs when an agent is active
* Strip leading status glyphs from tab titles when showing an icon

* Suppress PTY resize on resume for mobile-driven terminals

Avoid reasserting the PTY size on resume if desktop resizing is
suppressed. This prevents overriding the intentional drift from
desktop dimensions for parked or mobile-driven terminals.
2026-06-29 16:06:27 -07:00

20 lines
1.0 KiB
TypeScript

// Leading status decorations that coding agents prepend to their OSC title —
// Claude's '✳', Gemini's glyphs (✦ ⏲ ◇ ✋), braille spinners, and Claude's
// '. '/'* ' working/idle prefixes. Once the tab bar shows the provider icon,
// this leading glyph reads as a redundant second icon, so strip it from the
// displayed title. Scoped to titles we already know belong to an agent.
const LEADING_AGENT_TITLE_DECORATION_RE =
// eslint-disable-next-line no-control-regex -- intentional unicode status-glyph ranges
/^(?:[✳✦⏲◇✋⠀-⣿]+|[.*]\s)\s*/
export function stripLeadingAgentTitleDecorationOrEmpty(title: string): string {
return title.replace(LEADING_AGENT_TITLE_DECORATION_RE, '').trimStart()
}
export function stripLeadingAgentTitleDecoration(title: string): string {
const stripped = stripLeadingAgentTitleDecorationOrEmpty(title)
// Why: never return empty — a title that is *only* a status glyph should keep
// its original text rather than collapse to a blank tab label.
return stripped.length > 0 ? stripped : title
}