polymath-society 0.2.20 → 0.2.22

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 (38) hide show
  1. package/dist/cli.js +23943 -21630
  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 +19647 -17969
  17. package/dist/pipeline/coding-agglomerate.js +826 -82
  18. package/dist/pipeline/coding-aggregate.js +307 -23
  19. package/dist/pipeline/coding-build.js +453 -95
  20. package/dist/pipeline/coding-coaching.js +479 -88
  21. package/dist/pipeline/coding-day-digest.js +308 -36
  22. package/dist/pipeline/coding-delegation.js +376 -52
  23. package/dist/pipeline/coding-expertise.js +356 -62
  24. package/dist/pipeline/coding-flow.js +288 -15
  25. package/dist/pipeline/coding-focus.js +371 -51
  26. package/dist/pipeline/coding-frontier-detail.js +344 -50
  27. package/dist/pipeline/coding-frontier.js +7 -6
  28. package/dist/pipeline/coding-gap-dist.js +288 -15
  29. package/dist/pipeline/coding-gap.js +507 -115
  30. package/dist/pipeline/coding-grade.js +342 -45
  31. package/dist/pipeline/coding-growth.js +17041 -0
  32. package/dist/pipeline/coding-nutshell.js +15 -7
  33. package/dist/pipeline/coding-projects.js +7 -6
  34. package/dist/pipeline/coding-walkthrough.js +317 -37
  35. package/dist/pipeline/coding-workbrief.js +16387 -0
  36. package/dist/web/app.js +2095 -1395
  37. package/dist/web/styles.css +1 -1
  38. package/package.json +1 -1
@@ -504,6 +504,13 @@ ${report}`);
504
504
  }
505
505
 
506
506
  // ../../lib/agents/shared/codexAdapter.ts
507
+ var CODEX_DEFAULT_MODEL = "gpt-5.5";
508
+ var CODEX_MINI_MODEL = "gpt-5.4-mini";
509
+ function mapCodexTier(model, env = process.env) {
510
+ if (model && !/^(claude|haiku|sonnet|opus)/i.test(model)) return model;
511
+ if (model && /^haiku/i.test(model)) return env.POLYMATH_CODEX_MODEL_MINI || CODEX_MINI_MODEL;
512
+ return env.POLYMATH_CODEX_MODEL || CODEX_DEFAULT_MODEL;
513
+ }
507
514
  function composePrompt(inv, roots) {
508
515
  return [
509
516
  inv.systemPrompt ? `<system>
@@ -544,7 +551,7 @@ var codexAdapter = {
544
551
  "read-only",
545
552
  "--json"
546
553
  ];
547
- if (inv.model && !/^claude/i.test(inv.model)) args.push("--model", inv.model);
554
+ args.push("--model", mapCodexTier(inv.model));
548
555
  args.push(composePrompt(inv, roots));
549
556
  const started = Date.now();
550
557
  const toolCalls = [];
@@ -15689,7 +15696,7 @@ ${parts.join("\n\n")}`;
15689
15696
 
15690
15697
  // ../../lib/calibration/index.ts
15691
15698
  var DEFAULT_CALIBRATION = {
15692
- version: "2026-07-16.2",
15699
+ version: "2026-07-21.1",
15693
15700
  // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
15694
15701
  // src/grade/criteria.ts). A unit test fails loud when the rubric changes
15695
15702
  // without this being updated (and re-pushed to the server).
@@ -15785,13 +15792,14 @@ var DEFAULT_CALIBRATION = {
15785
15792
  },
15786
15793
  codingBenchmarks: {
15787
15794
  flow: {
15788
- // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
15789
- // recognized deep-work ceiling (Newport) 50% most sit far below it.
15795
+ // typical knowledge worker ≈ 35% of an 8h day focused; the ~4h/day
15796
+ // deep-work ceiling (Newport) sits nearer ~40% of a real (9-10h) top
15797
+ // performer's day — 50% overstated it (owner call 2026-07-21).
15790
15798
  typicalPctOfDay: 0.35,
15791
- topPctOfDay: 0.5,
15799
+ topPctOfDay: 0.4,
15792
15800
  tag: "measured",
15793
- source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
15794
- line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
15801
+ source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling against a 9-10h day)",
15802
+ line: "the best spend ~40% of the workday in true deep flow; ~4h/day is the human ceiling"
15795
15803
  },
15796
15804
  longestRun: {
15797
15805
  typicalHours: 0.67,
@@ -205,7 +205,7 @@ var TRANSCRIPT_LINE_RE = new RegExp(`^\\s*(${NOTE})((,| and) ${NOTE})*\\s*$|^\\s
205
205
 
