mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 08:03:12 +00:00
refactor(terminal-pane): fold the fork's trust preflight onto the canonical one
`preflightForkAgentTrust` was a behavioural duplicate of `preflightAgentTrust`, whose signature now accepts a nullable agent and workspace path and so is a drop-in replacement. Its file is left holding only the launch-platform resolver — which is not a duplicate, since it returns an override rather than a default — so the file is renamed for what it now contains.
This commit is contained in:
-23
@@ -1,5 +1,3 @@
|
||||
import { TUI_AGENT_CONFIG } from '../../../../shared/tui-agent-config'
|
||||
import type { TuiAgent } from '../../../../shared/tui-agent'
|
||||
import { isWslUncPath } from '../../../../shared/wsl-paths'
|
||||
import type { ProjectExecutionRuntimeResolution } from '../../../../shared/project-execution-runtime'
|
||||
|
||||
@@ -19,24 +17,3 @@ export function getForkAgentLaunchPlatform(args: {
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export async function preflightForkAgentTrust(args: {
|
||||
agent: TuiAgent
|
||||
workspacePath?: string | null
|
||||
connectionId?: string | null
|
||||
}): Promise<void> {
|
||||
const { agent, workspacePath, connectionId } = args
|
||||
const preflight = TUI_AGENT_CONFIG[agent].preflightTrust
|
||||
if (!preflight || !workspacePath || !window.api.agentTrust?.markTrusted) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await window.api.agentTrust.markTrusted({
|
||||
preset: preflight,
|
||||
workspacePath,
|
||||
...(connectionId ? { connectionId } : {})
|
||||
})
|
||||
} catch {
|
||||
// Best-effort: if the trust artifact cannot be written, keep the existing launch path.
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,8 @@ import { activateAndRevealWorktree } from '@/lib/worktree-activation'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makePaneKey } from '../../../../shared/stable-pane-id'
|
||||
import { TUI_AGENT_CONFIG } from '../../../../shared/tui-agent-config'
|
||||
import {
|
||||
getForkAgentLaunchPlatform,
|
||||
preflightForkAgentTrust
|
||||
} from './terminal-agent-session-fork-agent-preflight'
|
||||
import { getForkAgentLaunchPlatform } from './terminal-agent-session-fork-launch-platform'
|
||||
import { preflightAgentTrust } from '@/lib/agent-trust-preflight'
|
||||
import { slugifyForWorkspaceName } from '../../../../shared/workspace-name'
|
||||
import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants'
|
||||
import type { TuiAgent } from '../../../../shared/tui-agent'
|
||||
@@ -231,7 +229,7 @@ export async function startAgentSessionFork(fork: PreparedAgentSessionFork): Pro
|
||||
activateAndRevealWorktree(forkWorktreeId, { sidebarRevealBehavior: 'auto' })
|
||||
return copyAgentSessionForkContext(fork)
|
||||
}
|
||||
await preflightForkAgentTrust({
|
||||
await preflightAgentTrust({
|
||||
agent: fork.agent,
|
||||
workspacePath: created.worktree.path,
|
||||
connectionId: sourceRepo?.connectionId
|
||||
|
||||
Reference in New Issue
Block a user