@aionis/substrate 0.1.1 → 0.1.3
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/CHANGELOG.md +12 -2
- package/README.md +11 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +494 -4
- package/dist/cli.js.map +1 -1
- package/dist/runtime-snapshot-corpus.d.ts +29 -0
- package/dist/runtime-snapshot-corpus.d.ts.map +1 -1
- package/dist/runtime-snapshot-corpus.js +95 -0
- package/dist/runtime-snapshot-corpus.js.map +1 -1
- package/dist/runtime-snapshot-importer.d.ts +17 -0
- package/dist/runtime-snapshot-importer.d.ts.map +1 -1
- package/dist/runtime-snapshot-importer.js +56 -9
- package/dist/runtime-snapshot-importer.js.map +1 -1
- package/docs/CLI.md +98 -1
- package/docs/RUNTIME_SNAPSHOT_CORPUS.md +22 -8
- package/docs/RUNTIME_SNAPSHOT_IMPORT.md +14 -1
- package/docs/V0_2_ROADMAP.md +1 -1
- package/package.json +1 -1
package/docs/CLI.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# CLI
|
|
2
2
|
|
|
3
|
-
`@aionis/substrate` publishes a small CLI for validation and sidecar integration work.
|
|
3
|
+
`@aionis/substrate` publishes a small CLI for local store operations, validation, and sidecar integration work.
|
|
4
4
|
|
|
5
5
|
It is intentionally narrow:
|
|
6
6
|
|
|
7
|
+
- it inspects, previews, backs up, restores, and compacts Substrate stores;
|
|
8
|
+
- it imports Runtime Lite SQLite snapshots into separate Substrate stores;
|
|
7
9
|
- it runs read-only checks over existing Runtime evidence;
|
|
8
10
|
- it writes reports to local files;
|
|
9
11
|
- it does not start Aionis Runtime unless you explicitly use the separate repository script `check:runtime-dual-write`;
|
|
@@ -26,6 +28,101 @@ npx aionis-substrate --help
|
|
|
26
28
|
|
|
27
29
|
The CLI requires Node 24+.
|
|
28
30
|
|
|
31
|
+
## Store Commands
|
|
32
|
+
|
|
33
|
+
All store commands use explicit adapter and path arguments:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx aionis-substrate inspect --adapter sqlite --path ./substrate.sqlite --scope repo-a
|
|
37
|
+
npx aionis-substrate preview-context --adapter sqlite --path ./substrate.sqlite --scope repo-a --query "continue runtime work"
|
|
38
|
+
npx aionis-substrate backup --adapter sqlite --path ./substrate.sqlite --output ./substrate-backup.json
|
|
39
|
+
npx aionis-substrate restore --adapter sqlite --path ./restored.sqlite --input ./substrate-backup.json
|
|
40
|
+
npx aionis-substrate compact --adapter sqlite --path ./substrate.sqlite
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Use `--adapter file` with a directory path for the file-backed adapter:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx aionis-substrate inspect --adapter file --path ./substrate-store --scope repo-a
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Inspect
|
|
50
|
+
|
|
51
|
+
`inspect` prints store metadata. With `--scope`, it also prints scoped counts and memory-node summaries:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx aionis-substrate inspect \
|
|
55
|
+
--adapter sqlite \
|
|
56
|
+
--path ./substrate.sqlite \
|
|
57
|
+
--scope repo-a
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The report contract is `aionis_substrate_inspect_report_v1`.
|
|
61
|
+
|
|
62
|
+
### Preview Context
|
|
63
|
+
|
|
64
|
+
`preview-context` compiles the governed buckets without writing a `memory.decision.recorded` receipt:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx aionis-substrate preview-context \
|
|
68
|
+
--adapter sqlite \
|
|
69
|
+
--path ./substrate.sqlite \
|
|
70
|
+
--scope repo-a \
|
|
71
|
+
--query "continue the current route" \
|
|
72
|
+
--max-per-bucket 8
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The report includes `read_only: true` when event counts and sequence numbers are unchanged.
|
|
76
|
+
|
|
77
|
+
### Backup and Restore
|
|
78
|
+
|
|
79
|
+
`backup` writes a checksum-covered event backup:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx aionis-substrate backup \
|
|
83
|
+
--adapter sqlite \
|
|
84
|
+
--path ./substrate.sqlite \
|
|
85
|
+
--output ./substrate-backup.json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`restore` verifies the backup before writing an empty target:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx aionis-substrate restore \
|
|
92
|
+
--adapter sqlite \
|
|
93
|
+
--path ./restored.sqlite \
|
|
94
|
+
--input ./substrate-backup.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use `--overwrite` only when replacing an existing restore target is intentional.
|
|
98
|
+
|
|
99
|
+
### Compact
|
|
100
|
+
|
|
101
|
+
`compact` rewrites the event history into one checkpoint event without changing governed state:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx aionis-substrate compact \
|
|
105
|
+
--adapter sqlite \
|
|
106
|
+
--path ./substrate.sqlite
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Runtime Snapshot Import
|
|
110
|
+
|
|
111
|
+
Use `import-runtime-snapshot` to copy Runtime Lite SQLite evidence into a separate Substrate store:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx aionis-substrate import-runtime-snapshot \
|
|
115
|
+
--source /path/to/aionis-runtime-lite.sqlite \
|
|
116
|
+
--target ./substrate.sqlite \
|
|
117
|
+
--adapter sqlite \
|
|
118
|
+
--scope repo-a
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The Runtime source is opened read-only. The target is a Substrate store owned by this command.
|
|
122
|
+
The JSON output includes imported/skipped counts plus structured `diagnostics.sourceTables`,
|
|
123
|
+
`diagnostics.skipReasons`, and `diagnostics.jsonIssues` so bridge failures can be classified
|
|
124
|
+
without scraping warning strings.
|
|
125
|
+
|
|
29
126
|
## Sidecar Check
|
|
30
127
|
|
|
31
128
|
Use `sidecar` when you already have Runtime Lite SQLite evidence and want to check whether Substrate can mirror the governed context surface from outside the Runtime boundary.
|
|
@@ -8,7 +8,7 @@ It is a read-only validation path:
|
|
|
8
8
|
2. select Runtime scopes;
|
|
9
9
|
3. import each scope into a temporary Substrate SQLite store;
|
|
10
10
|
4. compile Substrate context;
|
|
11
|
-
5. aggregate import coverage, bucket counts, warnings, and
|
|
11
|
+
5. aggregate import coverage, bucket counts, warnings, failures, and structured import diagnostics.
|
|
12
12
|
|
|
13
13
|
It does not replace Runtime storage and does not install dual-write.
|
|
14
14
|
|
|
@@ -35,7 +35,11 @@ The command writes a report under `reports/runtime-snapshot-corpus-*` unless `--
|
|
|
35
35
|
- `passed_scopes`: scopes imported and compiled successfully.
|
|
36
36
|
- `failed_scopes`: scopes that failed import or compile.
|
|
37
37
|
- `total_nodes_imported`: imported Runtime nodes.
|
|
38
|
+
- `total_nodes_read` / `total_nodes_skipped`: node-level import coverage.
|
|
39
|
+
- `total_relations_*`, `total_feedback_*`, `total_decisions_*`: bridge coverage for Runtime relation, outcome, and decision evidence.
|
|
38
40
|
- `total_warnings`: scan and import warnings.
|
|
41
|
+
- `bucket_totals`: aggregate compiled Substrate admission buckets across imported scopes.
|
|
42
|
+
- `diagnostics_summary`: machine-readable source table coverage, skip reasons, and JSON issues aggregated across scopes.
|
|
39
43
|
- `scope_reports`: per-scope import and bucket summary.
|
|
40
44
|
|
|
41
45
|
## Interpretation
|
|
@@ -47,7 +51,8 @@ Good results mean:
|
|
|
47
51
|
- Runtime SQLite sources can be opened read-only;
|
|
48
52
|
- Runtime memory nodes can be mapped into Substrate nodes;
|
|
49
53
|
- Substrate can compile governed context for real scopes;
|
|
50
|
-
- warnings and failures are visible
|
|
54
|
+
- warnings and failures are visible;
|
|
55
|
+
- skipped evidence is attributable to concrete causes such as missing endpoints, missing referenced rule nodes, audit-only nodes, empty summaries, or malformed Runtime JSON.
|
|
51
56
|
|
|
52
57
|
Bad results should be treated as mapping or substrate-contract evidence, not as a reason to mutate Aionis Runtime core.
|
|
53
58
|
|
|
@@ -65,17 +70,26 @@ npm run check:runtime-corpus -- \
|
|
|
65
70
|
--max-per-bucket 50
|
|
66
71
|
```
|
|
67
72
|
|
|
68
|
-
Result on 2026-06-
|
|
73
|
+
Result on 2026-06-26:
|
|
69
74
|
|
|
70
75
|
- discovered SQLite files: 30
|
|
71
76
|
- Runtime SQLite files: 14
|
|
72
77
|
- candidate scopes: 128
|
|
73
|
-
- attempted scopes:
|
|
74
|
-
- passed scopes:
|
|
78
|
+
- attempted scopes: 128
|
|
79
|
+
- passed scopes: 128
|
|
75
80
|
- failed scopes: 0
|
|
76
|
-
-
|
|
77
|
-
-
|
|
81
|
+
- Runtime nodes read: 9,069
|
|
82
|
+
- Runtime nodes imported: 8,941
|
|
83
|
+
- Runtime nodes skipped: 128
|
|
84
|
+
- relation rows skipped: 0
|
|
85
|
+
- feedback rows skipped: 0
|
|
86
|
+
- decision rows skipped: 0
|
|
87
|
+
- bucket totals: `use_now=128`, `inspect_before_use=3,789`, `do_not_use=80`, `rehydrate=0`
|
|
88
|
+
- source table coverage: `lite_memory_nodes=128/128`, `lite_memory_edges=128/128`, `lite_memory_execution_native_index=41/128`, `lite_memory_rule_feedback=128/128`, `lite_memory_execution_decisions=128/128`
|
|
89
|
+
- skip reason totals: `not_agent_facing=128`, all other skip reasons `0`
|
|
90
|
+
- JSON issues: 0
|
|
91
|
+
- warnings: 128, all from intentionally skipped non-agent-facing Runtime nodes
|
|
78
92
|
|
|
79
93
|
Local report:
|
|
80
94
|
|
|
81
|
-
`reports/runtime-snapshot-corpus-2026-06-
|
|
95
|
+
`reports/runtime-snapshot-corpus-2026-06-26T09-00-03-229Z/summary.json`
|
|
@@ -72,7 +72,20 @@ node scripts/import-runtime-snapshot.ts \
|
|
|
72
72
|
--adapter file
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
The command prints a JSON summary with imported/skipped counts and
|
|
75
|
+
The command prints a JSON summary with imported/skipped counts, warnings, and
|
|
76
|
+
structured diagnostics.
|
|
77
|
+
|
|
78
|
+
The diagnostic block is machine-readable:
|
|
79
|
+
|
|
80
|
+
- `sourceTables`: which Runtime Lite tables were present in the read-only source;
|
|
81
|
+
- `skipReasons.nodes`: `not_agent_facing` and `empty_summary` counts;
|
|
82
|
+
- `skipReasons.relations`: relation rows skipped because an endpoint was not imported;
|
|
83
|
+
- `skipReasons.feedback`: feedback rows skipped because the referenced rule node was not imported;
|
|
84
|
+
- `skipReasons.decisions`: decision rows skipped because none of the referenced source rules were imported;
|
|
85
|
+
- `jsonIssues`: malformed or shape-mismatched Runtime JSON fields.
|
|
86
|
+
|
|
87
|
+
Warnings remain for human inspection, but downstream tooling should prefer the
|
|
88
|
+
diagnostic counters when classifying import coverage failures.
|
|
76
89
|
|
|
77
90
|
## Parity Checker
|
|
78
91
|
|
package/docs/V0_2_ROADMAP.md
CHANGED
|
@@ -64,7 +64,7 @@ Make the substrate boundary easier to consume without widening policy scope:
|
|
|
64
64
|
- document install, minimal API usage, and sidecar reports separately;
|
|
65
65
|
- keep repository-only Runtime process experiments explicit and separate.
|
|
66
66
|
|
|
67
|
-
Initial implementation status: the package exposes `aionis-substrate sidecar` for read-only snapshot/reference checks.
|
|
67
|
+
Initial implementation status: the package exposes `aionis-substrate sidecar` for read-only snapshot/reference checks and store commands for inspect, preview-context, backup, restore, compact, and Runtime snapshot import. These commands do not start Runtime, mutate Runtime storage, or implement Runtime admission policy.
|
|
68
68
|
|
|
69
69
|
## Excluded
|
|
70
70
|
|