@engramx/client 0.16.0-rc.2 → 0.16.0-rc.21

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 (95) hide show
  1. package/README.md +69 -8
  2. package/dist/EngramClient.d.ts +60 -16
  3. package/dist/EngramClient.js +139 -70
  4. package/dist/EngramClient.js.map +1 -1
  5. package/dist/MarketClient.js.map +1 -1
  6. package/dist/ProfileManager.d.ts +3 -19
  7. package/dist/ProfileManager.js +1 -58
  8. package/dist/ProfileManager.js.map +1 -1
  9. package/dist/SessionManager.d.ts +1 -1
  10. package/dist/SessionManager.js.map +1 -1
  11. package/dist/actionReceipt.d.ts +8 -0
  12. package/dist/actionReceipt.js +8 -0
  13. package/dist/actionReceipt.js.map +1 -1
  14. package/dist/birthChain.d.ts +87 -0
  15. package/dist/birthChain.js +233 -0
  16. package/dist/birthChain.js.map +1 -0
  17. package/dist/cache.js.map +1 -1
  18. package/dist/certifiedAudit.d.ts +31 -0
  19. package/dist/certifiedAudit.js +124 -0
  20. package/dist/certifiedAudit.js.map +1 -1
  21. package/dist/claude-setup.d.ts +15 -6
  22. package/dist/claude-setup.js +30 -17
  23. package/dist/claude-setup.js.map +1 -1
  24. package/dist/cli.d.ts +7 -1
  25. package/dist/cli.js +212 -187
  26. package/dist/cli.js.map +1 -1
  27. package/dist/connect-config.d.ts +109 -0
  28. package/dist/connect-config.js +251 -0
  29. package/dist/connect-config.js.map +1 -0
  30. package/dist/encryption.d.ts +4 -0
  31. package/dist/encryption.js +7 -1
  32. package/dist/encryption.js.map +1 -1
  33. package/dist/evidence.d.ts +94 -0
  34. package/dist/evidence.js +352 -0
  35. package/dist/evidence.js.map +1 -0
  36. package/dist/idl.d.ts +21 -3
  37. package/dist/idl.js +34 -4
  38. package/dist/idl.js.map +1 -1
  39. package/dist/index.d.ts +13 -6
  40. package/dist/index.js +22 -5
  41. package/dist/index.js.map +1 -1
  42. package/dist/ledgerfsHash.d.ts +0 -2
  43. package/dist/ledgerfsHash.js +0 -2
  44. package/dist/ledgerfsHash.js.map +1 -1
  45. package/dist/lineage.d.ts +7 -1
  46. package/dist/lineage.js +7 -1
  47. package/dist/lineage.js.map +1 -1
  48. package/dist/memoryArchive.d.ts +77 -98
  49. package/dist/memoryArchive.js +58 -31
  50. package/dist/memoryArchive.js.map +1 -1
  51. package/dist/migrate.d.ts +18 -30
  52. package/dist/migrate.js +42 -136
  53. package/dist/migrate.js.map +1 -1
  54. package/dist/openEngram.d.ts +7 -0
  55. package/dist/openEngram.js +27 -3
  56. package/dist/openEngram.js.map +1 -1
  57. package/dist/openclaw-local.d.ts +86 -0
  58. package/dist/openclaw-local.js +332 -0
  59. package/dist/openclaw-local.js.map +1 -0
  60. package/dist/openclaw-setup.d.ts +82 -3
  61. package/dist/openclaw-setup.js +162 -50
  62. package/dist/openclaw-setup.js.map +1 -1
  63. package/dist/pair.js.map +1 -1
  64. package/dist/path-utils.d.ts +0 -16
  65. package/dist/path-utils.js +4 -27
  66. package/dist/path-utils.js.map +1 -1
  67. package/dist/publicRecord.d.ts +5 -0
  68. package/dist/publicRecord.js +52 -0
  69. package/dist/publicRecord.js.map +1 -0
  70. package/dist/recordChain.d.ts +69 -0
  71. package/dist/recordChain.js +145 -0
  72. package/dist/recordChain.js.map +1 -0
  73. package/dist/schema.d.ts +11 -22
  74. package/dist/schema.js +6 -28
  75. package/dist/schema.js.map +1 -1
  76. package/dist/types.d.ts +67 -451
  77. package/dist/verify.d.ts +8 -0
  78. package/dist/verify.js +19 -0
  79. package/dist/verify.js.map +1 -0
  80. package/dist/version.d.ts +22 -0
  81. package/dist/version.js +22 -0
  82. package/dist/version.js.map +1 -1
  83. package/package.json +27 -12
  84. package/dist/generated/engram.idl.d.ts +0 -6
  85. package/dist/generated/engram.idl.js +0 -1366
  86. package/dist/generated/engram.idl.js.map +0 -1
  87. package/dist/generated/market.idl.d.ts +0 -6
  88. package/dist/generated/market.idl.js +0 -557
  89. package/dist/generated/market.idl.js.map +0 -1
  90. package/dist/generated/registry.idl.d.ts +0 -6
  91. package/dist/generated/registry.idl.js +0 -510
  92. package/dist/generated/registry.idl.js.map +0 -1
  93. package/dist/offline.d.ts +0 -21
  94. package/dist/offline.js +0 -104
  95. package/dist/offline.js.map +0 -1
