@engramx/client 0.15.0-rc.3 → 0.16.0-rc.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.
Files changed (66) hide show
  1. package/README.md +255 -26
  2. package/dist/EngramClient.d.ts +235 -229
  3. package/dist/EngramClient.js +446 -1247
  4. package/dist/EngramClient.js.map +1 -1
  5. package/dist/MarketClient.d.ts +137 -0
  6. package/dist/MarketClient.js +228 -0
  7. package/dist/MarketClient.js.map +1 -0
  8. package/dist/ProfileManager.d.ts +4 -4
  9. package/dist/SessionManager.d.ts +3 -3
  10. package/dist/SessionManager.js +1 -1
  11. package/dist/SessionManager.js.map +1 -1
  12. package/dist/actionReceipt.d.ts +59 -0
  13. package/dist/actionReceipt.js +68 -2
  14. package/dist/actionReceipt.js.map +1 -1
  15. package/dist/auth.d.ts +16 -0
  16. package/dist/auth.js +38 -5
  17. package/dist/auth.js.map +1 -1
  18. package/dist/certifiedAudit.d.ts +32 -6
  19. package/dist/certifiedAudit.js +75 -14
  20. package/dist/certifiedAudit.js.map +1 -1
  21. package/dist/cli.js +95 -26
  22. package/dist/cli.js.map +1 -1
  23. package/dist/encryption.d.ts +26 -12
  24. package/dist/encryption.js +13 -15
  25. package/dist/encryption.js.map +1 -1
  26. package/dist/generated/engram.idl.d.ts +6 -0
  27. package/dist/generated/engram.idl.js +1366 -0
  28. package/dist/generated/engram.idl.js.map +1 -0
  29. package/dist/generated/market.idl.d.ts +6 -0
  30. package/dist/generated/market.idl.js +557 -0
  31. package/dist/generated/market.idl.js.map +1 -0
  32. package/dist/generated/registry.idl.d.ts +6 -0
  33. package/dist/generated/registry.idl.js +510 -0
  34. package/dist/generated/registry.idl.js.map +1 -0
  35. package/dist/idl.d.ts +66 -0
  36. package/dist/idl.js +227 -0
  37. package/dist/idl.js.map +1 -0
  38. package/dist/index.d.ts +12 -18
  39. package/dist/index.js +54 -9
  40. package/dist/index.js.map +1 -1
  41. package/dist/ledgerfsHash.js +1 -1
  42. package/dist/ledgerfsHash.js.map +1 -1
  43. package/dist/lineage.js +8 -5
  44. package/dist/lineage.js.map +1 -1
  45. package/dist/memoryArchive.d.ts +384 -0
  46. package/dist/memoryArchive.js +477 -0
  47. package/dist/memoryArchive.js.map +1 -0
  48. package/dist/migrate.js +31 -4
  49. package/dist/migrate.js.map +1 -1
  50. package/dist/openEngram.d.ts +48 -0
  51. package/dist/openEngram.js +161 -0
  52. package/dist/openEngram.js.map +1 -0
  53. package/dist/pair.d.ts +33 -2
  54. package/dist/pair.js +56 -9
  55. package/dist/pair.js.map +1 -1
  56. package/dist/types.d.ts +244 -307
  57. package/dist/version.d.ts +8 -0
  58. package/dist/version.js +45 -0
  59. package/dist/version.js.map +1 -0
  60. package/dist/wire.d.ts +76 -0
  61. package/dist/wire.js +79 -0
  62. package/dist/wire.js.map +1 -0
  63. package/package.json +3 -13
  64. package/dist/bootstrap.d.ts +0 -21
  65. package/dist/bootstrap.js +0 -71
  66. package/dist/bootstrap.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -2,18 +2,18 @@ import { Principal } from '@icp-sdk/core/principal';
2
2
  export type Role = {
3
3
  Owner: null;
4
4
  } | {
5
- Operator: null;
5
+ Agent: null;
6
6
  } | {
7
7
  Guardian: null;
8
8
  };
