progmune-runtime 2.0.2 → 2.1.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/.mcp.json +11 -0
- package/.progmune_allowlist +50 -0
- package/.test_report/test_report.md +87 -0
- package/Dockerfile +2 -10
- package/FAQ.md +167 -0
- package/demo-project/auth.ts +55 -0
- package/demo-project/tsconfig.json +8 -0
- package/dist/ab-stats.js +11 -0
- package/dist/acl-breakdown.js +13 -0
- package/dist/all-sessions.js +11 -0
- package/dist/antibody-stats.js +11 -0
- package/dist/audit.js +218 -0
- package/dist/benchmark-count.js +7 -0
- package/dist/benchmark-full.js +17 -0
- package/dist/benchmark-pass-rate.js +54 -0
- package/dist/benchmark-report.js +67 -0
- package/dist/benchmark-save.js +62 -0
- package/dist/benchmark-status.js +15 -0
- package/dist/branch-ledger.js +365 -0
- package/dist/branch-tree-count.js +14 -0
- package/dist/check.js +506 -0
- package/dist/common-fixpath.js +12 -0
- package/dist/constraint-types.js +12 -0
- package/dist/deterministic-replay.js +277 -0
- package/dist/emitter.js +112 -12
- package/dist/exec-metrics.js +11 -0
- package/dist/execute.js +242 -0
- package/dist/extract-ir.js +550 -5
- package/dist/failure-collector.js +143 -0
- package/dist/failure-corpus.js +481 -35
- package/dist/failure-report.js +11 -0
- package/dist/failures.js +11 -0
- package/dist/fast-path-hits.js +13 -0
- package/dist/feedback.js +6 -3
- package/dist/file-lock.js +82 -0
- package/dist/find-session.js +10 -0
- package/dist/fingerprint-list.js +15 -0
- package/dist/gen-history-log.js +13 -0
- package/dist/generate.js +2 -1
- package/dist/generate_500.js +4 -2
- package/dist/genome.js +11 -0
- package/dist/heatmap-data.js +11 -0
- package/dist/heatmap.js +11 -0
- package/dist/immune-reporter.js +137 -0
- package/dist/learned.js +11 -0
- package/dist/ledger-registry.js +241 -0
- package/dist/llm.js +43 -2
- package/dist/load-benchmarks.js +47 -0
- package/dist/main.js +2 -1
- package/dist/mcp-server.mjs +446 -34
- package/dist/memory-layer.js +51 -13
- package/dist/metrics.js +11 -0
- package/dist/obs-web.js +561 -0
- package/dist/p0_ssg_demo.js +255 -40
- package/dist/planner.js +933 -65
- package/dist/protocol-registry.js +105 -0
- package/dist/recent-session.js +12 -0
- package/dist/repair-proposal.js +353 -0
- package/dist/report.js +32 -0
- package/dist/runtime-invariants.js +161 -0
- package/dist/runtime-types.js +117 -0
- package/dist/search-planner.js +38 -9
- package/dist/semantic-snapshot.js +155 -0
- package/dist/semantic-trace.js +1497 -0
- package/dist/semantic-validator.js +3 -2
- package/dist/semantic_guard_test.js +2 -1
- package/dist/sessions.js +11 -0
- package/dist/ssg-validator.js +658 -20
- package/dist/svl-distribution.js +11 -0
- package/dist/terminal-status.js +11 -0
- package/dist/test_failure_corpus.js +3 -1
- package/dist/token-savings.js +11 -0
- package/dist/total-repairs.js +12 -0
- package/dist/unresolved-count.js +12 -0
- package/dist/valid-fingerprints.js +13 -0
- package/dist/validator.js +116 -60
- package/dist/verify-fps.js +11 -0
- package/dist/verify-ledgers.js +11 -0
- package/docs/whitepaper-style.css +77 -0
- package/docs/whitepaper-v2.1.md +609 -0
- package/docs/whitepaper-v2.2.md +1064 -0
- package/docs/whitepaper-v2.2.pdf +0 -0
- package/fly.toml +1 -1
- package/package.json +13 -4
- package/protocols.json +136 -0
- package/public/dashboard.html +119 -0
- package/readme.md +829 -0
- package/server/hub.js +84 -12
- package/test/replay-golden/sess_1780063202050_mgeld.json +9 -0
- package/test/replay-golden/sess_1780064032560_gocld.json +354 -0
- package/test/replay-golden/sess_1780064413331_s2709.json +606 -0
- package/test/replay-golden/sess_1780064792710_y3avo.json +614 -0
- package/test/replay-golden.ts +84 -0
- package/test_benchmark.js +165 -0
- package/test_comprehensive.mjs +638 -0
- package/test_concurrency.js +129 -0
- package/test_ir_robustness.js +85 -0
- package/test_semantic_contracts.js +269 -0
- package/test_ssg_stress.js +156 -0
- package/test_svl3.js +58 -0
- package/tsconfig.json +1 -1
- package/.env.example +0 -3
- package/.progmune_memory/fingerprints.json +0 -7
- package/.progmune_memory/opt_in.json +0 -4
- package/README.md +0 -118
- package/dist/mcp-server.js +0 -55
- package/immune_hub_data/2026-05-14.json +0 -50
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Phase 7: Failure Corpus — collect and categorize emitter failures.
|
|
4
|
+
*
|
|
5
|
+
* Records every failed progmune_execute attempt with root cause classification.
|
|
6
|
+
* Feeds the Emitter Intelligence loop: collect → classify → fix → verify.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.classifyError = classifyError;
|
|
43
|
+
exports.classifyPlanError = classifyPlanError;
|
|
44
|
+
exports.recordFailure = recordFailure;
|
|
45
|
+
exports.loadFailures = loadFailures;
|
|
46
|
+
exports.failureStats = failureStats;
|
|
47
|
+
exports.formatFailureStats = formatFailureStats;
|
|
48
|
+
const fs = __importStar(require("fs"));
|
|
49
|
+
const CORPUS_DIR = "failure-corpus";
|
|
50
|
+
/** Classify a compile error string into a root cause. */
|
|
51
|
+
function classifyError(error) {
|
|
52
|
+
if (!error)
|
|
53
|
+
return "F10";
|
|
54
|
+
if (error.includes("declares") && error.includes("locally"))
|
|
55
|
+
return "F01";
|
|
56
|
+
if (error.includes("Cannot find module") || error.includes("has no exported member"))
|
|
57
|
+
return "F02";
|
|
58
|
+
if (error.includes("is not assignable") || error.includes("Type"))
|
|
59
|
+
return "F03";
|
|
60
|
+
if (error.includes("Expected") && error.includes("arguments"))
|
|
61
|
+
return "F04";
|
|
62
|
+
if (error.includes("Cannot find name"))
|
|
63
|
+
return "F06";
|
|
64
|
+
if (error.includes("is not a function") || error.includes("not callable"))
|
|
65
|
+
return "F05";
|
|
66
|
+
if (error.includes("return") && error.includes("type"))
|
|
67
|
+
return "F08";
|
|
68
|
+
return "F10";
|
|
69
|
+
}
|
|
70
|
+
/** Classify a planning failure. */
|
|
71
|
+
function classifyPlanError(error) {
|
|
72
|
+
if (!error)
|
|
73
|
+
return "F10";
|
|
74
|
+
if (error.includes("protocol") || error.includes("SSG"))
|
|
75
|
+
return "F09";
|
|
76
|
+
if (error.includes("Cannot read properties") || error.includes("undefined"))
|
|
77
|
+
return "F07";
|
|
78
|
+
return "F07"; // most plan failures are parsing issues
|
|
79
|
+
}
|
|
80
|
+
/** Record a failure and save to disk. */
|
|
81
|
+
function recordFailure(record) {
|
|
82
|
+
const id = `F-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
83
|
+
const entry = {
|
|
84
|
+
...record,
|
|
85
|
+
id,
|
|
86
|
+
timestamp: Date.now(),
|
|
87
|
+
};
|
|
88
|
+
try {
|
|
89
|
+
if (!fs.existsSync(CORPUS_DIR))
|
|
90
|
+
fs.mkdirSync(CORPUS_DIR, { recursive: true });
|
|
91
|
+
fs.writeFileSync(`${CORPUS_DIR}/${id}.json`, JSON.stringify(entry, null, 2), "utf-8");
|
|
92
|
+
}
|
|
93
|
+
catch { }
|
|
94
|
+
return id;
|
|
95
|
+
}
|
|
96
|
+
/** Load all recorded failures. */
|
|
97
|
+
function loadFailures() {
|
|
98
|
+
if (!fs.existsSync(CORPUS_DIR))
|
|
99
|
+
return [];
|
|
100
|
+
const failures = [];
|
|
101
|
+
for (const f of fs.readdirSync(CORPUS_DIR)) {
|
|
102
|
+
if (!f.endsWith(".json") || f === "schema.json")
|
|
103
|
+
continue;
|
|
104
|
+
try {
|
|
105
|
+
failures.push(JSON.parse(fs.readFileSync(`${CORPUS_DIR}/${f}`, "utf-8")));
|
|
106
|
+
}
|
|
107
|
+
catch { }
|
|
108
|
+
}
|
|
109
|
+
return failures.sort((a, b) => b.timestamp - a.timestamp);
|
|
110
|
+
}
|
|
111
|
+
/** Get failure statistics grouped by root cause. */
|
|
112
|
+
function failureStats() {
|
|
113
|
+
const failures = loadFailures();
|
|
114
|
+
const byRootCause = {};
|
|
115
|
+
for (const f of failures) {
|
|
116
|
+
byRootCause[f.rootCause] = (byRootCause[f.rootCause] || 0) + 1;
|
|
117
|
+
}
|
|
118
|
+
const sorted = Object.entries(byRootCause).sort((a, b) => b[1] - a[1]);
|
|
119
|
+
return {
|
|
120
|
+
total: failures.length,
|
|
121
|
+
byRootCause,
|
|
122
|
+
topCause: sorted.length > 0 ? sorted[0][0] : "none",
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** Format failure stats as readable text. */
|
|
126
|
+
function formatFailureStats() {
|
|
127
|
+
const stats = failureStats();
|
|
128
|
+
if (stats.total === 0)
|
|
129
|
+
return "No failures recorded yet.";
|
|
130
|
+
const lines = [
|
|
131
|
+
`Failure Corpus: ${stats.total} failures`,
|
|
132
|
+
`Top cause: ${stats.topCause}`,
|
|
133
|
+
"",
|
|
134
|
+
];
|
|
135
|
+
const sorted = Object.entries(stats.byRootCause).sort((a, b) => b[1] - a[1]);
|
|
136
|
+
const max = sorted[0]?.[1] || 1;
|
|
137
|
+
for (const [cause, count] of sorted) {
|
|
138
|
+
const bar = "█".repeat(Math.round((count / max) * 20));
|
|
139
|
+
const pct = ((count / stats.total) * 100).toFixed(0) + "%";
|
|
140
|
+
lines.push(` ${cause}: ${bar} ${count} (${pct})`);
|
|
141
|
+
}
|
|
142
|
+
return lines.join("\n");
|
|
143
|
+
}
|