@@ -56,10 +56,12 @@ import type { LinearConnectionStatus } from "../../desktop/src/shared/types/line
5656import { resolveAdeLayout } from "../../desktop/src/shared/adeLayout" ;
5757import {
5858 buildTrackedCliLaunchCommand ,
59+ deriveTrackedCliInitialInputSessionMeta ,
5960 isLaunchProfile ,
6061 isTrackedCliPermissionMode ,
6162 LAUNCH_PROFILE_TITLE ,
6263 LAUNCH_PROFILE_TOOL_TYPE ,
64+ resolveCleanShellLaunchFields ,
6365 validateLaunchProfilePermissionMode ,
6466 type CliProvider ,
6567 type LaunchProfile ,
@@ -225,7 +227,7 @@ const TOOL_SPECS: ToolSpec[] = [
225227 runId : { type : "string" } ,
226228 stepId : { type : "string" } ,
227229 attemptId : { type : "string" } ,
228- permissionMode : { type : "string" , enum : [ "default" , "plan" , "edit" , "full-auto" , "config-toml" ] , default : "default" } ,
230+ permissionMode : { type : "string" , enum : [ "default" , "auto" , " plan", "edit" , "full-auto" , "config-toml" ] , default : "default" } ,
229231 toolWhitelist : { type : "array" , items : { type : "string" } , maxItems : 24 } ,
230232 maxPromptChars : { type : "number" , minimum : 256 , maximum : 12000 } ,
231233 contextFilePath : { type : "string" } ,
@@ -322,13 +324,14 @@ const TOOL_SPECS: ToolSpec[] = [
322324 properties : {
323325 laneId : { type : "string" , minLength : 1 } ,
324326 provider : { type : "string" , enum : [ "claude" , "codex" , "cursor" , "droid" , "opencode" , "shell" ] } ,
325- permissionMode : { type : "string" , enum : [ "default" , "plan" , "edit" , "full-auto" , "config-toml" ] , default : "default" } ,
327+ permissionMode : { type : "string" , enum : [ "default" , "auto" , " plan", "edit" , "full-auto" , "config-toml" ] , default : "default" } ,
326328 title : { type : "string" } ,
327329 initialInput : { type : "string" } ,
328330 cols : { type : "number" , minimum : 20 , maximum : 400 , default : 120 } ,
329331 rows : { type : "number" , minimum : 4 , maximum : 200 , default : 36 } ,
330332 model : { type : "string" } ,
331333 modelId : { type : "string" } ,
334+ reasoningEffort : { type : "string" } ,
332335 cwd : { type : "string" } ,
333336 chatSessionId : { type : "string" } ,
334337 tracked : { type : "boolean" , default : true }
@@ -1738,7 +1741,7 @@ const CTO_OPERATOR_TOOL_SPECS: ToolSpec[] = [
17381741 laneId : { type : "string" } ,
17391742 modelId : { type : "string" } ,
17401743 reasoningEffort : { type : "string" } ,
1741- permissionMode : { type : "string" , enum : [ "default" , "plan" , "edit" , "full-auto" , "config-toml" ] } ,
1744+ permissionMode : { type : "string" , enum : [ "default" , "auto" , " plan", "edit" , "full-auto" , "config-toml" ] } ,
17421745 droidPermissionMode : { type : "string" , enum : [ "read-only" , "auto-low" , "auto-medium" , "auto-high" ] } ,
17431746 title : { type : "string" } ,
17441747 initialPrompt : { type : "string" } ,
@@ -2491,7 +2494,7 @@ function parseCliSessionPermissionMode(value: unknown): AgentChatPermissionMode
24912494 if ( isTrackedCliPermissionMode ( mode ) ) return mode ;
24922495 throw new JsonRpcError (
24932496 JsonRpcErrorCode . invalidParams ,
2494- "permissionMode must be one of default, plan, edit, full-auto, or config-toml" ,
2497+ "permissionMode must be one of default, auto, plan, edit, full-auto, or config-toml" ,
24952498 ) ;
24962499}
24972500
@@ -3201,11 +3204,11 @@ function sha256Text(value: string): string {
32013204 return createHash ( "sha256" ) . update ( value ) . digest ( "hex" ) ;
32023205}
32033206
3204- type SpawnPermissionMode = "default" | "plan" | "edit" | "full-auto" | "config-toml" ;
3207+ type SpawnPermissionMode = "default" | "auto" | " plan" | "edit" | "full-auto" | "config-toml" ;
32053208
32063209function parseSpawnPermissionMode ( value : unknown ) : SpawnPermissionMode {
32073210 const normalized = asTrimmedString ( value ) . toLowerCase ( ) ;
3208- if ( normalized === "plan" || normalized === "edit" || normalized === "full-auto" || normalized === "config-toml" ) return normalized ;
3211+ if ( normalized === "auto" || normalized === " plan" || normalized === "edit" || normalized === "full-auto" || normalized === "config-toml" ) return normalized ;
32093212 return "default" ;
32103213}
32113214
@@ -5171,16 +5174,37 @@ async function runTool(args: {
51715174 }
51725175 const cols = clampInteger ( toolArgs . cols , DEFAULT_PTY_COLS , 20 , 400 ) ;
51735176 const rows = clampInteger ( toolArgs . rows , DEFAULT_PTY_ROWS , 4 , 200 ) ;
5174- const title = asOptionalTrimmedString ( toolArgs . title ) ?? LAUNCH_PROFILE_TITLE [ provider ] ;
51755177 const initialInput = asOptionalTrimmedString ( toolArgs . initialInput ) ?. slice ( 0 , 20_000 ) ?? null ;
51765178 const model = asOptionalTrimmedString ( toolArgs . model ) ?? asOptionalTrimmedString ( toolArgs . modelId ) ;
5179+ const reasoningEffort = asOptionalTrimmedString ( toolArgs . reasoningEffort ) ;
5180+ const initialInputMeta = deriveTrackedCliInitialInputSessionMeta ( {
5181+ provider,
5182+ title : asOptionalTrimmedString ( toolArgs . title ) ,
5183+ initialInput,
5184+ } ) ;
5185+ const title = initialInputMeta . title || LAUNCH_PROFILE_TITLE [ provider ] ;
51775186 const ptyService = runtime . ptyService ;
51785187 const preassignedSessionId = provider === "claude" ? randomUUID ( ) : undefined ;
51795188 const laneWorktreePath = resolveLaneWorktreePath ( runtime , laneId ) ;
51805189
51815190 const launchFields : { startupCommand ?: string ; command ?: string ; args ?: string [ ] ; env ?: Record < string , string > } = ( ( ) => {
5191+ if ( provider === "shell" ) {
5192+ return resolveCleanShellLaunchFields ( {
5193+ platform : process . platform ,
5194+ shell : process . env . SHELL ,
5195+ comSpec : process . env . ComSpec ,
5196+ } ) ;
5197+ }
51825198 if ( ! isCliProvider ( provider ) ) return { } ;
5183- return buildTrackedCliLaunchCommand ( { provider, permissionMode, sessionId : preassignedSessionId , model, laneWorktreePath } ) ;
5199+ return buildTrackedCliLaunchCommand ( {
5200+ provider,
5201+ permissionMode,
5202+ sessionId : preassignedSessionId ,
5203+ model,
5204+ reasoningEffort,
5205+ initialPrompt : provider === "codex" ? initialInput : null ,
5206+ laneWorktreePath,
5207+ } ) ;
51845208 } ) ( ) ;
51855209
51865210 const created = await ptyService . create ( {
@@ -5198,7 +5222,9 @@ async function runTool(args: {
51985222 } ) ;
51995223
52005224 let initialInputWritten = false ;
5201- if ( initialInput && isCliProvider ( provider ) ) {
5225+ if ( initialInput && provider === "codex" ) {
5226+ initialInputWritten = true ;
5227+ } else if ( initialInput && isCliProvider ( provider ) ) {
52025228 initialInputWritten = ptyService . writeBySessionId ( created . sessionId , `${ initialInput } \r` ) ;
52035229 if ( ! initialInputWritten ) {
52045230 try {
@@ -5225,6 +5251,17 @@ async function runTool(args: {
52255251 }
52265252 }
52275253
5254+ if ( initialInputMeta . goal ) {
5255+ const session = runtime . sessionService . get ( created . sessionId ) as TerminalSessionSummary | null ;
5256+ runtime . sessionService . updateMeta ( {
5257+ sessionId : created . sessionId ,
5258+ ...( session ?. goal ?. trim ( ) . length ? { } : { goal : initialInputMeta . goal } ) ,
5259+ ...( initialInputMeta . promptTitle && title === initialInputMeta . promptTitle
5260+ ? { title : initialInputMeta . promptTitle , manuallyNamed : false }
5261+ : { } ) ,
5262+ } ) ;
5263+ }
5264+
52285265 const session = runtime . sessionService . get ( created . sessionId ) as TerminalSessionSummary | null ;
52295266 const enrichedSession = session ? ptyService . enrichSessions ( [ session ] ) [ 0 ] ?? session : session ;
52305267 return {
@@ -6855,6 +6892,12 @@ async function runTool(args: {
68556892 "permissionMode config-toml is only supported for Codex spawn_agent sessions." ,
68566893 ) ;
68576894 }
6895+ if ( provider === "codex" && permissionMode === "auto" ) {
6896+ throw new JsonRpcError (
6897+ JsonRpcErrorCode . invalidParams ,
6898+ "permissionMode auto is only supported for Claude spawn_agent sessions." ,
6899+ ) ;
6900+ }
68586901 const maxPromptChars = Math . max ( 256 , Math . min ( 12000 , Math . floor ( asNumber ( toolArgs . maxPromptChars , 2800 ) ) ) ) ;
68596902 const prompt = asOptionalTrimmedString ( toolArgs . prompt ) ;
68606903 const runId = asOptionalTrimmedString ( toolArgs . runId ) ;
@@ -6934,6 +6977,9 @@ async function runTool(args: {
69346977 case "edit" :
69356978 claudePermission = "acceptEdits" ;
69366979 break ;
6980+ case "auto" :
6981+ claudePermission = "auto" ;
6982+ break ;
69376983 default :
69386984 claudePermission = "default" ;
69396985 }
0 commit comments