@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.
- package/README.md +191 -195
- package/lib/cli/cli.d.ts +0 -0
- package/lib/cli/cli.js +198 -164
- package/lib/cli/index.d.ts +3 -91
- package/lib/cli/index.js +5 -2
- package/lib/config.d.ts +349 -433
- package/lib/config.js +41 -28
- package/lib/contracts/app-registry/abi.d.ts +1064 -265
- package/lib/contracts/app-registry/abi.js +1233 -308
- package/lib/contracts/app-registry/index.d.ts +123 -102
- package/lib/contracts/app-registry/index.js +200 -198
- package/lib/contracts/data-registry/abi.d.ts +166 -187
- package/lib/contracts/data-registry/abi.js +207 -237
- package/lib/contracts/data-registry/index.d.ts +4 -160
- package/lib/contracts/data-registry/index.js +5 -294
- package/lib/contracts/index.d.ts +6 -7
- package/lib/contracts/index.js +6 -8
- package/lib/contracts/logs.d.ts +21 -0
- package/lib/contracts/logs.js +32 -0
- package/lib/contracts/membership-registry/abi.d.ts +1145 -0
- package/lib/contracts/membership-registry/abi.js +1333 -0
- package/lib/contracts/membership-registry/index.d.ts +79 -0
- package/lib/contracts/membership-registry/index.js +104 -0
- package/lib/contracts/types.d.ts +3 -1
- package/lib/contracts/types.js +3 -1
- package/lib/contracts/write.d.ts +34 -2
- package/lib/contracts/write.js +48 -1
- package/lib/crypto/encryption.js +4 -4
- package/lib/engine/car.d.ts +2 -2
- package/lib/engine/car.js +10 -5
- package/lib/engine/index.d.ts +99 -143
- package/lib/engine/index.js +156 -295
- package/lib/engine/records.d.ts +110 -0
- package/lib/engine/records.js +165 -0
- package/lib/engine/test-helpers.d.ts +7 -14
- package/lib/engine/test-helpers.js +7 -18
- package/lib/fangorn.d.ts +163 -155
- package/lib/fangorn.js +284 -248
- package/lib/feed.d.ts +7 -4
- package/lib/feed.js +4 -1
- package/lib/index.d.ts +9 -9
- package/lib/index.js +9 -10
- package/lib/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +77 -0
- package/lib/node_modules/@vitest/expect/dist/index.js +1414 -0
- package/lib/node_modules/@vitest/pretty-format/dist/index.js +858 -0
- package/lib/node_modules/@vitest/runner/dist/chunk-tasks.js +51 -0
- package/lib/node_modules/@vitest/runner/dist/index.js +1199 -0
- package/lib/node_modules/@vitest/runner/dist/utils.js +3 -0
- package/lib/node_modules/@vitest/snapshot/dist/index.js +1075 -0
- package/lib/node_modules/@vitest/spy/dist/index.js +353 -0
- package/lib/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +7 -0
- package/lib/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +81 -0
- package/lib/node_modules/@vitest/utils/dist/diff.js +1345 -0
- package/lib/node_modules/@vitest/utils/dist/display.js +534 -0
- package/lib/node_modules/@vitest/utils/dist/error.js +30 -0
- package/lib/node_modules/@vitest/utils/dist/helpers.js +118 -0
- package/lib/node_modules/@vitest/utils/dist/serialize.js +76 -0
- package/lib/node_modules/@vitest/utils/dist/source-map.js +93 -0
- package/lib/node_modules/@vitest/utils/dist/timers.js +36 -0
- package/lib/node_modules/chai/index.js +2874 -0
- package/lib/node_modules/magic-string/dist/magic-string.es.js +939 -0
- package/lib/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +81 -0
- package/lib/node_modules/tinyrainbow/dist/index.js +85 -0
- package/lib/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +5 -0
- package/lib/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.js +50 -0
- package/lib/node_modules/vitest/dist/chunks/utils.DvEY5TfP.js +44 -0
- package/lib/node_modules/vitest/dist/chunks/vi.2VT5v0um.js +2578 -0
- package/lib/providers/storage/signed-url.d.ts +16 -6
- package/lib/providers/storage/signed-url.js +20 -8
- package/lib/registry.d.ts +116 -0
- package/lib/registry.js +182 -0
- package/lib/test/mem-registry.d.ts +51 -0
- package/lib/test/mem-registry.js +107 -0
- package/lib/test/sdk-suite.d.ts +13 -0
- package/lib/test/sdk-suite.js +226 -0
- package/lib/test/testbed.d.ts +16411 -61
- package/lib/test/testbed.js +190 -84
- package/lib/types/index.d.ts +13 -11
- package/package.json +89 -72
- package/lib/contracts/data-registry/test.d.ts +0 -1
- package/lib/contracts/data-registry/test.js +0 -1
- package/lib/contracts/settlement-registry/abi.d.ts +0 -466
- package/lib/contracts/settlement-registry/abi.js +0 -535
- package/lib/contracts/settlement-registry/index.d.ts +0 -163
- package/lib/contracts/settlement-registry/index.js +0 -264
- package/lib/contracts/subscription-registry/abi.d.ts +0 -179
- package/lib/contracts/subscription-registry/abi.js +0 -195
- package/lib/contracts/subscription-registry/index.d.ts +0 -59
- package/lib/contracts/subscription-registry/index.js +0 -116
- package/lib/engine/graph.d.ts +0 -70
- 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 {
|
|
2
|
+
import { PreparedTx } from "./contracts/write.js";
|
|
3
3
|
import { AppRegistryClient } from "./contracts/app-registry/index.js";
|
|
4
|
-
import {
|
|
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,
|
|
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
|
|
15
|
-
|
|
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
|
-
|
|
24
|
-
/**
|
|
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 `
|
|
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
|
|
64
|
+
private readonly _schemas;
|
|
41
65
|
private _feed;
|
|
66
|
+
private _apps;
|
|
67
|
+
private _membership;
|
|
42
68
|
/**
|
|
43
|
-
* The
|
|
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
|
-
|
|
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
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
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
|
-
|
|
76
|
-
|
|
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
|
|
80
|
-
* A no-op (no on-chain tx) if the
|
|
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
|
-
*
|
|
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,
|
|
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
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* fast-forward tx.
|
|
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,
|
|
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
|
-
|
|
129
|
+
recordCids: Record<string, string>;
|
|
119
130
|
}>;
|
|
120
131
|
/**
|
|
121
|
-
* Build a new commit (no on-chain tx) that
|
|
122
|
-
* `
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
|
143
|
+
/** Snapshot semantics: the staged records replace the repo's previous contents. */
|
|
141
144
|
replace?: boolean;
|
|
142
145
|
}): Promise<{
|
|
143
146
|
commitCid: string;
|
|
144
|
-
|
|
147
|
+
parent: string | null;
|
|
145
148
|
root: string;
|
|
146
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
|
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
|
-
|
|
184
|
-
|
|
178
|
+
records: number;
|
|
179
|
+
deletes: number;
|
|
185
180
|
};
|
|
186
181
|
tx: PreparedTx;
|
|
187
|
-
|
|
182
|
+
recordCids: Record<string, string>;
|
|
188
183
|
}>;
|
|
189
184
|
/**
|
|
190
|
-
* Settle a local commit as the on-chain head of `
|
|
191
|
-
*
|
|
192
|
-
*
|
|
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(
|
|
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
|
|
201
|
-
onChainTip(owner: Hex,
|
|
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
|
|
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
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
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
|
|
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
|
|
209
|
+
* few huge repos blow memory before the count cap bites.
|
|
214
210
|
*/
|
|
215
|
-
|
|
211
|
+
readRepo(owner: Hex, repo: string): Promise<{
|
|
216
212
|
tip: string | null;
|
|
217
|
-
contents:
|
|
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,
|
|
221
|
-
*
|
|
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
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
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
|
-
|
|
235
|
-
|
|
229
|
+
appRepos(opts?: {
|
|
230
|
+
repo?: string;
|
|
236
231
|
owner?: Hex;
|
|
237
232
|
fromBlock?: bigint;
|
|
238
233
|
}): Promise<{
|
|
239
234
|
owner: Hex;
|
|
240
|
-
|
|
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
|
-
|
|
256
|
-
|
|
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
|
|
272
|
+
/** Show a commit and what it changed vs. its parent. */
|
|
261
273
|
show(commitCid: string): Promise<CommitDiff>;
|
|
262
274
|
/**
|
|
263
|
-
* Lists every
|
|
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
|
-
|
|
279
|
+
inspectRepo(repoName: string): Promise<RepoContents>;
|
|
268
280
|
/**
|
|
269
|
-
* Stream changes to one publisher's
|
|
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<
|
|
286
|
+
subscribe(opts: SubscribeOptions): AsyncGenerator<RepoChange>;
|
|
275
287
|
/**
|
|
276
|
-
* Stream changes across the *whole app* — every
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
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, "
|
|
282
|
-
|
|
283
|
-
}): AsyncGenerator<
|
|
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
|
|
288
|
-
*
|
|
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
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
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
|
|
311
|
+
private toRepoChange;
|
|
296
312
|
getConfig(): AppConfig;
|
|
297
|
-
|
|
313
|
+
/** Heads, membership, exclusions and logs: the registry of WHITEPAPER_1 §3.2. */
|
|
314
|
+
getRegistry(): Registry;
|
|
298
315
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
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
|
-
|
|
308
|
-
|
|
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.
|
|
321
|
-
*
|
|
328
|
+
* or at none, without rebuilding it. Every read, publish and subscription
|
|
329
|
+
* after this call is in the new context.
|
|
322
330
|
*
|
|
323
|
-
*
|
|
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,
|
|
348
|
+
export { AgentCard, FANGORN_APP_EXTENSION, Fangorn, RepoChange, SubscribeOptions };
|