(
configDir: string,
extraEnv: NodeJS.ProcessEnv = {},
)
| 73 | } |
| 74 | |
| 75 | export function createWrapperEnv( |
| 76 | configDir: string, |
| 77 | extraEnv: NodeJS.ProcessEnv = {}, |
| 78 | ): NodeJS.ProcessEnv { |
| 79 | const env = createSharedSmokeEnv(configDir, getSmokeRuntimeConfig(), { |
| 80 | NCODE_BUILD_MODE: process.env.NCODE_BUILD_MODE || 'noumena', |
| 81 | NCODE_DISABLE_STDIN_TTY_OVERRIDE: '1', |
| 82 | CLAUDE_CODE_NO_FLICKER: '0', |
| 83 | NOUMENA_OAUTH_WEB_BASE_URL: |
| 84 | process.env.NOUMENA_OAUTH_WEB_BASE_URL || 'https://api.noumena.com', |
| 85 | NOUMENA_GROWTHBOOK_API_HOST: |
| 86 | process.env.NOUMENA_GROWTHBOOK_API_HOST || 'https://flags.noumena.com', |
| 87 | NOUMENA_GROWTHBOOK_CLIENT_KEY: |
| 88 | process.env.NOUMENA_GROWTHBOOK_CLIENT_KEY || 'sdk-4goZclgHgKG2mtsb', |
| 89 | CLAUDE_CODE_OAUTH_TOKEN: |
| 90 | process.env.CLAUDE_CODE_OAUTH_TOKEN || WRAPPER_HARNESS_OAUTH_TOKEN, |
| 91 | ...extraEnv, |
| 92 | }) |
| 93 | |
| 94 | // Wrapper fixtures exercise the managed OAuth path. Ambient direct API keys |
| 95 | // from the developer shell trigger the interactive "use this API key?" |
| 96 | // prompt before the steady-state wrapper surface, making the contracts |
| 97 | // depend on unrelated local state. Use empty overrides instead of deletion: |
| 98 | // spawnPtyContractSession merges process.env back in after this env object. |
| 99 | // Preserve explicit overrides for tests that intentionally exercise API-key |
| 100 | // behavior. |
| 101 | for (const key of ['ANTHROPIC_API_KEY', 'NOUMENA_API_KEY'] as const) { |
| 102 | if (!(key in extraEnv)) { |
| 103 | env[key] = '' |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | return env |
| 108 | } |
| 109 | |
| 110 | export function getWrapperHarnessBunBin(): string { |
| 111 | return process.env.BUN_BIN || process.execPath |
no test coverage detected