mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 16:02:35 +00:00
refactor(workspaces): keep reseed helper outside caller census
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
gateWorktreeAgentActivation,
|
||||
type WorktreeAgentActivationOutcome
|
||||
} from './worktree-agent-activation-gate'
|
||||
import type { WorktreeActivationSurfaceSelection } from './worktree-activation-surface-selection'
|
||||
import { reseedGatedEmptyWorkspace } from './worktree-initial-terminal-seeding'
|
||||
|
||||
type GatedEmptyWorkspaceReseedIntent = {
|
||||
@@ -18,12 +17,13 @@ const latestReseedIntentByGate = new WeakMap<
|
||||
|
||||
export function gateAndReseedEmptyWorkspace(
|
||||
workspaceKey: string,
|
||||
selection?: WorktreeActivationSurfaceSelection & { executionHostId?: ExecutionHostId }
|
||||
callerProvidesSurface: boolean,
|
||||
executionHostId?: ExecutionHostId
|
||||
): void {
|
||||
const gate = gateWorktreeAgentActivation(workspaceKey)
|
||||
const intent: GatedEmptyWorkspaceReseedIntent = {
|
||||
callerProvidesSurface: selection?.providesInitialSurface === true,
|
||||
...(selection?.executionHostId ? { executionHostId: selection.executionHostId } : {})
|
||||
callerProvidesSurface,
|
||||
...(executionHostId ? { executionHostId } : {})
|
||||
}
|
||||
latestReseedIntentByGate.set(gate, intent)
|
||||
void gate.then((outcome) => {
|
||||
|
||||
@@ -143,7 +143,11 @@ export function activateAndRevealFolderWorkspace(
|
||||
resumeSleepingAgentSessionsForWorktree(workspaceKey)
|
||||
}
|
||||
if (shouldGateAgentActivation) {
|
||||
gateAndReseedEmptyWorkspace(workspaceKey, opts)
|
||||
gateAndReseedEmptyWorkspace(
|
||||
workspaceKey,
|
||||
opts?.providesInitialSurface === true,
|
||||
opts?.executionHostId
|
||||
)
|
||||
}
|
||||
const primaryTabId = shouldGateAgentActivation
|
||||
? null
|
||||
@@ -238,7 +242,11 @@ export function activateAndRevealWorktree(
|
||||
resumeSleepingAgentSessionsForWorktree(worktreeId)
|
||||
}
|
||||
if (shouldGateAgentActivation) {
|
||||
gateAndReseedEmptyWorkspace(worktreeId, opts)
|
||||
gateAndReseedEmptyWorkspace(
|
||||
worktreeId,
|
||||
opts?.providesInitialSurface === true,
|
||||
opts?.executionHostId
|
||||
)
|
||||
}
|
||||
|
||||
// 4. Ensure a focusable surface exists for externally-created worktrees
|
||||
|
||||
Reference in New Issue
Block a user