clawmoney 0.15.48 → 0.15.49
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.
|
@@ -276,16 +276,46 @@ export async function bootstrapClaudeFingerprint(opts = {}) {
|
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
278
|
const port = addr.port;
|
|
279
|
-
//
|
|
280
|
-
//
|
|
279
|
+
// Build child env: inherit parent's env but strip HTTPS_PROXY
|
|
280
|
+
// entries so claude doesn't try to tunnel its call to
|
|
281
|
+
// http://127.0.0.1:<port> through the upstream proxy. Set
|
|
282
|
+
// NO_PROXY=localhost as belt-and-braces.
|
|
283
|
+
const childEnv = {
|
|
284
|
+
...process.env,
|
|
285
|
+
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
|
286
|
+
NO_PROXY: "127.0.0.1,localhost",
|
|
287
|
+
no_proxy: "127.0.0.1,localhost",
|
|
288
|
+
};
|
|
289
|
+
delete childEnv.HTTPS_PROXY;
|
|
290
|
+
delete childEnv.https_proxy;
|
|
291
|
+
delete childEnv.HTTP_PROXY;
|
|
292
|
+
delete childEnv.http_proxy;
|
|
293
|
+
delete childEnv.ALL_PROXY;
|
|
294
|
+
delete childEnv.all_proxy;
|
|
295
|
+
// Launch `claude -p "hi"` — same command the manual capture
|
|
296
|
+
// script documents. `-p` is non-interactive print mode; in
|
|
297
|
+
// recent claude versions it skips the trust dialog for
|
|
298
|
+
// text-only prompts. We intentionally do NOT pass
|
|
299
|
+
// --dangerously-skip-permissions — that would silently opt
|
|
300
|
+
// users into a lower safety setting without consent.
|
|
281
301
|
claudeChild = spawn("claude", ["-p", "hi"], {
|
|
282
|
-
env:
|
|
283
|
-
|
|
284
|
-
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
|
285
|
-
},
|
|
286
|
-
stdio: "ignore",
|
|
302
|
+
env: childEnv,
|
|
303
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
287
304
|
shell: process.platform === "win32",
|
|
288
305
|
});
|
|
306
|
+
// Buffer stderr so we can surface it in the error message if
|
|
307
|
+
// claude bails out. stdout is dropped — we don't care about
|
|
308
|
+
// the content, only about the /v1/messages request it made.
|
|
309
|
+
let stderrBuf = "";
|
|
310
|
+
claudeChild.stderr?.on("data", (chunk) => {
|
|
311
|
+
stderrBuf += chunk.toString();
|
|
312
|
+
if (stderrBuf.length > 4_000) {
|
|
313
|
+
stderrBuf = stderrBuf.slice(-4_000);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
claudeChild.stdout?.on("data", () => {
|
|
317
|
+
// drain, ignore
|
|
318
|
+
});
|
|
289
319
|
claudeChild.on("error", (err) => {
|
|
290
320
|
if (resolved)
|
|
291
321
|
return;
|
|
@@ -304,8 +334,9 @@ export async function bootstrapClaudeFingerprint(opts = {}) {
|
|
|
304
334
|
resolved = true;
|
|
305
335
|
clearTimeout(timer);
|
|
306
336
|
cleanup();
|
|
307
|
-
|
|
308
|
-
|
|
337
|
+
const tail = stderrBuf.trim().slice(-400);
|
|
338
|
+
const detail = tail ? ` stderr: ${tail}` : "";
|
|
339
|
+
reject(new Error(`claude -p hi exited with code ${code ?? "unknown"} before sending a /v1/messages request.${detail}`));
|
|
309
340
|
}, 500);
|
|
310
341
|
});
|
|
311
342
|
});
|