@fangorn-network/sdk 2026.8.18-dev → 2026.10.1-9.0-dev

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 (91) hide show
  1. package/README.md +191 -195
  2. package/lib/cli/cli.d.ts +0 -0
  3. package/lib/cli/cli.js +198 -164
  4. package/lib/cli/index.d.ts +3 -91
  5. package/lib/cli/index.js +5 -2
  6. package/lib/config.d.ts +349 -433
  7. package/lib/config.js +41 -28
  8. package/lib/contracts/app-registry/abi.d.ts +1064 -265
  9. package/lib/contracts/app-registry/abi.js +1233 -308
  10. package/lib/contracts/app-registry/index.d.ts +123 -102
  11. package/lib/contracts/app-registry/index.js +200 -198
  12. package/lib/contracts/data-registry/abi.d.ts +166 -187
  13. package/lib/contracts/data-registry/abi.js +207 -237
  14. package/lib/contracts/data-registry/index.d.ts +4 -160
  15. package/lib/contracts/data-registry/index.js +5 -294
  16. package/lib/contracts/index.d.ts +6 -7
  17. package/lib/contracts/index.js +6 -8
  18. package/lib/contracts/logs.d.ts +21 -0
  19. package/lib/contracts/logs.js +32 -0
  20. package/lib/contracts/membership-registry/abi.d.ts +1145 -0
  21. package/lib/contracts/membership-registry/abi.js +1333 -0
  22. package/lib/contracts/membership-registry/index.d.ts +79 -0
  23. package/lib/contracts/membership-registry/index.js +104 -0
  24. package/lib/contracts/types.d.ts +3 -1
  25. package/lib/contracts/types.js +3 -1
  26. package/lib/contracts/write.d.ts +34 -2
  27. package/lib/contracts/write.js +48 -1
  28. package/lib/crypto/encryption.js +4 -4
  29. package/lib/engine/car.d.ts +2 -2
  30. package/lib/engine/car.js +10 -5
  31. package/lib/engine/index.d.ts +99 -143
  32. package/lib/engine/index.js +156 -295
  33. package/lib/engine/records.d.ts +110 -0
  34. package/lib/engine/records.js +165 -0
  35. package/lib/engine/test-helpers.d.ts +7 -14
  36. package/lib/engine/test-helpers.js +7 -18
  37. package/lib/fangorn.d.ts +163 -155
  38. package/lib/fangorn.js +284 -248
  39. package/lib/feed.d.ts +7 -4
  40. package/lib/feed.js +4 -1
  41. package/lib/index.d.ts +9 -9
  42. package/lib/index.js +9 -10
  43. package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
  44. package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
  45. package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
  46. package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
  47. package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
  48. package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
  49. package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
  50. package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
  51. package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
  52. package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
  53. package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
  54. package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
  55. package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
  56. package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
  57. package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
  58. package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
  59. package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
  60. package/lib/node_modules/chai/index.js +2874 -0
  61. package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
  62. package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
  63. package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
  64. package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
  65. package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
  66. package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
  67. package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
  68. package/lib/providers/storage/signed-url.d.ts +16 -6
  69. package/lib/providers/storage/signed-url.js +20 -8
  70. package/lib/registry.d.ts +116 -0
  71. package/lib/registry.js +182 -0
  72. package/lib/test/mem-registry.d.ts +51 -0
  73. package/lib/test/mem-registry.js +107 -0
  74. package/lib/test/sdk-suite.d.ts +13 -0
  75. package/lib/test/sdk-suite.js +226 -0
  76. package/lib/test/testbed.d.ts +16411 -61
  77. package/lib/test/testbed.js +190 -84
  78. package/lib/types/index.d.ts +13 -11
  79. package/package.json +89 -72
  80. package/lib/contracts/data-registry/test.d.ts +0 -1
  81. package/lib/contracts/data-registry/test.js +0 -1
  82. package/lib/contracts/settlement-registry/abi.d.ts +0 -466
  83. package/lib/contracts/settlement-registry/abi.js +0 -535
  84. package/lib/contracts/settlement-registry/index.d.ts +0 -163
  85. package/lib/contracts/settlement-registry/index.js +0 -264
  86. package/lib/contracts/subscription-registry/abi.d.ts +0 -179
  87. package/lib/contracts/subscription-registry/abi.js +0 -195
  88. package/lib/contracts/subscription-registry/index.d.ts +0 -59
  89. package/lib/contracts/subscription-registry/index.js +0 -116
  90. package/lib/engine/graph.d.ts +0 -70
  91. package/lib/engine/graph.js +0 -73
