polymath-society 0.2.29 → 0.2.31
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 +439 -285
- package/dist/engine/chat-loops.js +1 -1
- package/dist/engine/exp-allfacets.js +1 -1
- package/dist/engine/exp-person.js +1 -1
- package/dist/engine/exp-pipeline.js +1 -1
- package/dist/engine/peak-demos.js +1 -1
- package/dist/engine/person-dimension-summary.js +1 -1
- package/dist/engine/person-facet-lines.js +1 -1
- package/dist/engine/person-headline.js +1 -1
- package/dist/engine/person-report.js +1 -1
- package/dist/engine/person-self-image.js +1 -1
- package/dist/engine/public-report.js +1 -1
- package/dist/engine/run-analysis.js +1 -1
- package/dist/engine/run-tagger.js +6 -5
- package/dist/index.js +26 -20
- package/dist/pipeline/coding-agglomerate.js +1 -1
- package/dist/pipeline/coding-build.js +25 -16
- package/dist/pipeline/coding-coaching.js +1 -1
- package/dist/pipeline/coding-day-digest.js +9 -7
- package/dist/pipeline/coding-delegation.js +6 -5
- package/dist/pipeline/coding-expertise.js +1 -1
- package/dist/pipeline/coding-focus.js +1 -1
- package/dist/pipeline/coding-frontier-detail.js +1 -1
- package/dist/pipeline/coding-gap.js +1 -1
- package/dist/pipeline/coding-grade.js +13 -8
- package/dist/pipeline/coding-growth.js +1 -1
- package/dist/pipeline/coding-nutshell.js +1 -1
- package/dist/pipeline/coding-walkthrough.js +7 -6
- package/dist/pipeline/coding-workbrief.js +1 -1
- package/dist/web/app.js +13 -10
- package/dist/web/styles.css +1 -1
- package/package.json +1 -1
|
@@ -16505,7 +16505,7 @@ import path7 from "path";
|
|
|
16505
16505
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16506
16506
|
import path6 from "path";
|
|
16507
16507
|
var G = globalThis;
|
|
16508
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16508
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16509
16509
|
function write(ev) {
|
|
16510
16510
|
try {
|
|
16511
16511
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15302,7 +15302,7 @@ import path8 from "path";
|
|
|
15302
15302
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15303
15303
|
import path7 from "path";
|
|
15304
15304
|
var G = globalThis;
|
|
15305
|
-
var file = () => path7.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15305
|
+
var file = () => path7.join(process.env.POLYMATH_DATA_DIR || path7.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15306
15306
|
function write(ev) {
|
|
15307
15307
|
try {
|
|
15308
15308
|
mkdirSync(path7.dirname(file()), { recursive: true });
|
|
@@ -15302,7 +15302,7 @@ import path8 from "path";
|
|
|
15302
15302
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15303
15303
|
import path7 from "path";
|
|
15304
15304
|
var G = globalThis;
|
|
15305
|
-
var file = () => path7.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15305
|
+
var file = () => path7.join(process.env.POLYMATH_DATA_DIR || path7.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15306
15306
|
function write(ev) {
|
|
15307
15307
|
try {
|
|
15308
15308
|
mkdirSync(path7.dirname(file()), { recursive: true });
|
|
@@ -15297,7 +15297,7 @@ import path7 from "path";
|
|
|
15297
15297
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15298
15298
|
import path6 from "path";
|
|
15299
15299
|
var G = globalThis;
|
|
15300
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15300
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15301
15301
|
function write(ev) {
|
|
15302
15302
|
try {
|
|
15303
15303
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -16293,7 +16293,7 @@ import path9 from "path";
|
|
|
16293
16293
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16294
16294
|
import path8 from "path";
|
|
16295
16295
|
var G = globalThis;
|
|
16296
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16296
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16297
16297
|
function write(ev) {
|
|
16298
16298
|
try {
|
|
16299
16299
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -16293,7 +16293,7 @@ import path9 from "path";
|
|
|
16293
16293
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16294
16294
|
import path8 from "path";
|
|
16295
16295
|
var G = globalThis;
|
|
16296
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16296
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16297
16297
|
function write(ev) {
|
|
16298
16298
|
try {
|
|
16299
16299
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -16293,7 +16293,7 @@ import path9 from "path";
|
|
|
16293
16293
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16294
16294
|
import path8 from "path";
|
|
16295
16295
|
var G = globalThis;
|
|
16296
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16296
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16297
16297
|
function write(ev) {
|
|
16298
16298
|
try {
|
|
16299
16299
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -16293,7 +16293,7 @@ import path9 from "path";
|
|
|
16293
16293
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16294
16294
|
import path8 from "path";
|
|
16295
16295
|
var G = globalThis;
|
|
16296
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16296
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16297
16297
|
function write(ev) {
|
|
16298
16298
|
try {
|
|
16299
16299
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -16293,7 +16293,7 @@ import path9 from "path";
|
|
|
16293
16293
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16294
16294
|
import path8 from "path";
|
|
16295
16295
|
var G = globalThis;
|
|
16296
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16296
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16297
16297
|
function write(ev) {
|
|
16298
16298
|
try {
|
|
16299
16299
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -16245,7 +16245,7 @@ import path10 from "path";
|
|
|
16245
16245
|
import { appendFileSync, mkdirSync } from "fs";
|
|
16246
16246
|
import path9 from "path";
|
|
16247
16247
|
var G = globalThis;
|
|
16248
|
-
var file = () => path9.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
16248
|
+
var file = () => path9.join(process.env.POLYMATH_DATA_DIR || path9.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
16249
16249
|
function write(ev) {
|
|
16250
16250
|
try {
|
|
16251
16251
|
mkdirSync(path9.dirname(file()), { recursive: true });
|
|
@@ -15291,7 +15291,7 @@ import path7 from "path";
|
|
|
15291
15291
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15292
15292
|
import path6 from "path";
|
|
15293
15293
|
var G = globalThis;
|
|
15294
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15294
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15295
15295
|
function write(ev) {
|
|
15296
15296
|
try {
|
|
15297
15297
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15414,7 +15414,7 @@ import path10 from "path";
|
|
|
15414
15414
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15415
15415
|
import path9 from "path";
|
|
15416
15416
|
var G = globalThis;
|
|
15417
|
-
var file = () => path9.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15417
|
+
var file = () => path9.join(process.env.POLYMATH_DATA_DIR || path9.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15418
15418
|
function write(ev) {
|
|
15419
15419
|
try {
|
|
15420
15420
|
mkdirSync(path9.dirname(file()), { recursive: true });
|
|
@@ -15391,7 +15391,7 @@ import path9 from "path";
|
|
|
15391
15391
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15392
15392
|
import path8 from "path";
|
|
15393
15393
|
var G = globalThis;
|
|
15394
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15394
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15395
15395
|
function write(ev) {
|
|
15396
15396
|
try {
|
|
15397
15397
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -15403,10 +15403,11 @@ function hhmm() {
|
|
|
15403
15403
|
const d = /* @__PURE__ */ new Date();
|
|
15404
15404
|
return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
15405
15405
|
}
|
|
15406
|
-
function startRun(label, total) {
|
|
15407
|
-
G.__runStats = { label, total, done:
|
|
15408
|
-
console.log(`[run-stats] START "${label}" \u2014 ${total} items @ ${hhmm()}`);
|
|
15409
|
-
|
|
15406
|
+
function startRun(label, total, alreadyDone = 0) {
|
|
15407
|
+
G.__runStats = { label, total, done: alreadyDone, failed: 0, startedAt: Date.now(), limitHits: 0, lastWall: 0 };
|
|
15408
|
+
console.log(`[run-stats] START "${label}" \u2014 ${total} items${alreadyDone ? ` (${alreadyDone} already done, resuming)` : ""} @ ${hhmm()}`);
|
|
15409
|
+
if (alreadyDone > 0) console.log(` \u03A3 ${alreadyDone}/${total}`);
|
|
15410
|
+
write({ event: "start", label, total, ...alreadyDone ? { alreadyDone } : {} });
|
|
15410
15411
|
}
|
|
15411
15412
|
function snapshot() {
|
|
15412
15413
|
const p = G.__runStats;
|
package/dist/index.js
CHANGED
|
@@ -444,7 +444,8 @@ var init_cursor = __esm({
|
|
|
444
444
|
});
|
|
445
445
|
|
|
446
446
|
// ../coding-core/dist/raw.js
|
|
447
|
-
import { promises as fs2 } from "fs";
|
|
447
|
+
import { promises as fs2, createReadStream } from "fs";
|
|
448
|
+
import readline from "readline";
|
|
448
449
|
import path from "path";
|
|
449
450
|
import os from "os";
|
|
450
451
|
function resolveSourceRoot(envVar, ...defaultSegments) {
|
|
@@ -551,10 +552,18 @@ function blank(sessionId, source, file2) {
|
|
|
551
552
|
klassReason: ""
|
|
552
553
|
};
|
|
553
554
|
}
|
|
554
|
-
function
|
|
555
|
+
function jsonlLines(file2) {
|
|
556
|
+
return readline.createInterface({ input: createReadStream(file2, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
557
|
+
}
|
|
558
|
+
function shedAgentBulk(s) {
|
|
559
|
+
if (s.klass === "agent" && s.events.length > 2)
|
|
560
|
+
s.events = [s.events[0], s.events[s.events.length - 1]];
|
|
561
|
+
return s;
|
|
562
|
+
}
|
|
563
|
+
async function parseClaudeCode(input, sessionId, file2) {
|
|
555
564
|
const s = blank(sessionId, "claude-code", file2);
|
|
556
565
|
const seen = /* @__PURE__ */ new Set();
|
|
557
|
-
for (const lineRaw of
|
|
566
|
+
for await (const lineRaw of typeof input === "string" ? input.split("\n") : input) {
|
|
558
567
|
const line = lineRaw.trim();
|
|
559
568
|
if (!line)
|
|
560
569
|
continue;
|
|
@@ -656,7 +665,7 @@ function parseClaudeCode(raw, sessionId, file2) {
|
|
|
656
665
|
const c = classify(s);
|
|
657
666
|
s.klass = c.klass;
|
|
658
667
|
s.klassReason = c.reason;
|
|
659
|
-
return s;
|
|
668
|
+
return shedAgentBulk(s);
|
|
660
669
|
}
|
|
661
670
|
function codexText(content) {
|
|
662
671
|
if (typeof content === "string")
|
|
@@ -678,10 +687,10 @@ function codexText(content) {
|
|
|
678
687
|
}
|
|
679
688
|
return "";
|
|
680
689
|
}
|
|
681
|
-
function parseCodex(
|
|
690
|
+
async function parseCodex(input, file2) {
|
|
682
691
|
let sessionId = path.basename(file2, ".jsonl");
|
|
683
692
|
const s = blank(sessionId, "codex", file2);
|
|
684
|
-
for (const lineRaw of
|
|
693
|
+
for await (const lineRaw of typeof input === "string" ? input.split("\n") : input) {
|
|
685
694
|
const line = lineRaw.trim();
|
|
686
695
|
if (!line)
|
|
687
696
|
continue;
|
|
@@ -747,7 +756,7 @@ function parseCodex(raw, file2) {
|
|
|
747
756
|
const c = classify(s);
|
|
748
757
|
s.klass = c.klass;
|
|
749
758
|
s.klassReason = c.reason;
|
|
750
|
-
return s;
|
|
759
|
+
return shedAgentBulk(s);
|
|
751
760
|
}
|
|
752
761
|
async function readClaudeCodeAt(base2, machine) {
|
|
753
762
|
const out = [];
|
|
@@ -771,13 +780,12 @@ async function readClaudeCodeAt(base2, machine) {
|
|
|
771
780
|
}
|
|
772
781
|
for (const f of files) {
|
|
773
782
|
const file2 = path.join(full, f);
|
|
774
|
-
let
|
|
783
|
+
let s = null;
|
|
775
784
|
try {
|
|
776
|
-
|
|
785
|
+
s = await parseClaudeCode(jsonlLines(file2), path.basename(f, ".jsonl"), file2);
|
|
777
786
|
} catch {
|
|
778
787
|
continue;
|
|
779
788
|
}
|
|
780
|
-
const s = parseClaudeCode(raw, path.basename(f, ".jsonl"), file2);
|
|
781
789
|
if (s) {
|
|
782
790
|
if (machine)
|
|
783
791
|
s.machine = machine;
|
|
@@ -812,13 +820,12 @@ async function readCodexAt(base2, machine) {
|
|
|
812
820
|
await walkJsonl(base2, files);
|
|
813
821
|
const out = [];
|
|
814
822
|
for (const file2 of files) {
|
|
815
|
-
let
|
|
823
|
+
let s = null;
|
|
816
824
|
try {
|
|
817
|
-
|
|
825
|
+
s = await parseCodex(jsonlLines(file2), file2);
|
|
818
826
|
} catch {
|
|
819
827
|
continue;
|
|
820
828
|
}
|
|
821
|
-
const s = parseCodex(raw, file2);
|
|
822
829
|
if (s) {
|
|
823
830
|
if (machine)
|
|
824
831
|
s.machine = machine;
|
|
@@ -1024,7 +1031,7 @@ function rawSessionFromCursorComposer(c, file2, cwd) {
|
|
|
1024
1031
|
const cl = classify(s);
|
|
1025
1032
|
s.klass = cl.klass;
|
|
1026
1033
|
s.klassReason = cl.reason;
|
|
1027
|
-
return s;
|
|
1034
|
+
return shedAgentBulk(s);
|
|
1028
1035
|
}
|
|
1029
1036
|
function parseCursorTranscript(raw, composerId, file2, ws, fileMtime) {
|
|
1030
1037
|
const s = blank(composerId, "cursor", file2);
|
|
@@ -1069,7 +1076,7 @@ function parseCursorTranscript(raw, composerId, file2, ws, fileMtime) {
|
|
|
1069
1076
|
const c = classify(s);
|
|
1070
1077
|
s.klass = c.klass;
|
|
1071
1078
|
s.klassReason = c.reason;
|
|
1072
|
-
return s;
|
|
1079
|
+
return shedAgentBulk(s);
|
|
1073
1080
|
}
|
|
1074
1081
|
function cursorWorkspaceSession(ws, idx) {
|
|
1075
1082
|
if (ws.generations.length === 0)
|
|
@@ -1091,7 +1098,7 @@ function cursorWorkspaceSession(ws, idx) {
|
|
|
1091
1098
|
const c = classify(s);
|
|
1092
1099
|
s.klass = c.klass;
|
|
1093
1100
|
s.klassReason = c.reason;
|
|
1094
|
-
return s;
|
|
1101
|
+
return shedAgentBulk(s);
|
|
1095
1102
|
}
|
|
1096
1103
|
async function readCursorAt(roots, machine) {
|
|
1097
1104
|
const workspaces = await readCursorWorkspaces(roots.workspace);
|
|
@@ -1205,6 +1212,8 @@ async function readAllSessions(opts2 = {}) {
|
|
|
1205
1212
|
]);
|
|
1206
1213
|
const all = [...cc, ...cx, ...cr, ...mm];
|
|
1207
1214
|
demoteTemplateFanouts(all);
|
|
1215
|
+
for (const s of all)
|
|
1216
|
+
shedAgentBulk(s);
|
|
1208
1217
|
return all;
|
|
1209
1218
|
}
|
|
1210
1219
|
var SOURCE_ROOT_ENV_VARS, anyRootOverridden, claudeProjectsRoot, codexSessionsRoot, cursorWorkspaceRoot, cursorProjectsRoot, cursorGlobalRoot, MACHINE_CURSOR_FILE_RE, SKIP_DIR_RE, AGENT_CWD_RE, PERSONA_RE, OUTPUT_CONTRACT_RES, CAPS_HEADER_RE, PING_RE, ms, CURSOR_USER_QUERY_RE2, NODE_SQLITE2, FANOUT_PREFIX, FANOUT_MIN_SESSIONS;
|
|
@@ -18247,7 +18256,7 @@ var init_runStats = __esm({
|
|
|
18247
18256
|
"../../lib/agents/shared/runStats.ts"() {
|
|
18248
18257
|
"use strict";
|
|
18249
18258
|
G = globalThis;
|
|
18250
|
-
file = () => path10.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
18259
|
+
file = () => path10.join(process.env.POLYMATH_DATA_DIR || path10.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
18251
18260
|
}
|
|
18252
18261
|
});
|
|
18253
18262
|
|
|
@@ -25099,13 +25108,10 @@ function electronAppData() {
|
|
|
25099
25108
|
function resolveDataRoot(env = process.env, cwd = process.cwd(), appData = electronAppData, home = os6.homedir()) {
|
|
25100
25109
|
const fromEnv = env.POLYMATH_DATA_DIR;
|
|
25101
25110
|
if (fromEnv && fromEnv.trim()) return path26.resolve(fromEnv);
|
|
25102
|
-
const local = path26.join(cwd, ".data");
|
|
25103
25111
|
const dflt = path26.join(home, ".polymath-society", "data");
|
|
25104
|
-
if (existsSync4(local) && hasCompletedAnalysis(local)) return local;
|
|
25105
25112
|
const fromApp = appData();
|
|
25106
25113
|
if (fromApp && hasCompletedAnalysis(fromApp)) return fromApp;
|
|
25107
25114
|
if (hasCompletedAnalysis(dflt)) return dflt;
|
|
25108
|
-
if (existsSync4(local)) return local;
|
|
25109
25115
|
if (fromApp) return fromApp;
|
|
25110
25116
|
return dflt;
|
|
25111
25117
|
}
|
|
@@ -15300,7 +15300,7 @@ import path7 from "path";
|
|
|
15300
15300
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15301
15301
|
import path6 from "path";
|
|
15302
15302
|
var G = globalThis;
|
|
15303
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15303
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15304
15304
|
function write(ev) {
|
|
15305
15305
|
try {
|
|
15306
15306
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -5,7 +5,8 @@ import { promises as fs4 } from "fs";
|
|
|
5
5
|
import path3 from "path";
|
|
6
6
|
|
|
7
7
|
// ../coding-core/dist/raw.js
|
|
8
|
-
import { promises as fs2 } from "fs";
|
|
8
|
+
import { promises as fs2, createReadStream } from "fs";
|
|
9
|
+
import readline from "readline";
|
|
9
10
|
import path from "path";
|
|
10
11
|
import os from "os";
|
|
11
12
|
|
|
@@ -481,10 +482,18 @@ var ms = (ts) => {
|
|
|
481
482
|
const n = Date.parse(ts);
|
|
482
483
|
return Number.isFinite(n) ? n : null;
|
|
483
484
|
};
|
|
484
|
-
function
|
|
485
|
+
function jsonlLines(file) {
|
|
486
|
+
return readline.createInterface({ input: createReadStream(file, { encoding: "utf-8" }), crlfDelay: Infinity });
|
|
487
|
+
}
|
|
488
|
+
function shedAgentBulk(s) {
|
|
489
|
+
if (s.klass === "agent" && s.events.length > 2)
|
|
490
|
+
s.events = [s.events[0], s.events[s.events.length - 1]];
|
|
491
|
+
return s;
|
|
492
|
+
}
|
|
493
|
+
async function parseClaudeCode(input, sessionId, file) {
|
|
485
494
|
const s = blank(sessionId, "claude-code", file);
|
|
486
495
|
const seen = /* @__PURE__ */ new Set();
|
|
487
|
-
for (const lineRaw of
|
|
496
|
+
for await (const lineRaw of typeof input === "string" ? input.split("\n") : input) {
|
|
488
497
|
const line = lineRaw.trim();
|
|
489
498
|
if (!line)
|
|
490
499
|
continue;
|
|
@@ -586,7 +595,7 @@ function parseClaudeCode(raw, sessionId, file) {
|
|
|
586
595
|
const c = classify(s);
|
|
587
596
|
s.klass = c.klass;
|
|
588
597
|
s.klassReason = c.reason;
|
|
589
|
-
return s;
|
|
598
|
+
return shedAgentBulk(s);
|
|
590
599
|
}
|
|
591
600
|
function codexText(content) {
|
|
592
601
|
if (typeof content === "string")
|
|
@@ -608,10 +617,10 @@ function codexText(content) {
|
|
|
608
617
|
}
|
|
609
618
|
return "";
|
|
610
619
|
}
|
|
611
|
-
function parseCodex(
|
|
620
|
+
async function parseCodex(input, file) {
|
|
612
621
|
let sessionId = path.basename(file, ".jsonl");
|
|
613
622
|
const s = blank(sessionId, "codex", file);
|
|
614
|
-
for (const lineRaw of
|
|
623
|
+
for await (const lineRaw of typeof input === "string" ? input.split("\n") : input) {
|
|
615
624
|
const line = lineRaw.trim();
|
|
616
625
|
if (!line)
|
|
617
626
|
continue;
|
|
@@ -677,7 +686,7 @@ function parseCodex(raw, file) {
|
|
|
677
686
|
const c = classify(s);
|
|
678
687
|
s.klass = c.klass;
|
|
679
688
|
s.klassReason = c.reason;
|
|
680
|
-
return s;
|
|
689
|
+
return shedAgentBulk(s);
|
|
681
690
|
}
|
|
682
691
|
async function readClaudeCodeAt(base, machine) {
|
|
683
692
|
const out = [];
|
|
@@ -701,13 +710,12 @@ async function readClaudeCodeAt(base, machine) {
|
|
|
701
710
|
}
|
|
702
711
|
for (const f of files) {
|
|
703
712
|
const file = path.join(full, f);
|
|
704
|
-
let
|
|
713
|
+
let s = null;
|
|
705
714
|
try {
|
|
706
|
-
|
|
715
|
+
s = await parseClaudeCode(jsonlLines(file), path.basename(f, ".jsonl"), file);
|
|
707
716
|
} catch {
|
|
708
717
|
continue;
|
|
709
718
|
}
|
|
710
|
-
const s = parseClaudeCode(raw, path.basename(f, ".jsonl"), file);
|
|
711
719
|
if (s) {
|
|
712
720
|
if (machine)
|
|
713
721
|
s.machine = machine;
|
|
@@ -742,13 +750,12 @@ async function readCodexAt(base, machine) {
|
|
|
742
750
|
await walkJsonl(base, files);
|
|
743
751
|
const out = [];
|
|
744
752
|
for (const file of files) {
|
|
745
|
-
let
|
|
753
|
+
let s = null;
|
|
746
754
|
try {
|
|
747
|
-
|
|
755
|
+
s = await parseCodex(jsonlLines(file), file);
|
|
748
756
|
} catch {
|
|
749
757
|
continue;
|
|
750
758
|
}
|
|
751
|
-
const s = parseCodex(raw, file);
|
|
752
759
|
if (s) {
|
|
753
760
|
if (machine)
|
|
754
761
|
s.machine = machine;
|
|
@@ -956,7 +963,7 @@ function rawSessionFromCursorComposer(c, file, cwd) {
|
|
|
956
963
|
const cl = classify(s);
|
|
957
964
|
s.klass = cl.klass;
|
|
958
965
|
s.klassReason = cl.reason;
|
|
959
|
-
return s;
|
|
966
|
+
return shedAgentBulk(s);
|
|
960
967
|
}
|
|
961
968
|
function parseCursorTranscript(raw, composerId, file, ws, fileMtime) {
|
|
962
969
|
const s = blank(composerId, "cursor", file);
|
|
@@ -1001,7 +1008,7 @@ function parseCursorTranscript(raw, composerId, file, ws, fileMtime) {
|
|
|
1001
1008
|
const c = classify(s);
|
|
1002
1009
|
s.klass = c.klass;
|
|
1003
1010
|
s.klassReason = c.reason;
|
|
1004
|
-
return s;
|
|
1011
|
+
return shedAgentBulk(s);
|
|
1005
1012
|
}
|
|
1006
1013
|
function cursorWorkspaceSession(ws, idx) {
|
|
1007
1014
|
if (ws.generations.length === 0)
|
|
@@ -1023,7 +1030,7 @@ function cursorWorkspaceSession(ws, idx) {
|
|
|
1023
1030
|
const c = classify(s);
|
|
1024
1031
|
s.klass = c.klass;
|
|
1025
1032
|
s.klassReason = c.reason;
|
|
1026
|
-
return s;
|
|
1033
|
+
return shedAgentBulk(s);
|
|
1027
1034
|
}
|
|
1028
1035
|
async function readCursorAt(roots, machine) {
|
|
1029
1036
|
const workspaces = await readCursorWorkspaces(roots.workspace);
|
|
@@ -1139,6 +1146,8 @@ async function readAllSessions(opts = {}) {
|
|
|
1139
1146
|
]);
|
|
1140
1147
|
const all = [...cc, ...cx, ...cr, ...mm];
|
|
1141
1148
|
demoteTemplateFanouts(all);
|
|
1149
|
+
for (const s of all)
|
|
1150
|
+
shedAgentBulk(s);
|
|
1142
1151
|
return all;
|
|
1143
1152
|
}
|
|
1144
1153
|
|
|
@@ -15294,7 +15294,7 @@ import path7 from "path";
|
|
|
15294
15294
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15295
15295
|
import path6 from "path";
|
|
15296
15296
|
var G = globalThis;
|
|
15297
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15297
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15298
15298
|
function write(ev) {
|
|
15299
15299
|
try {
|
|
15300
15300
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15300,7 +15300,7 @@ import path7 from "path";
|
|
|
15300
15300
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15301
15301
|
import path6 from "path";
|
|
15302
15302
|
var G = globalThis;
|
|
15303
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15303
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15304
15304
|
function write(ev) {
|
|
15305
15305
|
try {
|
|
15306
15306
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15312,10 +15312,11 @@ function hhmm() {
|
|
|
15312
15312
|
const d = /* @__PURE__ */ new Date();
|
|
15313
15313
|
return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
15314
15314
|
}
|
|
15315
|
-
function startRun(label, total) {
|
|
15316
|
-
G.__runStats = { label, total, done:
|
|
15317
|
-
console.log(`[run-stats] START "${label}" \u2014 ${total} items @ ${hhmm()}`);
|
|
15318
|
-
|
|
15315
|
+
function startRun(label, total, alreadyDone = 0) {
|
|
15316
|
+
G.__runStats = { label, total, done: alreadyDone, failed: 0, startedAt: Date.now(), limitHits: 0, lastWall: 0 };
|
|
15317
|
+
console.log(`[run-stats] START "${label}" \u2014 ${total} items${alreadyDone ? ` (${alreadyDone} already done, resuming)` : ""} @ ${hhmm()}`);
|
|
15318
|
+
if (alreadyDone > 0) console.log(` \u03A3 ${alreadyDone}/${total}`);
|
|
15319
|
+
write({ event: "start", label, total, ...alreadyDone ? { alreadyDone } : {} });
|
|
15319
15320
|
}
|
|
15320
15321
|
function snapshot() {
|
|
15321
15322
|
const p = G.__runStats;
|
|
@@ -16592,9 +16593,10 @@ async function main() {
|
|
|
16592
16593
|
};
|
|
16593
16594
|
await fs7.writeFile(OUT, JSON.stringify(out, null, 2));
|
|
16594
16595
|
const cutoffDay = aiWindowCutoff(sessions).slice(0, 10);
|
|
16595
|
-
const
|
|
16596
|
+
const inWindow2 = dayConvs.filter((dc) => !cutoffDay || dc.date >= cutoffDay);
|
|
16597
|
+
const todo = inWindow2.filter((dc) => REDO || !done.get(dc.date)?.overall);
|
|
16596
16598
|
console.log(`[day-digest] digesting ${todo.length} days${cutoffDay ? ` since ${cutoffDay} (AI window)` : ""} on ${model}, conc ${CONC} (newest first)\u2026`);
|
|
16597
|
-
startRun("day-digest", todo.length);
|
|
16599
|
+
startRun("day-digest", inWindow2.length, inWindow2.length - todo.length);
|
|
16598
16600
|
let writeChain = Promise.resolve();
|
|
16599
16601
|
const save = () => writeChain = writeChain.then(() => fs7.writeFile(OUT, JSON.stringify(out, null, 2)));
|
|
16600
16602
|
let cursor = 0;
|
|
@@ -15300,7 +15300,7 @@ import path7 from "path";
|
|
|
15300
15300
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15301
15301
|
import path6 from "path";
|
|
15302
15302
|
var G = globalThis;
|
|
15303
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15303
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15304
15304
|
function write(ev) {
|
|
15305
15305
|
try {
|
|
15306
15306
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15312,10 +15312,11 @@ function hhmm() {
|
|
|
15312
15312
|
const d = /* @__PURE__ */ new Date();
|
|
15313
15313
|
return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
15314
15314
|
}
|
|
15315
|
-
function startRun(label, total) {
|
|
15316
|
-
G.__runStats = { label, total, done:
|
|
15317
|
-
console.log(`[run-stats] START "${label}" \u2014 ${total} items @ ${hhmm()}`);
|
|
15318
|
-
|
|
15315
|
+
function startRun(label, total, alreadyDone = 0) {
|
|
15316
|
+
G.__runStats = { label, total, done: alreadyDone, failed: 0, startedAt: Date.now(), limitHits: 0, lastWall: 0 };
|
|
15317
|
+
console.log(`[run-stats] START "${label}" \u2014 ${total} items${alreadyDone ? ` (${alreadyDone} already done, resuming)` : ""} @ ${hhmm()}`);
|
|
15318
|
+
if (alreadyDone > 0) console.log(` \u03A3 ${alreadyDone}/${total}`);
|
|
15319
|
+
write({ event: "start", label, total, ...alreadyDone ? { alreadyDone } : {} });
|
|
15319
15320
|
}
|
|
15320
15321
|
function snapshot() {
|
|
15321
15322
|
const p = G.__runStats;
|
|
@@ -15296,7 +15296,7 @@ import path7 from "path";
|
|
|
15296
15296
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15297
15297
|
import path6 from "path";
|
|
15298
15298
|
var G = globalThis;
|
|
15299
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15299
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15300
15300
|
function write(ev) {
|
|
15301
15301
|
try {
|
|
15302
15302
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15355,7 +15355,7 @@ import path7 from "path";
|
|
|
15355
15355
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15356
15356
|
import path6 from "path";
|
|
15357
15357
|
var G = globalThis;
|
|
15358
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15358
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15359
15359
|
function write(ev) {
|
|
15360
15360
|
try {
|
|
15361
15361
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15294,7 +15294,7 @@ import path7 from "path";
|
|
|
15294
15294
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15295
15295
|
import path6 from "path";
|
|
15296
15296
|
var G = globalThis;
|
|
15297
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15297
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15298
15298
|
function write(ev) {
|
|
15299
15299
|
try {
|
|
15300
15300
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15342,7 +15342,7 @@ import path7 from "path";
|
|
|
15342
15342
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15343
15343
|
import path6 from "path";
|
|
15344
15344
|
var G = globalThis;
|
|
15345
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15345
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15346
15346
|
function write(ev) {
|
|
15347
15347
|
try {
|
|
15348
15348
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15300,7 +15300,7 @@ import path7 from "path";
|
|
|
15300
15300
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15301
15301
|
import path6 from "path";
|
|
15302
15302
|
var G = globalThis;
|
|
15303
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15303
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15304
15304
|
function write(ev) {
|
|
15305
15305
|
try {
|
|
15306
15306
|
mkdirSync(path6.dirname(file()), { recursive: true });
|
|
@@ -15312,10 +15312,11 @@ function hhmm() {
|
|
|
15312
15312
|
const d = /* @__PURE__ */ new Date();
|
|
15313
15313
|
return `${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
15314
15314
|
}
|
|
15315
|
-
function startRun(label, total) {
|
|
15316
|
-
G.__runStats = { label, total, done:
|
|
15317
|
-
console.log(`[run-stats] START "${label}" \u2014 ${total} items @ ${hhmm()}`);
|
|
15318
|
-
|
|
15315
|
+
function startRun(label, total, alreadyDone = 0) {
|
|
15316
|
+
G.__runStats = { label, total, done: alreadyDone, failed: 0, startedAt: Date.now(), limitHits: 0, lastWall: 0 };
|
|
15317
|
+
console.log(`[run-stats] START "${label}" \u2014 ${total} items${alreadyDone ? ` (${alreadyDone} already done, resuming)` : ""} @ ${hhmm()}`);
|
|
15318
|
+
if (alreadyDone > 0) console.log(` \u03A3 ${alreadyDone}/${total}`);
|
|
15319
|
+
write({ event: "start", label, total, ...alreadyDone ? { alreadyDone } : {} });
|
|
15319
15320
|
}
|
|
15320
15321
|
function snapshot() {
|
|
15321
15322
|
const p = G.__runStats;
|
|
@@ -16826,18 +16827,22 @@ async function main() {
|
|
|
16826
16827
|
await fs7.mkdir(LOGS, { recursive: true });
|
|
16827
16828
|
const limit = ALL ? ranked.length : N;
|
|
16828
16829
|
const picked = [];
|
|
16830
|
+
let alreadyGraded = 0;
|
|
16829
16831
|
for (const s of ranked) {
|
|
16830
16832
|
if (picked.length >= limit) break;
|
|
16831
16833
|
if (!REGRADE) {
|
|
16832
16834
|
const done = await fs7.readFile(path12.join(GRADES2, `${s.sessionId}.json`), "utf8").catch(() => null);
|
|
16833
|
-
if (done)
|
|
16835
|
+
if (done) {
|
|
16836
|
+
alreadyGraded++;
|
|
16837
|
+
continue;
|
|
16838
|
+
}
|
|
16834
16839
|
}
|
|
16835
16840
|
picked.push(s);
|
|
16836
16841
|
}
|
|
16837
16842
|
console.log(`[coding-grade] grading ${picked.length}${ALL ? " (ALL gradable, resuming)" : ""} on ${MODEL}, conc ${CONC}\u2026`);
|
|
16838
16843
|
console.log(` (each session below is a single small ${MODEL} call \u2014 a long run is many tiny calls, not a huge one)`);
|
|
16839
16844
|
const lim = makeLimiter(CONC);
|
|
16840
|
-
startRun("coding-grade", picked.length);
|
|
16845
|
+
startRun("coding-grade", alreadyGraded + picked.length, alreadyGraded);
|
|
16841
16846
|
let doneN = 0, sumUsd = 0, sumCalls = 0;
|
|
16842
16847
|
const runT0 = Date.now();
|
|
16843
16848
|
await Promise.all(picked.map((s) => lim(async () => {
|
|
@@ -16855,7 +16860,7 @@ async function main() {
|
|
|
16855
16860
|
sumUsd += g.meta.costUsd ?? 0;
|
|
16856
16861
|
sumCalls += g.meta.calls ?? 0;
|
|
16857
16862
|
const elapsedMin = (Date.now() - runT0) / 6e4;
|
|
16858
|
-
console.log(` \u03A3 ${doneN}/${picked.length} \xB7 ${elapsedMin.toFixed(0)}m elapsed \u2192 ~${(elapsedMin / doneN * picked.length / 60).toFixed(1)}h total for this run (small ${MODEL} calls)`);
|
|
16863
|
+
console.log(` \u03A3 ${alreadyGraded + doneN}/${alreadyGraded + picked.length} \xB7 ${elapsedMin.toFixed(0)}m elapsed \u2192 ~${(elapsedMin / doneN * picked.length / 60).toFixed(1)}h total for this run (small ${MODEL} calls)`);
|
|
16859
16864
|
} catch (e) {
|
|
16860
16865
|
tick(false);
|
|
16861
16866
|
console.log(` \u2022 "${s.title.slice(0, 48)}" ERROR ${e.message.slice(0, 60)}`);
|
|
@@ -15971,7 +15971,7 @@ import path9 from "path";
|
|
|
15971
15971
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15972
15972
|
import path8 from "path";
|
|
15973
15973
|
var G = globalThis;
|
|
15974
|
-
var file = () => path8.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15974
|
+
var file = () => path8.join(process.env.POLYMATH_DATA_DIR || path8.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15975
15975
|
function write(ev) {
|
|
15976
15976
|
try {
|
|
15977
15977
|
mkdirSync(path8.dirname(file()), { recursive: true });
|
|
@@ -15296,7 +15296,7 @@ import path7 from "path";
|
|
|
15296
15296
|
import { appendFileSync, mkdirSync } from "fs";
|
|
15297
15297
|
import path6 from "path";
|
|
15298
15298
|
var G = globalThis;
|
|
15299
|
-
var file = () => path6.join(process.cwd(), ".data", "run-stats.jsonl");
|
|
15299
|
+
var file = () => path6.join(process.env.POLYMATH_DATA_DIR || path6.join(process.cwd(), ".data"), "run-stats.jsonl");
|
|
15300
15300
|
function write(ev) {
|
|
15301
15301
|
try {
|
|
15302
15302
|
mkdirSync(path6.dirname(file()), { recursive: true });
|