@aionis/substrate 0.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +201 -0
  3. package/README.md +222 -0
  4. package/dist/backup.d.ts +38 -0
  5. package/dist/backup.d.ts.map +1 -0
  6. package/dist/backup.js +203 -0
  7. package/dist/backup.js.map +1 -0
  8. package/dist/event-log.d.ts +18 -0
  9. package/dist/event-log.d.ts.map +1 -0
  10. package/dist/event-log.js +157 -0
  11. package/dist/event-log.js.map +1 -0
  12. package/dist/file-substrate.d.ts +7 -0
  13. package/dist/file-substrate.d.ts.map +1 -0
  14. package/dist/file-substrate.js +409 -0
  15. package/dist/file-substrate.js.map +1 -0
  16. package/dist/index.d.ts +9 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +9 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/runtime-reference-corpus.d.ts +76 -0
  21. package/dist/runtime-reference-corpus.d.ts.map +1 -0
  22. package/dist/runtime-reference-corpus.js +308 -0
  23. package/dist/runtime-reference-corpus.js.map +1 -0
  24. package/dist/runtime-snapshot-corpus.d.ts +53 -0
  25. package/dist/runtime-snapshot-corpus.d.ts.map +1 -0
  26. package/dist/runtime-snapshot-corpus.js +176 -0
  27. package/dist/runtime-snapshot-corpus.js.map +1 -0
  28. package/dist/runtime-snapshot-importer.d.ts +27 -0
  29. package/dist/runtime-snapshot-importer.d.ts.map +1 -0
  30. package/dist/runtime-snapshot-importer.js +571 -0
  31. package/dist/runtime-snapshot-importer.js.map +1 -0
  32. package/dist/runtime-snapshot-parity.d.ts +40 -0
  33. package/dist/runtime-snapshot-parity.d.ts.map +1 -0
  34. package/dist/runtime-snapshot-parity.js +217 -0
  35. package/dist/runtime-snapshot-parity.js.map +1 -0
  36. package/dist/search.d.ts +3 -0
  37. package/dist/search.d.ts.map +1 -0
  38. package/dist/search.js +157 -0
  39. package/dist/search.js.map +1 -0
  40. package/dist/sqlite-substrate.d.ts +7 -0
  41. package/dist/sqlite-substrate.d.ts.map +1 -0
  42. package/dist/sqlite-substrate.js +666 -0
  43. package/dist/sqlite-substrate.js.map +1 -0
  44. package/dist/types.d.ts +253 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +2 -0
  47. package/dist/types.js.map +1 -0
  48. package/docs/ADAPTER_CONTRACT.md +155 -0
  49. package/docs/API_USAGE.md +225 -0
  50. package/docs/BACKUP_RESTORE.md +108 -0
  51. package/docs/CHECKPOINT_COMPACTION.md +75 -0
  52. package/docs/EXTERNAL_ADMISSION_PARITY.md +98 -0
  53. package/docs/RUNTIME_DUAL_WRITE_EXPERIMENT.md +132 -0
  54. package/docs/RUNTIME_MAPPING.md +69 -0
  55. package/docs/RUNTIME_REFERENCE_CORPUS.md +129 -0
  56. package/docs/RUNTIME_SNAPSHOT_CORPUS.md +81 -0
  57. package/docs/RUNTIME_SNAPSHOT_IMPORT.md +120 -0
  58. package/docs/STORE_CONTRACT.md +181 -0
  59. package/examples/basic/README.md +19 -0
  60. package/examples/basic/index.mjs +112 -0
  61. package/package.json +65 -0
