MCPcopy Create free account
hub / github.com/Noumena-Network/code / createWrapperEnv

Function createWrapperEnv

src/testing/wrapperPtyHarness.ts:75–108  ·  view source on GitHub ↗
(
  configDir: string,
  extraEnv: NodeJS.ProcessEnv = {},
)

Source from the content-addressed store, hash-verified

73}
74
75export 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
110export function getWrapperHarnessBunBin(): string {
111 return process.env.BUN_BIN || process.execPath

Calls 2

createSharedSmokeEnvFunction · 0.90
getSmokeRuntimeConfigFunction · 0.90

Tested by

no test coverage detected