mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 11:24:37 +00:00
* Add setup scripts for project group folder workspaces * Align setup regression fixtures and catalog read validation * Target the Advanced disclosure in group setup regression * test: initialize project groups in worktree slice fixture * Preserve group setup startup input across paired hosts * Check paired group startup regression in cross-layer project * Restore group setup settings when saving fails * Wait for group agents to accept startup input * Type the group startup readiness fixture foreground state * Give group startup fixture mocks portable public types * Reuse worktree startup for group folder setup * Keep example shell regression while removing obsolete observer tests * Complete launch runtime fixture PTY options * Exercise terminal startup failure and worktree draft paste in parity tests * Preserve repository type defaults for setup commands
106 lines
4.5 KiB
TypeScript
106 lines
4.5 KiB
TypeScript
import { OrcaRuntimeWithGetWorktreeTerminalProvisioningHost } from '../startup/workspace-terminal-provisioning'
|
|
import {
|
|
prepareGroupFolderCreation,
|
|
groupFolderCreationIsUserAct,
|
|
type RuntimeGroupFolderCreateInput
|
|
} from './runtime-group-folder-setup'
|
|
import type { ProjectGroup } from '../../../../shared/project-group-types'
|
|
import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types'
|
|
import type { Worktree } from '../../../../shared/worktree/types'
|
|
import type { RuntimeNavigationTarget } from '../../../../shared/runtime-navigation'
|
|
import type { RuntimeLocalWorktreeTerminalPorts } from '../startup/runtime-local-worktree-terminal-startup'
|
|
import { wslUserAct } from '../startup/workspace-create-activation'
|
|
import {
|
|
buildWorktreeStartupForAgent,
|
|
buildWorktreeStartupForDraft
|
|
} from '../startup/runtime-worktree-agent-startup'
|
|
import { resolveStartupAgentLaunchRuntime } from '../../terminal/launch/agent-launch-scope-runtime'
|
|
import { projectGroupHookOwner } from '../../../../shared/workspace-hook-owner'
|
|
|
|
export abstract class OrcaRuntimeWithGroupFolderSetup extends OrcaRuntimeWithGetWorktreeTerminalProvisioningHost {
|
|
protected finishGroupFolderCreation = async (
|
|
input: RuntimeGroupFolderCreateInput,
|
|
group: ProjectGroup,
|
|
workspace: FolderWorkspace
|
|
) => {
|
|
const store = this.requireStore()
|
|
const worktree = this.folderWorkspaceToResolvedWorktree(workspace)
|
|
const activation: { wslUserAct?: true } = groupFolderCreationIsUserAct(input)
|
|
? { wslUserAct: true }
|
|
: {}
|
|
const scope = await this.resolveTerminalWorkspaceLaunchScope(
|
|
`id:${worktree.id}`,
|
|
undefined,
|
|
activation,
|
|
worktree,
|
|
workspace
|
|
)
|
|
const owner = projectGroupHookOwner(group)
|
|
return prepareGroupFolderCreation({
|
|
input,
|
|
group,
|
|
workspace,
|
|
settings: store.getSettings(),
|
|
ports: this.localWorktreeTerminalPorts(activation, () => {}, worktree),
|
|
wait: (handle, signal) => this.waitForSetupTerminalCompletion(handle, signal),
|
|
startupBuilders: {
|
|
agent: (agent, prompt, launchPreferences, inputs) =>
|
|
buildWorktreeStartupForAgent({
|
|
repo: owner ?? {
|
|
path: workspace.folderPath,
|
|
connectionId: workspace.connectionId,
|
|
executionHostId: workspace.executionHostId
|
|
},
|
|
agent,
|
|
prompt,
|
|
launchPreferences,
|
|
...inputs,
|
|
settings: store.getSettings(),
|
|
getLaunchRuntime: (requested) =>
|
|
resolveStartupAgentLaunchRuntime(store, scope, requested),
|
|
toSessionOptions: (preferences) => this.toAgentSessionOptions(preferences)
|
|
}),
|
|
draft: (draft, requestedAgent, launchSource, inputs) =>
|
|
buildWorktreeStartupForDraft({
|
|
repo: owner ?? {
|
|
path: workspace.folderPath,
|
|
connectionId: workspace.connectionId,
|
|
executionHostId: workspace.executionHostId
|
|
},
|
|
draft,
|
|
requestedAgent,
|
|
originalAgent: inputs?.createdWithAgent ?? requestedAgent,
|
|
agentArgs: inputs?.startupAgentArgs,
|
|
sessionOptions:
|
|
inputs?.startupSessionOptions ??
|
|
this.toAgentSessionOptions(inputs?.startupLaunchPreferences),
|
|
launchSource,
|
|
settings: store.getSettings(),
|
|
getLaunchRuntime: (agent) => resolveStartupAgentLaunchRuntime(store, scope, agent)
|
|
})
|
|
}
|
|
})
|
|
}
|
|
protected localWorktreeTerminalPorts(
|
|
args: { navigation?: RuntimeNavigationTarget; wslUserAct?: true },
|
|
activate: RuntimeLocalWorktreeTerminalPorts['activate'],
|
|
worktree?: Worktree
|
|
): RuntimeLocalWorktreeTerminalPorts {
|
|
return {
|
|
canSpawn: Boolean(this.ptyController?.spawn),
|
|
provisionInBackground: () => this.shouldProvisionWorktreeInBackground(args.navigation),
|
|
createTerminal: (selector, options) =>
|
|
worktree
|
|
? this.createTerminal(selector, { ...options, ...wslUserAct(args) }, worktree)
|
|
: this.createTerminal(selector, { ...options, ...wslUserAct(args) }),
|
|
pasteDraft: (handle, draft) => this.pasteStartupDraftWhenReady(handle, draft),
|
|
sendFollowup: (handle, followup, terminal) => {
|
|
void this.deliverStartupFollowup(handle, followup, { terminalCreation: terminal })
|
|
},
|
|
provision: (options) =>
|
|
this.provisionManagedWorktreeTerminals({ ...options, ...wslUserAct(args) }, worktree),
|
|
activate
|
|
}
|
|
}
|
|
}
|