package/lib/fangorn.d.ts CHANGED
@@ -1,18 +1,20 @@
1
1
  import { AppConfig } from "./config.js";
2
- import { DataRegistryClient, PreparedTx } from "./contracts/data-registry/index.js";
2
+ import { PreparedTx } from "./contracts/write.js";
3
3
  import { AppRegistryClient } from "./contracts/app-registry/index.js";
4
- import { SettlementRegistryClient } from "./contracts/settlement-registry/index.js";
5
- import { SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
4
+ import { MembershipRegistryClient } from "./contracts/membership-registry/index.js";
6
5
  import "./contracts/index.js";
6
+ import { Registry } from "./registry.js";
7
7
  import { MetadataStorage } from "./providers/storage/types.js";
8
- import { CommitDiff, FangornEngine, MetagraphRegistry, NamespaceContents, NamespaceDiff } from "./engine/index.js";
8
+ import { CommitDiff, FangornEngine, RecordInput, RepoContents, RepoDiff, SchemaRegistry } from "./engine/index.js";
9
9
  import { FangornCreateOptions, StorageConfig } from "./types/index.js";
10
10
  import { AppFeed } from "./feed.js";
11
+ import * as viem0 from "viem";
11
12
  import { Hex, WalletClient } from "viem";
13
+ import { CID } from "multiformats/cid";
12
14
 
13
15
  //#region src/fangorn.d.ts
14
- interface NamespaceChange extends NamespaceDiff {
15
- namespace: string;
16
+ interface RepoChange extends RepoDiff {
17
+ repo: string;
16
18
  owner: Hex;
17
19
  commitCid: string;
18
20
  oldRoot: Hex;
@@ -20,13 +22,17 @@ interface NamespaceChange extends NamespaceDiff {
20
22
  blockNumber: bigint;
21
23
  }
22
24
  interface SubscribeOptions {
23
- namespace: string;
24
- /** Publisher whose namespace to watch (defaults to this wallet's address). */
25
+ repo: string;
26
+ /**
27
+ * Under an app, the stream follows what the app presents (its members' updates,
28
+ * less exclusions); with no app, every update the publisher commits.
29
+ */
30
+ /** Publisher whose repo to watch (defaults to this wallet's address). */
25
31
  owner?: Hex;
26
32
  /**
27
33
  * Replay `StateCommitted` events from this block before going live (the resume
28
34
  * cursor). Omit to start live from the current chain tip — seed initial state
29
- * separately via `inspectNamespace`.
35
+ * separately via `inspectRepo`.
30
36
  */
31
37
  fromBlock?: bigint;
32
38
  /** Poll interval (ms) for the live watch over an HTTP transport. */
@@ -34,19 +40,40 @@ interface SubscribeOptions {
34
40
  /** Abort to stop the subscription and release the watch. */
35
41
  signal?: AbortSignal;
36
42
  }
43
+ /** The A2A extension a Fangorn app's agent card carries: it names the app the card speaks for. */
44
+ declare const FANGORN_APP_EXTENSION = "https://fangorn.network/a2a/app/v1";
45
+ /**
46
+ * The part of an A2A agent card `discoverApp` reads. A card's other fields
47
+ * (skills, endpoints and so on) pass through untouched.
48
+ */
49
+ interface AgentCard {
50
+ name?: string;
51
+ description?: string;
52
+ url?: string;
53
+ capabilities?: {
54
+ extensions?: {
55
+ uri: string;
56
+ params?: Record<string, unknown>;
57
+ }[];
58
+ };
59
+ [key: string]: unknown;
60
+ }
37
61
  declare class Fangorn {
38
62
  private readonly ctx;
39
63
  private _engine;
40
- private readonly _metagraph;
64
+ private readonly _schemas;
41
65
  private _feed;
66
+ private _apps;
67
+ private _membership;
42
68
  /**
43
- * The namespace cache
69
+ * The repo cache
44
70
  * Insertion order = LRU order
45
71
  */
46
72
  private readonly nsCache;
47
73
  private constructor();
48
74
  get engine(): FangornEngine;
49
- get metagraph(): MetagraphRegistry;
75
+ /** Per-repo record schemas. Unregistered types are accepted as-is. */
76
+ get schemas(): SchemaRegistry;
50
77
  /**
51
78
  * Static creation of a new Fangorn client
52
79
  *
@@ -55,29 +82,19 @@ declare class Fangorn {
55
82
  */
56
83
  static create(options: FangornCreateOptions): Fangorn;
57
84
  /**
58
- * Resets a namespace's onchain state root to zero.
59
- * TODO: also unpin all data
60
- * Use at your own risk.
61
- */
62
- reset(namespace: string): Promise<void>;
63
- /**
64
- * TODO: this isn't really needed here, it's cosmetic
65
- * instead, what if we moved this to a new paradigm where...
66
- *
67
- * each app registers as an ERC-8004 agent with the validation registry
68
- * pointing to these rules essentially?
69
- *
70
- *
71
- * Register permissive (no required fields) schemas for every tag/relation a
72
- * staged graph uses, unless the caller has already registered stricter rules
73
- * via `this.metagraph` directly — schema ids are free-form tags by default.
85
+ * Empties a repo: one commit of the empty state on top of the head. History
86
+ * stays (a head never goes back to zero), and so do the old records: the new
87
+ * head still names them as history.
74
88
  */
75
- private registerPermissiveSchemas;
76
- /** Stage a graph into one commit on top of `base` (engine shapes adapted from CLI shapes). */
89
+ reset(repo: string): Promise<{
90
+ txHash: viem0.Hash;
91
+ onChainTip: CID;
92
+ }>;
93
+ /** Stage records into one commit on top of `base`. */
77
94
  private createCommit;
78
95
  /**
79
- * Allocates a namespace in the publisher's root map.
80
- * A no-op (no on-chain tx) if the namespace is already initialized.
96
+ * Allocates a repo in the publisher's root map.
97
+ * A no-op (no on-chain tx) if the repo is already initialized.
81
98
  */
82
99
  initRepo(repoName: string): Promise<{
83
100
  cid: undefined;
@@ -91,59 +108,45 @@ declare class Fangorn {
91
108
  alreadyInitialized: false;
92
109
  }>;
93
110
  /**
94
- * Stage one vertex and settle it on-chain in a single shot.
111
+ * Put one record and settle it on-chain in a single shot. `id` defaults to
112
+ * a random one, so repeated calls add records; pass an id to update one.
95
113
  */
96
- upload(repoName: string, payload: unknown, schemaId: string): Promise<{
114
+ upload(repoName: string, payload: unknown, type: string, id?: string): Promise<{
115
+ id: string;
97
116
  payloadCid: string;
98
117
  commitCid: string;
99
118
  txHash: `0x${string}`;
100
119
  }>;
101
120
  /**
102
- * Stages many vertices (and optionally edges between them) under one publisher
103
- * root, instead of one tx per vertex. The whole graph is built in memory and
104
- * persisted as ONE CAR upload plus one commit block, then settled in a single
105
- * fast-forward tx. Edges reference vertices by the caller-supplied local `id`.
121
+ * Puts many records (and deletes some, by id) under one repo in a
122
+ * single commit, instead of one tx per record. Built in memory and persisted
123
+ * as ONE CAR upload plus one commit block, then settled in a single
124
+ * fast-forward tx. Relations are records too: give them `src`/`dst` `Ref`s.
106
125
  */
107
- uploadBatch(repoName: string, vertices: {
108
- id: string;
109
- tag: string;
110
- payload: unknown;
111
- }[], edges?: {
112
- rel: string;
113
- from: string;
114
- to: string;
115
- }[]): Promise<{
126
+ uploadBatch(repoName: string, records: RecordInput[], deletes?: string[]): Promise<{
116
127
  commitCid: string;
117
128
  txHash: `0x${string}`;
118
- vertexCids: Record<string, string>;
129
+ recordCids: Record<string, string>;
119
130
  }>;
120
131
  /**
121
- * Build a new commit (no on-chain tx) that stages vertices/edges into
122
- * `namespace` on top of `parent` (a commit CID string, or undefined for a
132
+ * Build a new commit (no on-chain tx) that puts/deletes records in
133
+ * `repo` on top of `parent` (a commit CID string, or undefined for a
123
134
  * root commit). The commit and its CAR are uploaded to storage, so a later
124
135
  * `push` — even in a separate process — can settle it.
125
136
  */
126
137
  commit(opts: {
127
- namespace: string;
128
- vertices?: {
129
- id: string;
130
- tag: string;
131
- payload: unknown;
132
- }[];
133
- edges?: {
134
- rel: string;
135
- from: string;
136
- to: string;
137
- }[];
138
+ repo: string;
139
+ records?: RecordInput[];
140
+ deletes?: string[];
138
141
  parent?: string;
139
142
  message: string;
140
- /** Snapshot semantics: the staged graph replaces the namespace's previous contents. */
143
+ /** Snapshot semantics: the staged records replace the repo's previous contents. */
141
144
  replace?: boolean;
142
145
  }): Promise<{
143
146
  commitCid: string;
144
- parents: string[];
147
+ parent: string | null;
145
148
  root: string;
146
- vertexCids: Record<string, string>;
149
+ recordCids: Record<string, string>;
147
150
  }>;
148
151
  /**
149
152
  * Build a commit on top of `owner`'s current on-chain head and return it
@@ -161,86 +164,95 @@ declare class Fangorn {
161
164
  prepareCommit(opts: {
162
165
  /** The publisher whose head advances — NOT this client's service wallet. */
163
166
  owner: Hex;
164
- namespace: string;
165
- vertices?: {
166
- id: string;
167
- tag: string;
168
- payload: unknown;
169
- }[];
170
- edges?: {
171
- rel: string;
172
- from: string;
173
- to: string;
174
- }[];
167
+ repo: string;
168
+ records?: RecordInput[];
169
+ deletes?: string[];
175
170
  message: string;
176
- /** Snapshot semantics: the staged graph replaces the namespace's contents. */
171
+ /** Snapshot semantics: the staged records replace the repo's contents. */
177
172
  replace?: boolean;
178
173
  }): Promise<{
179
174
  commitCid: string;
180
175
  oldRoot: Hex;
181
176
  newRoot: Hex;
182
177
  staged: {
183
- vertices: number;
184
- edges: number;
178
+ records: number;
179
+ deletes: number;
185
180
  };
186
181
  tx: PreparedTx;
187
- vertexCids: Record<string, string>;
182
+ recordCids: Record<string, string>;
188
183
  }>;
189
184
  /**
190
- * Settle a local commit as the on-chain head of `namespace` (fast-forward
191
- * unless `force`). Each namespace has its own timeline, so pushes to
192
- * different namespaces never contend for the same compare-and-swap.
185
+ * Settle a local commit as the on-chain head of `repo`. Its parent must be
186
+ * the current head (see `FangornEngine.pushCommit`). Each repo has its own
187
+ * timeline, so pushes to different repos never contend.
193
188
  */
194
- push(namespace: string, commitCid: string, opts?: {
195
- force?: boolean;
196
- }): Promise<{
189
+ push(repo: string, commitCid: string): Promise<{
197
190
  txHash: string;
198
191
  onChainTip: string;
199
192
  }>;
200
- /** The owner's current on-chain tip for a namespace, or null if they have none. */
201
- onChainTip(owner: Hex, namespace: string): Promise<string | null>;
193
+ /** The owner's current on-chain tip for a repo, or null if they have none. */
194
+ onChainTip(owner: Hex, repo: string): Promise<string | null>;
202
195
  /**
203
- * A publisher's namespace contents, cached against its on-chain tip.
196
+ * A publisher's repo as this client presents it, cached against its tip:
197
+ * the publisher's latest head, or, under an app, nothing unless the app
198
+ * presents the publisher (provides its storage) and excludes neither it nor
199
+ * the repo.
204
200
  *
205
- * Reading a namespace walks the pail tree from the root — many sequential
206
- * gateway fetches. The tip is one cheap contract read and only moves on
207
- * publish, so it doubles as the cache key: no TTL to tune, no invalidation
208
- * to remember after a settle, and never stale.
201
+ * Reading a repo walks its whole record tree from the root. The tip is one
202
+ * cheap contract read and only moves on publish, so it doubles as the cache
203
+ * key: no TTL to tune, no invalidation to remember after a settle, and never
204
+ * stale.
209
205
  *
210
- * LRU-bounded so an always-on process can't accumulate every namespace it
206
+ * LRU-bounded so an always-on process can't accumulate every repo it
211
207
  * ever touched. The durable copy is on-chain — an evicted entry re-walks.
212
208
  * ponytail: fixed entry count, not byte-aware; switch to a size budget if a
213
- * few huge namespaces blow memory before the count cap bites.
209
+ * few huge repos blow memory before the count cap bites.
214
210
  */
215
- readNamespace(owner: Hex, namespace: string): Promise<{
211
+ readRepo(owner: Hex, repo: string): Promise<{
216
212
  tip: string | null;
217
- contents: NamespaceContents;
213
+ contents: RepoContents;
218
214
  }>;
215
+ /** The commit this client presents of a repo, or null for none (see `readRepo`). */
216
+ private presentedTip;
217
+ /** Does `app` present `ref`: it presents the publisher, and excludes neither it nor the repo? */
218
+ private presentsRepo;
219
219
  /**
220
- * Every (publisher, namespace) pair that has ever committed under this app,
221
- * at its latest root — the app's directory, from ONE `getLogs`.
220
+ * Every (publisher, repo) this client's app presents, at its latest head, less
221
+ * what it excludes — the app's directory, from ONE `getLogs` over the update
222
+ * log, kept to the publishers the app presents.
222
223
  *
223
- * This is what cross-publisher discovery looks like now: the registry already
224
- * indexes `app_id`, so the commit log IS the index. No per-publisher fan-out,
225
- * no separate registration sweep, no central list — and unlike a publisher
226
- * roster it only surfaces publishers with actual content.
227
- *
228
- * Namespaces come back as `subspaceId` (the hash), not the name, because the
229
- * event never carries the name — recovering it costs one content fetch per
230
- * entry. Pass `namespace` when you know the name you're after (the usual
231
- * case: an app with one well-known namespace) and the filter is applied
232
- * on-chain instead.
224
+ * ponytail: reads every publisher's updates and drops non-members, so it costs
225
+ * what the network writes, not what the app holds. Filter on-chain by the
226
+ * app's members (a `publisher` topic list) once that is too slow.
227
+ * Narrow it with `repo` (every publisher's `docs`) or `owner`, filtered on-chain.
233
228
  */
234
- appNamespaces(opts?: {
235
- namespace?: string;
229
+ appRepos(opts?: {
230
+ repo?: string;
236
231
  owner?: Hex;
237
232
  fromBlock?: bigint;
238
233
  }): Promise<{
239
234
  owner: Hex;
240
- subspaceId: Hex;
235
+ repo: string;
241
236
  root: Hex;
242
237
  blockNumber: bigint;
243
238
  }[]>;
239
+ /**
240
+ * Resolve an app from its agent card URL alone, and prove the card speaks for it.
241
+ *
242
+ * The card names its app in the `FANGORN_APP_EXTENSION` A2A extension, but
243
+ * anyone can serve a card that names any app. So the card is trusted only if
244
+ * the app's on-chain `agent_uri`, which only the app owner can set, points
245
+ * back at this exact URL. The comparison is exact string equality, so a
246
+ * trailing slash or a different host counts as a different card.
247
+ *
248
+ * Doesn't touch this client's app. Pass `appId` to `setAppId` to read under it.
249
+ */
250
+ discoverApp(cardUrl: string): Promise<{
251
+ card: AgentCard;
252
+ appId: Hex;
253
+ fromBlock: bigint;
254
+ repos: string[];
255
+ }>;
244
256
  /**
245
257
  * The app's commit stream as ONE shared, ref-counted subscription (see
246
258
  * `AppFeed`). Prefer this over `subscribeApp` anywhere more than one consumer
@@ -252,80 +264,76 @@ declare class Fangorn {
252
264
  /** Walk commit history from `head` (newest first). */
253
265
  log(head: string, max?: number): AsyncGenerator<{
254
266
  cid: string;
255
- parents: string[];
256
- timestamp: number;
267
+ parent: string | null;
268
+ epoch: number;
257
269
  message: string;
258
270
  root: string;
259
271
  }>;
260
- /** Show a commit and what it changed vs. its first parent. */
272
+ /** Show a commit and what it changed vs. its parent. */
261
273
  show(commitCid: string): Promise<CommitDiff>;
262
274
  /**
263
- * Lists every vertex and edge currently committed under a namespace, resolved
275
+ * Lists every record currently committed under a repo, resolved
264
276
  * from the publisher's on-chain root — useful for verifying what actually
265
277
  * made it into the repository, as opposed to what a given call staged.
266
278
  */
267
- inspectNamespace(repoName: string): Promise<NamespaceContents>;
279
+ inspectRepo(repoName: string): Promise<RepoContents>;
268
280
  /**
269
- * Stream changes to one publisher's namespace. Optionally replays from
281
+ * Stream changes to one publisher's repo. Optionally replays from
270
282
  * `fromBlock` first (resume cursor), then watches live until the `signal`
271
283
  * aborts. Each yielded change carries `blockNumber` — persist it to resume
272
284
  * exactly where you left off.
273
285
  */
274
- subscribe(opts: SubscribeOptions): AsyncGenerator<NamespaceChange>;
286
+ subscribe(opts: SubscribeOptions): AsyncGenerator<RepoChange>;
275
287
  /**
276
- * Stream changes across the *whole app* — every publisher, every namespace.
277
- * The app-level feed: one topic filter on `app_id`, no per-publisher fan-out
278
- * and no global root to keep in sync. Narrow it with `namespace` (every
279
- * publisher's `docs`) or `owner` (one publisher's whole app footprint).
288
+ * Stream changes across the *whole app* — every repo of every publisher it
289
+ * presents, less its exclusions. Narrow it with `repo` (every publisher's `docs`) or
290
+ * `owner` (one publisher's whole app footprint). With no app, every update by
291
+ * anyone: a firehose.
280
292
  */
281
- subscribeApp(opts?: Omit<SubscribeOptions, "namespace"> & {
282
- namespace?: string;
283
- }): AsyncGenerator<NamespaceChange>;
293
+ subscribeApp(opts?: Omit<SubscribeOptions, "repo"> & {
294
+ repo?: string;
295
+ }): AsyncGenerator<RepoChange>;
284
296
  /** Shared catch-up-then-live loop behind `subscribe` and `subscribeApp`. */
285
297
  private streamCommits;
286
298
  /**
287
- * Resolve a raw `StateCommitted` log into a namespace change, or null if the
288
- * namespace slice was untouched.
299
+ * Resolve a log entry into a repo change, or null if nothing presented
300
+ * changed: the repo slice was untouched, or the app excludes it.
301
+ *
302
+ * The commit itself names its repo, which must be the one the entry was
303
+ * logged under, or the publisher settled a commit for one repo against
304
+ * another's timeline.
289
305
  *
290
- * The event carries `keccak256(namespace)`, never the name, so the name comes
291
- * from the commit's own root map — and must hash back to the subspace the
292
- * commit was published into, or the publisher settled a commit for one
293
- * namespace against another's timeline.
306
+ * The diff runs from the last head this stream saw for the repo, not from
307
+ * the entry's parent. If an entry was dropped (an RPC that left out a log),
308
+ * the two differ, and diffing from the entry's parent would skip what the
309
+ * dropped entry changed.
294
310
  */
295
- private toNamespaceChange;
311
+ private toRepoChange;
296
312
  getConfig(): AppConfig;
297
- getDataRegistry(): DataRegistryClient;
313
+ /** Heads, membership, exclusions and logs: the registry of WHITEPAPER_1 §3.2. */
314
+ getRegistry(): Registry;
298
315
  /**
299
- * Apps, their publisher terms, and per-app membership.
300
- *
301
- * `commitStateRoot` cross-calls this contract, so joining the app here is a
302
- * precondition for publishing under it — `registerForApp()` before
303
- * `commit()`, or the commit reverts `NotRegisteredForApp`.
316
+ * App management: claiming an app (its storage subscription), terms,
317
+ * invitations and membership, the agent card, and the protocol admin's powers.
318
+ * The owner accepts a publisher (`acceptPublisher()`); from then its uploads
319
+ * bill the app's subscription, and the app presents its repos.
304
320
  */
305
321
  getAppRegistry(): AppRegistryClient;
306
- /**
307
- * The publisher-side storage paywall. Per-wallet, not per-app: one
308
- * subscription covers everything this publisher writes, under every app.
309
- */
310
- getSubscriptionRegistry(): SubscriptionRegistryClient;
311
- /**
312
- * The consumer-side pay-then-read rail. Resources are keyed by owner+uid, so
313
- * this client is app-agnostic too.
314
- */
315
- getSettlementRegistry(): SettlementRegistryClient;
316
- /** The app (global namespace) this client publishes and reads under. */
317
- getAppId(): Hex;
322
+ getMembershipRegistry(): MembershipRegistryClient;
323
+ /** The app this client reads and publishes under, or undefined for none. */
324
+ getAppId(): Hex | undefined;
325
+ private requireApp;
318
326
  /**
319
327
  * Point this client at a different app — by name (`"my-app"`) or by app id —
320
- * without rebuilding it. The app id prefixes every namespace key, so every
321
- * read, publish and subscription after this call lands in the new app.
328
+ * or at none, without rebuilding it. Every read, publish and subscription
329
+ * after this call is in the new context.
322
330
  *
323
- * Namespace reads are dropped from the cache (its keys are app-agnostic) and
331
+ * Repo reads are dropped from the cache (its keys are app-agnostic) and
324
332
  * the shared `appFeed` is released: a feed watches one app's commit stream, so
325
333
  * the next `appFeed()` opens a fresh subscription. Generators already running
326
334
  * from `subscribe`/`subscribeApp` keep their original filter until aborted.
327
335
  */
328
- setAppId(nameOrId: string): void;
336
+ setAppId(nameOrId: string | undefined): void;
329
337
  getStorage(): MetadataStorage;
330
338
  /**
331
339
  * Swap the storage backend at runtime — e.g. move from access-worker signed
@@ -337,4 +345,4 @@ declare class Fangorn {
337
345
  getAddress(): Hex;
338
346
  }
339
347
  //#endregion
340
- export { Fangorn, NamespaceChange, SubscribeOptions };
348
+ export { AgentCard, FANGORN_APP_EXTENSION, Fangorn, RepoChange, SubscribeOptions };