polymath-society 0.2.19 → 0.2.21

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.
Files changed (40) hide show
  1. package/dist/cli.js +24620 -22073
  2. package/dist/engine/chat-loops.js +8 -1
  3. package/dist/engine/exp-allfacets.js +8 -1
  4. package/dist/engine/exp-person.js +8 -1
  5. package/dist/engine/exp-pipeline.js +8 -1
  6. package/dist/engine/ingest-export.js +7 -6
  7. package/dist/engine/peak-demos.js +8 -1
  8. package/dist/engine/person-dimension-summary.js +8 -1
  9. package/dist/engine/person-facet-lines.js +8 -1
  10. package/dist/engine/person-headline.js +8 -1
  11. package/dist/engine/person-report.js +8 -1
  12. package/dist/engine/person-self-image.js +8 -1
  13. package/dist/engine/public-report.js +15 -7
  14. package/dist/engine/run-analysis.js +8 -1
  15. package/dist/engine/run-tagger.js +8 -1
  16. package/dist/index.js +19600 -17706
  17. package/dist/pipeline/FOCUS-EXAMPLES.md +127 -0
  18. package/dist/pipeline/FOCUS-RUBRIC.md +418 -0
  19. package/dist/pipeline/coding-agglomerate.js +947 -79
  20. package/dist/pipeline/coding-aggregate.js +443 -23
  21. package/dist/pipeline/coding-build.js +569 -97
  22. package/dist/pipeline/coding-coaching.js +651 -101
  23. package/dist/pipeline/coding-day-digest.js +417 -36
  24. package/dist/pipeline/coding-delegation.js +564 -68
  25. package/dist/pipeline/coding-expertise.js +477 -59
  26. package/dist/pipeline/coding-flow.js +424 -15
  27. package/dist/pipeline/coding-focus.js +507 -51
  28. package/dist/pipeline/coding-frontier-detail.js +465 -47
  29. package/dist/pipeline/coding-frontier.js +7 -6
  30. package/dist/pipeline/coding-gap-dist.js +424 -15
  31. package/dist/pipeline/coding-gap.js +679 -128
  32. package/dist/pipeline/coding-grade.js +469 -42
  33. package/dist/pipeline/coding-growth.js +17041 -0
  34. package/dist/pipeline/coding-nutshell.js +168 -151
  35. package/dist/pipeline/coding-projects.js +7 -6
  36. package/dist/pipeline/coding-walkthrough.js +461 -37
  37. package/dist/pipeline/coding-workbrief.js +16387 -0
  38. package/dist/web/app.js +2095 -1396
  39. package/dist/web/styles.css +1 -1
  40. package/package.json +1 -1
@@ -134,13 +134,13 @@ var require_secure_json_parse = __commonJS({
134
134
  });
135
135
 
136
136
  // ../../scripts/coding-delegation.mts
137
- import { promises as fs9 } from "fs";
138
- import path12 from "path";
137
+ import { promises as fs10 } from "fs";
138
+ import path13 from "path";
139
139
 
140
140
  // ../../lib/agents/coding/delegation/detect.ts
141
- import { promises as fs6 } from "fs";
142
- import os2 from "os";
143
- import path9 from "path";
141
+ import { promises as fs7 } from "fs";
142
+ import os3 from "os";
143
+ import path10 from "path";
144
144
 
145
145
  // ../../lib/agents/shared/agent.ts
146
146
  import { readFileSync } from "fs";
@@ -508,6 +508,13 @@ ${report}`);
508
508
  }
509
509
 
510
510
  // ../../lib/agents/shared/codexAdapter.ts
511
+ var CODEX_DEFAULT_MODEL = "gpt-5.5";
512
+ var CODEX_MINI_MODEL = "gpt-5.4-mini";
513
+ function mapCodexTier(model, env = process.env) {
514
+ if (model && !/^(claude|haiku|sonnet|opus)/i.test(model)) return model;
515
+ if (model && /^haiku/i.test(model)) return env.POLYMATH_CODEX_MODEL_MINI || CODEX_MINI_MODEL;
516
+ return env.POLYMATH_CODEX_MODEL || CODEX_DEFAULT_MODEL;
517
+ }
511
518
  function composePrompt(inv, roots) {
512
519
  return [
513
520
  inv.systemPrompt ? `<system>
@@ -548,7 +555,7 @@ var codexAdapter = {
548
555
  "read-only",
549
556
  "--json"
550
557
  ];
551
- if (inv.model && !/^claude/i.test(inv.model)) args.push("--model", inv.model);
558
+ args.push("--model", mapCodexTier(inv.model));
552
559
  args.push(composePrompt(inv, roots));
553
560
  const started = Date.now();
554
561
  const toolCalls = [];