@@ -0,0 +1,308 @@
1
+ import { DatabaseSync } from "node:sqlite";
2
+ import { readdir, readFile, stat, writeFile, mkdir } from "node:fs/promises";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { extractRuntimeReferenceSurfaces, runRuntimeSnapshotParity, } from "./runtime-snapshot-parity.js";
5
+ function emptySurfaces() {
6
+ return {
7
+ use_now: [],
8
+ inspect_before_use: [],
9
+ do_not_use: [],
10
+ rehydrate: [],
11
+ };
12
+ }
13
+ function unique(values) {
14
+ return Array.from(new Set(values.map((value) => value.trim()).filter(Boolean)));
15
+ }
16
+ function surfaceIds(surfaces) {
17
+ return unique([
18
+ ...surfaces.use_now,
19
+ ...surfaces.inspect_before_use,
20
+ ...surfaces.do_not_use,
21
+ ...surfaces.rehydrate,
22
+ ]);
23
+ }
24
+ function mergeSurfaces(target, source) {
25
+ return {
26
+ use_now: unique([...target.use_now, ...source.use_now]),
27
+ inspect_before_use: unique([...target.inspect_before_use, ...source.inspect_before_use]),
28
+ do_not_use: unique([...target.do_not_use, ...source.do_not_use]),
29
+ rehydrate: unique([...target.rehydrate, ...source.rehydrate]),
30
+ };
31
+ }
32
+ function isSqliteLike(path) {
33
+ return /\.(sqlite|sqlite3|db)$/i.test(path);
34
+ }
35
+ function isJsonLike(path) {
36
+ return /\.(json|jsonl)$/i.test(path);
37
+ }
38
+ async function walkFiles(rootPath, predicate) {
39
+ const root = resolve(rootPath);
40
+ const rootStat = await stat(root);
41
+ if (rootStat.isFile())
42
+ return predicate(root) ? [root] : [];
43
+ const out = [];
44
+ async function walk(dir) {
45
+ const entries = await readdir(dir, { withFileTypes: true });
46
+ for (const entry of entries) {
47
+ const fullPath = join(dir, entry.name);
48
+ if (entry.isDirectory()) {
49
+ if (entry.name === "node_modules" || entry.name === ".git")
50
+ continue;
51
+ await walk(fullPath);
52
+ }
53
+ else if (entry.isFile() && predicate(fullPath)) {
54
+ out.push(fullPath);
55
+ }
56
+ }
57
+ }
58
+ await walk(root);
59
+ return out.sort((a, b) => a.localeCompare(b));
60
+ }
61
+ async function findFiles(rootPaths, predicate, warnings) {
62
+ const files = new Set();
63
+ for (const rootPath of rootPaths) {
64
+ try {
65
+ for (const file of await walkFiles(rootPath, predicate))
66
+ files.add(file);
67
+ }
68
+ catch (err) {
69
+ warnings.push(`${rootPath}: failed to scan (${err.message})`);
70
+ }
71
+ }
72
+ return [...files].sort((a, b) => a.localeCompare(b));
73
+ }
74
+ function tableExists(db, tableName) {
75
+ const row = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(tableName);
76
+ return row?.name === tableName;
77
+ }
78
+ function readRuntimeScopes(sourcePath, maxScopesPerFile, minNodes) {
79
+ const db = new DatabaseSync(sourcePath, { readOnly: true });
80
+ try {
81
+ if (!tableExists(db, "lite_memory_nodes"))
82
+ return [];
83
+ const rows = db.prepare(`
84
+ SELECT scope, COUNT(*) AS node_count
85
+ FROM lite_memory_nodes
86
+ GROUP BY scope
87
+ HAVING COUNT(*) >= ?
88
+ ORDER BY node_count DESC, scope ASC
89
+ LIMIT ?
90
+ `).all(minNodes, maxScopesPerFile);
91
+ return rows.map((row) => {
92
+ const idRows = db.prepare(`
93
+ SELECT id
94
+ FROM lite_memory_nodes
95
+ WHERE scope = ?
96
+ ORDER BY id ASC
97
+ `).all(row.scope);
98
+ const ids = new Set(idRows.map((idRow) => idRow.id));
99
+ const idsSample = [...ids].slice(0, 20);
100
+ return {
101
+ source_path: sourcePath,
102
+ scope: row.scope,
103
+ node_count: Number(row.node_count),
104
+ ids,
105
+ ids_sample: idsSample,
106
+ };
107
+ });
108
+ }
109
+ finally {
110
+ db.close();
111
+ }
112
+ }
113
+ async function readReference(path, warnings) {
114
+ try {
115
+ const raw = await readFile(path, "utf8");
116
+ let surfaces = emptySurfaces();
117
+ if (/\.jsonl$/i.test(path)) {
118
+ for (const [index, line] of raw.split(/\r?\n/).entries()) {
119
+ const trimmed = line.trim();
120
+ if (!trimmed)
121
+ continue;
122
+ try {
123
+ surfaces = mergeSurfaces(surfaces, extractRuntimeReferenceSurfaces(JSON.parse(trimmed)));
124
+ }
125
+ catch (err) {
126
+ warnings.push(`${path}:${index + 1}: failed to parse JSONL line (${err.message})`);
127
+ }
128
+ }
129
+ }
130
+ else {
131
+ surfaces = extractRuntimeReferenceSurfaces(JSON.parse(raw));
132
+ }
133
+ const ids = surfaceIds(surfaces);
134
+ return {
135
+ reference_path: path,
136
+ id_count: ids.length,
137
+ ids_sample: ids.slice(0, 20),
138
+ surfaces,
139
+ };
140
+ }
141
+ catch (err) {
142
+ warnings.push(`${path}: failed to read Runtime reference (${err.message})`);
143
+ return null;
144
+ }
145
+ }
146
+ function overlapIds(referenceIds, scope) {
147
+ return referenceIds.filter((id) => scope.ids.has(id));
148
+ }
149
+ function bestScope(referenceIds, scopes) {
150
+ let best = null;
151
+ for (const scope of scopes) {
152
+ const overlap = overlapIds(referenceIds, scope);
153
+ if (!best) {
154
+ best = { scope, overlap };
155
+ continue;
156
+ }
157
+ if (overlap.length > best.overlap.length
158
+ || (overlap.length === best.overlap.length && scope.node_count < best.scope.node_count)
159
+ || (overlap.length === best.overlap.length
160
+ && scope.node_count === best.scope.node_count
161
+ && `${scope.source_path}\u0000${scope.scope}`.localeCompare(`${best.scope.source_path}\u0000${best.scope.scope}`) < 0)) {
162
+ best = { scope, overlap };
163
+ }
164
+ }
165
+ return best;
166
+ }
167
+ export async function runRuntimeReferenceCorpus(options) {
168
+ if (options.sourceRootPaths.length === 0)
169
+ throw new Error("at least one source root is required");
170
+ if (options.referenceRootPaths.length === 0)
171
+ throw new Error("at least one reference root is required");
172
+ const maxSourceFiles = options.maxSourceFiles === undefined ? null : options.maxSourceFiles;
173
+ const maxScopes = options.maxScopes === undefined ? null : options.maxScopes;
174
+ const maxReferences = options.maxReferences === undefined ? null : options.maxReferences;
175
+ const maxScopesPerFile = options.maxScopesPerFile ?? 3;
176
+ const minNodes = options.minNodes ?? 1;
177
+ const minOverlap = options.minOverlap ?? 1;
178
+ const scanWarnings = [];
179
+ const sqliteFiles = await findFiles(options.sourceRootPaths, isSqliteLike, scanWarnings);
180
+ const scopes = [];
181
+ let runtimeSqliteFiles = 0;
182
+ for (const file of sqliteFiles) {
183
+ if (maxSourceFiles !== null && runtimeSqliteFiles >= maxSourceFiles)
184
+ break;
185
+ try {
186
+ const fileScopes = readRuntimeScopes(file, maxScopesPerFile, minNodes);
187
+ if (fileScopes.length === 0)
188
+ continue;
189
+ runtimeSqliteFiles += 1;
190
+ scopes.push(...fileScopes);
191
+ }
192
+ catch (err) {
193
+ scanWarnings.push(`${file}: failed to inspect Runtime scopes (${err.message})`);
194
+ }
195
+ }
196
+ scopes.sort((a, b) => b.node_count - a.node_count || a.source_path.localeCompare(b.source_path) || a.scope.localeCompare(b.scope));
197
+ const selectedScopes = maxScopes === null ? scopes : scopes.slice(0, maxScopes);
198
+ const referenceFiles = await findFiles(options.referenceRootPaths, isJsonLike, scanWarnings);
199
+ const references = [];
200
+ for (const file of referenceFiles) {
201
+ if (maxReferences !== null && references.length >= maxReferences)
202
+ break;
203
+ const reference = await readReference(file, scanWarnings);
204
+ if (reference)
205
+ references.push(reference);
206
+ }
207
+ const withSurfaces = references.filter((reference) => reference.id_count > 0);
208
+ const matchedReports = [];
209
+ const unmatchedReports = references
210
+ .filter((reference) => reference.id_count === 0)
211
+ .map((reference) => ({
212
+ reference_path: reference.reference_path,
213
+ reference_id_count: 0,
214
+ ids_sample: [],
215
+ reason: "no_reference_surface_ids",
216
+ }));
217
+ for (const reference of withSurfaces) {
218
+ const referenceIds = surfaceIds(reference.surfaces);
219
+ const match = bestScope(referenceIds, selectedScopes);
220
+ if (!match || match.overlap.length < minOverlap) {
221
+ unmatchedReports.push({
222
+ reference_path: reference.reference_path,
223
+ reference_id_count: reference.id_count,
224
+ ids_sample: reference.ids_sample,
225
+ reason: "no_runtime_scope_overlap",
226
+ });
227
+ continue;
228
+ }
229
+ try {
230
+ const parityReport = await runRuntimeSnapshotParity({
231
+ sourcePath: match.scope.source_path,
232
+ scope: match.scope.scope,
233
+ referencePath: reference.reference_path,
234
+ maxPerBucket: options.maxPerBucket,
235
+ });
236
+ matchedReports.push({
237
+ reference_path: reference.reference_path,
238
+ source_path: match.scope.source_path,
239
+ scope: match.scope.scope,
240
+ status: "passed",
241
+ reference_id_count: reference.id_count,
242
+ runtime_scope_node_count: match.scope.node_count,
243
+ overlap_count: match.overlap.length,
244
+ overlap_ids_sample: match.overlap.slice(0, 20),
245
+ parity_exact: parityReport.parity.exact,
246
+ bucket_reports: parityReport.parity.bucket_reports,
247
+ error: null,
248
+ });
249
+ }
250
+ catch (err) {
251
+ matchedReports.push({
252
+ reference_path: reference.reference_path,
253
+ source_path: match.scope.source_path,
254
+ scope: match.scope.scope,
255
+ status: "failed",
256
+ reference_id_count: reference.id_count,
257
+ runtime_scope_node_count: match.scope.node_count,
258
+ overlap_count: match.overlap.length,
259
+ overlap_ids_sample: match.overlap.slice(0, 20),
260
+ parity_exact: null,
261
+ bucket_reports: [],
262
+ error: err.message,
263
+ });
264
+ }
265
+ }
266
+ const report = {
267
+ contract_version: "aionis_runtime_reference_corpus_report_v1",
268
+ generated_at: new Date().toISOString(),
269
+ source_roots: options.sourceRootPaths.map((rootPath) => resolve(rootPath)),
270
+ reference_roots: options.referenceRootPaths.map((rootPath) => resolve(rootPath)),
271
+ options: {
272
+ max_source_files: maxSourceFiles,
273
+ max_scopes: maxScopes,
274
+ max_scopes_per_file: maxScopesPerFile,
275
+ max_references: maxReferences,
276
+ min_nodes: minNodes,
277
+ min_overlap: minOverlap,
278
+ max_per_bucket: options.maxPerBucket ?? null,
279
+ },
280
+ discovered_sqlite_files: sqliteFiles.length,
281
+ runtime_sqlite_files: runtimeSqliteFiles,
282
+ candidate_scopes: selectedScopes.map((scope) => ({
283
+ source_path: scope.source_path,
284
+ scope: scope.scope,
285
+ node_count: scope.node_count,
286
+ ids_sample: scope.ids_sample,
287
+ })),
288
+ discovered_reference_files: referenceFiles.length,
289
+ reference_files_with_surfaces: withSurfaces.length,
290
+ reference_files_without_surfaces: references.length - withSurfaces.length,
291
+ matched_references: matchedReports.length,
292
+ unmatched_references: unmatchedReports.length,
293
+ passed_matches: matchedReports.filter((match) => match.status === "passed").length,
294
+ failed_matches: matchedReports.filter((match) => match.status === "failed").length,
295
+ exact_matches: matchedReports.filter((match) => match.parity_exact === true).length,
296
+ partial_matches: matchedReports.filter((match) => match.status === "passed" && match.parity_exact === false).length,
297
+ scan_warnings: scanWarnings,
298
+ matched_reports: matchedReports,
299
+ unmatched_reference_reports: unmatchedReports,
300
+ };
301
+ if (options.outputPath) {
302
+ const outputPath = resolve(options.outputPath);
303
+ await mkdir(dirname(outputPath), { recursive: true });
304
+ await writeFile(outputPath, `${JSON.stringify(report, null, 2)}\n`, "utf8");
305
+ }
306
+ return report;
307
+ }
308
+ //# sourceMappingURL=runtime-reference-corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-reference-corpus.js","sourceRoot":"","sources":["../src/runtime-reference-corpus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,GAGzB,MAAM,8BAA8B,CAAC;AA0FtC,SAAS,aAAa;IACpB,OAAO;QACL,OAAO,EAAE,EAAE;QACX,kBAAkB,EAAE,EAAE;QACtB,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,EAAE;KACd,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,MAAgB;IAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,UAAU,CAAC,QAAkC;IACpD,OAAO,MAAM,CAAC;QACZ,GAAG,QAAQ,CAAC,OAAO;QACnB,GAAG,QAAQ,CAAC,kBAAkB;QAC9B,GAAG,QAAQ,CAAC,UAAU;QACtB,GAAG,QAAQ,CAAC,SAAS;KACtB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,MAAgC,EAAE,MAAgC;IACvF,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QACvD,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,kBAAkB,EAA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EF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,SAAS,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { type RuntimeReferenceSurfaces } from "./runtime-snapshot-parity.ts";
2
+ export type RuntimeSnapshotCorpusScopeCandidate = {
3
+ source_path: string;
4
+ scope: string;
5
+ node_count: number;
6
+ first_created_at: string | null;
7
+ last_created_at: string | null;
8
+ };
9
+ export type RuntimeSnapshotCorpusScopeReport = {
10
+ source_path: string;
11
+ scope: string;
12
+ node_count: number;
13
+ status: "passed" | "failed";
14
+ nodes_imported: number;
15
+ nodes_skipped: number;
16
+ warnings: string[];
17
+ bucket_counts: Record<keyof RuntimeReferenceSurfaces, number>;
18
+ error: string | null;
19
+ };
20
+ export type RuntimeSnapshotCorpusReport = {
21
+ contract_version: "aionis_runtime_snapshot_corpus_report_v1";
22
+ generated_at: string;
23
+ roots: string[];
24
+ options: {
25
+ max_files: number | null;
26
+ max_scopes: number | null;
27
+ max_scopes_per_file: number;
28
+ min_nodes: number;
29
+ max_per_bucket: number | null;
30
+ };
31
+ discovered_sqlite_files: number;
32
+ runtime_sqlite_files: number;
33
+ candidate_scopes: RuntimeSnapshotCorpusScopeCandidate[];
34
+ attempted_scopes: number;
35
+ passed_scopes: number;
36
+ failed_scopes: number;
37
+ total_nodes_imported: number;
38
+ total_nodes_skipped: number;
39
+ total_warnings: number;
40
+ scan_warnings: string[];
41
+ scope_reports: RuntimeSnapshotCorpusScopeReport[];
42
+ };
43
+ export type RuntimeSnapshotCorpusOptions = {
44
+ rootPaths: string[];
45
+ outputPath?: string;
46
+ maxFiles?: number | null;
47
+ maxScopes?: number | null;
48
+ maxScopesPerFile?: number;
49
+ minNodes?: number;
50
+ maxPerBucket?: number;
51
+ };
52
+ export declare function runRuntimeSnapshotCorpus(options: RuntimeSnapshotCorpusOptions): Promise<RuntimeSnapshotCorpusReport>;
53
+ //# sourceMappingURL=runtime-snapshot-corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-snapshot-corpus.d.ts","sourceRoot":"","sources":["../src/runtime-snapshot-corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4B,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAEvG,MAAM,MAAM,mCAAmC,GAAG;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC,MAAM,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAC9D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,0CAA0C,CAAC;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,mBAAmB,EAAE,MAAM,CAAC;QAC5B,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;IACF,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,mCAAmC,EAAE,CAAC;IACxD,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,gCAAgC,EAAE,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAyFF,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CA2F1H"}
@@ -0,0 +1,176 @@
1
+ import { DatabaseSync } from "node:sqlite";
2
+ import { readdir, stat, writeFile, mkdir } from "node:fs/promises";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { runRuntimeSnapshotParity } from "./runtime-snapshot-parity.js";
5
+ function tableExists(db, tableName) {
6
+ const row = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(tableName);
7
+ return row?.name === tableName;
8
+ }
9
+ function isSqliteLike(path) {
10
+ return /\.(sqlite|sqlite3|db)$/i.test(path);
11
+ }
12
+ async function walkSqliteFiles(rootPath) {
13
+ const root = resolve(rootPath);
14
+ const rootStat = await stat(root);
15
+ if (rootStat.isFile())
16
+ return isSqliteLike(root) ? [root] : [];
17
+ const out = [];
18
+ async function walk(dir) {
19
+ const entries = await readdir(dir, { withFileTypes: true });
20
+ for (const entry of entries) {
21
+ const fullPath = join(dir, entry.name);
22
+ if (entry.isDirectory()) {
23
+ if (entry.name === "node_modules" || entry.name === ".git")
24
+ continue;
25
+ await walk(fullPath);
26
+ }
27
+ else if (entry.isFile() && isSqliteLike(fullPath)) {
28
+ out.push(fullPath);
29
+ }
30
+ }
31
+ }
32
+ await walk(root);
33
+ return out.sort((a, b) => a.localeCompare(b));
34
+ }
35
+ async function findSqliteFiles(rootPaths, warnings) {
36
+ const files = new Set();
37
+ for (const rootPath of rootPaths) {
38
+ try {
39
+ for (const file of await walkSqliteFiles(rootPath))
40
+ files.add(file);
41
+ }
42
+ catch (err) {
43
+ warnings.push(`${rootPath}: failed to scan (${err.message})`);
44
+ }
45
+ }
46
+ return [...files].sort((a, b) => a.localeCompare(b));
47
+ }
48
+ function readScopeCandidates(sourcePath, maxScopesPerFile, minNodes) {
49
+ const db = new DatabaseSync(sourcePath, { readOnly: true });
50
+ try {
51
+ if (!tableExists(db, "lite_memory_nodes"))
52
+ return [];
53
+ const rows = db.prepare(`
54
+ SELECT
55
+ scope,
56
+ COUNT(*) AS node_count,
57
+ MIN(created_at) AS first_created_at,
58
+ MAX(created_at) AS last_created_at
59
+ FROM lite_memory_nodes
60
+ GROUP BY scope
61
+ HAVING COUNT(*) >= ?
62
+ ORDER BY node_count DESC, scope ASC
63
+ LIMIT ?
64
+ `).all(minNodes, maxScopesPerFile);
65
+ return rows.map((row) => ({
66
+ source_path: sourcePath,
67
+ scope: row.scope,
68
+ node_count: Number(row.node_count),
69
+ first_created_at: row.first_created_at,
70
+ last_created_at: row.last_created_at,
71
+ }));
72
+ }
73
+ finally {
74
+ db.close();
75
+ }
76
+ }
77
+ function countBuckets(surfaces) {
78
+ return {
79
+ use_now: surfaces.use_now.length,
80
+ inspect_before_use: surfaces.inspect_before_use.length,
81
+ do_not_use: surfaces.do_not_use.length,
82
+ rehydrate: surfaces.rehydrate.length,
83
+ };
84
+ }
85
+ export async function runRuntimeSnapshotCorpus(options) {
86
+ if (options.rootPaths.length === 0)
87
+ throw new Error("at least one root path is required");
88
+ const maxFiles = options.maxFiles === undefined ? null : options.maxFiles;
89
+ const maxScopes = options.maxScopes === undefined ? null : options.maxScopes;
90
+ const maxScopesPerFile = options.maxScopesPerFile ?? 3;
91
+ const minNodes = options.minNodes ?? 1;
92
+ const scanWarnings = [];
93
+ const sqliteFiles = await findSqliteFiles(options.rootPaths, scanWarnings);
94
+ const candidateScopes = [];
95
+ let runtimeSqliteFiles = 0;
96
+ for (const file of sqliteFiles) {
97
+ if (maxFiles !== null && runtimeSqliteFiles >= maxFiles)
98
+ break;
99
+ try {
100
+ const scopes = readScopeCandidates(file, maxScopesPerFile, minNodes);
101
+ if (scopes.length === 0)
102
+ continue;
103
+ runtimeSqliteFiles += 1;
104
+ candidateScopes.push(...scopes);
105
+ }
106
+ catch (err) {
107
+ scanWarnings.push(`${file}: failed to inspect Runtime scopes (${err.message})`);
108
+ }
109
+ }
110
+ candidateScopes.sort((a, b) => b.node_count - a.node_count || a.source_path.localeCompare(b.source_path) || a.scope.localeCompare(b.scope));
111
+ const selectedScopes = maxScopes === null ? candidateScopes : candidateScopes.slice(0, maxScopes);
112
+ const scopeReports = [];
113
+ for (const candidate of selectedScopes) {
114
+ try {
115
+ const report = await runRuntimeSnapshotParity({
116
+ sourcePath: candidate.source_path,
117
+ scope: candidate.scope,
118
+ maxPerBucket: options.maxPerBucket,
119
+ });
120
+ scopeReports.push({
121
+ source_path: candidate.source_path,
122
+ scope: candidate.scope,
123
+ node_count: candidate.node_count,
124
+ status: "passed",
125
+ nodes_imported: report.import_summary.nodesImported,
126
+ nodes_skipped: report.import_summary.nodesSkipped,
127
+ warnings: report.import_summary.warnings,
128
+ bucket_counts: countBuckets(report.substrate_context),
129
+ error: null,
130
+ });
131
+ }
132
+ catch (err) {
133
+ scopeReports.push({
134
+ source_path: candidate.source_path,
135
+ scope: candidate.scope,
136
+ node_count: candidate.node_count,
137
+ status: "failed",
138
+ nodes_imported: 0,
139
+ nodes_skipped: 0,
140
+ warnings: [],
141
+ bucket_counts: { use_now: 0, inspect_before_use: 0, do_not_use: 0, rehydrate: 0 },
142
+ error: err.message,
143
+ });
144
+ }
145
+ }
146
+ const report = {
147
+ contract_version: "aionis_runtime_snapshot_corpus_report_v1",
148
+ generated_at: new Date().toISOString(),
149
+ roots: options.rootPaths.map((rootPath) => resolve(rootPath)),
150
+ options: {
151
+ max_files: maxFiles,
152
+ max_scopes: maxScopes,
153
+ max_scopes_per_file: maxScopesPerFile,
154
+ min_nodes: minNodes,
155
+ max_per_bucket: options.maxPerBucket ?? null,
156
+ },
157
+ discovered_sqlite_files: sqliteFiles.length,
158
+ runtime_sqlite_files: runtimeSqliteFiles,
159
+ candidate_scopes: candidateScopes,
160
+ attempted_scopes: scopeReports.length,
161
+ passed_scopes: scopeReports.filter((scope) => scope.status === "passed").length,
162
+ failed_scopes: scopeReports.filter((scope) => scope.status === "failed").length,
163
+ total_nodes_imported: scopeReports.reduce((sum, scope) => sum + scope.nodes_imported, 0),
164
+ total_nodes_skipped: scopeReports.reduce((sum, scope) => sum + scope.nodes_skipped, 0),
165
+ total_warnings: scanWarnings.length + scopeReports.reduce((sum, scope) => sum + scope.warnings.length, 0),
166
+ scan_warnings: scanWarnings,
167
+ scope_reports: scopeReports,
168
+ };
169
+ if (options.outputPath) {
170
+ const outputPath = resolve(options.outputPath);
171
+ await mkdir(dirname(outputPath), { recursive: true });
172
+ await writeFile(outputPath, `${JSON.stringify(report, null, 2)}\n`, "utf8");
173
+ }
174
+ return report;
175
+ }
176
+ //# sourceMappingURL=runtime-snapshot-corpus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-snapshot-corpus.js","sourceRoot":"","sources":["../src/runtime-snapshot-corpus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAiC,MAAM,8BAA8B,CAAC;AA+DvG,SAAS,WAAW,CAAC,EAAgB,EAAE,SAAiB;IACtD,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,kEAAkE,CAAC,CAAC,GAAG,CAAC,SAAS,CAAkC,CAAC;IAC3I,OAAO,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,QAAgB;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,MAAM,EAAE;QAAE,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/D,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,UAAU,IAAI,CAAC,GAAW;QAC7B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,KAAK,MAAM,KAAK,IAAI,OA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AY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACzG,aAAa,EAAE,YAAY;QAC3B,aAAa,EAAE,YAAY;KAC5B,CAAC;IAEF,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,SAAS,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { AionisSubstrate } from "./types.ts";
2
+ export type RuntimeSnapshotImportOptions = {
3
+ sourcePath: string;
4
+ target: AionisSubstrate;
5
+ scope?: string;
6
+ limit?: number;
7
+ };
8
+ export type RuntimeSnapshotImportSummary = {
9
+ sourcePath: string;
10
+ scope: string | null;
11
+ nodesRead: number;
12
+ nodesImported: number;
13
+ nodesSkipped: number;
14
+ relationsRead: number;
15
+ relationsImported: number;
16
+ relationsSkipped: number;
17
+ feedbackRead: number;
18
+ feedbackImported: number;
19
+ feedbackSkipped: number;
20
+ decisionsRead: number;
21
+ decisionsImported: number;
22
+ decisionsSkipped: number;
23
+ scopes: string[];
24
+ warnings: string[];
25
+ };
26
+ export declare function importRuntimeLiteSnapshot(options: RuntimeSnapshotImportOptions): Promise<RuntimeSnapshotImportSummary>;
27
+ //# sourceMappingURL=runtime-snapshot-importer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-snapshot-importer.d.ts","sourceRoot":"","sources":["../src/runtime-snapshot-importer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAQV,eAAe,EAEhB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA2gBF,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAgJ5H"}