mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-25 11:10:00 +02:00
506ed6b40e
New lib/conductor-env-shim.ts promotes GSTACK_ANTHROPIC_API_KEY and GSTACK_OPENAI_API_KEY to canonical names when canonical is empty. Wired into the four TS entry points that hit paid APIs or gbrain embeddings: gstack-gbrain-sync.ts, gstack-model-benchmark, preflight-agent-sdk.ts, test/helpers/e2e-helpers.ts. Side-effect-only import, 15 lines total. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
15 lines
621 B
TypeScript
15 lines
621 B
TypeScript
/**
|
|
* Conductor workspaces don't inherit the user's interactive shell env, so the
|
|
* canonical ANTHROPIC_API_KEY / OPENAI_API_KEY may be missing while
|
|
* Conductor's GSTACK_-prefixed forms are present. Promote the GSTACK_ form to
|
|
* canonical when canonical is empty, so subprocesses (gbrain embed,
|
|
* @anthropic-ai/claude-agent-sdk, etc) pick it up.
|
|
*
|
|
* Import this for its side effect: `import "../lib/conductor-env-shim";`
|
|
*/
|
|
for (const key of ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"] as const) {
|
|
if (!process.env[key] && process.env[`GSTACK_${key}`]) {
|
|
process.env[key] = process.env[`GSTACK_${key}`];
|
|
}
|
|
}
|