@provenonce/sdk 0.12.0 → 0.14.0
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/dist/index.d.mts +82 -58
- package/dist/index.d.ts +82 -58
- package/dist/index.js +191 -220
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +192 -220
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -15,12 +15,11 @@
|
|
|
15
15
|
* registryUrl: 'https://provenonce.io',
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
|
-
* await agent.init(); //
|
|
19
|
-
* await agent.
|
|
20
|
-
* await agent.checkin(); // Report to registry
|
|
18
|
+
* await agent.init(); // Initialize agent state
|
|
19
|
+
* await agent.heartbeat(); // Send paid heartbeat (Phase 2)
|
|
21
20
|
*
|
|
22
|
-
* // Or run the autonomous heartbeat:
|
|
23
|
-
* agent.startHeartbeat(); //
|
|
21
|
+
* // Or run the autonomous heartbeat loop:
|
|
22
|
+
* agent.startHeartbeat(); // Heartbeats at regular intervals
|
|
24
23
|
* // ... do your agent work ...
|
|
25
24
|
* agent.stopHeartbeat();
|
|
26
25
|
*
|
|
@@ -189,8 +188,34 @@ interface SpawnResult {
|
|
|
189
188
|
ok: boolean;
|
|
190
189
|
eligible: boolean;
|
|
191
190
|
child_hash?: string;
|
|
191
|
+
spawn_authorization?: string;
|
|
192
|
+
receipt_based?: boolean;
|
|
193
|
+
required_beats?: number;
|
|
194
|
+
accumulated_beats?: number;
|
|
192
195
|
progress_pct?: number;
|
|
193
196
|
deficit?: number;
|
|
197
|
+
error?: string;
|
|
198
|
+
}
|
|
199
|
+
/** A signed work-proof receipt from the Beats service. */
|
|
200
|
+
interface WorkProofReceipt {
|
|
201
|
+
type: string;
|
|
202
|
+
beats_verified: number;
|
|
203
|
+
difficulty: number;
|
|
204
|
+
anchor_index: number;
|
|
205
|
+
anchor_hash: string | null;
|
|
206
|
+
from_hash: string;
|
|
207
|
+
to_hash: string;
|
|
208
|
+
utc: string;
|
|
209
|
+
signature: string;
|
|
210
|
+
[key: string]: unknown;
|
|
211
|
+
}
|
|
212
|
+
/** Result of computeWorkProof() */
|
|
213
|
+
interface WorkProofResult {
|
|
214
|
+
ok: boolean;
|
|
215
|
+
receipt?: WorkProofReceipt;
|
|
216
|
+
beats_computed?: number;
|
|
217
|
+
elapsed_ms?: number;
|
|
218
|
+
error?: string;
|
|
194
219
|
}
|
|
195
220
|
/** Agent status from the registry */
|
|
196
221
|
interface AgentStatus {
|
|
@@ -205,21 +230,8 @@ interface AgentStatus {
|
|
|
205
230
|
};
|
|
206
231
|
difficulty?: number;
|
|
207
232
|
}
|
|
208
|
-
/**
|
|
209
|
-
* Generate an Ed25519 keypair for agent wallet identity.
|
|
210
|
-
* Returns hex-encoded raw keys (32 bytes each).
|
|
211
|
-
* Uses Node.js built-in crypto — zero external dependencies.
|
|
212
|
-
*/
|
|
213
|
-
declare function generateWalletKeypair(): {
|
|
214
|
-
publicKey: string;
|
|
215
|
-
secretKey: string;
|
|
216
|
-
};
|
|
217
233
|
/** Wallet info returned from root registration */
|
|
218
234
|
interface WalletInfo {
|
|
219
|
-
/** Hex-encoded 32-byte Ed25519 public key (Solana self-custody only, empty otherwise) */
|
|
220
|
-
public_key: string;
|
|
221
|
-
/** Hex-encoded 32-byte Ed25519 secret seed — SAVE THIS for future fee signing (Solana self-custody only) */
|
|
222
|
-
secret_key: string;
|
|
223
235
|
/** Solana-compatible base58 address (Solana wallets only) */
|
|
224
236
|
solana_address?: string;
|
|
225
237
|
/** The wallet address (base58 for Solana, 0x for Ethereum) */
|
|
@@ -266,10 +278,8 @@ interface RegisterOptions {
|
|
|
266
278
|
registrationToken?: string;
|
|
267
279
|
/** Admin-minted invite token */
|
|
268
280
|
registrationInvite?: string;
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
272
|
-
walletModel?: 'self-custody' | 'operator';
|
|
281
|
+
/** Wallet model: 'operator' (Model B). Must be set explicitly to opt in. */
|
|
282
|
+
walletModel?: 'operator';
|
|
273
283
|
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
274
284
|
walletChain?: 'solana' | 'ethereum';
|
|
275
285
|
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
@@ -295,20 +305,6 @@ interface RegisterOptions {
|
|
|
295
305
|
* No wallet (default, single-phase):
|
|
296
306
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
297
307
|
*
|
|
298
|
-
* Solana self-custody wallet (Model A, two-phase):
|
|
299
|
-
* const creds = await register('my-org', {
|
|
300
|
-
* registryUrl: '...',
|
|
301
|
-
* walletModel: 'self-custody',
|
|
302
|
-
* });
|
|
303
|
-
* // creds.wallet.secret_key = hex secret (SAVE THIS)
|
|
304
|
-
* // creds.wallet.address = base58 Solana address
|
|
305
|
-
*
|
|
306
|
-
* Solana with existing key:
|
|
307
|
-
* const creds = await register('my-org', {
|
|
308
|
-
* registryUrl: '...',
|
|
309
|
-
* walletSecretKey: '<hex-encoded-32-byte-seed>',
|
|
310
|
-
* });
|
|
311
|
-
*
|
|
312
308
|
* Ethereum bring-your-own (two-phase):
|
|
313
309
|
* const creds = await register('my-org', {
|
|
314
310
|
* registryUrl: '...',
|
|
@@ -358,6 +354,8 @@ interface BeatAgentConfig {
|
|
|
358
354
|
verbose?: boolean;
|
|
359
355
|
/** Verify anchor hash locally before trusting it (default: true). */
|
|
360
356
|
verifyAnchors?: boolean;
|
|
357
|
+
/** Beats service URL for work-proof submission (default: https://beats.provenonce.dev). */
|
|
358
|
+
beatsUrl?: string;
|
|
361
359
|
}
|
|
362
360
|
declare class BeatAgent {
|
|
363
361
|
private config;
|
|
@@ -382,24 +380,8 @@ declare class BeatAgent {
|
|
|
382
380
|
genesis?: string;
|
|
383
381
|
error?: string;
|
|
384
382
|
}>;
|
|
385
|
-
/**
|
|
386
|
-
* @deprecated Phase 2: VDF computation retired (D-68). Payment is the liveness mechanism.
|
|
387
|
-
* Use heartbeat() instead. This method will be removed in the next major version.
|
|
388
|
-
*
|
|
389
|
-
* Compute N beats locally (VDF hash chain).
|
|
390
|
-
*/
|
|
391
|
-
pulse(count?: number): Beat[];
|
|
392
|
-
/** Internal beat computation — no status check. Used by both pulse() and resync(). */
|
|
383
|
+
/** Internal beat computation — no status check. Used by resync(). */
|
|
393
384
|
private computeBeats;
|
|
394
|
-
/**
|
|
395
|
-
* @deprecated Phase 2: VDF check-in retired (D-68). Use heartbeat() instead.
|
|
396
|
-
* This method will be removed in the next major version.
|
|
397
|
-
*/
|
|
398
|
-
checkin(): Promise<{
|
|
399
|
-
ok: boolean;
|
|
400
|
-
total_beats?: number;
|
|
401
|
-
error?: string;
|
|
402
|
-
}>;
|
|
403
385
|
/**
|
|
404
386
|
* Start the autonomous heartbeat loop.
|
|
405
387
|
* Phase 2: Sends paid heartbeats at regular intervals.
|
|
@@ -413,8 +395,14 @@ declare class BeatAgent {
|
|
|
413
395
|
*/
|
|
414
396
|
stopHeartbeat(): void;
|
|
415
397
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
398
|
+
* Re-Sync Challenge (D-67 reversal): reactivate a frozen agent by proving CPU work.
|
|
399
|
+
*
|
|
400
|
+
* When BEATS_REQUIRED=true on the server: requires a signed Beats work-proof
|
|
401
|
+
* receipt. This method computes the proof automatically using computeWorkProof().
|
|
402
|
+
*
|
|
403
|
+
* When BEATS_REQUIRED=false (devnet): no receipt needed — agent is reactivated freely.
|
|
404
|
+
*
|
|
405
|
+
* Gap formula: min(gap_anchors * 100, 10_000) beats required (matches Beats constants).
|
|
418
406
|
*/
|
|
419
407
|
resync(): Promise<{
|
|
420
408
|
ok: boolean;
|
|
@@ -423,9 +411,45 @@ declare class BeatAgent {
|
|
|
423
411
|
}>;
|
|
424
412
|
/**
|
|
425
413
|
* Request to spawn a child agent.
|
|
426
|
-
* Requires sufficient accumulated beats (Temporal Gestation).
|
|
414
|
+
* Requires sufficient accumulated beats (Temporal Gestation), OR a valid Beats work-proof receipt.
|
|
415
|
+
*
|
|
416
|
+
* @param childName Optional name for the child agent
|
|
417
|
+
* @param childHash Pre-registered child hash (Step 2 finalization)
|
|
418
|
+
* @param beatsReceipt Signed work-proof receipt from computeWorkProof() (receipt-based spawn)
|
|
419
|
+
*/
|
|
420
|
+
requestSpawn(childName?: string, childHash?: string, beatsReceipt?: WorkProofReceipt): Promise<SpawnResult>;
|
|
421
|
+
/**
|
|
422
|
+
* Compute a Beats work-proof for spawn or resync authorization.
|
|
423
|
+
*
|
|
424
|
+
* Computes `beatsNeeded` sequential SHA-256 beats at `difficulty`, weaving in
|
|
425
|
+
* the given anchor hash, then submits to the Beats service and returns a signed receipt.
|
|
426
|
+
*
|
|
427
|
+
* @param opts.beatsNeeded Minimum beats required (from spawn/resync response.required_beats)
|
|
428
|
+
* @param opts.anchorHash Current global anchor hash (from syncGlobal or getAnchor)
|
|
429
|
+
* @param opts.anchorIndex Current global anchor index
|
|
430
|
+
* @param opts.difficulty Beat difficulty (default: agent's current difficulty)
|
|
431
|
+
*/
|
|
432
|
+
computeWorkProof(opts: {
|
|
433
|
+
beatsNeeded: number;
|
|
434
|
+
anchorHash: string;
|
|
435
|
+
anchorIndex: number;
|
|
436
|
+
difficulty?: number;
|
|
437
|
+
}): Promise<WorkProofResult>;
|
|
438
|
+
/**
|
|
439
|
+
* Compute a Beats work-proof and use it to request spawn authorization.
|
|
440
|
+
*
|
|
441
|
+
* Probes the spawn endpoint to determine required beats, computes the proof,
|
|
442
|
+
* and returns the spawn_authorization token. The caller still needs to:
|
|
443
|
+
* 1. Register the child via POST /api/v1/register with spawn_authorization
|
|
444
|
+
* 2. Finalize via POST /api/v1/agent/spawn with child_hash
|
|
445
|
+
*
|
|
446
|
+
* @param opts.childName Optional name for the child agent
|
|
447
|
+
* @param opts.beatsNeeded Override the required beats (default: auto-probed)
|
|
427
448
|
*/
|
|
428
|
-
|
|
449
|
+
requestSpawnWithBeatsProof(opts?: {
|
|
450
|
+
childName?: string;
|
|
451
|
+
beatsNeeded?: number;
|
|
452
|
+
}): Promise<SpawnResult>;
|
|
429
453
|
/** Cached lineage proof from the most recent heartbeat or SIGIL purchase */
|
|
430
454
|
private cachedProof;
|
|
431
455
|
/**
|
|
@@ -601,4 +625,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
601
625
|
constructor(message: string, statusCode?: number);
|
|
602
626
|
}
|
|
603
627
|
|
|
604
|
-
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, computeBeat, computeBeatsLite,
|
|
628
|
+
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, type WorkProofReceipt, type WorkProofResult, computeBeat, computeBeatsLite, register, verifyAnchorHash };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,12 +15,11 @@
|
|
|
15
15
|
* registryUrl: 'https://provenonce.io',
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
|
-
* await agent.init(); //
|
|
19
|
-
* await agent.
|
|
20
|
-
* await agent.checkin(); // Report to registry
|
|
18
|
+
* await agent.init(); // Initialize agent state
|
|
19
|
+
* await agent.heartbeat(); // Send paid heartbeat (Phase 2)
|
|
21
20
|
*
|
|
22
|
-
* // Or run the autonomous heartbeat:
|
|
23
|
-
* agent.startHeartbeat(); //
|
|
21
|
+
* // Or run the autonomous heartbeat loop:
|
|
22
|
+
* agent.startHeartbeat(); // Heartbeats at regular intervals
|
|
24
23
|
* // ... do your agent work ...
|
|
25
24
|
* agent.stopHeartbeat();
|
|
26
25
|
*
|
|
@@ -189,8 +188,34 @@ interface SpawnResult {
|
|
|
189
188
|
ok: boolean;
|
|
190
189
|
eligible: boolean;
|
|
191
190
|
child_hash?: string;
|
|
191
|
+
spawn_authorization?: string;
|
|
192
|
+
receipt_based?: boolean;
|
|
193
|
+
required_beats?: number;
|
|
194
|
+
accumulated_beats?: number;
|
|
192
195
|
progress_pct?: number;
|
|
193
196
|
deficit?: number;
|
|
197
|
+
error?: string;
|
|
198
|
+
}
|
|
199
|
+
/** A signed work-proof receipt from the Beats service. */
|
|
200
|
+
interface WorkProofReceipt {
|
|
201
|
+
type: string;
|
|
202
|
+
beats_verified: number;
|
|
203
|
+
difficulty: number;
|
|
204
|
+
anchor_index: number;
|
|
205
|
+
anchor_hash: string | null;
|
|
206
|
+
from_hash: string;
|
|
207
|
+
to_hash: string;
|
|
208
|
+
utc: string;
|
|
209
|
+
signature: string;
|
|
210
|
+
[key: string]: unknown;
|
|
211
|
+
}
|
|
212
|
+
/** Result of computeWorkProof() */
|
|
213
|
+
interface WorkProofResult {
|
|
214
|
+
ok: boolean;
|
|
215
|
+
receipt?: WorkProofReceipt;
|
|
216
|
+
beats_computed?: number;
|
|
217
|
+
elapsed_ms?: number;
|
|
218
|
+
error?: string;
|
|
194
219
|
}
|
|
195
220
|
/** Agent status from the registry */
|
|
196
221
|
interface AgentStatus {
|
|
@@ -205,21 +230,8 @@ interface AgentStatus {
|
|
|
205
230
|
};
|
|
206
231
|
difficulty?: number;
|
|
207
232
|
}
|
|
208
|
-
/**
|
|
209
|
-
* Generate an Ed25519 keypair for agent wallet identity.
|
|
210
|
-
* Returns hex-encoded raw keys (32 bytes each).
|
|
211
|
-
* Uses Node.js built-in crypto — zero external dependencies.
|
|
212
|
-
*/
|
|
213
|
-
declare function generateWalletKeypair(): {
|
|
214
|
-
publicKey: string;
|
|
215
|
-
secretKey: string;
|
|
216
|
-
};
|
|
217
233
|
/** Wallet info returned from root registration */
|
|
218
234
|
interface WalletInfo {
|
|
219
|
-
/** Hex-encoded 32-byte Ed25519 public key (Solana self-custody only, empty otherwise) */
|
|
220
|
-
public_key: string;
|
|
221
|
-
/** Hex-encoded 32-byte Ed25519 secret seed — SAVE THIS for future fee signing (Solana self-custody only) */
|
|
222
|
-
secret_key: string;
|
|
223
235
|
/** Solana-compatible base58 address (Solana wallets only) */
|
|
224
236
|
solana_address?: string;
|
|
225
237
|
/** The wallet address (base58 for Solana, 0x for Ethereum) */
|
|
@@ -266,10 +278,8 @@ interface RegisterOptions {
|
|
|
266
278
|
registrationToken?: string;
|
|
267
279
|
/** Admin-minted invite token */
|
|
268
280
|
registrationInvite?: string;
|
|
269
|
-
/**
|
|
270
|
-
|
|
271
|
-
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
272
|
-
walletModel?: 'self-custody' | 'operator';
|
|
281
|
+
/** Wallet model: 'operator' (Model B). Must be set explicitly to opt in. */
|
|
282
|
+
walletModel?: 'operator';
|
|
273
283
|
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
274
284
|
walletChain?: 'solana' | 'ethereum';
|
|
275
285
|
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
@@ -295,20 +305,6 @@ interface RegisterOptions {
|
|
|
295
305
|
* No wallet (default, single-phase):
|
|
296
306
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
297
307
|
*
|
|
298
|
-
* Solana self-custody wallet (Model A, two-phase):
|
|
299
|
-
* const creds = await register('my-org', {
|
|
300
|
-
* registryUrl: '...',
|
|
301
|
-
* walletModel: 'self-custody',
|
|
302
|
-
* });
|
|
303
|
-
* // creds.wallet.secret_key = hex secret (SAVE THIS)
|
|
304
|
-
* // creds.wallet.address = base58 Solana address
|
|
305
|
-
*
|
|
306
|
-
* Solana with existing key:
|
|
307
|
-
* const creds = await register('my-org', {
|
|
308
|
-
* registryUrl: '...',
|
|
309
|
-
* walletSecretKey: '<hex-encoded-32-byte-seed>',
|
|
310
|
-
* });
|
|
311
|
-
*
|
|
312
308
|
* Ethereum bring-your-own (two-phase):
|
|
313
309
|
* const creds = await register('my-org', {
|
|
314
310
|
* registryUrl: '...',
|
|
@@ -358,6 +354,8 @@ interface BeatAgentConfig {
|
|
|
358
354
|
verbose?: boolean;
|
|
359
355
|
/** Verify anchor hash locally before trusting it (default: true). */
|
|
360
356
|
verifyAnchors?: boolean;
|
|
357
|
+
/** Beats service URL for work-proof submission (default: https://beats.provenonce.dev). */
|
|
358
|
+
beatsUrl?: string;
|
|
361
359
|
}
|
|
362
360
|
declare class BeatAgent {
|
|
363
361
|
private config;
|
|
@@ -382,24 +380,8 @@ declare class BeatAgent {
|
|
|
382
380
|
genesis?: string;
|
|
383
381
|
error?: string;
|
|
384
382
|
}>;
|
|
385
|
-
/**
|
|
386
|
-
* @deprecated Phase 2: VDF computation retired (D-68). Payment is the liveness mechanism.
|
|
387
|
-
* Use heartbeat() instead. This method will be removed in the next major version.
|
|
388
|
-
*
|
|
389
|
-
* Compute N beats locally (VDF hash chain).
|
|
390
|
-
*/
|
|
391
|
-
pulse(count?: number): Beat[];
|
|
392
|
-
/** Internal beat computation — no status check. Used by both pulse() and resync(). */
|
|
383
|
+
/** Internal beat computation — no status check. Used by resync(). */
|
|
393
384
|
private computeBeats;
|
|
394
|
-
/**
|
|
395
|
-
* @deprecated Phase 2: VDF check-in retired (D-68). Use heartbeat() instead.
|
|
396
|
-
* This method will be removed in the next major version.
|
|
397
|
-
*/
|
|
398
|
-
checkin(): Promise<{
|
|
399
|
-
ok: boolean;
|
|
400
|
-
total_beats?: number;
|
|
401
|
-
error?: string;
|
|
402
|
-
}>;
|
|
403
385
|
/**
|
|
404
386
|
* Start the autonomous heartbeat loop.
|
|
405
387
|
* Phase 2: Sends paid heartbeats at regular intervals.
|
|
@@ -413,8 +395,14 @@ declare class BeatAgent {
|
|
|
413
395
|
*/
|
|
414
396
|
stopHeartbeat(): void;
|
|
415
397
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
398
|
+
* Re-Sync Challenge (D-67 reversal): reactivate a frozen agent by proving CPU work.
|
|
399
|
+
*
|
|
400
|
+
* When BEATS_REQUIRED=true on the server: requires a signed Beats work-proof
|
|
401
|
+
* receipt. This method computes the proof automatically using computeWorkProof().
|
|
402
|
+
*
|
|
403
|
+
* When BEATS_REQUIRED=false (devnet): no receipt needed — agent is reactivated freely.
|
|
404
|
+
*
|
|
405
|
+
* Gap formula: min(gap_anchors * 100, 10_000) beats required (matches Beats constants).
|
|
418
406
|
*/
|
|
419
407
|
resync(): Promise<{
|
|
420
408
|
ok: boolean;
|
|
@@ -423,9 +411,45 @@ declare class BeatAgent {
|
|
|
423
411
|
}>;
|
|
424
412
|
/**
|
|
425
413
|
* Request to spawn a child agent.
|
|
426
|
-
* Requires sufficient accumulated beats (Temporal Gestation).
|
|
414
|
+
* Requires sufficient accumulated beats (Temporal Gestation), OR a valid Beats work-proof receipt.
|
|
415
|
+
*
|
|
416
|
+
* @param childName Optional name for the child agent
|
|
417
|
+
* @param childHash Pre-registered child hash (Step 2 finalization)
|
|
418
|
+
* @param beatsReceipt Signed work-proof receipt from computeWorkProof() (receipt-based spawn)
|
|
419
|
+
*/
|
|
420
|
+
requestSpawn(childName?: string, childHash?: string, beatsReceipt?: WorkProofReceipt): Promise<SpawnResult>;
|
|
421
|
+
/**
|
|
422
|
+
* Compute a Beats work-proof for spawn or resync authorization.
|
|
423
|
+
*
|
|
424
|
+
* Computes `beatsNeeded` sequential SHA-256 beats at `difficulty`, weaving in
|
|
425
|
+
* the given anchor hash, then submits to the Beats service and returns a signed receipt.
|
|
426
|
+
*
|
|
427
|
+
* @param opts.beatsNeeded Minimum beats required (from spawn/resync response.required_beats)
|
|
428
|
+
* @param opts.anchorHash Current global anchor hash (from syncGlobal or getAnchor)
|
|
429
|
+
* @param opts.anchorIndex Current global anchor index
|
|
430
|
+
* @param opts.difficulty Beat difficulty (default: agent's current difficulty)
|
|
431
|
+
*/
|
|
432
|
+
computeWorkProof(opts: {
|
|
433
|
+
beatsNeeded: number;
|
|
434
|
+
anchorHash: string;
|
|
435
|
+
anchorIndex: number;
|
|
436
|
+
difficulty?: number;
|
|
437
|
+
}): Promise<WorkProofResult>;
|
|
438
|
+
/**
|
|
439
|
+
* Compute a Beats work-proof and use it to request spawn authorization.
|
|
440
|
+
*
|
|
441
|
+
* Probes the spawn endpoint to determine required beats, computes the proof,
|
|
442
|
+
* and returns the spawn_authorization token. The caller still needs to:
|
|
443
|
+
* 1. Register the child via POST /api/v1/register with spawn_authorization
|
|
444
|
+
* 2. Finalize via POST /api/v1/agent/spawn with child_hash
|
|
445
|
+
*
|
|
446
|
+
* @param opts.childName Optional name for the child agent
|
|
447
|
+
* @param opts.beatsNeeded Override the required beats (default: auto-probed)
|
|
427
448
|
*/
|
|
428
|
-
|
|
449
|
+
requestSpawnWithBeatsProof(opts?: {
|
|
450
|
+
childName?: string;
|
|
451
|
+
beatsNeeded?: number;
|
|
452
|
+
}): Promise<SpawnResult>;
|
|
429
453
|
/** Cached lineage proof from the most recent heartbeat or SIGIL purchase */
|
|
430
454
|
private cachedProof;
|
|
431
455
|
/**
|
|
@@ -601,4 +625,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
601
625
|
constructor(message: string, statusCode?: number);
|
|
602
626
|
}
|
|
603
627
|
|
|
604
|
-
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, computeBeat, computeBeatsLite,
|
|
628
|
+
export { type AgentStatus, AuthError, type Beat, BeatAgent, type BeatAgentConfig, type Capability, type CheckinResult, type ComplianceRegime, ErrorCode, FrozenError, type HeartbeatResult, type IdentityClass, type LineageProof, type MetadataUpdateResult, NetworkError, NotFoundError, type Passport, ProvenonceError, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, type SigilResult, type SigilTier, type SpawnResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, type WorkProofReceipt, type WorkProofResult, computeBeat, computeBeatsLite, register, verifyAnchorHash };
|