@engramx/client 0.16.0-rc.12 → 0.16.0-rc.14

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 (68) hide show
  1. package/README.md +31 -8
  2. package/dist/EngramClient.d.ts +45 -15
  3. package/dist/EngramClient.js +121 -70
  4. package/dist/EngramClient.js.map +1 -1
  5. package/dist/ProfileManager.d.ts +3 -19
  6. package/dist/ProfileManager.js +1 -58
  7. package/dist/ProfileManager.js.map +1 -1
  8. package/dist/SessionManager.d.ts +1 -1
  9. package/dist/SessionManager.js.map +1 -1
  10. package/dist/certifiedAudit.d.ts +31 -0
  11. package/dist/certifiedAudit.js +124 -0
  12. package/dist/certifiedAudit.js.map +1 -1
  13. package/dist/claude-setup.d.ts +15 -6
  14. package/dist/claude-setup.js +30 -20
  15. package/dist/claude-setup.js.map +1 -1
  16. package/dist/cli.js +103 -166
  17. package/dist/cli.js.map +1 -1
  18. package/dist/connect-config.d.ts +109 -0
  19. package/dist/connect-config.js +251 -0
  20. package/dist/connect-config.js.map +1 -0
  21. package/dist/encryption.js +7 -1
  22. package/dist/encryption.js.map +1 -1
  23. package/dist/evidence.d.ts +94 -0
  24. package/dist/evidence.js +352 -0
  25. package/dist/evidence.js.map +1 -0
  26. package/dist/idl.d.ts +16 -1
  27. package/dist/idl.js +9 -1
  28. package/dist/idl.js.map +1 -1
  29. package/dist/index.d.ts +11 -5
  30. package/dist/index.js +13 -4
  31. package/dist/index.js.map +1 -1
  32. package/dist/ledgerfsHash.d.ts +0 -2
  33. package/dist/ledgerfsHash.js +0 -2
  34. package/dist/ledgerfsHash.js.map +1 -1
  35. package/dist/lineage.d.ts +7 -1
  36. package/dist/lineage.js +7 -1
  37. package/dist/lineage.js.map +1 -1
  38. package/dist/memoryArchive.d.ts +12 -77
  39. package/dist/memoryArchive.js.map +1 -1
  40. package/dist/migrate.d.ts +1 -30
  41. package/dist/migrate.js +13 -136
  42. package/dist/migrate.js.map +1 -1
  43. package/dist/openclaw-local.d.ts +86 -0
  44. package/dist/openclaw-local.js +332 -0
  45. package/dist/openclaw-local.js.map +1 -0
  46. package/dist/openclaw-setup.d.ts +2 -2
  47. package/dist/openclaw-setup.js +8 -36
  48. package/dist/openclaw-setup.js.map +1 -1
  49. package/dist/path-utils.d.ts +0 -16
  50. package/dist/path-utils.js +4 -27
  51. package/dist/path-utils.js.map +1 -1
  52. package/dist/publicRecord.d.ts +5 -0
  53. package/dist/publicRecord.js +52 -0
  54. package/dist/publicRecord.js.map +1 -0
  55. package/dist/recordChain.d.ts +69 -0
  56. package/dist/recordChain.js +145 -0
  57. package/dist/recordChain.js.map +1 -0
  58. package/dist/schema.d.ts +6 -17
  59. package/dist/schema.js +6 -28
  60. package/dist/schema.js.map +1 -1
  61. package/dist/types.d.ts +50 -453
  62. package/dist/verify.d.ts +6 -0
  63. package/dist/verify.js +16 -0
  64. package/dist/verify.js.map +1 -0
  65. package/package.json +17 -5
  66. package/dist/offline.d.ts +0 -21
  67. package/dist/offline.js +0 -104
  68. package/dist/offline.js.map +0 -1
