mirror of
https://github.com/stablyai/orca.git
synced 2026-11-05 11:37:25 +00:00
* fix(worktrees): remove repeated scans and keep prepared checkouts fresh * fix(worktrees): reclaim unlocked fallback preparations safely * refactor(worktrees): simplify creation ownership and idle maintenance * fix(git): keep ref maintenance armed after an index-only pass An idle attempt that found the pack index due but refs still cooling down returned without rescheduling, so loose refs from the arming fetch waited for the next write instead of the ref cooldown.
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
// @ts-nocheck -- mechanically split from OrcaRuntimeService; behavior is covered by AST equivalence and characterization tests.
|
|
import { OrcaRuntimeWithStopExplicitlyClosedTabPtys } from './orca-runtime-stop-explicitly-closed-tab-ptys'
|
|
import type { TerminalPaneSplitSource } from '../../shared/feature-education-telemetry'
|
|
import type { RuntimeTerminalSplit } from '../../shared/runtime-types'
|
|
import { randomUUID } from 'node:crypto'
|
|
import type { Worktree } from '../../shared/worktree/types'
|
|
|
|
export class OrcaRuntimeWithSplitTerminal extends OrcaRuntimeWithStopExplicitlyClosedTabPtys {
|
|
async splitTerminal(
|
|
handle: string,
|
|
opts: {
|
|
direction?: 'horizontal' | 'vertical'
|
|
command?: string
|
|
env?: Record<string, string>
|
|
envToDelete?: string[]
|
|
activate?: boolean
|
|
// Why: same split as createTerminal — adopt the pane without revealing its
|
|
// workspace, for splits the user never asked to see.
|
|
surfaceOwner?: false
|
|
telemetrySource?: TerminalPaneSplitSource
|
|
} = {},
|
|
// Internal creation evidence; RPC and preload callers never supply it.
|
|
createdWorktree?: Worktree
|
|
): Promise<RuntimeTerminalSplit> {
|
|
const livePty = this.getLivePtyForHandle(handle)
|
|
if (livePty) {
|
|
return await this.splitPtyBackedTerminal(livePty.pty, opts, createdWorktree)
|
|
}
|
|
this.assertGraphReady()
|
|
const { leaf } = this.getLiveLeafForHandle(handle)
|
|
const direction = opts.direction ?? 'horizontal'
|
|
|
|
const newLeafId = randomUUID()
|
|
|
|
this.notifier?.splitTerminal(leaf.tabId, leaf.paneRuntimeId, {
|
|
direction,
|
|
command: opts.command,
|
|
worktreeId: leaf.worktreeId,
|
|
sourceLeafId: leaf.leafId,
|
|
telemetrySource: opts.telemetrySource,
|
|
newLeafId
|
|
})
|
|
|
|
const newHandle = await this.waitForLeafInTab(leaf.tabId, newLeafId)
|
|
return {
|
|
handle: newHandle,
|
|
tabId: leaf.tabId,
|
|
paneRuntimeId: leaf.paneRuntimeId,
|
|
leafId: newLeafId
|
|
}
|
|
}
|
|
}
|