@@ -2176,8 +2183,8 @@ function getErrorMap() {
2176
2183
 
2177
2184
  // ../../node_modules/zod/v3/helpers/parseUtil.js
2178
2185
  var makeIssue = (params) => {
2179
- const { data, path: path13, errorMaps, issueData } = params;
2180
- const fullPath = [...path13, ...issueData.path || []];
2186
+ const { data, path: path14, errorMaps, issueData } = params;
2187
+ const fullPath = [...path14, ...issueData.path || []];
2181
2188
  const fullIssue = {
2182
2189
  ...issueData,
2183
2190
  path: fullPath
@@ -2293,11 +2300,11 @@ var errorUtil;
2293
2300
 
2294
2301
  // ../../node_modules/zod/v3/types.js
2295
2302
  var ParseInputLazyPath = class {
2296
- constructor(parent, value, path13, key) {
2303
+ constructor(parent, value, path14, key) {
2297
2304
  this._cachedPath = [];
2298
2305
  this.parent = parent;
2299
2306
  this.data = value;
2300
- this._path = path13;
2307
+ this._path = path14;
2301
2308
  this._key = key;
2302
2309
  }
2303
2310
  get path() {
@@ -15084,39 +15091,39 @@ function createOpenAI(options = {}) {
15084
15091
  });
15085
15092
  const createChatModel = (modelId, settings = {}) => new OpenAIChatLanguageModel(modelId, settings, {
15086
15093
  provider: `${providerName}.chat`,
15087
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15094
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15088
15095
  headers: getHeaders,
15089
15096
  compatibility,
15090
15097
  fetch: options.fetch
15091
15098
  });
15092
15099
  const createCompletionModel = (modelId, settings = {}) => new OpenAICompletionLanguageModel(modelId, settings, {
15093
15100
  provider: `${providerName}.completion`,
15094
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15101
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15095
15102
  headers: getHeaders,
15096
15103
  compatibility,
15097
15104
  fetch: options.fetch
15098
15105
  });
15099
15106
  const createEmbeddingModel = (modelId, settings = {}) => new OpenAIEmbeddingModel(modelId, settings, {
15100
15107
  provider: `${providerName}.embedding`,
15101
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15108
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15102
15109
  headers: getHeaders,
15103
15110
  fetch: options.fetch
15104
15111
  });
15105
15112
  const createImageModel = (modelId, settings = {}) => new OpenAIImageModel(modelId, settings, {
15106
15113
  provider: `${providerName}.image`,
15107
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15114
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15108
15115
  headers: getHeaders,
15109
15116
  fetch: options.fetch
15110
15117
  });
15111
15118
  const createTranscriptionModel = (modelId) => new OpenAITranscriptionModel(modelId, {
15112
15119
  provider: `${providerName}.transcription`,
15113
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15120
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15114
15121
  headers: getHeaders,
15115
15122
  fetch: options.fetch
15116
15123
  });
15117
15124
  const createSpeechModel = (modelId) => new OpenAISpeechModel(modelId, {
15118
15125
  provider: `${providerName}.speech`,
15119
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15126
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15120
15127
  headers: getHeaders,
15121
15128
  fetch: options.fetch
15122
15129
  });
@@ -15137,7 +15144,7 @@ function createOpenAI(options = {}) {
15137
15144
  const createResponsesModel = (modelId) => {
15138
15145
  return new OpenAIResponsesLanguageModel(modelId, {
15139
15146
  provider: `${providerName}.responses`,
15140
- url: ({ path: path13 }) => `${baseURL}${path13}`,
15147
+ url: ({ path: path14 }) => `${baseURL}${path14}`,
15141
15148
  headers: getHeaders,
15142
15149
  fetch: options.fetch
15143
15150
  });
@@ -15659,7 +15666,7 @@ function invokeAgent(inv, opts = {}) {
15659
15666
  }
15660
15667
 
15661
15668
  // ../../lib/agents/coding/materialize.ts
15662
- import { promises as fs4 } from "fs";
15669
+ import { promises as fs5 } from "fs";
15663
15670
 
15664
15671
  // ../coding-core/dist/injected.js
15665
15672
  var SYSTEM_REMINDER_RE = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
@@ -15694,8 +15701,392 @@ function isHarnessEntry(e) {
15694
15701
  return e.isMeta === true || e.isCompactSummary === true;
15695
15702
  }
15696
15703
 
15697
- // ../../lib/agents/coding/materialize.ts
15704
+ // ../coding-core/dist/codex.js
15698
15705
  var SYSTEM_REMINDER_RE2 = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
15706
+ var CODEX_INJECTED_TEXT_RE = /^\s*(<(environment_context|user_instructions|ENVIRONMENT_CONTEXT|turn_aborted)\b|#\s*AGENTS\.md instructions\b)/;
15707
+ function isCodexInjectedUserText(text2) {
15708
+ return CODEX_INJECTED_TEXT_RE.test(text2);
15709
+ }
15710
+ function codexContentText(content) {
15711
+ if (typeof content === "string")
15712
+ return content;
15713
+ if (!Array.isArray(content))
15714
+ return "";
15715
+ const parts = [];
15716
+ for (const item of content) {
15717
+ if (typeof item === "string") {
15718
+ parts.push(item);
15719
+ continue;
15720
+ }
15721
+ if (item && typeof item === "object") {
15722
+ const it = item;
15723
+ if (it.type === "input_text" || it.type === "output_text" || it.type === "text")
15724
+ parts.push(it.text || "");
15725
+ }
15726
+ }
15727
+ return parts.join("\n");
15728
+ }
15729
+ function sniffCodexRaw(raw) {
15730
+ let checked = 0;
15731
+ for (const lineRaw of raw.split("\n")) {
15732
+ const line = lineRaw.trim();
15733
+ if (!line)
15734
+ continue;
15735
+ if (checked++ >= 5)
15736
+ break;
15737
+ try {
15738
+ const e = JSON.parse(line);
15739
+ if (e.type === "session_meta" || e.type === "response_item" || e.type === "turn_context")
15740
+ return true;
15741
+ if (e.type === "user" || e.type === "assistant" || e.type === "summary" || e.type === "queue-operation")
15742
+ return false;
15743
+ } catch {
15744
+ }
15745
+ }
15746
+ return false;
15747
+ }
15748
+ var EXIT_CODE_RE = /(?:Process exited with code|Exit code:)\s+(\d+)/;
15749
+ function extractCodexEvents(raw) {
15750
+ const out = [];
15751
+ for (const lineRaw of raw.split("\n")) {
15752
+ const line = lineRaw.trim();
15753
+ if (!line)
15754
+ continue;
15755
+ let e;
15756
+ try {
15757
+ e = JSON.parse(line);
15758
+ } catch {
15759
+ continue;
15760
+ }
15761
+ if (e.type !== "response_item")
15762
+ continue;
15763
+ const p = e.payload ?? {};
15764
+ const t = typeof e.timestamp === "string" ? Date.parse(e.timestamp) : NaN;
15765
+ const ptype = p.type;
15766
+ if (ptype === "message") {
15767
+ const role = p.role;
15768
+ const text2 = codexContentText(p.content).replace(SYSTEM_REMINDER_RE2, "").trim();
15769
+ if (!text2)
15770
+ continue;
15771
+ if (role === "user") {
15772
+ if (isCodexInjectedUserText(text2))
15773
+ continue;
15774
+ out.push({ kind: "user", t, text: text2 });
15775
+ } else if (role === "assistant") {
15776
+ out.push({ kind: "assistant", t, text: text2 });
15777
+ }
15778
+ continue;
15779
+ }
15780
+ if (ptype === "function_call" || ptype === "custom_tool_call" || ptype === "local_shell_call") {
15781
+ const name17 = typeof p.name === "string" && p.name ? p.name : ptype === "local_shell_call" ? "shell" : String(ptype);
15782
+ const input = typeof p.arguments === "string" ? p.arguments : typeof p.input === "string" ? p.input : "";
15783
+ out.push({ kind: "tool", t, name: name17, input });
15784
+ continue;
15785
+ }
15786
+ if (ptype === "function_call_output" || ptype === "custom_tool_call_output") {
15787
+ const output = typeof p.output === "string" ? p.output : "";
15788
+ const m = EXIT_CODE_RE.exec(output.slice(0, 200));
15789
+ out.push({ kind: "tool_output", t, output, isError: !!m && m[1] !== "0" });
15790
+ }
15791
+ }
15792
+ return out;
15793
+ }
15794
+ function codexPatchFiles(input) {
15795
+ const files = [];
15796
+ const re2 = /\*\*\*\s+(?:Update|Add|Delete)\s+File:\s+(.+)/g;
15797
+ let m;
15798
+ while (m = re2.exec(input)) {
15799
+ const short = m[1].trim().split("/").slice(-2).join("/");
15800
+ if (short && !files.includes(short))
15801
+ files.push(short);
15802
+ }
15803
+ return files;
15804
+ }
15805
+ var CODEX_MUTATORS = /* @__PURE__ */ new Set(["apply_patch"]);
15806
+ var CODEX_INVESTIGATORS = /* @__PURE__ */ new Set(["exec_command", "shell", "local_shell_call", "read_file", "list_dir", "grep", "web_search", "view_image"]);
15807
+
15808
+ // ../coding-core/dist/cursor.js
15809
+ import { promises as fs4 } from "fs";
15810
+ var NODE_SQLITE = "node:sqlite";
15811
+ async function openCursorSqlite(dbPath) {
15812
+ try {
15813
+ await fs4.access(dbPath);
15814
+ } catch {
15815
+ return null;
15816
+ }
15817
+ let mod;
15818
+ try {
15819
+ mod = await import(NODE_SQLITE);
15820
+ } catch {
15821
+ return null;
15822
+ }
15823
+ const DatabaseSync = mod?.DatabaseSync;
15824
+ if (!DatabaseSync)
15825
+ return null;
15826
+ let db;
15827
+ try {
15828
+ db = new DatabaseSync(dbPath, { readOnly: true });
15829
+ } catch {
15830
+ try {
15831
+ db = new DatabaseSync(dbPath);
15832
+ } catch {
15833
+ return null;
15834
+ }
15835
+ }
15836
+ const asText = (v) => v == null ? null : typeof v === "string" ? v : Buffer.from(v).toString("utf-8");
15837
+ return {
15838
+ prefix(prefix) {
15839
+ try {
15840
+ const rows = db.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\'").all(likePrefix(prefix));
15841
+ return rows.map((r) => ({ key: r.key, value: asText(r.value) ?? "" }));
15842
+ } catch {
15843
+ return [];
15844
+ }
15845
+ },
15846
+ get(key) {
15847
+ try {
15848
+ const row = db.prepare("SELECT value FROM cursorDiskKV WHERE key = ?").get(key);
15849
+ return row ? asText(row.value) : null;
15850
+ } catch {
15851
+ return null;
15852
+ }
15853
+ },
15854
+ close() {
15855
+ try {
15856
+ db.close();
15857
+ } catch {
15858
+ }
15859
+ }
15860
+ };
15861
+ }
15862
+ function likePrefix(prefix) {
15863
+ return prefix.replace(/[\\%_]/g, (c) => "\\" + c) + "%";
15864
+ }
15865
+ var CURSOR_USER_QUERY_RE = /<user_query>\s*([\s\S]*?)\s*<\/user_query>/;
15866
+ function cleanUserText(raw) {
15867
+ let t = raw.replace(SYSTEM_REMINDER_RE, "");
15868
+ const m = t.match(CURSOR_USER_QUERY_RE);
15869
+ if (m)
15870
+ t = m[1];
15871
+ return t.trim();
15872
+ }
15873
+ var msFrom = (v) => {
15874
+ if (typeof v === "number" && Number.isFinite(v))
15875
+ return v;
15876
+ if (typeof v === "string") {
15877
+ const n = Date.parse(v);
15878
+ return Number.isFinite(n) ? n : null;
15879
+ }
15880
+ return null;
15881
+ };
15882
+ function readCursorComposer(db, composerId) {
15883
+ const cdRaw = db.get(`composerData:${composerId}`);
15884
+ if (!cdRaw)
15885
+ return null;
15886
+ let cd;
15887
+ try {
15888
+ cd = JSON.parse(cdRaw);
15889
+ } catch {
15890
+ return null;
15891
+ }
15892
+ const headers = Array.isArray(cd.fullConversationHeadersOnly) ? cd.fullConversationHeadersOnly : [];
15893
+ if (headers.length === 0)
15894
+ return null;
15895
+ const bubbles = /* @__PURE__ */ new Map();
15896
+ for (const row of db.prefix(`bubbleId:${composerId}:`)) {
15897
+ const bid = row.key.slice(`bubbleId:${composerId}:`.length);
15898
+ try {
15899
+ bubbles.set(bid, JSON.parse(row.value));
15900
+ } catch {
15901
+ }
15902
+ }
15903
+ const turns = [];
15904
+ let clock = msFrom(cd.createdAt) ?? 0;
15905
+ for (const h of headers) {
15906
+ const b = bubbles.get(h.bubbleId);
15907
+ if (!b)
15908
+ continue;
15909
+ const type = h.type === 1 ? 1 : 2;
15910
+ const tool2 = type === 2 && b.toolFormerData && typeof b.toolFormerData.name === "string" ? b.toolFormerData.name : null;
15911
+ const rawText = typeof b.text === "string" ? b.text : "";
15912
+ const text2 = type === 1 ? cleanUserText(rawText) : rawText.replace(SYSTEM_REMINDER_RE, "").trim();
15913
+ if (!text2 && !tool2)
15914
+ continue;
15915
+ const t = msFrom(b.createdAt);
15916
+ clock = Math.max(clock, t ?? clock + 1);
15917
+ const model = b.modelInfo && typeof b.modelInfo.modelName === "string" ? b.modelInfo.modelName : null;
15918
+ turns.push({ t: clock, type, text: text2, tool: tool2, model });
15919
+ }
15920
+ if (turns.length === 0)
15921
+ return null;
15922
+ const gitRepo = Array.isArray(cd.trackedGitRepos) && cd.trackedGitRepos[0] && typeof cd.trackedGitRepos[0].repoPath === "string" ? cd.trackedGitRepos[0].repoPath : null;
15923
+ return {
15924
+ composerId,
15925
+ createdAt: msFrom(cd.createdAt),
15926
+ updatedAt: msFrom(cd.lastUpdatedAt),
15927
+ name: typeof cd.name === "string" && cd.name.trim() ? cd.name.trim() : null,
15928
+ gitRepo,
15929
+ turns
15930
+ };
15931
+ }
15932
+ function sniffCursorRaw(raw) {
15933
+ for (const lineRaw of raw.split("\n")) {
15934
+ const line = lineRaw.trim();
15935
+ if (!line)
15936
+ continue;
15937
+ try {
15938
+ const e = JSON.parse(line);
15939
+ return (e.role === "user" || e.role === "assistant") && typeof e.message === "object" && e.message !== null && "content" in e.message && !("type" in e);
15940
+ } catch {
15941
+ return false;
15942
+ }
15943
+ }
15944
+ return false;
15945
+ }
15946
+ function jsonlText(content) {
15947
+ const parts = [];
15948
+ const tools = [];
15949
+ if (Array.isArray(content)) {
15950
+ for (const item of content) {
15951
+ if (!item || typeof item !== "object")
15952
+ continue;
15953
+ const it = item;
15954
+ if (it.type === "text" && it.text)
15955
+ parts.push(it.text);
15956
+ else if (it.type === "tool_use" && it.name)
15957
+ tools.push(it.name);
15958
+ }
15959
+ } else if (typeof content === "string")
15960
+ parts.push(content);
15961
+ return { text: parts.join("\n"), tools };
15962
+ }
15963
+ function parseCursorJsonl(raw, base) {
15964
+ const turns = [];
15965
+ let clock = base;
15966
+ for (const lineRaw of raw.split("\n")) {
15967
+ const line = lineRaw.trim();
15968
+ if (!line)
15969
+ continue;
15970
+ let e;
15971
+ try {
15972
+ e = JSON.parse(line);
15973
+ } catch {
15974
+ continue;
15975
+ }
15976
+ if (e.role !== "user" && e.role !== "assistant")
15977
+ continue;
15978
+ const { text: rawText, tools } = jsonlText(e.message?.content);
15979
+ const type = e.role === "user" ? 1 : 2;
15980
+ const text2 = type === 1 ? cleanUserText(rawText) : rawText.replace(SYSTEM_REMINDER_RE, "").trim();
15981
+ if (type === 2 && tools.length) {
15982
+ for (const tool2 of tools) {
15983
+ clock += 1;
15984
+ turns.push({ t: clock, type: 2, text: "", tool: tool2, model: null });
15985
+ }
15986
+ }
15987
+ if (!text2)
15988
+ continue;
15989
+ clock += 1;
15990
+ turns.push({ t: clock, type, text: text2, tool: null, model: null });
15991
+ }
15992
+ if (turns.length === 0)
15993
+ return null;
15994
+ return { composerId: "", createdAt: base, updatedAt: clock, name: null, gitRepo: null, turns };
15995
+ }
15996
+ var AI_GIST = 500;
15997
+ function renderCursorTranscript(c) {
15998
+ const lines = [];
15999
+ let humanTurns = 0, humanChars = 0;
16000
+ let aiProse = "";
16001
+ const aiTools = /* @__PURE__ */ new Map();
16002
+ const flushAI = () => {
16003
+ if (!aiProse && aiTools.size === 0)
16004
+ return;
16005
+ const tools = [...aiTools.entries()].map(([n, k]) => k > 1 ? `${n}\xD7${k}` : n).join(", ");
16006
+ const gist = aiProse ? aiProse.length > AI_GIST ? aiProse.slice(0, AI_GIST) + "\u2026" : aiProse : "";
16007
+ const bits = [];
16008
+ if (gist)
16009
+ bits.push(gist);
16010
+ if (tools)
16011
+ bits.push(`ran ${tools}`);
16012
+ lines.push(`[AI: ${bits.join(" \xB7 ")}]`);
16013
+ aiProse = "";
16014
+ aiTools.clear();
16015
+ };
16016
+ for (const turn of c.turns) {
16017
+ if (turn.type === 1) {
16018
+ flushAI();
16019
+ humanTurns++;
16020
+ humanChars += turn.text.length;
16021
+ lines.push(`>> ${turn.text}`);
16022
+ } else {
16023
+ if (turn.tool)
16024
+ aiTools.set(turn.tool, (aiTools.get(turn.tool) ?? 0) + 1);
16025
+ if (turn.text)
16026
+ aiProse = turn.text.replace(/\s+/g, " ").trim();
16027
+ }
16028
+ }
16029
+ flushAI();
16030
+ return { text: lines.join("\n"), humanTurns, humanChars };
16031
+ }
16032
+ function composerIdFromFile(file2) {
16033
+ const m = file2.match(/agent-transcripts\/([^/]+)\/[^/]+\.jsonl$/);
16034
+ return m ? m[1] : null;
16035
+ }
16036
+ async function loadCursorComposer(file2, raw, dbPath) {
16037
+ const cid = composerIdFromFile(file2);
16038
+ if (cid && dbPath) {
16039
+ const db = await openCursorSqlite(dbPath);
16040
+ if (db) {
16041
+ try {
16042
+ const c = readCursorComposer(db, cid);
16043
+ if (c)
16044
+ return c;
16045
+ } finally {
16046
+ db.close();
16047
+ }
16048
+ }
16049
+ }
16050
+ return parseCursorJsonl(raw, 0);
16051
+ }
16052
+
16053
+ // ../coding-core/dist/raw.js
16054
+ import path9 from "path";
16055
+ import os2 from "os";
16056
+ var SOURCE_ROOT_ENV_VARS = [
16057
+ "CLAUDE_PROJECTS_DIR",
16058
+ "CODEX_SESSIONS_DIR",
16059
+ "CURSOR_WORKSPACE_DIR",
16060
+ "CURSOR_PROJECTS_DIR",
16061
+ // Cursor's globalStorage dir (holds state.vscdb — the composer bubbles that
16062
+ // carry a Cursor session's real per-turn timestamps + content). Same
16063
+ // isolation contract: overriding any root disables every unset source.
16064
+ "CURSOR_GLOBAL_DIR"
16065
+ ];
16066
+ var anyRootOverridden = () => SOURCE_ROOT_ENV_VARS.some((v) => !!process.env[v]);
16067
+ function resolveSourceRoot(envVar, ...defaultSegments) {
16068
+ const explicit = process.env[envVar];
16069
+ if (explicit)
16070
+ return explicit;
16071
+ if (anyRootOverridden())
16072
+ return null;
16073
+ return path9.join(os2.homedir(), ...defaultSegments);
16074
+ }
16075
+ var cursorGlobalRoot = () => resolveSourceRoot("CURSOR_GLOBAL_DIR", "Library", "Application Support", "Cursor", "User", "globalStorage");
16076
+ function cursorGlobalDbPath() {
16077
+ const root = cursorGlobalRoot();
16078
+ return root === null ? null : path9.join(root, "state.vscdb");
16079
+ }
16080
+ var MACHINE_CURSOR_FILE_RE = /^(.*[/\\]machines[/\\][^/\\]+[/\\]\.cursor)[/\\]projects[/\\]/;
16081
+ function cursorDbPathForFile(file2) {
16082
+ const m = file2.match(MACHINE_CURSOR_FILE_RE);
16083
+ if (m)
16084
+ return path9.join(m[1], "globalStorage", "state.vscdb");
16085
+ return cursorGlobalDbPath();
16086
+ }
16087
+
16088
+ // ../../lib/agents/coding/materialize.ts
16089
+ var SYSTEM_REMINDER_RE3 = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
15699
16090
  var INJECT_GIST = 120;
15700
16091
  var INJECTED = [
15701
16092
  { re: /<task-notification>[\s\S]*?<\/task-notification>/g, label: "bg task", gistRe: /<summary>([\s\S]*?)<\/summary>/ },
@@ -15715,7 +16106,7 @@ function collapseInjected(input) {
15715
16106
  return "";
15716
16107
  });
15717
16108
  }
15718
- return { text: text2.replace(SYSTEM_REMINDER_RE2, "").trim(), markers };
16109
+ return { text: text2.replace(SYSTEM_REMINDER_RE3, "").trim(), markers };
15719
16110
  }
15720
16111
  function extractText(content) {
15721
16112
  if (typeof content === "string") return content;
@@ -15731,14 +16122,52 @@ function extractText(content) {
15731
16122
  function isToolResultOnly(content) {
15732
16123
  return Array.isArray(content) && content.length > 0 && content.every((c) => c && typeof c === "object" && c.type === "tool_result");
15733
16124
  }
15734
- var AI_GIST = 160;
16125
+ var AI_GIST2 = 160;
16126
+ function materializeCodex(raw) {
16127
+ const lines = [];
16128
+ let humanTurns = 0, humanChars = 0;
16129
+ let aiLastProse = "";
16130
+ const aiTools = /* @__PURE__ */ new Map();
16131
+ const flushAI = () => {
16132
+ if (!aiLastProse && aiTools.size === 0) return;
16133
+ const tools = [...aiTools.entries()].map(([n, c]) => c > 1 ? `${n}\xD7${c}` : n).join(", ");
16134
+ const gist = aiLastProse ? aiLastProse.length > AI_GIST2 ? aiLastProse.slice(0, AI_GIST2) + "\u2026" : aiLastProse : "";
16135
+ const bits = [];
16136
+ if (gist) bits.push(gist);
16137
+ if (tools) bits.push(`ran ${tools}`);
16138
+ lines.push(`[AI: ${bits.join(" \xB7 ")}]`);
16139
+ aiLastProse = "";
16140
+ aiTools.clear();
16141
+ };
16142
+ for (const ev of extractCodexEvents(raw)) {
16143
+ if (ev.kind === "user") {
16144
+ flushAI();
16145
+ humanTurns++;
16146
+ humanChars += ev.text.length;
16147
+ lines.push(`>> ${ev.text}`);
16148
+ } else if (ev.kind === "assistant") {
16149
+ const prose = ev.text.replace(/\s+/g, " ").trim();
16150
+ if (prose) aiLastProse = prose;
16151
+ } else if (ev.kind === "tool") {
16152
+ aiTools.set(ev.name, (aiTools.get(ev.name) ?? 0) + 1);
16153
+ }
16154
+ }
16155
+ flushAI();
16156
+ return { text: lines.join("\n"), humanTurns, humanChars };
16157
+ }
16158
+ async function materializeCursor(file2, raw) {
16159
+ const composer = await loadCursorComposer(file2, raw, cursorDbPathForFile(file2));
16160
+ return composer ? renderCursorTranscript(composer) : { text: "", humanTurns: 0, humanChars: 0 };
16161
+ }
15735
16162
  async function materializeSession(file2) {
15736
16163
  let raw;
15737
16164
  try {
15738
- raw = await fs4.readFile(file2, "utf-8");
16165
+ raw = await fs5.readFile(file2, "utf-8");
15739
16166
  } catch {
15740
16167
  return null;
15741
16168
  }
16169
+ if (sniffCodexRaw(raw)) return materializeCodex(raw);
16170
+ if (sniffCursorRaw(raw)) return materializeCursor(file2, raw);
15742
16171
  const lines = [];
15743
16172
  let humanTurns = 0, humanChars = 0;
15744
16173
  const pendingQueued = [];
@@ -15751,7 +16180,7 @@ async function materializeSession(file2) {
15751
16180
  const flushAI = () => {
15752
16181
  if (!aiLastProse && aiTools.size === 0) return;
15753
16182
  const tools = [...aiTools.entries()].map(([n, c]) => c > 1 ? `${n}\xD7${c}` : n).join(", ");
15754
- const gist = aiLastProse ? aiLastProse.length > AI_GIST ? aiLastProse.slice(0, AI_GIST) + "\u2026" : aiLastProse : "";
16183
+ const gist = aiLastProse ? aiLastProse.length > AI_GIST2 ? aiLastProse.slice(0, AI_GIST2) + "\u2026" : aiLastProse : "";
15755
16184
  const bits = [];
15756
16185
  if (gist) bits.push(gist);
15757
16186
  if (tools) bits.push(`ran ${tools}`);
@@ -15830,7 +16259,7 @@ async function materializeSession(file2) {
15830
16259
  }
15831
16260
 
15832
16261
  // ../coding-core/dist/delegation/parse.js
15833
- import { promises as fs5 } from "fs";
16262
+ import { promises as fs6 } from "fs";
15834
16263
  var MUTATORS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
15835
16264
  var INVESTIGATORS = /* @__PURE__ */ new Set(["Read", "Grep", "Glob", "Bash", "ToolSearch", "WebSearch", "WebFetch"]);
15836
16265
  var CORRECTIVE_RE = /\b(fix|still|again|nope?|broken|revert|undo|wrong|same (error|issue|thing|problem|bug)|doesn'?t work|not work(ing)?|didn'?t work|that'?s not|try (again|to)|no it|it'?s still|its still|stop|keeps?|why (is|isn'?t)|do (this|that|it)|make it)\b/i;
@@ -15865,13 +16294,93 @@ function countToolErrors(content) {
15865
16294
  }
15866
16295
  return n;
15867
16296
  }
16297
+ function newTurn(i, t, text2) {
16298
+ const len = text2.length;
16299
+ const deepDive = len >= DEEPDIVE_MIN_LEN || DEEPDIVE_RE.test(text2);
16300
+ return {
16301
+ i,
16302
+ t,
16303
+ text: text2,
16304
+ len,
16305
+ corrective: !deepDive && len <= CORRECTIVE_MAX_LEN && CORRECTIVE_RE.test(text2),
16306
+ deepDive,
16307
+ edits: 0,
16308
+ editFiles: [],
16309
+ investigations: 0,
16310
+ toolErrors: 0,
16311
+ aiStruggle: 0
16312
+ };
16313
+ }
16314
+ function parseCodexTurns(raw) {
16315
+ const turns = [];
16316
+ let cur = null;
16317
+ let idx = 0;
16318
+ for (const ev of extractCodexEvents(raw)) {
16319
+ if (ev.kind === "user") {
16320
+ const text2 = humanTypedText(ev.text);
16321
+ if (!text2)
16322
+ continue;
16323
+ cur = newTurn(idx++, Number.isFinite(ev.t) ? ev.t : cur ? cur.t : 0, text2);
16324
+ turns.push(cur);
16325
+ } else if (ev.kind === "tool" && cur) {
16326
+ if (CODEX_MUTATORS.has(ev.name)) {
16327
+ cur.edits++;
16328
+ for (const f of codexPatchFiles(ev.input))
16329
+ if (!cur.editFiles.includes(f))
16330
+ cur.editFiles.push(f);
16331
+ } else if (CODEX_INVESTIGATORS.has(ev.name)) {
16332
+ cur.investigations++;
16333
+ }
16334
+ } else if (ev.kind === "tool_output" && cur) {
16335
+ if (ev.isError)
16336
+ cur.toolErrors++;
16337
+ } else if (ev.kind === "assistant" && cur) {
16338
+ if (STRUGGLE_RE.test(ev.text))
16339
+ cur.aiStruggle++;
16340
+ }
16341
+ }
16342
+ return turns;
16343
+ }
16344
+ var CURSOR_MUTATOR_RE = /edit|write|replace|delete|patch|reapply|create/i;
16345
+ var CURSOR_INVESTIGATOR_RE = /read|search|grep|list|terminal|glob|fetch|run/i;
16346
+ async function parseCursorTurns(file2, raw) {
16347
+ const c = await loadCursorComposer(file2, raw, cursorDbPathForFile(file2));
16348
+ if (!c)
16349
+ return [];
16350
+ const turns = [];
16351
+ let cur = null;
16352
+ let idx = 0;
16353
+ for (const turn of c.turns) {
16354
+ if (turn.type === 1) {
16355
+ const text2 = humanTypedText(turn.text);
16356
+ if (!text2)
16357
+ continue;
16358
+ cur = newTurn(idx++, turn.t, text2);
16359
+ turns.push(cur);
16360
+ } else if (cur) {
16361
+ if (turn.tool) {
16362
+ if (CURSOR_MUTATOR_RE.test(turn.tool))
16363
+ cur.edits++;
16364
+ else if (CURSOR_INVESTIGATOR_RE.test(turn.tool))
16365
+ cur.investigations++;
16366
+ }
16367
+ if (turn.text && STRUGGLE_RE.test(turn.text))
16368
+ cur.aiStruggle++;
16369
+ }
16370
+ }
16371
+ return turns;
16372
+ }
15868
16373
  async function parseSession(file2) {
15869
16374
  let raw;
15870
16375
  try {
15871
- raw = await fs5.readFile(file2, "utf-8");
16376
+ raw = await fs6.readFile(file2, "utf-8");
15872
16377
  } catch {
15873
16378
  return [];
15874
16379
  }
16380
+ if (sniffCodexRaw(raw))
16381
+ return parseCodexTurns(raw);
16382
+ if (sniffCursorRaw(raw))
16383
+ return parseCursorTurns(file2, raw);
15875
16384
  const turns = [];
15876
16385
  let cur = null;
15877
16386
  let idx = 0;
@@ -15898,21 +16407,7 @@ async function parseSession(file2) {
15898
16407
  const text2 = humanTypedText(extractText2(content));
15899
16408
  if (!text2)
15900
16409
  continue;
15901
- const len = text2.length;
15902
- const deepDive = len >= DEEPDIVE_MIN_LEN || DEEPDIVE_RE.test(text2);
15903
- cur = {
15904
- i: idx++,
15905
- t: Number.isFinite(ts) ? ts : cur ? cur.t : 0,
15906
- text: text2,
15907
- len,
15908
- corrective: !deepDive && len <= CORRECTIVE_MAX_LEN && CORRECTIVE_RE.test(text2),
15909
- deepDive,
15910
- edits: 0,
15911
- editFiles: [],
15912
- investigations: 0,
15913
- toolErrors: 0,
15914
- aiStruggle: 0
15915
- };
16410
+ cur = newTurn(idx++, Number.isFinite(ts) ? ts : cur ? cur.t : 0, text2);
15916
16411
  turns.push(cur);
15917
16412
  } else if (e.type === "assistant" && cur) {
15918
16413
  const msg = e.message ?? {};
@@ -16078,7 +16573,7 @@ async function detectDelegation(rec, opts = {}) {
16078
16573
  let meta = {};
16079
16574
  if (candidates.length > 0) {
16080
16575
  const mat = await materializeSession(rec.file);
16081
- const sandbox = await fs6.mkdtemp(path9.join(os2.tmpdir(), "ps-deleg-"));
16576
+ const sandbox = await fs7.mkdtemp(path10.join(os3.tmpdir(), "ps-deleg-"));
16082
16577
  try {
16083
16578
  const run2 = await invokeAgent({
16084
16579
  prompt: buildPrompt(rec, mat?.text ?? "", candidates),
@@ -16088,7 +16583,7 @@ async function detectDelegation(rec, opts = {}) {
16088
16583
  maxTurns: 6,
16089
16584
  timeoutMs: 3e5,
16090
16585
  model: opts.model ?? "sonnet",
16091
- logPath: opts.logDir ? path9.join(opts.logDir, `${rec.sessionId}.log`) : void 0
16586
+ logPath: opts.logDir ? path10.join(opts.logDir, `${rec.sessionId}.log`) : void 0
16092
16587
  });
16093
16588
  const j = run2.json ?? {};
16094
16589
  context = String(j.context ?? "").slice(0, 900);
@@ -16104,7 +16599,7 @@ async function detectDelegation(rec, opts = {}) {
16104
16599
  }).filter((l) => l.confirmed);
16105
16600
  meta = { costUsd: run2.costUsd, durationMs: run2.durationMs };
16106
16601
  } finally {
16107
- await fs6.rm(sandbox, { recursive: true, force: true }).catch(() => {
16602
+ await fs7.rm(sandbox, { recursive: true, force: true }).catch(() => {
16108
16603
  });
16109
16604
  }
16110
16605
  }
@@ -16120,16 +16615,16 @@ async function detectDelegation(rec, opts = {}) {
16120
16615
  meta
16121
16616
  };
16122
16617
  if (opts.outDir) {
16123
- await fs6.mkdir(opts.outDir, { recursive: true });
16124
- await fs6.writeFile(path9.join(opts.outDir, `${rec.sessionId}.json`), JSON.stringify(read, null, 2));
16618
+ await fs7.mkdir(opts.outDir, { recursive: true });
16619
+ await fs7.writeFile(path10.join(opts.outDir, `${rec.sessionId}.json`), JSON.stringify(read, null, 2));
16125
16620
  }
16126
16621
  return read;
16127
16622
  }
16128
16623
 
16129
16624
  // ../../lib/agents/coding/delegation/rollup.ts
16130
- import { promises as fs7 } from "fs";
16131
- import os3 from "os";
16132
- import path10 from "path";
16625
+ import { promises as fs8 } from "fs";
16626
+ import os4 from "os";
16627
+ import path11 from "path";
16133
16628
  var median2 = (xs) => {
16134
16629
  if (!xs.length) return 0;
16135
16630
  const s = [...xs].sort((a, b) => a - b);
@@ -16185,7 +16680,7 @@ async function rollupDelegation(reads, records, opts = {}) {
16185
16680
  }
16186
16681
  const exemplars = ranked.map((r) => ({ sessionId: r.sessionId, title: r.title, openingChars: r.overDrive.openingChars }));
16187
16682
  if (samples.length) {
16188
- const sandbox = await fs7.mkdtemp(path10.join(os3.tmpdir(), "ps-deleg-roll-"));
16683
+ const sandbox = await fs8.mkdtemp(path11.join(os4.tmpdir(), "ps-deleg-roll-"));
16189
16684
  try {
16190
16685
  const run2 = await invokeAgent({
16191
16686
  prompt: buildPrompt2(samples),
@@ -16206,7 +16701,7 @@ async function rollupDelegation(reads, records, opts = {}) {
16206
16701
  exemplars
16207
16702
  };
16208
16703
  } finally {
16209
- await fs7.rm(sandbox, { recursive: true, force: true }).catch(() => {
16704
+ await fs8.rm(sandbox, { recursive: true, force: true }).catch(() => {
16210
16705
  });
16211
16706
  }
16212
16707
  }
@@ -16267,7 +16762,7 @@ function aiWindowCutoff(sessions, opts = {}) {
16267
16762
 
16268
16763
  // ../../lib/agents/coding/promptCache.ts
16269
16764
  import { createHash } from "crypto";
16270
- import { promises as fs8 } from "fs";
16765
+ import { promises as fs9 } from "fs";
16271
16766
  function promptSha(parts) {
16272
16767
  const h = createHash("sha256");
16273
16768
  for (const p of parts) {
@@ -16278,7 +16773,7 @@ function promptSha(parts) {
16278
16773
  }
16279
16774
  async function reusableOutput(outPath, sha, valid, key = "promptSha") {
16280
16775
  try {
16281
- const o = JSON.parse(await fs8.readFile(outPath, "utf8"));
16776
+ const o = JSON.parse(await fs9.readFile(outPath, "utf8"));
16282
16777
  if (o[key] === sha && valid(o)) return o;
16283
16778
  } catch {
16284
16779
  }
@@ -16286,7 +16781,7 @@ async function reusableOutput(outPath, sha, valid, key = "promptSha") {
16286
16781
  }
16287
16782
 
16288
16783
  // ../../lib/agents/coding/profile.ts
16289
- import path11 from "path";
16784
+ import path12 from "path";
16290
16785
 
16291
16786
  // ../../lib/calibration/fingerprint.ts
16292
16787
  import { createHash as createHash2 } from "node:crypto";
@@ -16440,7 +16935,7 @@ var TRANSCRIPT_LINE_RE = new RegExp(`^\\s*(${NOTE})((,| and) ${NOTE})*\\s*$|^\\s
16440
16935
 
16441
16936
  // ../../lib/calibration/index.ts
16442
16937
  var DEFAULT_CALIBRATION = {
16443
- version: "2026-07-16.2",
16938
+ version: "2026-07-21.1",
16444
16939
  // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
16445
16940
  // src/grade/criteria.ts). A unit test fails loud when the rubric changes
16446
16941
  // without this being updated (and re-pushed to the server).
@@ -16536,13 +17031,14 @@ var DEFAULT_CALIBRATION = {
16536
17031
  },
16537
17032
  codingBenchmarks: {
16538
17033
  flow: {
16539
- // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
16540
- // recognized deep-work ceiling (Newport) 50% most sit far below it.
17034
+ // typical knowledge worker ≈ 35% of an 8h day focused; the ~4h/day
17035
+ // deep-work ceiling (Newport) sits nearer ~40% of a real (9-10h) top
17036
+ // performer's day — 50% overstated it (owner call 2026-07-21).
16541
17037
  typicalPctOfDay: 0.35,
16542
- topPctOfDay: 0.5,
17038
+ topPctOfDay: 0.4,
16543
17039
  tag: "measured",
16544
- source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
16545
- line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
17040
+ source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling against a 9-10h day)",
17041
+ line: "the best spend ~40% of the workday in true deep flow; ~4h/day is the human ceiling"
16546
17042
  },
16547
17043
  longestRun: {
16548
17044
  typicalHours: 0.67,
@@ -16591,8 +17087,8 @@ var BEST = DEFAULT_CALIBRATION.codingBenchmarks;
16591
17087
 
16592
17088
  // ../../lib/agents/coding/profile.ts
16593
17089
  var ROOT = process.cwd();
16594
- var CODING_DIR = process.env.POLYMATH_DATA_DIR ? path11.join(process.env.POLYMATH_DATA_DIR, "coding") : path11.join(ROOT, ".data", "coding");
16595
- var GRADES = path11.join(CODING_DIR, "grades");
17090
+ var CODING_DIR = process.env.POLYMATH_DATA_DIR ? path12.join(process.env.POLYMATH_DATA_DIR, "coding") : path12.join(ROOT, ".data", "coding");
17091
+ var GRADES = path12.join(CODING_DIR, "grades");
16596
17092
 
16597
17093
  // ../../scripts/coding-delegation.mts
16598
17094
  var argv = process.argv.slice(2);
@@ -16620,10 +17116,10 @@ function makeLimiter(max) {
16620
17116
  };
16621
17117
  }
16622
17118
  var CODING = CODING_DIR;
16623
- var OUT = path12.join(CODING, "delegation");
16624
- var LOGS = path12.join(OUT, "logs");
17119
+ var OUT = path13.join(CODING, "delegation");
17120
+ var LOGS = path13.join(OUT, "logs");
16625
17121
  async function main() {
16626
- const sessions = JSON.parse(await fs9.readFile(path12.join(CODING, "sessions.json"), "utf8"));
17122
+ const sessions = JSON.parse(await fs10.readFile(path13.join(CODING, "sessions.json"), "utf8"));
16627
17123
  const live = sessions.filter((s) => s.klass === "interactive" && !s.duplicateOf);
16628
17124
  const { gradable: allGradable } = partition(live);
16629
17125
  const cutoff = aiWindowCutoff(live);
@@ -16633,7 +17129,7 @@ async function main() {
16633
17129
  const set = new Set(IDS);
16634
17130
  picked = live.filter((s) => set.has(s.sessionId));
16635
17131
  } else if (N > 0) picked = gradable.slice().sort((a, b) => b.humanChars * Math.log1p(b.humanTurns) - a.humanChars * Math.log1p(a.humanTurns)).slice(0, N);
16636
- await fs9.mkdir(LOGS, { recursive: true });
17132
+ await fs10.mkdir(LOGS, { recursive: true });
16637
17133
  console.log(`[delegation] ${live.length} live \xB7 ${allGradable.length} gradable${cutoff ? ` \xB7 ${gradable.length} since ${cutoff.slice(0, 10)} (AI window)` : ""} \xB7 running detect on ${picked.length} (LLM only on stuck-loop candidates)\u2026`);
16638
17134
  const lim = makeLimiter(CONC);
16639
17135
  let reused = 0;
@@ -16641,7 +17137,7 @@ async function main() {
16641
17137
  const reads = (await Promise.all(picked.map((s) => lim(async () => {
16642
17138
  if (!REFRESH) {
16643
17139
  try {
16644
- const prev = JSON.parse(await fs9.readFile(path12.join(OUT, `${s.sessionId}.json`), "utf8"));
17140
+ const prev = JSON.parse(await fs10.readFile(path13.join(OUT, `${s.sessionId}.json`), "utf8"));
16645
17141
  reused++;
16646
17142
  tick(true);
16647
17143
  return prev;
@@ -16663,13 +17159,13 @@ async function main() {
16663
17159
  if (reused) console.log(`[delegation] reused ${reused} existing per-session read(s) (--refresh to re-detect)`);
16664
17160
  const stable = reads.map((r) => ({ id: r.sessionId, loops: r.stuckLoops, od: r.overDrive })).sort((a, b) => a.id < b.id ? -1 : 1);
16665
17161
  const sha = promptSha([JSON.stringify(stable), MODEL]);
16666
- const rollupPath = path12.join(CODING, "delegation-rollup.json");
17162
+ const rollupPath = path13.join(CODING, "delegation-rollup.json");
16667
17163
  let rollup = REFRESH ? null : await reusableOutput(rollupPath, sha, (o) => typeof o.sessions === "number");
16668
17164
  if (rollup) console.log(`[delegation] rollup inputs unchanged \u2014 reusing (--refresh to regenerate)`);
16669
17165
  else {
16670
17166
  console.log(`[delegation] corpus rollup (Case A count + Case B over-drive judgment)\u2026`);
16671
17167
  rollup = { ...await rollupDelegation(reads, live, { model: MODEL }), promptSha: sha };
16672
- await fs9.writeFile(rollupPath, JSON.stringify(rollup, null, 2));
17168
+ await fs10.writeFile(rollupPath, JSON.stringify(rollup, null, 2));
16673
17169
  }
16674
17170
  console.log(`
16675
17171
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 DELEGATION \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);