@@ -0,0 +1,94 @@
1
+ import { toHexString, type SealedRow } from './recordChain.js';
2
+ import { verifyHistoricalCertificate } from './certifiedAudit.js';
3
+ export declare const EVIDENCE_FORMAT = "engramx-evidence/1";
4
+ /**
5
+ * The bundle, as JSON. Hashes are lowercase hex; bytes and certificates base64; every integer a
6
+ * decimal string (JSON numbers lose precision past 2^53, and record times are nanoseconds).
7
+ */
8
+ export interface EvidenceBundle {
9
+ format: typeof EVIDENCE_FORMAT;
10
+ /** The canister whose record this is (an engram, usually). */
11
+ canisterId: string;
12
+ /** The record entry being proven, in full. */
13
+ entry: {
14
+ id: string;
15
+ timestampNs: string;
16
+ caller: string;
17
+ callerRole: string;
18
+ operation: string;
19
+ details: string;
20
+ success: boolean;
21
+ /** As served; checked when present. */
22
+ entryHash?: string;
23
+ };
24
+ /** The record head just before the entry (the write receipt's `recordPrev`). */
25
+ recordPrev: string;
26
+ /** The record's switch point to the hash-first rule, as its record read serves it. */
27
+ hashFirstFrom: string;
28
+ /** A certified head captured after the entry (`getCertifiedAuditHead`). */
29
+ certified: {
30
+ certificate: string;
31
+ headHash: string;
32
+ /** Entries ever appended, as the canister claimed; the walk proves or refutes it. */
33
+ total?: string;
34
+ /** The registry's tree format only: the witness, and the head is the `audit_head` leaf. */
35
+ witness?: string | null;
36
+ };
37
+ /** Hash-only rows after the entry, up to (at least) the certified head. Absent: fetch them. */
38
+ rows?: {
39
+ id: string;
40
+ digest: string;
41
+ entryHash: string;
42
+ }[];
43
+ /** The memory write the entry records, when the bundle proves content too. */
44
+ write?: {
45
+ path: string;
46
+ /** The bytes the write sent: the appended delta, or the whole new content of a set. */
47
+ bytes: string;
48
+ /** The writer's principal (the event's `by`). */
49
+ by: string;
50
+ receipt: {
51
+ version: string;
52
+ seq: string;
53
+ head: string;
54
+ prev: string;
55
+ atNs: string;
56
+ contentRoot: string;
57
+ size: string;
58
+ };
59
+ };
60
+ }
61
+ export interface EvidenceLink {
62
+ link: string;
63
+ ok: boolean;
64
+ detail: string;
65
+ }
66
+ export interface EvidenceCheck {
67
+ ok: boolean;
68
+ links: EvidenceLink[];
69
+ /** The first broken link's detail; 'ok' when every link held. */
70
+ why: string;
71
+ signedTimeNs?: bigint;
72
+ /** Entries walked past the proven entry to the certified head. */
73
+ distance?: bigint;
74
+ /** Entries the certified head covers (the walk's proof of `total`). */
75
+ entriesCovered?: bigint;
76
+ }
77
+ export interface CheckOptions {
78
+ /** Default: the pinned IC mainnet root key. Anything else is printed as such by the CLI. */
79
+ rootKey?: Uint8Array;
80
+ /** Rows to walk when the bundle carries none, or too few: fetched from `fromId` onward. */
81
+ fetchRows?: (fromId: bigint) => Promise<{
82
+ rows: SealedRow[];
83
+ hashFirstFrom: bigint;
84
+ }>;
85
+ /** For tests only: stands in for the subnet's signature, which a test cannot produce. */
86
+ verifyCertificate?: typeof verifyHistoricalCertificate;
87
+ }
88
+ /** Run every link. Never throws for a broken bundle: a malformed field is a broken link, named. */
89
+ export declare function checkEvidence(bundle: EvidenceBundle, opts?: CheckOptions): Promise<EvidenceCheck>;
90
+ /** Encode a bundle field from bytes. */
91
+ export declare const bundleHex: typeof toHexString;
92
+ export declare const bundleB64: (b: Uint8Array | number[]) => string;
93
+ /** For a page's full items: the hash-only row of each, so a page that mixes both can be walked. */
94
+ export { sealedRowOf, recordEntryBody } from './recordChain.js';
@@ -0,0 +1,352 @@
1
+ // Evidence bundles: what a writer captures right after a write, and the check anyone runs on it.
2
+ //
3
+ // ⟨ADDED 2026-10-15, the owner's ruling 6B of 2026-10-14⟩ The claim a bundle proves is narrow and
4
+ // exact: "this entry — and, when the bundle carries one, this write's bytes — was in the record by
5
+ // the time the subnet signed this certificate." The check is a chain of links, and each must hold:
6
+ //
7
+ // 1. content → memory event the bytes, with the receipt's previous head, time, size and content
8
+ // root, rebuild the memory-file event whose hash is the receipt's head;
9
+ // 2. memory event → entry the record entry names that event (`seq=…` and `head=…`);
10
+ // 3. entry → entry hash the entry's body, hashed first and chained onto the record head
11
+ // before it (the receipt's `recordPrev`);
12
+ // 4. certificate it verifies against the pinned IC mainnet root key for this canister,
13
+ // at any age, and its signed `/time` is read;
14
+ // 5. certified head the certificate's certified data is the bundle's head;
15
+ // 6. walk from the entry, through hash-only rows (from the bundle, or fetched
16
+ // from the canister by anyone), to the certified head;
17
+ // 7. total the number of entries that head covers, proven by the walk, is the
18
+ // number the bundle claims.
19
+ //
20
+ // What it does NOT prove: that nothing was written elsewhere (another path, engram or key), or any
21
+ // time EARLIER than the certificate's — an entry's certified time is the signed time of the earliest
22
+ // certificate one keeps that covers it. A controller can rewrite a record and certify a new,
23
+ // self-consistent head; only someone who kept an OLDER certificate catches that, which is why the
24
+ // bundle keeps the certificate's bytes, not a flag saying one was checked.
25
+ //
26
+ // NODE-ONLY: the memory-file half (ledgerfsHash.ts) hashes with node:crypto. The browser-safe parts
27
+ // (the chain walk, the historical certificate check) are in recordChain.ts and certifiedAudit.ts.
28
+ import { Principal } from '@icp-sdk/core/principal';
29
+ import { contentRoot as ledgerContentRoot, chunkHash, deltaHash, eventHash, } from './ledgerfsHash.js';
30
+ import { recordEntryHash, sameBytes, toHexString, walkToCertifiedHead, } from './recordChain.js';
31
+ import { verifyHistoricalCertificate } from './certifiedAudit.js';
32
+ export const EVIDENCE_FORMAT = 'engramx-evidence/1';
33
+ /** ledgerfs's fixed chunk size (src/ledgerfs/Types.mo · CHUNK_SIZE) — part of every content root. */
34
+ const CHUNK_SIZE = 262144;
35
+ // ── parsing (every field checked, so a malformed bundle is named, never half-checked) ────────────
36
+ const hex = (what, h, len) => {
37
+ if (typeof h !== 'string' || !/^([0-9a-f]{2})*$/.test(h)) {
38
+ throw new Error(`${what} is not lowercase hex`);
39
+ }
40
+ const out = Uint8Array.from(h.match(/../g) ?? [], (b) => parseInt(b, 16));
41
+ if (len !== undefined && out.length !== len)
42
+ throw new Error(`${what} is ${out.length} bytes, not ${len}`);
43
+ return out;
44
+ };
45
+ const nat = (what, n) => {
46
+ if (typeof n !== 'string' || !/^\d+$/.test(n))
47
+ throw new Error(`${what} is not a decimal string`);
48
+ return BigInt(n);
49
+ };
50
+ const int = (what, n) => {
51
+ if (typeof n !== 'string' || !/^-?\d+$/.test(n))
52
+ throw new Error(`${what} is not a decimal string`);
53
+ return BigInt(n);
54
+ };
55
+ const b64 = (what, s) => {
56
+ if (typeof s !== 'string')
57
+ throw new Error(`${what} is not base64 text`);
58
+ return new Uint8Array(Buffer.from(s, 'base64'));
59
+ };
60
+ /** Which ledgerfs op a record entry's operation wrote — the two a writer can rebuild from its bytes. */
61
+ function opKind(operation) {
62
+ if (operation === 'memory.append' ||
63
+ operation === 'mcp.append' ||
64
+ operation === 'memory.append.session') {
65
+ return 'append';
66
+ }
67
+ if (operation === 'memory.write' || operation === 'memory.revise')
68
+ return 'set';
69
+ return null;
70
+ }
71
+ /** The memory-file event a write committed, rebuilt from its bytes and its receipt. */
72
+ function rebuildEvent(kind, w, bytes) {
73
+ const r = w.receipt;
74
+ const seq = nat('write.receipt.seq', r.seq);
75
+ const size = nat('write.receipt.size', r.size);
76
+ const receiptRoot = hex('write.receipt.contentRoot', r.contentRoot, 32);
77
+ let op;
78
+ let contentRootChecked = false;
79
+ if (kind === 'append') {
80
+ op = { kind: 'append', deltaHash: deltaHash(bytes), deltaSize: bytes.length, newSize: size };
81
+ }
82
+ else {
83
+ // A set seals its whole content from an empty tail: full 256 KiB chunks, then the remainder,
84
+ // every ref born at this event's seq (Store.prepareSet · seal).
85
+ const full = [];
86
+ let i = 0;
87
+ for (; i + CHUNK_SIZE <= bytes.length; i += CHUNK_SIZE)
88
+ full.push(bytes.subarray(i, i + CHUNK_SIZE));
89
+ const tail = bytes.subarray(i);
90
+ const fullHashes = full.map((c) => chunkHash(c));
91
+ const tailHash = tail.length > 0 ? chunkHash(tail) : null;
92
+ const root = ledgerContentRoot(fullHashes, tailHash);
93
+ const chunks = fullHashes.map((h) => ({ hash: h, size: CHUNK_SIZE, birthSeq: seq }));
94
+ if (tailHash)
95
+ chunks.push({ hash: tailHash, size: tail.length, birthSeq: seq });
96
+ op = { kind: 'set', manifest: { chunks, totalSize: BigInt(bytes.length), contentRoot: root } };
97
+ contentRootChecked = sameBytes(root, receiptRoot);
98
+ }
99
+ return {
100
+ event: {
101
+ seq,
102
+ path: w.path,
103
+ version: nat('write.receipt.version', r.version),
104
+ op,
105
+ byRaw: Principal.fromText(w.by).toUint8Array(),
106
+ at: int('write.receipt.atNs', r.atNs),
107
+ size,
108
+ contentRoot: receiptRoot,
109
+ prev: hex('write.receipt.prev', r.prev, 32),
110
+ },
111
+ contentRootChecked,
112
+ };
113
+ }
114
+ /** Run every link. Never throws for a broken bundle: a malformed field is a broken link, named. */
115
+ export async function checkEvidence(bundle, opts = {}) {
116
+ const links = [];
117
+ const done = (extra = {}) => {
118
+ const broken = links.find((l) => !l.ok);
119
+ return {
120
+ ok: !broken,
121
+ links,
122
+ why: broken ? `${broken.link}: ${broken.detail}` : 'ok',
123
+ ...extra,
124
+ };
125
+ };
126
+ const fail = (link, detail, extra = {}) => {
127
+ links.push({ link, ok: false, detail });
128
+ return done(extra);
129
+ };
130
+ try {
131
+ if (bundle?.format !== EVIDENCE_FORMAT) {
132
+ return fail('bundle', `format is ${JSON.stringify(bundle?.format)}, not "${EVIDENCE_FORMAT}"`);
133
+ }
134
+ Principal.fromText(bundle.canisterId);
135
+ }
136
+ catch (e) {
137
+ return fail('bundle', e.message);
138
+ }
139
+ let entry;
140
+ let entryId;
141
+ let recordPrev;
142
+ let hashFirstFrom;
143
+ try {
144
+ const e = bundle.entry;
145
+ entryId = nat('entry.id', e.id);
146
+ entry = {
147
+ id: entryId,
148
+ timestampNs: int('entry.timestampNs', e.timestampNs),
149
+ caller: Principal.fromText(e.caller).toText(),
150
+ callerRole: String(e.callerRole),
151
+ operation: String(e.operation),
152
+ details: String(e.details),
153
+ success: e.success === true,
154
+ };
155
+ recordPrev = hex('recordPrev', bundle.recordPrev);
156
+ if (recordPrev.length !== 0 && recordPrev.length !== 32)
157
+ throw new Error('recordPrev is neither empty (genesis) nor 32 bytes');
158
+ hashFirstFrom = nat('hashFirstFrom', bundle.hashFirstFrom);
159
+ }
160
+ catch (e) {
161
+ return fail('bundle', e.message);
162
+ }
163
+ // 1–2. content → memory event → record entry
164
+ if (bundle.write) {
165
+ const kind = opKind(entry.operation);
166
+ if (!kind) {
167
+ return fail('content → memory event', `the entry's operation "${entry.operation}" is not a write this check can rebuild from its bytes (an append or a set)`);
168
+ }
169
+ let built;
170
+ let receiptHead;
171
+ try {
172
+ built = rebuildEvent(kind, bundle.write, b64('write.bytes', bundle.write.bytes));
173
+ receiptHead = hex('write.receipt.head', bundle.write.receipt.head, 32);
174
+ }
175
+ catch (e) {
176
+ return fail('content → memory event', `the write is malformed: ${e.message}`);
177
+ }
178
+ if (kind === 'set' && !built.contentRootChecked) {
179
+ return fail('content → memory event', "the bytes do not hash to the receipt's content root: they are not the content this write set");
180
+ }
181
+ const h = eventHash(built.event);
182
+ if (!sameBytes(h, receiptHead)) {
183
+ return fail('content → memory event', `the event rebuilt from the bytes and the receipt hashes to ${toHexString(h)}, not to the receipt's head ` +
184
+ `${toHexString(receiptHead)}: the bytes are not the ones written, or the receipt's previous head, time, size ` +
185
+ `or content root is wrong`);
186
+ }
187
+ links.push({
188
+ link: 'content → memory event',
189
+ ok: true,
190
+ detail: `${kind === 'append' ? 'the appended bytes' : 'the content'} rebuild event ${bundle.write.receipt.seq}, head ${toHexString(receiptHead)}`,
191
+ });
192
+ // The engram writes a memory entry's details as `v=<version>[ src=…] seq=<seq> head=<head>[ conn=…]
193
+ // path=<path>[ key=…]`, capped at 512 characters with the path LAST so a cap cuts the path, never
194
+ // the proof (main.mo · receiptSuffix). All three tokens must name THIS write.
195
+ const d = entry.details;
196
+ const seqTok = ` seq=${bundle.write.receipt.seq} head=${toHexString(receiptHead)}`;
197
+ const versionTok = `v=${bundle.write.receipt.version} `;
198
+ const pathTok = ` path=${bundle.write.path}`;
199
+ const pathCut = Array.from(d).length === 512 && pathTok.startsWith(d.slice(d.lastIndexOf(' path=')));
200
+ if (!d.startsWith(versionTok) ||
201
+ !d.includes(`${seqTok} `) ||
202
+ !(d.includes(pathTok) || pathCut)) {
203
+ return fail('memory event → record entry', `the entry does not name this write: its details are "${d.slice(0, 200)}", and they must begin ` +
204
+ `"${versionTok.trim()}", carry "${seqTok.trim()}" and name path "${bundle.write.path}"`);
205
+ }
206
+ links.push({
207
+ link: 'memory event → record entry',
208
+ ok: true,
209
+ detail: `entry ${entryId} records seq ${bundle.write.receipt.seq}`,
210
+ });
211
+ }
212
+ // 3. entry → its hash
213
+ const entryHash = await recordEntryHash(entry, recordPrev, hashFirstFrom);
214
+ if (bundle.entry.entryHash !== undefined) {
215
+ let served;
216
+ try {
217
+ served = hex('entry.entryHash', bundle.entry.entryHash, 32);
218
+ }
219
+ catch (e) {
220
+ return fail('record entry → entry hash', e.message);
221
+ }
222
+ if (!sameBytes(served, entryHash)) {
223
+ return fail('record entry → entry hash', `the entry, chained onto the previous record head ${toHexString(recordPrev) || '(genesis)'}, hashes to ` +
224
+ `${toHexString(entryHash)}, not to its entry hash ${toHexString(served)}: the entry's text, or the receipt's previous record head, is wrong`);
225
+ }
226
+ }
227
+ links.push({
228
+ link: 'record entry → entry hash',
229
+ ok: true,
230
+ detail: `entry ${entryId} hashes to ${toHexString(entryHash)} (${entryId >= hashFirstFrom ? 'hashed first, then chained' : 'the older rule'})`,
231
+ });
232
+ // 4–5. certificate and certified head
233
+ let certified;
234
+ let claimedHead;
235
+ try {
236
+ claimedHead = hex('certified.headHash', bundle.certified.headHash, 32);
237
+ const witness = bundle.certified.witness
238
+ ? b64('certified.witness', bundle.certified.witness)
239
+ : null;
240
+ certified = await (opts.verifyCertificate ?? verifyHistoricalCertificate)({
241
+ certificate: b64('certified.certificate', bundle.certified.certificate),
242
+ canisterId: bundle.canisterId,
243
+ rootKey: opts.rootKey,
244
+ witness,
245
+ leafPath: witness ? [new TextEncoder().encode('audit_head')] : undefined,
246
+ });
247
+ }
248
+ catch (e) {
249
+ return fail('certificate', e.message);
250
+ }
251
+ if (!certified.verified || certified.signedTimeNs === null) {
252
+ return fail('certificate', certified.why);
253
+ }
254
+ const signedTimeNs = certified.signedTimeNs;
255
+ links.push({
256
+ link: 'certificate',
257
+ ok: true,
258
+ detail: `signed by the subnet at ${new Date(Number(signedTimeNs / 1000000n)).toISOString()} for ${bundle.canisterId}`,
259
+ });
260
+ const certifiedHead = certified.leaf ?? certified.certifiedData;
261
+ if (!sameBytes(certifiedHead, claimedHead)) {
262
+ return fail('certified head', `the certificate certifies ${toHexString(certifiedHead)}, not the bundle's head ${toHexString(claimedHead)}`, { signedTimeNs });
263
+ }
264
+ links.push({
265
+ link: 'certified head',
266
+ ok: true,
267
+ detail: `the subnet signed head ${toHexString(certifiedHead)}`,
268
+ });
269
+ // The certificate predates the entry when it certifies the head the entry was chained onto.
270
+ if (sameBytes(certifiedHead, recordPrev)) {
271
+ return fail('walk', `the certificate precedes the entry: it certifies the record head from just before entry ${entryId}, so it was captured before the write and proves nothing about it`, { signedTimeNs });
272
+ }
273
+ // 6. walk
274
+ let rows;
275
+ try {
276
+ rows = (bundle.rows ?? []).map((r, i) => ({
277
+ id: nat(`rows[${i}].id`, r.id),
278
+ digest: hex(`rows[${i}].digest`, r.digest, 32),
279
+ entryHash: hex(`rows[${i}].entryHash`, r.entryHash, 32),
280
+ }));
281
+ }
282
+ catch (e) {
283
+ return fail('walk', `the bundle's rows are malformed: ${e.message}`, {
284
+ signedTimeNs,
285
+ });
286
+ }
287
+ let walk = await walkToCertifiedHead({
288
+ fromId: entryId,
289
+ fromHash: entryHash,
290
+ rows,
291
+ certifiedHead,
292
+ hashFirstFrom,
293
+ });
294
+ // Fetch only when the bundle carried no rows, or its rows simply ran out. A row that is missing,
295
+ // swapped or altered INSIDE the bundle is a broken bundle — never repaired by fetching.
296
+ const ranOut = !walk.ok && (rows.length === 0 || /was not reached/.test(walk.why));
297
+ if (!walk.ok && ranOut && opts.fetchRows) {
298
+ const last = rows.length ? rows[rows.length - 1].id : entryId;
299
+ let fetched;
300
+ try {
301
+ fetched = await opts.fetchRows(rows.length ? last + 1n : entryId + 1n);
302
+ }
303
+ catch (e) {
304
+ return fail('walk', `fetching hash-only rows failed: ${e.message}`, {
305
+ signedTimeNs,
306
+ });
307
+ }
308
+ if (fetched.hashFirstFrom !== hashFirstFrom) {
309
+ return fail('walk', `the canister says its record switched rule at ${fetched.hashFirstFrom}, the bundle says ${hashFirstFrom}`, { signedTimeNs });
310
+ }
311
+ walk = await walkToCertifiedHead({
312
+ fromId: entryId,
313
+ fromHash: entryHash,
314
+ rows: [...rows, ...fetched.rows.filter((r) => r.id > last)],
315
+ certifiedHead,
316
+ hashFirstFrom,
317
+ });
318
+ }
319
+ if (!walk.ok)
320
+ return fail('walk', walk.why, { signedTimeNs });
321
+ links.push({
322
+ link: 'walk',
323
+ ok: true,
324
+ detail: `${walk.distance} entr${walk.distance === 1n ? 'y' : 'ies'} from entry ${entryId} to the certified head (entry ${walk.headId})`,
325
+ });
326
+ // 7. total
327
+ const covered = walk.headId + 1n;
328
+ if (bundle.certified.total !== undefined) {
329
+ let claimed;
330
+ try {
331
+ claimed = nat('certified.total', bundle.certified.total);
332
+ }
333
+ catch (e) {
334
+ return fail('total', e.message, { signedTimeNs, distance: walk.distance });
335
+ }
336
+ if (claimed !== covered) {
337
+ return fail('total', `the bundle says the head covers ${claimed} entries; the walk proves it covers ${covered}`, { signedTimeNs, distance: walk.distance });
338
+ }
339
+ links.push({
340
+ link: 'total',
341
+ ok: true,
342
+ detail: `the certified head covers exactly ${covered} entries`,
343
+ });
344
+ }
345
+ return done({ signedTimeNs, distance: walk.distance, entriesCovered: covered });
346
+ }
347
+ /** Encode a bundle field from bytes. */
348
+ export const bundleHex = toHexString;
349
+ export const bundleB64 = (b) => Buffer.from(Uint8Array.from(b)).toString('base64');
350
+ /** For a page's full items: the hash-only row of each, so a page that mixes both can be walked. */
351
+ export { sealedRowOf, recordEntryBody } from './recordChain.js';
352
+ //# sourceMappingURL=evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,EAAE;AACF,kGAAkG;AAClG,mGAAmG;AACnG,mGAAmG;AACnG,EAAE;AACF,oGAAoG;AACpG,sGAAsG;AACtG,0FAA0F;AAC1F,gGAAgG;AAChG,wEAAwE;AACxE,sGAAsG;AACtG,4EAA4E;AAC5E,uFAAuF;AACvF,oGAAoG;AACpG,qFAAqF;AACrF,mGAAmG;AACnG,0DAA0D;AAC1D,EAAE;AACF,mGAAmG;AACnG,qGAAqG;AACrG,6FAA6F;AAC7F,kGAAkG;AAClG,2EAA2E;AAC3E,EAAE;AACF,oGAAoG;AACpG,kGAAkG;AAElG,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EACL,WAAW,IAAI,iBAAiB,EAChC,SAAS,EACT,SAAS,EACT,SAAS,GAGV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,SAAS,EACT,WAAW,EACX,mBAAmB,GAGpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAA8B,MAAM,qBAAqB,CAAC;AAE9F,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAEpD,qGAAqG;AACrG,MAAM,UAAU,GAAG,MAAO,CAAC;AAmF3B,oGAAoG;AAEpG,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,CAAU,EAAE,GAAY,EAAc,EAAE;IACjE,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAA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AAO,UAAU;SAC/D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;AAClF,CAAC;AAED,wCAAwC;AACxC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAwB,EAAU,EAAE,CAC5D,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAErD,mGAAmG;AACnG,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/idl.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { _SERVICE as GeneratedEngramService } from '@engramx/idl/engram';
1
2
  type InterfaceFactory = (env: {
2
3
  IDL: any;
3
4
  }) => any;
