Files
orca/src/shared/ephemeral-setup-terminal-worktree-id.ts
Vladislav Meshkorudnyjandvladmesh e82dce4382 Fix/remote skill install floating terminal (#6816)
* fix(terminal): scope skill-install terminals to the floating runtime selector (#6789)

Inline setup/onboarding terminals (skill installers, feature tips) create a
PTY under a synthetic per-panel worktree id. On a remote runtime the remote
PTY transport sent that id as `id:<panel>` to `terminal.create`, which the
runtime cannot resolve, so installing a skill via Settings failed with
selector_not_found. Locally it worked because the IPC spawn uses cwd directly
and never resolves the selector.

These terminals are ephemeral floating terminals with no backing worktree, so
brand their id and resolve it to the floating-terminal selector
(global-floating-terminal), which every runtime already maps to the home dir.
Local tab isolation keeps the distinct per-panel id; only the runtime terminal
selector changes. The server is unchanged.

* docs(terminal): add JSDoc for functions touched by the skill-install terminal fix

Document the new ephemeral setup-terminal id helpers, the runtime terminal
selector, and the onboarding/remote-transport entry points so the changed
functions carry contract-level docstrings.

---------

Co-authored-by: vladmesh <vladmesh@gmail.com>
2026-06-29 20:38:11 -07:00

20 lines
936 B
TypeScript

// Inline setup/onboarding terminals have no backing worktree. Branding their
// per-panel id lets the terminal RPC layer scope them to the floating terminal,
// instead of leaking an unresolvable selector to a remote runtime (#6789).
export const EPHEMERAL_SETUP_TERMINAL_WORKTREE_ID_PREFIX = 'ephemeral-setup-terminal:'
/**
* Brand a per-panel setup-terminal id so the terminal RPC layer routes it to the
* floating-terminal scope on a runtime. Idempotent for already-branded ids.
*/
export function brandEphemeralSetupTerminalWorktreeId(panelId: string): string {
return isEphemeralSetupTerminalWorktreeId(panelId)
? panelId
: `${EPHEMERAL_SETUP_TERMINAL_WORKTREE_ID_PREFIX}${panelId}`
}
/** Whether `worktreeId` is a branded ephemeral setup-terminal id. */
export function isEphemeralSetupTerminalWorktreeId(worktreeId: string): boolean {
return worktreeId.startsWith(EPHEMERAL_SETUP_TERMINAL_WORKTREE_ID_PREFIX)
}