Files
orca/src/shared/claude-agent-view.ts
T
OrcaWinandOrcaWin 1ff73e808d feat(claude): navigate and track subagent views from sidebar (#33322)
* feat(claude): open subagent views from sidebar rows

* test(claude): type mod session events for CI lint

* test(claude): preserve sidebar preference types

* fix(claude): localize subagent navigation notices

* fix(claude): refresh managed mods asynchronously

* fix(claude): track the viewed agent and honor parent selection

* test(rpc): include Claude view observations in terminal manifest

* fix(claude): preserve bindings and isolate optional view setup

* fix(claude): scope subagent mods and avoid redundant shortcut input

* fix(claude): reconcile navigation setup outside PTY spawns

* fix(i18n): include Claude navigation search terms in runtime catalog

* fix(claude): keep terminal spawns independent of navigation setup

* test(claude): use fixed clocks for navigation coverage

* test(claude): isolate navigation cleanup from startup fixtures

* fix(claude): clean cached shell configs without probing

* docs(claude): describe cached config cleanup limitation

* fix(i18n): preserve navigation search localization after rebase

* feat(claude): enable sidebar subagent navigation by default

* test(claude): update WSL fixtures for automatic navigation

* docs(claude): remove subagent navigation readme

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-10-25 18:53:42 -07:00

45 lines
1.4 KiB
TypeScript

import { z } from 'zod'
export const CLAUDE_AGENT_VIEW_PATH = '/claude/agent-view'
export const CLAUDE_AGENT_VIEW_RELAY_METHOD = 'agent_hook.claudeAgentView'
export const CLAUDE_AGENT_VIEW_COMMAND = 'orca-agent-view'
export const CLAUDE_AGENT_VIEW_PLUGIN = 'orca-agent-view'
export const CLAUDE_AGENT_VIEW_SUBSCRIBE = 'terminal.subscribeClaudeAgentViews'
export const ClaudeAgentViewObservation = z.object({
agentId: z.string().min(1).max(256).optional(),
revision: z.number().int().nonnegative()
})
export const ClaudeAgentViewSnapshot = z.array(
z.object({
paneKey: z.string(),
sessionId: z.string(),
agentId: z.string().optional()
})
)
export type ClaudeAgentViewSnapshot = z.infer<typeof ClaudeAgentViewSnapshot>
export function normalizeClaudeAgentViewChord(chord: string): string {
return chord
.toLowerCase()
.replace(/control/g, 'ctrl')
.replace(/option|opt/g, 'alt')
.trim()
.split(/\s+/)
.map((stroke) => stroke.split('+').sort().join('+'))
.join(' ')
}
export const CLAUDE_AGENT_VIEW_SHORTCUTS = [
{ chord: 'ctrl+alt+g', input: '\u001b[103;7u' },
{ chord: 'ctrl+alt+h', input: '\u001b[104;7u' },
{ chord: 'ctrl+alt+v', input: '\u001b[118;7u' }
] as const
export type ClaudeAgentViewResult = {
status: 'viewed' | 'unsupported' | 'busy' | 'permission' | 'unavailable' | 'denied' | 'timeout'
reason?: string
}
export type ClaudeAgentViewSettings = { claudeSubagentNavigationEnabled?: boolean }