206
206
  // ../../lib/calibration/index.ts
207
207
  var DEFAULT_CALIBRATION = {
208
- version: "2026-07-16.2",
208
+ version: "2026-07-21.1",
209
209
  // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
210
210
  // src/grade/criteria.ts). A unit test fails loud when the rubric changes
211
211
  // without this being updated (and re-pushed to the server).
@@ -301,13 +301,14 @@ var DEFAULT_CALIBRATION = {
301
301
  },
302
302
  codingBenchmarks: {
303
303
  flow: {
304
- // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
305
- // recognized deep-work ceiling (Newport) 50% most sit far below it.
304
+ // typical knowledge worker ≈ 35% of an 8h day focused; the ~4h/day
305
+ // deep-work ceiling (Newport) sits nearer ~40% of a real (9-10h) top
306
+ // performer's day — 50% overstated it (owner call 2026-07-21).
306
307
  typicalPctOfDay: 0.35,
307
- topPctOfDay: 0.5,
308
+ topPctOfDay: 0.4,
308
309
  tag: "measured",
309
- source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
310
- line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
310
+ source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling against a 9-10h day)",
311
+ line: "the best spend ~40% of the workday in true deep flow; ~4h/day is the human ceiling"
311
312
  },
312
313
  longestRun: {
313
314
  typicalHours: 0.67,
@@ -134,13 +134,13 @@ var require_secure_json_parse = __commonJS({
134
134
  });
135
135
 
136
136
  // ../../scripts/coding-walkthrough.mts
137
- import { promises as fs6 } from "fs";
138
- import path11 from "path";
137
+ import { promises as fs7 } from "fs";
138
+ import path12 from "path";
139
139
 
140
140
  // ../../lib/agents/coding/walkthrough.ts
141
- import { promises as fs5 } from "fs";
142
- import os2 from "os";
143
- import path9 from "path";
141
+ import { promises as fs6 } 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: path12, errorMaps, issueData } = params;
2180
- const fullPath = [...path12, ...issueData.path || []];
2186
+ const { data, path: path13, errorMaps, issueData } = params;
2187
+ const fullPath = [...path13, ...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, path12, key) {
2303
+ constructor(parent, value, path13, key) {
2297
2304
  this._cachedPath = [];
2298
2305
  this.parent = parent;
2299
2306
  this.data = value;
2300
- this._path = path12;
2307
+ this._path = path13;
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: path12 }) => `${baseURL}${path12}`,
15094
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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: path12 }) => `${baseURL}${path12}`,
15101
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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: path12 }) => `${baseURL}${path12}`,
15108
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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: path12 }) => `${baseURL}${path12}`,
15114
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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: path12 }) => `${baseURL}${path12}`,
15120
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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: path12 }) => `${baseURL}${path12}`,
15126
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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: path12 }) => `${baseURL}${path12}`,
15147
+ url: ({ path: path13 }) => `${baseURL}${path13}`,
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
  // ../coding-core/dist/messages.js
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;
@@ -15785,6 +15792,274 @@ function extractCodexEvents(raw) {
15785
15792
  return out;
15786
15793
  }
15787
15794
 
