progmune-runtime 2.0.4 → 2.1.1

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.
Files changed (110) hide show
  1. package/.mcp.json +11 -0
  2. package/.progmune_allowlist +50 -0
  3. package/.test_report/test_report.md +87 -0
  4. package/Dockerfile +2 -10
  5. package/FAQ.md +167 -0
  6. package/README.md +108 -54
  7. package/demo-project/auth.ts +55 -0
  8. package/demo-project/tsconfig.json +8 -0
  9. package/dist/ab-stats.js +11 -0
  10. package/dist/acl-breakdown.js +13 -0
  11. package/dist/action-runtime.js +1 -0
  12. package/dist/all-sessions.js +11 -0
  13. package/dist/antibody-stats.js +11 -0
  14. package/dist/audit.js +222 -0
  15. package/dist/benchmark-count.js +7 -0
  16. package/dist/benchmark-full.js +17 -0
  17. package/dist/benchmark-pass-rate.js +54 -0
  18. package/dist/benchmark-report.js +67 -0
  19. package/dist/benchmark-save.js +62 -0
  20. package/dist/benchmark-status.js +15 -0
  21. package/dist/branch-ledger.js +393 -0
  22. package/dist/branch-tree-count.js +14 -0
  23. package/dist/check.js +506 -0
  24. package/dist/common-fixpath.js +12 -0
  25. package/dist/constraint-types.js +12 -0
  26. package/dist/deterministic-replay.js +283 -0
  27. package/dist/emitter.js +143 -12
  28. package/dist/exec-metrics.js +11 -0
  29. package/dist/execute.js +251 -0
  30. package/dist/extract-ir.js +592 -5
  31. package/dist/failure-collector.js +163 -0
  32. package/dist/failure-corpus.js +507 -35
  33. package/dist/failure-report.js +11 -0
  34. package/dist/failures.js +11 -0
  35. package/dist/fast-path-hits.js +13 -0
  36. package/dist/feedback.js +10 -3
  37. package/dist/file-lock.js +82 -0
  38. package/dist/find-session.js +10 -0
  39. package/dist/fingerprint-list.js +15 -0
  40. package/dist/gen-history-log.js +13 -0
  41. package/dist/generate.js +2 -1
  42. package/dist/generate_500.js +4 -2
  43. package/dist/genome.js +11 -0
  44. package/dist/heatmap-data.js +11 -0
  45. package/dist/heatmap.js +11 -0
  46. package/dist/immune-reporter.js +34 -22
  47. package/dist/ir-utils.js +18 -0
  48. package/dist/learned.js +11 -0
  49. package/dist/ledger-registry.js +252 -0
  50. package/dist/llm.js +46 -2
  51. package/dist/load-benchmarks.js +47 -0
  52. package/dist/main.js +2 -1
  53. package/dist/mcp-server.mjs +445 -43
  54. package/dist/memory-layer.js +54 -13
  55. package/dist/metrics.js +11 -0
  56. package/dist/obs-web.js +561 -0
  57. package/dist/p0_ssg_demo.js +255 -40
  58. package/dist/planner.js +996 -80
  59. package/dist/protocol-registry.js +112 -0
  60. package/dist/recent-session.js +12 -0
  61. package/dist/repair-proposal.js +363 -0
  62. package/dist/runtime-invariants.js +170 -0
  63. package/dist/runtime-types.js +117 -0
  64. package/dist/runtime.js +1 -0
  65. package/dist/search-planner.js +39 -9
  66. package/dist/semantic-snapshot.js +157 -0
  67. package/dist/semantic-trace.js +1497 -0
  68. package/dist/semantic-validator.js +3 -2
  69. package/dist/semantic_guard_test.js +2 -1
  70. package/dist/session-utils.js +19 -0
  71. package/dist/sessions.js +11 -0
  72. package/dist/ssg-validator.js +666 -20
  73. package/dist/svl-distribution.js +11 -0
  74. package/dist/terminal-status.js +11 -0
  75. package/dist/test_failure_corpus.js +3 -1
  76. package/dist/token-savings.js +11 -0
  77. package/dist/total-repairs.js +12 -0
  78. package/dist/unresolved-count.js +12 -0
  79. package/dist/utils.js +2 -0
  80. package/dist/valid-fingerprints.js +13 -0
  81. package/dist/validator.js +118 -60
  82. package/dist/verify-fps.js +11 -0
  83. package/dist/verify-ledgers.js +11 -0
  84. package/docs/whitepaper-style.css +77 -0
  85. package/docs/whitepaper-v2.1.md +609 -0
  86. package/docs/whitepaper-v2.2.md +1064 -0
  87. package/docs/whitepaper-v2.2.pdf +0 -0
  88. package/fly.toml +1 -1
  89. package/package.json +13 -4
  90. package/protocols.json +131 -11
  91. package/public/dashboard.html +119 -0
  92. package/server/hub.js +84 -12
  93. package/test/replay-golden/sess_1780063202050_mgeld.json +9 -0
  94. package/test/replay-golden/sess_1780064032560_gocld.json +354 -0
  95. package/test/replay-golden/sess_1780064413331_s2709.json +606 -0
  96. package/test/replay-golden/sess_1780064792710_y3avo.json +614 -0
  97. package/test/replay-golden.ts +84 -0
  98. package/test_benchmark.js +165 -0
  99. package/test_comprehensive.mjs +638 -0
  100. package/test_concurrency.js +129 -0
  101. package/test_ir_robustness.js +85 -0
  102. package/test_semantic_contracts.js +269 -0
  103. package/test_ssg_stress.js +156 -0
  104. package/test_svl3.js +58 -0
  105. package/tsconfig.json +1 -1
  106. package/.env.example +0 -3
  107. package/.progmune_memory/episodic.json +0 -186
  108. package/.progmune_memory/fingerprints.json +0 -7
  109. package/.progmune_memory/opt_in.json +0 -4
  110. package/immune_hub_data/2026-05-14.json +0 -50
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.main = main;
4
+ // @progmune-generated session=sess_1780343418638_31zut timestamp=2026-06-01T19:50:19.661Z ruleHash=9dec68bc2995e92a
5
+ // Generated with IR constraint: 384 functions, 17 protocol rules
6
+ const failure_corpus_1 = require("./failure-corpus");
7
+ function main() {
8
+ const stats = (0, failure_corpus_1.getAntibodyStats)();
9
+ return stats;
10
+ }
11
+ main();
package/dist/audit.js ADDED
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ /**
3
+ * Phase 4.5: Progmune Audit — 扫描代码库中的 @progmune-generated 标记,统计覆盖率
4
+ *
5
+ * Usage:
6
+ * npx ts-node src/audit.ts <directory>
7
+ * npx ts-node src/audit.ts src/
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.auditDirectory = auditDirectory;
44
+ exports.formatAuditResult = formatAuditResult;
45
+ const fs = __importStar(require("fs"));
46
+ const path = __importStar(require("path"));
47
+ /** Scan a directory recursively for TypeScript files and check for @progmune-generated markers. */
48
+ const DEFAULT_THRESHOLD = 0.8;
49
+ /** Audit a directory for @progmune-generated markers and report coverage. */
50
+ /** @requires DIRECTORY @produces AUDIT_RESULT */
51
+ function auditDirectory(dir, threshold = DEFAULT_THRESHOLD) {
52
+ const result = {
53
+ directory: dir,
54
+ totalFiles: 0,
55
+ progmuneFiles: 0,
56
+ coverage: 0,
57
+ threshold,
58
+ warning: null,
59
+ nonProgmuneFiles: [],
60
+ sessions: [],
61
+ };
62
+ if (!fs.existsSync(dir)) {
63
+ return result;
64
+ }
65
+ const stat = fs.statSync(dir);
66
+ if (!stat.isDirectory()) {
67
+ return result;
68
+ }
69
+ scanDir(dir, dir, result);
70
+ result.coverage = result.totalFiles > 0
71
+ ? result.progmuneFiles / result.totalFiles
72
+ : 0;
73
+ if (result.coverage < result.threshold && result.totalFiles > 0) {
74
+ const pct = (result.coverage * 100).toFixed(0);
75
+ const target = (result.threshold * 100).toFixed(0);
76
+ result.warning = `Coverage ${pct}% below ${target}% threshold. ${result.nonProgmuneFiles.length} file(s) are not @progmune-generated.`;
77
+ }
78
+ // Sort sessions by timestamp (most recent first)
79
+ result.sessions.sort((a, b) => (b.timestamp || "").localeCompare(a.timestamp || ""));
80
+ if (result.sessions.length > 0) {
81
+ result.lastGeneration = result.sessions[0].timestamp;
82
+ }
83
+ return result;
84
+ }
85
+ const MARKER_REGEX = /@progmune-generated\s+session=(\S+)(?:\s+timestamp=(\S+))?(?:\s+ruleHash=(\S+))?/;
86
+ const EXCLUDED_DIRS = new Set(["node_modules", ".git", "dist", ".progmune_corpus", ".progmune_memory"]);
87
+ function scanDir(rootDir, currentDir, result) {
88
+ let entries;
89
+ try {
90
+ entries = fs.readdirSync(currentDir, { withFileTypes: true });
91
+ }
92
+ catch {
93
+ return;
94
+ }
95
+ for (const entry of entries) {
96
+ const fullPath = path.join(currentDir, entry.name);
97
+ if (entry.isDirectory()) {
98
+ if (!EXCLUDED_DIRS.has(entry.name) && !entry.name.startsWith(".")) {
99
+ scanDir(rootDir, fullPath, result);
100
+ }
101
+ continue;
102
+ }
103
+ // Only check TypeScript source files
104
+ if (!entry.name.endsWith(".ts") && !entry.name.endsWith(".tsx") && !entry.name.endsWith(".mjs")) {
105
+ continue;
106
+ }
107
+ result.totalFiles++;
108
+ try {
109
+ const content = fs.readFileSync(fullPath, "utf-8");
110
+ // Only check first 5 lines for the marker (performance)
111
+ const head = content.split("\n").slice(0, 5).join("\n");
112
+ const match = head.match(MARKER_REGEX);
113
+ if (match) {
114
+ result.progmuneFiles++;
115
+ result.sessions.push({
116
+ sessionId: match[1],
117
+ file: path.relative(rootDir, fullPath),
118
+ timestamp: match[2],
119
+ ruleHash: match[3],
120
+ });
121
+ }
122
+ else {
123
+ result.nonProgmuneFiles.push(path.relative(rootDir, fullPath));
124
+ }
125
+ }
126
+ catch {
127
+ // Skip unreadable files
128
+ }
129
+ }
130
+ }
131
+ /** Format audit result as human-readable text. */
132
+ /** Format audit result as human-readable text with coverage statistics. */
133
+ /** @requires AUDIT_RESULT @produces FORMATTED_REPORT */
134
+ function formatAuditResult(result) {
135
+ const pct = (result.coverage * 100).toFixed(1);
136
+ const lines = [];
137
+ lines.push(`Progmune Audit: ${result.directory}`);
138
+ lines.push("═".repeat(56));
139
+ lines.push(` Total source files: ${result.totalFiles}`);
140
+ lines.push(` @progmune-generated: ${result.progmuneFiles} (${pct}%)`);
141
+ lines.push(` Threshold: ${(result.threshold * 100).toFixed(0)}%`);
142
+ if (result.warning) {
143
+ lines.push(` ⚠️ ${result.warning}`);
144
+ }
145
+ lines.push(` Not covered: ${result.nonProgmuneFiles.length}`);
146
+ lines.push("");
147
+ // Phase 7: Execution metrics
148
+ try {
149
+ const { getExecutionMetrics } = require("./execute");
150
+ const m = getExecutionMetrics();
151
+ if (m.generated > 0) {
152
+ const repairRate = m.repaired > 0 ? ` | Repaired: ${m.repaired}` : "";
153
+ lines.push(` Executions: ${m.generated} total${repairRate}`);
154
+ if (m.lastGeneration) {
155
+ lines.push(` Last: ${m.lastGeneration}`);
156
+ }
157
+ if (m.history.length >= 2) {
158
+ const recent = m.history.slice(-5);
159
+ lines.push(` Recent: ${recent.map((r) => r.repaired ? '🔧' : '✅').join(' ')}`);
160
+ }
161
+ lines.push("");
162
+ }
163
+ }
164
+ catch { }
165
+ // Phase 7: Violation Analytics
166
+ try {
167
+ const repairDir = ".progmune_corpus/repairs";
168
+ if (fs.existsSync(repairDir)) {
169
+ const repairs = fs.readdirSync(repairDir).filter((f) => f.endsWith(".json"));
170
+ if (repairs.length > 0) {
171
+ const bySvl = {};
172
+ const byConstraint = {};
173
+ for (const f of repairs) {
174
+ try {
175
+ const r = JSON.parse(fs.readFileSync(`${repairDir}/${f}`, "utf-8"));
176
+ bySvl[r.violation] = (bySvl[r.violation] || 0) + 1;
177
+ byConstraint[r.constraint] = (byConstraint[r.constraint] || 0) + 1;
178
+ }
179
+ catch { }
180
+ }
181
+ lines.push(` Repairs recorded: ${repairs.length}`);
182
+ const svlSummary = Object.entries(bySvl).map(([k, v]) => `${k}: ${v}`).join(" | ");
183
+ lines.push(` By SVL: ${svlSummary}`);
184
+ if (Object.keys(byConstraint).length > 1) {
185
+ const cSummary = Object.entries(byConstraint).map(([k, v]) => `${k}: ${v}`).join(" | ");
186
+ lines.push(` By constraint: ${cSummary}`);
187
+ }
188
+ lines.push("");
189
+ }
190
+ }
191
+ }
192
+ catch { }
193
+ if (result.sessions.length > 0) {
194
+ lines.push(` Last generation: ${result.lastGeneration || "unknown"}`);
195
+ lines.push(` Unique sessions: ${new Set(result.sessions.map(s => s.sessionId)).size}`);
196
+ lines.push("");
197
+ lines.push(" Generated files:");
198
+ for (const s of result.sessions.slice(0, 10)) {
199
+ lines.push(` ${s.file}`);
200
+ }
201
+ if (result.sessions.length > 10) {
202
+ lines.push(` ... and ${result.sessions.length - 10} more`);
203
+ }
204
+ lines.push("");
205
+ }
206
+ if (result.nonProgmuneFiles.length > 0) {
207
+ lines.push(` Files without Progmune marker (${result.nonProgmuneFiles.length}):`);
208
+ for (const f of result.nonProgmuneFiles.slice(0, 20)) {
209
+ lines.push(` ${f}`);
210
+ }
211
+ if (result.nonProgmuneFiles.length > 20) {
212
+ lines.push(` ... and ${result.nonProgmuneFiles.length - 20} more`);
213
+ }
214
+ }
215
+ return lines.join("\n");
216
+ }
217
+ // CLI entry
218
+ if (require.main === module) {
219
+ const dir = process.argv[2] || "src";
220
+ const result = auditDirectory(dir);
221
+ console.log(formatAuditResult(result));
222
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.benchmarkCount = benchmarkCount;
4
+ const load_benchmarks_1 = require("./load-benchmarks");
5
+ function benchmarkCount() {
6
+ return (0, load_benchmarks_1.loadBenchmarks)().length;
7
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.main = main;
4
+ // @progmune-generated session=sess_1780350938098_h5bts timestamp=2026-06-01T21:55:39.709Z ruleHash=9dec68bc2995e92a
5
+ // Generated with IR constraint: 404 functions, 17 protocol rules
6
+ const load_benchmarks_1 = require("./load-benchmarks");
7
+ const benchmark_count_1 = require("./benchmark-count");
8
+ const benchmark_report_1 = require("./benchmark-report");
9
+ const benchmark_save_1 = require("./benchmark-save");
10
+ function main() {
11
+ const benchmarks = (0, load_benchmarks_1.loadBenchmarks)();
12
+ const count = (0, benchmark_count_1.benchmarkCount)();
13
+ const report = (0, benchmark_report_1.benchmarkReport)();
14
+ const savedPath = (0, benchmark_save_1.benchmarkSave)(report);
15
+ return savedPath;
16
+ }
17
+ main();
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.benchmarkPassRate = benchmarkPassRate;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ function benchmarkPassRate() {
40
+ const resultsDir = path.resolve(process.cwd(), "bench");
41
+ if (!fs.existsSync(resultsDir))
42
+ return { total: 0, passed: 0, rate: 0 };
43
+ const files = fs.readdirSync(resultsDir).filter(f => f.startsWith("results-") && f.endsWith(".json"));
44
+ if (files.length === 0)
45
+ return { total: 0, passed: 0, rate: 0 };
46
+ const latest = files.sort().reverse()[0];
47
+ const results = JSON.parse(fs.readFileSync(path.join(resultsDir, latest), "utf-8"));
48
+ const passed = results.filter(r => r.compile_success).length;
49
+ return {
50
+ total: results.length,
51
+ passed,
52
+ rate: results.length > 0 ? passed / results.length : 0,
53
+ };
54
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.benchmarkReport = benchmarkReport;
37
+ /** Format benchmark results as a readable report
38
+ * @protocol pre_states=["BENCHMARKS_LOADED"] post_states=["REPORT_FORMATTED"]
39
+ */
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ function benchmarkReport() {
43
+ const resultsDir = path.resolve(process.cwd(), "bench");
44
+ if (!fs.existsSync(resultsDir))
45
+ return "No benchmark results.";
46
+ const files = fs.readdirSync(resultsDir)
47
+ .filter(f => f.startsWith("results-") && f.endsWith(".json"))
48
+ .sort().reverse();
49
+ if (files.length === 0)
50
+ return "No benchmark results.";
51
+ const latest = files[0];
52
+ const results = JSON.parse(fs.readFileSync(path.join(resultsDir, latest), "utf-8"));
53
+ const passed = results.filter(r => r.compile_success).length;
54
+ const repaired = results.filter(r => r.repair_applied).length;
55
+ const lines = [
56
+ `Benchmark: ${results.length} tasks`,
57
+ `Compiled: ${passed}/${results.length} (${((passed / results.length) * 100).toFixed(1)}%)`,
58
+ `Repaired: ${repaired}`,
59
+ "",
60
+ ];
61
+ for (const r of results) {
62
+ const icon = r.compile_success ? "✅" : "❌";
63
+ const repair = r.repair_applied ? " 🔧" : "";
64
+ lines.push(`${icon} ${r.id}: ${r.intent.slice(0, 60)}${repair}`);
65
+ }
66
+ return lines.join("\n");
67
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.benchmarkSave = benchmarkSave;
37
+ exports.benchmarkLoadLatest = benchmarkLoadLatest;
38
+ /** Save benchmark results to a timestamped file
39
+ * @protocol pre_states=["BENCHMARKS_LOADED"] post_states=["RESULTS_SAVED"]
40
+ */
41
+ const fs = __importStar(require("fs"));
42
+ const path = __importStar(require("path"));
43
+ function benchmarkSave(data) {
44
+ const dir = path.resolve(process.cwd(), "bench");
45
+ if (!fs.existsSync(dir))
46
+ fs.mkdirSync(dir, { recursive: true });
47
+ const ts = Date.now();
48
+ const filePath = path.join(dir, `results-${ts}.json`);
49
+ fs.writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8");
50
+ return filePath;
51
+ }
52
+ function benchmarkLoadLatest() {
53
+ const dir = path.resolve(process.cwd(), "bench");
54
+ if (!fs.existsSync(dir))
55
+ return null;
56
+ const files = fs.readdirSync(dir)
57
+ .filter(f => f.startsWith("results-") && f.endsWith(".json"))
58
+ .sort().reverse();
59
+ if (files.length === 0)
60
+ return null;
61
+ return JSON.parse(fs.readFileSync(path.join(dir, files[0]), "utf-8"));
62
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.main = main;
4
+ // @progmune-generated session=sess_1780350835297_stf8a timestamp=2026-06-01T21:53:57.126Z ruleHash=9dec68bc2995e92a
5
+ // Generated with IR constraint: 401 functions, 17 protocol rules
6
+ const load_benchmarks_1 = require("./load-benchmarks");
7
+ const benchmark_count_1 = require("./benchmark-count");
8
+ const benchmark_report_1 = require("./benchmark-report");
9
+ function main() {
10
+ const tasks = (0, load_benchmarks_1.loadBenchmarks)();
11
+ const count = (0, benchmark_count_1.benchmarkCount)();
12
+ const report = (0, benchmark_report_1.benchmarkReport)();
13
+ return report;
14
+ }
15
+ main();