549
550
export function buildAgentSdkEnv(
552
>
inheritedEnv: Readonly<Record<string, string | undefined>>,
553
>
): Record<string, string> {
554
>
const out: Record<string, string> = {};
555
>
const setIfMissing = (key: string, value: string | undefined): void => {
556
>
if (value === undefined || value === '' || inheritedEnv[key] !== undefined) {
557
>
return;
558
>
}
559
out[key] = value;
561
>
setIfMissing(AgentHostCodexAgentSdkRootEnvVar, settings.codexSdkRoot);
562
>
setIfMissing(AgentHostCodexAgentCodexHomeEnvVar, settings.codexHome);
563
>
if (Array.isArray(settings.codexBinaryArgs) && settings.codexBinaryArgs.length > 0) {
564
setIfMissing(AgentHostCodexAgentBinaryArgsEnvVar, JSON.stringify(settings.codexBinaryArgs));
565
}
567
setIfMissing(AgentHostClaudeAgentEnabledEnvVar, settings.claudeAgentEnabled ? 'true' : 'false');
568
}
570
setIfMissing(AgentHostCodexAgentEnabledEnvVar, settings.codexAgentEnabled ? 'true' : 'false');
571
}
573
setIfMissing(AgentHostByokModelsEnabledEnvVar, settings.byokModelsEnabled ? 'true' : 'false');
574
}
576
>
}
577
578
/** Result of starting the agent host WebSocket server on-demand. */