(args: {
cwd: string;
mode: EnhancedMode;
mcpServers: McpServersConfig;
cliOverrides?: CodexCliOverrides;
baseInstructions?: string;
developerInstructions?: string;
})
| 88 | } |
| 89 | |
| 90 | export function buildThreadStartParams(args: { |
| 91 | cwd: string; |
| 92 | mode: EnhancedMode; |
| 93 | mcpServers: McpServersConfig; |
| 94 | cliOverrides?: CodexCliOverrides; |
| 95 | baseInstructions?: string; |
| 96 | developerInstructions?: string; |
| 97 | }): ThreadStartParams { |
| 98 | const approvalPolicy = resolveApprovalPolicy(args.mode); |
| 99 | const sandbox = resolveSandbox(args.mode); |
| 100 | const allowCliOverrides = args.mode.permissionMode === 'default'; |
| 101 | const cliOverrides = allowCliOverrides ? args.cliOverrides : undefined; |
| 102 | const resolvedApprovalPolicy = cliOverrides?.approvalPolicy ?? approvalPolicy; |
| 103 | const resolvedSandbox = cliOverrides?.sandbox ?? sandbox; |
| 104 | |
| 105 | const config = buildMcpServerConfig(args.mcpServers); |
| 106 | const { |
| 107 | baseInstructions, |
| 108 | developerInstructions: resolvedDeveloperInstructions |
| 109 | } = resolveInstructions(args); |
| 110 | const configWithInstructions = { |
| 111 | ...config, |
| 112 | developer_instructions: resolvedDeveloperInstructions, |
| 113 | ...(args.mode.modelReasoningEffort ? { model_reasoning_effort: args.mode.modelReasoningEffort } : {}) |
| 114 | }; |
| 115 | |
| 116 | const params: ThreadStartParams = { |
| 117 | cwd: args.cwd, |
| 118 | approvalPolicy: resolvedApprovalPolicy, |
| 119 | sandbox: resolvedSandbox, |
| 120 | baseInstructions, |
| 121 | developerInstructions: resolvedDeveloperInstructions, |
| 122 | ...(Object.keys(configWithInstructions).length > 0 ? { config: configWithInstructions } : {}) |
| 123 | }; |
| 124 | |
| 125 | if (args.mode.model) { |
| 126 | params.model = args.mode.model; |
| 127 | } |
| 128 | |
| 129 | return params; |
| 130 | } |
| 131 | |
| 132 | export function buildTurnStartParams(args: { |
| 133 | threadId: string; |
no test coverage detected