@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.
- package/README.md +190 -194
- package/lib/cli/cli.d.ts +0 -0
- package/lib/cli/cli.js +177 -201
- package/lib/cli/index.d.ts +3 -91
- package/lib/cli/index.js +5 -2
- package/lib/config.d.ts +358 -117
- package/lib/config.js +43 -23
- package/lib/contracts/app-registry/abi.d.ts +1033 -277
- package/lib/contracts/app-registry/abi.js +1214 -335
- package/lib/contracts/app-registry/index.d.ts +105 -65
- package/lib/contracts/app-registry/index.js +182 -175
- 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 -151
- package/lib/contracts/data-registry/index.js +5 -279
- package/lib/contracts/index.d.ts +6 -7
- package/lib/contracts/index.js +6 -8
- package/lib/contracts/logs.d.ts +4 -1
- package/lib/contracts/logs.js +9 -2
- 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 +129 -156
- package/lib/fangorn.js +250 -250
- package/lib/feed.d.ts +7 -4
- package/lib/feed.js +4 -1
- package/lib/index.d.ts +9 -9
- package/lib/index.js +8 -9
- 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 -73
- 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/feed.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RepoChange } from "./fangorn.js";
|
|
2
2
|
|
|
3
3
|
//#region src/feed.d.ts
|
|
4
4
|
|
|
@@ -6,10 +6,13 @@ import { NamespaceChange } from "./fangorn.js";
|
|
|
6
6
|
* One shared app-wide commit stream, fanned out to many consumers.
|
|
7
7
|
*
|
|
8
8
|
* `subscribeApp` opens a fresh RPC watch per call. A server that subscribes per
|
|
9
|
-
* connection × per tracked
|
|
9
|
+
* connection × per tracked repo opens N×M pollers for what is the *same*
|
|
10
10
|
* app-level topic filter. This opens exactly one, ref-counted: it starts with
|
|
11
11
|
* the first listener and stops with the last. Consumers filter in memory — the
|
|
12
12
|
* events are already narrowed to the app on-chain.
|
|
13
|
+
*
|
|
14
|
+
* Not a lens (WHITEPAPER_1 §3.4): a lens computes a view over the stream, this
|
|
15
|
+
* only shares the stream. fangorn-md's server fans it out to its connections.
|
|
13
16
|
*/
|
|
14
17
|
declare class AppFeed {
|
|
15
18
|
private readonly open;
|
|
@@ -17,7 +20,7 @@ declare class AppFeed {
|
|
|
17
20
|
private readonly restartDelayMs;
|
|
18
21
|
private readonly listeners;
|
|
19
22
|
private abort;
|
|
20
|
-
constructor(open: (signal: AbortSignal) => AsyncGenerator<
|
|
23
|
+
constructor(open: (signal: AbortSignal) => AsyncGenerator<RepoChange>, /** Delay before reopening the watch after it fails or ends. */
|
|
21
24
|
restartDelayMs?: number);
|
|
22
25
|
/** Number of live listeners — 0 means the underlying watch is closed. */
|
|
23
26
|
get size(): number;
|
|
@@ -25,7 +28,7 @@ declare class AppFeed {
|
|
|
25
28
|
* Register a listener, starting the feed if it was idle. Returns the
|
|
26
29
|
* unsubscribe function; the feed stops once the last listener leaves.
|
|
27
30
|
*/
|
|
28
|
-
on(onChange: (change:
|
|
31
|
+
on(onChange: (change: RepoChange) => void, onError?: (err: Error) => void): () => void;
|
|
29
32
|
private run;
|
|
30
33
|
}
|
|
31
34
|
//#endregion
|
package/lib/feed.js
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
* One shared app-wide commit stream, fanned out to many consumers.
|
|
4
4
|
*
|
|
5
5
|
* `subscribeApp` opens a fresh RPC watch per call. A server that subscribes per
|
|
6
|
-
* connection × per tracked
|
|
6
|
+
* connection × per tracked repo opens N×M pollers for what is the *same*
|
|
7
7
|
* app-level topic filter. This opens exactly one, ref-counted: it starts with
|
|
8
8
|
* the first listener and stops with the last. Consumers filter in memory — the
|
|
9
9
|
* events are already narrowed to the app on-chain.
|
|
10
|
+
*
|
|
11
|
+
* Not a lens (WHITEPAPER_1 §3.4): a lens computes a view over the stream, this
|
|
12
|
+
* only shares the stream. fangorn-md's server fans it out to its connections.
|
|
10
13
|
*/
|
|
11
14
|
var AppFeed = class {
|
|
12
15
|
listeners = /* @__PURE__ */ new Set();
|
package/lib/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { AppConfig,
|
|
1
|
+
import { AppConfig, BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, nonBlank, toAppId } from "./config.js";
|
|
2
2
|
import { APP_REGISTRY_ABI } from "./contracts/app-registry/abi.js";
|
|
3
3
|
import { PublisherStatus } from "./contracts/types.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { PreparedTx } from "./contracts/write.js";
|
|
5
|
+
import { AppAccess, AppAgentLog, AppRegistryClient } from "./contracts/app-registry/index.js";
|
|
6
6
|
import { DATA_REGISTRY_ABI } from "./contracts/data-registry/abi.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { SUBSCRIPTION_REGISTRY_ABI } from "./contracts/subscription-registry/abi.js";
|
|
7
|
+
import { repoId } from "./contracts/data-registry/index.js";
|
|
8
|
+
import { ClaimArgs, JoinArgs, MembershipPayment, MembershipRegistryClient, joinNonce, membershipScope, membershipTokenId } from "./contracts/membership-registry/index.js";
|
|
9
|
+
import { MEMBERSHIP_REGISTRY_ABI } from "./contracts/membership-registry/abi.js";
|
|
11
10
|
import "./contracts/index.js";
|
|
12
11
|
import { AccessRequest, AccessSigner, DecryptHandleParams, EncryptAndUploadParams, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, Gadget, HandleFieldInput, X25519_PUBKEY_LENGTH, accessMessageHash, buildAccessRequest, decryptHandle, encryptAndUpload, seal, sealSelf, sha256Hex, unseal, unsealSelf } from "./crypto/encryption.js";
|
|
12
|
+
import { ChainRegistry, ChainRegistryConfig, EPOCH_SECONDS, Exclusion, LogFilter, Registry, RepoRef, UpdateEntry, ZERO_HEAD, covers, epochOf, exclusionId, repoExcluded } from "./registry.js";
|
|
13
13
|
import { FangornContext, FangornCreateOptions, StorageConfig } from "./types/index.js";
|
|
14
14
|
import { AppFeed } from "./feed.js";
|
|
15
|
-
import { AgentCard, FANGORN_APP_EXTENSION, Fangorn,
|
|
15
|
+
import { AgentCard, FANGORN_APP_EXTENSION, Fangorn, RepoChange, SubscribeOptions } from "./fangorn.js";
|
|
16
16
|
import { AssetProcessor, BuildAssetGraphOptions, CommitFileGraph, Edge, FileFacade, ProcessorResult, Vertex, buildAssetGraph, buildMarkdownGraph, extractMarkdownLinks } from "./harness/index.js";
|
|
17
17
|
import { PinataBackend } from "./providers/storage/pinata.js";
|
|
18
18
|
import { DEFAULT_SIGNED_URL_WORKER, SignedUrlBackend, SignedUrlSigner } from "./providers/storage/signed-url.js";
|
|
19
19
|
import { MAX_UPLOAD_ATTEMPTS, deserialize, fetchRawByCid, isTransientUpload, retrieveByCid, serialize, withUploadRetry } from "./providers/storage/utils.js";
|
|
20
|
-
export { APP_REGISTRY_ABI, AccessRequest, AccessSigner, AgentCard, AppAgentLog, AppConfig, AppFeed,
|
|
20
|
+
export { APP_REGISTRY_ABI, AccessRequest, AccessSigner, AgentCard, AppAccess, AppAgentLog, AppConfig, AppFeed, AppRegistryClient, AssetProcessor, BaseSepoliaConfig, BuildAssetGraphOptions, ChainRegistry, ChainRegistryConfig, ClaimArgs, CommitFileGraph, DATA_REGISTRY_ABI, DEFAULT_SIGNED_URL_WORKER, DecryptHandleParams, EPOCH_SECONDS, Edge, EncryptAndUploadParams, Exclusion, FANGORN_APP_EXTENSION, Fangorn, FangornConfig, FangornContext, FangornCreateOptions, FileFacade, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, Gadget, HandleFieldInput, JoinArgs, LogFilter, MAX_UPLOAD_ATTEMPTS, MEMBERSHIP_REGISTRY_ABI, MembershipPayment, MembershipRegistryClient, PinataBackend, PreparedTx, ProcessorResult, PublisherStatus, Registry, RepoChange, RepoRef, SignedUrlBackend, SignedUrlSigner, StorageConfig, SubscribeOptions, SupportedNetworks, UpdateEntry, Vertex, X25519_PUBKEY_LENGTH, ZERO_HEAD, accessMessageHash, appId, buildAccessRequest, buildAssetGraph, buildMarkdownGraph, covers, decryptHandle, deserialize, encryptAndUpload, epochOf, exclusionId, extractMarkdownLinks, fetchRawByCid, isTransientUpload, joinNonce, membershipScope, membershipTokenId, nonBlank, repoExcluded, repoId, retrieveByCid, seal, sealSelf, serialize, sha256Hex, toAppId, unseal, unsealSelf, withUploadRetry };
|
package/lib/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseSepoliaConfig, FangornConfig, SupportedNetworks, appId, nonBlank, toAppId } from "./config.js";
|
|
2
2
|
import { DEFAULT_SIGNED_URL_WORKER, SignedUrlBackend } from "./providers/storage/signed-url.js";
|
|
3
3
|
import { MAX_UPLOAD_ATTEMPTS, deserialize, fetchRawByCid, isTransientUpload, retrieveByCid, serialize, withUploadRetry } from "./providers/storage/utils.js";
|
|
4
4
|
import { PinataBackend } from "./providers/storage/pinata.js";
|
|
5
5
|
import { APP_REGISTRY_ABI } from "./contracts/app-registry/abi.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { AppRegistryClient } from "./contracts/app-registry/index.js";
|
|
7
|
+
import { repoId } from "./contracts/data-registry/index.js";
|
|
8
8
|
import { DATA_REGISTRY_ABI } from "./contracts/data-registry/abi.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { SUBSCRIPTION_REGISTRY_ABI } from "./contracts/subscription-registry/abi.js";
|
|
13
|
-
import { SubscriptionRegistryClient } from "./contracts/subscription-registry/index.js";
|
|
9
|
+
import { MEMBERSHIP_REGISTRY_ABI } from "./contracts/membership-registry/abi.js";
|
|
10
|
+
import { MembershipRegistryClient, joinNonce, membershipScope, membershipTokenId } from "./contracts/membership-registry/index.js";
|
|
11
|
+
import { PublisherStatus } from "./contracts/types.js";
|
|
14
12
|
import "./contracts/index.js";
|
|
13
|
+
import { ChainRegistry, EPOCH_SECONDS, ZERO_HEAD, covers, epochOf, exclusionId, repoExcluded } from "./registry.js";
|
|
15
14
|
import { AppFeed } from "./feed.js";
|
|
16
15
|
import { FANGORN_APP_EXTENSION, Fangorn } from "./fangorn.js";
|
|
17
16
|
import { buildAssetGraph, buildMarkdownGraph, extractMarkdownLinks } from "./harness/index.js";
|
|
18
17
|
import { GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, X25519_PUBKEY_LENGTH, accessMessageHash, buildAccessRequest, decryptHandle, encryptAndUpload, seal, sealSelf, sha256Hex, unseal, unsealSelf } from "./crypto/encryption.js";
|
|
19
18
|
|
|
20
|
-
export { APP_REGISTRY_ABI, AppFeed, AppRegistryClient,
|
|
19
|
+
export { APP_REGISTRY_ABI, AppFeed, AppRegistryClient, BaseSepoliaConfig, ChainRegistry, DATA_REGISTRY_ABI, DEFAULT_SIGNED_URL_WORKER, EPOCH_SECONDS, FANGORN_APP_EXTENSION, Fangorn, FangornConfig, GADGET_SELF_HKDF_V1, GADGET_WORKER_USDC_V1, MAX_UPLOAD_ATTEMPTS, MEMBERSHIP_REGISTRY_ABI, MembershipRegistryClient, PinataBackend, PublisherStatus, SignedUrlBackend, SupportedNetworks, X25519_PUBKEY_LENGTH, ZERO_HEAD, accessMessageHash, appId, buildAccessRequest, buildAssetGraph, buildMarkdownGraph, covers, decryptHandle, deserialize, encryptAndUpload, epochOf, exclusionId, extractMarkdownLinks, fetchRawByCid, isTransientUpload, joinNonce, membershipScope, membershipTokenId, nonBlank, repoExcluded, repoId, retrieveByCid, seal, sealSelf, serialize, sha256Hex, toAppId, unseal, unsealSelf, withUploadRetry };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
2
|
+
var comma = ",".charCodeAt(0);
|
|
3
|
+
var semicolon = ";".charCodeAt(0);
|
|
4
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
5
|
+
var intToChar = new Uint8Array(64);
|
|
6
|
+
var charToInt = new Uint8Array(128);
|
|
7
|
+
for (let i = 0; i < chars.length; i++) {
|
|
8
|
+
const c = chars.charCodeAt(i);
|
|
9
|
+
intToChar[i] = c;
|
|
10
|
+
charToInt[c] = i;
|
|
11
|
+
}
|
|
12
|
+
function encodeInteger(builder, num, relative) {
|
|
13
|
+
let delta = num - relative;
|
|
14
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
15
|
+
do {
|
|
16
|
+
let clamped = delta & 31;
|
|
17
|
+
delta >>>= 5;
|
|
18
|
+
if (delta > 0) clamped |= 32;
|
|
19
|
+
builder.write(intToChar[clamped]);
|
|
20
|
+
} while (delta > 0);
|
|
21
|
+
return num;
|
|
22
|
+
}
|
|
23
|
+
var bufLength = 1024 * 16;
|
|
24
|
+
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
25
|
+
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
26
|
+
} } : { decode(buf) {
|
|
27
|
+
let out = "";
|
|
28
|
+
for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
|
|
29
|
+
return out;
|
|
30
|
+
} };
|
|
31
|
+
var StringWriter = class {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.pos = 0;
|
|
34
|
+
this.out = "";
|
|
35
|
+
this.buffer = new Uint8Array(bufLength);
|
|
36
|
+
}
|
|
37
|
+
write(v) {
|
|
38
|
+
const { buffer } = this;
|
|
39
|
+
buffer[this.pos++] = v;
|
|
40
|
+
if (this.pos === bufLength) {
|
|
41
|
+
this.out += td.decode(buffer);
|
|
42
|
+
this.pos = 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
flush() {
|
|
46
|
+
const { buffer, out, pos } = this;
|
|
47
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function encode(decoded) {
|
|
51
|
+
const writer = new StringWriter();
|
|
52
|
+
let sourcesIndex = 0;
|
|
53
|
+
let sourceLine = 0;
|
|
54
|
+
let sourceColumn = 0;
|
|
55
|
+
let namesIndex = 0;
|
|
56
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
57
|
+
const line = decoded[i];
|
|
58
|
+
if (i > 0) writer.write(semicolon);
|
|
59
|
+
if (line.length === 0) continue;
|
|
60
|
+
let genColumn = 0;
|
|
61
|
+
for (let j = 0; j < line.length; j++) {
|
|
62
|
+
const segment = line[j];
|
|
63
|
+
if (j > 0) writer.write(comma);
|
|
64
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
65
|
+
if (segment.length === 1) continue;
|
|
66
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
67
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
68
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
69
|
+
if (segment.length === 4) continue;
|
|
70
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return writer.flush();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { encode };
|