@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
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
BackgroundOrchestrator
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-J26YQVAK.js";
|
|
4
|
+
} from "./chunk-QWA26UNO.js";
|
|
5
|
+
import "./chunk-J4E6K5MG.js";
|
|
7
6
|
import "./chunk-PBHIFAL4.js";
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-FS3WTUHY.js";
|
|
8
|
+
import "./chunk-6QC3YGB6.js";
|
|
9
9
|
import "./chunk-PMXRGPRQ.js";
|
|
10
10
|
import "./chunk-MW5DMGBB.js";
|
|
11
11
|
import "./chunk-5JGJACDU.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ZGUAAVMA.js";
|
|
13
|
+
import "./chunk-EDOAWN7J.js";
|
|
14
14
|
import "./chunk-IRKUEJVW.js";
|
|
15
15
|
import "./chunk-ZXMDA7VB.js";
|
|
16
16
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
rebuildUniversityIndex,
|
|
4
|
+
saveNote,
|
|
5
|
+
saveQuiz
|
|
6
|
+
} from "./chunk-GT5QGC2H.js";
|
|
7
|
+
import "./chunk-ZXMDA7VB.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/university/add.ts
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
import { execSync } from "child_process";
|
|
12
|
+
import * as os from "os";
|
|
13
|
+
function resolveAuthor() {
|
|
14
|
+
try {
|
|
15
|
+
return execSync("git config user.name", { encoding: "utf-8", timeout: 3e3 }).trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").slice(0, 20) || "unknown";
|
|
16
|
+
} catch {
|
|
17
|
+
try {
|
|
18
|
+
return os.userInfo().username;
|
|
19
|
+
} catch {
|
|
20
|
+
return "unknown";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function universityAddCommand(type, options) {
|
|
25
|
+
const rootDir = process.cwd();
|
|
26
|
+
if (!options.title) {
|
|
27
|
+
console.error(chalk.red("\n Error: --title is required\n"));
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const author = resolveAuthor();
|
|
31
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
32
|
+
const slug = options.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
|
|
33
|
+
const tags = options.tags ? options.tags.split(",").map((t) => t.trim()) : [];
|
|
34
|
+
const symbols = options.symbols ? options.symbols.split(",").map((s) => s.trim()) : [];
|
|
35
|
+
if (type === "quiz") {
|
|
36
|
+
const id2 = `Q-${slug}`;
|
|
37
|
+
const quiz = {
|
|
38
|
+
id: id2,
|
|
39
|
+
title: options.title,
|
|
40
|
+
description: options.body || "",
|
|
41
|
+
author,
|
|
42
|
+
created: today,
|
|
43
|
+
updated: today,
|
|
44
|
+
tags,
|
|
45
|
+
symbols,
|
|
46
|
+
difficulty: options.difficulty || "beginner",
|
|
47
|
+
passThreshold: 0.7,
|
|
48
|
+
questions: []
|
|
49
|
+
};
|
|
50
|
+
saveQuiz(rootDir, quiz);
|
|
51
|
+
rebuildUniversityIndex(rootDir);
|
|
52
|
+
console.log(chalk.green(`
|
|
53
|
+
Created quiz: ${id2}`));
|
|
54
|
+
console.log(chalk.gray(" Add questions by editing the YAML file\n"));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const prefix = type === "policy" ? "P" : "N";
|
|
58
|
+
const id = `${prefix}-${slug}`;
|
|
59
|
+
const frontmatter = {
|
|
60
|
+
id,
|
|
61
|
+
title: options.title,
|
|
62
|
+
type,
|
|
63
|
+
author,
|
|
64
|
+
created: today,
|
|
65
|
+
updated: today,
|
|
66
|
+
tags,
|
|
67
|
+
symbols,
|
|
68
|
+
difficulty: options.difficulty || "beginner",
|
|
69
|
+
estimatedMinutes: options.minutes ? parseInt(options.minutes, 10) : void 0,
|
|
70
|
+
prerequisites: []
|
|
71
|
+
};
|
|
72
|
+
saveNote(rootDir, frontmatter, options.body || "");
|
|
73
|
+
rebuildUniversityIndex(rootDir);
|
|
74
|
+
console.log(chalk.green(`
|
|
75
|
+
Created ${type}: ${id}`));
|
|
76
|
+
console.log(chalk.gray(` Edit at .paradigm/university/content/${type === "policy" ? "policies" : "notes"}/${id}.md
|
|
77
|
+
`));
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
universityAddCommand
|
|
81
|
+
};
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
buildSymbolIndex,
|
|
6
6
|
getSymbolCounts,
|
|
7
7
|
parsePremiseFile
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-ZGUAAVMA.js";
|
|
9
|
+
import "./chunk-EDOAWN7J.js";
|
|
10
10
|
import "./chunk-IRKUEJVW.js";
|
|
11
11
|
import "./chunk-ZXMDA7VB.js";
|
|
12
12
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
addAssessment,
|
|
4
|
+
loadLoreEntry
|
|
5
|
+
} from "./chunk-QIOCFXDQ.js";
|
|
6
|
+
import "./chunk-ZXMDA7VB.js";
|
|
7
|
+
|
|
8
|
+
// src/commands/lore/assess.ts
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
async function loreAssessCommand(id, verdict, options) {
|
|
11
|
+
const rootDir = process.cwd();
|
|
12
|
+
const validVerdicts = ["correct", "partial", "incorrect"];
|
|
13
|
+
if (!validVerdicts.includes(verdict)) {
|
|
14
|
+
console.error(chalk.red(`
|
|
15
|
+
Invalid verdict: "${verdict}". Must be one of: correct, partial, incorrect
|
|
16
|
+
`));
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
const entry = await loadLoreEntry(rootDir, id);
|
|
20
|
+
if (!entry) {
|
|
21
|
+
console.error(chalk.red(`
|
|
22
|
+
Entry not found: ${id}
|
|
23
|
+
`));
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const success = await addAssessment(rootDir, id, {
|
|
27
|
+
verdict,
|
|
28
|
+
assessed_by: options.assessor || "unknown",
|
|
29
|
+
assessed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30
|
+
notes: options.notes
|
|
31
|
+
});
|
|
32
|
+
if (success) {
|
|
33
|
+
const verdictColors = {
|
|
34
|
+
correct: chalk.green,
|
|
35
|
+
partial: chalk.yellow,
|
|
36
|
+
incorrect: chalk.red
|
|
37
|
+
};
|
|
38
|
+
const colorFn = verdictColors[verdict] || chalk.white;
|
|
39
|
+
console.log(chalk.green(`
|
|
40
|
+
Assessment recorded for ${id}`));
|
|
41
|
+
console.log(` Verdict: ${colorFn(verdict)}`);
|
|
42
|
+
if (entry.confidence != null) {
|
|
43
|
+
const impliedScore = verdict === "correct" ? 1 : verdict === "partial" ? 0.5 : 0;
|
|
44
|
+
const delta = impliedScore - entry.confidence;
|
|
45
|
+
const deltaStr = `${delta > 0 ? "+" : ""}${delta.toFixed(2)}`;
|
|
46
|
+
const deltaColor = Math.abs(delta) <= 0.1 ? chalk.green : Math.abs(delta) <= 0.3 ? chalk.yellow : chalk.red;
|
|
47
|
+
console.log(` Confidence: ${entry.confidence.toFixed(2)} | Delta: ${deltaColor(deltaStr)}`);
|
|
48
|
+
if (delta > 0.1) {
|
|
49
|
+
console.log(chalk.gray(" Under-confident (outcome better than predicted)"));
|
|
50
|
+
} else if (delta < -0.1) {
|
|
51
|
+
console.log(chalk.gray(" Over-confident (outcome worse than predicted)"));
|
|
52
|
+
} else {
|
|
53
|
+
console.log(chalk.gray(" Well-calibrated"));
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
console.log(chalk.gray(" No confidence recorded \u2014 delta not computed"));
|
|
57
|
+
}
|
|
58
|
+
console.log();
|
|
59
|
+
} else {
|
|
60
|
+
console.error(chalk.red(`
|
|
61
|
+
Failed to assess entry: ${id}
|
|
62
|
+
`));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
loreAssessCommand
|
|
68
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadLoreEntries
|
|
4
|
+
} from "./chunk-QIOCFXDQ.js";
|
|
5
|
+
import "./chunk-ZXMDA7VB.js";
|
|
6
|
+
|
|
7
|
+
// src/commands/lore/calibration.ts
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
async function loreCalibrationCommand(options) {
|
|
10
|
+
const rootDir = process.cwd();
|
|
11
|
+
const entries = await loadLoreEntries(rootDir, {
|
|
12
|
+
symbol: options.symbol,
|
|
13
|
+
tag: options.tag,
|
|
14
|
+
author: options.author,
|
|
15
|
+
hasAssessment: true
|
|
16
|
+
});
|
|
17
|
+
if (entries.length === 0) {
|
|
18
|
+
if (options.json) {
|
|
19
|
+
console.log(JSON.stringify({ totalAssessed: 0, message: "No assessed entries found" }, null, 2));
|
|
20
|
+
} else {
|
|
21
|
+
console.log(chalk.gray("\n No assessed lore entries found.\n"));
|
|
22
|
+
console.log(chalk.gray(" Use `paradigm lore assess <id> <correct|partial|incorrect>` to assess entries.\n"));
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const withConfidence = entries.filter((e) => e.confidence != null);
|
|
27
|
+
const totalAssessed = entries.length;
|
|
28
|
+
const totalWithConfidence = withConfidence.length;
|
|
29
|
+
const verdictBreakdown = { correct: 0, partial: 0, incorrect: 0 };
|
|
30
|
+
let totalImpliedScore = 0;
|
|
31
|
+
let totalConfidence = 0;
|
|
32
|
+
let totalAbsDelta = 0;
|
|
33
|
+
for (const e of entries) {
|
|
34
|
+
const v = e.assessment.verdict;
|
|
35
|
+
verdictBreakdown[v]++;
|
|
36
|
+
const implied = v === "correct" ? 1 : v === "partial" ? 0.5 : 0;
|
|
37
|
+
totalImpliedScore += implied;
|
|
38
|
+
if (e.confidence != null) {
|
|
39
|
+
totalConfidence += e.confidence;
|
|
40
|
+
totalAbsDelta += Math.abs(implied - e.confidence);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const accuracyRate = totalImpliedScore / totalAssessed;
|
|
44
|
+
const avgConfidence = totalWithConfidence > 0 ? totalConfidence / totalWithConfidence : null;
|
|
45
|
+
const calibrationScore = totalWithConfidence > 0 ? 1 - totalAbsDelta / totalWithConfidence : null;
|
|
46
|
+
let groups;
|
|
47
|
+
if (options.groupBy && totalAssessed > 0) {
|
|
48
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
49
|
+
for (const e of entries) {
|
|
50
|
+
let keys = [];
|
|
51
|
+
if (options.groupBy === "symbol") {
|
|
52
|
+
keys = e.symbols_touched || [];
|
|
53
|
+
} else if (options.groupBy === "tag") {
|
|
54
|
+
keys = e.tags || [];
|
|
55
|
+
} else if (options.groupBy === "type") {
|
|
56
|
+
keys = [e.type || "agent-session"];
|
|
57
|
+
}
|
|
58
|
+
for (const key of keys) {
|
|
59
|
+
if (!groupMap.has(key)) groupMap.set(key, []);
|
|
60
|
+
groupMap.get(key).push(e);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
groups = Array.from(groupMap.entries()).map(([key, gEntries]) => {
|
|
64
|
+
const gWithConf = gEntries.filter((e) => e.confidence != null);
|
|
65
|
+
const gBreakdown = { correct: 0, partial: 0, incorrect: 0 };
|
|
66
|
+
let gImplied = 0;
|
|
67
|
+
let gConf = 0;
|
|
68
|
+
let gAbsDelta = 0;
|
|
69
|
+
for (const e of gEntries) {
|
|
70
|
+
const v = e.assessment.verdict;
|
|
71
|
+
gBreakdown[v]++;
|
|
72
|
+
const implied = v === "correct" ? 1 : v === "partial" ? 0.5 : 0;
|
|
73
|
+
gImplied += implied;
|
|
74
|
+
if (e.confidence != null) {
|
|
75
|
+
gConf += e.confidence;
|
|
76
|
+
gAbsDelta += Math.abs(implied - e.confidence);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
key,
|
|
81
|
+
total: gEntries.length,
|
|
82
|
+
accuracyRate: gImplied / gEntries.length,
|
|
83
|
+
avgConfidence: gWithConf.length > 0 ? gConf / gWithConf.length : null,
|
|
84
|
+
calibrationScore: gWithConf.length > 0 ? 1 - gAbsDelta / gWithConf.length : null,
|
|
85
|
+
verdictBreakdown: gBreakdown
|
|
86
|
+
};
|
|
87
|
+
}).sort((a, b) => b.total - a.total);
|
|
88
|
+
}
|
|
89
|
+
if (options.json) {
|
|
90
|
+
console.log(JSON.stringify({
|
|
91
|
+
totalAssessed,
|
|
92
|
+
totalWithConfidence,
|
|
93
|
+
accuracyRate: Math.round(accuracyRate * 1e3) / 1e3,
|
|
94
|
+
avgConfidence: avgConfidence != null ? Math.round(avgConfidence * 1e3) / 1e3 : null,
|
|
95
|
+
calibrationScore: calibrationScore != null ? Math.round(calibrationScore * 1e3) / 1e3 : null,
|
|
96
|
+
verdictBreakdown,
|
|
97
|
+
...groups ? { groups } : {}
|
|
98
|
+
}, null, 2));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const caveat = totalAssessed < 5 ? chalk.gray(` (Low sample: N=${totalAssessed}. Stats may not be representative.)`) : totalAssessed < 15 ? chalk.gray(` (Moderate sample: N=${totalAssessed}. Trends are directional.)`) : "";
|
|
102
|
+
console.log(chalk.magenta(`
|
|
103
|
+
Calibration Report (${totalAssessed} assessed entries)
|
|
104
|
+
`));
|
|
105
|
+
if (caveat) console.log(caveat + "\n");
|
|
106
|
+
const total = totalAssessed;
|
|
107
|
+
console.log(chalk.white(" Verdicts:"));
|
|
108
|
+
console.log(` ${chalk.green("correct")}: ${verdictBreakdown.correct}/${total} (${(verdictBreakdown.correct / total * 100).toFixed(0)}%)`);
|
|
109
|
+
console.log(` ${chalk.yellow("partial")}: ${verdictBreakdown.partial}/${total} (${(verdictBreakdown.partial / total * 100).toFixed(0)}%)`);
|
|
110
|
+
console.log(` ${chalk.red("incorrect")}: ${verdictBreakdown.incorrect}/${total} (${(verdictBreakdown.incorrect / total * 100).toFixed(0)}%)`);
|
|
111
|
+
console.log();
|
|
112
|
+
console.log(chalk.white(" Scores:"));
|
|
113
|
+
const accColor = accuracyRate >= 0.8 ? chalk.green : accuracyRate >= 0.5 ? chalk.yellow : chalk.red;
|
|
114
|
+
console.log(` Accuracy rate: ${accColor(accuracyRate.toFixed(3))}`);
|
|
115
|
+
if (avgConfidence != null) {
|
|
116
|
+
console.log(` Avg confidence: ${avgConfidence.toFixed(3)}`);
|
|
117
|
+
}
|
|
118
|
+
if (calibrationScore != null) {
|
|
119
|
+
const calColor = calibrationScore >= 0.9 ? chalk.green : calibrationScore >= 0.7 ? chalk.yellow : chalk.red;
|
|
120
|
+
console.log(` Calibration: ${calColor(calibrationScore.toFixed(3))} (1.0 = perfect)`);
|
|
121
|
+
}
|
|
122
|
+
console.log();
|
|
123
|
+
if (groups && groups.length > 0) {
|
|
124
|
+
console.log(chalk.white(` By ${options.groupBy}:`));
|
|
125
|
+
for (const g of groups.slice(0, 15)) {
|
|
126
|
+
const gAccColor = g.accuracyRate >= 0.8 ? chalk.green : g.accuracyRate >= 0.5 ? chalk.yellow : chalk.red;
|
|
127
|
+
const calStr = g.calibrationScore != null ? ` cal:${g.calibrationScore.toFixed(2)}` : "";
|
|
128
|
+
console.log(` ${chalk.cyan(g.key.padEnd(25))} ${gAccColor(`acc:${g.accuracyRate.toFixed(2)}`)}${calStr} (${g.verdictBreakdown.correct}/${g.verdictBreakdown.partial}/${g.verdictBreakdown.incorrect}) N=${g.total}`);
|
|
129
|
+
}
|
|
130
|
+
console.log();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
loreCalibrationCommand
|
|
135
|
+
};
|
|
@@ -423,6 +423,96 @@ async function doctorCommand(options = {}) {
|
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
+
const universityDir = path.join(cwd, ".paradigm", "university");
|
|
427
|
+
if (fs.existsSync(universityDir)) {
|
|
428
|
+
try {
|
|
429
|
+
const contentDir = path.join(universityDir, "content");
|
|
430
|
+
let contentCount = 0;
|
|
431
|
+
let issues = 0;
|
|
432
|
+
if (fs.existsSync(contentDir)) {
|
|
433
|
+
for (const subdir of ["notes", "policies", "quizzes", "paths"]) {
|
|
434
|
+
const sd = path.join(contentDir, subdir);
|
|
435
|
+
if (fs.existsSync(sd)) {
|
|
436
|
+
contentCount += fs.readdirSync(sd).filter((f) => f.endsWith(".md") || f.endsWith(".yaml")).length;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (contentCount === 0) {
|
|
441
|
+
results.push({
|
|
442
|
+
name: "University content",
|
|
443
|
+
status: "warn",
|
|
444
|
+
message: "University directory exists but no content found",
|
|
445
|
+
fix: 'Add content: paradigm university add note --title "Getting Started"'
|
|
446
|
+
});
|
|
447
|
+
} else {
|
|
448
|
+
const quizDir = path.join(contentDir, "quizzes");
|
|
449
|
+
if (fs.existsSync(quizDir)) {
|
|
450
|
+
for (const file of fs.readdirSync(quizDir).filter((f) => f.endsWith(".yaml"))) {
|
|
451
|
+
try {
|
|
452
|
+
const { parse } = await import("./dist-PSF5CP4I.js");
|
|
453
|
+
const quiz = parse(fs.readFileSync(path.join(quizDir, file), "utf8"));
|
|
454
|
+
if (quiz?.questions) {
|
|
455
|
+
for (const q of quiz.questions) {
|
|
456
|
+
if (q.choices && q.correct && !(q.correct in q.choices)) {
|
|
457
|
+
issues++;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
} catch {
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const pathDir = path.join(contentDir, "paths");
|
|
466
|
+
if (fs.existsSync(pathDir)) {
|
|
467
|
+
for (const file of fs.readdirSync(pathDir).filter((f) => f.endsWith(".yaml"))) {
|
|
468
|
+
try {
|
|
469
|
+
const { parse } = await import("./dist-PSF5CP4I.js");
|
|
470
|
+
const lp = parse(fs.readFileSync(path.join(pathDir, file), "utf8"));
|
|
471
|
+
if (lp?.steps) {
|
|
472
|
+
for (const step of lp.steps) {
|
|
473
|
+
if (step.content && !step.content.startsWith("plsat:")) {
|
|
474
|
+
let found = false;
|
|
475
|
+
for (const sd of ["notes", "policies", "quizzes", "paths"]) {
|
|
476
|
+
const sdPath = path.join(contentDir, sd);
|
|
477
|
+
if (fs.existsSync(sdPath)) {
|
|
478
|
+
const files = fs.readdirSync(sdPath);
|
|
479
|
+
if (files.some((f) => f.startsWith(step.content))) {
|
|
480
|
+
found = true;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (!found) issues++;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
} catch {
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (issues > 0) {
|
|
494
|
+
results.push({
|
|
495
|
+
name: "University content",
|
|
496
|
+
status: "warn",
|
|
497
|
+
message: `${contentCount} items, ${issues} issue${issues > 1 ? "s" : ""}`,
|
|
498
|
+
fix: "Run: paradigm university validate --deep"
|
|
499
|
+
});
|
|
500
|
+
} else {
|
|
501
|
+
results.push({
|
|
502
|
+
name: "University content",
|
|
503
|
+
status: "ok",
|
|
504
|
+
message: `${contentCount} content item${contentCount > 1 ? "s" : ""}`
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
} catch {
|
|
509
|
+
results.push({
|
|
510
|
+
name: "University content",
|
|
511
|
+
status: "warn",
|
|
512
|
+
message: "Could not read university directory"
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
426
516
|
const hooksJsonPath = path.join(cwd, ".claude", "hooks.json");
|
|
427
517
|
const pluginHooksPath = path.join(cwd, "plugins", "paradigm", "hooks.json");
|
|
428
518
|
if (fs.existsSync(hooksJsonPath)) {
|
|
@@ -543,7 +633,7 @@ async function doctorCommand(options = {}) {
|
|
|
543
633
|
}
|
|
544
634
|
}
|
|
545
635
|
}
|
|
546
|
-
const { runContextAudit } = await import("./context-audit-
|
|
636
|
+
const { runContextAudit } = await import("./context-audit-557EO6PK.js");
|
|
547
637
|
const contextResults = await runContextAudit(cwd, { quiet });
|
|
548
638
|
let contextErrorCount = 0;
|
|
549
639
|
let contextWarnCount = 0;
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-36TKPM5Z.js";
|
|
6
6
|
import {
|
|
7
7
|
aggregateFromDirectory
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZGUAAVMA.js";
|
|
9
9
|
import {
|
|
10
10
|
cliBuildGraphState
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QDXI2DHR.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/scan/navigator.ts
|
|
14
14
|
import * as fs from "fs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
indexCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7COU5S2Z.js";
|
|
5
5
|
import {
|
|
6
6
|
getDefaultPremiseContent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZGUAAVMA.js";
|
|
8
8
|
import {
|
|
9
9
|
getDefaultPurposeContent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EDOAWN7J.js";
|
|
11
11
|
import {
|
|
12
12
|
STACK_PRESETS,
|
|
13
13
|
detectDiscipline,
|
|
@@ -300,10 +300,36 @@ async function updateLoreEntry(rootDir, entryId, partial) {
|
|
|
300
300
|
if (partial.linked_lore !== void 0) entry.linked_lore = partial.linked_lore;
|
|
301
301
|
if (partial.linked_tasks !== void 0) entry.linked_tasks = partial.linked_tasks;
|
|
302
302
|
if (partial.linked_commits !== void 0) entry.linked_commits = partial.linked_commits;
|
|
303
|
+
if (partial.confidence !== void 0) entry.confidence = partial.confidence;
|
|
304
|
+
if (partial.assessment !== void 0) entry.assessment = partial.assessment;
|
|
305
|
+
if (partial.assessment_delta !== void 0) entry.assessment_delta = partial.assessment_delta;
|
|
303
306
|
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
304
307
|
await rebuildTimeline(rootDir);
|
|
305
308
|
return true;
|
|
306
309
|
}
|
|
310
|
+
function verdictToScore(verdict) {
|
|
311
|
+
switch (verdict) {
|
|
312
|
+
case "correct":
|
|
313
|
+
return 1;
|
|
314
|
+
case "partial":
|
|
315
|
+
return 0.5;
|
|
316
|
+
case "incorrect":
|
|
317
|
+
return 0;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
async function addLoreAssessment(rootDir, entryId, assessment) {
|
|
321
|
+
const entry = await loadLoreEntry(rootDir, entryId);
|
|
322
|
+
if (!entry) return false;
|
|
323
|
+
const dateStr = entry.timestamp.slice(0, 10);
|
|
324
|
+
const entryPath = resolveEntryPath(rootDir, dateStr, entryId);
|
|
325
|
+
if (!entryPath) return false;
|
|
326
|
+
entry.assessment = assessment;
|
|
327
|
+
if (entry.confidence != null) {
|
|
328
|
+
entry.assessment_delta = verdictToScore(assessment.verdict) - entry.confidence;
|
|
329
|
+
}
|
|
330
|
+
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
307
333
|
async function deleteLoreEntry(rootDir, entryId) {
|
|
308
334
|
const entry = await loadLoreEntry(rootDir, entryId);
|
|
309
335
|
if (!entry) return false;
|
|
@@ -366,6 +392,12 @@ function applyFilter(entries, filter) {
|
|
|
366
392
|
if (filter.hasReview !== void 0) {
|
|
367
393
|
result = result.filter((e) => filter.hasReview ? e.review != null : e.review == null);
|
|
368
394
|
}
|
|
395
|
+
if (filter.hasConfidence !== void 0) {
|
|
396
|
+
result = result.filter((e) => filter.hasConfidence ? e.confidence != null : e.confidence == null);
|
|
397
|
+
}
|
|
398
|
+
if (filter.hasAssessment !== void 0) {
|
|
399
|
+
result = result.filter((e) => filter.hasAssessment ? e.assessment != null : e.assessment == null);
|
|
400
|
+
}
|
|
369
401
|
result.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
|
370
402
|
if (filter.offset) result = result.slice(filter.offset);
|
|
371
403
|
if (filter.limit) result = result.slice(0, filter.limit);
|
|
@@ -399,5 +431,6 @@ export {
|
|
|
399
431
|
addLoreReview,
|
|
400
432
|
rebuildTimeline,
|
|
401
433
|
updateLoreEntry,
|
|
434
|
+
addLoreAssessment,
|
|
402
435
|
deleteLoreEntry
|
|
403
436
|
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/graph-server/routes/symbols.ts
|
|
4
|
+
import { Router } from "express";
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
function createSymbolsRouter(projectDir) {
|
|
8
|
+
const router = Router();
|
|
9
|
+
router.get("/", (_req, res) => {
|
|
10
|
+
const indexPath = path.join(projectDir, ".paradigm", "scan-index.json");
|
|
11
|
+
if (!fs.existsSync(indexPath)) {
|
|
12
|
+
res.status(404).json({
|
|
13
|
+
error: "scan-index.json not found",
|
|
14
|
+
hint: "Run `paradigm scan` to generate the symbol index."
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const raw = fs.readFileSync(indexPath, "utf-8");
|
|
20
|
+
const index = JSON.parse(raw);
|
|
21
|
+
const categoryMap = {
|
|
22
|
+
components: "component",
|
|
23
|
+
features: "component",
|
|
24
|
+
flows: "flow",
|
|
25
|
+
state: "component",
|
|
26
|
+
gates: "gate",
|
|
27
|
+
signals: "signal",
|
|
28
|
+
aspects: "aspect",
|
|
29
|
+
screens: "component"
|
|
30
|
+
};
|
|
31
|
+
const prefixMap = {
|
|
32
|
+
component: "#",
|
|
33
|
+
flow: "$",
|
|
34
|
+
gate: "^",
|
|
35
|
+
signal: "!",
|
|
36
|
+
aspect: "~"
|
|
37
|
+
};
|
|
38
|
+
const symbols = [];
|
|
39
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const [sectionKey, category] of Object.entries(categoryMap)) {
|
|
41
|
+
const entries = index[sectionKey];
|
|
42
|
+
if (!entries || typeof entries !== "object") continue;
|
|
43
|
+
const items = Array.isArray(entries) ? entries : Object.values(entries);
|
|
44
|
+
for (const entry of items) {
|
|
45
|
+
const name = entry.name || entry.id || "";
|
|
46
|
+
if (!name || seen.has(name)) continue;
|
|
47
|
+
seen.add(name);
|
|
48
|
+
symbols.push({
|
|
49
|
+
id: name,
|
|
50
|
+
name,
|
|
51
|
+
category,
|
|
52
|
+
prefix: prefixMap[category] || "#",
|
|
53
|
+
description: entry.description || "",
|
|
54
|
+
path: entry.path || entry.file || "",
|
|
55
|
+
tags: entry.tags || [],
|
|
56
|
+
related: entry.related || []
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
res.json({
|
|
61
|
+
symbols,
|
|
62
|
+
meta: {
|
|
63
|
+
total: symbols.length,
|
|
64
|
+
projectDir,
|
|
65
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
} catch (err) {
|
|
69
|
+
res.status(500).json({
|
|
70
|
+
error: "Failed to read scan-index.json",
|
|
71
|
+
details: err.message
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return router;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/graph-server/routes/graphs.ts
|
|
79
|
+
import { Router as Router2 } from "express";
|
|
80
|
+
import * as fs2 from "fs";
|
|
81
|
+
import * as path2 from "path";
|
|
82
|
+
var GRAPHS_DIR = ".paradigm/graphs";
|
|
83
|
+
function createGraphsRouter(projectDir) {
|
|
84
|
+
const router = Router2();
|
|
85
|
+
const graphsPath = path2.join(projectDir, GRAPHS_DIR);
|
|
86
|
+
router.get("/", (_req, res) => {
|
|
87
|
+
if (!fs2.existsSync(graphsPath)) {
|
|
88
|
+
res.json({ graphs: [] });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const files = fs2.readdirSync(graphsPath).filter((f) => f.endsWith(".graph.json"));
|
|
93
|
+
const graphs = files.map((file) => {
|
|
94
|
+
const filePath = path2.join(graphsPath, file);
|
|
95
|
+
const stat = fs2.statSync(filePath);
|
|
96
|
+
const slug = file.replace(/\.graph\.json$/, "");
|
|
97
|
+
let name = slug;
|
|
98
|
+
let nodeCount = 0;
|
|
99
|
+
let edgeCount = 0;
|
|
100
|
+
try {
|
|
101
|
+
const raw = JSON.parse(fs2.readFileSync(filePath, "utf8"));
|
|
102
|
+
name = raw.name || slug;
|
|
103
|
+
nodeCount = Array.isArray(raw.nodes) ? raw.nodes.length : 0;
|
|
104
|
+
edgeCount = Array.isArray(raw.edges) ? raw.edges.length : 0;
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
slug,
|
|
109
|
+
file,
|
|
110
|
+
name,
|
|
111
|
+
nodes: nodeCount,
|
|
112
|
+
edges: edgeCount,
|
|
113
|
+
size: stat.size,
|
|
114
|
+
modified: stat.mtime.toISOString()
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
graphs.sort((a, b) => b.modified.localeCompare(a.modified));
|
|
118
|
+
res.json({ graphs });
|
|
119
|
+
} catch (err) {
|
|
120
|
+
res.status(500).json({ error: "Failed to list graphs", details: err.message });
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
router.get("/:slug", (req, res) => {
|
|
124
|
+
const slug = req.params.slug;
|
|
125
|
+
const filePath = path2.join(graphsPath, `${slug}.graph.json`);
|
|
126
|
+
if (!fs2.existsSync(filePath)) {
|
|
127
|
+
res.status(404).json({ error: `Graph "${slug}" not found` });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const raw = fs2.readFileSync(filePath, "utf8");
|
|
132
|
+
res.type("application/json").send(raw);
|
|
133
|
+
} catch (err) {
|
|
134
|
+
res.status(500).json({ error: "Failed to read graph", details: err.message });
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return router;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export {
|
|
141
|
+
createSymbolsRouter,
|
|
142
|
+
createGraphsRouter
|
|
143
|
+
};
|