diff --git a/src/renderer/src/components/terminal-pane/terminal-agent-session-fork-agent-preflight.ts b/src/renderer/src/components/terminal-pane/terminal-agent-session-fork-launch-platform.ts similarity index 51% rename from src/renderer/src/components/terminal-pane/terminal-agent-session-fork-agent-preflight.ts rename to src/renderer/src/components/terminal-pane/terminal-agent-session-fork-launch-platform.ts index 980006593f3..33fbb193388 100644 --- a/src/renderer/src/components/terminal-pane/terminal-agent-session-fork-agent-preflight.ts +++ b/src/renderer/src/components/terminal-pane/terminal-agent-session-fork-launch-platform.ts @@ -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 { - 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. - } -} diff --git a/src/renderer/src/components/terminal-pane/terminal-agent-session-fork.ts b/src/renderer/src/components/terminal-pane/terminal-agent-session-fork.ts index 135250f513c..fc22eae6417 100644 --- a/src/renderer/src/components/terminal-pane/terminal-agent-session-fork.ts +++ b/src/renderer/src/components/terminal-pane/terminal-agent-session-fork.ts @@ -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