@aionis/substrate 0.1.5 → 0.1.6
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/README.md +7 -0
- package/docs/PRODUCT_CONTRACT.md +136 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -123,8 +123,12 @@ Checkpoint compaction is documented in [docs/CHECKPOINT_COMPACTION.md](docs/CHEC
|
|
|
123
123
|
|
|
124
124
|
Runtime snapshot import is documented in [docs/RUNTIME_SNAPSHOT_IMPORT.md](docs/RUNTIME_SNAPSHOT_IMPORT.md).
|
|
125
125
|
|
|
126
|
+
The product contract is documented in [docs/PRODUCT_CONTRACT.md](docs/PRODUCT_CONTRACT.md).
|
|
127
|
+
|
|
126
128
|
Runtime live sidecar sync is documented in [docs/RUNTIME_LIVE_SIDECAR.md](docs/RUNTIME_LIVE_SIDECAR.md).
|
|
127
129
|
|
|
130
|
+
Published Runtime bridge validation is documented in the release checks section below. It installs the published npm package into a fresh temporary project, reads a real Runtime Lite SQLite source, writes only separate Substrate target stores, and verifies snapshot/live parity plus checkpoint idempotency.
|
|
131
|
+
|
|
128
132
|
Runtime Zvec candidate-index validation is documented in [docs/RUNTIME_ZVEC_CANDIDATE_INDEX.md](docs/RUNTIME_ZVEC_CANDIDATE_INDEX.md).
|
|
129
133
|
|
|
130
134
|
Zvec scale and maintenance validation is documented in [docs/ZVEC_SCALE_MAINTENANCE.md](docs/ZVEC_SCALE_MAINTENANCE.md).
|
|
@@ -373,10 +377,13 @@ After publishing to npm, run the registry package checks:
|
|
|
373
377
|
```bash
|
|
374
378
|
npm run check:registry-install
|
|
375
379
|
npm run check:published-runtime-smoke
|
|
380
|
+
AIONIS_RUNTIME_SQLITE_SOURCE=/path/to/aionis-lite.sqlite npm run check:published-runtime-bridge
|
|
376
381
|
```
|
|
377
382
|
|
|
378
383
|
These commands install `@aionis/substrate@<package.json version>` from the npm registry into a fresh temporary project. `check:published-runtime-smoke` also creates a Runtime Lite SQLite fixture and verifies published-package snapshot import into a separate Substrate store.
|
|
379
384
|
|
|
385
|
+
`check:published-runtime-bridge` is the real Runtime bridge gate. It reads the Runtime Lite SQLite source passed through `AIONIS_RUNTIME_SQLITE_SOURCE`, imports it into an isolated snapshot store, runs checkpointed `live-sidecar` twice into an isolated live store, verifies the second pass does not mutate the target, verifies snapshot/live event parity, and verifies the Runtime source file was not modified.
|
|
386
|
+
|
|
380
387
|
## Scale Smoke
|
|
381
388
|
|
|
382
389
|
```bash
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Aionis Substrate Product Contract
|
|
2
|
+
|
|
3
|
+
Aionis Substrate is a governed memory substrate for long-running agents.
|
|
4
|
+
|
|
5
|
+
It gives an agent host a durable place to store execution memory, lifecycle authority, feedback, relations, and memory-decision receipts, then compiles a scoped context object that an agent can safely use on the next turn.
|
|
6
|
+
|
|
7
|
+
## Product Promise
|
|
8
|
+
|
|
9
|
+
Aionis Substrate turns raw agent memory into governed working memory:
|
|
10
|
+
|
|
11
|
+
- active evidence can influence the next turn;
|
|
12
|
+
- stale, failed, low-authority, or payload-only evidence stays visible without silently becoming instruction;
|
|
13
|
+
- raw traces can be restored through rehydrate hooks instead of flooding the prompt;
|
|
14
|
+
- every context decision can leave an auditable receipt;
|
|
15
|
+
- optional semantic candidate indexing can improve recall without replacing lifecycle governance.
|
|
16
|
+
|
|
17
|
+
## Core Contract
|
|
18
|
+
|
|
19
|
+
Substrate stores memory as append-only evidence and derived read models.
|
|
20
|
+
|
|
21
|
+
| Surface | Product meaning | Primary API |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| Evidence log | Durable record of memory writes, lifecycle transitions, relations, feedback, and decisions | `writeNode`, `transitionLifecycle`, `writeRelation`, `writeFeedback`, `compileContext` |
|
|
24
|
+
| Lifecycle authority | The current status that controls whether memory can act | `active`, `contested`, `suppressed`, `archived` |
|
|
25
|
+
| Admission buckets | The agent-facing context boundary | `use_now`, `inspect_before_use`, `do_not_use`, `rehydrate` |
|
|
26
|
+
| Preview | Read-only context compilation for UI, planning, or dry runs | `previewContext()` |
|
|
27
|
+
| Receipt | Auditable record of a context decision | `compileContext()` |
|
|
28
|
+
| Backup | Checksum-covered export and restore of evidence | `exportBackup`, `restore...` |
|
|
29
|
+
| Runtime bridge | Read-only import or checkpointed sidecar mirror from Aionis Runtime Lite SQLite | `importRuntimeLiteSnapshot`, `runRuntimeLiveSidecarOnce` |
|
|
30
|
+
| Semantic candidate index | Optional Zvec-backed candidate narrowing before deterministic admission | `createZvecCandidateIndex` |
|
|
31
|
+
|
|
32
|
+
## Admission Semantics
|
|
33
|
+
|
|
34
|
+
Substrate compiles memory into four buckets.
|
|
35
|
+
|
|
36
|
+
| Bucket | Meaning |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `use_now` | Directly usable memory. The host may place this in the agent context as current working state. |
|
|
39
|
+
| `inspect_before_use` | Relevant but uncertain memory. The agent may inspect it, but it should not be treated as an instruction. |
|
|
40
|
+
| `do_not_use` | Memory blocked from direct use by lifecycle, authority, scope, or relation evidence. |
|
|
41
|
+
| `rehydrate` | Pointer to raw payload or trace evidence that can be restored on demand. |
|
|
42
|
+
|
|
43
|
+
This contract is intentionally stricter than ordinary vector recall. Search can find candidates; admission decides whether candidates may influence the next turn.
|
|
44
|
+
|
|
45
|
+
## Host Integration Shape
|
|
46
|
+
|
|
47
|
+
A host normally integrates Substrate in four calls:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import {
|
|
51
|
+
openSqliteAionisSubstrate,
|
|
52
|
+
createZvecCandidateIndex,
|
|
53
|
+
buildAionisEmbeddingDocument,
|
|
54
|
+
buildAionisEmbeddingQuery,
|
|
55
|
+
} from "@aionis/substrate";
|
|
56
|
+
|
|
57
|
+
const store = await openSqliteAionisSubstrate({ path: "./aionis-substrate.sqlite" });
|
|
58
|
+
|
|
59
|
+
await store.writeNode({
|
|
60
|
+
id: "route-1",
|
|
61
|
+
scope: "repo-a",
|
|
62
|
+
kind: "procedure",
|
|
63
|
+
summary: "Use the active migration path after verifier passes.",
|
|
64
|
+
lifecycle: "active",
|
|
65
|
+
authority: "trusted",
|
|
66
|
+
targetFiles: ["src/migrate.ts"],
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const context = await store.previewContext({
|
|
70
|
+
scope: "repo-a",
|
|
71
|
+
query: "continue the migration task",
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const receipt = await store.compileContext({
|
|
75
|
+
scope: "repo-a",
|
|
76
|
+
query: "continue the migration task",
|
|
77
|
+
traceId: "agent-run-42",
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`previewContext()` gives a read-only context object. `compileContext()` produces the same governed buckets and records a decision receipt.
|
|
82
|
+
|
|
83
|
+
## Embedding Projection Contract
|
|
84
|
+
|
|
85
|
+
Provider embeddings should be built from stable Substrate projection helpers:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const documentText = buildAionisEmbeddingDocument(memoryNode, {
|
|
89
|
+
projection: "structured",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const queryText = buildAionisEmbeddingQuery(userQuery, {
|
|
93
|
+
projection: "structured",
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The current projection version is:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
AIONIS_EMBEDDING_PROJECTION_VERSION
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Hosts can use this to keep document-side and query-side embeddings aligned across providers. The projection is a recall helper; lifecycle admission still controls whether a retrieved candidate can become `use_now`.
|
|
104
|
+
|
|
105
|
+
## Runtime Bridge Contract
|
|
106
|
+
|
|
107
|
+
Substrate can mirror Aionis Runtime Lite SQLite into a separate store:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx aionis-substrate import-runtime-snapshot \
|
|
111
|
+
--source ./runtime.sqlite \
|
|
112
|
+
--target ./substrate.sqlite \
|
|
113
|
+
--adapter sqlite
|
|
114
|
+
|
|
115
|
+
npx aionis-substrate live-sidecar \
|
|
116
|
+
--source ./runtime.sqlite \
|
|
117
|
+
--target ./substrate.sqlite \
|
|
118
|
+
--adapter sqlite \
|
|
119
|
+
--checkpoint ./checkpoint.json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The bridge reads Runtime evidence and writes an external Substrate store. Runtime source storage remains untouched.
|
|
123
|
+
|
|
124
|
+
## Release-Level Guarantees
|
|
125
|
+
|
|
126
|
+
For `@aionis/substrate@0.1.5`:
|
|
127
|
+
|
|
128
|
+
- file and SQLite adapters preserve the same admission buckets for the same evidence;
|
|
129
|
+
- invalid writes do not persist partial events;
|
|
130
|
+
- controlled forgetting is a lifecycle transition;
|
|
131
|
+
- backup restore verifies event integrity;
|
|
132
|
+
- Runtime snapshot import is read-only against Runtime source SQLite;
|
|
133
|
+
- live sidecar uses checkpoint fingerprints for repeated sync;
|
|
134
|
+
- published package install smoke verifies CLI and SDK import surfaces;
|
|
135
|
+
- structured embedding projection is exposed as public SDK API.
|
|
136
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aionis/substrate",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Durable governed memory substrate for Aionis execution state.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"check:install-smoke": "npm run build && node scripts/install-smoke.ts",
|
|
46
46
|
"check:registry-install": "node scripts/registry-install-smoke.ts",
|
|
47
47
|
"check:published-runtime-smoke": "node scripts/published-runtime-smoke.ts",
|
|
48
|
+
"check:published-runtime-bridge": "node scripts/published-runtime-bridge.ts",
|
|
48
49
|
"check:scale": "node scripts/scale-test.ts",
|
|
49
50
|
"check:zvec-scale": "node scripts/zvec-scale-test.ts",
|
|
50
51
|
"example:basic": "npm run build && node examples/basic/index.mjs",
|