polymath-society 0.2.11 → 0.2.12
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.
- package/dist/cli.js +74 -19
- package/dist/engine/chat-loops.js +22 -1
- package/dist/engine/exp-allfacets.js +22 -1
- package/dist/engine/exp-person.js +22 -1
- package/dist/engine/exp-pipeline.js +22 -1
- package/dist/engine/peak-demos.js +22 -1
- package/dist/engine/person-dimension-summary.js +22 -1
- package/dist/engine/person-facet-lines.js +22 -1
- package/dist/engine/person-headline.js +22 -1
- package/dist/engine/person-report.js +22 -1
- package/dist/engine/person-self-image.js +22 -1
- package/dist/engine/public-report.js +22 -1
- package/dist/engine/run-analysis.js +22 -1
- package/dist/engine/run-tagger.js +22 -1
- package/dist/index.js +33 -4
- package/dist/pipeline/coding-agglomerate.js +22 -1
- package/dist/pipeline/coding-coaching.js +22 -1
- package/dist/pipeline/coding-day-digest.js +22 -1
- package/dist/pipeline/coding-delegation.js +22 -1
- package/dist/pipeline/coding-expertise.js +22 -1
- package/dist/pipeline/coding-focus.js +22 -1
- package/dist/pipeline/coding-frontier-detail.js +22 -1
- package/dist/pipeline/coding-gap.js +22 -1
- package/dist/pipeline/coding-grade.js +37 -2
- package/dist/pipeline/coding-nutshell.js +22 -1
- package/dist/pipeline/coding-walkthrough.js +38 -2
- package/dist/web/app.js +63 -0
- package/dist/web/styles.css +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -841,7 +841,19 @@ function aiWindowCutoff(sessions, opts = {}) {
|
|
|
841
841
|
const floorStart = gradableStarts[floor - 1];
|
|
842
842
|
return floorStart < windowCutoff ? floorStart : windowCutoff;
|
|
843
843
|
}
|
|
844
|
-
|
|
844
|
+
function maxGraded() {
|
|
845
|
+
const n = Number(process.env.POLYMATH_MAX_GRADED);
|
|
846
|
+
return Number.isFinite(n) && n >= 0 ? n : MAX_GRADED_DEFAULT;
|
|
847
|
+
}
|
|
848
|
+
function substanceRank(a, b) {
|
|
849
|
+
return b.humanChars * Math.log1p(b.humanTurns) - a.humanChars * Math.log1p(a.humanTurns);
|
|
850
|
+
}
|
|
851
|
+
function capGradable(gradable) {
|
|
852
|
+
const sorted = gradable.slice().sort(substanceRank);
|
|
853
|
+
const cap = maxGraded();
|
|
854
|
+
return cap > 0 && sorted.length > cap ? sorted.slice(0, cap) : sorted;
|
|
855
|
+
}
|
|
856
|
+
var GATE, AI_WINDOW, MAX_GRADED_DEFAULT;
|
|
845
857
|
var init_gate = __esm({
|
|
846
858
|
"../coding-core/dist/gate.js"() {
|
|
847
859
|
"use strict";
|
|
@@ -860,6 +872,7 @@ var init_gate = __esm({
|
|
|
860
872
|
minSessions: 40
|
|
861
873
|
// extend the window back until this many gradable sessions
|
|
862
874
|
};
|
|
875
|
+
MAX_GRADED_DEFAULT = 150;
|
|
863
876
|
}
|
|
864
877
|
});
|
|
865
878
|
|
|
@@ -868,10 +881,14 @@ var gate_exports = {};
|
|
|
868
881
|
__export(gate_exports, {
|
|
869
882
|
AI_WINDOW: () => AI_WINDOW,
|
|
870
883
|
GATE: () => GATE,
|
|
884
|
+
MAX_GRADED_DEFAULT: () => MAX_GRADED_DEFAULT,
|
|
871
885
|
aiWindowCutoff: () => aiWindowCutoff,
|
|
886
|
+
capGradable: () => capGradable,
|
|
872
887
|
isGradable: () => isGradable,
|
|
873
888
|
isTrivial: () => isTrivial,
|
|
874
|
-
|
|
889
|
+
maxGraded: () => maxGraded,
|
|
890
|
+
partition: () => partition,
|
|
891
|
+
substanceRank: () => substanceRank
|
|
875
892
|
});
|
|
876
893
|
var init_gate2 = __esm({
|
|
877
894
|
"src/gate.ts"() {
|
|
@@ -880,6 +897,31 @@ var init_gate2 = __esm({
|
|
|
880
897
|
}
|
|
881
898
|
});
|
|
882
899
|
|
|
900
|
+
// ../coding-core/dist/env.js
|
|
901
|
+
function claudeCliEnv(base2 = process.env) {
|
|
902
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
903
|
+
return base2;
|
|
904
|
+
const present = AUTH_VARS.filter((k) => base2[k]);
|
|
905
|
+
if (!present.length)
|
|
906
|
+
return base2;
|
|
907
|
+
if (!warned) {
|
|
908
|
+
warned = true;
|
|
909
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
910
|
+
}
|
|
911
|
+
const scrubbed = { ...base2 };
|
|
912
|
+
for (const k of AUTH_VARS)
|
|
913
|
+
delete scrubbed[k];
|
|
914
|
+
return scrubbed;
|
|
915
|
+
}
|
|
916
|
+
var AUTH_VARS, warned;
|
|
917
|
+
var init_env = __esm({
|
|
918
|
+
"../coding-core/dist/env.js"() {
|
|
919
|
+
"use strict";
|
|
920
|
+
AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
921
|
+
warned = false;
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
|
|
883
925
|
// src/grade/adapter.ts
|
|
884
926
|
function extractJson(text2) {
|
|
885
927
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1013,6 +1055,7 @@ var cliAdapter;
|
|
|
1013
1055
|
var init_cliAdapter = __esm({
|
|
1014
1056
|
"src/grade/cliAdapter.ts"() {
|
|
1015
1057
|
"use strict";
|
|
1058
|
+
init_env();
|
|
1016
1059
|
init_adapter();
|
|
1017
1060
|
init_backends();
|
|
1018
1061
|
cliAdapter = {
|
|
@@ -1049,7 +1092,9 @@ var init_cliAdapter = __esm({
|
|
|
1049
1092
|
await new Promise((resolve2, reject) => {
|
|
1050
1093
|
const child = spawn(bin, args, {
|
|
1051
1094
|
cwd: inv.cwd ?? inv.addDir,
|
|
1052
|
-
|
|
1095
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1096
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1097
|
+
env: claudeCliEnv(),
|
|
1053
1098
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1054
1099
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1055
1100
|
// children that otherwise orphan and pile up).
|
|
@@ -2458,19 +2503,19 @@ function makeMultiBar(out = process.stderr) {
|
|
|
2458
2503
|
const lanes = /* @__PURE__ */ new Map();
|
|
2459
2504
|
let link = "";
|
|
2460
2505
|
let paintedRows = 0;
|
|
2461
|
-
const laneText = (name17, l) => {
|
|
2462
|
-
const w = l.within ? ` ${l.within.done}/${l.within.total}` : "";
|
|
2463
|
-
return `${name17} ${l.i}/${l.total} ${l.label.slice(0, 26)}${w}`;
|
|
2464
|
-
};
|
|
2465
2506
|
const rows = () => {
|
|
2466
|
-
const
|
|
2467
|
-
const parts = [...lanes.entries()].map(([n, l]) => laneText(n, l));
|
|
2468
|
-
const avg2 = lanes.size ? [...lanes.values()].reduce((a, l) => a + frac(l), 0) / lanes.size : 0;
|
|
2469
|
-
const width = 14;
|
|
2470
|
-
const fill = Math.max(0, Math.min(width, Math.round(avg2 * width)));
|
|
2507
|
+
const width = 16;
|
|
2471
2508
|
const elapsedMin = Math.round((Date.now() - t0) / 6e4);
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2509
|
+
const laneRow = ([name17, l]) => {
|
|
2510
|
+
const frac = l.total ? (l.i - 1 + (l.within && l.within.total ? l.within.done / l.within.total : 0)) / l.total : 0;
|
|
2511
|
+
const clamped = Math.max(0, Math.min(1, frac));
|
|
2512
|
+
const fill = Math.round(clamped * width);
|
|
2513
|
+
return ` ${name17.padEnd(6)} [${"\u2588".repeat(fill)}${"\u2591".repeat(width - fill)}] ${String(Math.round(clamped * 100)).padStart(3)}%`;
|
|
2514
|
+
};
|
|
2515
|
+
const out2 = [];
|
|
2516
|
+
if (link) out2.push(`\u21B3 your reports (live, fill in as stages finish) \u2192 ${link} \xB7 ${elapsedMin}m`);
|
|
2517
|
+
out2.push(...[...lanes.entries()].map(laneRow));
|
|
2518
|
+
return out2.length ? out2 : [`(starting\u2026 ${elapsedMin}m)`];
|
|
2474
2519
|
};
|
|
2475
2520
|
const clearPinned = () => {
|
|
2476
2521
|
if (!paintedRows) return;
|
|
@@ -4360,6 +4405,7 @@ import { readFileSync } from "fs";
|
|
|
4360
4405
|
import path13 from "path";
|
|
4361
4406
|
|
|
4362
4407
|
// ../../lib/agents/shared/cliAdapter.ts
|
|
4408
|
+
init_env();
|
|
4363
4409
|
import { spawn as spawn3 } from "child_process";
|
|
4364
4410
|
import { promises as fs7 } from "fs";
|
|
4365
4411
|
import path7 from "path";
|
|
@@ -4468,7 +4514,9 @@ var cliAdapter2 = {
|
|
|
4468
4514
|
await new Promise((resolve2, reject) => {
|
|
4469
4515
|
const child = spawn3(CLAUDE_BIN, args, {
|
|
4470
4516
|
cwd: inv.cwd ?? inv.addDir,
|
|
4471
|
-
|
|
4517
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
4518
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
4519
|
+
env: claudeCliEnv(),
|
|
4472
4520
|
stdio: ["ignore", "pipe", "pipe"],
|
|
4473
4521
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
4474
4522
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -24494,8 +24542,9 @@ function startServer(opts) {
|
|
|
24494
24542
|
if (req.method === "GET" && route === "/auth/callback") {
|
|
24495
24543
|
try {
|
|
24496
24544
|
const id = await completeLogin(dataDir, new URL(url, serverUrl).searchParams);
|
|
24545
|
+
const back = host === "127.0.0.1" ? serverUrl.replace("//127.0.0.1:", "//localhost:") : serverUrl;
|
|
24497
24546
|
res.writeHead(200, { "content-type": MIME[".html"] });
|
|
24498
|
-
res.end(`<!doctype html><meta charset="utf-8"><title>Signed in</title><body style="font-family:system-ui;padding:40px"><p>Signed in as <b>${id.email.replace(/</g, "<")}</b>.</p><p><a href="/">Back to your report</a> (or just close this tab \u2014 the report page picks it up on its own).</p></body>`);
|
|
24547
|
+
res.end(`<!doctype html><meta charset="utf-8"><title>Signed in</title><body style="font-family:system-ui;padding:40px"><p>Signed in as <b>${id.email.replace(/</g, "<")}</b>.</p><p><a href="${back}/">Back to your report</a> (or just close this tab \u2014 the report page picks it up on its own).</p></body>`);
|
|
24499
24548
|
} catch (e) {
|
|
24500
24549
|
res.writeHead(400, { "content-type": MIME[".html"] });
|
|
24501
24550
|
res.end(`<!doctype html><meta charset="utf-8"><title>Sign-in failed</title><body style="font-family:system-ui;padding:40px"><p><b>Sign-in failed.</b></p><p>${String(e.message).replace(/</g, "<")}</p><p><a href="/auth/login">Try again</a></p></body>`);
|
|
@@ -24659,7 +24708,12 @@ function startServer(opts) {
|
|
|
24659
24708
|
}).catch(() => {
|
|
24660
24709
|
});
|
|
24661
24710
|
resolve2({
|
|
24662
|
-
|
|
24711
|
+
// The DISPLAYED/opened URL says localhost — friendlier than 127.0.0.1
|
|
24712
|
+
// (owner call 2026-07-15); same server, same loopback. serverUrl itself
|
|
24713
|
+
// stays on the bound host because the Google sign-in redirect is
|
|
24714
|
+
// allow-listed for http://127.0.0.1:*/** in Supabase — auth flows
|
|
24715
|
+
// through 127.0.0.1 no matter which name the person's tab uses.
|
|
24716
|
+
url: host === "127.0.0.1" ? `http://localhost:${port}` : serverUrl,
|
|
24663
24717
|
port,
|
|
24664
24718
|
close: () => new Promise((r) => server.close(() => r())),
|
|
24665
24719
|
setProfile: (p) => {
|
|
@@ -24970,11 +25024,12 @@ function upToDateSkip(i) {
|
|
|
24970
25024
|
}
|
|
24971
25025
|
async function evalUpToDate(codingDir, threshold, regrade) {
|
|
24972
25026
|
try {
|
|
24973
|
-
const { partition: partition2, aiWindowCutoff: aiWindowCutoff2 } = await Promise.resolve().then(() => (init_gate2(), gate_exports));
|
|
25027
|
+
const { partition: partition2, aiWindowCutoff: aiWindowCutoff2, capGradable: capGradable2 } = await Promise.resolve().then(() => (init_gate2(), gate_exports));
|
|
24974
25028
|
const sessions = JSON.parse(await fs31.readFile(path36.join(codingDir, "sessions.json"), "utf8"));
|
|
24975
25029
|
const live = sessions.filter((s) => s.klass === "interactive" && !s.duplicateOf);
|
|
24976
25030
|
const cutoff = aiWindowCutoff2(live);
|
|
24977
|
-
const { gradable } = partition2(cutoff ? live.filter((s) => (s.start ?? "") >= cutoff) : live);
|
|
25031
|
+
const { gradable: uncapped } = partition2(cutoff ? live.filter((s) => (s.start ?? "") >= cutoff) : live);
|
|
25032
|
+
const gradable = capGradable2(uncapped);
|
|
24978
25033
|
const graded = new Set(
|
|
24979
25034
|
(await fs31.readdir(path36.join(codingDir, "grades")).catch(() => [])).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -5))
|
|
24980
25035
|
);
|
|
@@ -1356,6 +1356,25 @@ import { spawn } from "child_process";
|
|
|
1356
1356
|
import { promises as fs2 } from "fs";
|
|
1357
1357
|
import path2 from "path";
|
|
1358
1358
|
|
|
1359
|
+
// ../coding-core/dist/env.js
|
|
1360
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1361
|
+
var warned = false;
|
|
1362
|
+
function claudeCliEnv(base = process.env) {
|
|
1363
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1364
|
+
return base;
|
|
1365
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1366
|
+
if (!present.length)
|
|
1367
|
+
return base;
|
|
1368
|
+
if (!warned) {
|
|
1369
|
+
warned = true;
|
|
1370
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1371
|
+
}
|
|
1372
|
+
const scrubbed = { ...base };
|
|
1373
|
+
for (const k of AUTH_VARS)
|
|
1374
|
+
delete scrubbed[k];
|
|
1375
|
+
return scrubbed;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1359
1378
|
// ../../lib/agents/shared/adapter.ts
|
|
1360
1379
|
function extractJson(text2) {
|
|
1361
1380
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1460,7 +1479,9 @@ var cliAdapter = {
|
|
|
1460
1479
|
await new Promise((resolve2, reject) => {
|
|
1461
1480
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1462
1481
|
cwd: inv.cwd ?? inv.addDir,
|
|
1463
|
-
|
|
1482
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1483
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1484
|
+
env: claudeCliEnv(),
|
|
1464
1485
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1465
1486
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1466
1487
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -153,6 +153,25 @@ import { spawn } from "child_process";
|
|
|
153
153
|
import { promises as fs2 } from "fs";
|
|
154
154
|
import path3 from "path";
|
|
155
155
|
|
|
156
|
+
// ../coding-core/dist/env.js
|
|
157
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
158
|
+
var warned = false;
|
|
159
|
+
function claudeCliEnv(base = process.env) {
|
|
160
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
161
|
+
return base;
|
|
162
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
163
|
+
if (!present.length)
|
|
164
|
+
return base;
|
|
165
|
+
if (!warned) {
|
|
166
|
+
warned = true;
|
|
167
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
168
|
+
}
|
|
169
|
+
const scrubbed = { ...base };
|
|
170
|
+
for (const k of AUTH_VARS)
|
|
171
|
+
delete scrubbed[k];
|
|
172
|
+
return scrubbed;
|
|
173
|
+
}
|
|
174
|
+
|
|
156
175
|
// ../../lib/agents/shared/adapter.ts
|
|
157
176
|
function extractJson(text2) {
|
|
158
177
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -257,7 +276,9 @@ var cliAdapter = {
|
|
|
257
276
|
await new Promise((resolve2, reject) => {
|
|
258
277
|
const child = spawn(CLAUDE_BIN, args, {
|
|
259
278
|
cwd: inv.cwd ?? inv.addDir,
|
|
260
|
-
|
|
279
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
280
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
281
|
+
env: claudeCliEnv(),
|
|
261
282
|
stdio: ["ignore", "pipe", "pipe"],
|
|
262
283
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
263
284
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -153,6 +153,25 @@ import { spawn } from "child_process";
|
|
|
153
153
|
import { promises as fs2 } from "fs";
|
|
154
154
|
import path3 from "path";
|
|
155
155
|
|
|
156
|
+
// ../coding-core/dist/env.js
|
|
157
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
158
|
+
var warned = false;
|
|
159
|
+
function claudeCliEnv(base = process.env) {
|
|
160
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
161
|
+
return base;
|
|
162
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
163
|
+
if (!present.length)
|
|
164
|
+
return base;
|
|
165
|
+
if (!warned) {
|
|
166
|
+
warned = true;
|
|
167
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
168
|
+
}
|
|
169
|
+
const scrubbed = { ...base };
|
|
170
|
+
for (const k of AUTH_VARS)
|
|
171
|
+
delete scrubbed[k];
|
|
172
|
+
return scrubbed;
|
|
173
|
+
}
|
|
174
|
+
|
|
156
175
|
// ../../lib/agents/shared/adapter.ts
|
|
157
176
|
function extractJson(text2) {
|
|
158
177
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -257,7 +276,9 @@ var cliAdapter = {
|
|
|
257
276
|
await new Promise((resolve2, reject) => {
|
|
258
277
|
const child = spawn(CLAUDE_BIN, args, {
|
|
259
278
|
cwd: inv.cwd ?? inv.addDir,
|
|
260
|
-
|
|
279
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
280
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
281
|
+
env: claudeCliEnv(),
|
|
261
282
|
stdio: ["ignore", "pipe", "pipe"],
|
|
262
283
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
263
284
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -148,6 +148,25 @@ import { spawn } from "child_process";
|
|
|
148
148
|
import { promises as fs2 } from "fs";
|
|
149
149
|
import path2 from "path";
|
|
150
150
|
|
|
151
|
+
// ../coding-core/dist/env.js
|
|
152
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
153
|
+
var warned = false;
|
|
154
|
+
function claudeCliEnv(base = process.env) {
|
|
155
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
156
|
+
return base;
|
|
157
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
158
|
+
if (!present.length)
|
|
159
|
+
return base;
|
|
160
|
+
if (!warned) {
|
|
161
|
+
warned = true;
|
|
162
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
163
|
+
}
|
|
164
|
+
const scrubbed = { ...base };
|
|
165
|
+
for (const k of AUTH_VARS)
|
|
166
|
+
delete scrubbed[k];
|
|
167
|
+
return scrubbed;
|
|
168
|
+
}
|
|
169
|
+
|
|
151
170
|
// ../../lib/agents/shared/adapter.ts
|
|
152
171
|
function extractJson(text2) {
|
|
153
172
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -252,7 +271,9 @@ var cliAdapter = {
|
|
|
252
271
|
await new Promise((resolve2, reject) => {
|
|
253
272
|
const child = spawn(CLAUDE_BIN, args, {
|
|
254
273
|
cwd: inv.cwd ?? inv.addDir,
|
|
255
|
-
|
|
274
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
275
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
276
|
+
env: claudeCliEnv(),
|
|
256
277
|
stdio: ["ignore", "pipe", "pipe"],
|
|
257
278
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
258
279
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -1144,6 +1144,25 @@ import { spawn } from "child_process";
|
|
|
1144
1144
|
import { promises as fs3 } from "fs";
|
|
1145
1145
|
import path4 from "path";
|
|
1146
1146
|
|
|
1147
|
+
// ../coding-core/dist/env.js
|
|
1148
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1149
|
+
var warned = false;
|
|
1150
|
+
function claudeCliEnv(base = process.env) {
|
|
1151
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1152
|
+
return base;
|
|
1153
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1154
|
+
if (!present.length)
|
|
1155
|
+
return base;
|
|
1156
|
+
if (!warned) {
|
|
1157
|
+
warned = true;
|
|
1158
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1159
|
+
}
|
|
1160
|
+
const scrubbed = { ...base };
|
|
1161
|
+
for (const k of AUTH_VARS)
|
|
1162
|
+
delete scrubbed[k];
|
|
1163
|
+
return scrubbed;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1147
1166
|
// ../../lib/agents/shared/adapter.ts
|
|
1148
1167
|
function extractJson(text2) {
|
|
1149
1168
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1248,7 +1267,9 @@ var cliAdapter = {
|
|
|
1248
1267
|
await new Promise((resolve2, reject) => {
|
|
1249
1268
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1250
1269
|
cwd: inv.cwd ?? inv.addDir,
|
|
1251
|
-
|
|
1270
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1271
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1272
|
+
env: claudeCliEnv(),
|
|
1252
1273
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1253
1274
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1254
1275
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -1144,6 +1144,25 @@ import { spawn } from "child_process";
|
|
|
1144
1144
|
import { promises as fs3 } from "fs";
|
|
1145
1145
|
import path4 from "path";
|
|
1146
1146
|
|
|
1147
|
+
// ../coding-core/dist/env.js
|
|
1148
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1149
|
+
var warned = false;
|
|
1150
|
+
function claudeCliEnv(base = process.env) {
|
|
1151
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1152
|
+
return base;
|
|
1153
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1154
|
+
if (!present.length)
|
|
1155
|
+
return base;
|
|
1156
|
+
if (!warned) {
|
|
1157
|
+
warned = true;
|
|
1158
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1159
|
+
}
|
|
1160
|
+
const scrubbed = { ...base };
|
|
1161
|
+
for (const k of AUTH_VARS)
|
|
1162
|
+
delete scrubbed[k];
|
|
1163
|
+
return scrubbed;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1147
1166
|
// ../../lib/agents/shared/adapter.ts
|
|
1148
1167
|
function extractJson(text2) {
|
|
1149
1168
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1248,7 +1267,9 @@ var cliAdapter = {
|
|
|
1248
1267
|
await new Promise((resolve2, reject) => {
|
|
1249
1268
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1250
1269
|
cwd: inv.cwd ?? inv.addDir,
|
|
1251
|
-
|
|
1270
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1271
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1272
|
+
env: claudeCliEnv(),
|
|
1252
1273
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1253
1274
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1254
1275
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -1144,6 +1144,25 @@ import { spawn } from "child_process";
|
|
|
1144
1144
|
import { promises as fs3 } from "fs";
|
|
1145
1145
|
import path4 from "path";
|
|
1146
1146
|
|
|
1147
|
+
// ../coding-core/dist/env.js
|
|
1148
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1149
|
+
var warned = false;
|
|
1150
|
+
function claudeCliEnv(base = process.env) {
|
|
1151
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1152
|
+
return base;
|
|
1153
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1154
|
+
if (!present.length)
|
|
1155
|
+
return base;
|
|
1156
|
+
if (!warned) {
|
|
1157
|
+
warned = true;
|
|
1158
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1159
|
+
}
|
|
1160
|
+
const scrubbed = { ...base };
|
|
1161
|
+
for (const k of AUTH_VARS)
|
|
1162
|
+
delete scrubbed[k];
|
|
1163
|
+
return scrubbed;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1147
1166
|
// ../../lib/agents/shared/adapter.ts
|
|
1148
1167
|
function extractJson(text2) {
|
|
1149
1168
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1248,7 +1267,9 @@ var cliAdapter = {
|
|
|
1248
1267
|
await new Promise((resolve2, reject) => {
|
|
1249
1268
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1250
1269
|
cwd: inv.cwd ?? inv.addDir,
|
|
1251
|
-
|
|
1270
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1271
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1272
|
+
env: claudeCliEnv(),
|
|
1252
1273
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1253
1274
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1254
1275
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -1144,6 +1144,25 @@ import { spawn } from "child_process";
|
|
|
1144
1144
|
import { promises as fs3 } from "fs";
|
|
1145
1145
|
import path4 from "path";
|
|
1146
1146
|
|
|
1147
|
+
// ../coding-core/dist/env.js
|
|
1148
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1149
|
+
var warned = false;
|
|
1150
|
+
function claudeCliEnv(base = process.env) {
|
|
1151
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1152
|
+
return base;
|
|
1153
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1154
|
+
if (!present.length)
|
|
1155
|
+
return base;
|
|
1156
|
+
if (!warned) {
|
|
1157
|
+
warned = true;
|
|
1158
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1159
|
+
}
|
|
1160
|
+
const scrubbed = { ...base };
|
|
1161
|
+
for (const k of AUTH_VARS)
|
|
1162
|
+
delete scrubbed[k];
|
|
1163
|
+
return scrubbed;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1147
1166
|
// ../../lib/agents/shared/adapter.ts
|
|
1148
1167
|
function extractJson(text2) {
|
|
1149
1168
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1248,7 +1267,9 @@ var cliAdapter = {
|
|
|
1248
1267
|
await new Promise((resolve2, reject) => {
|
|
1249
1268
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1250
1269
|
cwd: inv.cwd ?? inv.addDir,
|
|
1251
|
-
|
|
1270
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1271
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1272
|
+
env: claudeCliEnv(),
|
|
1252
1273
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1253
1274
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1254
1275
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -1144,6 +1144,25 @@ import { spawn } from "child_process";
|
|
|
1144
1144
|
import { promises as fs3 } from "fs";
|
|
1145
1145
|
import path4 from "path";
|
|
1146
1146
|
|
|
1147
|
+
// ../coding-core/dist/env.js
|
|
1148
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1149
|
+
var warned = false;
|
|
1150
|
+
function claudeCliEnv(base = process.env) {
|
|
1151
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1152
|
+
return base;
|
|
1153
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1154
|
+
if (!present.length)
|
|
1155
|
+
return base;
|
|
1156
|
+
if (!warned) {
|
|
1157
|
+
warned = true;
|
|
1158
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1159
|
+
}
|
|
1160
|
+
const scrubbed = { ...base };
|
|
1161
|
+
for (const k of AUTH_VARS)
|
|
1162
|
+
delete scrubbed[k];
|
|
1163
|
+
return scrubbed;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1147
1166
|
// ../../lib/agents/shared/adapter.ts
|
|
1148
1167
|
function extractJson(text2) {
|
|
1149
1168
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1248,7 +1267,9 @@ var cliAdapter = {
|
|
|
1248
1267
|
await new Promise((resolve2, reject) => {
|
|
1249
1268
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1250
1269
|
cwd: inv.cwd ?? inv.addDir,
|
|
1251
|
-
|
|
1270
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1271
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1272
|
+
env: claudeCliEnv(),
|
|
1252
1273
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1253
1274
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1254
1275
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -1096,6 +1096,25 @@ import { spawn } from "child_process";
|
|
|
1096
1096
|
import { promises as fs4 } from "fs";
|
|
1097
1097
|
import path5 from "path";
|
|
1098
1098
|
|
|
1099
|
+
// ../coding-core/dist/env.js
|
|
1100
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
1101
|
+
var warned = false;
|
|
1102
|
+
function claudeCliEnv(base = process.env) {
|
|
1103
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
1104
|
+
return base;
|
|
1105
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
1106
|
+
if (!present.length)
|
|
1107
|
+
return base;
|
|
1108
|
+
if (!warned) {
|
|
1109
|
+
warned = true;
|
|
1110
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
1111
|
+
}
|
|
1112
|
+
const scrubbed = { ...base };
|
|
1113
|
+
for (const k of AUTH_VARS)
|
|
1114
|
+
delete scrubbed[k];
|
|
1115
|
+
return scrubbed;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1099
1118
|
// ../../lib/agents/shared/adapter.ts
|
|
1100
1119
|
function extractJson(text2) {
|
|
1101
1120
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -1200,7 +1219,9 @@ var cliAdapter = {
|
|
|
1200
1219
|
await new Promise((resolve2, reject) => {
|
|
1201
1220
|
const child = spawn(CLAUDE_BIN, args, {
|
|
1202
1221
|
cwd: inv.cwd ?? inv.addDir,
|
|
1203
|
-
|
|
1222
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
1223
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
1224
|
+
env: claudeCliEnv(),
|
|
1204
1225
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1205
1226
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
1206
1227
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -142,6 +142,25 @@ import { spawn } from "child_process";
|
|
|
142
142
|
import { promises as fs2 } from "fs";
|
|
143
143
|
import path2 from "path";
|
|
144
144
|
|
|
145
|
+
// ../coding-core/dist/env.js
|
|
146
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
147
|
+
var warned = false;
|
|
148
|
+
function claudeCliEnv(base = process.env) {
|
|
149
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
150
|
+
return base;
|
|
151
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
152
|
+
if (!present.length)
|
|
153
|
+
return base;
|
|
154
|
+
if (!warned) {
|
|
155
|
+
warned = true;
|
|
156
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
157
|
+
}
|
|
158
|
+
const scrubbed = { ...base };
|
|
159
|
+
for (const k of AUTH_VARS)
|
|
160
|
+
delete scrubbed[k];
|
|
161
|
+
return scrubbed;
|
|
162
|
+
}
|
|
163
|
+
|
|
145
164
|
// ../../lib/agents/shared/adapter.ts
|
|
146
165
|
function extractJson(text2) {
|
|
147
166
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -246,7 +265,9 @@ var cliAdapter = {
|
|
|
246
265
|
await new Promise((resolve2, reject) => {
|
|
247
266
|
const child = spawn(CLAUDE_BIN, args, {
|
|
248
267
|
cwd: inv.cwd ?? inv.addDir,
|
|
249
|
-
|
|
268
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
269
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
270
|
+
env: claudeCliEnv(),
|
|
250
271
|
stdio: ["ignore", "pipe", "pipe"],
|
|
251
272
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
252
273
|
// its own children that otherwise orphan and pile up — the root cause of
|
|
@@ -265,6 +265,25 @@ import { spawn } from "child_process";
|
|
|
265
265
|
import { promises as fs4 } from "fs";
|
|
266
266
|
import path5 from "path";
|
|
267
267
|
|
|
268
|
+
// ../coding-core/dist/env.js
|
|
269
|
+
var AUTH_VARS = ["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
270
|
+
var warned = false;
|
|
271
|
+
function claudeCliEnv(base = process.env) {
|
|
272
|
+
if (process.env.POLYMATH_USE_API_KEY === "1")
|
|
273
|
+
return base;
|
|
274
|
+
const present = AUTH_VARS.filter((k) => base[k]);
|
|
275
|
+
if (!present.length)
|
|
276
|
+
return base;
|
|
277
|
+
if (!warned) {
|
|
278
|
+
warned = true;
|
|
279
|
+
console.error(`[polymath-society] ${present.join(" + ")} is set in your shell \u2014 ignoring it so the analysis runs on your claude.ai login (the key would take over auth and either fail or bill your API account). Set POLYMATH_USE_API_KEY=1 if you really want the API key used.`);
|
|
280
|
+
}
|
|
281
|
+
const scrubbed = { ...base };
|
|
282
|
+
for (const k of AUTH_VARS)
|
|
283
|
+
delete scrubbed[k];
|
|
284
|
+
return scrubbed;
|
|
285
|
+
}
|
|
286
|
+
|
|
268
287
|
// ../../lib/agents/shared/adapter.ts
|
|
269
288
|
function extractJson(text2) {
|
|
270
289
|
const fences = [...text2.matchAll(/```json\s*([\s\S]*?)```/gi)];
|
|
@@ -369,7 +388,9 @@ var cliAdapter = {
|
|
|
369
388
|
await new Promise((resolve2, reject) => {
|
|
370
389
|
const child = spawn(CLAUDE_BIN, args, {
|
|
371
390
|
cwd: inv.cwd ?? inv.addDir,
|
|
372
|
-
|
|
391
|
+
// scrubbed: a stray ANTHROPIC_API_KEY in the user's shell hijacks the
|
|
392
|
+
// claude CLI away from their claude.ai login (coding-core/env.ts)
|
|
393
|
+
env: claudeCliEnv(),
|
|
373
394
|
stdio: ["ignore", "pipe", "pipe"],
|
|
374
395
|
// Own process group, so a timeout can kill the WHOLE tree (claude spawns
|
|
375
396
|
// its own children that otherwise orphan and pile up — the root cause of
|