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.
- package/dist/cli.js +23943 -21630
- package/dist/engine/chat-loops.js +8 -1
- package/dist/engine/exp-allfacets.js +8 -1
- package/dist/engine/exp-person.js +8 -1
- package/dist/engine/exp-pipeline.js +8 -1
- package/dist/engine/ingest-export.js +7 -6
- package/dist/engine/peak-demos.js +8 -1
- package/dist/engine/person-dimension-summary.js +8 -1
- package/dist/engine/person-facet-lines.js +8 -1
- package/dist/engine/person-headline.js +8 -1
- package/dist/engine/person-report.js +8 -1
- package/dist/engine/person-self-image.js +8 -1
- package/dist/engine/public-report.js +15 -7
- package/dist/engine/run-analysis.js +8 -1
- package/dist/engine/run-tagger.js +8 -1
- package/dist/index.js +19647 -17969
- package/dist/pipeline/coding-agglomerate.js +826 -82
- package/dist/pipeline/coding-aggregate.js +307 -23
- package/dist/pipeline/coding-build.js +453 -95
- package/dist/pipeline/coding-coaching.js +479 -88
- package/dist/pipeline/coding-day-digest.js +308 -36
- package/dist/pipeline/coding-delegation.js +376 -52
- package/dist/pipeline/coding-expertise.js +356 -62
- package/dist/pipeline/coding-flow.js +288 -15
- package/dist/pipeline/coding-focus.js +371 -51
- package/dist/pipeline/coding-frontier-detail.js +344 -50
- package/dist/pipeline/coding-frontier.js +7 -6
- package/dist/pipeline/coding-gap-dist.js +288 -15
- package/dist/pipeline/coding-gap.js +507 -115
- package/dist/pipeline/coding-grade.js +342 -45
- package/dist/pipeline/coding-growth.js +17041 -0
- package/dist/pipeline/coding-nutshell.js +15 -7
- package/dist/pipeline/coding-projects.js +7 -6
- package/dist/pipeline/coding-walkthrough.js +317 -37
- package/dist/pipeline/coding-workbrief.js +16387 -0
- package/dist/web/app.js +2095 -1395
- package/dist/web/styles.css +1 -1
- package/package.json +1 -1
|
@@ -134,13 +134,13 @@ var require_secure_json_parse = __commonJS({
|
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
// ../../scripts/coding-day-digest.mts
|
|
137
|
-
import { promises as
|
|
138
|
-
import
|
|
137
|
+
import { promises as fs7 } from "fs";
|
|
138
|
+
import path12 from "path";
|
|
139
139
|
|
|
140
140
|
// ../../lib/agents/coding/dayDigest.ts
|
|
141
|
-
import { promises as
|
|
142
|
-
import
|
|
143
|
-
import
|
|
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(model2, env = process.env) {
|
|
514
|
+
if (model2 && !/^(claude|haiku|sonnet|opus)/i.test(model2)) return model2;
|
|
515
|
+
if (model2 && /^haiku/i.test(model2)) 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
|
-
|
|
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:
|
|
2180
|
-
const fullPath = [...
|
|
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,
|
|
2303
|
+
constructor(parent, value, path13, key) {
|
|
2297
2304
|
this._cachedPath = [];
|
|
2298
2305
|
this.parent = parent;
|
|
2299
2306
|
this.data = value;
|
|
2300
|
-
this._path =
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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,250 @@ 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 model2 = b.modelInfo && typeof b.modelInfo.modelName === "string" ? b.modelInfo.modelName : null;
|
|
15905
|
+
turns.push({ t: clock, type, text: text2, tool: tool2, model: model2 });
|
|
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 composerIdFromFile(file2) {
|
|
15984
|
+
const m = file2.match(/agent-transcripts\/([^/]+)\/[^/]+\.jsonl$/);
|
|
15985
|
+
return m ? m[1] : null;
|
|
15986
|
+
}
|
|
15987
|
+
async function loadCursorComposer(file2, raw, dbPath) {
|
|
15988
|
+
const cid = composerIdFromFile(file2);
|
|
15989
|
+
if (cid && dbPath) {
|
|
15990
|
+
const db = await openCursorSqlite(dbPath);
|
|
15991
|
+
if (db) {
|
|
15992
|
+
try {
|
|
15993
|
+
const c = readCursorComposer(db, cid);
|
|
15994
|
+
if (c)
|
|
15995
|
+
return c;
|
|
15996
|
+
} finally {
|
|
15997
|
+
db.close();
|
|
15998
|
+
}
|
|
15999
|
+
}
|
|
16000
|
+
}
|
|
16001
|
+
return parseCursorJsonl(raw, 0);
|
|
16002
|
+
}
|
|
16003
|
+
|
|
16004
|
+
// ../coding-core/dist/raw.js
|
|
16005
|
+
import path9 from "path";
|
|
16006
|
+
import os2 from "os";
|
|
16007
|
+
var SOURCE_ROOT_ENV_VARS = [
|
|
16008
|
+
"CLAUDE_PROJECTS_DIR",
|
|
16009
|
+
"CODEX_SESSIONS_DIR",
|
|
16010
|
+
"CURSOR_WORKSPACE_DIR",
|
|
16011
|
+
"CURSOR_PROJECTS_DIR",
|
|
16012
|
+
// Cursor's globalStorage dir (holds state.vscdb — the composer bubbles that
|
|
16013
|
+
// carry a Cursor session's real per-turn timestamps + content). Same
|
|
16014
|
+
// isolation contract: overriding any root disables every unset source.
|
|
16015
|
+
"CURSOR_GLOBAL_DIR"
|
|
16016
|
+
];
|
|
16017
|
+
var anyRootOverridden = () => SOURCE_ROOT_ENV_VARS.some((v) => !!process.env[v]);
|
|
16018
|
+
function resolveSourceRoot(envVar, ...defaultSegments) {
|
|
16019
|
+
const explicit = process.env[envVar];
|
|
16020
|
+
if (explicit)
|
|
16021
|
+
return explicit;
|
|
16022
|
+
if (anyRootOverridden())
|
|
16023
|
+
return null;
|
|
16024
|
+
return path9.join(os2.homedir(), ...defaultSegments);
|
|
16025
|
+
}
|
|
16026
|
+
var cursorGlobalRoot = () => resolveSourceRoot("CURSOR_GLOBAL_DIR", "Library", "Application Support", "Cursor", "User", "globalStorage");
|
|
16027
|
+
function cursorGlobalDbPath() {
|
|
16028
|
+
const root = cursorGlobalRoot();
|
|
16029
|
+
return root === null ? null : path9.join(root, "state.vscdb");
|
|
16030
|
+
}
|
|
16031
|
+
var MACHINE_CURSOR_FILE_RE = /^(.*[/\\]machines[/\\][^/\\]+[/\\]\.cursor)[/\\]projects[/\\]/;
|
|
16032
|
+
function cursorDbPathForFile(file2) {
|
|
16033
|
+
const m = file2.match(MACHINE_CURSOR_FILE_RE);
|
|
16034
|
+
if (m)
|
|
16035
|
+
return path9.join(m[1], "globalStorage", "state.vscdb");
|
|
16036
|
+
return cursorGlobalDbPath();
|
|
16037
|
+
}
|
|
16038
|
+
|
|
15788
16039
|
// ../coding-core/dist/messages.js
|
|
15789
16040
|
function extractText(content) {
|
|
15790
16041
|
if (typeof content === "string")
|
|
@@ -15812,15 +16063,35 @@ function extractUserMessagesCodex(raw) {
|
|
|
15812
16063
|
}
|
|
15813
16064
|
return out.sort((a, b) => a.t - b.t);
|
|
15814
16065
|
}
|
|
16066
|
+
function extractUserMessagesCursor(c) {
|
|
16067
|
+
const out = [];
|
|
16068
|
+
let lastTs = null;
|
|
16069
|
+
for (const turn of c.turns) {
|
|
16070
|
+
const t = turn.t;
|
|
16071
|
+
const gapMs = Number.isFinite(t) && lastTs != null ? t - lastTs : NaN;
|
|
16072
|
+
if (Number.isFinite(t))
|
|
16073
|
+
lastTs = t;
|
|
16074
|
+
if (turn.type !== 1)
|
|
16075
|
+
continue;
|
|
16076
|
+
const text2 = humanTypedText(turn.text);
|
|
16077
|
+
if (text2 && Number.isFinite(t))
|
|
16078
|
+
out.push({ t, text: text2, gapMs });
|
|
16079
|
+
}
|
|
16080
|
+
return out.sort((a, b) => a.t - b.t);
|
|
16081
|
+
}
|
|
15815
16082
|
async function extractUserMessages(file2) {
|
|
15816
16083
|
let raw;
|
|
15817
16084
|
try {
|
|
15818
|
-
raw = await
|
|
16085
|
+
raw = await fs5.readFile(file2, "utf-8");
|
|
15819
16086
|
} catch {
|
|
15820
16087
|
return [];
|
|
15821
16088
|
}
|
|
15822
16089
|
if (sniffCodexRaw(raw))
|
|
15823
16090
|
return extractUserMessagesCodex(raw);
|
|
16091
|
+
if (sniffCursorRaw(raw)) {
|
|
16092
|
+
const c = await loadCursorComposer(file2, raw, cursorDbPathForFile(file2));
|
|
16093
|
+
return c ? extractUserMessagesCursor(c) : [];
|
|
16094
|
+
}
|
|
15824
16095
|
const out = [];
|
|
15825
16096
|
const userTexts = /* @__PURE__ */ new Set();
|
|
15826
16097
|
const seenUuids = /* @__PURE__ */ new Set();
|
|
@@ -15924,7 +16195,7 @@ ${lines.join("\n")}`);
|
|
|
15924
16195
|
}
|
|
15925
16196
|
var SYSTEM = "You read all the messages a person sent on ONE day across several coding-agent conversations, and say \u2014 per conversation \u2014 what they actually DID that day, semantically and specifically. Their words only; ignore mechanical scaffolding. One tight line per conversation (e.g. 'built the full prototype of the apprenticeship app', 'tuned the intelligence rubric with examples from their own read on people', 'set up an EC2 box to run the analysis overnight'). No flattery, no filler.";
|
|
15926
16197
|
async function digestDay(dc, opts = {}) {
|
|
15927
|
-
const sandbox = await
|
|
16198
|
+
const sandbox = await fs6.mkdtemp(path10.join(os3.tmpdir(), "ps-coding-day-"));
|
|
15928
16199
|
try {
|
|
15929
16200
|
const prompt = `Date: ${dc.date}. Below are ALL the conversations this person sent messages in that day, each with their verbatim messages. For EACH conversation write one specific line on what they did/worked on that day. Then one "overall" line summarizing the whole day.
|
|
15930
16201
|
|
|
@@ -15945,7 +16216,7 @@ Output a SINGLE fenced \`\`\`json block:
|
|
|
15945
16216
|
conversations: dc.conversations.map((c) => ({ sessionId: c.sessionId, title: c.title, messageCount: c.messageCount, summary: summaries.get(c.sessionId.slice(0, 8)) ?? "" }))
|
|
15946
16217
|
};
|
|
15947
16218
|
} finally {
|
|
15948
|
-
await
|
|
16219
|
+
await fs6.rm(sandbox, { recursive: true, force: true }).catch(() => {
|
|
15949
16220
|
});
|
|
15950
16221
|
}
|
|
15951
16222
|
}
|
|
@@ -15988,7 +16259,7 @@ function aiWindowCutoff(sessions, opts = {}) {
|
|
|
15988
16259
|
}
|
|
15989
16260
|
|
|
15990
16261
|
// ../../lib/agents/coding/profile.ts
|
|
15991
|
-
import
|
|
16262
|
+
import path11 from "path";
|
|
15992
16263
|
|
|
15993
16264
|
// ../../lib/calibration/fingerprint.ts
|
|
15994
16265
|
import { createHash } from "node:crypto";
|
|
@@ -16142,7 +16413,7 @@ var TRANSCRIPT_LINE_RE = new RegExp(`^\\s*(${NOTE})((,| and) ${NOTE})*\\s*$|^\\s
|
|
|
16142
16413
|
|
|
16143
16414
|
// ../../lib/calibration/index.ts
|
|
16144
16415
|
var DEFAULT_CALIBRATION = {
|
|
16145
|
-
version: "2026-07-
|
|
16416
|
+
version: "2026-07-21.1",
|
|
16146
16417
|
// = RUBRIC_FINGERPRINT of the shipped npm rubric (packages/coding-analyzer/
|
|
16147
16418
|
// src/grade/criteria.ts). A unit test fails loud when the rubric changes
|
|
16148
16419
|
// without this being updated (and re-pushed to the server).
|
|
@@ -16238,13 +16509,14 @@ var DEFAULT_CALIBRATION = {
|
|
|
16238
16509
|
},
|
|
16239
16510
|
codingBenchmarks: {
|
|
16240
16511
|
flow: {
|
|
16241
|
-
// typical knowledge worker ≈ 35% of an 8h day focused; ~4h/day
|
|
16242
|
-
//
|
|
16512
|
+
// typical knowledge worker ≈ 35% of an 8h day focused; the ~4h/day
|
|
16513
|
+
// deep-work ceiling (Newport) sits nearer ~40% of a real (9-10h) top
|
|
16514
|
+
// performer's day — 50% overstated it (owner call 2026-07-21).
|
|
16243
16515
|
typicalPctOfDay: 0.35,
|
|
16244
|
-
topPctOfDay: 0.
|
|
16516
|
+
topPctOfDay: 0.4,
|
|
16245
16517
|
tag: "measured",
|
|
16246
|
-
source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling)",
|
|
16247
|
-
line: "the best spend ~
|
|
16518
|
+
source: "RescueTime 2019 (~2h48m focused/day) \xB7 Cal Newport, Deep Work (~4h/day deep-work ceiling against a 9-10h day)",
|
|
16519
|
+
line: "the best spend ~40% of the workday in true deep flow; ~4h/day is the human ceiling"
|
|
16248
16520
|
},
|
|
16249
16521
|
longestRun: {
|
|
16250
16522
|
typicalHours: 0.67,
|
|
@@ -16293,8 +16565,8 @@ var BEST = DEFAULT_CALIBRATION.codingBenchmarks;
|
|
|
16293
16565
|
|
|
16294
16566
|
// ../../lib/agents/coding/profile.ts
|
|
16295
16567
|
var ROOT = process.cwd();
|
|
16296
|
-
var CODING_DIR = process.env.POLYMATH_DATA_DIR ?
|
|
16297
|
-
var GRADES =
|
|
16568
|
+
var CODING_DIR = process.env.POLYMATH_DATA_DIR ? path11.join(process.env.POLYMATH_DATA_DIR, "coding") : path11.join(ROOT, ".data", "coding");
|
|
16569
|
+
var GRADES = path11.join(CODING_DIR, "grades");
|
|
16298
16570
|
|
|
16299
16571
|
// ../../scripts/coding-day-digest.mts
|
|
16300
16572
|
var argv = process.argv.slice(2);
|
|
@@ -16302,28 +16574,28 @@ var model = argv.indexOf("--model") >= 0 ? argv[argv.indexOf("--model") + 1] : "
|
|
|
16302
16574
|
var REDO = argv.includes("--redo");
|
|
16303
16575
|
var CONC = Number(argv.indexOf("--conc") >= 0 ? argv[argv.indexOf("--conc") + 1] : "8");
|
|
16304
16576
|
var CODING = CODING_DIR;
|
|
16305
|
-
var OUT =
|
|
16577
|
+
var OUT = path12.join(CODING, "day-digest.json");
|
|
16306
16578
|
var TZ = process.env.CODING_TZ || "America/Los_Angeles";
|
|
16307
16579
|
async function main() {
|
|
16308
|
-
const all = JSON.parse(await
|
|
16580
|
+
const all = JSON.parse(await fs7.readFile(path12.join(CODING, "sessions.json"), "utf8"));
|
|
16309
16581
|
const sessions = all.filter((s) => s.klass === "interactive");
|
|
16310
16582
|
console.log(`[day-digest] grouping ${sessions.length}/${all.length} interactive sessions' messages by day (tz ${TZ})\u2026`);
|
|
16311
16583
|
const dayConvs = await buildDayConversations(sessions, TZ);
|
|
16312
16584
|
console.log(`[day-digest] ${dayConvs.length} active days \xB7 ${dayConvs.reduce((a, d) => a + d.totalMessages, 0)} user messages total`);
|
|
16313
|
-
const prev = REDO ? { generatedAt: "", tz: TZ, days: [] } : await
|
|
16585
|
+
const prev = REDO ? { generatedAt: "", tz: TZ, days: [] } : await fs7.readFile(OUT, "utf8").then(JSON.parse).catch(() => ({ generatedAt: "", tz: TZ, days: [] }));
|
|
16314
16586
|
const done = new Map((prev.days ?? []).map((d) => [d.date, d]));
|
|
16315
16587
|
const out = {
|
|
16316
16588
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16317
16589
|
tz: TZ,
|
|
16318
16590
|
days: dayConvs.map((dc) => done.get(dc.date) ?? { date: dc.date, overall: "", conversationsTouched: dc.conversations.length, totalMessages: dc.totalMessages, conversations: dc.conversations.map((c) => ({ sessionId: c.sessionId, title: c.title, messageCount: c.messageCount, summary: "" })) })
|
|
16319
16591
|
};
|
|
16320
|
-
await
|
|
16592
|
+
await fs7.writeFile(OUT, JSON.stringify(out, null, 2));
|
|
16321
16593
|
const cutoffDay = aiWindowCutoff(sessions).slice(0, 10);
|
|
16322
16594
|
const todo = dayConvs.filter((dc) => (REDO || !done.get(dc.date)?.overall) && (!cutoffDay || dc.date >= cutoffDay));
|
|
16323
16595
|
console.log(`[day-digest] digesting ${todo.length} days${cutoffDay ? ` since ${cutoffDay} (AI window)` : ""} on ${model}, conc ${CONC} (newest first)\u2026`);
|
|
16324
16596
|
startRun("day-digest", todo.length);
|
|
16325
16597
|
let writeChain = Promise.resolve();
|
|
16326
|
-
const save = () => writeChain = writeChain.then(() =>
|
|
16598
|
+
const save = () => writeChain = writeChain.then(() => fs7.writeFile(OUT, JSON.stringify(out, null, 2)));
|
|
16327
16599
|
let cursor = 0;
|
|
16328
16600
|
const worker = async () => {
|
|
16329
16601
|
while (cursor < todo.length) {
|
|
@@ -16348,7 +16620,7 @@ async function main() {
|
|
|
16348
16620
|
await Promise.all(Array.from({ length: Math.min(CONC, todo.length) }, worker));
|
|
16349
16621
|
await writeChain;
|
|
16350
16622
|
endRun();
|
|
16351
|
-
console.log(`[day-digest] wrote \u2192 ${
|
|
16623
|
+
console.log(`[day-digest] wrote \u2192 ${path12.relative(process.cwd(), OUT)}`);
|
|
16352
16624
|
}
|
|
16353
16625
|
main().catch((e) => {
|
|
16354
16626
|
console.error(e);
|