15795
+ // ../coding-core/dist/cursor.js
15796
+ import { promises as fs4 } from "fs";
15797
+ var NODE_SQLITE = "node:sqlite";
15798
+ async function openCursorSqlite(dbPath) {
15799
+ try {
15800
+ await fs4.access(dbPath);
15801
+ } catch {
15802
+ return null;
15803
+ }
15804
+ let mod;
15805
+ try {
15806
+ mod = await import(NODE_SQLITE);
15807
+ } catch {
15808
+ return null;
15809
+ }
15810
+ const DatabaseSync = mod?.DatabaseSync;
15811
+ if (!DatabaseSync)
15812
+ return null;
15813
+ let db;
15814
+ try {
15815
+ db = new DatabaseSync(dbPath, { readOnly: true });
15816
+ } catch {
15817
+ try {
15818
+ db = new DatabaseSync(dbPath);
15819
+ } catch {
15820
+ return null;
15821
+ }
15822
+ }
15823
+ const asText = (v) => v == null ? null : typeof v === "string" ? v : Buffer.from(v).toString("utf-8");
15824
+ return {
15825
+ prefix(prefix) {
15826
+ try {
15827
+ const rows = db.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE ? ESCAPE '\\'").all(likePrefix(prefix));
15828
+ return rows.map((r) => ({ key: r.key, value: asText(r.value) ?? "" }));
15829
+ } catch {
15830
+ return [];
15831
+ }
15832
+ },
15833
+ get(key) {
15834
+ try {
15835
+ const row = db.prepare("SELECT value FROM cursorDiskKV WHERE key = ?").get(key);
15836
+ return row ? asText(row.value) : null;
15837
+ } catch {
15838
+ return null;
15839
+ }
15840
+ },
15841
+ close() {
15842
+ try {
15843
+ db.close();
15844
+ } catch {
15845
+ }
15846
+ }
15847
+ };
15848
+ }
15849
+ function likePrefix(prefix) {
15850
+ return prefix.replace(/[\\%_]/g, (c) => "\\" + c) + "%";
15851
+ }
15852
+ var CURSOR_USER_QUERY_RE = /<user_query>\s*([\s\S]*?)\s*<\/user_query>/;
15853
+ function cleanUserText(raw) {
15854
+ let t = raw.replace(SYSTEM_REMINDER_RE, "");
15855
+ const m = t.match(CURSOR_USER_QUERY_RE);
15856
+ if (m)
15857
+ t = m[1];
15858
+ return t.trim();
15859
+ }
15860
+ var msFrom = (v) => {
15861
+ if (typeof v === "number" && Number.isFinite(v))
15862
+ return v;
15863
+ if (typeof v === "string") {
15864
+ const n = Date.parse(v);
15865
+ return Number.isFinite(n) ? n : null;
15866
+ }
15867
+ return null;
15868
+ };
15869
+ function readCursorComposer(db, composerId) {
15870
+ const cdRaw = db.get(`composerData:${composerId}`);
15871
+ if (!cdRaw)
15872
+ return null;
15873
+ let cd;
15874
+ try {
15875
+ cd = JSON.parse(cdRaw);
15876
+ } catch {
15877
+ return null;
15878
+ }
15879
+ const headers = Array.isArray(cd.fullConversationHeadersOnly) ? cd.fullConversationHeadersOnly : [];
15880
+ if (headers.length === 0)
15881
+ return null;
15882
+ const bubbles = /* @__PURE__ */ new Map();
15883
+ for (const row of db.prefix(`bubbleId:${composerId}:`)) {
15884
+ const bid = row.key.slice(`bubbleId:${composerId}:`.length);
15885
+ try {
15886
+ bubbles.set(bid, JSON.parse(row.value));
15887
+ } catch {
15888
+ }
15889
+ }
15890
+ const turns = [];
15891
+ let clock = msFrom(cd.createdAt) ?? 0;
15892
+ for (const h of headers) {
15893
+ const b = bubbles.get(h.bubbleId);
15894
+ if (!b)
15895
+ continue;
15896
+ const type = h.type === 1 ? 1 : 2;
15897
+ const tool2 = type === 2 && b.toolFormerData && typeof b.toolFormerData.name === "string" ? b.toolFormerData.name : null;
15898
+ const rawText = typeof b.text === "string" ? b.text : "";
15899
+ const text2 = type === 1 ? cleanUserText(rawText) : rawText.replace(SYSTEM_REMINDER_RE, "").trim();
15900
+ if (!text2 && !tool2)
15901
+ continue;
15902
+ const t = msFrom(b.createdAt);
15903
+ clock = Math.max(clock, t ?? clock + 1);
15904
+ const model = b.modelInfo && typeof b.modelInfo.modelName === "string" ? b.modelInfo.modelName : null;
15905
+ turns.push({ t: clock, type, text: text2, tool: tool2, model });
15906
+ }
15907
+ if (turns.length === 0)
15908
+ return null;
15909
+ const gitRepo = Array.isArray(cd.trackedGitRepos) && cd.trackedGitRepos[0] && typeof cd.trackedGitRepos[0].repoPath === "string" ? cd.trackedGitRepos[0].repoPath : null;
15910
+ return {
15911
+ composerId,
15912
+ createdAt: msFrom(cd.createdAt),
15913
+ updatedAt: msFrom(cd.lastUpdatedAt),
15914
+ name: typeof cd.name === "string" && cd.name.trim() ? cd.name.trim() : null,
15915
+ gitRepo,
15916
+ turns
15917
+ };
15918
+ }
15919
+ function sniffCursorRaw(raw) {
15920
+ for (const lineRaw of raw.split("\n")) {
15921
+ const line = lineRaw.trim();
15922
+ if (!line)
15923
+ continue;
15924
+ try {
15925
+ const e = JSON.parse(line);
15926
+ return (e.role === "user" || e.role === "assistant") && typeof e.message === "object" && e.message !== null && "content" in e.message && !("type" in e);
15927
+ } catch {
15928
+ return false;
15929
+ }
15930
+ }
15931
+ return false;
15932
+ }
15933
+ function jsonlText(content) {
15934
+ const parts = [];
15935
+ const tools = [];
15936
+ if (Array.isArray(content)) {
15937
+ for (const item of content) {
15938
+ if (!item || typeof item !== "object")
15939
+ continue;
15940
+ const it = item;
15941
+ if (it.type === "text" && it.text)
15942
+ parts.push(it.text);
15943
+ else if (it.type === "tool_use" && it.name)
15944
+ tools.push(it.name);
15945
+ }
15946
+ } else if (typeof content === "string")
15947
+ parts.push(content);
15948
+ return { text: parts.join("\n"), tools };
15949
+ }
15950
+ function parseCursorJsonl(raw, base) {
15951
+ const turns = [];
15952
+ let clock = base;
15953
+ for (const lineRaw of raw.split("\n")) {
15954
+ const line = lineRaw.trim();
15955
+ if (!line)
15956
+ continue;
15957
+ let e;
15958
+ try {
15959
+ e = JSON.parse(line);
15960
+ } catch {
15961
+ continue;
15962
+ }
15963
+ if (e.role !== "user" && e.role !== "assistant")
15964
+ continue;
15965
+ const { text: rawText, tools } = jsonlText(e.message?.content);
15966
+ const type = e.role === "user" ? 1 : 2;
15967
+ const text2 = type === 1 ? cleanUserText(rawText) : rawText.replace(SYSTEM_REMINDER_RE, "").trim();
15968
+ if (type === 2 && tools.length) {
15969
+ for (const tool2 of tools) {
15970
+ clock += 1;
15971
+ turns.push({ t: clock, type: 2, text: "", tool: tool2, model: null });
15972
+ }
15973
+ }
15974
+ if (!text2)
15975
+ continue;
15976
+ clock += 1;
15977
+ turns.push({ t: clock, type, text: text2, tool: null, model: null });
15978
+ }
15979
+ if (turns.length === 0)
15980
+ return null;
15981
+ return { composerId: "", createdAt: base, updatedAt: clock, name: null, gitRepo: null, turns };
15982
+ }
15983
+ function cursorMessages(c) {
15984
+ const out = [];
15985
+ let aiStart = 0;
15986
+ let aiParts = [];
15987
+ const flushAI = () => {
15988
+ if (!aiParts.length)
15989
+ return;
15990
+ out.push({ t: aiStart, role: "ai", text: aiParts.join("\n") });
15991
+ aiParts = [];
15992
+ };
15993
+ for (const turn of c.turns) {
15994
+ if (turn.type === 1) {
15995
+ flushAI();
15996
+ out.push({ t: turn.t, role: "user", text: turn.text });
15997
+ } else {
15998
+ if (aiParts.length === 0)
15999
+ aiStart = turn.t;
16000
+ if (turn.text)
16001
+ aiParts.push(turn.text);
16002
+ }
16003
+ }
16004
+ flushAI();
16005
+ return out;
16006
+ }
16007
+ function composerIdFromFile(file2) {
16008
+ const m = file2.match(/agent-transcripts\/([^/]+)\/[^/]+\.jsonl$/);
16009
+ return m ? m[1] : null;
16010
+ }
16011
+ async function loadCursorComposer(file2, raw, dbPath) {
16012
+ const cid = composerIdFromFile(file2);
16013
+ if (cid && dbPath) {
16014
+ const db = await openCursorSqlite(dbPath);
16015
+ if (db) {
16016
+ try {
16017
+ const c = readCursorComposer(db, cid);
16018
+ if (c)
16019
+ return c;
16020
+ } finally {
16021
+ db.close();
16022
+ }
16023
+ }
16024
+ }
16025
+ return parseCursorJsonl(raw, 0);
16026
+ }
16027
+
16028
+ // ../coding-core/dist/raw.js
16029
+ import path9 from "path";
16030
+ import os2 from "os";
16031
+ var SOURCE_ROOT_ENV_VARS = [
16032
+ "CLAUDE_PROJECTS_DIR",
16033
+ "CODEX_SESSIONS_DIR",
16034
+ "CURSOR_WORKSPACE_DIR",
16035
+ "CURSOR_PROJECTS_DIR",
16036
+ // Cursor's globalStorage dir (holds state.vscdb — the composer bubbles that
16037
+ // carry a Cursor session's real per-turn timestamps + content). Same
16038
+ // isolation contract: overriding any root disables every unset source.
16039
+ "CURSOR_GLOBAL_DIR"
16040
+ ];
16041
+ var anyRootOverridden = () => SOURCE_ROOT_ENV_VARS.some((v) => !!process.env[v]);
16042
+ function resolveSourceRoot(envVar, ...defaultSegments) {
16043
+ const explicit = process.env[envVar];
16044
+ if (explicit)
16045
+ return explicit;
16046
+ if (anyRootOverridden())
16047
+ return null;
16048
+ return path9.join(os2.homedir(), ...defaultSegments);
16049
+ }
16050
+ var cursorGlobalRoot = () => resolveSourceRoot("CURSOR_GLOBAL_DIR", "Library", "Application Support", "Cursor", "User", "globalStorage");
16051
+ function cursorGlobalDbPath() {
16052
+ const root = cursorGlobalRoot();
16053
+ return root === null ? null : path9.join(root, "state.vscdb");
16054
+ }
16055
+ var MACHINE_CURSOR_FILE_RE = /^(.*[/\\]machines[/\\][^/\\]+[/\\]\.cursor)[/\\]projects[/\\]/;
16056
+ function cursorDbPathForFile(file2) {
16057
+ const m = file2.match(MACHINE_CURSOR_FILE_RE);
16058
+ if (m)
16059
+ return path9.join(m[1], "globalStorage", "state.vscdb");
16060
+ return cursorGlobalDbPath();
16061
+ }
16062
+
15788
16063
  // ../coding-core/dist/messages.js
