@origintrail-official/dkg-agent 0.0.1-dev.1773506972.23bf9c0
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/LICENSE +201 -0
- package/README.md +37 -0
- package/dist/agent-wallet.d.ts +19 -0
- package/dist/agent-wallet.d.ts.map +1 -0
- package/dist/agent-wallet.js +61 -0
- package/dist/agent-wallet.js.map +1 -0
- package/dist/discovery.d.ts +40 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +120 -0
- package/dist/discovery.js.map +1 -0
- package/dist/dkg-agent.d.ts +396 -0
- package/dist/dkg-agent.d.ts.map +1 -0
- package/dist/dkg-agent.js +2120 -0
- package/dist/dkg-agent.js.map +1 -0
- package/dist/encryption.d.ts +27 -0
- package/dist/encryption.d.ts.map +1 -0
- package/dist/encryption.js +81 -0
- package/dist/encryption.js.map +1 -0
- package/dist/finalization-handler.d.ts +18 -0
- package/dist/finalization-handler.d.ts.map +1 -0
- package/dist/finalization-handler.js +351 -0
- package/dist/finalization-handler.js.map +1 -0
- package/dist/gossip-publish-handler.d.ts +33 -0
- package/dist/gossip-publish-handler.d.ts.map +1 -0
- package/dist/gossip-publish-handler.js +354 -0
- package/dist/gossip-publish-handler.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/messaging.d.ts +66 -0
- package/dist/messaging.d.ts.map +1 -0
- package/dist/messaging.js +376 -0
- package/dist/messaging.js.map +1 -0
- package/dist/op-wallets.d.ts +15 -0
- package/dist/op-wallets.d.ts.map +1 -0
- package/dist/op-wallets.js +43 -0
- package/dist/op-wallets.js.map +1 -0
- package/dist/profile-manager.d.ts +16 -0
- package/dist/profile-manager.d.ts.map +1 -0
- package/dist/profile-manager.js +38 -0
- package/dist/profile-manager.js.map +1 -0
- package/dist/profile.d.ts +31 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +78 -0
- package/dist/profile.js.map +1 -0
- package/dist/workspace-consistency.d.ts +47 -0
- package/dist/workspace-consistency.d.ts.map +1 -0
- package/dist/workspace-consistency.js +78 -0
- package/dist/workspace-consistency.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { DKGNode, ProtocolRouter, GossipSubManager, TypedEventBus, type OperationContext } from '@origintrail-official/dkg-core';
|
|
2
|
+
import { type TripleStore, type TripleStoreConfig, type Quad } from '@origintrail-official/dkg-storage';
|
|
3
|
+
import { type ChainAdapter, type CreateContextGraphParams, type CreateContextGraphResult } from '@origintrail-official/dkg-chain';
|
|
4
|
+
import { DKGPublisher, type PublishResult, type PhaseCallback, type CASCondition } from '@origintrail-official/dkg-publisher';
|
|
5
|
+
import { DKGQueryEngine, type QueryRequest, type QueryResponse, type QueryAccessConfig } from '@origintrail-official/dkg-query';
|
|
6
|
+
import { type AgentWallet } from './agent-wallet.js';
|
|
7
|
+
import { ProfileManager } from './profile-manager.js';
|
|
8
|
+
import { DiscoveryClient, type SkillSearchOptions, type DiscoveredAgent, type DiscoveredOffering } from './discovery.js';
|
|
9
|
+
import { type SkillHandler, type SkillResponse, type ChatHandler } from './messaging.js';
|
|
10
|
+
/** Health status of a peer from the last ping round. */
|
|
11
|
+
export interface PeerHealth {
|
|
12
|
+
peerId: string;
|
|
13
|
+
alive: boolean;
|
|
14
|
+
latencyMs: number | null;
|
|
15
|
+
lastSeen: number | null;
|
|
16
|
+
lastChecked: number;
|
|
17
|
+
}
|
|
18
|
+
/** Tracks the subscription and sync state of a paranet. */
|
|
19
|
+
export interface ParanetSub {
|
|
20
|
+
name?: string;
|
|
21
|
+
/** GossipSub topics are active for this paranet. */
|
|
22
|
+
subscribed: boolean;
|
|
23
|
+
/** Definition triples exist in the local triple store. */
|
|
24
|
+
synced: boolean;
|
|
25
|
+
/** On-chain paranet ID (keccak256 hash), if known. */
|
|
26
|
+
onChainId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DKGAgentConfig {
|
|
29
|
+
name: string;
|
|
30
|
+
framework?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
listenPort?: number;
|
|
33
|
+
/** IP address to listen on. Default: '0.0.0.0' (all interfaces). Use '127.0.0.1' for tests. */
|
|
34
|
+
listenHost?: string;
|
|
35
|
+
bootstrapPeers?: string[];
|
|
36
|
+
/** Multiaddrs of relay nodes for NAT traversal. */
|
|
37
|
+
relayPeers?: string[];
|
|
38
|
+
/** Multiaddrs to announce to the network (for VPS/cloud nodes with a public IP not on the interface). */
|
|
39
|
+
announceAddresses?: string[];
|
|
40
|
+
skills?: Array<{
|
|
41
|
+
skillType: string;
|
|
42
|
+
pricePerCall?: number;
|
|
43
|
+
currency?: string;
|
|
44
|
+
handler: SkillHandler;
|
|
45
|
+
}>;
|
|
46
|
+
dataDir?: string;
|
|
47
|
+
store?: TripleStore;
|
|
48
|
+
/** Triple store backend configuration (e.g. oxigraph-worker, blazegraph). If omitted, defaults to oxigraph-worker when dataDir is set. */
|
|
49
|
+
storeConfig?: TripleStoreConfig;
|
|
50
|
+
/** Node deployment tier: 'core' (cloud, relay) or 'edge' (personal, behind NAT). Default: 'edge'. */
|
|
51
|
+
nodeRole?: 'core' | 'edge';
|
|
52
|
+
/** Pre-built chain adapter (for testing). If provided, chainConfig is ignored. */
|
|
53
|
+
chainAdapter?: ChainAdapter;
|
|
54
|
+
/**
|
|
55
|
+
* EVM chain configuration. If omitted, publishing won't have on-chain finality.
|
|
56
|
+
* `operationalKeys` are the private keys for operational wallets.
|
|
57
|
+
* The first key is the primary signer (identity, staking); all are used
|
|
58
|
+
* round-robin for publish TXs to avoid nonce collisions on parallel publishes.
|
|
59
|
+
*/
|
|
60
|
+
chainConfig?: {
|
|
61
|
+
rpcUrl: string;
|
|
62
|
+
hubAddress: string;
|
|
63
|
+
operationalKeys: string[];
|
|
64
|
+
chainId?: string;
|
|
65
|
+
};
|
|
66
|
+
/** Cross-agent query access configuration. */
|
|
67
|
+
queryAccess?: QueryAccessConfig;
|
|
68
|
+
/** Additional paranet IDs to sync on peer connect (beyond system paranets). */
|
|
69
|
+
syncParanets?: string[];
|
|
70
|
+
/** TTL for workspace data in milliseconds. Expired operations are periodically cleaned up. Default: 48 hours. Set to 0 to disable. */
|
|
71
|
+
workspaceTtlMs?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* High-level facade that ties together all DKG agent capabilities:
|
|
75
|
+
* identity, networking, publishing, querying, discovery, and messaging.
|
|
76
|
+
*
|
|
77
|
+
* Usage:
|
|
78
|
+
* const agent = await DKGAgent.create({ name: 'MyBot', skills: [...] });
|
|
79
|
+
* await agent.start();
|
|
80
|
+
* const offerings = await agent.findSkills({ skillType: 'ImageAnalysis' });
|
|
81
|
+
* const response = await agent.invokeSkill(offerings[0], inputData);
|
|
82
|
+
* await agent.stop();
|
|
83
|
+
*/
|
|
84
|
+
export declare class DKGAgent {
|
|
85
|
+
readonly wallet: AgentWallet;
|
|
86
|
+
readonly node: DKGNode;
|
|
87
|
+
readonly store: TripleStore;
|
|
88
|
+
readonly publisher: DKGPublisher;
|
|
89
|
+
readonly queryEngine: DKGQueryEngine;
|
|
90
|
+
readonly discovery: DiscoveryClient;
|
|
91
|
+
readonly profileManager: ProfileManager;
|
|
92
|
+
gossip: GossipSubManager;
|
|
93
|
+
router: ProtocolRouter;
|
|
94
|
+
readonly eventBus: TypedEventBus;
|
|
95
|
+
private readonly chain;
|
|
96
|
+
/** Shared workspace-owned root entities per paranet: entity → creatorPeerId. Used by publisher and workspace handler. */
|
|
97
|
+
private readonly workspaceOwnedEntities;
|
|
98
|
+
/** Shared write locks so gossip writes serialize against local CAS writes. */
|
|
99
|
+
private readonly writeLocks;
|
|
100
|
+
private workspaceHandler?;
|
|
101
|
+
private gossipPublishHandler?;
|
|
102
|
+
private finalizationHandler?;
|
|
103
|
+
private readonly log;
|
|
104
|
+
private messageHandler;
|
|
105
|
+
private chainPoller;
|
|
106
|
+
private workspaceCleanupTimer;
|
|
107
|
+
private readonly config;
|
|
108
|
+
private started;
|
|
109
|
+
private readonly subscribedParanets;
|
|
110
|
+
private readonly gossipRegistered;
|
|
111
|
+
private readonly seenOnChainIds;
|
|
112
|
+
private readonly peerHealth;
|
|
113
|
+
private constructor();
|
|
114
|
+
static create(config: DKGAgentConfig): Promise<DKGAgent>;
|
|
115
|
+
start(): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Pull all triples for the given paranets from a remote peer and merge
|
|
118
|
+
* them into our local store. Used on peer:connect for initial catch-up.
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* Pull triples for the given paranets from a remote peer in pages,
|
|
122
|
+
* verify merkle roots against the KC metadata, and only insert
|
|
123
|
+
* triples that pass verification.
|
|
124
|
+
*/
|
|
125
|
+
syncFromPeer(remotePeerId: string, paranetIds?: string[], onPhase?: PhaseCallback): Promise<number>;
|
|
126
|
+
/**
|
|
127
|
+
* Pull workspace graph triples for the given paranets from a remote peer.
|
|
128
|
+
* Workspace data is not merkle-verified (no chain finality) — it is
|
|
129
|
+
* accepted as-is and merged into the local workspace + workspace_meta graphs.
|
|
130
|
+
* The workspaceOwnedEntities set is updated so Rule 4 stays consistent.
|
|
131
|
+
*/
|
|
132
|
+
syncWorkspaceFromPeer(remotePeerId: string, paranetIds?: string[]): Promise<number>;
|
|
133
|
+
/**
|
|
134
|
+
* Catch up a single paranet from currently connected peers that advertise
|
|
135
|
+
* the sync protocol. Useful after runtime subscribe so historical data is
|
|
136
|
+
* backfilled immediately (not only future gossip messages).
|
|
137
|
+
*/
|
|
138
|
+
syncParanetFromConnectedPeers(paranetId: string, options?: {
|
|
139
|
+
includeWorkspace?: boolean;
|
|
140
|
+
}): Promise<{
|
|
141
|
+
connectedPeers: number;
|
|
142
|
+
syncCapablePeers: number;
|
|
143
|
+
peersTried: number;
|
|
144
|
+
dataSynced: number;
|
|
145
|
+
workspaceSynced: number;
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Update the workspace TTL at runtime. Takes effect immediately for queries
|
|
149
|
+
* and the next cleanup cycle without requiring a restart.
|
|
150
|
+
*/
|
|
151
|
+
setWorkspaceTtlMs(ttlMs: number): void;
|
|
152
|
+
/**
|
|
153
|
+
* Remove expired workspace operations and their data.
|
|
154
|
+
* Queries workspace_meta for operations with publishedAt older than the TTL,
|
|
155
|
+
* deletes the corresponding triples from workspace and workspace_meta,
|
|
156
|
+
* and removes the root entities from workspaceOwnedEntities.
|
|
157
|
+
*/
|
|
158
|
+
cleanupExpiredWorkspace(): Promise<number>;
|
|
159
|
+
publishProfile(): Promise<PublishResult>;
|
|
160
|
+
findAgents(options?: {
|
|
161
|
+
framework?: string;
|
|
162
|
+
}): Promise<DiscoveredAgent[]>;
|
|
163
|
+
findSkills(options?: SkillSearchOptions): Promise<DiscoveredOffering[]>;
|
|
164
|
+
findAgentByPeerId(peerId: string): Promise<DiscoveredAgent | null>;
|
|
165
|
+
sendChat(recipientPeerId: string, text: string): Promise<{
|
|
166
|
+
delivered: boolean;
|
|
167
|
+
error?: string;
|
|
168
|
+
}>;
|
|
169
|
+
onChat(handler: ChatHandler): void;
|
|
170
|
+
private _pendingChatHandler;
|
|
171
|
+
invokeSkill(recipientPeerId: string, skillUri: string, inputData: Uint8Array): Promise<SkillResponse>;
|
|
172
|
+
connectTo(multiaddress: string): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Ensure libp2p knows how to reach a peer via circuit relay. If the peer
|
|
175
|
+
* isn't directly connected and their profile advertises a relay address, we
|
|
176
|
+
* add a /p2p-circuit multiaddr to the peer store so dialProtocol can route
|
|
177
|
+
* through the relay.
|
|
178
|
+
*/
|
|
179
|
+
private ensureCircuitRelayAddress;
|
|
180
|
+
publish(paranetId: string, quads: Quad[], privateQuads?: Quad[], opts?: {
|
|
181
|
+
onPhase?: PhaseCallback;
|
|
182
|
+
operationCtx?: OperationContext;
|
|
183
|
+
accessPolicy?: 'public' | 'ownerOnly' | 'allowList';
|
|
184
|
+
allowedPeers?: string[];
|
|
185
|
+
}): Promise<PublishResult>;
|
|
186
|
+
update(kcId: bigint, paranetId: string, quads: Quad[], privateQuads?: Quad[], opts?: {
|
|
187
|
+
onPhase?: PhaseCallback;
|
|
188
|
+
operationCtx?: OperationContext;
|
|
189
|
+
}): Promise<PublishResult>;
|
|
190
|
+
/**
|
|
191
|
+
* Write quads to the paranet's workspace graph (no chain, no TRAC).
|
|
192
|
+
* When localOnly is false (default), replicates via GossipSub workspace topic.
|
|
193
|
+
* When localOnly is true, stores locally without broadcasting — use for private data.
|
|
194
|
+
*/
|
|
195
|
+
writeToWorkspace(paranetId: string, quads: Quad[], opts?: {
|
|
196
|
+
localOnly?: boolean;
|
|
197
|
+
operationCtx?: OperationContext;
|
|
198
|
+
}): Promise<{
|
|
199
|
+
workspaceOperationId: string;
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* Compare-and-swap workspace write. Verifies each condition against the
|
|
203
|
+
* current workspace graph before applying the write atomically.
|
|
204
|
+
* Throws StaleWriteError if any condition fails.
|
|
205
|
+
*/
|
|
206
|
+
writeConditionalToWorkspace(paranetId: string, quads: Quad[], conditions: CASCondition[], opts?: {
|
|
207
|
+
localOnly?: boolean;
|
|
208
|
+
operationCtx?: OperationContext;
|
|
209
|
+
}): Promise<{
|
|
210
|
+
workspaceOperationId: string;
|
|
211
|
+
}>;
|
|
212
|
+
/**
|
|
213
|
+
* Enshrine workspace content: read from workspace graph and publish with full finality (data graph + chain).
|
|
214
|
+
* After on-chain confirmation, broadcasts a lightweight FinalizationMessage so peers with matching
|
|
215
|
+
* workspace state can promote it to canonical without re-downloading the full payload.
|
|
216
|
+
*/
|
|
217
|
+
enshrineFromWorkspace(paranetId: string, selection: 'all' | {
|
|
218
|
+
rootEntities: string[];
|
|
219
|
+
}, options?: {
|
|
220
|
+
clearWorkspaceAfter?: boolean;
|
|
221
|
+
operationCtx?: OperationContext;
|
|
222
|
+
onPhase?: PhaseCallback;
|
|
223
|
+
contextGraphId?: string | bigint;
|
|
224
|
+
contextGraphSignatures?: Array<{
|
|
225
|
+
identityId: bigint;
|
|
226
|
+
r: Uint8Array;
|
|
227
|
+
vs: Uint8Array;
|
|
228
|
+
}>;
|
|
229
|
+
}): Promise<PublishResult>;
|
|
230
|
+
/**
|
|
231
|
+
* Create a new context graph on-chain.
|
|
232
|
+
* A context graph is a bounded, M/N signature-gated subgraph within a paranet.
|
|
233
|
+
*/
|
|
234
|
+
createContextGraph(params: CreateContextGraphParams): Promise<CreateContextGraphResult>;
|
|
235
|
+
/**
|
|
236
|
+
* Link an already-published KC batch to a context graph.
|
|
237
|
+
* Collects participant signatures and calls addBatchToContextGraph on-chain.
|
|
238
|
+
*/
|
|
239
|
+
addBatchToContextGraph(params: {
|
|
240
|
+
contextGraphId: string | bigint;
|
|
241
|
+
batchId: bigint;
|
|
242
|
+
merkleRoot?: Uint8Array;
|
|
243
|
+
participantSignatures?: Array<{
|
|
244
|
+
identityId: bigint;
|
|
245
|
+
r: Uint8Array;
|
|
246
|
+
vs: Uint8Array;
|
|
247
|
+
}>;
|
|
248
|
+
}): Promise<{
|
|
249
|
+
success: boolean;
|
|
250
|
+
}>;
|
|
251
|
+
/**
|
|
252
|
+
* (Re-)attempt on-chain identity registration. Safe to call multiple times.
|
|
253
|
+
* Returns the identityId (>0n on success, 0n if chain is not configured).
|
|
254
|
+
*/
|
|
255
|
+
ensureIdentity(): Promise<bigint>;
|
|
256
|
+
query(sparql: string, options?: string | {
|
|
257
|
+
paranetId?: string;
|
|
258
|
+
graphSuffix?: '_workspace';
|
|
259
|
+
includeWorkspace?: boolean;
|
|
260
|
+
operationCtx?: OperationContext;
|
|
261
|
+
}): Promise<import("@origintrail-official/dkg-query").QueryResult>;
|
|
262
|
+
/**
|
|
263
|
+
* Send a cross-agent query to a remote peer via the /dkg/query/2.0.0 protocol.
|
|
264
|
+
*/
|
|
265
|
+
queryRemote(peerId: string, request: Omit<QueryRequest, 'operationId'>): Promise<QueryResponse>;
|
|
266
|
+
/**
|
|
267
|
+
* Look up a specific knowledge asset on a remote peer by UAL.
|
|
268
|
+
*/
|
|
269
|
+
lookupEntity(peerId: string, ual: string): Promise<QueryResponse>;
|
|
270
|
+
/**
|
|
271
|
+
* Find entities of a given RDF type on a remote peer's paranet.
|
|
272
|
+
*/
|
|
273
|
+
findEntitiesByType(peerId: string, paranetId: string, rdfType: string, limit?: number): Promise<QueryResponse>;
|
|
274
|
+
/**
|
|
275
|
+
* Get all triples for a specific entity from a remote peer's paranet.
|
|
276
|
+
*/
|
|
277
|
+
getEntityTriples(peerId: string, paranetId: string, entityUri: string): Promise<QueryResponse>;
|
|
278
|
+
/**
|
|
279
|
+
* Run a SPARQL query on a remote peer (if they allow it).
|
|
280
|
+
*/
|
|
281
|
+
queryRemoteSparql(peerId: string, paranetId: string, sparql: string, limit?: number, timeout?: number): Promise<QueryResponse>;
|
|
282
|
+
subscribeToParanet(paranetId: string, options?: {
|
|
283
|
+
trackSyncScope?: boolean;
|
|
284
|
+
}): void;
|
|
285
|
+
/**
|
|
286
|
+
* Add a paranet to runtime sync scope so sync-on-connect includes it.
|
|
287
|
+
* System paranets are already included by default and are skipped here.
|
|
288
|
+
*/
|
|
289
|
+
private trackSyncParanet;
|
|
290
|
+
private getOrCreateGossipPublishHandler;
|
|
291
|
+
private getOrCreateWorkspaceHandler;
|
|
292
|
+
private updateHandler?;
|
|
293
|
+
private getOrCreateUpdateHandler;
|
|
294
|
+
private getOrCreateFinalizationHandler;
|
|
295
|
+
/**
|
|
296
|
+
* Create a paranet by registering it on-chain (if a chain adapter is
|
|
297
|
+
* available) and publishing its definition triples into the system
|
|
298
|
+
* ontology paranet.
|
|
299
|
+
*
|
|
300
|
+
* On-chain registration is privacy-preserving by default: only
|
|
301
|
+
* keccak256(bytes(name)) is stored. Set revealOnChain to also publish
|
|
302
|
+
* cleartext name and description to the contract.
|
|
303
|
+
*
|
|
304
|
+
* If the paranet already exists on-chain (another node registered it
|
|
305
|
+
* first), the local definition is created without a chain call.
|
|
306
|
+
*/
|
|
307
|
+
createParanet(opts: {
|
|
308
|
+
id: string;
|
|
309
|
+
name: string;
|
|
310
|
+
description?: string;
|
|
311
|
+
replicationPolicy?: string;
|
|
312
|
+
accessPolicy?: number;
|
|
313
|
+
revealOnChain?: boolean;
|
|
314
|
+
/** When true, skips on-chain registration, gossip subscription, and broadcast. Data stays local-only. */
|
|
315
|
+
private?: boolean;
|
|
316
|
+
}): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* Idempotent "ensure" variant of createParanet for boot-time defaults.
|
|
319
|
+
* If the paranet already exists locally, just ensures GossipSub subscription
|
|
320
|
+
* and registry entry. If not, inserts definition triples and optionally
|
|
321
|
+
* registers on-chain (or gracefully handles "already exists" on-chain).
|
|
322
|
+
* Unlike createParanet(), this never throws for duplicates and avoids
|
|
323
|
+
* re-claiming creator if the paranet is already on-chain.
|
|
324
|
+
*/
|
|
325
|
+
ensureParanetLocal(opts: {
|
|
326
|
+
id: string;
|
|
327
|
+
name: string;
|
|
328
|
+
description?: string;
|
|
329
|
+
revealOnChain?: boolean;
|
|
330
|
+
}): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Check whether a paranet is registered (definition triples exist in the
|
|
333
|
+
* ontology graph). Always store-backed to avoid false positives from
|
|
334
|
+
* in-memory state that may not have been persisted yet.
|
|
335
|
+
*/
|
|
336
|
+
paranetExists(paranetId: string): Promise<boolean>;
|
|
337
|
+
/**
|
|
338
|
+
* List all known paranets by merging the subscription registry with
|
|
339
|
+
* SPARQL-discovered definition triples. Returns enriched entries with
|
|
340
|
+
* `subscribed` and `synced` flags.
|
|
341
|
+
*/
|
|
342
|
+
listParanets(): Promise<Array<{
|
|
343
|
+
id: string;
|
|
344
|
+
uri: string;
|
|
345
|
+
name: string;
|
|
346
|
+
description?: string;
|
|
347
|
+
creator?: string;
|
|
348
|
+
createdAt?: string;
|
|
349
|
+
isSystem: boolean;
|
|
350
|
+
subscribed: boolean;
|
|
351
|
+
synced: boolean;
|
|
352
|
+
}>>;
|
|
353
|
+
networkId(): Promise<string>;
|
|
354
|
+
get peerId(): string;
|
|
355
|
+
get identityId(): bigint;
|
|
356
|
+
/**
|
|
357
|
+
* Sign the context graph participant digest: keccak256(contextGraphId, merkleRoot).
|
|
358
|
+
* Returns the caller's identity ID and compact ECDSA (r, vs) values that the
|
|
359
|
+
* ContextGraphs contract can verify via ecrecover.
|
|
360
|
+
*/
|
|
361
|
+
signContextGraphDigest(contextGraphId: bigint, merkleRoot: Uint8Array): Promise<{
|
|
362
|
+
identityId: bigint;
|
|
363
|
+
r: Uint8Array;
|
|
364
|
+
vs: Uint8Array;
|
|
365
|
+
}>;
|
|
366
|
+
get multiaddrs(): string[];
|
|
367
|
+
/** Returns a snapshot of the paranet subscription registry. */
|
|
368
|
+
getSubscribedParanets(): ReadonlyMap<string, ParanetSub>;
|
|
369
|
+
/** Returns the latest health snapshot for all known peers. */
|
|
370
|
+
getPeerHealth(): ReadonlyMap<string, PeerHealth>;
|
|
371
|
+
/**
|
|
372
|
+
* Ping all known peers to check liveness. Updates the peerHealth map with
|
|
373
|
+
* latency and last-seen timestamps. Returns the number of peers that responded.
|
|
374
|
+
*/
|
|
375
|
+
pingPeers(): Promise<number>;
|
|
376
|
+
/**
|
|
377
|
+
* Scan the local ONTOLOGY graph for paranet definitions and auto-subscribe
|
|
378
|
+
* to any that aren't yet in the subscription registry. Called after
|
|
379
|
+
* syncFromPeer to catch paranets discovered via ONTOLOGY sync.
|
|
380
|
+
*/
|
|
381
|
+
discoverParanetsFromStore(): Promise<number>;
|
|
382
|
+
/**
|
|
383
|
+
* Query the on-chain ParanetV9Registry for all registered paranets and
|
|
384
|
+
* auto-subscribe to any not yet in the subscription registry.
|
|
385
|
+
* Returns the number of newly discovered paranets.
|
|
386
|
+
*/
|
|
387
|
+
discoverParanetsFromChain(): Promise<number>;
|
|
388
|
+
stop(): Promise<void>;
|
|
389
|
+
/**
|
|
390
|
+
* Loads genesis knowledge into the triple store if not already present.
|
|
391
|
+
* Creates the system paranet graphs and inserts the genesis quads.
|
|
392
|
+
*/
|
|
393
|
+
private static loadGenesis;
|
|
394
|
+
private broadcastPublish;
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=dkg-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dkg-agent.d.ts","sourceRoot":"","sources":["../src/dkg-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EASpC,KAAK,gBAAgB,EAC1C,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAmC,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,mCAAmC,CAAC;AACzI,OAAO,EAA0E,KAAK,YAAY,EAAE,KAAK,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC1M,OAAO,EACL,YAAY,EAGZ,KAAK,aAAa,EAAE,KAAK,aAAa,EAAmB,KAAK,YAAY,EAC3E,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAC9D,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzH,OAAO,EAAkB,KAAK,YAAY,EAAqB,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiB5H,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf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