@@ -8,6 +9,9 @@ type InterfaceFactory = (env: {
8
9
  * vendored inside this package, so a missing name is a fact about this build, identical in every
9
10
  * environment — never a runtime surprise that only some caller hits. The message names the fix,
10
11
  * because the tempting wrong fix is to paste the old shape back in.
12
+ * ⟨2026-10-06⟩ "vendored inside this package" is no longer how: the factory comes from
13
+ * `@engramx/idl`, pinned to this package's exact version when it is packed. The conclusion stands
14
+ * for the same reason — one version of the interface per version of this package.
11
15
  */
12
16
  export declare function projectService(generated: InterfaceFactory, methods: readonly string[], IDL: any): any;
13
17
  /** A factory over the engram interface, narrowed to `methods`. */
@@ -25,11 +29,11 @@ export declare const marketSubset: (methods?: readonly string[]) => InterfaceFac
25
29
  * nothing calls reads as a supported capability to the next person who greps for one, and a name
26
30
  * here the CANISTER does not serve is a construction-time failure — projectService throws on it.
27
31
  *
28
- * The market serves 64 methods. These nine are the BUYER path, which is the only path this SDK has
32
+ * The market serves 64 methods. These seven are the BUYER path, which is the only path this SDK has
29
33
  * ever wrapped: the seller surface (uploads, endpoints, service registration, pricing) is console
30
34
  * work, and the admin surface is recovery work. Neither belongs in an agent's client library.
31
35
  */
32
- export declare const SDK_MARKET_METHODS: readonly ["confirmJob", "disputeJob", "getJob", "getJobResult", "getJobStatus", "listServices", "createJob"];
36
+ export declare const SDK_MARKET_METHODS: readonly ['confirmJob', 'disputeJob', 'getJob', 'getJobResult', 'getJobStatus', 'listServices', 'createJob'];
33
37
  /**
34
38
  * The engram methods EngramClient's actor may call.
35
39
  *
@@ -52,11 +56,25 @@ export declare const SDK_MARKET_METHODS: readonly ["confirmJob", "disputeJob", "
52
56
  * owner-mode `git-revert`, which reaches the actor directly and says so at its call site, and the
53
57
  * encryption migrations the encryption runbook names by hand. If a name here has no caller, that is
54
58
  * a bug in this list, not a reserve.
59
+ * ⟨2026-10-13, the owner's 5A⟩ `git-revert` no longer calls writeMemory: its canister restore moved
60
+ * to @engramx/owner (`--restore`). The encryption migrations and `setMemoryEncryption` are now the
61
+ * only callers of `writeMemory` and `setEncryptionEnabled`; both names leave this list when that
62
+ * trio moves to the owner kit too (it waits on the kit taking `@engramx/client/encryption` as a
63
+ * dependency).
55
64
  *
56
65
  * ADDING A NAME IS A PRODUCT DECISION, not a maintenance one (surface-budget rule L6): no addition
57
66
  * without a named caller.
58
67
  */
59
- export declare const SDK_ENGRAM_METHODS: readonly ["about", "appendMemory", "backupAbort", "backupFinalize", "backupInit", "backupPullChunk", "backupPushChunk", "getBackupMetadata", "getCertifiedAuditHead", "getEncryptedMemoryKey", "getMemoryHistory", "getMemoryKeyVerificationKey", "getOwnerConsole", "getProtectedPaths", "getWalletBalances", "getWorldIdVerification", "listAuditEntries", "listBackups", "listGuardians", "listMemoryFiles", "listMyApprovalRequests", "readMemory", "readMemoryBatch", "readMemoryBytes", "pairAgent", "reviseMemory", "resignAgent", "rotateAgentKeyHash", "nominateAgentKey", "acceptAgentKeyNomination", "getChildAllowance", "openChildEngram", "getSpawnedBy", "sessionReadContext", "setEncryptionEnabled", "writeMemory"];
68
+ export declare const SDK_ENGRAM_METHODS: readonly ['about', 'appendMemory', 'backupAbort', 'backupFinalize', 'backupInit', 'backupPullChunk', 'backupPushChunk', 'getBackupMetadata', 'getBackupRetention', 'getCertifiedAuditHead', 'getEncryptedMemoryKey', 'getMemoryHistory', 'getMemoryKeyVerificationKey', 'getOwnerConsole', 'getProtectedPaths', 'getWalletBalances', 'getWorldIdVerification', 'listAuditEntries', 'listBackups', 'listGuardians', 'listMemoryFiles', 'listMyApprovalRequests', 'readMemory', 'readMemoryBatch', 'readMemoryBytes', 'pairAgent', 'reviseMemory', 'resignAgent', 'myGrant', 'rotateAgentKeyHash', 'nominateAgentKey', 'acceptAgentKeyNomination', 'getChildAllowance', 'openChildEngram', 'getSpawnedBy', 'sessionReadContext', 'setEncryptionEnabled', 'writeMemory'];
69
+ /** One of the engram methods this SDK may call. */
70
+ export type SdkEngramMethod = (typeof SDK_ENGRAM_METHODS)[number];
71
+ /**
72
+ * ⟨2026-10-13, the owner's 3A⟩ The TYPE of the actor EngramClient builds: the generated engram
73
+ * interface, narrowed to SDK_ENGRAM_METHODS. It was `ActorSubclass<any>`, so a call with the wrong
74
+ * arguments, a method this list does not declare, or a reply read as the wrong shape compiled and
75
+ * failed at run time (types.ts says which ones did). Now tsc checks every call and every reply.
76
+ */
77
+ export type SdkEngramService = Pick<GeneratedEngramService, SdkEngramMethod>;
60
78
  /**
61
79
  * The engram actor interface EngramClient builds. Exported because the fidelity gate imports it
62
80
  * and because a caller holding its own agent may want the same narrowing; it is not part of the
package/dist/idl.js CHANGED
@@ -16,6 +16,18 @@
16
16
  // derived factory cannot hold that defect: there is no hand-typed shape left to be wrong. What
17
17
  // remains checkable is FRESHNESS of the vendored copy and VALIDITY of the name list, and both are
18
18
  // gates in test/idl-fidelity.test.ts.
19
+ // ⟨2026-10-06, the owner's ruling of 2026-10-05: "engramx/idl changes in rc.3"⟩ There is no vendored
20
+ // copy any more. The three factories below are imported from `@engramx/idl`, the package the
21
+ // release publishes the generated interfaces in, and `src/generated/` inside this package is
22
+ // deleted. The dependency is declared `workspace:*`, which packing rewrites to the EXACT version
23
+ // being released, so an installed @engramx/client@X always projects from @engramx/idl@X — the
24
+ // interface it was tested against, never a neighbouring one. FRESHNESS is no longer this package's
25
+ // question: @engramx/idl copies what scripts/gen-did.sh wrote, byte for byte, and its own test
26
+ // (test/idl-package.test.ts at the repo root) holds that. What test/idl-fidelity.test.ts checks
27
+ // now is that this package resolves the workspace's @engramx/idl, that the dist it resolves is
28
+ // the generator's current output, that the projection keeps the package's signatures, and the
29
+ // name list. WHAT WOULD MAKE THIS WRONG: a consumer forcing a different @engramx/idl version
30
+ // (an `overrides` entry, a hand-edited lockfile); the exact pin is then theirs to break.
19
31
  //
20
32
  // WHY A METHOD SUBSET SURVIVES AT ALL. ADR-0018 retires the client-subset rule for clients that
21
33
  // ship WITH their canister — the platform apps deploy in the same release as the engram they
@@ -70,9 +82,9 @@
70
82
  // an older engram does not, the fix is the interface law itself — the field is `opt` from birth
71
83
  // (rule 1: absent + declared-`opt` decodes to null on both halves, measured cases 1 and 9) —
72
84
  // or a codegen-time projection. Never a hand edit here.
73
- import { idlFactory as generatedEngramIdl } from './generated/engram.idl.js';
74
- import { idlFactory as generatedRegistryIdl } from './generated/registry.idl.js';
75
- import { idlFactory as generatedMarketIdl } from './generated/market.idl.js';
85
+ import { idlFactory as generatedEngramIdl } from '@engramx/idl/engram';
86
+ import { idlFactory as generatedRegistryIdl } from '@engramx/idl/registry';
87
+ import { idlFactory as generatedMarketIdl } from '@engramx/idl/market';
76
88
  /**
77
89
  * Build a service carrying exactly `methods`, taking every signature from `generated`.
78
90
  *
@@ -80,6 +92,9 @@ import { idlFactory as generatedMarketIdl } from './generated/market.idl.js';
80
92
  * vendored inside this package, so a missing name is a fact about this build, identical in every
81
93
  * environment — never a runtime surprise that only some caller hits. The message names the fix,
82
94
  * because the tempting wrong fix is to paste the old shape back in.
95
+ * ⟨2026-10-06⟩ "vendored inside this package" is no longer how: the factory comes from
96
+ * `@engramx/idl`, pinned to this package's exact version when it is packed. The conclusion stands
97
+ * for the same reason — one version of the interface per version of this package.
83
98
  */
84
99
  export function projectService(generated, methods, IDL) {
85
100
  const served = new Map(generated({ IDL })._fields);
@@ -113,7 +128,7 @@ export const marketSubset = (methods = SDK_MARKET_METHODS) => ({ IDL }) => proje
113
128
  * nothing calls reads as a supported capability to the next person who greps for one, and a name
114
129
  * here the CANISTER does not serve is a construction-time failure — projectService throws on it.
115
130
  *
116
- * The market serves 64 methods. These nine are the BUYER path, which is the only path this SDK has
131
+ * The market serves 64 methods. These seven are the BUYER path, which is the only path this SDK has
117
132
  * ever wrapped: the seller surface (uploads, endpoints, service registration, pricing) is console
118
133
  * work, and the admin surface is recovery work. Neither belongs in an agent's client library.
119
134
  */
@@ -148,6 +163,11 @@ export const SDK_MARKET_METHODS = [
148
163
  * owner-mode `git-revert`, which reaches the actor directly and says so at its call site, and the
149
164
  * encryption migrations the encryption runbook names by hand. If a name here has no caller, that is
150
165
  * a bug in this list, not a reserve.
166
+ * ⟨2026-10-13, the owner's 5A⟩ `git-revert` no longer calls writeMemory: its canister restore moved
167
+ * to @engramx/owner (`--restore`). The encryption migrations and `setMemoryEncryption` are now the
168
+ * only callers of `writeMemory` and `setEncryptionEnabled`; both names leave this list when that
169
+ * trio moves to the owner kit too (it waits on the kit taking `@engramx/client/encryption` as a
170
+ * dependency).
151
171
  *
152
172
  * ADDING A NAME IS A PRODUCT DECISION, not a maintenance one (surface-budget rule L6): no addition
153
173
  * without a named caller.
@@ -158,6 +178,9 @@ export const SDK_ENGRAM_METHODS = [
158
178
  // it that the canister does not serve fails at RUNTIME with method-not-found, exactly like the
159
179
  // hand-written Motoko IDLs check-client-idls.mjs gates. Nothing type-checks it: projectService
160
180
  // narrows a generated factory, and an actor call is `any`.
181
+ // ⟨2026-10-13, the owner's 3A⟩ Something does now: SdkEngramService (below) is the generated
182
+ // interface narrowed to this list, and EngramClient's actor has that type — a name here the
183
+ // canister stopped serving fails to compile, and so does a call to a name not here.
161
184
  //
162
185
  // Six of the twenty MOVED to the market with the commerce graft (confirmJob, disputeJob, getJob,
163
186
  // getJobResult, listServices, createJob) and are NOT replaced here — they belong to a
@@ -174,6 +197,10 @@ export const SDK_ENGRAM_METHODS = [
174
197
  'backupPullChunk',
175
198
  'backupPushChunk',
176
199
  'getBackupMetadata',
200
+ // ⟨2026-10-21, the owner's round-11 answers h and m⟩ Named caller: EngramClient.getBackupRetention —
201
+ // an agent that uploads backups reads how many of its OWN the engram keeps per kind (the cap is per
202
+ // creator from that day: an agent's backup never removes another party's).
203
+ 'getBackupRetention',
177
204
  'getCertifiedAuditHead',
178
205
  'getEncryptedMemoryKey',
179
206
  'getMemoryHistory',
@@ -200,6 +227,9 @@ export const SDK_ENGRAM_METHODS = [
200
227
  // ⟨2026-09-28⟩ Named caller: EngramClient.resignAgent — the agent's own exit, which the owner
201
228
  // decided the same day an agent must be able to take (and have recorded).
202
229
  'resignAgent',
230
+ // ⟨2026-10-21, the owner's round-11 answer g⟩ Named callers: EngramClient.myGrant and the MCP
231
+ // server's engram_my_grant tool — an agent reads its own grant (its own key only).
232
+ 'myGrant',
203
233
  'rotateAgentKeyHash',
204
234
  // ⟨2026-09-29, the owner's ruling of that date (follow-up 10, option A)⟩ Named callers:
205
235
  // EngramClient.nominateAgentKey and EngramClient.acceptAgentKeyNomination — the agent's one-step
package/dist/idl.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"idl.js","sourceRoot":"","sources":["../src/idl.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,EAAE;AACF,wFAAwF;AACxF,sFAAsF;AACtF,2FAA2F;AAC3F,6FAA6F;AAC7F,0FAA0F;AAC1F,qFAAqF;AACrF,6FAA6F;AAC7F,wFAAwF;AACxF,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,8FAA8F;AAC9F,iGAAiG;AACjG,+FAA+F;AAC/F,kGAAkG;AAClG,sCAAsC;A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