@@ -0,0 +1,109 @@
1
+ export interface ConnectParams {
2
+ canisterId: string;
3
+ /** IC gateway host. Defaults to mainnet (icp0.io). Local replica: http://localhost:4943 */
4
+ host?: string;
5
+ }
6
+ export declare const MAINNET_HOST = "https://icp0.io";
7
+ /** What a surface that prints the per-client guides passes: the engram, and the build's version. */
8
+ export interface GuideParams extends ConnectParams {
9
+ /**
10
+ * The @engramx/client version the surface printing these guides was BUILT with — its own
11
+ * package.json's version, which the release's version change stamps (X.Y.Z-rc.N while a release
12
+ * candidate soaks, X.Y.Z once the final release is cut). Every pairing command in the guides
13
+ * names it.
14
+ *
15
+ * ⟨2026-10-13⟩ It is also the @engramx/mcp version the local (stdio) server config names
16
+ * (`mcpPackage`): the protocol's packages share one version number, which each release's version
17
+ * change stamps into every one of them, so the surface's own version is both.
18
+ */
19
+ clientVersion: string;
20
+ }
21
+ /**
22
+ * The pairing command, pinned to the version the surface printing it was built with.
23
+ *
24
+ * WHY (the owner's ruling of 2026-10-03: print the exact version each page was built with).
25
+ * A bare `npx @engramx/client pair …` installs npm's default (`latest`), which is the last FINAL
26
+ * release: while a release candidate soaks under the `next` tag, every surface built from it would
27
+ * hand out a command that installs the previous release, and a previous release cannot pair with
28
+ * this release's engram (the 0.15.0 → 0.16.0 enrolment change). Pinned to the build's own version,
29
+ * the command names the final version once the final release is cut — through that release's own
30
+ * version change, with nothing to undo. WHAT WOULD MAKE THIS WRONG: a surface that prints the guides
31
+ * for a different release than the one it was built from (then `clientVersion` must be that
32
+ * release's), or a published version being withdrawn from npm (a pinned command then fails loudly,
33
+ * where a bare one would quietly install another release).
34
+ */
35
+ export declare function pairCommand(clientVersion: string, inviteCode: string, canisterId: string): string;
36
+ /** The remote MCP endpoint URL for an engram canister (boundary-node subdomain routing). */
37
+ export declare function mcpUrl({ canisterId, host }: ConnectParams): string;
38
+ /**
39
+ * The @engramx/mcp package the local (stdio) server config runs, pinned to the version the surface
40
+ * printing it was built with: `@engramx/mcp@<version>`.
41
+ *
42
+ * ⟨ADDED 2026-10-13, the owner's "fix … the MCP version in rc.12"⟩ WHY. The config said
43
+ * `npx -y @engramx/mcp`, and a bare name installs npm's default (`latest`) — the last FINAL release.
44
+ * While a release candidate soaks under `next`, that is the previous release (0.15.0 during the
45
+ * 0.16.0 soak, read from npm's dist-tags 2026-10-13), which cannot talk to this release's engram, so
46
+ * the first session started from the copied config failed. The defect class is the bare pairing
47
+ * command's (`pairCommand` above); that fix missed this one because the package name sits in an
48
+ * argument list, not a command line.
49
+ *
50
+ * A version that is not a release version — a surface that could not read its own — prints the
51
+ * visible blank `<version>`, which npm refuses by name (EINVALIDTAGNAME). Never `@engramx/mcp@` or
52
+ * the bare name: npm reads both as the range `*` and installs `latest`, the very failure this
53
+ * prevents (npm-package-arg, measured 2026-10-13 with npm 11.19.1).
54
+ *
55
+ * WHAT WOULD MAKE THIS WRONG: the packages no longer sharing one version number (then the surface
56
+ * must pass @engramx/mcp's own version), a surface printing the config for a release other than the
57
+ * one it was built from, or the named version being withdrawn from npm (the pinned config then
58
+ * fails loudly, where a bare one would quietly run another release).
59
+ */
60
+ export declare function mcpPackage(version: string): string;
61
+ /** What the stdio entry needs beyond the guides: the key file, when the surface knows it. */
62
+ export interface StdioParams extends GuideParams {
63
+ /**
64
+ * The session key file the server reads. ⟨2026-10-13⟩ Set by `engramx pair --target claude`, which
65
+ * just wrote that file (and may have been given `--key-path`); omitted by surfaces that do not
66
+ * know it, so the server reads its default, ~/.engramx/session.key.
67
+ */
68
+ sessionKeyPath?: string;
69
+ }
70
+ /** The stdio `mcpServers.engramx` entry, as every surface writes it. */
71
+ export interface StdioServerEntry {
72
+ command: string;
73
+ args: string[];
74
+ env: Record<string, string>;
75
+ }
76
+ /**
77
+ * Claude Desktop / Cursor STDIO server entry (local @engramx/mcp, session-key auth), running the
78
+ * @engramx/mcp version the surface was built with (`mcpPackage`).
79
+ */
80
+ export declare function stdioServerConfig({ canisterId, host, clientVersion, sessionKeyPath, }: StdioParams): StdioServerEntry;
81
+ /** The claude_desktop_config.json fragment with the engramx server under mcpServers. */
82
+ export declare function claudeDesktopConfig(p: StdioParams): {
83
+ mcpServers: {
84
+ engramx: StdioServerEntry;
85
+ };
86
+ };
87
+ export interface ClientGuide {
88
+ id: string;
89
+ name: string;
90
+ /** 'remote' = canister-hosted HTTP MCP + OAuth; 'stdio' = local @engramx/mcp + session key */
91
+ transport: 'remote' | 'stdio';
92
+ steps: string[];
93
+ /** Optional copy-paste install snippet (CLI command, YAML, or JSON). */
94
+ snippet?: string;
95
+ }
96
+ /** Per-client connection guides — identical wording in the CLI and the web page. */
97
+ export declare function clientGuides(p: GuideParams): ClientGuide[];
98
+ /** Everything a consumer needs in one call. */
99
+ export declare function connectInfo(p: GuideParams): {
100
+ canisterId: string;
101
+ host: string;
102
+ mcpUrl: string;
103
+ claudeDesktopConfig: {
104
+ mcpServers: {
105
+ engramx: StdioServerEntry;
106
+ };
107
+ };
108
+ guides: ClientGuide[];
109
+ };
@@ -0,0 +1,251 @@
1
+ // Canonical config generation for connecting AI clients (Claude.ai web, Claude Desktop, Cursor, …)
2
+ // to an engram's remote MCP endpoint. Used by the `@engramx/mcp connect` CLI.
3
+ //
4
+ // Dependency-free and free of Node/browser-only APIs so any consumer (this CLI, or a web UI) can
5
+ // import it unchanged. The contract test (connect-config.test.ts) pins the output — downstream UIs
6
+ // that re-render this config should reuse this module + that test so every surface stays identical.
7
+ //
8
+ // ⟨MOVED 2026-10-13, the bloat audit + the owner's 3A⟩ From integrations/mcp/src/ into
9
+ // @engramx/client, published as the browser-safe subpath `@engramx/client/connect-config`, so a web
10
+ // UI imports it instead of keeping a hand copy (the platform's was policed by a sync script). It is
11
+ // also now the ONE generator of the stdio `mcpServers.engramx` entry: claude-setup.ts
12
+ // (`engramx pair --target claude`) built a second one that had drifted (the session-key variable set
13
+ // there and not here; `ic0.app` the only mainnet spelling there). `stdioServerConfig` takes the
14
+ // key path for the surfaces that know it. Still dependency-free — test/browser-safe-subpaths.test.ts
15
+ // holds it to that.
16
+ //
17
+ // ⟨2026-10-03⟩ Every pairing command this module prints names the exact @engramx/client version the
18
+ // surface printing it was built with (`npx @engramx/client@<version> pair …`), so the caller passes
19
+ // that version in (`GuideParams.clientVersion`): this module cannot read a package.json and stay
20
+ // usable in a browser. This CLI passes its own package.json's version; a web UI passes the version
21
+ // it was built with. See `pairCommand` below for why.
22
+ // ⟨2026-10-13⟩ The local (stdio) server config takes that same version and names
23
+ // `@engramx/mcp@<version>` (`mcpPackage` below) — it named the bare package until then.
24
+ export const MAINNET_HOST = 'https://icp0.io';
25
+ /**
26
+ * The pairing command, pinned to the version the surface printing it was built with.
27
+ *
28
+ * WHY (the owner's ruling of 2026-10-03: print the exact version each page was built with).
29
+ * A bare `npx @engramx/client pair …` installs npm's default (`latest`), which is the last FINAL
30
+ * release: while a release candidate soaks under the `next` tag, every surface built from it would
31
+ * hand out a command that installs the previous release, and a previous release cannot pair with
32
+ * this release's engram (the 0.15.0 → 0.16.0 enrolment change). Pinned to the build's own version,
33
+ * the command names the final version once the final release is cut — through that release's own
34
+ * version change, with nothing to undo. WHAT WOULD MAKE THIS WRONG: a surface that prints the guides
35
+ * for a different release than the one it was built from (then `clientVersion` must be that
36
+ * release's), or a published version being withdrawn from npm (a pinned command then fails loudly,
37
+ * where a bare one would quietly install another release).
38
+ */
39
+ export function pairCommand(clientVersion, inviteCode, canisterId) {
40
+ return `npx @engramx/client@${clientVersion} pair ${inviteCode} --engram ${canisterId}`;
41
+ }
42
+ function isLocal(host) {
43
+ return host.includes('localhost') || host.includes('127.0.0.1');
44
+ }
45
+ /** The remote MCP endpoint URL for an engram canister (boundary-node subdomain routing). */
46
+ export function mcpUrl({ canisterId, host = MAINNET_HOST }) {
47
+ if (isLocal(host))
48
+ return `http://${canisterId}.localhost:4943/mcp`;
49
+ return `https://${canisterId}.icp0.io/mcp`;
50
+ }
51
+ /** A release version as the release's version change writes it: X.Y.Z, or X.Y.Z-<pre-release>. */
52
+ const RELEASE_VERSION = /^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$/;
53
+ /**
54
+ * The @engramx/mcp package the local (stdio) server config runs, pinned to the version the surface
55
+ * printing it was built with: `@engramx/mcp@<version>`.
56
+ *
57
+ * ⟨ADDED 2026-10-13, the owner's "fix … the MCP version in rc.12"⟩ WHY. The config said
58
+ * `npx -y @engramx/mcp`, and a bare name installs npm's default (`latest`) — the last FINAL release.
59
+ * While a release candidate soaks under `next`, that is the previous release (0.15.0 during the
60
+ * 0.16.0 soak, read from npm's dist-tags 2026-10-13), which cannot talk to this release's engram, so
61
+ * the first session started from the copied config failed. The defect class is the bare pairing
62
+ * command's (`pairCommand` above); that fix missed this one because the package name sits in an
63
+ * argument list, not a command line.
64
+ *
65
+ * A version that is not a release version — a surface that could not read its own — prints the
66
+ * visible blank `<version>`, which npm refuses by name (EINVALIDTAGNAME). Never `@engramx/mcp@` or
67
+ * the bare name: npm reads both as the range `*` and installs `latest`, the very failure this
68
+ * prevents (npm-package-arg, measured 2026-10-13 with npm 11.19.1).
69
+ *
70
+ * WHAT WOULD MAKE THIS WRONG: the packages no longer sharing one version number (then the surface
71
+ * must pass @engramx/mcp's own version), a surface printing the config for a release other than the
72
+ * one it was built from, or the named version being withdrawn from npm (the pinned config then
73
+ * fails loudly, where a bare one would quietly run another release).
74
+ */
75
+ export function mcpPackage(version) {
76
+ return `@engramx/mcp@${RELEASE_VERSION.test(version) ? version : '<version>'}`;
77
+ }
78
+ /**
79
+ * Claude Desktop / Cursor STDIO server entry (local @engramx/mcp, session-key auth), running the
80
+ * @engramx/mcp version the surface was built with (`mcpPackage`).
81
+ */
82
+ export function stdioServerConfig({ canisterId, host = MAINNET_HOST, clientVersion, sessionKeyPath, }) {
83
+ const env = { ENGRAM_CANISTER_ID: canisterId };
84
+ if (sessionKeyPath)
85
+ env['ENGRAM_SESSION_KEY_PATH'] = sessionKeyPath;
86
+ // Only pin a non-default host (e.g. local replica); mainnet is the @engramx/mcp default.
87
+ if (host !== MAINNET_HOST && host !== 'https://ic0.app')
88
+ env['ENGRAM_HOST'] = host;
89
+ // ⟨2026-10-13⟩ Was `args: ['-y', '@engramx/mcp']` — unpinned; `mcpPackage` says why.
90
+ return { command: 'npx', args: ['-y', mcpPackage(clientVersion)], env };
91
+ }
92
+ /** The claude_desktop_config.json fragment with the engramx server under mcpServers. */
93
+ export function claudeDesktopConfig(p) {
94
+ return { mcpServers: { engramx: stdioServerConfig(p) } };
95
+ }
96
+ /** Per-client connection guides — identical wording in the CLI and the web page. */
97
+ export function clientGuides(p) {
98
+ const url = mcpUrl(p);
99
+ const pair = pairCommand(p.clientVersion, '<invite-code>', p.canisterId);
100
+ return [
101
+ {
102
+ id: 'claude-web',
103
+ name: 'Claude (claude.ai)',
104
+ transport: 'remote',
105
+ steps: [
106
+ 'Open claude.ai → Settings → Connectors → Add custom connector.',
107
+ `Paste the MCP URL: ${url}`,
108
+ 'Sign in with the wallet that owns this engram, then approve.',
109
+ 'Your engram tools (read/append/list memory, audit log, wallet) appear in new chats.',
110
+ ],
111
+ },
112
+ {
113
+ id: 'claude-code',
114
+ name: 'Claude Code (CLI)',
115
+ transport: 'remote',
116
+ snippet: `claude mcp add engramx-memory ${url}`,
117
+ steps: [
118
+ 'Run the command, then restart claude-code — OAuth opens in your browser on first use.',
119
+ ],
120
+ },
121
+ {
122
+ id: 'claude-desktop',
123
+ name: 'Claude Desktop (remote)',
124
+ transport: 'remote',
125
+ steps: [
126
+ 'Claude Desktop → Settings → Connectors → Add custom connector.',
127
+ `Paste the MCP URL: ${url}`,
128
+ 'Authorize with your wallet.',
129
+ ],
130
+ },
131
+ {
132
+ id: 'cursor',
133
+ name: 'Cursor',
134
+ transport: 'remote',
135
+ steps: [
136
+ 'Cursor → Settings → MCP → Add new MCP server.',
137
+ `Paste the remote URL ${url}; the OAuth flow opens in your browser.`,
138
+ ],
139
+ },
140
+ {
141
+ id: 'copilot',
142
+ name: 'GitHub Copilot (VS Code, agent mode)',
143
+ transport: 'remote',
144
+ snippet: `{\n "servers": {\n "engramx-memory": { "type": "http", "url": "${url}" }\n }\n}`,
145
+ steps: [
146
+ 'VS Code → Command Palette → "MCP: Add Server" → HTTP → paste the URL; or add the JSON above to .vscode/mcp.json (workspace) or your user mcp.json.',
147
+ 'Open Copilot Chat in Agent mode and authorize with the wallet that owns this engram; your engram tools appear in the tool picker.',
148
+ 'Note: the GitHub Copilot CLI is a separate surface (gh copilot) — this flow is for Copilot Chat in VS Code.',
149
+ ],
150
+ },
151
+ {
152
+ id: 'continue',
153
+ name: 'Continue.dev',
154
+ transport: 'remote',
155
+ snippet: `mcpServers:\n - name: engramx-memory\n transport: streamable-http\n url: ${url}`,
156
+ steps: ['Add this YAML to .continue/mcpServers/engramx.yaml.'],
157
+ },
158
+ {
159
+ id: 'chatgpt',
160
+ name: 'ChatGPT (developer mode)',
161
+ transport: 'remote',
162
+ steps: [
163
+ 'ChatGPT → Settings → Apps & Connectors → enable Developer mode → New connector.',
164
+ `Add the MCP server URL: ${url}, then authorize with the wallet that owns this engram.`,
165
+ 'Web + paid tiers only (Plus/Pro/Business); the desktop/mobile apps and free tier cannot add a custom MCP.',
166
+ 'Our connector handshake with ChatGPT is still being verified — if the authorize step fails, seed via a paste prompt for now.',
167
+ ],
168
+ },
169
+ {
170
+ id: 'gemini-cli',
171
+ name: 'Gemini CLI',
172
+ transport: 'remote',
173
+ snippet: `gemini mcp add --transport http engramx-memory ${url}`,
174
+ steps: [
175
+ 'Run the command, then restart gemini-cli.',
176
+ 'If the OAuth handshake misbehaves, add an auth header (the key for this engram) or use the local stdio proxy instead.',
177
+ 'The consumer Gemini app has no custom-MCP support — use gemini-cli, or seed the app’s Saved Info via a paste prompt.',
178
+ ],
179
+ },
180
+ {
181
+ id: 'grok',
182
+ name: 'Grok',
183
+ transport: 'remote',
184
+ steps: [
185
+ 'Grok → Settings → Connectors → Bring your own MCP → add a custom connector.',
186
+ `Paste the MCP URL: ${url} and authorize. Paid tier.`,
187
+ ],
188
+ },
189
+ {
190
+ id: 'perplexity',
191
+ name: 'Perplexity',
192
+ transport: 'remote',
193
+ steps: [
194
+ 'Perplexity → Settings → Connectors → Add → Custom MCP (Pro / Max / Enterprise).',
195
+ `Paste the remote URL: ${url}; authorize with your wallet.`,
196
+ ],
197
+ },
198
+ {
199
+ id: 'lechat',
200
+ name: 'Mistral Le Chat',
201
+ transport: 'remote',
202
+ steps: [
203
+ 'Le Chat → + Add Connector → Custom MCP.',
204
+ `Name it "engramx" and paste the server URL: ${url}. Available on all tiers, including free.`,
205
+ ],
206
+ },
207
+ {
208
+ id: 'openclaw',
209
+ name: 'OpenClaw (self-hosted)',
210
+ transport: 'stdio',
211
+ snippet: pair,
212
+ steps: [
213
+ 'Run the command; it auto-detects OpenClaw and installs the engramx memory plugin.',
214
+ 'The engram becomes OpenClaw’s memory backend — it reads at session start and syncs new memories automatically.',
215
+ 'Get <invite-code> from the engram’s owner — you, if this is your engram — who creates it under Access → Agents; it works for thirty minutes.',
216
+ ],
217
+ },
218
+ {
219
+ id: 'sdk',
220
+ name: 'Your own agent (@engramx/client SDK)',
221
+ transport: 'stdio',
222
+ snippet: pair,
223
+ steps: [
224
+ 'Pair a key for this engram once with the command; get <invite-code> from the engram’s owner — you, if this is your engram — who creates it under Access → Agents. It works for thirty minutes.',
225
+ `In your agent: new EngramClient({ canisterId: '${p.canisterId}', sessionKeyPath: '~/.engramx/session.key' }), then startSession() to read this owner's memory back and appendMemory() as it learns.`,
226
+ 'This grant is append-only for writes — your agent can read and add memory, and cannot delete it. Overwriting existing content requires a separate grant the owner issues deliberately, per path: only on paths the owner lists for agents, and never on paths the owner has locked.',
227
+ ],
228
+ },
229
+ {
230
+ id: 'claude-desktop-stdio',
231
+ name: 'Claude Desktop / Cursor (local stdio)',
232
+ transport: 'stdio',
233
+ snippet: JSON.stringify(claudeDesktopConfig(p), null, 2),
234
+ steps: [
235
+ `Pair a key for this engram once: ${pair}`,
236
+ 'Add the JSON to claude_desktop_config.json under "mcpServers", then restart the app.',
237
+ ],
238
+ },
239
+ ];
240
+ }
241
+ /** Everything a consumer needs in one call. */
242
+ export function connectInfo(p) {
243
+ return {
244
+ canisterId: p.canisterId,
245
+ host: p.host ?? MAINNET_HOST,
246
+ mcpUrl: mcpUrl(p),
247
+ claudeDesktopConfig: claudeDesktopConfig(p),
248
+ guides: clientGuides(p),
249
+ };
250
+ }
251
+ //# sourceMappingURL=connect-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-config.js","sourceRoot":"","sources":["../src/connect-config.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,8EAA8E;AAC9E,EAAE;AACF,iGAAiG;AACjG,mGAAmG;AACnG,oGAAoG;AACpG,EAAE;AACF,uFAAuF;AACvF,oGAAoG;AACpG,oGAAoG;AACpG,sFAAsF;AACtF,qGAAqG;AACrG,gGAAgG;AAChG,qGAAqG;AACrG,oBAAoB;AACpB,EAAE;AAC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AE,UAAU;YACd,IAAI,EAAE,wBAAwB;YAC9B,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE;gBACL,mFAAmF;gBACnF,gHAAgH;gBAChH,8IAA8I;aAC/I;SACF;QACD;YACE,EAAE,EAAE,KAAK;YACT,IAAI,EAAE,sCAAsC;YAC5C,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,IAAI;YACb,KAAK,EAAE;gBACL,gMAAgM;gBAChM,kDAAkD,CAAC,CAAC,UAAU,uIAAuI;gBACrM,qRAAqR;aACtR;SACF;QACD;YACE,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,uCAAuC;YAC7C,SAAS,EAAE,OAAO;YAClB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YACxD,KAAK,EAAE;gBACL,oCAAoC,IAAI,EAAE;gBAC1C,sFAAsF;aACvF;SACF;KACF,CAAC;AACJ,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,CAAc;IACxC,OAAO;QACL,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY;QAC5B,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACjB,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;KACxB,CAAC;AACJ,CAAC"}
@@ -70,7 +70,13 @@ export class EncryptionManager {
70
70
  async cacheModule() {
71
71
  if (!this.persistPath || typeof process === 'undefined' || !process.versions?.node)
72
72
  return null;
73
- return import('./keyCache.js');
73
+ // ⟨2026-10-13, the owner's 3A⟩ The specifier is a VARIABLE so a browser bundler does not follow
74
+ // it: this module is the browser-safe subpath `@engramx/client/encryption`, and keyCache.js is
75
+ // Node's file system. With a literal, Vite bundled keyCache (and node:fs) into a web build that
76
+ // can never reach it (persistence needs `process.versions.node`). Node resolves the variable
77
+ // relative to this file exactly as it did the literal. Held by test/browser-safe-subpaths.test.ts.
78
+ const keyCacheModule = './keyCache.js';
79
+ return (await import(/* @vite-ignore */ keyCacheModule));
74
80
  }
75
81
  async resolvedPath(kc) {
76
82
  return this.persistPath === '1' || this.persistPath === 'true'
@@ -1 +1 @@
1
- {"version":3,"file":"encryption.js","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,iFAAiF;AACjF,yEAAyE;AACzE,0FAA0F;AAC1F,iFAAiF;AACjF,0DAA0D;AAC1D,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,uEAAuE;AASvE,OAAO,EAAE,YAAY,EAAkB,MAAM,WAAW,CAAC;AAEzD,6EAA6E;AAC7E,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACrD,gGAAgG;AAChG,wEAAwE;AACxE,MAAM,aAAa,GAAG,0BAA0B,CAAC;AACjD,MAAM,UAAU,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;AACxE,yEAAyE;AACzE,iFAAiF;AACjF,MAAM,eAAe,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAC1C,wEAAwE;AACxE,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,+EAA+E;AAC/E,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/D,6FAA6F;AAC7F,8FAA8F;AAC9F,8FAA8F;AAC9F,iGAAiG;AACjG,gGAAgG;AAChG,qBAAqB;AACrB,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI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AAC;YACrC,IAAI,GAAG,GAAG,CAAC,CAAC;YACZ,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACtB,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;gBACnB,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC;YAClB,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,2FAA2F;QAC3F,sEAAsE;QACtE,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED;qFACiF;IACjF,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC1B,MAAM,EAAE,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,94 @@
1
+ import { 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: (b: Uint8Array) => string;
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';