@fangorn-network/sdk 2026.9.22-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 +190 -194
  2. package/lib/cli/cli.d.ts +0 -0
  3. package/lib/cli/cli.js +177 -201
  4. package/lib/cli/index.d.ts +3 -91
  5. package/lib/cli/index.js +5 -2
  6. package/lib/config.d.ts +358 -117
  7. package/lib/config.js +43 -23
  8. package/lib/contracts/app-registry/abi.d.ts +1033 -277
  9. package/lib/contracts/app-registry/abi.js +1214 -335
  10. package/lib/contracts/app-registry/index.d.ts +105 -65
  11. package/lib/contracts/app-registry/index.js +182 -175
  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 -151
  15. package/lib/contracts/data-registry/index.js +5 -279
  16. package/lib/contracts/index.d.ts +6 -7
  17. package/lib/contracts/index.js +6 -8
  18. package/lib/contracts/logs.d.ts +4 -1
  19. package/lib/contracts/logs.js +9 -2
  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 +129 -156
  38. package/lib/fangorn.js +250 -250
  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 +8 -9
  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 -73
  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. */
@@ -55,16 +61,19 @@ interface AgentCard {
55
61
  declare class Fangorn {
56
62
  private readonly ctx;
57
63
  private _engine;
58
- private readonly _metagraph;
64
+ private readonly _schemas;
59
65
  private _feed;
66
+ private _apps;
67
+ private _membership;
60
68
  /**
61
- * The namespace cache
69
+ * The repo cache
62
70
  * Insertion order = LRU order
63
71
  */
64
72
  private readonly nsCache;
65
73
  private constructor();
66
74
  get engine(): FangornEngine;
67
- get metagraph(): MetagraphRegistry;
75
+ /** Per-repo record schemas. Unregistered types are accepted as-is. */
76
+ get schemas(): SchemaRegistry;
68
77
  /**
69
78
  * Static creation of a new Fangorn client
70
79
  *
@@ -73,29 +82,19 @@ declare class Fangorn {
73
82
  */
74
83
  static create(options: FangornCreateOptions): Fangorn;
75
84
  /**
76
- * Resets a namespace's onchain state root to zero.
77
- * TODO: also unpin all data
78
- * Use at your own risk.
79
- */
80
- reset(namespace: string): Promise<void>;
81
- /**
82
- * TODO: this isn't really needed here, it's cosmetic
83
- * instead, what if we moved this to a new paradigm where...
84
- *
85
- * each app registers as an ERC-8004 agent with the validation registry
86
- * pointing to these rules essentially?
87
- *
88
- *
89
- * Register permissive (no required fields) schemas for every tag/relation a
90
- * staged graph uses, unless the caller has already registered stricter rules
91
- * 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.
92
88
  */
93
- private registerPermissiveSchemas;
94
- /** 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`. */
95
94
  private createCommit;
96
95
  /**
97
- * Allocates a namespace in the publisher's root map.
98
- * 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.
99
98
  */
100
99
  initRepo(repoName: string): Promise<{
101
100
  cid: undefined;
@@ -109,59 +108,45 @@ declare class Fangorn {
109
108
  alreadyInitialized: false;
110
109
  }>;
111
110
  /**
112
- * 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.
113
113
  */
114
- upload(repoName: string, payload: unknown, schemaId: string): Promise<{
114
+ upload(repoName: string, payload: unknown, type: string, id?: string): Promise<{
115
+ id: string;
115
116
  payloadCid: string;
116
117
  commitCid: string;
117
118
  txHash: `0x${string}`;
118
119
  }>;
119
120
  /**
120
- * Stages many vertices (and optionally edges between them) under one publisher
121
- * root, instead of one tx per vertex. The whole graph is built in memory and
122
- * persisted as ONE CAR upload plus one commit block, then settled in a single
123
- * 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.
124
125
  */
125
- uploadBatch(repoName: string, vertices: {
126
- id: string;
127
- tag: string;
128
- payload: unknown;
129
- }[], edges?: {
130
- rel: string;
131
- from: string;
132
- to: string;
133
- }[]): Promise<{
126
+ uploadBatch(repoName: string, records: RecordInput[], deletes?: string[]): Promise<{
134
127
  commitCid: string;
135
128
  txHash: `0x${string}`;
136
- vertexCids: Record<string, string>;
129
+ recordCids: Record<string, string>;
137
130
  }>;
138
131
  /**
139
- * Build a new commit (no on-chain tx) that stages vertices/edges into
140
- * `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
141
134
  * root commit). The commit and its CAR are uploaded to storage, so a later
142
135
  * `push` — even in a separate process — can settle it.
143
136
  */
144
137
  commit(opts: {
145
- namespace: string;
146
- vertices?: {
147
- id: string;
148
- tag: string;
149
- payload: unknown;
150
- }[];
151
- edges?: {
152
- rel: string;
153
- from: string;
154
- to: string;
155
- }[];
138
+ repo: string;
139
+ records?: RecordInput[];
140
+ deletes?: string[];
156
141
  parent?: string;
157
142
  message: string;
158
- /** Snapshot semantics: the staged graph replaces the namespace's previous contents. */
143
+ /** Snapshot semantics: the staged records replace the repo's previous contents. */
159
144
  replace?: boolean;
160
145
  }): Promise<{
161
146
  commitCid: string;
162
- parents: string[];
147
+ parent: string | null;
163
148
  root: string;
164
- vertexCids: Record<string, string>;
149
+ recordCids: Record<string, string>;
165
150
  }>;
166
151
  /**
167
152
  * Build a commit on top of `owner`'s current on-chain head and return it
@@ -179,83 +164,75 @@ declare class Fangorn {
179
164
  prepareCommit(opts: {
180
165
  /** The publisher whose head advances — NOT this client's service wallet. */
181
166
  owner: Hex;
182
- namespace: string;
183
- vertices?: {
184
- id: string;
185
- tag: string;
186
- payload: unknown;
187
- }[];
188
- edges?: {
189
- rel: string;
190
- from: string;
191
- to: string;
192
- }[];
167
+ repo: string;
168
+ records?: RecordInput[];
169
+ deletes?: string[];
193
170
  message: string;
194
- /** Snapshot semantics: the staged graph replaces the namespace's contents. */
171
+ /** Snapshot semantics: the staged records replace the repo's contents. */
195
172
  replace?: boolean;
196
173
  }): Promise<{
197
174
  commitCid: string;
198
175
  oldRoot: Hex;
199
176
  newRoot: Hex;
200
177
  staged: {
201
- vertices: number;
202
- edges: number;
178
+ records: number;
179
+ deletes: number;
203
180
  };
204
181
  tx: PreparedTx;
205
- vertexCids: Record<string, string>;
182
+ recordCids: Record<string, string>;
206
183
  }>;
207
184
  /**
208
- * Settle a local commit as the on-chain head of `namespace` (fast-forward
209
- * unless `force`). Each namespace has its own timeline, so pushes to
210
- * 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.
211
188
  */
212
- push(namespace: string, commitCid: string, opts?: {
213
- force?: boolean;
214
- }): Promise<{
189
+ push(repo: string, commitCid: string): Promise<{
215
190
  txHash: string;
216
191
  onChainTip: string;
217
192
  }>;
218
- /** The owner's current on-chain tip for a namespace, or null if they have none. */
219
- 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>;
220
195
  /**
221
- * 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.
222
200
  *
223
- * Reading a namespace walks the pail tree from the root — many sequential
224
- * gateway fetches. The tip is one cheap contract read and only moves on
225
- * publish, so it doubles as the cache key: no TTL to tune, no invalidation
226
- * 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.
227
205
  *
228
- * 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
229
207
  * ever touched. The durable copy is on-chain — an evicted entry re-walks.
230
208
  * ponytail: fixed entry count, not byte-aware; switch to a size budget if a
231
- * few huge namespaces blow memory before the count cap bites.
209
+ * few huge repos blow memory before the count cap bites.
232
210
  */
233
- readNamespace(owner: Hex, namespace: string): Promise<{
211
+ readRepo(owner: Hex, repo: string): Promise<{
234
212
  tip: string | null;
235
- contents: NamespaceContents;
213
+ contents: RepoContents;
236
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;
237
219
  /**
238
- * Every (publisher, namespace) pair that has ever committed under this app,
239
- * 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.
240
223
  *
241
- * This is what cross-publisher discovery looks like now: the registry already
242
- * indexes `app_id`, so the commit log IS the index. No per-publisher fan-out,
243
- * no separate registration sweep, no central list — and unlike a publisher
244
- * roster it only surfaces publishers with actual content.
245
- *
246
- * Namespaces come back as `subspaceId` (the hash), not the name, because the
247
- * event never carries the name — recovering it costs one content fetch per
248
- * entry. Pass `namespace` when you know the name you're after (the usual
249
- * case: an app with one well-known namespace) and the filter is applied
250
- * 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.
251
228
  */
252
- appNamespaces(opts?: {
253
- namespace?: string;
229
+ appRepos(opts?: {
230
+ repo?: string;
254
231
  owner?: Hex;
255
232
  fromBlock?: bigint;
256
233
  }): Promise<{
257
234
  owner: Hex;
258
- subspaceId: Hex;
235
+ repo: string;
259
236
  root: Hex;
260
237
  blockNumber: bigint;
261
238
  }[]>;
@@ -274,7 +251,7 @@ declare class Fangorn {
274
251
  card: AgentCard;
275
252
  appId: Hex;
276
253
  fromBlock: bigint;
277
- namespaces: string[];
254
+ repos: string[];
278
255
  }>;
279
256
  /**
280
257
  * The app's commit stream as ONE shared, ref-counted subscription (see
@@ -287,80 +264,76 @@ declare class Fangorn {
287
264
  /** Walk commit history from `head` (newest first). */
288
265
  log(head: string, max?: number): AsyncGenerator<{
289
266
  cid: string;
290
- parents: string[];
291
- timestamp: number;
267
+ parent: string | null;
268
+ epoch: number;
292
269
  message: string;
293
270
  root: string;
294
271
  }>;
295
- /** Show a commit and what it changed vs. its first parent. */
272
+ /** Show a commit and what it changed vs. its parent. */
296
273
  show(commitCid: string): Promise<CommitDiff>;
297
274
  /**
298
- * Lists every vertex and edge currently committed under a namespace, resolved
275
+ * Lists every record currently committed under a repo, resolved
299
276
  * from the publisher's on-chain root — useful for verifying what actually
300
277
  * made it into the repository, as opposed to what a given call staged.
301
278
  */
302
- inspectNamespace(repoName: string): Promise<NamespaceContents>;
279
+ inspectRepo(repoName: string): Promise<RepoContents>;
303
280
  /**
304
- * Stream changes to one publisher's namespace. Optionally replays from
281
+ * Stream changes to one publisher's repo. Optionally replays from
305
282
  * `fromBlock` first (resume cursor), then watches live until the `signal`
306
283
  * aborts. Each yielded change carries `blockNumber` — persist it to resume
307
284
  * exactly where you left off.
308
285
  */
309
- subscribe(opts: SubscribeOptions): AsyncGenerator<NamespaceChange>;
286
+ subscribe(opts: SubscribeOptions): AsyncGenerator<RepoChange>;
310
287
  /**
311
- * Stream changes across the *whole app* — every publisher, every namespace.
312
- * The app-level feed: one topic filter on `app_id`, no per-publisher fan-out
313
- * and no global root to keep in sync. Narrow it with `namespace` (every
314
- * 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.
315
292
  */
316
- subscribeApp(opts?: Omit<SubscribeOptions, "namespace"> & {
317
- namespace?: string;
318
- }): AsyncGenerator<NamespaceChange>;
293
+ subscribeApp(opts?: Omit<SubscribeOptions, "repo"> & {
294
+ repo?: string;
295
+ }): AsyncGenerator<RepoChange>;
319
296
  /** Shared catch-up-then-live loop behind `subscribe` and `subscribeApp`. */
320
297
  private streamCommits;
321
298
  /**
322
- * Resolve a raw `StateCommitted` log into a namespace change, or null if the
323
- * 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.
324
305
  *
325
- * The event carries `keccak256(namespace)`, never the name, so the name comes
326
- * from the commit's own root map — and must hash back to the subspace the
327
- * commit was published into, or the publisher settled a commit for one
328
- * 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.
329
310
  */
330
- private toNamespaceChange;
311
+ private toRepoChange;
331
312
  getConfig(): AppConfig;
332
- getDataRegistry(): DataRegistryClient;
313
+ /** Heads, membership, exclusions and logs: the registry of WHITEPAPER_1 §3.2. */
314
+ getRegistry(): Registry;
333
315
  /**
334
- * Apps, their publisher terms, and per-app membership.
335
- *
336
- * `commitStateRoot` cross-calls this contract, so joining the app here is a
337
- * precondition for publishing under it — `registerForApp()` before
338
- * `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.
339
320
  */
340
321
  getAppRegistry(): AppRegistryClient;
341
- /**
342
- * The publisher-side storage paywall. Per-wallet, not per-app: one
343
- * subscription covers everything this publisher writes, under every app.
344
- */
345
- getSubscriptionRegistry(): SubscriptionRegistryClient;
346
- /**
347
- * The consumer-side pay-then-read rail. Resources are keyed by owner+uid, so
348
- * this client is app-agnostic too.
349
- */
350
- getSettlementRegistry(): SettlementRegistryClient;
351
- /** The app (global namespace) this client publishes and reads under. */
352
- 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;
353
326
  /**
354
327
  * Point this client at a different app — by name (`"my-app"`) or by app id —
355
- * without rebuilding it. The app id prefixes every namespace key, so every
356
- * 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.
357
330
  *
358
- * 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
359
332
  * the shared `appFeed` is released: a feed watches one app's commit stream, so
360
333
  * the next `appFeed()` opens a fresh subscription. Generators already running
361
334
  * from `subscribe`/`subscribeApp` keep their original filter until aborted.
362
335
  */
363
- setAppId(nameOrId: string): void;
336
+ setAppId(nameOrId: string | undefined): void;
364
337
  getStorage(): MetadataStorage;
365
338
  /**
366
339
  * Swap the storage backend at runtime — e.g. move from access-worker signed
@@ -372,4 +345,4 @@ declare class Fangorn {
372
345
  getAddress(): Hex;
373
346
  }
374
347
  //#endregion
375
- export { AgentCard, FANGORN_APP_EXTENSION, Fangorn, NamespaceChange, SubscribeOptions };
348
+ export { AgentCard, FANGORN_APP_EXTENSION, Fangorn, RepoChange, SubscribeOptions };