/**
 * sdk-env-merge.demo.ts — value-signal demo for the 0.3.149 env foot-gun.
 *
 * Run: npx tsx packages/intelligence/src/agent-stream/sdk-env-merge.demo.ts
 * (or `node --import tsx ...`). Prints a before/after showing how many
 * load-bearing keys a naive bare-literal `Options.env` would strip vs. the
 * safe merge helper.
 */
import { mergeSubprocessEnv, findStrippedEnvKeys, OLAM_LOAD_BEARING_SUBPROCESS_ENV, } from './sdk-env-merge';
// A realistic supervisor env an olam Claude Code subprocess inherits.
const inherited = {
    PATH: '/usr/local/bin:/usr/bin',
    HOME: '/root',
    ANTHROPIC_BASE_URL: 'http://127.0.0.1:8787',
    HOST_CP_URL: 'http://host.docker.internal:3112',
    HOST_CP_BEARER: 'redacted',
    AGENT_DRIVER_TOOLS_ENABLED: '1',
};
// The mistake: inject ONE var as a bare Options.env literal.
const naive = { OLAM_QUESTION_BROKER_URL: 'https://broker' };
const naiveStripped = findStrippedEnvKeys(naive, OLAM_LOAD_BEARING_SUBPROCESS_ENV, inherited);
// The fix: merge on top of the inherited env.
const safe = mergeSubprocessEnv(naive, inherited);
const safeStripped = findStrippedEnvKeys(safe, OLAM_LOAD_BEARING_SUBPROCESS_ENV, inherited);
/* eslint-disable no-console */
console.log('SDK 0.3.149 Options.env = REPLACE (not merge). Value signal:');
console.log(`  inherited load-bearing keys present: ${OLAM_LOAD_BEARING_SUBPROCESS_ENV.filter((k) => typeof inherited[k] === 'string').length}`);
console.log(`  bare-literal env keys: ${Object.keys(naive).length}`);
console.log(`  -> bare literal STRIPS ${naiveStripped.length} load-bearing keys: ${naiveStripped.join(', ')}`);
console.log(`  -> mergeSubprocessEnv STRIPS ${safeStripped.length} keys (env size ${Object.keys(safe).length})`);
console.log(naiveStripped.length > 0 && safeStripped.length === 0
    ? 'PASS: helper prevents the silent env-wipe.'
    : 'FAIL: unexpected result.');
/* eslint-enable no-console */
//# sourceMappingURL=sdk-env-merge.demo.js.map