polymath-society 0.2.8 → 0.2.10
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 +420 -239
- package/dist/engine/chat-loops.js +17290 -0
- package/dist/index.js +312 -193
- package/dist/pipeline/coding-day-digest.js +40 -2
- package/dist/pipeline/coding-delegation.js +27 -2
- package/dist/pipeline/coding-grade.js +29 -2
- package/dist/pipeline/coding-walkthrough.js +30 -2
- package/dist/web/app.js +363 -436
- package/dist/web/styles.css +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -17,9 +17,9 @@ var __export = (target, all) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __copyProps = (to, from, except, desc) => {
|
|
19
19
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let
|
|
21
|
-
if (!__hasOwnProp.call(to,
|
|
22
|
-
__defProp(to,
|
|
20
|
+
for (let key2 of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
22
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
23
23
|
}
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
@@ -507,9 +507,9 @@ async function openCursorDb(dbPath) {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
return {
|
|
510
|
-
get(
|
|
510
|
+
get(key2) {
|
|
511
511
|
try {
|
|
512
|
-
const row = db.prepare("SELECT value FROM ItemTable WHERE key = ?").get(
|
|
512
|
+
const row = db.prepare("SELECT value FROM ItemTable WHERE key = ?").get(key2);
|
|
513
513
|
if (!row || row.value == null)
|
|
514
514
|
return [];
|
|
515
515
|
const txt = typeof row.value === "string" ? row.value : Buffer.from(row.value).toString("utf-8");
|
|
@@ -738,10 +738,10 @@ function demoteTemplateFanouts(sessions) {
|
|
|
738
738
|
for (const s of sessions) {
|
|
739
739
|
if (s.klass !== "interactive" || s.humanTurns > 2)
|
|
740
740
|
continue;
|
|
741
|
-
const
|
|
742
|
-
if (
|
|
741
|
+
const key2 = s.firstHuman.replace(/\s+/g, " ").trim().slice(0, FANOUT_PREFIX);
|
|
742
|
+
if (key2.length < FANOUT_PREFIX)
|
|
743
743
|
continue;
|
|
744
|
-
(groups.get(
|
|
744
|
+
(groups.get(key2) ?? groups.set(key2, []).get(key2)).push(s);
|
|
745
745
|
}
|
|
746
746
|
for (const g of groups.values()) {
|
|
747
747
|
if (g.length < FANOUT_MIN_SESSIONS)
|
|
@@ -824,7 +824,24 @@ function partition(sessions) {
|
|
|
824
824
|
(isGradable(s) ? gradable : isTrivial(s) ? trivial : thin).push(s);
|
|
825
825
|
return { gradable, thin, trivial };
|
|
826
826
|
}
|
|
827
|
-
|
|
827
|
+
function aiWindowCutoff(sessions, opts = {}) {
|
|
828
|
+
const envDays = Number(process.env.POLYMATH_AI_WINDOW_DAYS);
|
|
829
|
+
const days = opts.windowDays ?? (Number.isFinite(envDays) && envDays >= 0 ? envDays : AI_WINDOW.days);
|
|
830
|
+
const floor = opts.minSessions ?? AI_WINDOW.minSessions;
|
|
831
|
+
if (days === 0)
|
|
832
|
+
return "";
|
|
833
|
+
const starts = sessions.map((s) => s.start ?? "").filter(Boolean).sort();
|
|
834
|
+
const latest = starts[starts.length - 1];
|
|
835
|
+
if (!latest)
|
|
836
|
+
return "";
|
|
837
|
+
const windowCutoff = new Date(new Date(latest).getTime() - days * 864e5).toISOString();
|
|
838
|
+
const gradableStarts = sessions.filter(isGradable).map((s) => s.start ?? "").filter(Boolean).sort().reverse();
|
|
839
|
+
if (gradableStarts.length <= floor)
|
|
840
|
+
return "";
|
|
841
|
+
const floorStart = gradableStarts[floor - 1];
|
|
842
|
+
return floorStart < windowCutoff ? floorStart : windowCutoff;
|
|
843
|
+
}
|
|
844
|
+
var GATE, AI_WINDOW;
|
|
828
845
|
var init_gate = __esm({
|
|
829
846
|
"../coding-core/dist/gate.js"() {
|
|
830
847
|
"use strict";
|
|
@@ -837,13 +854,21 @@ var init_gate = __esm({
|
|
|
837
854
|
// below this = a one-liner, definitely trivial
|
|
838
855
|
trivialHumanTurns: 2
|
|
839
856
|
};
|
|
857
|
+
AI_WINDOW = {
|
|
858
|
+
days: 90,
|
|
859
|
+
// ~3 months
|
|
860
|
+
minSessions: 40
|
|
861
|
+
// extend the window back until this many gradable sessions
|
|
862
|
+
};
|
|
840
863
|
}
|
|
841
864
|
});
|
|
842
865
|
|
|
843
866
|
// src/gate.ts
|
|
844
867
|
var gate_exports = {};
|
|
845
868
|
__export(gate_exports, {
|
|
869
|
+
AI_WINDOW: () => AI_WINDOW,
|
|
846
870
|
GATE: () => GATE,
|
|
871
|
+
aiWindowCutoff: () => aiWindowCutoff,
|
|
847
872
|
isGradable: () => isGradable,
|
|
848
873
|
isTrivial: () => isTrivial,
|
|
849
874
|
partition: () => partition
|
|
@@ -1323,8 +1348,8 @@ var require_secure_json_parse = __commonJS({
|
|
|
1323
1348
|
}
|
|
1324
1349
|
delete node.constructor;
|
|
1325
1350
|
}
|
|
1326
|
-
for (const
|
|
1327
|
-
const value = node[
|
|
1351
|
+
for (const key2 in node) {
|
|
1352
|
+
const value = node[key2];
|
|
1328
1353
|
if (value && typeof value === "object") {
|
|
1329
1354
|
next.push(value);
|
|
1330
1355
|
}
|
|
@@ -2092,7 +2117,8 @@ var init_plan = __esm({
|
|
|
2092
2117
|
// src/wizard.ts
|
|
2093
2118
|
var wizard_exports = {};
|
|
2094
2119
|
__export(wizard_exports, {
|
|
2095
|
-
runWizard: () => runWizard
|
|
2120
|
+
runWizard: () => runWizard,
|
|
2121
|
+
sayExportLinks: () => sayExportLinks
|
|
2096
2122
|
});
|
|
2097
2123
|
import { promises as fs35 } from "fs";
|
|
2098
2124
|
import os10 from "os";
|
|
@@ -2127,6 +2153,24 @@ async function scanJsonlDir(label, dir) {
|
|
|
2127
2153
|
await walk(dir, 0);
|
|
2128
2154
|
return { label, dir, files, newest: newest ? new Date(newest).toISOString().slice(0, 10) : null };
|
|
2129
2155
|
}
|
|
2156
|
+
async function sayExportLinks(say, haveKinds) {
|
|
2157
|
+
const { EXPORT_LINKS: EXPORT_LINKS2, osc8: osc82 } = await Promise.resolve().then(() => (init_exportLinks(), exportLinks_exports));
|
|
2158
|
+
const requestable = EXPORT_LINKS2.filter((l) => l.requestUrl);
|
|
2159
|
+
if (!requestable.length) return;
|
|
2160
|
+
const missing = requestable.filter((l) => !haveKinds.has(l.kind));
|
|
2161
|
+
say();
|
|
2162
|
+
say(` ${bold("Export more of your history")} \u2014 one click each:`);
|
|
2163
|
+
if (missing.length) {
|
|
2164
|
+
say(` ${missing.map((l) => l.label).join(", ")} ${missing.length === 1 ? "is" : "are"} not on this machine yet.`);
|
|
2165
|
+
}
|
|
2166
|
+
for (const l of requestable) {
|
|
2167
|
+
const have = haveKinds.has(l.kind);
|
|
2168
|
+
say(` ${bold(l.label)}${have ? green(" \u2713 already have one") : ""} ${osc82(l.requestUrl, l.requestUrl)}`);
|
|
2169
|
+
say(` ${l.buttonPath} \xB7 ${l.eta}`);
|
|
2170
|
+
}
|
|
2171
|
+
say(` ${dim("Run polymath-society again once a download lands \u2014 it finds the zip on its own.")}`);
|
|
2172
|
+
say();
|
|
2173
|
+
}
|
|
2130
2174
|
function describeExport(f, i, included, hadPrevious) {
|
|
2131
2175
|
const kind = {
|
|
2132
2176
|
chatgpt: "ChatGPT export",
|
|
@@ -2302,20 +2346,7 @@ async function runWizard() {
|
|
|
2302
2346
|
const defaults = found.map(() => true);
|
|
2303
2347
|
say(` Found ${dim("(identified locally from the files themselves)")}:`);
|
|
2304
2348
|
found.forEach((f, i) => say(describeExport(f, i, defaults[i], hadPrevious)));
|
|
2305
|
-
|
|
2306
|
-
const { EXPORT_LINKS: EXPORT_LINKS2, osc8: osc82 } = await Promise.resolve().then(() => (init_exportLinks(), exportLinks_exports));
|
|
2307
|
-
const haveKinds = new Set(found.map((f) => f.kind));
|
|
2308
|
-
const missing = EXPORT_LINKS2.filter((l) => l.requestUrl && !haveKinds.has(l.kind));
|
|
2309
|
-
if (missing.length) {
|
|
2310
|
-
say();
|
|
2311
|
-
say(` ${bold("Not on this machine yet")} \u2014 one click to request each:`);
|
|
2312
|
-
for (const l of missing) {
|
|
2313
|
-
say(` ${bold(l.label)} ${osc82(l.requestUrl, l.requestUrl)}`);
|
|
2314
|
-
say(` ${l.buttonPath} \xB7 ${l.eta}`);
|
|
2315
|
-
}
|
|
2316
|
-
say();
|
|
2317
|
-
}
|
|
2318
|
-
}
|
|
2349
|
+
await sayExportLinks(say, new Set(found.map((f) => f.kind)));
|
|
2319
2350
|
const include = await pick2(defaults, hadPrevious);
|
|
2320
2351
|
const manifest = {
|
|
2321
2352
|
approvedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2335,16 +2366,7 @@ async function runWizard() {
|
|
|
2335
2366
|
}
|
|
2336
2367
|
} else {
|
|
2337
2368
|
await writeManifest(dataDir, { approvedAt: (/* @__PURE__ */ new Date()).toISOString(), agents, exports: { included: [], excluded: [] } });
|
|
2338
|
-
|
|
2339
|
-
const { EXPORT_LINKS: EXPORT_LINKS2, osc8: osc82 } = await Promise.resolve().then(() => (init_exportLinks(), exportLinks_exports));
|
|
2340
|
-
const missing = EXPORT_LINKS2.filter((l) => l.requestUrl);
|
|
2341
|
-
say();
|
|
2342
|
-
say(` ${bold("You can request these exports")} \u2014 one click each:`);
|
|
2343
|
-
for (const l of missing) {
|
|
2344
|
-
say(` ${bold(l.label)} ${osc82(l.requestUrl, l.requestUrl)}`);
|
|
2345
|
-
say(` ${l.buttonPath} \xB7 ${l.eta}`);
|
|
2346
|
-
}
|
|
2347
|
-
}
|
|
2369
|
+
await sayExportLinks(say, /* @__PURE__ */ new Set());
|
|
2348
2370
|
}
|
|
2349
2371
|
{
|
|
2350
2372
|
const { EXPORT_LINKS: EXPORT_LINKS2 } = await Promise.resolve().then(() => (init_exportLinks(), exportLinks_exports));
|
|
@@ -2897,10 +2919,10 @@ async function extractUserMessages(file2) {
|
|
|
2897
2919
|
function createMessageDeduper() {
|
|
2898
2920
|
const seen = /* @__PURE__ */ new Set();
|
|
2899
2921
|
return (m) => {
|
|
2900
|
-
const
|
|
2901
|
-
if (seen.has(
|
|
2922
|
+
const key2 = m.uuid ?? `${m.t}|${m.text}`;
|
|
2923
|
+
if (seen.has(key2))
|
|
2902
2924
|
return false;
|
|
2903
|
-
seen.add(
|
|
2925
|
+
seen.add(key2);
|
|
2904
2926
|
return true;
|
|
2905
2927
|
};
|
|
2906
2928
|
}
|
|
@@ -3406,8 +3428,8 @@ async function analyze(opts = {}) {
|
|
|
3406
3428
|
const agent = raw.filter((s) => s.klass === "agent");
|
|
3407
3429
|
const byReason = /* @__PURE__ */ new Map();
|
|
3408
3430
|
for (const s of agent) {
|
|
3409
|
-
const
|
|
3410
|
-
byReason.set(
|
|
3431
|
+
const key2 = s.klassReason.startsWith("cwd:") ? "cwd:<agent-dir>" : s.klassReason;
|
|
3432
|
+
byReason.set(key2, (byReason.get(key2) ?? 0) + 1);
|
|
3411
3433
|
}
|
|
3412
3434
|
const records = toSessionRecords(interactive, idleGapMin);
|
|
3413
3435
|
const dupCount = await markDuplicates(records);
|
|
@@ -3633,9 +3655,9 @@ var UIKEY_FOR = [
|
|
|
3633
3655
|
["delegation", "delegation"],
|
|
3634
3656
|
["frontier", "frontier"]
|
|
3635
3657
|
];
|
|
3636
|
-
var GRADED_CRITERIA2 = UIKEY_FOR.map(([
|
|
3637
|
-
const c = GRADED_CRITERIA.find((rc) => rc.key ===
|
|
3638
|
-
if (!c || !c.rungs?.length) throw new Error(`repo rubric (lib/agents/coding/criteria.ts) no longer defines graded criterion "${
|
|
3658
|
+
var GRADED_CRITERIA2 = UIKEY_FOR.map(([key2, uiKey]) => {
|
|
3659
|
+
const c = GRADED_CRITERIA.find((rc) => rc.key === key2);
|
|
3660
|
+
if (!c || !c.rungs?.length) throw new Error(`repo rubric (lib/agents/coding/criteria.ts) no longer defines graded criterion "${key2}" with rungs`);
|
|
3639
3661
|
return { key: c.key, uiKey, label: c.label, definition: c.definition, read: c.read, rungs: c.rungs };
|
|
3640
3662
|
});
|
|
3641
3663
|
var RUBRIC_FINGERPRINT2 = rubricFingerprint(GRADED_CRITERIA2);
|
|
@@ -3829,15 +3851,15 @@ function validate(raw) {
|
|
|
3829
3851
|
for (const r of arr) {
|
|
3830
3852
|
if (!r || typeof r !== "object") continue;
|
|
3831
3853
|
const o = r;
|
|
3832
|
-
const
|
|
3833
|
-
if (!keys.has(
|
|
3834
|
-
seen.add(
|
|
3854
|
+
const key2 = String(o.key ?? "");
|
|
3855
|
+
if (!keys.has(key2) || seen.has(key2)) continue;
|
|
3856
|
+
seen.add(key2);
|
|
3835
3857
|
const num3 = (v) => {
|
|
3836
3858
|
const n = typeof v === "number" ? v : typeof v === "string" ? Number(v) : NaN;
|
|
3837
3859
|
return Number.isFinite(n) && n >= 1 && n <= 11 ? Math.round(n * 100) / 100 : null;
|
|
3838
3860
|
};
|
|
3839
3861
|
out.push({
|
|
3840
|
-
key,
|
|
3862
|
+
key: key2,
|
|
3841
3863
|
score: num3(o.score),
|
|
3842
3864
|
confidence: String(o.confidence ?? "firm"),
|
|
3843
3865
|
low: num3(o.low),
|
|
@@ -3997,14 +4019,14 @@ function buildShareSections(p) {
|
|
|
3997
4019
|
const w = p.workstyle;
|
|
3998
4020
|
if (w) s.workstyle = { daysObserved: w.daysObserved, activeHours: w.activeHours, flowPct: agg?.flow?.flow?.pctOfWorkDay ?? null, flowHoursPerDay: w.flowHoursPerDay, peakHours: w.peakHours };
|
|
3999
4021
|
if (p.projects) s.snapshot = p.projects;
|
|
4000
|
-
const grade = (
|
|
4001
|
-
const c = (p.criteria ?? []).find((x) => x.key ===
|
|
4022
|
+
const grade = (key2) => {
|
|
4023
|
+
const c = (p.criteria ?? []).find((x) => x.key === key2);
|
|
4002
4024
|
if (!c) return void 0;
|
|
4003
4025
|
const scores = (c.takes ?? []).map((t) => t.score ?? t.best).filter((x) => x != null).sort((a, b) => b - a);
|
|
4004
4026
|
return scores.length ? { score: scores[Math.min(3, scores.length) - 1], sessions: scores.length } : void 0;
|
|
4005
4027
|
};
|
|
4006
|
-
for (const [
|
|
4007
|
-
const g = grade(
|
|
4028
|
+
for (const [key2, out] of [["abstraction", "abstraction"], ["taste", "taste"], ["delegation", "delegation"]]) {
|
|
4029
|
+
const g = grade(key2 === "abstraction" ? "generative" : key2);
|
|
4008
4030
|
if (g) s[out] = g;
|
|
4009
4031
|
}
|
|
4010
4032
|
return s;
|
|
@@ -4026,8 +4048,8 @@ var DEFAULT_SUPABASE_URL = "https://zcbonfjgiorrxczyekxl.supabase.co";
|
|
|
4026
4048
|
var DEFAULT_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InpjYm9uZmpnaW9ycnhjenlla3hsIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODA3MDI5MDIsImV4cCI6MjA5NjI3ODkwMn0.f2KAwstDU765i-sUucKuzA-j0xMsKRKHVHXPRNFoud4";
|
|
4027
4049
|
function centralConfig() {
|
|
4028
4050
|
const url = process.env.PS_SUPABASE_URL ?? DEFAULT_SUPABASE_URL;
|
|
4029
|
-
const
|
|
4030
|
-
return { supabaseUrl: url, supabaseAnonKey:
|
|
4051
|
+
const key2 = process.env.PS_SUPABASE_ANON_KEY ?? DEFAULT_SUPABASE_ANON_KEY;
|
|
4052
|
+
return { supabaseUrl: url, supabaseAnonKey: key2, configured: Boolean(url && key2) };
|
|
4031
4053
|
}
|
|
4032
4054
|
|
|
4033
4055
|
// src/auth.ts
|
|
@@ -5317,8 +5339,8 @@ function splitLines(buffer, chunk) {
|
|
|
5317
5339
|
}
|
|
5318
5340
|
function extractResponseHeaders(response) {
|
|
5319
5341
|
const headers = {};
|
|
5320
|
-
response.headers.forEach((value,
|
|
5321
|
-
headers[
|
|
5342
|
+
response.headers.forEach((value, key2) => {
|
|
5343
|
+
headers[key2] = value;
|
|
5322
5344
|
});
|
|
5323
5345
|
return headers;
|
|
5324
5346
|
}
|
|
@@ -5843,19 +5865,19 @@ var getRefs = (options) => {
|
|
|
5843
5865
|
};
|
|
5844
5866
|
|
|
5845
5867
|
// ../../node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
5846
|
-
function addErrorMessage(res,
|
|
5868
|
+
function addErrorMessage(res, key2, errorMessage, refs) {
|
|
5847
5869
|
if (!refs?.errorMessages)
|
|
5848
5870
|
return;
|
|
5849
5871
|
if (errorMessage) {
|
|
5850
5872
|
res.errorMessage = {
|
|
5851
5873
|
...res.errorMessage,
|
|
5852
|
-
[
|
|
5874
|
+
[key2]: errorMessage
|
|
5853
5875
|
};
|
|
5854
5876
|
}
|
|
5855
5877
|
}
|
|
5856
|
-
function setResponseValueAndErrors(res,
|
|
5857
|
-
res[
|
|
5858
|
-
addErrorMessage(res,
|
|
5878
|
+
function setResponseValueAndErrors(res, key2, value, errorMessage, refs) {
|
|
5879
|
+
res[key2] = value;
|
|
5880
|
+
addErrorMessage(res, key2, errorMessage, refs);
|
|
5859
5881
|
}
|
|
5860
5882
|
|
|
5861
5883
|
// ../../node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
@@ -6014,9 +6036,9 @@ var util;
|
|
|
6014
6036
|
};
|
|
6015
6037
|
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object2) => {
|
|
6016
6038
|
const keys = [];
|
|
6017
|
-
for (const
|
|
6018
|
-
if (Object.prototype.hasOwnProperty.call(object2,
|
|
6019
|
-
keys.push(
|
|
6039
|
+
for (const key2 in object2) {
|
|
6040
|
+
if (Object.prototype.hasOwnProperty.call(object2, key2)) {
|
|
6041
|
+
keys.push(key2);
|
|
6020
6042
|
}
|
|
6021
6043
|
}
|
|
6022
6044
|
return keys;
|
|
@@ -6416,10 +6438,10 @@ var ParseStatus = class _ParseStatus {
|
|
|
6416
6438
|
static async mergeObjectAsync(status, pairs) {
|
|
6417
6439
|
const syncPairs = [];
|
|
6418
6440
|
for (const pair of pairs) {
|
|
6419
|
-
const
|
|
6441
|
+
const key2 = await pair.key;
|
|
6420
6442
|
const value = await pair.value;
|
|
6421
6443
|
syncPairs.push({
|
|
6422
|
-
key,
|
|
6444
|
+
key: key2,
|
|
6423
6445
|
value
|
|
6424
6446
|
});
|
|
6425
6447
|
}
|
|
@@ -6428,17 +6450,17 @@ var ParseStatus = class _ParseStatus {
|
|
|
6428
6450
|
static mergeObjectSync(status, pairs) {
|
|
6429
6451
|
const finalObject = {};
|
|
6430
6452
|
for (const pair of pairs) {
|
|
6431
|
-
const { key, value } = pair;
|
|
6432
|
-
if (
|
|
6453
|
+
const { key: key2, value } = pair;
|
|
6454
|
+
if (key2.status === "aborted")
|
|
6433
6455
|
return INVALID;
|
|
6434
6456
|
if (value.status === "aborted")
|
|
6435
6457
|
return INVALID;
|
|
6436
|
-
if (
|
|
6458
|
+
if (key2.status === "dirty")
|
|
6437
6459
|
status.dirty();
|
|
6438
6460
|
if (value.status === "dirty")
|
|
6439
6461
|
status.dirty();
|
|
6440
|
-
if (
|
|
6441
|
-
finalObject[
|
|
6462
|
+
if (key2.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
6463
|
+
finalObject[key2.value] = value.value;
|
|
6442
6464
|
}
|
|
6443
6465
|
}
|
|
6444
6466
|
return { status: status.value, value: finalObject };
|
|
@@ -6463,12 +6485,12 @@ var errorUtil;
|
|
|
6463
6485
|
|
|
6464
6486
|
// ../../node_modules/zod/v3/types.js
|
|
6465
6487
|
var ParseInputLazyPath = class {
|
|
6466
|
-
constructor(parent, value, path42,
|
|
6488
|
+
constructor(parent, value, path42, key2) {
|
|
6467
6489
|
this._cachedPath = [];
|
|
6468
6490
|
this.parent = parent;
|
|
6469
6491
|
this.data = value;
|
|
6470
6492
|
this._path = path42;
|
|
6471
|
-
this._key =
|
|
6493
|
+
this._key = key2;
|
|
6472
6494
|
}
|
|
6473
6495
|
get path() {
|
|
6474
6496
|
if (!this._cachedPath.length) {
|
|
@@ -8213,9 +8235,9 @@ ZodArray.create = (schema, params) => {
|
|
|
8213
8235
|
function deepPartialify(schema) {
|
|
8214
8236
|
if (schema instanceof ZodObject) {
|
|
8215
8237
|
const newShape = {};
|
|
8216
|
-
for (const
|
|
8217
|
-
const fieldSchema = schema.shape[
|
|
8218
|
-
newShape[
|
|
8238
|
+
for (const key2 in schema.shape) {
|
|
8239
|
+
const fieldSchema = schema.shape[key2];
|
|
8240
|
+
newShape[key2] = ZodOptional.create(deepPartialify(fieldSchema));
|
|
8219
8241
|
}
|
|
8220
8242
|
return new ZodObject({
|
|
8221
8243
|
...schema._def,
|
|
@@ -8266,29 +8288,29 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8266
8288
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
8267
8289
|
const extraKeys = [];
|
|
8268
8290
|
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
8269
|
-
for (const
|
|
8270
|
-
if (!shapeKeys.includes(
|
|
8271
|
-
extraKeys.push(
|
|
8291
|
+
for (const key2 in ctx.data) {
|
|
8292
|
+
if (!shapeKeys.includes(key2)) {
|
|
8293
|
+
extraKeys.push(key2);
|
|
8272
8294
|
}
|
|
8273
8295
|
}
|
|
8274
8296
|
}
|
|
8275
8297
|
const pairs = [];
|
|
8276
|
-
for (const
|
|
8277
|
-
const keyValidator = shape[
|
|
8278
|
-
const value = ctx.data[
|
|
8298
|
+
for (const key2 of shapeKeys) {
|
|
8299
|
+
const keyValidator = shape[key2];
|
|
8300
|
+
const value = ctx.data[key2];
|
|
8279
8301
|
pairs.push({
|
|
8280
|
-
key: { status: "valid", value:
|
|
8281
|
-
value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path,
|
|
8282
|
-
alwaysSet:
|
|
8302
|
+
key: { status: "valid", value: key2 },
|
|
8303
|
+
value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key2)),
|
|
8304
|
+
alwaysSet: key2 in ctx.data
|
|
8283
8305
|
});
|
|
8284
8306
|
}
|
|
8285
8307
|
if (this._def.catchall instanceof ZodNever) {
|
|
8286
8308
|
const unknownKeys = this._def.unknownKeys;
|
|
8287
8309
|
if (unknownKeys === "passthrough") {
|
|
8288
|
-
for (const
|
|
8310
|
+
for (const key2 of extraKeys) {
|
|
8289
8311
|
pairs.push({
|
|
8290
|
-
key: { status: "valid", value:
|
|
8291
|
-
value: { status: "valid", value: ctx.data[
|
|
8312
|
+
key: { status: "valid", value: key2 },
|
|
8313
|
+
value: { status: "valid", value: ctx.data[key2] }
|
|
8292
8314
|
});
|
|
8293
8315
|
}
|
|
8294
8316
|
} else if (unknownKeys === "strict") {
|
|
@@ -8305,15 +8327,15 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8305
8327
|
}
|
|
8306
8328
|
} else {
|
|
8307
8329
|
const catchall = this._def.catchall;
|
|
8308
|
-
for (const
|
|
8309
|
-
const value = ctx.data[
|
|
8330
|
+
for (const key2 of extraKeys) {
|
|
8331
|
+
const value = ctx.data[key2];
|
|
8310
8332
|
pairs.push({
|
|
8311
|
-
key: { status: "valid", value:
|
|
8333
|
+
key: { status: "valid", value: key2 },
|
|
8312
8334
|
value: catchall._parse(
|
|
8313
|
-
new ParseInputLazyPath(ctx, value, ctx.path,
|
|
8335
|
+
new ParseInputLazyPath(ctx, value, ctx.path, key2)
|
|
8314
8336
|
//, ctx.child(key), value, getParsedType(value)
|
|
8315
8337
|
),
|
|
8316
|
-
alwaysSet:
|
|
8338
|
+
alwaysSet: key2 in ctx.data
|
|
8317
8339
|
});
|
|
8318
8340
|
}
|
|
8319
8341
|
}
|
|
@@ -8321,10 +8343,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8321
8343
|
return Promise.resolve().then(async () => {
|
|
8322
8344
|
const syncPairs = [];
|
|
8323
8345
|
for (const pair of pairs) {
|
|
8324
|
-
const
|
|
8346
|
+
const key2 = await pair.key;
|
|
8325
8347
|
const value = await pair.value;
|
|
8326
8348
|
syncPairs.push({
|
|
8327
|
-
key,
|
|
8349
|
+
key: key2,
|
|
8328
8350
|
value,
|
|
8329
8351
|
alwaysSet: pair.alwaysSet
|
|
8330
8352
|
});
|
|
@@ -8449,8 +8471,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8449
8471
|
// }) as any;
|
|
8450
8472
|
// return merged;
|
|
8451
8473
|
// }
|
|
8452
|
-
setKey(
|
|
8453
|
-
return this.augment({ [
|
|
8474
|
+
setKey(key2, schema) {
|
|
8475
|
+
return this.augment({ [key2]: schema });
|
|
8454
8476
|
}
|
|
8455
8477
|
// merge<Incoming extends AnyZodObject>(
|
|
8456
8478
|
// merging: Incoming
|
|
@@ -8481,9 +8503,9 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8481
8503
|
}
|
|
8482
8504
|
pick(mask) {
|
|
8483
8505
|
const shape = {};
|
|
8484
|
-
for (const
|
|
8485
|
-
if (mask[
|
|
8486
|
-
shape[
|
|
8506
|
+
for (const key2 of util.objectKeys(mask)) {
|
|
8507
|
+
if (mask[key2] && this.shape[key2]) {
|
|
8508
|
+
shape[key2] = this.shape[key2];
|
|
8487
8509
|
}
|
|
8488
8510
|
}
|
|
8489
8511
|
return new _ZodObject({
|
|
@@ -8493,9 +8515,9 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8493
8515
|
}
|
|
8494
8516
|
omit(mask) {
|
|
8495
8517
|
const shape = {};
|
|
8496
|
-
for (const
|
|
8497
|
-
if (!mask[
|
|
8498
|
-
shape[
|
|
8518
|
+
for (const key2 of util.objectKeys(this.shape)) {
|
|
8519
|
+
if (!mask[key2]) {
|
|
8520
|
+
shape[key2] = this.shape[key2];
|
|
8499
8521
|
}
|
|
8500
8522
|
}
|
|
8501
8523
|
return new _ZodObject({
|
|
@@ -8511,12 +8533,12 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8511
8533
|
}
|
|
8512
8534
|
partial(mask) {
|
|
8513
8535
|
const newShape = {};
|
|
8514
|
-
for (const
|
|
8515
|
-
const fieldSchema = this.shape[
|
|
8516
|
-
if (mask && !mask[
|
|
8517
|
-
newShape[
|
|
8536
|
+
for (const key2 of util.objectKeys(this.shape)) {
|
|
8537
|
+
const fieldSchema = this.shape[key2];
|
|
8538
|
+
if (mask && !mask[key2]) {
|
|
8539
|
+
newShape[key2] = fieldSchema;
|
|
8518
8540
|
} else {
|
|
8519
|
-
newShape[
|
|
8541
|
+
newShape[key2] = fieldSchema.optional();
|
|
8520
8542
|
}
|
|
8521
8543
|
}
|
|
8522
8544
|
return new _ZodObject({
|
|
@@ -8526,16 +8548,16 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
8526
8548
|
}
|
|
8527
8549
|
required(mask) {
|
|
8528
8550
|
const newShape = {};
|
|
8529
|
-
for (const
|
|
8530
|
-
if (mask && !mask[
|
|
8531
|
-
newShape[
|
|
8551
|
+
for (const key2 of util.objectKeys(this.shape)) {
|
|
8552
|
+
if (mask && !mask[key2]) {
|
|
8553
|
+
newShape[key2] = this.shape[key2];
|
|
8532
8554
|
} else {
|
|
8533
|
-
const fieldSchema = this.shape[
|
|
8555
|
+
const fieldSchema = this.shape[key2];
|
|
8534
8556
|
let newField = fieldSchema;
|
|
8535
8557
|
while (newField instanceof ZodOptional) {
|
|
8536
8558
|
newField = newField._def.innerType;
|
|
8537
8559
|
}
|
|
8538
|
-
newShape[
|
|
8560
|
+
newShape[key2] = newField;
|
|
8539
8561
|
}
|
|
8540
8562
|
}
|
|
8541
8563
|
return new _ZodObject({
|
|
@@ -8779,14 +8801,14 @@ function mergeValues(a, b) {
|
|
|
8779
8801
|
return { valid: true, data: a };
|
|
8780
8802
|
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
8781
8803
|
const bKeys = util.objectKeys(b);
|
|
8782
|
-
const sharedKeys = util.objectKeys(a).filter((
|
|
8804
|
+
const sharedKeys = util.objectKeys(a).filter((key2) => bKeys.indexOf(key2) !== -1);
|
|
8783
8805
|
const newObj = { ...a, ...b };
|
|
8784
|
-
for (const
|
|
8785
|
-
const sharedValue = mergeValues(a[
|
|
8806
|
+
for (const key2 of sharedKeys) {
|
|
8807
|
+
const sharedValue = mergeValues(a[key2], b[key2]);
|
|
8786
8808
|
if (!sharedValue.valid) {
|
|
8787
8809
|
return { valid: false };
|
|
8788
8810
|
}
|
|
8789
|
-
newObj[
|
|
8811
|
+
newObj[key2] = sharedValue.data;
|
|
8790
8812
|
}
|
|
8791
8813
|
return { valid: true, data: newObj };
|
|
8792
8814
|
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
@@ -8950,11 +8972,11 @@ var ZodRecord = class _ZodRecord extends ZodType {
|
|
|
8950
8972
|
const pairs = [];
|
|
8951
8973
|
const keyType = this._def.keyType;
|
|
8952
8974
|
const valueType = this._def.valueType;
|
|
8953
|
-
for (const
|
|
8975
|
+
for (const key2 in ctx.data) {
|
|
8954
8976
|
pairs.push({
|
|
8955
|
-
key: keyType._parse(new ParseInputLazyPath(ctx,
|
|
8956
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[
|
|
8957
|
-
alwaysSet:
|
|
8977
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key2, ctx.path, key2)),
|
|
8978
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key2], ctx.path, key2)),
|
|
8979
|
+
alwaysSet: key2 in ctx.data
|
|
8958
8980
|
});
|
|
8959
8981
|
}
|
|
8960
8982
|
if (ctx.common.async) {
|
|
@@ -9002,9 +9024,9 @@ var ZodMap = class extends ZodType {
|
|
|
9002
9024
|
}
|
|
9003
9025
|
const keyType = this._def.keyType;
|
|
9004
9026
|
const valueType = this._def.valueType;
|
|
9005
|
-
const pairs = [...ctx.data.entries()].map(([
|
|
9027
|
+
const pairs = [...ctx.data.entries()].map(([key2, value], index) => {
|
|
9006
9028
|
return {
|
|
9007
|
-
key: keyType._parse(new ParseInputLazyPath(ctx,
|
|
9029
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key2, ctx.path, [index, "key"])),
|
|
9008
9030
|
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
|
|
9009
9031
|
};
|
|
9010
9032
|
});
|
|
@@ -9012,30 +9034,30 @@ var ZodMap = class extends ZodType {
|
|
|
9012
9034
|
const finalMap = /* @__PURE__ */ new Map();
|
|
9013
9035
|
return Promise.resolve().then(async () => {
|
|
9014
9036
|
for (const pair of pairs) {
|
|
9015
|
-
const
|
|
9037
|
+
const key2 = await pair.key;
|
|
9016
9038
|
const value = await pair.value;
|
|
9017
|
-
if (
|
|
9039
|
+
if (key2.status === "aborted" || value.status === "aborted") {
|
|
9018
9040
|
return INVALID;
|
|
9019
9041
|
}
|
|
9020
|
-
if (
|
|
9042
|
+
if (key2.status === "dirty" || value.status === "dirty") {
|
|
9021
9043
|
status.dirty();
|
|
9022
9044
|
}
|
|
9023
|
-
finalMap.set(
|
|
9045
|
+
finalMap.set(key2.value, value.value);
|
|
9024
9046
|
}
|
|
9025
9047
|
return { status: status.value, value: finalMap };
|
|
9026
9048
|
});
|
|
9027
9049
|
} else {
|
|
9028
9050
|
const finalMap = /* @__PURE__ */ new Map();
|
|
9029
9051
|
for (const pair of pairs) {
|
|
9030
|
-
const
|
|
9052
|
+
const key2 = pair.key;
|
|
9031
9053
|
const value = pair.value;
|
|
9032
|
-
if (
|
|
9054
|
+
if (key2.status === "aborted" || value.status === "aborted") {
|
|
9033
9055
|
return INVALID;
|
|
9034
9056
|
}
|
|
9035
|
-
if (
|
|
9057
|
+
if (key2.status === "dirty" || value.status === "dirty") {
|
|
9036
9058
|
status.dirty();
|
|
9037
9059
|
}
|
|
9038
|
-
finalMap.set(
|
|
9060
|
+
finalMap.set(key2.value, value.value);
|
|
9039
9061
|
}
|
|
9040
9062
|
return { status: status.value, value: finalMap };
|
|
9041
9063
|
}
|
|
@@ -10488,11 +10510,11 @@ function parseRecordDef(def, refs) {
|
|
|
10488
10510
|
return {
|
|
10489
10511
|
type: "object",
|
|
10490
10512
|
required: def.keyType._def.values,
|
|
10491
|
-
properties: def.keyType._def.values.reduce((acc,
|
|
10513
|
+
properties: def.keyType._def.values.reduce((acc, key2) => ({
|
|
10492
10514
|
...acc,
|
|
10493
|
-
[
|
|
10515
|
+
[key2]: parseDef(def.valueType._def, {
|
|
10494
10516
|
...refs,
|
|
10495
|
-
currentPath: [...refs.currentPath, "properties",
|
|
10517
|
+
currentPath: [...refs.currentPath, "properties", key2]
|
|
10496
10518
|
}) ?? parseAnyDef(refs)
|
|
10497
10519
|
}), {}),
|
|
10498
10520
|
additionalProperties: refs.rejectedAdditionalProperties
|
|
@@ -10559,10 +10581,10 @@ function parseMapDef(def, refs) {
|
|
|
10559
10581
|
// ../../node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
10560
10582
|
function parseNativeEnumDef(def) {
|
|
10561
10583
|
const object2 = def.values;
|
|
10562
|
-
const actualKeys = Object.keys(def.values).filter((
|
|
10563
|
-
return typeof object2[object2[
|
|
10584
|
+
const actualKeys = Object.keys(def.values).filter((key2) => {
|
|
10585
|
+
return typeof object2[object2[key2]] !== "number";
|
|
10564
10586
|
});
|
|
10565
|
-
const actualValues = actualKeys.map((
|
|
10587
|
+
const actualValues = actualKeys.map((key2) => object2[key2]);
|
|
10566
10588
|
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
10567
10589
|
return {
|
|
10568
10590
|
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
@@ -12175,17 +12197,17 @@ var BaseContext = (
|
|
|
12175
12197
|
function BaseContext2(parentContext) {
|
|
12176
12198
|
var self = this;
|
|
12177
12199
|
self._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
12178
|
-
self.getValue = function(
|
|
12179
|
-
return self._currentContext.get(
|
|
12200
|
+
self.getValue = function(key2) {
|
|
12201
|
+
return self._currentContext.get(key2);
|
|
12180
12202
|
};
|
|
12181
|
-
self.setValue = function(
|
|
12203
|
+
self.setValue = function(key2, value) {
|
|
12182
12204
|
var context = new BaseContext2(self._currentContext);
|
|
12183
|
-
context._currentContext.set(
|
|
12205
|
+
context._currentContext.set(key2, value);
|
|
12184
12206
|
return context;
|
|
12185
12207
|
};
|
|
12186
|
-
self.deleteValue = function(
|
|
12208
|
+
self.deleteValue = function(key2) {
|
|
12187
12209
|
var context = new BaseContext2(self._currentContext);
|
|
12188
|
-
context._currentContext.delete(
|
|
12210
|
+
context._currentContext.delete(key2);
|
|
12189
12211
|
return context;
|
|
12190
12212
|
};
|
|
12191
12213
|
}
|
|
@@ -12763,22 +12785,22 @@ function getBaseTelemetryAttributes({
|
|
|
12763
12785
|
"ai.model.provider": model.provider,
|
|
12764
12786
|
"ai.model.id": model.modelId,
|
|
12765
12787
|
// settings:
|
|
12766
|
-
...Object.entries(settings).reduce((attributes, [
|
|
12767
|
-
attributes[`ai.settings.${
|
|
12788
|
+
...Object.entries(settings).reduce((attributes, [key2, value]) => {
|
|
12789
|
+
attributes[`ai.settings.${key2}`] = value;
|
|
12768
12790
|
return attributes;
|
|
12769
12791
|
}, {}),
|
|
12770
12792
|
// add metadata as attributes:
|
|
12771
12793
|
...Object.entries((_a17 = telemetry == null ? void 0 : telemetry.metadata) != null ? _a17 : {}).reduce(
|
|
12772
|
-
(attributes, [
|
|
12773
|
-
attributes[`ai.telemetry.metadata.${
|
|
12794
|
+
(attributes, [key2, value]) => {
|
|
12795
|
+
attributes[`ai.telemetry.metadata.${key2}`] = value;
|
|
12774
12796
|
return attributes;
|
|
12775
12797
|
},
|
|
12776
12798
|
{}
|
|
12777
12799
|
),
|
|
12778
12800
|
// request headers
|
|
12779
|
-
...Object.entries(headers != null ? headers : {}).reduce((attributes, [
|
|
12801
|
+
...Object.entries(headers != null ? headers : {}).reduce((attributes, [key2, value]) => {
|
|
12780
12802
|
if (value !== void 0) {
|
|
12781
|
-
attributes[`ai.request.headers.${
|
|
12803
|
+
attributes[`ai.request.headers.${key2}`] = value;
|
|
12782
12804
|
}
|
|
12783
12805
|
return attributes;
|
|
12784
12806
|
}, {})
|
|
@@ -12898,7 +12920,7 @@ function selectTelemetryAttributes({
|
|
|
12898
12920
|
if ((telemetry == null ? void 0 : telemetry.isEnabled) !== true) {
|
|
12899
12921
|
return {};
|
|
12900
12922
|
}
|
|
12901
|
-
return Object.entries(attributes).reduce((attributes2, [
|
|
12923
|
+
return Object.entries(attributes).reduce((attributes2, [key2, value]) => {
|
|
12902
12924
|
if (value === void 0) {
|
|
12903
12925
|
return attributes2;
|
|
12904
12926
|
}
|
|
@@ -12907,16 +12929,16 @@ function selectTelemetryAttributes({
|
|
|
12907
12929
|
return attributes2;
|
|
12908
12930
|
}
|
|
12909
12931
|
const result = value.input();
|
|
12910
|
-
return result === void 0 ? attributes2 : { ...attributes2, [
|
|
12932
|
+
return result === void 0 ? attributes2 : { ...attributes2, [key2]: result };
|
|
12911
12933
|
}
|
|
12912
12934
|
if (typeof value === "object" && "output" in value && typeof value.output === "function") {
|
|
12913
12935
|
if ((telemetry == null ? void 0 : telemetry.recordOutputs) === false) {
|
|
12914
12936
|
return attributes2;
|
|
12915
12937
|
}
|
|
12916
12938
|
const result = value.output();
|
|
12917
|
-
return result === void 0 ? attributes2 : { ...attributes2, [
|
|
12939
|
+
return result === void 0 ? attributes2 : { ...attributes2, [key2]: result };
|
|
12918
12940
|
}
|
|
12919
|
-
return { ...attributes2, [
|
|
12941
|
+
return { ...attributes2, [key2]: value };
|
|
12920
12942
|
}, {});
|
|
12921
12943
|
}
|
|
12922
12944
|
var name32 = "AI_NoImageGeneratedError";
|
|
@@ -18214,10 +18236,10 @@ var OpenAITranscriptionModel = class {
|
|
|
18214
18236
|
temperature: (_d = openAIOptions.temperature) != null ? _d : void 0,
|
|
18215
18237
|
timestamp_granularities: (_e = openAIOptions.timestampGranularities) != null ? _e : void 0
|
|
18216
18238
|
};
|
|
18217
|
-
for (const
|
|
18218
|
-
const value = transcriptionModelOptions[
|
|
18239
|
+
for (const key2 in transcriptionModelOptions) {
|
|
18240
|
+
const value = transcriptionModelOptions[key2];
|
|
18219
18241
|
if (value !== void 0) {
|
|
18220
|
-
formData.append(
|
|
18242
|
+
formData.append(key2, String(value));
|
|
18221
18243
|
}
|
|
18222
18244
|
}
|
|
18223
18245
|
}
|
|
@@ -19190,10 +19212,10 @@ var OpenAISpeechModel = class {
|
|
|
19190
19212
|
}
|
|
19191
19213
|
if (openAIOptions) {
|
|
19192
19214
|
const speechModelOptions = {};
|
|
19193
|
-
for (const
|
|
19194
|
-
const value = speechModelOptions[
|
|
19215
|
+
for (const key2 in speechModelOptions) {
|
|
19216
|
+
const value = speechModelOptions[key2];
|
|
19195
19217
|
if (value !== void 0) {
|
|
19196
|
-
requestBody[
|
|
19218
|
+
requestBody[key2] = value;
|
|
19197
19219
|
}
|
|
19198
19220
|
}
|
|
19199
19221
|
}
|
|
@@ -21551,28 +21573,28 @@ function runDiagnostic(input) {
|
|
|
21551
21573
|
var REG = globalThis.__polymathDiagJobs ??= /* @__PURE__ */ new Map();
|
|
21552
21574
|
var MAX_ATTEMPTS = 3;
|
|
21553
21575
|
var BACKOFF_MS = 3e4;
|
|
21554
|
-
async function runWithRetries(
|
|
21576
|
+
async function runWithRetries(key2, input) {
|
|
21555
21577
|
let last;
|
|
21556
21578
|
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
21557
21579
|
try {
|
|
21558
21580
|
return await runDiagnostic(input);
|
|
21559
21581
|
} catch (e) {
|
|
21560
21582
|
last = e;
|
|
21561
|
-
console.warn(`[feedback/diagnostic] ${
|
|
21583
|
+
console.warn(`[feedback/diagnostic] ${key2}: attempt ${attempt}/${MAX_ATTEMPTS} failed \u2014 ${String(e?.message || e).slice(0, 160)}`);
|
|
21562
21584
|
if (attempt < MAX_ATTEMPTS) await new Promise((r) => setTimeout(r, BACKOFF_MS * attempt));
|
|
21563
21585
|
}
|
|
21564
21586
|
}
|
|
21565
21587
|
throw last;
|
|
21566
21588
|
}
|
|
21567
|
-
function startDiagnosticJob(
|
|
21568
|
-
const cur = REG.get(
|
|
21589
|
+
function startDiagnosticJob(key2, input) {
|
|
21590
|
+
const cur = REG.get(key2);
|
|
21569
21591
|
if (cur && cur.status === "running") return cur;
|
|
21570
21592
|
const rec = { status: "running", startedAt: Date.now() };
|
|
21571
|
-
REG.set(
|
|
21572
|
-
runWithRetries(
|
|
21593
|
+
REG.set(key2, rec);
|
|
21594
|
+
runWithRetries(key2, input).then(async (result) => {
|
|
21573
21595
|
rec.status = "done";
|
|
21574
21596
|
rec.result = result;
|
|
21575
|
-
await mergeIntoStateFile(
|
|
21597
|
+
await mergeIntoStateFile(key2, result).catch(() => {
|
|
21576
21598
|
});
|
|
21577
21599
|
}).catch((e) => {
|
|
21578
21600
|
rec.status = "failed";
|
|
@@ -21580,14 +21602,14 @@ function startDiagnosticJob(key, input) {
|
|
|
21580
21602
|
});
|
|
21581
21603
|
return rec;
|
|
21582
21604
|
}
|
|
21583
|
-
function diagnosticJobStatus(
|
|
21584
|
-
return REG.get(
|
|
21605
|
+
function diagnosticJobStatus(key2) {
|
|
21606
|
+
return REG.get(key2) ?? null;
|
|
21585
21607
|
}
|
|
21586
|
-
async function mergeIntoStateFile(
|
|
21608
|
+
async function mergeIntoStateFile(key2, diagnostic) {
|
|
21587
21609
|
const FILE = path18.join(process.env.POLYMATH_DATA_DIR || path18.join(process.cwd(), ".data"), "engine-pilot", "feedback-jobs.json");
|
|
21588
21610
|
const s = await fs13.readFile(FILE, "utf8").then(JSON.parse).catch(() => ({ version: 1, jobs: {} }));
|
|
21589
21611
|
const jobs = s.jobs || {};
|
|
21590
|
-
const j = jobs[
|
|
21612
|
+
const j = jobs[key2];
|
|
21591
21613
|
if (!j) return;
|
|
21592
21614
|
j.draft = j.draft || {};
|
|
21593
21615
|
j.draft.evidence = { ...j.draft.evidence || {}, diagnostic };
|
|
@@ -21623,17 +21645,17 @@ async function readJobs(dataDir) {
|
|
|
21623
21645
|
async function handleState(dataDir, method, body) {
|
|
21624
21646
|
const s = await readJobs(dataDir);
|
|
21625
21647
|
if (method === "GET") return { status: 200, json: { jobs: s.jobs || {} } };
|
|
21626
|
-
const
|
|
21627
|
-
if (!
|
|
21648
|
+
const key2 = typeof body?.key === "string" ? body.key.slice(0, 120) : "";
|
|
21649
|
+
if (!key2) return { status: 400, json: { error: "missing key" } };
|
|
21628
21650
|
const jobs = s.jobs || {};
|
|
21629
|
-
if (body?.job == null) delete jobs[
|
|
21651
|
+
if (body?.job == null) delete jobs[key2];
|
|
21630
21652
|
else {
|
|
21631
21653
|
try {
|
|
21632
21654
|
if (JSON.stringify(body.job).length > 3e5) return { status: 413, json: { error: "job too large" } };
|
|
21633
21655
|
} catch {
|
|
21634
21656
|
return { status: 400, json: { error: "bad job" } };
|
|
21635
21657
|
}
|
|
21636
|
-
jobs[
|
|
21658
|
+
jobs[key2] = body.job;
|
|
21637
21659
|
}
|
|
21638
21660
|
await fs14.mkdir(dataDir, { recursive: true });
|
|
21639
21661
|
await fs14.writeFile(jobsFile(dataDir), JSON.stringify({ version: 1, jobs }, null, 2), "utf8");
|
|
@@ -21690,7 +21712,7 @@ async function handleSubmit(dataDir, body) {
|
|
|
21690
21712
|
console.error(` [feedback/submit] stored ${String(row.id)} (${sectionKey}) for ${auth.identity.email}`);
|
|
21691
21713
|
return { status: 200, json: { ok: true, verified: row } };
|
|
21692
21714
|
}
|
|
21693
|
-
function handleDiagnostic(method, body,
|
|
21715
|
+
function handleDiagnostic(method, body, key2) {
|
|
21694
21716
|
if (method === "POST") {
|
|
21695
21717
|
const b = body ?? {};
|
|
21696
21718
|
if (!(b.rawFeedback || "").trim()) return { status: 400, json: { error: "no feedback" } };
|
|
@@ -21701,7 +21723,7 @@ function handleDiagnostic(method, body, key) {
|
|
|
21701
21723
|
const job2 = startDiagnosticJob(k2, { reportKind, sectionLabel: b.sectionLabel, rawFeedback: b.rawFeedback, locus: b.locus, evidence: b.evidence });
|
|
21702
21724
|
return { status: 200, json: { status: job2.status, startedAt: job2.startedAt, ...job2.status === "done" ? { diagnostic: job2.result } : {} } };
|
|
21703
21725
|
}
|
|
21704
|
-
const k = (
|
|
21726
|
+
const k = (key2 || "").trim().slice(0, 120);
|
|
21705
21727
|
if (!k) return { status: 400, json: { error: "missing key" } };
|
|
21706
21728
|
const job = diagnosticJobStatus(k);
|
|
21707
21729
|
if (!job) return { status: 200, json: { status: "none" } };
|
|
@@ -21874,8 +21896,8 @@ async function buildCorpusDocs(importedDir, opts = {}) {
|
|
|
21874
21896
|
);
|
|
21875
21897
|
const bySession = /* @__PURE__ */ new Map();
|
|
21876
21898
|
for (const it of items) {
|
|
21877
|
-
const
|
|
21878
|
-
(bySession.get(
|
|
21899
|
+
const key2 = it.sessionId ?? `${source}:${it.timestamp.slice(0, 10)}`;
|
|
21900
|
+
(bySession.get(key2) ?? bySession.set(key2, []).get(key2)).push(it);
|
|
21879
21901
|
}
|
|
21880
21902
|
for (const [, session] of bySession) {
|
|
21881
21903
|
session.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
|
|
@@ -21973,14 +21995,14 @@ async function loadFacetTakes(lensKey, idx) {
|
|
|
21973
21995
|
if (!Array.isArray(facets2)) continue;
|
|
21974
21996
|
const meta = idx[id] || { title: "", date: "", source: "" };
|
|
21975
21997
|
for (const f of facets2) {
|
|
21976
|
-
const
|
|
21977
|
-
if (!
|
|
21998
|
+
const key2 = String(f.facetKey || "");
|
|
21999
|
+
if (!key2) continue;
|
|
21978
22000
|
const score = typeof f.score === "number" ? f.score : null;
|
|
21979
22001
|
const best = typeof f.bestEstimate === "number" ? f.bestEstimate : null;
|
|
21980
22002
|
if (score == null && best == null) continue;
|
|
21981
22003
|
const t = { id, title: meta.title || id, date: meta.date || "", source: meta.source || void 0, score, best, low: num2(f.low), high: num2(f.high), confidence: String(f.confidence || ""), gist: String(f.why || "").replace(/\s+/g, " ").trim().slice(0, 220) };
|
|
21982
|
-
if (!byFacet.has(
|
|
21983
|
-
byFacet.get(
|
|
22004
|
+
if (!byFacet.has(key2)) byFacet.set(key2, []);
|
|
22005
|
+
byFacet.get(key2).push(t);
|
|
21984
22006
|
}
|
|
21985
22007
|
}
|
|
21986
22008
|
return byFacet;
|
|
@@ -22019,8 +22041,8 @@ async function readGrowthAgent() {
|
|
|
22019
22041
|
return m ? { text: t.slice(0, m.index).trim(), docId: m[1] } : { text: t.trim(), docId: "" };
|
|
22020
22042
|
};
|
|
22021
22043
|
const facets2 = {};
|
|
22022
|
-
const setFacet = (
|
|
22023
|
-
if (
|
|
22044
|
+
const setFacet = (key2, f) => {
|
|
22045
|
+
if (key2) facets2[key2] = { score: num2(f.score), trajectory: String(f.trajectory || ""), rationale: g(f, "rationale", "reasoning") };
|
|
22024
22046
|
};
|
|
22025
22047
|
if (Array.isArray(raw.facets)) for (const f of raw.facets) setFacet(g(f, "key", "facetKey"), f);
|
|
22026
22048
|
else for (const [k, v] of Object.entries(raw.facets)) setFacet(k, v || {});
|
|
@@ -22043,10 +22065,10 @@ async function compilePerson() {
|
|
|
22043
22065
|
const idx = await loadIndex();
|
|
22044
22066
|
const m = (id) => ({ id, title: idx[id]?.title || id, date: idx[id]?.date || "", source: idx[id]?.source || void 0 });
|
|
22045
22067
|
const out = [];
|
|
22046
|
-
for (const [
|
|
22047
|
-
const person = await fs16.readFile(path21.join(GRADES,
|
|
22048
|
-
const growth =
|
|
22049
|
-
const byFacet = await loadFacetTakes(
|
|
22068
|
+
for (const [key2, lens] of PERSON_LENSES) {
|
|
22069
|
+
const person = await fs16.readFile(path21.join(GRADES, key2, "_person.json"), "utf8").then(JSON.parse).catch(() => null);
|
|
22070
|
+
const growth = key2 === "growth" ? await readGrowthAgent() : null;
|
|
22071
|
+
const byFacet = await loadFacetTakes(key2, idx);
|
|
22050
22072
|
const pf = (k) => (person?.facets || []).find((x) => String(x.facetKey) === k) || null;
|
|
22051
22073
|
const facets2 = lens.facets.map((f) => {
|
|
22052
22074
|
const g = pf(f.key);
|
|
@@ -22084,7 +22106,7 @@ async function compilePerson() {
|
|
|
22084
22106
|
} : null;
|
|
22085
22107
|
return { facetKey: f.key, name: f.name, definition: f.definition, scaleMax, grade, dist: distOf2(takes), takes };
|
|
22086
22108
|
});
|
|
22087
|
-
out.push({ key, label: lens.label, overall: String(person?.overall || ""), facets: facets2, present: !!person, ...growth ? { growthAxes: growth.axes } : {} });
|
|
22109
|
+
out.push({ key: key2, label: lens.label, overall: String(person?.overall || ""), facets: facets2, present: !!person, ...growth ? { growthAxes: growth.axes } : {} });
|
|
22088
22110
|
}
|
|
22089
22111
|
return out;
|
|
22090
22112
|
}
|
|
@@ -22101,10 +22123,10 @@ async function gradeDetail(docId2, lensKey) {
|
|
|
22101
22123
|
title: meta.title || docId2,
|
|
22102
22124
|
date: meta.date || "",
|
|
22103
22125
|
facets: facets2.map((f) => {
|
|
22104
|
-
const
|
|
22126
|
+
const key2 = String(f.facetKey || "");
|
|
22105
22127
|
return {
|
|
22106
|
-
facetKey:
|
|
22107
|
-
name: FNAME[
|
|
22128
|
+
facetKey: key2,
|
|
22129
|
+
name: FNAME[key2] || key2,
|
|
22108
22130
|
score: num2(f.score),
|
|
22109
22131
|
confidence: String(f.confidence || ""),
|
|
22110
22132
|
low: num2(f.low),
|
|
@@ -22114,7 +22136,7 @@ async function gradeDetail(docId2, lensKey) {
|
|
|
22114
22136
|
cleared: String(f.cleared || ""),
|
|
22115
22137
|
penalized: String(f.penalized || ""),
|
|
22116
22138
|
quotes: Array.isArray(f.quotes) ? f.quotes : [],
|
|
22117
|
-
scaleMax: RUBRIC[
|
|
22139
|
+
scaleMax: RUBRIC[key2]?.rungs?.length ? 11 : 10
|
|
22118
22140
|
};
|
|
22119
22141
|
})
|
|
22120
22142
|
};
|
|
@@ -22258,13 +22280,13 @@ async function loadFeedback() {
|
|
|
22258
22280
|
}
|
|
22259
22281
|
async function handlePersonFeedback(method, body) {
|
|
22260
22282
|
if (method === "GET") return { status: 200, json: { entries: (await loadFeedback()).entries } };
|
|
22261
|
-
const
|
|
22262
|
-
if (!
|
|
22283
|
+
const key2 = typeof body?.key === "string" ? body.key.replace(/[^a-z0-9:_-]/gi, "").slice(0, 80) : "";
|
|
22284
|
+
if (!key2) return { status: 400, json: { error: "missing key" } };
|
|
22263
22285
|
const text2 = (typeof body?.text === "string" ? body.text : "").trim();
|
|
22264
22286
|
const store = await loadFeedback();
|
|
22265
22287
|
const updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
22266
|
-
if (text2) store.entries[
|
|
22267
|
-
else delete store.entries[
|
|
22288
|
+
if (text2) store.entries[key2] = { text: text2, updatedAt };
|
|
22289
|
+
else delete store.entries[key2];
|
|
22268
22290
|
await fs18.mkdir(path23.dirname(FEEDBACK_FILE()), { recursive: true });
|
|
22269
22291
|
await fs18.writeFile(FEEDBACK_FILE(), JSON.stringify(store, null, 2));
|
|
22270
22292
|
return { status: 200, json: { ok: true, updatedAt } };
|
|
@@ -22481,14 +22503,14 @@ ${clip2(headline, 1400)}`);
|
|
|
22481
22503
|
for (const f of d.facets) {
|
|
22482
22504
|
const g = f.grade;
|
|
22483
22505
|
const sc = g && (g.score != null || g.bestEstimate != null) ? `${g.score ?? g.bestEstimate}/${f.scaleMax}` : "\u2014";
|
|
22484
|
-
const
|
|
22506
|
+
const key2 = `${d.key}:${f.facetKey}`;
|
|
22485
22507
|
const parts = [`- ${f.name} (${sc})`];
|
|
22486
|
-
const line = facetLines[
|
|
22508
|
+
const line = facetLines[key2]?.line;
|
|
22487
22509
|
if (line) parts.push(`feel-seen: ${clip2(line, 280)}`);
|
|
22488
22510
|
for (const spike of (g?.spikes || []).slice(0, 2)) {
|
|
22489
22511
|
if (spike?.what) parts.push(`peak: ${clip2(spike.what, 300)}${spike.title ? ` [${clip2(spike.title, 80)}${spike.date ? `, ${spike.date}` : ""}]` : ""}${spike.quote ? ` \u2014 verbatim: "${clip2(spike.quote, 240)}"` : ""}`);
|
|
22490
22512
|
}
|
|
22491
|
-
for (const dm of (peakDemos[
|
|
22513
|
+
for (const dm of (peakDemos[key2] || []).slice(0, 2)) {
|
|
22492
22514
|
const steps = (dm.steps || []).map((x) => clip2(x, 500)).filter(Boolean);
|
|
22493
22515
|
if (!steps.length && !dm.why) continue;
|
|
22494
22516
|
parts.push(`demonstration${dm.title ? ` [${clip2(dm.title, 90)}${dm.date ? `, ${dm.date}` : ""}]` : ""} \u2014 ordered moves:`);
|
|
@@ -22983,7 +23005,7 @@ async function writeScoreboard(codingDir, docs) {
|
|
|
22983
23005
|
}
|
|
22984
23006
|
if (!byCriterion.size) return;
|
|
22985
23007
|
const blocks = [...byCriterion.entries()].sort(([a], [b]) => a < b ? -1 : 1).map(
|
|
22986
|
-
([
|
|
23008
|
+
([key2, rows]) => `## ${key2}
|
|
22987
23009
|
${rows.sort((a, b) => b.s - a.s).map((r) => r.line).join("\n")}`
|
|
22988
23010
|
);
|
|
22989
23011
|
await fs23.writeFile(
|
|
@@ -23035,10 +23057,10 @@ function promptSha(parts) {
|
|
|
23035
23057
|
}
|
|
23036
23058
|
return h.digest("hex").slice(0, 16);
|
|
23037
23059
|
}
|
|
23038
|
-
async function reusableOutput(outPath, sha, valid,
|
|
23060
|
+
async function reusableOutput(outPath, sha, valid, key2 = "promptSha") {
|
|
23039
23061
|
try {
|
|
23040
23062
|
const o = JSON.parse(await fs24.readFile(outPath, "utf8"));
|
|
23041
|
-
if (o[
|
|
23063
|
+
if (o[key2] === sha && valid(o)) return o;
|
|
23042
23064
|
} catch {
|
|
23043
23065
|
}
|
|
23044
23066
|
return null;
|
|
@@ -23653,20 +23675,20 @@ async function compileCodingProfile() {
|
|
|
23653
23675
|
const m = /([\d.]+)\s*%/.exec(label);
|
|
23654
23676
|
return m ? 100 - parseFloat(m[1]) : null;
|
|
23655
23677
|
};
|
|
23656
|
-
const ceilOf = (
|
|
23657
|
-
const c = criteria.find((x) => x.key ===
|
|
23678
|
+
const ceilOf = (key2) => {
|
|
23679
|
+
const c = criteria.find((x) => x.key === key2);
|
|
23658
23680
|
const scores = (c?.takes ?? []).map((t) => t.score ?? t.best).filter((x) => x != null).sort((a, b) => b - a);
|
|
23659
23681
|
return scores.length ? scores[Math.min(3, scores.length) - 1] : null;
|
|
23660
23682
|
};
|
|
23661
|
-
const proud = (
|
|
23662
|
-
const t = (criteria.find((x) => x.key ===
|
|
23683
|
+
const proud = (key2, fallback) => {
|
|
23684
|
+
const t = (criteria.find((x) => x.key === key2)?.takes ?? [])[0];
|
|
23663
23685
|
if (!t?.instance) return fallback;
|
|
23664
23686
|
let h = t.instance.split(/:\s|\s[—–]\s|\swith an?\s/)[0].trim().replace(/\s+/g, " ");
|
|
23665
23687
|
h = h.replace(/^The user\b/, "You").replace(/\bThe user\b/g, "you").replace(/([.?!]['"’”)\]]*\s+)you\b/g, (_m, p) => p + "You");
|
|
23666
23688
|
if (h.length > 150) h = h.slice(0, 148).replace(/\s+\S*$/, "") + "\u2026";
|
|
23667
23689
|
return h;
|
|
23668
23690
|
};
|
|
23669
|
-
const nTk = (
|
|
23691
|
+
const nTk = (key2) => criteria.find((x) => x.key === key2)?.takes.length ?? 0;
|
|
23670
23692
|
const peakWords = Object.values(wordsByDay).length ? Math.max(...Object.values(wordsByDay)) : 0;
|
|
23671
23693
|
const pHist = parallelism.levelHistogramMin || {};
|
|
23672
23694
|
const soloMin = pHist["1"] ?? 0;
|
|
@@ -23827,7 +23849,7 @@ async function buildSkeleton(codingDir, stackUp) {
|
|
|
23827
23849
|
const r = (stackUp ?? []).find((x) => x.label.toLowerCase().includes(label));
|
|
23828
23850
|
return r?.percentile != null ? Math.round((100 - r.percentile) * 100) / 100 : null;
|
|
23829
23851
|
};
|
|
23830
|
-
const gradedOn = (
|
|
23852
|
+
const gradedOn = (key2) => (agglom?.criteria ?? []).length ? 0 : 0;
|
|
23831
23853
|
const interactive = sessions.filter((s) => s.klass === "interactive" && !s.duplicateOf);
|
|
23832
23854
|
const flow = agg?.flow?.flow ?? {};
|
|
23833
23855
|
const thr = agg?.throughput ?? {};
|
|
@@ -24021,7 +24043,7 @@ async function generatePublicPage(opts) {
|
|
|
24021
24043
|
}
|
|
24022
24044
|
|
|
24023
24045
|
// ../../lib/agents/coding/publicPageEdit.ts
|
|
24024
|
-
var SYSTEM5 = "You edit a
|
|
24046
|
+
var SYSTEM5 = "You edit a person's shareable profile on their instruction. There are TWO artifacts in front of you: the CODING PROFILE (the page of axes, moments and numbers) and, when present, the CHAT PROFILE (their public report: headline, spikes, traits, failure modes). ROUTE BY WHAT THEY SAY: 'in the coding report\u2026' / a coding axis name (judgement, agency, taste, push, how they use AI, focus) \u2192 edit the page. 'in the chat report\u2026' / a chat spike or trait name \u2192 edit the chat report. If the instruction names neither and applies to only one artifact, edit that one; if it genuinely applies to both ('remove every mention of my employer'), edit both. NEVER touch the artifact the instruction is not about \u2014 echo it back byte-identical. You may ONLY do two kinds of thing: (1) REDACT \u2014 hide, shorten, soften, or remove existing text: a claim, a read, an edge line, a moment, a spike, a trait, an example, a failure mode, a bullet, an entire section. Removing something is always safe, in either artifact. (2) GATHER MORE EVIDENCE \u2014 CODING PROFILE ONLY: if asked to swap out a moment ('use a different example', 'that one's too personal, find another'), Read/Grep the corpus for a genuinely different qualifying moment on the SAME axis and replace it, with a VERIFIED verbatim quote if you use one. The CHAT PROFILE is REDACT-ONLY here: you cannot add a spike, trait, or example to it (its evidence lives in a corpus you cannot reach from this tool) \u2014 if asked, decline and say the chat report can only have things removed or shortened here. YOU MAY NEVER: invent an achievement, statistic, date, or quote; write anything more flattering than the evidence supports; add content unrelated to the instruction; or change any NUMBER (percentiles, scores, levels, hours, counts) in either artifact \u2014 those fields are locked and any change you make to them is discarded, so do not bother trying. If the instruction asks for something outside redaction/evidence-swap (e.g. 'say I'm the best engineer ever', 'boost my percentile', 'add that I know Rust'), do NOT comply \u2014 leave that field unchanged and say plainly in your reply why you didn't. Return BOTH artifacts complete, with only the TEXT fields changed (page: verdict, overall, missionArc, rhythm.inFlow/outFlow, axis claim/read/edge, moment what/quote/date/sessionId, howToWork; chat: headline, spike titles, trait label/body/con, example title/detail, failure modes, drives, wants, howToWorkWithHim). Every other field must be echoed back byte-identical." + sourceLookupNote();
|
|
24025
24047
|
var norm = (s) => s.toLowerCase().replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length > 2);
|
|
24026
24048
|
function grounded(newText, contextText) {
|
|
24027
24049
|
const nt = norm(newText);
|
|
@@ -24082,19 +24104,90 @@ function clampToProtected(edited, original) {
|
|
|
24082
24104
|
});
|
|
24083
24105
|
return out;
|
|
24084
24106
|
}
|
|
24107
|
+
var key = (s) => (s ?? "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
|
|
24108
|
+
function matchBy(items, label) {
|
|
24109
|
+
const byFacet = /* @__PURE__ */ new Map(), byLabel = /* @__PURE__ */ new Map();
|
|
24110
|
+
for (const it of items) {
|
|
24111
|
+
if (it.facet) byFacet.set(key(it.facet), it);
|
|
24112
|
+
byLabel.set(key(label(it)), it);
|
|
24113
|
+
}
|
|
24114
|
+
return (e) => e.facet && byFacet.get(key(e.facet)) || byLabel.get(key(label(e)));
|
|
24115
|
+
}
|
|
24116
|
+
function clampChatExamples(edited, orig) {
|
|
24117
|
+
if (!orig?.length) return orig;
|
|
24118
|
+
if (!Array.isArray(edited)) return orig;
|
|
24119
|
+
const find = matchBy(orig, (e) => e.title ?? "");
|
|
24120
|
+
const out = edited.map((e) => ({ e, o: find(e) })).filter((p) => !!p.o).map(({ e, o }) => ({
|
|
24121
|
+
...o,
|
|
24122
|
+
// date + provenance: from the original
|
|
24123
|
+
title: keepIfGrounded(e.title, o.title, `${o.title} ${[o.detail ?? []].flat().join(" ")}`).slice(0, 200),
|
|
24124
|
+
detail: Array.isArray(e.detail) ? e.detail.map((d, i) => keepIfGrounded(d, [o.detail ?? []].flat()[i] ?? "", [o.detail ?? []].flat().join(" "))).filter(Boolean).slice(0, 6) : o.detail
|
|
24125
|
+
}));
|
|
24126
|
+
return out.length ? out : void 0;
|
|
24127
|
+
}
|
|
24128
|
+
function clampChatReport(edited, original) {
|
|
24129
|
+
const findSpike = matchBy(original.spikes ?? [], (s) => s.title);
|
|
24130
|
+
const spikes = (Array.isArray(edited.spikes) ? edited.spikes : original.spikes ?? []).map((e) => ({ e, o: findSpike(e) })).filter((p) => !!p.o).map(({ e, o }) => {
|
|
24131
|
+
const findTrait = matchBy(o.traits ?? [], (t) => t.label);
|
|
24132
|
+
const traits = (Array.isArray(e.traits) ? e.traits : o.traits ?? []).map((te) => ({ te, to: findTrait(te) })).filter((p) => !!p.to).map(({ te, to }) => {
|
|
24133
|
+
const ctx = `${to.label} ${to.body} ${to.con ?? ""} ${(to.examples ?? []).map((x) => `${x.title} ${[x.detail ?? []].flat().join(" ")}`).join(" ")}`;
|
|
24134
|
+
return {
|
|
24135
|
+
...to,
|
|
24136
|
+
// facet, score, percentile, fromPersonalLife: PROTECTED
|
|
24137
|
+
label: keepIfGrounded(te.label, to.label, ctx).slice(0, 200),
|
|
24138
|
+
body: keepIfGrounded(te.body, to.body, ctx).slice(0, 900),
|
|
24139
|
+
con: te.con === void 0 ? to.con : te.con ? keepIfGrounded(te.con, to.con ?? "", ctx).slice(0, 400) || void 0 : void 0,
|
|
24140
|
+
// personal-life traits never carry receipts, edited or not
|
|
24141
|
+
examples: to.fromPersonalLife ? void 0 : clampChatExamples(te.examples, to.examples)
|
|
24142
|
+
};
|
|
24143
|
+
});
|
|
24144
|
+
return {
|
|
24145
|
+
...o,
|
|
24146
|
+
// facet, score, percentile: PROTECTED
|
|
24147
|
+
title: keepIfGrounded(e.title, o.title, `${o.title} ${(o.traits ?? []).map((t) => `${t.label} ${t.body}`).join(" ")}`).slice(0, 200),
|
|
24148
|
+
traits
|
|
24149
|
+
};
|
|
24150
|
+
});
|
|
24151
|
+
const findFm = matchBy(original.failureModes ?? [], (f) => f.label);
|
|
24152
|
+
const failureModes = Array.isArray(edited.failureModes) ? edited.failureModes.map((e) => ({ e, o: findFm(e) })).filter((p) => !!p.o).map(({ e, o }) => ({
|
|
24153
|
+
...o,
|
|
24154
|
+
frequency: o.frequency,
|
|
24155
|
+
// an absolute count, framed by the grader: PROTECTED
|
|
24156
|
+
label: keepIfGrounded(e.label, o.label, `${o.label} ${o.body ?? ""}`).slice(0, 200),
|
|
24157
|
+
body: e.body === void 0 ? o.body : e.body ? keepIfGrounded(e.body, o.body ?? "", `${o.label} ${o.body ?? ""}`).slice(0, 600) || void 0 : void 0
|
|
24158
|
+
})) : original.failureModes;
|
|
24159
|
+
return {
|
|
24160
|
+
...original,
|
|
24161
|
+
// level, radar, generatedAt, editLog: PROTECTED, always original
|
|
24162
|
+
headline: keepIfGrounded(edited.headline, original.headline, original.headline).slice(0, 300),
|
|
24163
|
+
spikes,
|
|
24164
|
+
failureModes: failureModes?.length ? failureModes : void 0,
|
|
24165
|
+
drives: edited.drives === void 0 ? original.drives : edited.drives ? keepIfGrounded(edited.drives, original.drives ?? "", original.drives ?? "").slice(0, 900) || void 0 : void 0,
|
|
24166
|
+
wants: Array.isArray(edited.wants) ? edited.wants.map((w) => keepIfGrounded(w, "", (original.wants ?? []).join(" "))).filter(Boolean).slice(0, 8) : original.wants,
|
|
24167
|
+
howToWorkWithHim: Array.isArray(edited.howToWorkWithHim) ? edited.howToWorkWithHim.map((b) => keepIfGrounded(b, "", (original.howToWorkWithHim ?? []).join(" "))).filter(Boolean).slice(0, 6) : original.howToWorkWithHim
|
|
24168
|
+
};
|
|
24169
|
+
}
|
|
24085
24170
|
async function editPublicPage(opts) {
|
|
24086
24171
|
const last = opts.messages.filter((m) => m.role === "user").pop();
|
|
24087
24172
|
if (!last?.content?.trim()) return { status: 400, json: { error: "an instruction is required" } };
|
|
24088
24173
|
const convo = opts.messages.slice(-6).map((m) => `${m.role === "user" ? "USER" : "EDITOR"}: ${m.content}`).join("\n");
|
|
24089
|
-
const
|
|
24174
|
+
const chat = opts.chatReport ?? null;
|
|
24175
|
+
const prompt = `CODING PROFILE (the page):
|
|
24090
24176
|
\`\`\`json
|
|
24091
24177
|
${JSON.stringify(opts.page, null, 1)}
|
|
24092
24178
|
\`\`\`
|
|
24093
24179
|
|
|
24094
|
-
|
|
24180
|
+
` + (chat ? `CHAT PROFILE (their public report \u2014 REDACT-ONLY):
|
|
24181
|
+
\`\`\`json
|
|
24182
|
+
${JSON.stringify({ ...chat, radar: void 0, level: void 0, editLog: void 0 }, null, 1)}
|
|
24183
|
+
\`\`\`
|
|
24184
|
+
|
|
24185
|
+
` : `CHAT PROFILE: none exists yet \u2014 every instruction is about the coding profile.
|
|
24186
|
+
|
|
24187
|
+
`) + `CONVERSATION:
|
|
24095
24188
|
${convo}
|
|
24096
24189
|
|
|
24097
|
-
Apply the user's LAST instruction within your allowed actions (redact
|
|
24190
|
+
Apply the user's LAST instruction to the RIGHT artifact, within your allowed actions (redact; gather-more-evidence on the coding page only). Output ONE fenced json block: { "page": <complete page>, ${chat ? `"chatReport": <complete chat report>, ` : ""}"reply": "one short plain sentence naming WHICH report you changed and what you did, or why you declined" }`;
|
|
24098
24191
|
try {
|
|
24099
24192
|
const run4 = await invokeAgent2({
|
|
24100
24193
|
prompt,
|
|
@@ -24111,7 +24204,11 @@ Apply the user's LAST instruction within your allowed actions (redact, or gather
|
|
|
24111
24204
|
const originalIds = new Set(opts.page.axes.flatMap((a) => a.moments.map((m) => m.sessionId).filter(Boolean)));
|
|
24112
24205
|
await verifyQuotes(opts.codingDir, clamped.axes);
|
|
24113
24206
|
for (const ax of clamped.axes) ax.moments = ax.moments.filter((m) => m.sessionId && originalIds.has(m.sessionId) || m.quote);
|
|
24114
|
-
|
|
24207
|
+
const chatOut = chat ? j.chatReport ? clampChatReport(j.chatReport, chat) : chat : void 0;
|
|
24208
|
+
return {
|
|
24209
|
+
status: 200,
|
|
24210
|
+
json: { page: clamped, ...chatOut ? { chatReport: chatOut } : {}, reply: String(j.reply ?? "Done.").slice(0, 300) }
|
|
24211
|
+
};
|
|
24115
24212
|
} catch (e) {
|
|
24116
24213
|
return { status: 502, json: { error: e.message.slice(0, 200) } };
|
|
24117
24214
|
}
|
|
@@ -24123,6 +24220,40 @@ async function localChatReport() {
|
|
|
24123
24220
|
const rep = await loadPublicReport().catch(() => null);
|
|
24124
24221
|
return rep && hasContent(rep) ? rep : null;
|
|
24125
24222
|
}
|
|
24223
|
+
async function handleSharedReportGet(dataDir) {
|
|
24224
|
+
const cfg = centralConfig();
|
|
24225
|
+
if (!cfg.configured) return { status: 200, json: { shared: null, reason: "central services are disabled in this build" } };
|
|
24226
|
+
const auth = await getAccessToken(dataDir);
|
|
24227
|
+
if (!auth) return { status: 200, json: { shared: null, reason: "signed-out" } };
|
|
24228
|
+
try {
|
|
24229
|
+
const r = await fetch(`${cfg.supabaseUrl}/rest/v1/reports?user_id=eq.${encodeURIComponent(auth.identity.userId)}&select=content,verification,created_at,updated_at`, {
|
|
24230
|
+
headers: { apikey: cfg.supabaseAnonKey, authorization: `Bearer ${auth.token}` }
|
|
24231
|
+
});
|
|
24232
|
+
if (!r.ok) return { status: 502, json: { error: `couldn't read your shared report (HTTP ${r.status})` } };
|
|
24233
|
+
const rows = await r.json();
|
|
24234
|
+
const row = rows[0];
|
|
24235
|
+
if (!row?.content) return { status: 200, json: { shared: null } };
|
|
24236
|
+
const c = row.content;
|
|
24237
|
+
return {
|
|
24238
|
+
status: 200,
|
|
24239
|
+
json: {
|
|
24240
|
+
shared: {
|
|
24241
|
+
// updated_at, NOT created_at: submit_report UPSERTS one row per user
|
|
24242
|
+
// (`on conflict (user_id) do update`), so created_at is the FIRST
|
|
24243
|
+
// share ever while the content is the LATEST — dating today's page
|
|
24244
|
+
// "July 3" would be a lie about the thing on screen.
|
|
24245
|
+
sharedAt: row.updated_at ?? row.created_at ?? null,
|
|
24246
|
+
verification: row.verification ?? null,
|
|
24247
|
+
// coding-pr1 carries {page, chatReport?}; the older pr1 is chat-only
|
|
24248
|
+
page: c.format === "coding-pr1" ? c.page ?? null : null,
|
|
24249
|
+
chatReport: c.chatReport ?? (c.format === "pr1" ? c.report ?? null : null)
|
|
24250
|
+
}
|
|
24251
|
+
}
|
|
24252
|
+
};
|
|
24253
|
+
} catch (e) {
|
|
24254
|
+
return { status: 502, json: { error: e.message.slice(0, 200) } };
|
|
24255
|
+
}
|
|
24256
|
+
}
|
|
24126
24257
|
async function handlePublicCodingPageGet(dataDir) {
|
|
24127
24258
|
const page = await readJson4(path32.join(dataDir, "coding", "coding-public.json"), null);
|
|
24128
24259
|
const chatReport = await localChatReport();
|
|
@@ -24144,7 +24275,12 @@ async function handlePublicCodingPageEdit(dataDir, body) {
|
|
|
24144
24275
|
const page = body.page;
|
|
24145
24276
|
const messages = Array.isArray(body.messages) ? body.messages : [];
|
|
24146
24277
|
if (!page || !Array.isArray(page.axes)) return { status: 400, json: { error: "page + messages are required" } };
|
|
24147
|
-
const
|
|
24278
|
+
const chatReport = await localChatReport();
|
|
24279
|
+
const out = await editPublicPage({ page, chatReport, messages, codingDir: path32.join(dataDir, "coding") });
|
|
24280
|
+
const edited = out.json.chatReport;
|
|
24281
|
+
if (out.status === 200 && edited && chatReport && JSON.stringify(edited) !== JSON.stringify(chatReport)) {
|
|
24282
|
+
await savePublicReport({ ...edited, editLog: [...chatReport.editLog ?? [], { instruction: messages.filter((m) => m.role === "user").pop()?.content ?? "", at: (/* @__PURE__ */ new Date()).toISOString() }].slice(-50) });
|
|
24283
|
+
}
|
|
24148
24284
|
return out;
|
|
24149
24285
|
}
|
|
24150
24286
|
async function handlePublicCodingPageShare(dataDir, body) {
|
|
@@ -24245,13 +24381,13 @@ async function handleShare(res, body, opts, dataDir) {
|
|
|
24245
24381
|
const all = opts.shareSections ?? opts.profile?.sections ?? {};
|
|
24246
24382
|
const sections = {};
|
|
24247
24383
|
if (parsed.sectionsData && typeof parsed.sectionsData === "object" && !Array.isArray(parsed.sectionsData)) {
|
|
24248
|
-
for (const
|
|
24249
|
-
if (
|
|
24384
|
+
for (const key2 of Object.keys(parsed.sectionsData)) {
|
|
24385
|
+
if (key2 in all && parsed.sectionsData[key2] != null) sections[key2] = parsed.sectionsData[key2];
|
|
24250
24386
|
}
|
|
24251
24387
|
} else {
|
|
24252
24388
|
const wanted = parsed.all ? Object.keys(all) : Array.isArray(parsed.sections) ? parsed.sections : [];
|
|
24253
|
-
for (const
|
|
24254
|
-
if (
|
|
24389
|
+
for (const key2 of wanted) {
|
|
24390
|
+
if (key2 in all && all[key2] != null) sections[key2] = all[key2];
|
|
24255
24391
|
}
|
|
24256
24392
|
}
|
|
24257
24393
|
if (Object.keys(sections).length === 0) {
|
|
@@ -24399,8 +24535,8 @@ function startServer(opts) {
|
|
|
24399
24535
|
return;
|
|
24400
24536
|
}
|
|
24401
24537
|
}
|
|
24402
|
-
const
|
|
24403
|
-
const out = handleDiagnostic(req.method || "GET", body,
|
|
24538
|
+
const key2 = new URL(url, serverUrl || "http://localhost").searchParams.get("key") || void 0;
|
|
24539
|
+
const out = handleDiagnostic(req.method || "GET", body, key2);
|
|
24404
24540
|
json(res, out.status, out.json);
|
|
24405
24541
|
return;
|
|
24406
24542
|
}
|
|
@@ -24475,6 +24611,11 @@ function startServer(opts) {
|
|
|
24475
24611
|
json(res, out.status, out.json);
|
|
24476
24612
|
return;
|
|
24477
24613
|
}
|
|
24614
|
+
if (req.method === "GET" && route === "/api/shared-report") {
|
|
24615
|
+
const out = await handleSharedReportGet(dataDir);
|
|
24616
|
+
json(res, out.status, out.json);
|
|
24617
|
+
return;
|
|
24618
|
+
}
|
|
24478
24619
|
if (req.method === "POST" && route === "/api/public-coding-page/generate") {
|
|
24479
24620
|
const out = await handlePublicCodingPageGenerate(dataDir, liveProfile);
|
|
24480
24621
|
json(res, out.status, out.json);
|
|
@@ -24581,10 +24722,10 @@ function withTimeout(p) {
|
|
|
24581
24722
|
new Promise((_, rej) => setTimeout(() => rej(new Error("runlog timeout")), RPC_TIMEOUT_MS).unref?.())
|
|
24582
24723
|
]);
|
|
24583
24724
|
}
|
|
24584
|
-
async function rpc(url,
|
|
24725
|
+
async function rpc(url, key2, fn, args) {
|
|
24585
24726
|
const res = await fetch(`${url.replace(/\/$/, "")}/rest/v1/rpc/${fn}`, {
|
|
24586
24727
|
method: "POST",
|
|
24587
|
-
headers: { "content-type": "application/json", apikey:
|
|
24728
|
+
headers: { "content-type": "application/json", apikey: key2, authorization: `Bearer ${key2}` },
|
|
24588
24729
|
body: JSON.stringify(args)
|
|
24589
24730
|
});
|
|
24590
24731
|
if (!res.ok) throw new Error(`${fn} \u2192 HTTP ${res.status}`);
|
|
@@ -24599,9 +24740,9 @@ async function writeRef(refPath, ref) {
|
|
|
24599
24740
|
}
|
|
24600
24741
|
}
|
|
24601
24742
|
var LiveRunLog = class {
|
|
24602
|
-
constructor(url,
|
|
24743
|
+
constructor(url, key2, sessionId, token, nonce, opts) {
|
|
24603
24744
|
this.url = url;
|
|
24604
|
-
this.key =
|
|
24745
|
+
this.key = key2;
|
|
24605
24746
|
this.token = token;
|
|
24606
24747
|
this.nonce = nonce;
|
|
24607
24748
|
this.opts = opts;
|
|
@@ -24693,18 +24834,18 @@ function inertRunLog(refPath) {
|
|
|
24693
24834
|
}
|
|
24694
24835
|
async function startRunLog(clientInfo = {}, opts = {}) {
|
|
24695
24836
|
const url = opts.supabaseUrl ?? process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
24696
|
-
const
|
|
24837
|
+
const key2 = opts.supabaseAnonKey ?? process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
|
24697
24838
|
const refPath = opts.refPath ?? runRefPath();
|
|
24698
|
-
if (!url || !
|
|
24839
|
+
if (!url || !key2) return inertRunLog(refPath);
|
|
24699
24840
|
try {
|
|
24700
24841
|
const data = await withTimeout(
|
|
24701
|
-
rpc(url,
|
|
24842
|
+
rpc(url, key2, "begin_analysis_session", {
|
|
24702
24843
|
p_client_info: { platform: process.platform, ...clientInfo }
|
|
24703
24844
|
})
|
|
24704
24845
|
);
|
|
24705
24846
|
const d = data ?? {};
|
|
24706
24847
|
if (!d.session_id || !d.token || !d.nonce) return inertRunLog(refPath);
|
|
24707
|
-
return new LiveRunLog(url,
|
|
24848
|
+
return new LiveRunLog(url, key2, d.session_id, d.token, d.nonce, opts);
|
|
24708
24849
|
} catch {
|
|
24709
24850
|
return inertRunLog(refPath);
|
|
24710
24851
|
}
|
|
@@ -24821,9 +24962,11 @@ function upToDateSkip(i) {
|
|
|
24821
24962
|
}
|
|
24822
24963
|
async function evalUpToDate(codingDir, threshold, regrade) {
|
|
24823
24964
|
try {
|
|
24824
|
-
const { partition: partition2 } = await Promise.resolve().then(() => (init_gate2(), gate_exports));
|
|
24965
|
+
const { partition: partition2, aiWindowCutoff: aiWindowCutoff2 } = await Promise.resolve().then(() => (init_gate2(), gate_exports));
|
|
24825
24966
|
const sessions = JSON.parse(await fs31.readFile(path36.join(codingDir, "sessions.json"), "utf8"));
|
|
24826
|
-
const
|
|
24967
|
+
const live = sessions.filter((s) => s.klass === "interactive" && !s.duplicateOf);
|
|
24968
|
+
const cutoff = aiWindowCutoff2(live);
|
|
24969
|
+
const { gradable } = partition2(cutoff ? live.filter((s) => (s.start ?? "") >= cutoff) : live);
|
|
24827
24970
|
const graded = new Set(
|
|
24828
24971
|
(await fs31.readdir(path36.join(codingDir, "grades")).catch(() => [])).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -5))
|
|
24829
24972
|
);
|
|
@@ -24839,6 +24982,44 @@ async function evalUpToDate(codingDir, threshold, regrade) {
|
|
|
24839
24982
|
return { skip: false, pending: -1 };
|
|
24840
24983
|
}
|
|
24841
24984
|
}
|
|
24985
|
+
function startKeepAwake(o = {}) {
|
|
24986
|
+
const platform = o.platform ?? process.platform;
|
|
24987
|
+
if (platform !== "darwin") return () => {
|
|
24988
|
+
};
|
|
24989
|
+
const cmd = o.cmd ?? "caffeinate";
|
|
24990
|
+
const argv = o.argv ?? ["-ims", "-w", String(process.pid)];
|
|
24991
|
+
let stopped = false;
|
|
24992
|
+
let child = null;
|
|
24993
|
+
let timer = null;
|
|
24994
|
+
const up = () => {
|
|
24995
|
+
if (stopped) return;
|
|
24996
|
+
try {
|
|
24997
|
+
child = spawn6(cmd, argv, { detached: true, stdio: "ignore" });
|
|
24998
|
+
child.unref();
|
|
24999
|
+
child.on("error", () => {
|
|
25000
|
+
stopped = true;
|
|
25001
|
+
child = null;
|
|
25002
|
+
});
|
|
25003
|
+
child.on("exit", () => {
|
|
25004
|
+
child = null;
|
|
25005
|
+
if (stopped) return;
|
|
25006
|
+
timer = setTimeout(up, o.respawnDelayMs ?? 5e3);
|
|
25007
|
+
timer.unref?.();
|
|
25008
|
+
});
|
|
25009
|
+
} catch {
|
|
25010
|
+
stopped = true;
|
|
25011
|
+
}
|
|
25012
|
+
};
|
|
25013
|
+
up();
|
|
25014
|
+
return () => {
|
|
25015
|
+
stopped = true;
|
|
25016
|
+
if (timer) clearTimeout(timer);
|
|
25017
|
+
try {
|
|
25018
|
+
child?.kill();
|
|
25019
|
+
} catch {
|
|
25020
|
+
}
|
|
25021
|
+
};
|
|
25022
|
+
}
|
|
24842
25023
|
async function runPipeline(o) {
|
|
24843
25024
|
if (!hasPipeline(o.repoRoot)) {
|
|
24844
25025
|
throw new Error(
|
|
@@ -24848,13 +25029,8 @@ async function runPipeline(o) {
|
|
|
24848
25029
|
const dataRoot = codingDataRoot(o.repoRoot);
|
|
24849
25030
|
const env = { ...process.env, POLYMATH_RESILIENT: "1", POLYMATH_DATA_DIR: dataRoot };
|
|
24850
25031
|
if (!o.overnight) env.POLYMATH_RESILIENT_NO_WINDOW = "1";
|
|
24851
|
-
|
|
24852
|
-
|
|
24853
|
-
const { spawn: spawn10 } = await import("node:child_process");
|
|
24854
|
-
spawn10("caffeinate", ["-ims", "-w", String(process.pid)], { detached: true, stdio: "ignore" }).unref();
|
|
24855
|
-
} catch {
|
|
24856
|
-
}
|
|
24857
|
-
}
|
|
25032
|
+
const stopKeepAwake = o.overnight ? startKeepAwake() : () => {
|
|
25033
|
+
};
|
|
24858
25034
|
const list = stages(o).filter((st) => !o.deterministicOnly || !st.llm);
|
|
24859
25035
|
const codingDir = path36.join(dataRoot, "coding");
|
|
24860
25036
|
const central = centralConfig();
|
|
@@ -24935,6 +25111,7 @@ async function runPipeline(o) {
|
|
|
24935
25111
|
o.onLine?.(`\u23F1 run took ${fmt(totalMs)} (${record.kind}) \u2014 slowest: ${slowest} \xB7 ledger: .data/coding/run-times.jsonl`);
|
|
24936
25112
|
} catch {
|
|
24937
25113
|
}
|
|
25114
|
+
stopKeepAwake();
|
|
24938
25115
|
return { failed, ...skippedLlm ? { skippedLlm } : {} };
|
|
24939
25116
|
}
|
|
24940
25117
|
|
|
@@ -24959,6 +25136,7 @@ function chatEngineStages() {
|
|
|
24959
25136
|
{ script: "person-facet-lines.mts", label: "Facet lines", llm: true, args: [], out: "engine-pilot/person-facet-lines.json" },
|
|
24960
25137
|
{ script: "peak-demos.mts", label: "Peak demonstrations", llm: true, args: [], out: "engine-pilot/peak-demos.json" },
|
|
24961
25138
|
{ script: "person-dimension-summary.mts", label: "Dimension summaries", llm: true, args: [], out: "engine-pilot/dimension-summary.json" },
|
|
25139
|
+
{ script: "chat-loops.mts", label: "Recurring patterns + growth loops", llm: true, args: [], out: "loops.json" },
|
|
24962
25140
|
{ script: "person-report.mts", label: "Report narrative", llm: true, args: [], out: "engine-pilot/report-narrative.json" },
|
|
24963
25141
|
{ script: "public-report.mts", label: "Public report", llm: true, args: [], out: "engine-pilot/public-report.json" }
|
|
24964
25142
|
];
|
|
@@ -25326,6 +25504,8 @@ Graded ${detail.gradedSessions} sessions \u2192 ${gradeOut}/graded.json`);
|
|
|
25326
25504
|
process.exit(1);
|
|
25327
25505
|
}
|
|
25328
25506
|
const chatOvernight = opts.chatOvernight ?? opts.overnight;
|
|
25507
|
+
const stopKeepAwake = opts.overnight || chatOvernight ? startKeepAwake() : () => {
|
|
25508
|
+
};
|
|
25329
25509
|
const when = (o) => o ? "at the 02:00 window tonight" : "now";
|
|
25330
25510
|
console.error(`
|
|
25331
25511
|
Running the full analysis on ${backend.name === "cli" ? "Claude Code" : "Codex"} \u2014 coding ${when(opts.overnight)}, chats ${when(chatOvernight)}.`);
|
|
@@ -25441,6 +25621,7 @@ Running the full analysis on ${backend.name === "cli" ? "Claude Code" : "Codex"}
|
|
|
25441
25621
|
return chat2;
|
|
25442
25622
|
})();
|
|
25443
25623
|
const [codingRes, chat] = await Promise.all([codingDone, chatDone]);
|
|
25624
|
+
stopKeepAwake();
|
|
25444
25625
|
const { failed } = codingRes;
|
|
25445
25626
|
clearInterval(liveRefresh);
|
|
25446
25627
|
mbar.done();
|
|
@@ -25524,7 +25705,7 @@ No analysis here yet \u2014 computing the instant deterministic metrics now (fre
|
|
|
25524
25705
|
console.error(` Run from the directory where you ran the analysis, or set POLYMATH_DATA_DIR.`);
|
|
25525
25706
|
}
|
|
25526
25707
|
console.error(`
|
|
25527
|
-
|
|
25708
|
+
your reports are live \u2192 ${handle.url}`);
|
|
25528
25709
|
console.error(` ${nSessions} sessions \xB7 ${nGraded} graded${opts.grade ? "" : nGraded ? "" : " (add --grade to run the full AI analysis first)"}`);
|
|
25529
25710
|
console.error(` share endpoint: ${shareUrl}`);
|
|
25530
25711
|
console.error(` ${who ? `signed in as ${who.email}` : "not signed in \u2014 feedback + sharing ask for Google sign-in in the header"}`);
|