9
- export type OperatorStatus = {
9
+ export type AgentStatus = {
10
10
  Active: null;
11
11
  } | {
12
12
  Revoked: null;
13
13
  } | {
14
- Expired: null;
14
+ Resigned: null;
15
15
  };
16
- export interface OperatorPermissions {
16
+ export interface AgentPermissions {
17
17
  canReadMemory: boolean;
18
18
  canAppendMemory: boolean;
19
19
  canReadWallet: boolean;
@@ -26,16 +26,129 @@ export interface OperatorPermissions {
26
26
  */
27
27
  scopes: [] | [string[]];
28
28
  }
29
- export interface OperatorRecord {
29
+ /** The stored form of an enrolment statement — see `AgentRecord.enrolment`. */
30
+ export interface EnrolmentProof {
31
+ rootPubkey: Uint8Array;
32
+ enrolledKey: Principal;
33
+ inviteCode: string;
34
+ signature: Uint8Array;
35
+ }
36
+ /** ⟨2026-09-29⟩ Why an agent's engagement with an engram ended. Mirrors the engram's `AgentEndReason`. */
37
+ export type AgentEndReason = {
38
+ OwnerRevoked: null;
39
+ } | {
40
+ GuardianRevoked: null;
41
+ } | {
42
+ KillSwitch: null;
43
+ } | {
44
+ Reset: null;
45
+ } | {
46
+ Resigned: null;
47
+ };
48
+ /** ⟨2026-09-29⟩ An ending as the engram keeps it — see `AgentRecord.ended`. */
49
+ export interface AgentEnding {
50
+ reason: AgentEndReason;
51
+ day: bigint;
52
+ }
53
+ /**
54
+ * ⟨2026-09-29⟩ Whether the registry put a new engagement on the agent's track record. `NotRecorded`
55
+ * carries a plain sentence: why, whether it is expected, and what to do. The pairing itself
56
+ * has succeeded either way. Mirrors the engram's `TrackRecordNotice`.
57
+ */
58
+ export type TrackRecordNotice = {
59
+ Recorded: null;
60
+ } | {
61
+ NotRecorded: string;
62
+ };
63
+ /**
64
+ * ⟨2026-10-01, the owner's ruling 2 A⟩ How many engrams of its own an agent may still open through
65
+ * this engram, as the owner set it (`setChildAllowance`). `root` is the agent's lasting key — the key
66
+ * that will own what it opens. Mirrors the engram's `ChildAllowanceRow`.
67
+ */
68
+ export interface ChildAllowanceRow {
69
+ root: Principal;
70
+ remaining: bigint;
71
+ }
72
+ /** ⟨2026-09-29⟩ `pairAgent`'s reply: the agent record and its track-record notice. */
73
+ export interface Pairing {
74
+ agent: AgentRecord;
75
+ trackRecord: TrackRecordNotice;
76
+ }
77
+ export interface AgentRecord {
30
78
  principal: Principal;
79
+ /**
80
+ * The agent this key belongs to: the principal of the root key that enrolled it (2026-09-28,
81
+ * owner decision: one root key per agent, with an enrolled key per client). The registry keeps
82
+ * the agent's track record under this.
83
+ */
84
+ root: Principal;
85
+ /**
86
+ * The enrolment statement that admitted this key, as the engram keeps it (2026-09-28, review
87
+ * finding OPS-1): the engram forwards it with every start it reports, so the registry verifies
88
+ * the root's consent itself instead of trusting the engram's word for the root. The invite code
89
+ * in it was burned at pairing.
90
+ */
91
+ enrolment: EnrolmentProof;
31
92
  name: string;
32
- registeredAt: bigint;
33
- lastSeen: bigint;
34
- permissions: OperatorPermissions;
35
- status: OperatorStatus;
36
- publicKeyHash: string | null;
37
- keyRotatedAt: bigint;
93
+ /**
94
+ * When this key was paired (nanoseconds). Renamed from `registeredAt` 2026-09-29 by the
95
+ * vocabulary ruling: pairing is the one verb that admits an agent.
96
+ */
97
+ pairedAtNs: bigint;
98
+ lastSeenNs: bigint;
99
+ permissions: AgentPermissions;
100
+ status: AgentStatus;
101
+ /**
102
+ * ⟨2026-09-29⟩ How this key's engagement with the engram ended — why, and the start of the UTC day
103
+ * (nanoseconds) it ended — or empty while it is active. The engram keeps it so the owner's
104
+ * `resyncAgentEdges` can re-send an ending the registry never received. Candid `opt`.
105
+ */
106
+ ended: [] | [AgentEnding];
107
+ /**
108
+ * ⟨CORRECTED 2026-10-05⟩ Was `string | null`. The wire is Candid `opt text`, and this record is
109
+ * handed back as delivered, so a caller gets `[]` or `[hash]`, never null: `=== null` never
110
+ * fired and `?? fallback` never applied. The same correction was made that day on
111
+ * ApprovalRequest and BackupMetadata; the wire-mirror gate now compares option-ness too.
112
+ */
113
+ publicKeyHash: [] | [string];
114
+ /** ⟨2026-09-29⟩ Count a key replacement as well as a change of the recorded key hash. */
115
+ keyRotatedAtNs: bigint;
38
116
  keyRotationCount: bigint;
117
+ /**
118
+ * ⟨2026-09-29, the owner's ruling of that date (follow-up 10)⟩ A replacement key this agent has
119
+ * nominated (`EngramClient.nominateAgentKey`) that has not yet accepted, and when (nanoseconds);
120
+ * empty when there is none. It expires 24 hours after it was made. Candid `opt`.
121
+ */
122
+ keyNomination: [] | [KeyNomination];
123
+ /**
124
+ * ⟨2026-09-29, review PR-6⟩ Where the engram's two logs stood when the key in use began to hold
125
+ * this record (at pairing, or at the replacement that moved it here). The agent reads the entries
126
+ * this key caused from here on, and none from before.
127
+ */
128
+ keyHeldFrom: LogPosition;
129
+ /**
130
+ * ⟨2026-09-29, review PR-6⟩ The keys this agent held on this engram before the one in use, oldest
131
+ * first (at most 16), each with the stretch of the logs it held the record for. The agent reads
132
+ * the entries each caused within its stretch, so a key replacement does not hide what it did
133
+ * before.
134
+ */
135
+ earlierKeys: HeldKey[];
136
+ }
137
+ /** ⟨2026-09-29, review PR-6⟩ The ids the next entries of the chained record and the read log get. */
138
+ export interface LogPosition {
139
+ record: bigint;
140
+ reads: bigint;
141
+ }
142
+ /** ⟨2026-09-29, review PR-6⟩ A key an agent held, from `from` (inclusive) to `until` (exclusive). */
143
+ export interface HeldKey {
144
+ key: Principal;
145
+ from: LogPosition;
146
+ until: LogPosition;
147
+ }
148
+ /** ⟨2026-09-29, follow-up 10⟩ A pending key nomination — see `AgentRecord.keyNomination`. */
149
+ export interface KeyNomination {
150
+ key: Principal;
151
+ atNs: bigint;
39
152
  }
40
153
  /** Internal wire type — raw bytes as stored on-canister (plaintext; see encryption.ts) */
41
154
  export interface RawMemoryFile {
@@ -43,7 +156,7 @@ export interface RawMemoryFile {
43
156
  content: Uint8Array;
44
157
  version: bigint;
45
158
  lastModifiedBy: Principal;
46
- lastModifiedAt: bigint;
159
+ lastModifiedAtNs: bigint;
47
160
  }
48
161
  /** Public type — content decoded to a UTF-8 string (no decryption; see encryption.ts) */
49
162
  export interface MemoryFile {
@@ -51,12 +164,12 @@ export interface MemoryFile {
51
164
  content: string;
52
165
  version: bigint;
53
166
  lastModifiedBy: Principal;
54
- lastModifiedAt: bigint;
167
+ lastModifiedAtNs: bigint;
55
168
  }
56
169
  export interface MemoryFileInfo {
57
170
  path: string;
58
171
  version: bigint;
59
- lastModifiedAt: bigint;
172
+ lastModifiedAtNs: bigint;
60
173
  }
61
174
  /**
62
175
  * Result of `startSession()` — the engram's memory assembled for injection at the start of an agent
@@ -93,7 +206,7 @@ export interface MemoryVersionSummary {
93
206
  tombstone: null;
94
207
  };
95
208
  by: Principal;
96
- at: bigint;
209
+ atNs: bigint;
97
210
  size: bigint;
98
211
  /** 32-byte hash the record commits to. Anyone holding the bytes can check them against it. */
99
212
  contentRoot: Uint8Array;
@@ -152,34 +265,116 @@ export interface Account {
152
265
  }
153
266
  export interface AuditEntry {
154
267
  id: bigint;
155
- timestamp: bigint;
268
+ timestampNs: bigint;
156
269
  caller: Principal;
157
270
  callerRole: Role;
158
271
  operation: string;
159
272
  details: string;
160
273
  success: boolean;
161
274
  }
275
+ /**
276
+ * A window of the engram's record, as the reader may see it. ⟨2026-09-29, owner ruling follow-up 16
277
+ * (B)⟩ An agent reads only the entries it caused; the owner and guardians read everything. So
278
+ * `withheld` counts the entries in the window this reader was not shown, and `items.length +
279
+ * withheld` is the window examined: a page with `withheld > 0` is not the whole record. `total` is
280
+ * how many entries the record has ever held (the same number the public certified head publishes).
281
+ * WHAT WOULD MAKE THIS WRONG: a reader handed only `items` — which is why `readAuditLog` returns this
282
+ * page and not the bare array it used to.
283
+ */
284
+ export interface AuditPage {
285
+ items: AuditEntry[];
286
+ total: bigint;
287
+ withheld: bigint;
288
+ }
289
+ /**
290
+ * ⚠ **STALE AS OF 2026-08-24 — this type no longer describes what the canister returns, and the
291
+ * three fields below carrying that news are the reason.** `EngramClient.status()` calls
292
+ * `about()` (the engram's `status()` was split into `about()` + `getOwnerConsole()` in the 0.16.0
293
+ * cut), and `About` carries NO `owner`, NO `authorized` and NO `cyclesBalance`. Measured against
294
+ * `src/engram/engram.did` on 2026-08-24, not inferred.
295
+ *
296
+ * Left declared rather than retyped because the retype is not local: `migrate.ts`'s
297
+ * `hasValidPairing` returns `status.authorized`, which is now `undefined` — falsy — so every
298
+ * caller reads as UNPAIRED. Removing the field here without fixing that call site turns a silent
299
+ * wrong answer into a compile error in a file this change does not own; both need to move
300
+ * together. Named here so the next reader does not mistake this for a description of the wire.
301
+ *
302
+ * ⟨RESOLVED 2026-10-05⟩ The banner above describes a past state: all three fields are now gone.
303
+ * `authorized` went on 2026-08-25 (its note is below). `owner` and `cyclesBalance` stayed declared
304
+ * until the v0.16.0-rc.1 release workflow failed to build the OpenClaw plugin, which still read
305
+ * `status.authorized`. The same plugin command read `status.cyclesBalance.length`. Against a real
306
+ * `about()` reply that is a TypeError, not a blank line, and tsc could not see it, because the
307
+ * actor is `ActorSubclass<any>` and this declaration is the only thing standing between a reader
308
+ * and the wire. Every field left here is one `type About` serves, compared field by field with
309
+ * `src/engram/engram.did`. test/wire-mirror.test.ts checks the same thing against the generated
310
+ * factory and fails on any declared field the reply does not carry. Read the owner and the cycles
311
+ * from `getOwnerConsole()`, which refuses a caller with no role on the engram instead of masking.
312
+ */
162
313
  export interface EngramStatus {
163
- owner: Principal | null;
164
314
  memoryFileCount: bigint;
165
315
  auditLogSize: bigint;
166
- operatorCount: bigint;
167
- /**
168
- * D3 discriminator: when false, cyclesBalance is a MASK (0), owner is null, and the sensitive
169
- * fields are hidden — do not read cyclesBalance=0 as "broke" without checking this first.
170
- */
171
- /** Present only on 0.12.0+ engrams (not wire-declared until the fleet serves it). */
172
- authorized?: boolean;
173
- cyclesBalance: bigint;
316
+ agentCount: bigint;
174
317
  version: string;
175
318
  guardianCount: bigint;
176
319
  paymentsFrozen: boolean;
177
320
  writesPaused: boolean;
178
321
  backupCount: bigint;
179
322
  totalBackupSize: bigint;
323
+ /**
324
+ * Whether NEW memory writes should be encrypted client-side. Ungated, and ⟨2026-08-24⟩ for a
325
+ * simpler reason than the one recorded here before: this said "`status()` redacts only `owner`
326
+ * and `cyclesBalance`", which described the masking that the 0.16.0 split removed. `about()`
327
+ * redacts NOTHING — the fields worth redacting left for `getOwnerConsole()` — so this reads the
328
+ * `memoryEncryptionEnabled` var for every caller including an anonymous one. Verified against
329
+ * `src/engram/engram.did` (`type About`), which carries `encryptionEnabled : bool`.
330
+ *
331
+ * DECLARED HERE ON 2026-08-17 because the SDK now READS it. The canister has always served it;
332
+ * this interface simply never named it, because the client asked the singleton
333
+ * `isEncryptionEnabled()` instead. The surface diet (R3) removed that method — one variable, one
334
+ * audience, two doors — so `ensureEncryptionMode()`, `isMemoryEncryptionEnabled()` and
335
+ * `auditLogSize()` all come through this record now, and a field the write path branches on may
336
+ * not be left off the type.
337
+ *
338
+ * `totalMemoryWrites` and `verifiedHuman` are still served-but-undeclared here, exactly as
339
+ * before: this type is a narrowing of the record, not a transcription of it, and nothing in this
340
+ * package reads those two.
341
+ */
342
+ encryptionEnabled: boolean;
343
+ }
344
+ /**
345
+ * ⟨0.16.0, L2.2⟩ The GATED half of the `status()` split — the fields `about()` shed because they
346
+ * identify the engram's people or its money, which an anonymous query must not hand out.
347
+ *
348
+ * SHAPE READ FROM `src/generated/engram.idl.ts` (`const OwnerConsole = IDL.Record({…})`), not
349
+ * inferred. `owner` is `IDL.Opt(IDL.Principal)`, which agent-js delivers as a 0-or-1-element
350
+ * ARRAY — the same option-as-array shape that, read as a bare value elsewhere in this package,
351
+ * silently corrupted a certificate witness (see `optBytes` in certifiedAudit.ts). `cyclesBalance`
352
+ * is a BARE bigint here and an option on `EngramStatus`: the widening exists only on the ungated
353
+ * half, and behind a gate there is nobody to mask it from.
354
+ * ⟨CORRECTED 2026-10-05⟩ There is no option on `EngramStatus`. `about()` never served
355
+ * `cyclesBalance` at 0.16.0, so the field "on the ungated half" was a declaration with no wire
356
+ * behind it, and it is now deleted. This is the only SDK type left with a `cyclesBalance` field.
357
+ *
358
+ * DESPITE THE NAME the gate is #anyRole — owner, active agent or active guardian — which is
359
+ * what makes this the right pairing probe for an agent SDK.
360
+ */
361
+ export interface OwnerConsole {
362
+ owner: [] | [Principal];
363
+ cyclesBalance: bigint;
364
+ memoryKeyEpoch: bigint;
365
+ protectedPathCount: bigint;
366
+ agentRevisablePathCount: bigint;
367
+ pendingApprovalCount: bigint;
368
+ /**
369
+ * ⟨ADDED 2026-10-05⟩ Served since the paid-session rail began counting, never declared here, so
370
+ * an SDK caller could not read it while the repo's own integration suite read it off the raw
371
+ * actor. How many paid-session calls named a session this engram does not have: counted, not
372
+ * logged, so a flood of forged session ids cannot push real refusals out of the denial log. Zero
373
+ * is a real answer on a fresh engram. Measured that day against engram.did: with it, this type
374
+ * declares all seven fields the record serves.
375
+ */
376
+ unknownSessionRefusals: bigint;
180
377
  }
181
- /** @deprecated Use EngramStatus instead */
182
- export type VaultStatus = EngramStatus;
183
378
  export type EngramRecordStatus = {
184
379
  Active: null;
185
380
  } | {
@@ -187,16 +382,12 @@ export type EngramRecordStatus = {
187
382
  } | {
188
383
  Deleted: null;
189
384
  };
190
- /** @deprecated Use EngramRecordStatus instead */
191
- export type VaultRecordStatus = EngramRecordStatus;
192
385
  export interface EngramRecord {
193
386
  owner: Principal;
194
387
  canisterId: Principal;
195
- createdAt: bigint;
388
+ createdAtNs: bigint;
196
389
  status: EngramRecordStatus;
197
390
  }
198
- /** @deprecated Use EngramRecord instead */
199
- export type VaultRecord = EngramRecord;
200
391
  export interface RegistryStatus {
201
392
  totalEngrams: bigint;
202
393
  activeEngrams: bigint;
@@ -204,7 +395,7 @@ export interface RegistryStatus {
204
395
  engramWasmHash: string;
205
396
  }
206
397
  export interface GuardianPermissions {
207
- canRevokeOperators: boolean;
398
+ canRevokeAgents: boolean;
208
399
  canFreezePayments: boolean;
209
400
  canPauseWrites: boolean;
210
401
  /**
@@ -216,214 +407,9 @@ export interface GuardianPermissions {
216
407
  export interface GuardianRecord {
217
408
  principal: Principal;
218
409
  name: string;
219
- addedAt: bigint;
410
+ addedAtNs: bigint;
220
411
  permissions: GuardianPermissions;
221
412
  }
222
- export type SessionStatus = {
223
- open: null;
224
- } | {
225
- closing: null;
226
- } | {
227
- closed: null;
228
- } | {
229
- expired: null;
230
- }
231
- /** Reserved catch-all: a future ic402 status arrives as `other`, never as a new tag. */
232
- | {
233
- other: string;
234
- };
235
- export interface Eip3009Authorization {
236
- from: string;
237
- to: string;
238
- value: bigint;
239
- validAfter: bigint;
240
- validBefore: bigint;
241
- nonce: Uint8Array;
242
- v: number;
243
- r: Uint8Array;
244
- s: Uint8Array;
245
- }
246
- export interface PaymentRequirement {
247
- scheme: string;
248
- network: string;
249
- token: string;
250
- amount: bigint;
251
- recipient: string;
252
- nonce: Uint8Array;
253
- expiry: bigint;
254
- tokenName: string | null;
255
- tokenVersion: string | null;
256
- }
257
- export interface PaymentSignature {
258
- scheme: string;
259
- network: string;
260
- signature: Uint8Array;
261
- asset: string | null;
262
- publicKey: Uint8Array | null;
263
- sender: string;
264
- nonce: Uint8Array;
265
- authorization: Eip3009Authorization | null;
266
- }
267
- export interface SessionIntent {
268
- network: string;
269
- token: string;
270
- recipient: string;
271
- suggestedDeposit: bigint;
272
- minDeposit: bigint | null;
273
- expiry: bigint;
274
- costPerCall: bigint | null;
275
- description: string | null;
276
- }
277
- export interface SessionConfig {
278
- maxDeposit: bigint;
279
- autoClose: boolean;
280
- idleTimeout: bigint | null;
281
- }
282
- export interface SessionState {
283
- id: string;
284
- payer: Principal;
285
- deposited: bigint;
286
- consumed: bigint;
287
- remaining: bigint;
288
- voucherCount: bigint;
289
- status: SessionStatus;
290
- openedAt: bigint;
291
- lastActivityAt: bigint;
292
- }
293
- export interface Voucher {
294
- sessionId: string;
295
- cumulativeAmount: bigint;
296
- sequence: bigint;
297
- signature: Uint8Array;
298
- }
299
- export interface SpendingPolicy {
300
- maxPerTransaction: bigint | null;
301
- maxPerDay: bigint | null;
302
- rateLimitPerMinute: bigint | null;
303
- maxSessionDeposit: bigint | null;
304
- maxConcurrentSessions: bigint | null;
305
- maxSessionDuration: bigint | null;
306
- sessionIdleTimeout: bigint | null;
307
- allowedCallers: Principal[] | null;
308
- blockedCallers: Principal[] | null;
309
- }
310
- export interface ContentEntry {
311
- id: string;
312
- mimeType: string;
313
- totalSize: bigint;
314
- chunkCount: bigint;
315
- createdAt: bigint;
316
- }
317
- export interface ContentRef {
318
- id: string;
319
- mimeType: string | null;
320
- sizeBytes: bigint | null;
321
- metadata: Array<[string, string]> | null;
322
- }
323
- export interface AccessGrant {
324
- grantId: string;
325
- contentRef: ContentRef;
326
- grantee: Principal;
327
- receiptId: string;
328
- issuedAt: bigint;
329
- expiresAt: bigint;
330
- hmac: Uint8Array;
331
- }
332
- export type AccessGrantResult = {
333
- ok: null;
334
- } | {
335
- expired: string;
336
- } | {
337
- revoked: string;
338
- } | {
339
- invalidGrant: string;
340
- };
341
- export interface ContentDelivery {
342
- grant: AccessGrant;
343
- /** EVM settle tx hash when the purchase settled on-chain (null-opt otherwise). */
344
- settlementTxHash: [string] | [];
345
- delivery: {
346
- inline: Uint8Array;
347
- } | {
348
- canisterQuery: {
349
- method: string;
350
- chunkCount: bigint;
351
- };
352
- } | {
353
- httpUrl: string;
354
- } | {
355
- assetCanister: {
356
- canisterId: Principal;
357
- path: string;
358
- };
359
- };
360
- }
361
- export type PaymentResult = {
362
- ok: PaymentReceipt;
363
- } | {
364
- insufficientFunds: string;
365
- } | {
366
- invalidSignature: string;
367
- } | {
368
- expired: string;
369
- } | {
370
- policyDenied: string;
371
- } | {
372
- tokenNotAccepted: string;
373
- } | {
374
- networkNotSupported: string;
375
- } | {
376
- settlementFailed: string;
377
- } | {
378
- settlementPending: string;
379
- } | {
380
- reputationTooLow: bigint;
381
- } | {
382
- depositBelowMinimum: bigint;
383
- }
384
- /** Reserved catch-all: a future ic402 result arrives as `other`, never as a new tag. */
385
- | {
386
- other: string;
387
- };
388
- export interface PaymentReceipt {
389
- id: string;
390
- amount: bigint;
391
- token: string;
392
- sender: string;
393
- recipient: string;
394
- network: string;
395
- timestamp: bigint;
396
- txHash: string | null;
397
- sessionId: string | null;
398
- refunded: bigint | null;
399
- }
400
- export interface AgentCard {
401
- name: string;
402
- description: string;
403
- services: ServiceEntry[];
404
- x402Support: boolean;
405
- }
406
- export interface ServiceEntry {
407
- name: string;
408
- endpoint: string;
409
- version: string;
410
- skills: string[];
411
- domains: string[];
412
- }
413
- export type VerificationLevel = {
414
- Orb: null;
415
- } | {
416
- Device: null;
417
- } | {
418
- Document: null;
419
- };
420
- export interface WorldIdProof {
421
- nullifierHash: string;
422
- merkleRoot: string;
423
- proof: string;
424
- verificationLevel: VerificationLevel;
425
- verifiedAt: bigint;
426
- }
427
413
  export type BackupType = {
428
414
  FullSnapshot: null;
429
415
  } | {
@@ -458,83 +444,34 @@ export interface ApprovalRequest {
458
444
  policyLimit: bigint;
459
445
  policyField: string;
460
446
  rationale: string;
461
- createdAt: bigint;
462
- expiresAt: bigint;
447
+ createdAtNs: bigint;
448
+ expiresAtNs: bigint;
463
449
  status: ApprovalStatus;
464
- approvedBy: Principal | null;
465
- approvedAt: bigint | null;
466
- denialReason: string | null;
467
- }
468
- export type EndpointType = {
469
- Content: null;
470
- };
471
- export type EndpointStatus = {
472
- Disabled: null;
473
- } | {
474
- Enabled: null;
475
- } | {
476
- Deleted: null;
477
- };
478
- export interface X402Endpoint {
479
- id: string;
480
- name: string;
481
- description: string;
482
- endpointType: EndpointType;
483
- contentId: string | null;
484
- suggestedPrice: bigint;
485
- price: bigint;
486
- createdBy: Principal;
487
- createdAt: bigint;
488
- status: EndpointStatus;
489
- enabledBy: Principal | null;
490
- enabledAt: bigint | null;
491
- totalRevenue: bigint;
492
- totalPurchases: bigint;
493
- }
494
- export interface PurchaseRecord {
495
- id: string;
496
- endpointId: string;
497
- buyer: string;
498
- amount: bigint;
499
- network: string;
500
- timestamp: bigint;
501
- receiptId: string;
502
- txHash: string | null;
503
- }
504
- export interface RevenueSummary {
505
- totalRevenue: bigint;
506
- totalPurchases: bigint;
507
- endpointBreakdown: Array<{
508
- endpointId: string;
509
- name: string;
510
- revenue: bigint;
511
- purchases: bigint;
512
- }>;
513
- }
514
- export interface StorageStats {
515
- totalFiles: bigint;
516
- totalContentSize: bigint;
517
- memoryFilesSize: bigint;
518
- memoryFilesCount: bigint;
519
- sessionFilesSize: bigint;
520
- sessionFilesCount: bigint;
521
- versionHistorySize: bigint;
522
- versionHistoryCount: bigint;
523
- backupSize: bigint;
524
- backupCount: bigint;
525
- fileLimit: bigint;
526
- auditLogSize: bigint;
450
+ /**
451
+ * ⟨CORRECTED 2026-10-05⟩ These three were `X | null`. The wire is Candid `opt`, and
452
+ * getMyApprovalRequests hands the rows back as delivered, so each is `[]` or `[value]`, never
453
+ * null (see AgentRecord.publicKeyHash).
454
+ */
455
+ approvedBy: [] | [Principal];
456
+ approvedAtNs: [] | [bigint];
457
+ denialReason: [] | [string];
527
458
  }
528
459
  export interface BackupMetadata {
529
460
  backupId: string;
530
461
  dbType: string;
531
462
  backupType: BackupType;
532
- parentBackupId: string | null;
463
+ /**
464
+ * ⟨CORRECTED 2026-10-05⟩ This and `backupLabel` were `string | null`. The wire is Candid `opt
465
+ * text`, and getBackupMetadata and listBackups hand the record back as delivered, so each is `[]`
466
+ * or `[text]`, never null (see AgentRecord.publicKeyHash). The OpenClaw backups table printed
467
+ * the label correctly only because an array of one string prints as that string.
468
+ */
469
+ parentBackupId: [] | [string];
533
470
  totalSize: bigint;
534
471
  chunkCount: bigint;
535
472
  sha256: string;
536
- createdAt: bigint;
473
+ createdAtNs: bigint;
537
474
  createdBy: Principal;
538
- backupLabel: string | null;
475
+ backupLabel: [] | [string];
539
476
  status: BackupStatus;
540
477
  }
@@ -0,0 +1,8 @@
1
+ /** Printed in place of a version this module could not read: a visible blank, never the bare form. */
2
+ export declare const UNREAD_VERSION = "<version>";
3
+ /** The version this package was built with (its package.json's), or UNREAD_VERSION. */
4
+ export declare const VERSION: string;
5
+ /** `npx @engramx/client@<version>` — the prefix of every command this package's help prints. */
6
+ export declare const NPX_CLIENT: string;
7
+ /** The pairing command, pinned to this build's version. */
8
+ export declare function pairCommand(code?: string, engram?: string): string;