@proagentstore/cli 0.4.22 → 0.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Merge the platform's resolved engine env over the machine's, where an EMPTY value means
|
|
4
|
+
* REMOVE rather than "set to empty".
|
|
5
|
+
*
|
|
6
|
+
* Needed because the machine env is inherited wholesale: a developer with ANTHROPIC_API_KEY in
|
|
7
|
+
* their shell handed it to every engine, and Claude Code prefers an API key over the
|
|
8
|
+
* subscription token — so choosing "subscription" injected CLAUDE_CODE_OAUTH_TOKEN and then
|
|
9
|
+
* silently lost, billing per token anyway. Without a way to express removal the setting could
|
|
10
|
+
* not mean what it said.
|
|
11
|
+
*/
|
|
12
|
+
export function mergeEnv(base, overlay) {
|
|
13
|
+
const out = { ...base };
|
|
14
|
+
for (const [k, v] of Object.entries(overlay ?? {})) {
|
|
15
|
+
if (v === "")
|
|
16
|
+
delete out[k];
|
|
17
|
+
else
|
|
18
|
+
out[k] = v;
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
2
22
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
23
|
import { dirname, join } from "node:path";
|
|
4
24
|
import { handlerFor } from "./handlers.js";
|
|
@@ -95,7 +115,7 @@ export class HeadlessSession {
|
|
|
95
115
|
const args = this.mode === "stream-json" ? buildClaudeArgs(this.cmdArgs, this.claudeSessionId) : [...this.cmdArgs];
|
|
96
116
|
const proc = spawn(this.cmdBin, args, {
|
|
97
117
|
cwd: this.config.workDir,
|
|
98
|
-
env:
|
|
118
|
+
env: mergeEnv(process.env, this.config.env),
|
|
99
119
|
stdio: ["pipe", "pipe", "pipe"],
|
|
100
120
|
});
|
|
101
121
|
this.proc = proc;
|