15789
16064
  function extractText(content) {
15790
16065
  if (typeof content === "string")
@@ -15842,12 +16117,16 @@ function extractMessagesCodex(raw) {
15842
16117
  async function extractMessages(file2) {
15843
16118
  let raw;
15844
16119
  try {
15845
- raw = await fs4.readFile(file2, "utf-8");
16120
+ raw = await fs5.readFile(file2, "utf-8");
15846
16121
  } catch {
15847
16122
  return [];
15848
16123
  }
15849
16124
  if (sniffCodexRaw(raw))
15850
16125
  return extractMessagesCodex(raw);
16126
+ if (sniffCursorRaw(raw)) {
16127
+ const c = await loadCursorComposer(file2, raw, cursorDbPathForFile(file2));
16128
+ return c ? cursorMessages(c) : [];
16129
+ }
15851
16130
  const out = [];
15852
16131
  const userTexts = /* @__PURE__ */ new Set();
15853
16132
  const seenUuids = /* @__PURE__ */ new Set();
@@ -15999,7 +16278,7 @@ async function buildWalkthrough(rec, opts) {
15999
16278
  const times = msgs.map((m) => m.t);
16000
16279
  const sessionEnd = Math.max(...times);
16001
16280
  const { text: text2, turnT, userTurns } = buildTranscript(msgs, tz);
16002
- const sandbox = await fs5.mkdtemp(path9.join(os2.tmpdir(), "ps-coding-walk-"));
16281
+ const sandbox = await fs6.mkdtemp(path10.join(os3.tmpdir(), "ps-coding-walk-"));
16003
16282
  try {
16004
16283
  const run2 = await invokeAgent({
16005
16284
  prompt: buildPrompt(rec, text2),
@@ -16022,16 +16301,16 @@ async function buildWalkthrough(rec, opts) {
16022
16301
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
16023
16302
  meta: { costUsd: run2.costUsd }
16024
16303
  };
16025
- await fs5.mkdir(opts.outDir, { recursive: true });
16026
- await fs5.writeFile(path9.join(opts.outDir, `${rec.sessionId}.json`), JSON.stringify(wt, null, 2));
16304
+ await fs6.mkdir(opts.outDir, { recursive: true });
16305
+ await fs6.writeFile(path10.join(opts.outDir, `${rec.sessionId}.json`), JSON.stringify(wt, null, 2));
16027
16306
  return wt;
16028
16307
  } finally {
16029
- await fs5.rm(sandbox, { recursive: true, force: true }).catch(() => {
16308
+ await fs6.rm(sandbox, { recursive: true, force: true }).catch(() => {
16030
16309
  });
16031
16310
  }
16032
16311
  }
16033
16312
  async function readWalkthrough(outDir, sessionId) {
16034
- return fs5.readFile(path9.join(outDir, `${sessionId}.json`), "utf8").then(JSON.parse).catch(() => null);
16313
+ return fs6.readFile(path10.join(outDir, `${sessionId}.json`), "utf8").then(JSON.parse).catch(() => null);
16035
16314
  }
16036
16315
 
16037
16316
  // ../coding-core/dist/gate.js
@@ -16088,7 +16367,7 @@ function capGradable(gradable) {
16088
16367
  }
16089
16368
 
16090
16369
  // ../../lib/agents/coding/profile.ts
16091
- import path10 from "path";
16370
+ import path11 from "path";
16092
16371
 
16093
16372
  // ../../lib/calibration/fingerprint.ts
16094
16373
  import { createHash } from "node:crypto";
@@ -16239,7 +16518,7 @@ var TRANSCRIPT_LINE_RE = new RegExp(`^\\s*(${NOTE})((,| and) ${NOTE})*\\s*$|^\\s
16239
16518
 
16240
16519
  // ../../lib/calibration/index.ts
16241
16520
  var DEFAULT_CALIBRATION = {
16242
- version: "2026-07-16.2",
16521
+ version: "2026-07-21.1",
16243
16522
  // = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
16244
16523
  // src/grade/criteria.ts). A unit test fails loud when the rubric changes
16245
16524
  // without this being updated (and re-pushed to the server).
@@ -16335,13 +16614,14 @@ var DEFAULT_CALIBRATION = {
16335
16614
  },
16336
16615
  codingBenchmarks: {
16337
16616
  flow: {
16338
- // typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day is the
16339
- // recognized deep-work ceiling (Newport) 50% most sit far below it.
16617
+ // typical knowledge worker ≈ 35% of an 8h day focused; the ~4h/day
16618
+ // deep-work ceiling (Newport) sits nearer ~40% of a real (9-10h) top
16619
+ // performer's day — 50% overstated it (owner call 2026-07-21).
16340
16620
  typicalPctOfDay: 0.35,
16341
- topPctOfDay: 0.5,
16621
+ topPctOfDay: 0.4,
16342
16622
  tag: "measured",
16343
- source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
16344
- line: "the best spend ~half the workday in true deep flow; ~4h/day is the human ceiling"
16623
+ source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling against a 9-10h day)",
16624
+ line: "the best spend ~40% of the workday in true deep flow; ~4h/day is the human ceiling"
16345
16625
  },
16346
16626
  longestRun: {
16347
16627
  typicalHours: 0.67,
@@ -16390,8 +16670,8 @@ var BEST = DEFAULT_CALIBRATION.codingBenchmarks;
16390
16670
 
16391
16671
  // ../../lib/agents/coding/profile.ts
16392
16672
  var ROOT = process.cwd();
16393
- var CODING_DIR = process.env.POLYMATH_DATA_DIR ? path10.join(process.env.POLYMATH_DATA_DIR, "coding") : path10.join(ROOT, ".data", "coding");
16394
- var GRADES = path10.join(CODING_DIR, "grades");
16673
+ var CODING_DIR = process.env.POLYMATH_DATA_DIR ? path11.join(process.env.POLYMATH_DATA_DIR, "coding") : path11.join(ROOT, ".data", "coding");
16674
+ var GRADES = path11.join(CODING_DIR, "grades");
16395
16675
 
16396
16676
  // ../../scripts/coding-walkthrough.mts
16397
16677
  var argv = process.argv.slice(2);
@@ -16403,7 +16683,7 @@ var MODEL = flag("model", "sonnet");
16403
16683
  var CONC = Number(flag("conc", "8"));
16404
16684
  var REGEN = argv.includes("--regen");
16405
16685
  var CODING = CODING_DIR;
16406
- var DIR = path11.join(CODING, "walkthroughs");
16686
+ var DIR = path12.join(CODING, "walkthroughs");
16407
16687
  function limiter(max) {
16408
16688
  let a = 0;
16409
16689
  const q = [];
@@ -16419,12 +16699,12 @@ function limiter(max) {
16419
16699
  };
16420
16700
  }
16421
16701
  async function main() {
16422
- const sessions = JSON.parse(await fs6.readFile(path11.join(CODING, "sessions.json"), "utf8"));
16702
+ const sessions = JSON.parse(await fs7.readFile(path12.join(CODING, "sessions.json"), "utf8"));
16423
16703
  const live = sessions.filter((s) => s.klass === "interactive" && !s.duplicateOf);
16424
16704
  const cutoff = aiWindowCutoff(live);
16425
16705
  const eligible = live.filter((s) => !isTrivial(s) && (!cutoff || (s.start ?? "") >= cutoff));
16426
16706
  const todo = capGradable(eligible);
16427
- await fs6.mkdir(DIR, { recursive: true });
16707
+ await fs7.mkdir(DIR, { recursive: true });
16428
16708
  const pending = [];
16429
16709
  for (const s of todo) {
16430
16710
  if (!REGEN && await readWalkthrough(DIR, s.sessionId)) continue;
@@ -16453,7 +16733,7 @@ async function main() {
16453
16733
  console.error(`[walkthrough] Likely cause: unreadable or unsupported transcript files (a log format the reader cannot parse). Fix ingestion, then re-run this stage.`);
16454
16734
  process.exit(1);
16455
16735
  }
16456
- console.log(`[walkthrough] done \u2192 ${path11.relative(process.cwd(), DIR)}/`);
16736
+ console.log(`[walkthrough] done \u2192 ${path12.relative(process.cwd(), DIR)}/`);
16457
16737
  }
16458
16738
  main().catch((e) => {
16459
16739
  console.error(e);