@sentropic/cluster-mesh 0.21.0 → 0.21.2
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/assets/storage/engram-memory/contract-manifest.json +155 -0
- package/assets/storage/engram-memory/equivalence.json +46 -0
- package/dist/comments/postgres.d.ts +2 -2
- package/dist/engram-memory/codec.d.ts +46 -0
- package/dist/engram-memory/codec.d.ts.map +1 -0
- package/dist/engram-memory/codec.js +146 -0
- package/dist/engram-memory/codec.js.map +1 -0
- package/dist/engram-memory/contract.d.ts +15 -0
- package/dist/engram-memory/contract.d.ts.map +1 -0
- package/dist/engram-memory/contract.js +16 -0
- package/dist/engram-memory/contract.js.map +1 -0
- package/dist/engram-memory/limits.d.ts +17 -0
- package/dist/engram-memory/limits.d.ts.map +1 -0
- package/dist/engram-memory/limits.js +47 -0
- package/dist/engram-memory/limits.js.map +1 -0
- package/dist/engram-memory/manifest.d.ts +84 -0
- package/dist/engram-memory/manifest.d.ts.map +1 -0
- package/dist/engram-memory/manifest.js +195 -0
- package/dist/engram-memory/manifest.js.map +1 -0
- package/dist/engram-memory/postgres-queries.d.ts +26 -0
- package/dist/engram-memory/postgres-queries.d.ts.map +1 -0
- package/dist/engram-memory/postgres-queries.js +91 -0
- package/dist/engram-memory/postgres-queries.js.map +1 -0
- package/dist/engram-memory/postgres.d.ts +55 -0
- package/dist/engram-memory/postgres.d.ts.map +1 -0
- package/dist/engram-memory/postgres.js +115 -0
- package/dist/engram-memory/postgres.js.map +1 -0
- package/dist/engram-memory/replay-policy.d.ts +25 -0
- package/dist/engram-memory/replay-policy.d.ts.map +1 -0
- package/dist/engram-memory/replay-policy.js +31 -0
- package/dist/engram-memory/replay-policy.js.map +1 -0
- package/dist/engram-memory/sqlite-queries.d.ts +11 -0
- package/dist/engram-memory/sqlite-queries.d.ts.map +1 -0
- package/dist/engram-memory/sqlite-queries.js +38 -0
- package/dist/engram-memory/sqlite-queries.js.map +1 -0
- package/dist/engram-memory/sqlite.d.ts +63 -0
- package/dist/engram-memory/sqlite.d.ts.map +1 -0
- package/dist/engram-memory/sqlite.js +83 -0
- package/dist/engram-memory/sqlite.js.map +1 -0
- package/dist/engram-memory/validation.d.ts +31 -0
- package/dist/engram-memory/validation.d.ts.map +1 -0
- package/dist/engram-memory/validation.js +92 -0
- package/dist/engram-memory/validation.js.map +1 -0
- package/dist/storage/common-contract.d.ts +73 -0
- package/dist/storage/common-contract.d.ts.map +1 -0
- package/dist/storage/common-contract.js +188 -0
- package/dist/storage/common-contract.js.map +1 -0
- package/dist/storage/contracts.d.ts +2 -2
- package/dist/storage/contracts.d.ts.map +1 -1
- package/dist/storage/contracts.js +1 -1
- package/dist/storage/contracts.js.map +1 -1
- package/dist/storage/postgres/index.d.ts +2 -2
- package/package.json +6 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "engram-memory-contract-manifest/v1",
|
|
3
|
+
"algorithm": "sha256(domain-prefix + NUL + canonicalizeJcs(manifest))",
|
|
4
|
+
"domain": "graphify-memory/l3a-module-descriptor/v1",
|
|
5
|
+
"profileDomain": "graphify-memory/l3a-profile/v1",
|
|
6
|
+
"canonicalization": "JCS RFC 8785 with NFC string normalization",
|
|
7
|
+
"contractDigest": "sha256:dff737ced37d801ef48bb4d7088fc4fbc92021d21fe2034ff33ea643b49bec28",
|
|
8
|
+
"canonicalManifest": "{\"assets\":{\"additive\":[\"acquireFence/checkFence/releaseFence canonical-instance acquisition (binding §9)\",\"CommitOptions.fence writer-fence identity (binding §§9.3–9.6)\",\"readCommitResult scoped original-result recovery (R-G4-7, binding §8.2)\",\"profileClaims with pinned versions and semantic digests (binding §6.3)\",\"memory-* named queries and scope-chain-index for memory-journal (binding §4.1)\",\"memory key encodings, codec manifest, and index policies in the contract digest (binding §§2.2.3, 3.1, 3.2, 5.3)\"],\"contract\":{\"digest\":\"c7111c9e7293ee270a0b4dde277f1cfc40fa3c863c3915c6f9ccdd6935c46294\",\"name\":\"l3a-generic-module-storage-port\",\"version\":\"v4.1\"}},\"boundaries\":[\"scope-root\",\"exact-cursor\"],\"chainKinds\":[\"memory-journal\"],\"codecs\":[\"jcs-rfc8785+nfc\",\"graphify-memory/payload/v2\",\"graphify-memory/record/v2\",\"graphify-memory/memory-journal-event/v1\",\"graphify-memory/memory-journal-intent/v1\",\"graphify-memory/canonical-transaction/v1\",\"graphify-memory/recovery-checkpoint/v1\",\"graphify-memory/accepted-lexical/v1\",\"graphify-memory/projection-outbox/v1\",\"graphify-memory/projection-batch/v1\",\"graphify-memory/capture-idempotency/v1\",\"graphify-memory/operational-capability/v1\"],\"contractVersion\":\"memory-binding-v1\",\"keyFormats\":[\"[\\\"memory-record-v1\\\",\\\"<record_id>\\\"]\",\"[\\\"memory-pending-control-v1\\\",\\\"<candidate_id>\\\"]\",\"[\\\"memory-sealed-envelope-v1\\\",\\\"<candidate_id>\\\"]\",\"[\\\"memory-state-v1\\\",\\\"candidate|record\\\",\\\"<entity_id>\\\"]\",\"[\\\"memory-outbox-v1\\\",\\\"<through_cursor_inclusive>\\\",\\\"<batch_digest>\\\"]\",\"[\\\"memory-capture-idempotency-v1\\\",\\\"<candidate_id>\\\"]\",\"[\\\"memory-admission-outcome-v1\\\",\\\"<candidate_id>\\\"]\",\"[\\\"memory-store-meta-v1\\\",\\\"binding\\\"]\",\"[\\\"memory-lexical-v1\\\",\\\"<scope_ref>\\\",\\\"<record_id>\\\"]\"],\"keys\":[\"memory-journal\",\"memory-record-v1\",\"memory-pending-control-v1\",\"memory-sealed-envelope-v1\",\"memory-state-v1\",\"memory-outbox-v1\",\"memory-capture-idempotency-v1\",\"memory-admission-outcome-v1\",\"memory-store-meta-v1\",\"memory-lexical-v1\"],\"kinds\":{\"aggregates\":{\"memory-admission-outcomes\":\"memory-admission-outcome\",\"memory-capture-idempotency\":\"memory-capture-idempotency\",\"memory-fold-state\":\"memory-fold-state\",\"memory-pending-controls\":\"memory-pending-control\",\"memory-sealed-envelopes\":\"memory-sealed-envelope\",\"memory-store-meta\":\"memory-store-meta\"},\"chains\":{\"memory-journal\":{\"chain\":\"memory-journal\",\"kind\":\"memory-journal-event\"}},\"records\":{\"memory-projection-outbox\":\"memory-outbox-batch\",\"memory-record-blobs\":\"memory-record-blob\"}},\"optionalProfiles\":[\"leased-snapshots-v1\"],\"pageLimits\":{\"maxEncodedBytes\":1048576,\"maxRecords\":2000},\"policies\":[\"first-proof-immutable:memory-capture-idempotency\",\"first-proof-immutable:memory-admission-outcomes\",\"journal-identity:memory-journal-event\"],\"profileClaims\":[{\"digest\":\"sha256:507fd5a8f5d68a8c2b99c05bee5a23c0ded47d79532ca5edf34ea08c1919958a\",\"name\":\"atomic-units-v1\",\"version\":\"1\"},{\"digest\":\"sha256:927777f8470be49c968a15cb9bbf2560efdd63bd329d763bfeeb1c166759a3bc\",\"name\":\"immutable-chains-v1\",\"version\":\"1\"},{\"digest\":\"sha256:47ee879a5552868ec7cee15f9984cb44f5a72b64aa2b02556232cd0c9037c80f\",\"name\":\"immutable-boundaries-v1\",\"version\":\"1\"},{\"digest\":\"sha256:d4f1e16890c9541fada3e71e4ba7ba2016da5b07e26383979e29e42b7916b1ed\",\"name\":\"scope-outbox-v1\",\"version\":\"1\"},{\"digest\":\"sha256:48cfb030a1a9c614de6170588116d1afe3d7c94acda79b4322b6b6d7d5156900\",\"name\":\"fenced-writers-v1\",\"version\":\"1\"},{\"digest\":\"sha256:66bbb70f8645b21707f5635e9544dd806d67f8b9d19ecb7be7413ac33d995b51\",\"name\":\"leased-snapshots-v1\",\"version\":\"1\"}],\"queryNames\":[\"memory-journal-page\",\"memory-record-by-id\",\"memory-accepted-snapshot\",\"memory-outbox-page\",\"scope-chain-index\"],\"requiredProfiles\":[\"atomic-units-v1\",\"immutable-chains-v1\",\"immutable-boundaries-v1\",\"scope-outbox-v1\",\"fenced-writers-v1\"],\"schemaVersions\":[\"memory-journal-1\",\"memory-record-2\",\"memory-lifecycle-event-2\",\"memory-checkpoint-1\"]}",
|
|
9
|
+
"manifest": {
|
|
10
|
+
"contractVersion": "memory-binding-v1",
|
|
11
|
+
"schemaVersions": [
|
|
12
|
+
"memory-journal-1",
|
|
13
|
+
"memory-record-2",
|
|
14
|
+
"memory-lifecycle-event-2",
|
|
15
|
+
"memory-checkpoint-1"
|
|
16
|
+
],
|
|
17
|
+
"requiredProfiles": [
|
|
18
|
+
"atomic-units-v1",
|
|
19
|
+
"immutable-chains-v1",
|
|
20
|
+
"immutable-boundaries-v1",
|
|
21
|
+
"scope-outbox-v1",
|
|
22
|
+
"fenced-writers-v1"
|
|
23
|
+
],
|
|
24
|
+
"optionalProfiles": [
|
|
25
|
+
"leased-snapshots-v1"
|
|
26
|
+
],
|
|
27
|
+
"chainKinds": [
|
|
28
|
+
"memory-journal"
|
|
29
|
+
],
|
|
30
|
+
"queryNames": [
|
|
31
|
+
"memory-journal-page",
|
|
32
|
+
"memory-record-by-id",
|
|
33
|
+
"memory-accepted-snapshot",
|
|
34
|
+
"memory-outbox-page",
|
|
35
|
+
"scope-chain-index"
|
|
36
|
+
],
|
|
37
|
+
"boundaries": [
|
|
38
|
+
"scope-root",
|
|
39
|
+
"exact-cursor"
|
|
40
|
+
],
|
|
41
|
+
"pageLimits": {
|
|
42
|
+
"maxRecords": 2000,
|
|
43
|
+
"maxEncodedBytes": 1048576
|
|
44
|
+
},
|
|
45
|
+
"profileClaims": [
|
|
46
|
+
{
|
|
47
|
+
"name": "atomic-units-v1",
|
|
48
|
+
"version": "1",
|
|
49
|
+
"digest": "sha256:507fd5a8f5d68a8c2b99c05bee5a23c0ded47d79532ca5edf34ea08c1919958a"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "immutable-chains-v1",
|
|
53
|
+
"version": "1",
|
|
54
|
+
"digest": "sha256:927777f8470be49c968a15cb9bbf2560efdd63bd329d763bfeeb1c166759a3bc"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "immutable-boundaries-v1",
|
|
58
|
+
"version": "1",
|
|
59
|
+
"digest": "sha256:47ee879a5552868ec7cee15f9984cb44f5a72b64aa2b02556232cd0c9037c80f"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "scope-outbox-v1",
|
|
63
|
+
"version": "1",
|
|
64
|
+
"digest": "sha256:d4f1e16890c9541fada3e71e4ba7ba2016da5b07e26383979e29e42b7916b1ed"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "fenced-writers-v1",
|
|
68
|
+
"version": "1",
|
|
69
|
+
"digest": "sha256:48cfb030a1a9c614de6170588116d1afe3d7c94acda79b4322b6b6d7d5156900"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "leased-snapshots-v1",
|
|
73
|
+
"version": "1",
|
|
74
|
+
"digest": "sha256:66bbb70f8645b21707f5635e9544dd806d67f8b9d19ecb7be7413ac33d995b51"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"codecs": [
|
|
78
|
+
"jcs-rfc8785+nfc",
|
|
79
|
+
"graphify-memory/payload/v2",
|
|
80
|
+
"graphify-memory/record/v2",
|
|
81
|
+
"graphify-memory/memory-journal-event/v1",
|
|
82
|
+
"graphify-memory/memory-journal-intent/v1",
|
|
83
|
+
"graphify-memory/canonical-transaction/v1",
|
|
84
|
+
"graphify-memory/recovery-checkpoint/v1",
|
|
85
|
+
"graphify-memory/accepted-lexical/v1",
|
|
86
|
+
"graphify-memory/projection-outbox/v1",
|
|
87
|
+
"graphify-memory/projection-batch/v1",
|
|
88
|
+
"graphify-memory/capture-idempotency/v1",
|
|
89
|
+
"graphify-memory/operational-capability/v1"
|
|
90
|
+
],
|
|
91
|
+
"keys": [
|
|
92
|
+
"memory-journal",
|
|
93
|
+
"memory-record-v1",
|
|
94
|
+
"memory-pending-control-v1",
|
|
95
|
+
"memory-sealed-envelope-v1",
|
|
96
|
+
"memory-state-v1",
|
|
97
|
+
"memory-outbox-v1",
|
|
98
|
+
"memory-capture-idempotency-v1",
|
|
99
|
+
"memory-admission-outcome-v1",
|
|
100
|
+
"memory-store-meta-v1",
|
|
101
|
+
"memory-lexical-v1"
|
|
102
|
+
],
|
|
103
|
+
"keyFormats": [
|
|
104
|
+
"[\"memory-record-v1\",\"<record_id>\"]",
|
|
105
|
+
"[\"memory-pending-control-v1\",\"<candidate_id>\"]",
|
|
106
|
+
"[\"memory-sealed-envelope-v1\",\"<candidate_id>\"]",
|
|
107
|
+
"[\"memory-state-v1\",\"candidate|record\",\"<entity_id>\"]",
|
|
108
|
+
"[\"memory-outbox-v1\",\"<through_cursor_inclusive>\",\"<batch_digest>\"]",
|
|
109
|
+
"[\"memory-capture-idempotency-v1\",\"<candidate_id>\"]",
|
|
110
|
+
"[\"memory-admission-outcome-v1\",\"<candidate_id>\"]",
|
|
111
|
+
"[\"memory-store-meta-v1\",\"binding\"]",
|
|
112
|
+
"[\"memory-lexical-v1\",\"<scope_ref>\",\"<record_id>\"]"
|
|
113
|
+
],
|
|
114
|
+
"kinds": {
|
|
115
|
+
"chains": {
|
|
116
|
+
"memory-journal": {
|
|
117
|
+
"kind": "memory-journal-event",
|
|
118
|
+
"chain": "memory-journal"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"records": {
|
|
122
|
+
"memory-record-blobs": "memory-record-blob",
|
|
123
|
+
"memory-projection-outbox": "memory-outbox-batch"
|
|
124
|
+
},
|
|
125
|
+
"aggregates": {
|
|
126
|
+
"memory-pending-controls": "memory-pending-control",
|
|
127
|
+
"memory-sealed-envelopes": "memory-sealed-envelope",
|
|
128
|
+
"memory-fold-state": "memory-fold-state",
|
|
129
|
+
"memory-capture-idempotency": "memory-capture-idempotency",
|
|
130
|
+
"memory-admission-outcomes": "memory-admission-outcome",
|
|
131
|
+
"memory-store-meta": "memory-store-meta"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"policies": [
|
|
135
|
+
"first-proof-immutable:memory-capture-idempotency",
|
|
136
|
+
"first-proof-immutable:memory-admission-outcomes",
|
|
137
|
+
"journal-identity:memory-journal-event"
|
|
138
|
+
],
|
|
139
|
+
"assets": {
|
|
140
|
+
"contract": {
|
|
141
|
+
"name": "l3a-generic-module-storage-port",
|
|
142
|
+
"version": "v4.1",
|
|
143
|
+
"digest": "c7111c9e7293ee270a0b4dde277f1cfc40fa3c863c3915c6f9ccdd6935c46294"
|
|
144
|
+
},
|
|
145
|
+
"additive": [
|
|
146
|
+
"acquireFence/checkFence/releaseFence canonical-instance acquisition (binding §9)",
|
|
147
|
+
"CommitOptions.fence writer-fence identity (binding §§9.3–9.6)",
|
|
148
|
+
"readCommitResult scoped original-result recovery (R-G4-7, binding §8.2)",
|
|
149
|
+
"profileClaims with pinned versions and semantic digests (binding §6.3)",
|
|
150
|
+
"memory-* named queries and scope-chain-index for memory-journal (binding §4.1)",
|
|
151
|
+
"memory key encodings, codec manifest, and index policies in the contract digest (binding §§2.2.3, 3.1, 3.2, 5.3)"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"format": "engram-memory-profile-equivalence/v1",
|
|
3
|
+
"contractDigest": "sha256:dff737ced37d801ef48bb4d7088fc4fbc92021d21fe2034ff33ea643b49bec28",
|
|
4
|
+
"neutralClaims": [
|
|
5
|
+
{
|
|
6
|
+
"name": "atomic-units-v1",
|
|
7
|
+
"version": "1",
|
|
8
|
+
"digest": "sha256:507fd5a8f5d68a8c2b99c05bee5a23c0ded47d79532ca5edf34ea08c1919958a"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "immutable-chains-v1",
|
|
12
|
+
"version": "1",
|
|
13
|
+
"digest": "sha256:927777f8470be49c968a15cb9bbf2560efdd63bd329d763bfeeb1c166759a3bc"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "immutable-boundaries-v1",
|
|
17
|
+
"version": "1",
|
|
18
|
+
"digest": "sha256:47ee879a5552868ec7cee15f9984cb44f5a72b64aa2b02556232cd0c9037c80f"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "scope-outbox-v1",
|
|
22
|
+
"version": "1",
|
|
23
|
+
"digest": "sha256:d4f1e16890c9541fada3e71e4ba7ba2016da5b07e26383979e29e42b7916b1ed"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "fenced-writers-v1",
|
|
27
|
+
"version": "1",
|
|
28
|
+
"digest": "sha256:48cfb030a1a9c614de6170588116d1afe3d7c94acda79b4322b6b6d7d5156900"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "leased-snapshots-v1",
|
|
32
|
+
"version": "1",
|
|
33
|
+
"digest": "sha256:66bbb70f8645b21707f5635e9544dd806d67f8b9d19ecb7be7413ac33d995b51"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"backendMapping": {
|
|
37
|
+
"sqlite": {
|
|
38
|
+
"status": "pending-qualification",
|
|
39
|
+
"note": "Backend claim identities are recorded at qualification (C8); only the qualified memory bridge exposes mapped claims. Original backend claims are preserved, never overwritten."
|
|
40
|
+
},
|
|
41
|
+
"postgres": {
|
|
42
|
+
"status": "pending-qualification",
|
|
43
|
+
"note": "Backend claim identities are recorded at qualification (C8); only the qualified memory bridge exposes mapped claims. Original backend claims are preserved, never overwritten."
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -36,11 +36,11 @@ export declare const createCommentsPostgresStorage: (options: Omit<PostgresStora
|
|
|
36
36
|
}>;
|
|
37
37
|
provisionFence: (grant: import("../storage/authority.js").ScopeGrant<unknown>, fence: import("../storage/contracts.js").WriterFence, leaseUntil?: string | undefined) => Promise<void>;
|
|
38
38
|
adapter: () => Readonly<{
|
|
39
|
-
moduleId: "comments" | "engram-live";
|
|
39
|
+
moduleId: "comments" | "engram-live" | "engram-memory";
|
|
40
40
|
incarnation: string;
|
|
41
41
|
bind: (supplied: import("../storage/authority.js").ScopeGrant<unknown>) => Promise<import("../storage/postgres/scope.js").PgScoped>;
|
|
42
42
|
}>;
|
|
43
|
-
moduleId: "comments" | "engram-live";
|
|
43
|
+
moduleId: "comments" | "engram-live" | "engram-memory";
|
|
44
44
|
incarnation: string;
|
|
45
45
|
bind: (supplied: import("../storage/authority.js").ScopeGrant<unknown>) => Promise<import("../storage/postgres/scope.js").PgScoped>;
|
|
46
46
|
}>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare class MemoryCanonicalJsonError extends Error {
|
|
2
|
+
constructor(message?: string);
|
|
3
|
+
}
|
|
4
|
+
export type MemoryCanonicalJsonValue = null | boolean | number | string | MemoryCanonicalJsonValue[] | {
|
|
5
|
+
[key: string]: MemoryCanonicalJsonValue;
|
|
6
|
+
};
|
|
7
|
+
export declare const normalizeMemoryCanonicalJson: (value: unknown, seen?: WeakSet<object>) => MemoryCanonicalJsonValue;
|
|
8
|
+
/** RFC 8785 JSON Canonicalization Scheme bytes with NFC normalization. */
|
|
9
|
+
export declare const canonicalizeMemoryJcs: (value: unknown) => string;
|
|
10
|
+
export interface MemoryEncodedValue {
|
|
11
|
+
readonly format: 'utf8';
|
|
12
|
+
readonly data: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const memoryUtf8: (data: string) => MemoryEncodedValue;
|
|
15
|
+
/** JCS bytes of an NFC-normalized value (binding section 3.2). */
|
|
16
|
+
export declare const memoryJcs: (value: unknown) => MemoryEncodedValue;
|
|
17
|
+
/** Compound identity-key encodings (binding section 3.1). */
|
|
18
|
+
export declare const memoryRecordKey: (recordId: string) => string;
|
|
19
|
+
export declare const memoryControlKey: (candidateId: string) => string;
|
|
20
|
+
export declare const memoryEnvelopeKey: (candidateId: string) => string;
|
|
21
|
+
export declare const memoryStateKey: (entityKind: 'candidate' | 'record', entityId: string) => string;
|
|
22
|
+
export declare const memoryOutboxKey: (throughCursorInclusive: string, batchDigest: string) => string;
|
|
23
|
+
export declare const memoryCaptureKey: (candidateId: string) => string;
|
|
24
|
+
export declare const memoryOutcomeKey: (candidateId: string) => string;
|
|
25
|
+
export declare const memoryStoreMetaKey: () => string;
|
|
26
|
+
export declare const memoryLexicalKey: (scopeRef: string, recordId: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Canonical lexical removal marker (binding section 3.4 rule 2): the neutral
|
|
29
|
+
* index write carries no delete primitive, so a transition out of
|
|
30
|
+
* `accepted_current` writes the JCS null tombstone under the same key in the
|
|
31
|
+
* same unit. Readers treat the tombstone as absent.
|
|
32
|
+
*/
|
|
33
|
+
export declare const memoryLexicalTombstone: () => MemoryEncodedValue;
|
|
34
|
+
/** Readers treat the tombstone as absent; recovery never resurrects it. */
|
|
35
|
+
export declare const isMemoryLexicalTombstone: (value: MemoryEncodedValue) => boolean;
|
|
36
|
+
/** The single journal chain identity (binding section 7.4). */
|
|
37
|
+
export declare const memoryJournalChain: () => string;
|
|
38
|
+
/** Zero hash opening a genesis chain (binding section 8.1). */
|
|
39
|
+
export declare const memoryZeroHash: () => string;
|
|
40
|
+
/** Canonical unsigned-64 decimal transport: BigInt end to end, never Number. */
|
|
41
|
+
export declare const isCanonicalU64: (value: unknown) => value is string;
|
|
42
|
+
export declare const compareU64: (left: string, right: string) => number;
|
|
43
|
+
/** Successor, or undefined at u64 exhaustion (refusal only at 2^64 - 1, never a wrap). */
|
|
44
|
+
export declare const nextU64: (value: string) => string | undefined;
|
|
45
|
+
export declare const maxU64: () => string;
|
|
46
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/engram-memory/codec.ts"],"names":[],"mappings":"AAKA,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,SAAgC;CAIpD;AAED,MAAM,MAAM,wBAAwB,GAChC,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,wBAAwB,EAAE,GAC1B;IAAE,CAAC,GAAG,EAAE,MAAM,GA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D,eAAO,MAAM,cAAc,QAAO,MAAoC,CAAC;AAKvE,gFAAgF;AAChF,eAAO,MAAM,cAAc,UAAW,OAAO,oBAO5C,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,MAAM,SAAS,MAAM,KAAG,MAIxD,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,MAAM,GAAG,SAGhD,CAAC;AAEF,eAAO,MAAM,MAAM,QAAO,MAA4B,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// engram-memory codec: canonical JCS (RFC 8785) with NFC normalization,
|
|
2
|
+
// compound identity-key helpers and canonical u64 decimal transport.
|
|
3
|
+
// Data-pure: no I/O, no clock, no crypto. Mirrors the co-signed Engram
|
|
4
|
+
// neutral declarations byte-for-byte; no import from Engram.
|
|
5
|
+
export class MemoryCanonicalJsonError extends Error {
|
|
6
|
+
constructor(message = 'Value is not canonical JSON') {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'MemoryCanonicalJsonError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const hasUnpairedSurrogate = (value) => {
|
|
12
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
13
|
+
const unit = value.charCodeAt(index);
|
|
14
|
+
if (unit >= 0xd800 && unit <= 0xdbff) {
|
|
15
|
+
// charCodeAt past the end yields NaN: a terminal high surrogate is unpaired.
|
|
16
|
+
const next = value.charCodeAt(index + 1);
|
|
17
|
+
if (Number.isNaN(next) || next < 0xdc00 || next > 0xdfff)
|
|
18
|
+
return true;
|
|
19
|
+
index += 1;
|
|
20
|
+
}
|
|
21
|
+
else if (unit >= 0xdc00 && unit <= 0xdfff) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
/** Own-property assignment that preserves the `__proto__` key instead of invoking the inherited setter. */
|
|
28
|
+
const defineOwnValue = (target, key, value) => {
|
|
29
|
+
Object.defineProperty(target, key, { value, writable: true, enumerable: true, configurable: true });
|
|
30
|
+
};
|
|
31
|
+
const isPlainObject = (value) => {
|
|
32
|
+
const prototype = Object.getPrototypeOf(value);
|
|
33
|
+
return prototype === Object.prototype || prototype === null;
|
|
34
|
+
};
|
|
35
|
+
export const normalizeMemoryCanonicalJson = (value, seen = new WeakSet()) => {
|
|
36
|
+
if (value === null || typeof value === 'boolean')
|
|
37
|
+
return value;
|
|
38
|
+
if (typeof value === 'string') {
|
|
39
|
+
if (hasUnpairedSurrogate(value))
|
|
40
|
+
throw new MemoryCanonicalJsonError('string contains an unpaired surrogate');
|
|
41
|
+
return value.normalize('NFC');
|
|
42
|
+
}
|
|
43
|
+
if (typeof value === 'number') {
|
|
44
|
+
if (!Number.isFinite(value) || Object.is(value, -0)) {
|
|
45
|
+
throw new MemoryCanonicalJsonError('number is not canonical JSON');
|
|
46
|
+
}
|
|
47
|
+
if (Number.isInteger(value) && !Number.isSafeInteger(value)) {
|
|
48
|
+
throw new MemoryCanonicalJsonError('integer is outside the safe range');
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
if (typeof value !== 'object' || typeof value === 'bigint' || typeof value === 'symbol' || typeof value === 'function') {
|
|
53
|
+
throw new MemoryCanonicalJsonError('value is not JSON');
|
|
54
|
+
}
|
|
55
|
+
if (seen.has(value))
|
|
56
|
+
throw new MemoryCanonicalJsonError('cyclic value is not JSON');
|
|
57
|
+
seen.add(value);
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
const extraKeys = Object.keys(value).filter((key) => !/^(0|[1-9][0-9]*)$/.test(key));
|
|
60
|
+
if (extraKeys.length > 0)
|
|
61
|
+
throw new MemoryCanonicalJsonError('array has non-index properties');
|
|
62
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
63
|
+
if (!(index in value))
|
|
64
|
+
throw new MemoryCanonicalJsonError('array has a hole and is not canonical JSON');
|
|
65
|
+
}
|
|
66
|
+
const normalized = value.map((item) => normalizeMemoryCanonicalJson(item, seen));
|
|
67
|
+
seen.delete(value);
|
|
68
|
+
return normalized;
|
|
69
|
+
}
|
|
70
|
+
if (!isPlainObject(value) || Object.getOwnPropertySymbols(value).length > 0) {
|
|
71
|
+
throw new MemoryCanonicalJsonError('value is not a plain JSON object');
|
|
72
|
+
}
|
|
73
|
+
const normalized = {};
|
|
74
|
+
for (const rawKey of Object.keys(value)) {
|
|
75
|
+
if (hasUnpairedSurrogate(rawKey))
|
|
76
|
+
throw new MemoryCanonicalJsonError('object key contains an unpaired surrogate');
|
|
77
|
+
const key = rawKey.normalize('NFC');
|
|
78
|
+
if (Object.hasOwn(normalized, key))
|
|
79
|
+
throw new MemoryCanonicalJsonError('duplicate key after NFC normalization');
|
|
80
|
+
defineOwnValue(normalized, key, normalizeMemoryCanonicalJson(value[rawKey], seen));
|
|
81
|
+
}
|
|
82
|
+
seen.delete(value);
|
|
83
|
+
return normalized;
|
|
84
|
+
};
|
|
85
|
+
const stringifyCanonicalJson = (value) => {
|
|
86
|
+
if (value === null || typeof value === 'boolean' || typeof value === 'number' || typeof value === 'string') {
|
|
87
|
+
return JSON.stringify(value);
|
|
88
|
+
}
|
|
89
|
+
if (Array.isArray(value))
|
|
90
|
+
return `[${value.map(stringifyCanonicalJson).join(',')}]`;
|
|
91
|
+
const keys = Object.keys(value).sort();
|
|
92
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stringifyCanonicalJson(value[key])}`).join(',')}}`;
|
|
93
|
+
};
|
|
94
|
+
/** RFC 8785 JSON Canonicalization Scheme bytes with NFC normalization. */
|
|
95
|
+
export const canonicalizeMemoryJcs = (value) => stringifyCanonicalJson(normalizeMemoryCanonicalJson(value));
|
|
96
|
+
export const memoryUtf8 = (data) => ({ format: 'utf8', data });
|
|
97
|
+
/** JCS bytes of an NFC-normalized value (binding section 3.2). */
|
|
98
|
+
export const memoryJcs = (value) => ({ format: 'utf8', data: canonicalizeMemoryJcs(value) });
|
|
99
|
+
/** Compound identity-key encodings (binding section 3.1). */
|
|
100
|
+
export const memoryRecordKey = (recordId) => JSON.stringify(['memory-record-v1', recordId]);
|
|
101
|
+
export const memoryControlKey = (candidateId) => JSON.stringify(['memory-pending-control-v1', candidateId]);
|
|
102
|
+
export const memoryEnvelopeKey = (candidateId) => JSON.stringify(['memory-sealed-envelope-v1', candidateId]);
|
|
103
|
+
export const memoryStateKey = (entityKind, entityId) => JSON.stringify(['memory-state-v1', entityKind, entityId]);
|
|
104
|
+
export const memoryOutboxKey = (throughCursorInclusive, batchDigest) => JSON.stringify(['memory-outbox-v1', throughCursorInclusive, batchDigest]);
|
|
105
|
+
export const memoryCaptureKey = (candidateId) => JSON.stringify(['memory-capture-idempotency-v1', candidateId]);
|
|
106
|
+
export const memoryOutcomeKey = (candidateId) => JSON.stringify(['memory-admission-outcome-v1', candidateId]);
|
|
107
|
+
export const memoryStoreMetaKey = () => JSON.stringify(['memory-store-meta-v1', 'binding']);
|
|
108
|
+
export const memoryLexicalKey = (scopeRef, recordId) => JSON.stringify(['memory-lexical-v1', scopeRef, recordId]);
|
|
109
|
+
/**
|
|
110
|
+
* Canonical lexical removal marker (binding section 3.4 rule 2): the neutral
|
|
111
|
+
* index write carries no delete primitive, so a transition out of
|
|
112
|
+
* `accepted_current` writes the JCS null tombstone under the same key in the
|
|
113
|
+
* same unit. Readers treat the tombstone as absent.
|
|
114
|
+
*/
|
|
115
|
+
export const memoryLexicalTombstone = () => ({ format: 'utf8', data: 'null' });
|
|
116
|
+
/** Readers treat the tombstone as absent; recovery never resurrects it. */
|
|
117
|
+
export const isMemoryLexicalTombstone = (value) => value.format === 'utf8' && value.data === 'null';
|
|
118
|
+
/** The single journal chain identity (binding section 7.4). */
|
|
119
|
+
export const memoryJournalChain = () => 'memory-journal';
|
|
120
|
+
/** Zero hash opening a genesis chain (binding section 8.1). */
|
|
121
|
+
export const memoryZeroHash = () => `sha256:${'0'.repeat(64)}`;
|
|
122
|
+
const MAX_U64 = 18446744073709551615n;
|
|
123
|
+
const U64_PATTERN = /^(0|[1-9][0-9]*)$/;
|
|
124
|
+
/** Canonical unsigned-64 decimal transport: BigInt end to end, never Number. */
|
|
125
|
+
export const isCanonicalU64 = (value) => {
|
|
126
|
+
if (typeof value !== 'string' || !U64_PATTERN.test(value))
|
|
127
|
+
return false;
|
|
128
|
+
try {
|
|
129
|
+
return BigInt(value) <= MAX_U64;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
export const compareU64 = (left, right) => {
|
|
136
|
+
const a = BigInt(left);
|
|
137
|
+
const b = BigInt(right);
|
|
138
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
139
|
+
};
|
|
140
|
+
/** Successor, or undefined at u64 exhaustion (refusal only at 2^64 - 1, never a wrap). */
|
|
141
|
+
export const nextU64 = (value) => {
|
|
142
|
+
const next = BigInt(value) + 1n;
|
|
143
|
+
return next > MAX_U64 ? undefined : next.toString();
|
|
144
|
+
};
|
|
145
|
+
export const maxU64 = () => MAX_U64.toString();
|
|
146
|
+
//# sourceMappingURL=codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/engram-memory/codec.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,6DAA6D;AAE7D,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,GAAG,6BAA6B;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAUD,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAW,EAAE;IACtD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,KAAK,CAAC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CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAsB,EAAE;IAC3D,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IAChC,OAAO,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { MEMORY_MODULE_ID, MEMORY_CONTRACT_VERSION, MEMORY_CONTRACT_DIGEST } from './manifest.js';
|
|
2
|
+
export { MEMORY_REQUIRED_PROFILES, MEMORY_OPTIONAL_PROFILES, MEMORY_PINNED_PROFILES, MEMORY_QUERY_NAMES, MEMORY_BOUNDARIES, MEMORY_SCHEMA_VERSIONS, MEMORY_CHAIN_KINDS, MEMORY_RECORD_KINDS, MEMORY_AGGREGATE_KINDS, MEMORY_CODEC_MANIFEST, MEMORY_KEY_MANIFEST, MEMORY_POLICY_MANIFEST, MEMORY_KIND_MANIFEST, MEMORY_KEY_FORMATS, MEMORY_ASSET_MANIFEST, MEMORY_DESCRIPTOR, memoryContractManifest, memoryDescriptorDigest, checkMemoryContractDigest, type MemoryProfileClaim, } from './manifest.js';
|
|
3
|
+
export { canonicalizeMemoryJcs, normalizeMemoryCanonicalJson, memoryRecordKey, memoryControlKey, memoryEnvelopeKey, memoryStateKey, memoryOutboxKey, memoryCaptureKey, memoryOutcomeKey, memoryStoreMetaKey, memoryLexicalKey, memoryLexicalTombstone, isMemoryLexicalTombstone, memoryJournalChain, memoryZeroHash, isCanonicalU64, compareU64, nextU64, maxU64, memoryUtf8, memoryJcs, MemoryCanonicalJsonError, type MemoryEncodedValue, type MemoryCanonicalJsonValue, } from './codec.js';
|
|
4
|
+
export { MEMORY_SINGLE_EVENT_LIMITS, MEMORY_CAPTURE_COMPLETION_LIMITS, MEMORY_MAINTENANCE_LIMITS, MEMORY_IMPORT_LIMITS, MEMORY_STORAGE_LIMITS, requireMemoryStorageLimits, } from './limits.js';
|
|
5
|
+
export { validateCaptureTransition, validateAdmissionTransition, isMemoryCaptureProof, isMemoryAdmissionOutcome, type MemoryCaptureProof, type MemoryAdmissionOutcome, } from './validation.js';
|
|
6
|
+
export { classifyCommitReplay, validateCommitReplay, type MemoryCommitIdentity, type MemoryReplayDecision, } from './replay-policy.js';
|
|
7
|
+
export { createMemoryPostgresRegistration, createMemoryPostgresStorage, resolveMemoryCurrentFromAggregates, validateMemoryEffects, type MemoryCurrentStateResolver, type MemoryPostgresRegistration, type MemoryStoredAggregate, } from './postgres.js';
|
|
8
|
+
export { MEMORY_PG_QUERIES, memoryPgQuery, isMemoryQueryName, validateMemoryPageInput, validateMemoryRecordByIdInput, validateMemorySnapshotInput, type MemoryQueryName, } from './postgres-queries.js';
|
|
9
|
+
export { createMemorySqliteRegistration, createMemorySqliteStorage, checkMemorySqliteDriver, MemoryHostDriverRequiredError, MEMORY_SQLITE_ENGINE_FLOOR, MEMORY_SQLITE_QUALIFICATION, type MemorySqliteDriverProvider, type MemorySqliteDriverIdentity, type MemorySqliteQualification, type MemorySqliteRegistration, type MemorySqliteStorageOptions, } from './sqlite.js';
|
|
10
|
+
export { MEMORY_SQLITE_QUERIES, memorySqliteQuery, MEMORY_SQLITE_QUERY_NAMES, } from './sqlite-queries.js';
|
|
11
|
+
/** Reserved trusted-service options for the memory module. No service is required in G1a. */
|
|
12
|
+
export interface MemoryServiceOptions {
|
|
13
|
+
readonly services?: Record<string, never>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/engram-memory/contract.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,EACV,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,kCAAkC,EAClC,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,6FAA6F;AAC7F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @sentropic/cluster-mesh/engram-memory — public assembly module for the
|
|
2
|
+
// co-signed `engram-memory` module surface (contract memory-binding-v1).
|
|
3
|
+
// Importing this module opens no database, spawns no process, acquires no
|
|
4
|
+
// fence, registers no provider and performs no network access. The root
|
|
5
|
+
// package entry does not activate it.
|
|
6
|
+
export { MEMORY_MODULE_ID, MEMORY_CONTRACT_VERSION, MEMORY_CONTRACT_DIGEST } from './manifest.js';
|
|
7
|
+
export { MEMORY_REQUIRED_PROFILES, MEMORY_OPTIONAL_PROFILES, MEMORY_PINNED_PROFILES, MEMORY_QUERY_NAMES, MEMORY_BOUNDARIES, MEMORY_SCHEMA_VERSIONS, MEMORY_CHAIN_KINDS, MEMORY_RECORD_KINDS, MEMORY_AGGREGATE_KINDS, MEMORY_CODEC_MANIFEST, MEMORY_KEY_MANIFEST, MEMORY_POLICY_MANIFEST, MEMORY_KIND_MANIFEST, MEMORY_KEY_FORMATS, MEMORY_ASSET_MANIFEST, MEMORY_DESCRIPTOR, memoryContractManifest, memoryDescriptorDigest, checkMemoryContractDigest, } from './manifest.js';
|
|
8
|
+
export { canonicalizeMemoryJcs, normalizeMemoryCanonicalJson, memoryRecordKey, memoryControlKey, memoryEnvelopeKey, memoryStateKey, memoryOutboxKey, memoryCaptureKey, memoryOutcomeKey, memoryStoreMetaKey, memoryLexicalKey, memoryLexicalTombstone, isMemoryLexicalTombstone, memoryJournalChain, memoryZeroHash, isCanonicalU64, compareU64, nextU64, maxU64, memoryUtf8, memoryJcs, MemoryCanonicalJsonError, } from './codec.js';
|
|
9
|
+
export { MEMORY_SINGLE_EVENT_LIMITS, MEMORY_CAPTURE_COMPLETION_LIMITS, MEMORY_MAINTENANCE_LIMITS, MEMORY_IMPORT_LIMITS, MEMORY_STORAGE_LIMITS, requireMemoryStorageLimits, } from './limits.js';
|
|
10
|
+
export { validateCaptureTransition, validateAdmissionTransition, isMemoryCaptureProof, isMemoryAdmissionOutcome, } from './validation.js';
|
|
11
|
+
export { classifyCommitReplay, validateCommitReplay, } from './replay-policy.js';
|
|
12
|
+
export { createMemoryPostgresRegistration, createMemoryPostgresStorage, resolveMemoryCurrentFromAggregates, validateMemoryEffects, } from './postgres.js';
|
|
13
|
+
export { MEMORY_PG_QUERIES, memoryPgQuery, isMemoryQueryName, validateMemoryPageInput, validateMemoryRecordByIdInput, validateMemorySnapshotInput, } from './postgres-queries.js';
|
|
14
|
+
export { createMemorySqliteRegistration, createMemorySqliteStorage, checkMemorySqliteDriver, MemoryHostDriverRequiredError, MEMORY_SQLITE_ENGINE_FLOOR, MEMORY_SQLITE_QUALIFICATION, } from './sqlite.js';
|
|
15
|
+
export { MEMORY_SQLITE_QUERIES, memorySqliteQuery, MEMORY_SQLITE_QUERY_NAMES, } from './sqlite-queries.js';
|
|
16
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/engram-memory/contract.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,sCAAsC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,GAE1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,EACV,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,wBAAwB,GAGzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,GAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAGrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,kCAAkC,EAClC,qBAAqB,GAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,GAE5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,uBAAuB,EACvB,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,GAM5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WorkLimits } from '../storage/contracts.js';
|
|
2
|
+
/** Single-event unit ceilings (binding section 4, Engram registry completion). */
|
|
3
|
+
export declare const MEMORY_SINGLE_EVENT_LIMITS: WorkLimits;
|
|
4
|
+
/** Capture-completion ceilings: actual appends stay strictly zero. */
|
|
5
|
+
export declare const MEMORY_CAPTURE_COMPLETION_LIMITS: WorkLimits;
|
|
6
|
+
/** Maintenance default ceilings with an explicitly pinned byte bound. */
|
|
7
|
+
export declare const MEMORY_MAINTENANCE_LIMITS: WorkLimits;
|
|
8
|
+
/** Finite backend import ceiling: one atomic empty-store operation. */
|
|
9
|
+
export declare const MEMORY_IMPORT_LIMITS: WorkLimits;
|
|
10
|
+
/** Installed storage policy: the maintenance ceilings bound every commit. */
|
|
11
|
+
export declare const MEMORY_STORAGE_LIMITS: WorkLimits;
|
|
12
|
+
/**
|
|
13
|
+
* A host cannot lower the memory ceilings below the installed policy:
|
|
14
|
+
* weaker limits would admit executions the qualified tuple never covered.
|
|
15
|
+
*/
|
|
16
|
+
export declare const requireMemoryStorageLimits: (limits?: WorkLimits) => WorkLimits;
|
|
17
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/engram-memory/limits.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,EAAE,UAIvC,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,gCAAgC,EAAE,UAI7C,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,EAAE,UAItC,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,EAAE,UAIjC,CAAC;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,EAAE,UAAsC,CAAC;AAO3E;;;GAGG;AACH,eAAO,MAAM,0BAA0B,YAAY,UAAU,KAA2B,UAKvF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// engram-memory work limits: fixed trusted policy for the memory module.
|
|
2
|
+
// Single-event units carry at most one append and eight records within one
|
|
3
|
+
// encoded megabyte; capture completion is one append, one record and 64 KiB
|
|
4
|
+
// with zero actual appends; maintenance defaults are 100 appends and
|
|
5
|
+
// 200 records within an explicitly pinned byte ceiling. Oversized imports
|
|
6
|
+
// refuse before effect; no staged import and no unbounded conversion.
|
|
7
|
+
import { UnsupportedProfileError } from '../storage/errors.js';
|
|
8
|
+
/** Single-event unit ceilings (binding section 4, Engram registry completion). */
|
|
9
|
+
export const MEMORY_SINGLE_EVENT_LIMITS = Object.freeze({
|
|
10
|
+
maxRecords: 8,
|
|
11
|
+
maxAppends: 1,
|
|
12
|
+
maxEncodedBytes: 1048576,
|
|
13
|
+
});
|
|
14
|
+
/** Capture-completion ceilings: actual appends stay strictly zero. */
|
|
15
|
+
export const MEMORY_CAPTURE_COMPLETION_LIMITS = Object.freeze({
|
|
16
|
+
maxRecords: 1,
|
|
17
|
+
maxAppends: 1,
|
|
18
|
+
maxEncodedBytes: 65536,
|
|
19
|
+
});
|
|
20
|
+
/** Maintenance default ceilings with an explicitly pinned byte bound. */
|
|
21
|
+
export const MEMORY_MAINTENANCE_LIMITS = Object.freeze({
|
|
22
|
+
maxRecords: 200,
|
|
23
|
+
maxAppends: 100,
|
|
24
|
+
maxEncodedBytes: 1048576,
|
|
25
|
+
});
|
|
26
|
+
/** Finite backend import ceiling: one atomic empty-store operation. */
|
|
27
|
+
export const MEMORY_IMPORT_LIMITS = Object.freeze({
|
|
28
|
+
maxRecords: 200,
|
|
29
|
+
maxAppends: 100,
|
|
30
|
+
maxEncodedBytes: 1048576,
|
|
31
|
+
});
|
|
32
|
+
/** Installed storage policy: the maintenance ceilings bound every commit. */
|
|
33
|
+
export const MEMORY_STORAGE_LIMITS = MEMORY_MAINTENANCE_LIMITS;
|
|
34
|
+
const atLeast = (limits, floor) => limits.maxRecords >= floor.maxRecords &&
|
|
35
|
+
limits.maxAppends >= floor.maxAppends &&
|
|
36
|
+
limits.maxEncodedBytes >= floor.maxEncodedBytes;
|
|
37
|
+
/**
|
|
38
|
+
* A host cannot lower the memory ceilings below the installed policy:
|
|
39
|
+
* weaker limits would admit executions the qualified tuple never covered.
|
|
40
|
+
*/
|
|
41
|
+
export const requireMemoryStorageLimits = (limits = MEMORY_STORAGE_LIMITS) => {
|
|
42
|
+
if (!atLeast(limits, MEMORY_STORAGE_LIMITS)) {
|
|
43
|
+
throw new UnsupportedProfileError('memory-transport-capacity-v1');
|
|
44
|
+
}
|
|
45
|
+
return limits;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../../src/engram-memory/limits.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,4EAA4E;AAC5E,qEAAqE;AACrE,0EAA0E;AAC1E,sEAAsE;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,kFAAkF;AAClF,MAAM,CAAC,MAAM,0BAA0B,GAAe,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