@a-company/paradigm 3.34.0 → 3.44.0
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/{accept-orchestration-XXANWJVZ.js → accept-orchestration-ZUWQUHSK.js} +6 -6
- package/dist/add-VSPZ6FM4.js +81 -0
- package/dist/{aggregate-XHQ6GI3Z.js → aggregate-SV3VGEIL.js} +2 -2
- package/dist/assess-UHBDYIK7.js +68 -0
- package/dist/{beacon-BTLQMYQL.js → beacon-3SJV4DAP.js} +2 -2
- package/dist/calibration-WWHK73WU.js +135 -0
- package/dist/{chunk-C5ZE6WEX.js → chunk-2SKXFXIT.js} +91 -1
- package/dist/{chunk-S5TDFT5Q.js → chunk-7COU5S2Z.js} +2 -2
- package/dist/{chunk-H4TVBJD4.js → chunk-AKIMFN6I.js} +3 -3
- package/dist/{chunk-3DYYXGDC.js → chunk-CDMAMDSG.js} +33 -0
- package/dist/chunk-F3BCHPYT.js +143 -0
- package/dist/{chunk-R2SGQ22F.js → chunk-FKJUBQU3.js} +461 -2
- package/dist/chunk-GT5QGC2H.js +253 -0
- package/dist/{chunk-UQNTJ5VB.js → chunk-HIKKOCXY.js} +1 -1
- package/dist/{chunk-J26YQVAK.js → chunk-J4E6K5MG.js} +1 -1
- package/dist/chunk-L27I3CPZ.js +357 -0
- package/dist/{chunk-WOONGZ3C.js → chunk-P7XSBJE3.js} +1 -1
- package/dist/{chunk-Z7W7HNRG.js → chunk-QDXI2DHR.js} +1 -1
- package/dist/{chunk-BRILIG7Z.js → chunk-QIOCFXDQ.js} +42 -0
- package/dist/{chunk-3BGSDKWD.js → chunk-QWA26UNO.js} +7 -7
- package/dist/{lore-server-ILPHKWLK.js → chunk-RAB5IKPR.js} +77 -112
- package/dist/chunk-SOBTKFSP.js +616 -0
- package/dist/{chunk-BKMNLROM.js → chunk-ZDHLG5VP.js} +461 -147
- package/dist/{chunk-CTF6RHKG.js → chunk-ZGUAAVMA.js} +17 -2
- package/dist/{chunk-PFLWLC6J.js → chunk-ZMQA6SCO.js} +855 -34
- package/dist/{chunk-3BAMPB6I.js → chunk-ZSYVKSY6.js} +2 -147
- package/dist/{commands-KPT2T2OZ.js → commands-5N4ILTPH.js} +465 -1
- package/dist/config-schema-3YNIFJCJ.js +152 -0
- package/dist/{constellation-LZ6XIKDT.js → constellation-FAGT45TU.js} +2 -2
- package/dist/{context-audit-RI4R2WRH.js → context-audit-557EO6PK.js} +138 -8
- package/dist/{cost-4SZM7OUS.js → cost-UD3WPEKZ.js} +1 -1
- package/dist/{delete-YTASL4SM.js → delete-RRK4RL6Y.js} +1 -1
- package/dist/{diff-T6YJSAAC.js → diff-IP5CIARP.js} +6 -6
- package/dist/{dist-AG5JNIZU-HW2FWNTZ.js → dist-5QE2BB2B-X6DYVSUL.js} +59 -5
- package/dist/{dist-IKBGY7FQ.js → dist-CM3MVWWW.js} +3 -1
- package/dist/{dist-OH4DBV2O.js → dist-OGTSAZ55.js} +16 -1
- package/dist/{dist-RMAIFRTW.js → dist-POMVY6WP.js} +5 -3
- package/dist/{dist-QSBAGCZT.js → dist-UXWV4OKX.js} +2 -2
- package/dist/{doctor-INBOLZC7.js → doctor-GKZJU7QG.js} +1 -1
- package/dist/{edit-S7NZD7H7.js → edit-4CLNN5JG.js} +1 -1
- package/dist/{graph-ERNQQQ7C.js → graph-YYUXI3F7.js} +1 -1
- package/dist/graph-server-ZPXRSGCW.js +116 -0
- package/dist/{habits-7BORPC2F.js → habits-RG5SVKXP.js} +2 -2
- package/dist/index.js +200 -86
- package/dist/integrity-MK2OP5TA.js +194 -0
- package/dist/integrity-checker-J7YXRTBT.js +11 -0
- package/dist/{lint-MTRZB5EC.js → lint-HYWGS3JJ.js} +1 -1
- package/dist/{list-QTFWN35D.js → list-BTLFHSRC.js} +1 -1
- package/dist/list-IUCYPGMK.js +57 -0
- package/dist/{lore-loader-S5BXMH27.js → lore-loader-VTEEZDX3.js} +3 -1
- package/dist/lore-server-NOOAHKJX.js +118 -0
- package/dist/mcp.js +2591 -112
- package/dist/{migrate-HRN5TUBQ.js → migrate-FQVGQNXZ.js} +21 -3
- package/dist/{migrate-assessments-FPR6C35Z.js → migrate-assessments-JP6Q5KME.js} +1 -1
- package/dist/{orchestrate-3SI6ON33.js → orchestrate-A226N6FC.js} +6 -6
- package/dist/platform-server-KHL6ZPPN.js +900 -0
- package/dist/{probe-ABMGCXQG.js → probe-7JK7IDNI.js} +4 -4
- package/dist/{providers-YW3FG6DA.js → providers-YNFSL6HK.js} +1 -1
- package/dist/quiz-I75NU2QQ.js +99 -0
- package/dist/{record-UGN75GTB.js → record-46CLR4OG.js} +11 -2
- package/dist/{reindex-YC7LD4MN.js → reindex-WIJMCJ4A.js} +3 -2
- package/dist/{remember-WR6ZVXLT.js → remember-4EUZKIIB.js} +1 -1
- package/dist/{retag-URLJLMSK.js → retag-KC4JVRLE.js} +1 -1
- package/dist/{review-725ZKA7U.js → review-Q7M4CRB5.js} +1 -1
- package/dist/{ripple-QTXKJCEI.js → ripple-RI3LOT6R.js} +2 -2
- package/dist/{sentinel-FUR3QKCJ.js → sentinel-UOIGJWHH.js} +1 -1
- package/dist/sentinel-bridge-APDXYAZS.js +109 -0
- package/dist/sentinel-mcp.js +13 -0
- package/dist/sentinel-ui/assets/{index-Zh1YM0C9.css → index-CJ1Wx083.css} +1 -1
- package/dist/sentinel-ui/assets/index-S1VJ67dT.js +62 -0
- package/dist/sentinel-ui/assets/index-S1VJ67dT.js.map +1 -0
- package/dist/sentinel-ui/index.html +2 -2
- package/dist/sentinel.js +6 -6
- package/dist/{serve-DIALBCTU.js → serve-22A4XOIG.js} +1 -1
- package/dist/{university-A66BMZ4Z.js → serve-2YJ6D2Y6.js} +9 -8
- package/dist/serve-JVXSRSUB.js +33 -0
- package/dist/{server-2VICPDUR.js → server-JV6UFGWZ.js} +25 -2
- package/dist/{server-OWBK2WFS.js → server-RDLQ3DK7.js} +49 -4
- package/dist/{setup-ASR6OMKV.js → setup-M2ZKLKNN.js} +2 -2
- package/dist/{shift-7XLSBLDW.js → shift-LNMKFYLR.js} +63 -14
- package/dist/{show-GEVVQWWG.js → show-P7GYO43X.js} +1 -1
- package/dist/show-PKZMYKRN.js +82 -0
- package/dist/{snapshot-QZFD7YBI.js → snapshot-Y3COXK4T.js} +2 -2
- package/dist/{spawn-DIY7T4QW.js → spawn-SSXZX45U.js} +2 -2
- package/dist/status-KLHALGW4.js +71 -0
- package/dist/{summary-R4CSYNNP.js → summary-5NQNOD3F.js} +2 -2
- package/dist/{sweep-5POCF2E4.js → sweep-EZU3GU6S.js} +1 -1
- package/dist/symphony-EYRGGVNE.js +470 -0
- package/dist/symphony-QWOEKZMC.js +308 -0
- package/dist/{team-VH3HYABB.js → team-HGLJXWQG.js} +7 -7
- package/dist/{timeline-RKXNRMKF.js → timeline-ANC7LVDL.js} +1 -1
- package/dist/{triage-GJ6GK647.js → triage-IZ4MDYNB.js} +2 -2
- package/dist/university-content/courses/.purpose +7 -1
- package/dist/university-content/courses/para-501.json +166 -0
- package/dist/university-content/plsat/.purpose +6 -0
- package/dist/university-content/plsat/v3.0.json +323 -1
- package/dist/university-content/reference.json +48 -0
- package/dist/university-ui/assets/{index-TcsCEBMo.js → index-tfi5xN4Q.js} +2 -2
- package/dist/university-ui/assets/{index-TcsCEBMo.js.map → index-tfi5xN4Q.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/dist/validate-GD5XWILV.js +134 -0
- package/dist/{validate-OUHUBZPO.js → validate-ZVPNN4FL.js} +1 -1
- package/dist/{workspace-5RBSALXC.js → workspace-UIUTHZTD.js} +5 -5
- package/package.json +4 -2
- package/platform-ui/dist/assets/GitSection-BD3Ze06e.js +4 -0
- package/platform-ui/dist/assets/GitSection-C-GQWHcu.css +1 -0
- package/platform-ui/dist/assets/GraphSection-BlgXTl53.css +1 -0
- package/platform-ui/dist/assets/GraphSection-SglITfSs.js +8 -0
- package/platform-ui/dist/assets/LoreSection-C3EixkjW.css +1 -0
- package/platform-ui/dist/assets/LoreSection-bR5Km4Fd.js +1 -0
- package/platform-ui/dist/assets/SentinelSection-BI-aIYKL.css +1 -0
- package/platform-ui/dist/assets/SentinelSection-QSpAZArG.js +1 -0
- package/platform-ui/dist/assets/SymphonySection-CobYJgvg.js +1 -0
- package/platform-ui/dist/assets/SymphonySection-zY0C5tFl.css +1 -0
- package/platform-ui/dist/assets/index-CfpZFjea.css +1 -0
- package/platform-ui/dist/assets/index-DbxeSMkV.js +57 -0
- package/platform-ui/dist/index.html +14 -0
- package/dist/graph-server-BZ73HTAT.js +0 -251
- package/dist/sentinel-ui/assets/index-C_Wstm64.js +0 -62
- package/dist/sentinel-ui/assets/index-C_Wstm64.js.map +0 -1
- /package/dist/{chunk-VUSCJJ4A.js → chunk-EDOAWN7J.js} +0 -0
- /package/dist/{chunk-5SXMV4SP.js → chunk-FS3WTUHY.js} +0 -0
|
@@ -120,6 +120,16 @@ function applyLoreFilter(entries, filter) {
|
|
|
120
120
|
(e) => filter.hasReview ? e.review != null : e.review == null
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
|
+
if (filter.hasConfidence !== void 0) {
|
|
124
|
+
result = result.filter(
|
|
125
|
+
(e) => filter.hasConfidence ? e.confidence != null : e.confidence == null
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (filter.hasAssessment !== void 0) {
|
|
129
|
+
result = result.filter(
|
|
130
|
+
(e) => filter.hasAssessment ? e.assessment != null : e.assessment == null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
123
133
|
if (filter.minCompleteness !== void 0) {
|
|
124
134
|
result = result.filter(
|
|
125
135
|
(e) => e.review != null && e.review.completeness >= filter.minCompleteness
|
|
@@ -332,6 +342,34 @@ async function addReview(rootDir, entryId, review) {
|
|
|
332
342
|
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
333
343
|
return true;
|
|
334
344
|
}
|
|
345
|
+
function verdictToScore(verdict) {
|
|
346
|
+
switch (verdict) {
|
|
347
|
+
case "correct":
|
|
348
|
+
return 1;
|
|
349
|
+
case "partial":
|
|
350
|
+
return 0.5;
|
|
351
|
+
case "incorrect":
|
|
352
|
+
return 0;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
async function addAssessment(rootDir, entryId, assessment) {
|
|
356
|
+
const entries = await loadLoreEntries(rootDir);
|
|
357
|
+
const entry = entries.find((e) => e.id === entryId);
|
|
358
|
+
if (!entry) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
const dateStr = entry.timestamp.slice(0, 10);
|
|
362
|
+
const entryPath = resolveEntryPath(rootDir, dateStr, entryId);
|
|
363
|
+
if (!entryPath) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
entry.assessment = assessment;
|
|
367
|
+
if (entry.confidence != null) {
|
|
368
|
+
entry.assessment_delta = verdictToScore(assessment.verdict) - entry.confidence;
|
|
369
|
+
}
|
|
370
|
+
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
335
373
|
async function loadLoreEntry(rootDir, entryId) {
|
|
336
374
|
const dateMatch = entryId.match(/^L-(\d{4}-\d{2}-\d{2})-/);
|
|
337
375
|
if (dateMatch) {
|
|
@@ -376,6 +414,9 @@ async function updateLoreEntry(rootDir, entryId, partial) {
|
|
|
376
414
|
if (partial.linked_lore !== void 0) entry.linked_lore = partial.linked_lore;
|
|
377
415
|
if (partial.linked_tasks !== void 0) entry.linked_tasks = partial.linked_tasks;
|
|
378
416
|
if (partial.linked_commits !== void 0) entry.linked_commits = partial.linked_commits;
|
|
417
|
+
if (partial.confidence !== void 0) entry.confidence = partial.confidence;
|
|
418
|
+
if (partial.assessment !== void 0) entry.assessment = partial.assessment;
|
|
419
|
+
if (partial.assessment_delta !== void 0) entry.assessment_delta = partial.assessment_delta;
|
|
379
420
|
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
380
421
|
await rebuildTimeline(rootDir);
|
|
381
422
|
return true;
|
|
@@ -477,6 +518,7 @@ export {
|
|
|
477
518
|
recordLore,
|
|
478
519
|
loadLoreEntries,
|
|
479
520
|
addReview,
|
|
521
|
+
addAssessment,
|
|
480
522
|
loadLoreEntry,
|
|
481
523
|
updateLoreEntry,
|
|
482
524
|
deleteLoreEntry
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
suggestAgentsForTask
|
|
4
|
-
} from "./chunk-6QC3YGB6.js";
|
|
5
2
|
import {
|
|
6
3
|
AgentSpawner,
|
|
7
4
|
extractSymbols
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J4E6K5MG.js";
|
|
9
6
|
import {
|
|
10
7
|
AuditLogger
|
|
11
8
|
} from "./chunk-PBHIFAL4.js";
|
|
9
|
+
import {
|
|
10
|
+
suggestAgentsForTask
|
|
11
|
+
} from "./chunk-6QC3YGB6.js";
|
|
12
12
|
import {
|
|
13
13
|
loadAgentsManifest
|
|
14
14
|
} from "./chunk-PMXRGPRQ.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
buildSymbolIndex,
|
|
24
24
|
getReferencesTo,
|
|
25
25
|
searchSymbols
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZGUAAVMA.js";
|
|
27
27
|
|
|
28
28
|
// src/core/orchestrator.ts
|
|
29
29
|
import { minimatch } from "minimatch";
|
|
@@ -566,7 +566,7 @@ var Orchestrator = class {
|
|
|
566
566
|
let preflightResult;
|
|
567
567
|
if (options.pmGovernance?.enabled) {
|
|
568
568
|
try {
|
|
569
|
-
const { aggregateFromDirectory } = await import("./dist-
|
|
569
|
+
const { aggregateFromDirectory } = await import("./dist-UXWV4OKX.js");
|
|
570
570
|
const aggregation = await aggregateFromDirectory(this.rootDir);
|
|
571
571
|
const index = buildSymbolIndex(aggregation);
|
|
572
572
|
preflightResult = runPreflight(task, this.rootDir, index);
|
|
@@ -593,7 +593,7 @@ var Orchestrator = class {
|
|
|
593
593
|
}
|
|
594
594
|
if (options.pmGovernance?.enabled && preflightResult) {
|
|
595
595
|
try {
|
|
596
|
-
const { aggregateFromDirectory } = await import("./dist-
|
|
596
|
+
const { aggregateFromDirectory } = await import("./dist-UXWV4OKX.js");
|
|
597
597
|
const aggregation = await aggregateFromDirectory(this.rootDir);
|
|
598
598
|
const index = buildSymbolIndex(aggregation);
|
|
599
599
|
const filesModified = [];
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-ZXMDA7VB.js";
|
|
3
|
-
|
|
4
|
-
// src/lore-server/index.ts
|
|
5
|
-
import express from "express";
|
|
6
|
-
import * as path4 from "path";
|
|
7
|
-
import * as fs4 from "fs";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
import chalk from "chalk";
|
|
10
2
|
|
|
11
3
|
// src/lore-server/routes/lore.ts
|
|
12
4
|
import { Router } from "express";
|
|
@@ -78,7 +70,7 @@ function createLoreRouter(projectDir) {
|
|
|
78
70
|
const router = Router();
|
|
79
71
|
router.get("/", (req, res) => {
|
|
80
72
|
let entries = loadAllEntries(projectDir);
|
|
81
|
-
const { author, authorType, hasAgent, symbol, type, tag, from, to, tags, hasReview, hasBody, limit, offset } = req.query;
|
|
73
|
+
const { author, authorType, hasAgent, symbol, type, tag, from, to, tags, hasReview, hasBody, hasConfidence, hasAssessment, limit, offset } = req.query;
|
|
82
74
|
if (author) {
|
|
83
75
|
entries = entries.filter((e) => e.author === author);
|
|
84
76
|
}
|
|
@@ -127,6 +119,16 @@ function createLoreRouter(projectDir) {
|
|
|
127
119
|
} else if (hasReview === "false") {
|
|
128
120
|
entries = entries.filter((e) => e.review == null);
|
|
129
121
|
}
|
|
122
|
+
if (hasConfidence === "true") {
|
|
123
|
+
entries = entries.filter((e) => e.confidence != null);
|
|
124
|
+
} else if (hasConfidence === "false") {
|
|
125
|
+
entries = entries.filter((e) => e.confidence == null);
|
|
126
|
+
}
|
|
127
|
+
if (hasAssessment === "true") {
|
|
128
|
+
entries = entries.filter((e) => e.assessment != null);
|
|
129
|
+
} else if (hasAssessment === "false") {
|
|
130
|
+
entries = entries.filter((e) => e.assessment == null);
|
|
131
|
+
}
|
|
130
132
|
entries.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
|
131
133
|
const off = parseInt(offset || "0", 10);
|
|
132
134
|
const lim = parseInt(limit || "100", 10);
|
|
@@ -195,6 +197,37 @@ function createLoreRouter(projectDir) {
|
|
|
195
197
|
const authors = Object.entries(authorMap).map(([id, info]) => ({ id, ...info })).sort((a, b) => b.count - a.count);
|
|
196
198
|
res.json({ authors });
|
|
197
199
|
});
|
|
200
|
+
router.get("/calibration", (_req, res) => {
|
|
201
|
+
const entries = loadAllEntries(projectDir).filter((e) => e.assessment != null);
|
|
202
|
+
const withConfidence = entries.filter((e) => e.confidence != null);
|
|
203
|
+
const totalAssessed = entries.length;
|
|
204
|
+
const totalWithConfidence = withConfidence.length;
|
|
205
|
+
const verdictBreakdown = { correct: 0, partial: 0, incorrect: 0 };
|
|
206
|
+
let totalImpliedScore = 0;
|
|
207
|
+
let totalConfidence = 0;
|
|
208
|
+
let totalAbsDelta = 0;
|
|
209
|
+
for (const e of entries) {
|
|
210
|
+
const v = e.assessment.verdict;
|
|
211
|
+
verdictBreakdown[v]++;
|
|
212
|
+
const implied = v === "correct" ? 1 : v === "partial" ? 0.5 : 0;
|
|
213
|
+
totalImpliedScore += implied;
|
|
214
|
+
if (e.confidence != null) {
|
|
215
|
+
totalConfidence += e.confidence;
|
|
216
|
+
totalAbsDelta += Math.abs(implied - e.confidence);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
const accuracyRate = totalAssessed > 0 ? totalImpliedScore / totalAssessed : 0;
|
|
220
|
+
const avgConfidence = totalWithConfidence > 0 ? totalConfidence / totalWithConfidence : null;
|
|
221
|
+
const calibrationScore = totalWithConfidence > 0 ? 1 - totalAbsDelta / totalWithConfidence : null;
|
|
222
|
+
res.json({
|
|
223
|
+
totalAssessed,
|
|
224
|
+
totalWithConfidence,
|
|
225
|
+
accuracyRate: Math.round(accuracyRate * 1e3) / 1e3,
|
|
226
|
+
avgConfidence: avgConfidence != null ? Math.round(avgConfidence * 1e3) / 1e3 : null,
|
|
227
|
+
calibrationScore: calibrationScore != null ? Math.round(calibrationScore * 1e3) / 1e3 : null,
|
|
228
|
+
verdictBreakdown
|
|
229
|
+
});
|
|
230
|
+
});
|
|
198
231
|
router.get("/:id", (req, res) => {
|
|
199
232
|
const entries = loadAllEntries(projectDir);
|
|
200
233
|
const entry = entries.find((e) => e.id === req.params.id);
|
|
@@ -204,6 +237,38 @@ function createLoreRouter(projectDir) {
|
|
|
204
237
|
}
|
|
205
238
|
res.json(entry);
|
|
206
239
|
});
|
|
240
|
+
router.put("/:id/assess", (req, res) => {
|
|
241
|
+
const entryId = req.params.id;
|
|
242
|
+
const entries = loadAllEntries(projectDir);
|
|
243
|
+
const entry = entries.find((e) => e.id === entryId);
|
|
244
|
+
if (!entry) {
|
|
245
|
+
res.status(404).json({ error: "Entry not found" });
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const dateStr = entry.timestamp.slice(0, 10);
|
|
249
|
+
const entryPath = resolveEntryPath(projectDir, dateStr, entryId);
|
|
250
|
+
if (!entryPath) {
|
|
251
|
+
res.status(404).json({ error: "Entry file not found" });
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const verdict = req.body.verdict;
|
|
255
|
+
if (!["correct", "partial", "incorrect"].includes(verdict)) {
|
|
256
|
+
res.status(400).json({ error: "Invalid verdict. Must be: correct, partial, incorrect" });
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
entry.assessment = {
|
|
260
|
+
verdict,
|
|
261
|
+
assessed_by: req.body.assessed_by || "anonymous",
|
|
262
|
+
assessed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
263
|
+
notes: req.body.notes
|
|
264
|
+
};
|
|
265
|
+
if (entry.confidence != null) {
|
|
266
|
+
const impliedScore = verdict === "correct" ? 1 : verdict === "partial" ? 0.5 : 0;
|
|
267
|
+
entry.assessment_delta = impliedScore - entry.confidence;
|
|
268
|
+
}
|
|
269
|
+
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
270
|
+
res.json({ success: true, entry });
|
|
271
|
+
});
|
|
207
272
|
router.put("/:id/review", (req, res) => {
|
|
208
273
|
const entryId = req.params.id;
|
|
209
274
|
const entries = loadAllEntries(projectDir);
|
|
@@ -415,108 +480,8 @@ function createSessionsRouter(projectDir) {
|
|
|
415
480
|
return router;
|
|
416
481
|
}
|
|
417
482
|
|
|
418
|
-
// src/lore-server/index.ts
|
|
419
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
420
|
-
var __dirname = path4.dirname(__filename);
|
|
421
|
-
var log = {
|
|
422
|
-
component(name) {
|
|
423
|
-
const symbol = chalk.magenta(`#${name}`);
|
|
424
|
-
return {
|
|
425
|
-
info: (msg, data) => {
|
|
426
|
-
const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
|
|
427
|
-
console.log(`${chalk.blue("i")} ${symbol} ${msg}${dataStr}`);
|
|
428
|
-
},
|
|
429
|
-
success: (msg, data) => {
|
|
430
|
-
const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
|
|
431
|
-
console.log(`${chalk.green("+")} ${symbol} ${msg}${dataStr}`);
|
|
432
|
-
},
|
|
433
|
-
warn: (msg, data) => {
|
|
434
|
-
const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
|
|
435
|
-
console.log(`${chalk.yellow("!")} ${symbol} ${msg}${dataStr}`);
|
|
436
|
-
},
|
|
437
|
-
error: (msg, data) => {
|
|
438
|
-
const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
|
|
439
|
-
console.error(`${chalk.red("x")} ${symbol} ${msg}${dataStr}`);
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
function createLoreApp(options) {
|
|
445
|
-
const app = express();
|
|
446
|
-
app.use(express.json());
|
|
447
|
-
app.use((_req, res, next) => {
|
|
448
|
-
res.header("Access-Control-Allow-Origin", "*");
|
|
449
|
-
res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
450
|
-
res.header("Access-Control-Allow-Headers", "Content-Type");
|
|
451
|
-
if (_req.method === "OPTIONS") {
|
|
452
|
-
res.sendStatus(204);
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
next();
|
|
456
|
-
});
|
|
457
|
-
app.use("/api/lore", createLoreRouter(options.projectDir));
|
|
458
|
-
app.use("/api/info", createInfoRouter(options.projectDir));
|
|
459
|
-
app.use("/api/sessions", createSessionsRouter(options.projectDir));
|
|
460
|
-
app.get("/api/health", (_req, res) => {
|
|
461
|
-
res.json({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
462
|
-
});
|
|
463
|
-
let uiDistPath = path4.join(__dirname, "..", "lore-ui", "dist");
|
|
464
|
-
if (!fs4.existsSync(uiDistPath)) {
|
|
465
|
-
uiDistPath = path4.join(__dirname, "..", "..", "lore-ui", "dist");
|
|
466
|
-
}
|
|
467
|
-
if (fs4.existsSync(uiDistPath)) {
|
|
468
|
-
app.use(express.static(uiDistPath));
|
|
469
|
-
app.get("{*path}", (req, res) => {
|
|
470
|
-
if (!req.path.startsWith("/api")) {
|
|
471
|
-
res.sendFile(path4.join(uiDistPath, "index.html"));
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
} else {
|
|
475
|
-
app.get("/", (_req, res) => {
|
|
476
|
-
res.send(`
|
|
477
|
-
<html>
|
|
478
|
-
<head><title>Paradigm Lore</title></head>
|
|
479
|
-
<body style="background:#0a0a0f;color:#e2e8f0;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
|
|
480
|
-
<div style="text-align:center">
|
|
481
|
-
<h1>Paradigm Lore</h1>
|
|
482
|
-
<p style="color:#94a3b8">UI not built yet. Run <code style="background:#1e293b;padding:4px 8px;border-radius:4px">cd lore-ui && npx vite build</code></p>
|
|
483
|
-
<p style="color:#94a3b8">API available at <a href="/api/lore" style="color:#7dd3fc">/api/lore</a></p>
|
|
484
|
-
</div>
|
|
485
|
-
</body>
|
|
486
|
-
</html>
|
|
487
|
-
`);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
return app;
|
|
491
|
-
}
|
|
492
|
-
async function startLoreServer(options) {
|
|
493
|
-
const app = createLoreApp(options);
|
|
494
|
-
log.component("lore-server").info("Starting server", { port: options.port });
|
|
495
|
-
log.component("lore-server").info("Project directory", { path: options.projectDir });
|
|
496
|
-
return new Promise((resolve, reject) => {
|
|
497
|
-
const server = app.listen(options.port, () => {
|
|
498
|
-
log.component("lore-server").success("Server running", { url: `http://localhost:${options.port}` });
|
|
499
|
-
if (options.open) {
|
|
500
|
-
import("open").then((openModule) => {
|
|
501
|
-
openModule.default(`http://localhost:${options.port}`);
|
|
502
|
-
log.component("lore-server").info("Opened browser");
|
|
503
|
-
}).catch(() => {
|
|
504
|
-
log.component("lore-server").warn("Could not open browser automatically");
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
resolve();
|
|
508
|
-
});
|
|
509
|
-
server.on("error", (err) => {
|
|
510
|
-
if (err.code === "EADDRINUSE") {
|
|
511
|
-
log.component("lore-server").error("Port already in use", { port: options.port });
|
|
512
|
-
} else {
|
|
513
|
-
log.component("lore-server").error("Server error", { error: err.message });
|
|
514
|
-
}
|
|
515
|
-
reject(err);
|
|
516
|
-
});
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
483
|
export {
|
|
520
|
-
|
|
521
|
-
|
|
484
|
+
createLoreRouter,
|
|
485
|
+
createInfoRouter,
|
|
486
|
+
createSessionsRouter
|
|
522
487
|
};
|