@provenonce/sdk 0.11.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 +98 -58
- package/dist/index.d.ts +98 -58
- package/dist/index.js +246 -220
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +245 -219
- 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
|
*
|
|
@@ -161,6 +160,20 @@ interface Beat {
|
|
|
161
160
|
anchor_hash?: string;
|
|
162
161
|
}
|
|
163
162
|
declare function computeBeat(prevHash: string, beatIndex: number, difficulty: number, nonce?: string, anchorHash?: string): Beat;
|
|
163
|
+
/**
|
|
164
|
+
* Verify an anchor hash locally.
|
|
165
|
+
* V3 (solana_entropy present): binary-canonical single SHA-256.
|
|
166
|
+
* V1 legacy (no entropy): string-based hash with difficulty iteration.
|
|
167
|
+
*/
|
|
168
|
+
declare function verifyAnchorHash(anchor: {
|
|
169
|
+
prev_hash: string;
|
|
170
|
+
beat_index: number;
|
|
171
|
+
hash: string;
|
|
172
|
+
utc: number;
|
|
173
|
+
epoch: number;
|
|
174
|
+
difficulty: number;
|
|
175
|
+
solana_entropy?: string;
|
|
176
|
+
}): boolean;
|
|
164
177
|
/** Result from a check-in submission */
|
|
165
178
|
interface CheckinResult {
|
|
166
179
|
ok: boolean;
|
|
@@ -175,8 +188,34 @@ interface SpawnResult {
|
|
|
175
188
|
ok: boolean;
|
|
176
189
|
eligible: boolean;
|
|
177
190
|
child_hash?: string;
|
|
191
|
+
spawn_authorization?: string;
|
|
192
|
+
receipt_based?: boolean;
|
|
193
|
+
required_beats?: number;
|
|
194
|
+
accumulated_beats?: number;
|
|
178
195
|
progress_pct?: number;
|
|
179
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;
|
|
180
219
|
}
|
|
181
220
|
/** Agent status from the registry */
|
|
182
221
|
interface AgentStatus {
|
|
@@ -191,21 +230,8 @@ interface AgentStatus {
|
|
|
191
230
|
};
|
|
192
231
|
difficulty?: number;
|
|
193
232
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Generate an Ed25519 keypair for agent wallet identity.
|
|
196
|
-
* Returns hex-encoded raw keys (32 bytes each).
|
|
197
|
-
* Uses Node.js built-in crypto — zero external dependencies.
|
|
198
|
-
*/
|
|
199
|
-
declare function generateWalletKeypair(): {
|
|
200
|
-
publicKey: string;
|
|
201
|
-
secretKey: string;
|
|
202
|
-
};
|
|
203
233
|
/** Wallet info returned from root registration */
|
|
204
234
|
interface WalletInfo {
|
|
205
|
-
/** Hex-encoded 32-byte Ed25519 public key (Solana self-custody only, empty otherwise) */
|
|
206
|
-
public_key: string;
|
|
207
|
-
/** Hex-encoded 32-byte Ed25519 secret seed — SAVE THIS for future fee signing (Solana self-custody only) */
|
|
208
|
-
secret_key: string;
|
|
209
235
|
/** Solana-compatible base58 address (Solana wallets only) */
|
|
210
236
|
solana_address?: string;
|
|
211
237
|
/** The wallet address (base58 for Solana, 0x for Ethereum) */
|
|
@@ -252,10 +278,8 @@ interface RegisterOptions {
|
|
|
252
278
|
registrationToken?: string;
|
|
253
279
|
/** Admin-minted invite token */
|
|
254
280
|
registrationInvite?: string;
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
258
|
-
walletModel?: 'self-custody' | 'operator';
|
|
281
|
+
/** Wallet model: 'operator' (Model B). Must be set explicitly to opt in. */
|
|
282
|
+
walletModel?: 'operator';
|
|
259
283
|
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
260
284
|
walletChain?: 'solana' | 'ethereum';
|
|
261
285
|
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
@@ -281,20 +305,6 @@ interface RegisterOptions {
|
|
|
281
305
|
* No wallet (default, single-phase):
|
|
282
306
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
283
307
|
*
|
|
284
|
-
* Solana self-custody wallet (Model A, two-phase):
|
|
285
|
-
* const creds = await register('my-org', {
|
|
286
|
-
* registryUrl: '...',
|
|
287
|
-
* walletModel: 'self-custody',
|
|
288
|
-
* });
|
|
289
|
-
* // creds.wallet.secret_key = hex secret (SAVE THIS)
|
|
290
|
-
* // creds.wallet.address = base58 Solana address
|
|
291
|
-
*
|
|
292
|
-
* Solana with existing key:
|
|
293
|
-
* const creds = await register('my-org', {
|
|
294
|
-
* registryUrl: '...',
|
|
295
|
-
* walletSecretKey: '<hex-encoded-32-byte-seed>',
|
|
296
|
-
* });
|
|
297
|
-
*
|
|
298
308
|
* Ethereum bring-your-own (two-phase):
|
|
299
309
|
* const creds = await register('my-org', {
|
|
300
310
|
* registryUrl: '...',
|
|
@@ -342,6 +352,10 @@ interface BeatAgentConfig {
|
|
|
342
352
|
onStatusChange?: (status: string, details: Record<string, unknown>) => void;
|
|
343
353
|
/** Enable verbose logging */
|
|
344
354
|
verbose?: boolean;
|
|
355
|
+
/** Verify anchor hash locally before trusting it (default: true). */
|
|
356
|
+
verifyAnchors?: boolean;
|
|
357
|
+
/** Beats service URL for work-proof submission (default: https://beats.provenonce.dev). */
|
|
358
|
+
beatsUrl?: string;
|
|
345
359
|
}
|
|
346
360
|
declare class BeatAgent {
|
|
347
361
|
private config;
|
|
@@ -366,24 +380,8 @@ declare class BeatAgent {
|
|
|
366
380
|
genesis?: string;
|
|
367
381
|
error?: string;
|
|
368
382
|
}>;
|
|
369
|
-
/**
|
|
370
|
-
* @deprecated Phase 2: VDF computation retired (D-68). Payment is the liveness mechanism.
|
|
371
|
-
* Use heartbeat() instead. This method will be removed in the next major version.
|
|
372
|
-
*
|
|
373
|
-
* Compute N beats locally (VDF hash chain).
|
|
374
|
-
*/
|
|
375
|
-
pulse(count?: number): Beat[];
|
|
376
|
-
/** Internal beat computation — no status check. Used by both pulse() and resync(). */
|
|
383
|
+
/** Internal beat computation — no status check. Used by resync(). */
|
|
377
384
|
private computeBeats;
|
|
378
|
-
/**
|
|
379
|
-
* @deprecated Phase 2: VDF check-in retired (D-68). Use heartbeat() instead.
|
|
380
|
-
* This method will be removed in the next major version.
|
|
381
|
-
*/
|
|
382
|
-
checkin(): Promise<{
|
|
383
|
-
ok: boolean;
|
|
384
|
-
total_beats?: number;
|
|
385
|
-
error?: string;
|
|
386
|
-
}>;
|
|
387
385
|
/**
|
|
388
386
|
* Start the autonomous heartbeat loop.
|
|
389
387
|
* Phase 2: Sends paid heartbeats at regular intervals.
|
|
@@ -397,8 +395,14 @@ declare class BeatAgent {
|
|
|
397
395
|
*/
|
|
398
396
|
stopHeartbeat(): void;
|
|
399
397
|
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
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).
|
|
402
406
|
*/
|
|
403
407
|
resync(): Promise<{
|
|
404
408
|
ok: boolean;
|
|
@@ -407,9 +411,45 @@ declare class BeatAgent {
|
|
|
407
411
|
}>;
|
|
408
412
|
/**
|
|
409
413
|
* Request to spawn a child agent.
|
|
410
|
-
* 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)
|
|
411
448
|
*/
|
|
412
|
-
|
|
449
|
+
requestSpawnWithBeatsProof(opts?: {
|
|
450
|
+
childName?: string;
|
|
451
|
+
beatsNeeded?: number;
|
|
452
|
+
}): Promise<SpawnResult>;
|
|
413
453
|
/** Cached lineage proof from the most recent heartbeat or SIGIL purchase */
|
|
414
454
|
private cachedProof;
|
|
415
455
|
/**
|
|
@@ -585,4 +625,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
585
625
|
constructor(message: string, statusCode?: number);
|
|
586
626
|
}
|
|
587
627
|
|
|
588
|
-
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
|
*
|
|
@@ -161,6 +160,20 @@ interface Beat {
|
|
|
161
160
|
anchor_hash?: string;
|
|
162
161
|
}
|
|
163
162
|
declare function computeBeat(prevHash: string, beatIndex: number, difficulty: number, nonce?: string, anchorHash?: string): Beat;
|
|
163
|
+
/**
|
|
164
|
+
* Verify an anchor hash locally.
|
|
165
|
+
* V3 (solana_entropy present): binary-canonical single SHA-256.
|
|
166
|
+
* V1 legacy (no entropy): string-based hash with difficulty iteration.
|
|
167
|
+
*/
|
|
168
|
+
declare function verifyAnchorHash(anchor: {
|
|
169
|
+
prev_hash: string;
|
|
170
|
+
beat_index: number;
|
|
171
|
+
hash: string;
|
|
172
|
+
utc: number;
|
|
173
|
+
epoch: number;
|
|
174
|
+
difficulty: number;
|
|
175
|
+
solana_entropy?: string;
|
|
176
|
+
}): boolean;
|
|
164
177
|
/** Result from a check-in submission */
|
|
165
178
|
interface CheckinResult {
|
|
166
179
|
ok: boolean;
|
|
@@ -175,8 +188,34 @@ interface SpawnResult {
|
|
|
175
188
|
ok: boolean;
|
|
176
189
|
eligible: boolean;
|
|
177
190
|
child_hash?: string;
|
|
191
|
+
spawn_authorization?: string;
|
|
192
|
+
receipt_based?: boolean;
|
|
193
|
+
required_beats?: number;
|
|
194
|
+
accumulated_beats?: number;
|
|
178
195
|
progress_pct?: number;
|
|
179
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;
|
|
180
219
|
}
|
|
181
220
|
/** Agent status from the registry */
|
|
182
221
|
interface AgentStatus {
|
|
@@ -191,21 +230,8 @@ interface AgentStatus {
|
|
|
191
230
|
};
|
|
192
231
|
difficulty?: number;
|
|
193
232
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Generate an Ed25519 keypair for agent wallet identity.
|
|
196
|
-
* Returns hex-encoded raw keys (32 bytes each).
|
|
197
|
-
* Uses Node.js built-in crypto — zero external dependencies.
|
|
198
|
-
*/
|
|
199
|
-
declare function generateWalletKeypair(): {
|
|
200
|
-
publicKey: string;
|
|
201
|
-
secretKey: string;
|
|
202
|
-
};
|
|
203
233
|
/** Wallet info returned from root registration */
|
|
204
234
|
interface WalletInfo {
|
|
205
|
-
/** Hex-encoded 32-byte Ed25519 public key (Solana self-custody only, empty otherwise) */
|
|
206
|
-
public_key: string;
|
|
207
|
-
/** Hex-encoded 32-byte Ed25519 secret seed — SAVE THIS for future fee signing (Solana self-custody only) */
|
|
208
|
-
secret_key: string;
|
|
209
235
|
/** Solana-compatible base58 address (Solana wallets only) */
|
|
210
236
|
solana_address?: string;
|
|
211
237
|
/** The wallet address (base58 for Solana, 0x for Ethereum) */
|
|
@@ -252,10 +278,8 @@ interface RegisterOptions {
|
|
|
252
278
|
registrationToken?: string;
|
|
253
279
|
/** Admin-minted invite token */
|
|
254
280
|
registrationInvite?: string;
|
|
255
|
-
/**
|
|
256
|
-
|
|
257
|
-
/** Wallet model: 'self-custody' (Model A) or 'operator' (Model B). Must be set explicitly to opt in. */
|
|
258
|
-
walletModel?: 'self-custody' | 'operator';
|
|
281
|
+
/** Wallet model: 'operator' (Model B). Must be set explicitly to opt in. */
|
|
282
|
+
walletModel?: 'operator';
|
|
259
283
|
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
260
284
|
walletChain?: 'solana' | 'ethereum';
|
|
261
285
|
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
@@ -281,20 +305,6 @@ interface RegisterOptions {
|
|
|
281
305
|
* No wallet (default, single-phase):
|
|
282
306
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
283
307
|
*
|
|
284
|
-
* Solana self-custody wallet (Model A, two-phase):
|
|
285
|
-
* const creds = await register('my-org', {
|
|
286
|
-
* registryUrl: '...',
|
|
287
|
-
* walletModel: 'self-custody',
|
|
288
|
-
* });
|
|
289
|
-
* // creds.wallet.secret_key = hex secret (SAVE THIS)
|
|
290
|
-
* // creds.wallet.address = base58 Solana address
|
|
291
|
-
*
|
|
292
|
-
* Solana with existing key:
|
|
293
|
-
* const creds = await register('my-org', {
|
|
294
|
-
* registryUrl: '...',
|
|
295
|
-
* walletSecretKey: '<hex-encoded-32-byte-seed>',
|
|
296
|
-
* });
|
|
297
|
-
*
|
|
298
308
|
* Ethereum bring-your-own (two-phase):
|
|
299
309
|
* const creds = await register('my-org', {
|
|
300
310
|
* registryUrl: '...',
|
|
@@ -342,6 +352,10 @@ interface BeatAgentConfig {
|
|
|
342
352
|
onStatusChange?: (status: string, details: Record<string, unknown>) => void;
|
|
343
353
|
/** Enable verbose logging */
|
|
344
354
|
verbose?: boolean;
|
|
355
|
+
/** Verify anchor hash locally before trusting it (default: true). */
|
|
356
|
+
verifyAnchors?: boolean;
|
|
357
|
+
/** Beats service URL for work-proof submission (default: https://beats.provenonce.dev). */
|
|
358
|
+
beatsUrl?: string;
|
|
345
359
|
}
|
|
346
360
|
declare class BeatAgent {
|
|
347
361
|
private config;
|
|
@@ -366,24 +380,8 @@ declare class BeatAgent {
|
|
|
366
380
|
genesis?: string;
|
|
367
381
|
error?: string;
|
|
368
382
|
}>;
|
|
369
|
-
/**
|
|
370
|
-
* @deprecated Phase 2: VDF computation retired (D-68). Payment is the liveness mechanism.
|
|
371
|
-
* Use heartbeat() instead. This method will be removed in the next major version.
|
|
372
|
-
*
|
|
373
|
-
* Compute N beats locally (VDF hash chain).
|
|
374
|
-
*/
|
|
375
|
-
pulse(count?: number): Beat[];
|
|
376
|
-
/** Internal beat computation — no status check. Used by both pulse() and resync(). */
|
|
383
|
+
/** Internal beat computation — no status check. Used by resync(). */
|
|
377
384
|
private computeBeats;
|
|
378
|
-
/**
|
|
379
|
-
* @deprecated Phase 2: VDF check-in retired (D-68). Use heartbeat() instead.
|
|
380
|
-
* This method will be removed in the next major version.
|
|
381
|
-
*/
|
|
382
|
-
checkin(): Promise<{
|
|
383
|
-
ok: boolean;
|
|
384
|
-
total_beats?: number;
|
|
385
|
-
error?: string;
|
|
386
|
-
}>;
|
|
387
385
|
/**
|
|
388
386
|
* Start the autonomous heartbeat loop.
|
|
389
387
|
* Phase 2: Sends paid heartbeats at regular intervals.
|
|
@@ -397,8 +395,14 @@ declare class BeatAgent {
|
|
|
397
395
|
*/
|
|
398
396
|
stopHeartbeat(): void;
|
|
399
397
|
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
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).
|
|
402
406
|
*/
|
|
403
407
|
resync(): Promise<{
|
|
404
408
|
ok: boolean;
|
|
@@ -407,9 +411,45 @@ declare class BeatAgent {
|
|
|
407
411
|
}>;
|
|
408
412
|
/**
|
|
409
413
|
* Request to spawn a child agent.
|
|
410
|
-
* 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)
|
|
411
448
|
*/
|
|
412
|
-
|
|
449
|
+
requestSpawnWithBeatsProof(opts?: {
|
|
450
|
+
childName?: string;
|
|
451
|
+
beatsNeeded?: number;
|
|
452
|
+
}): Promise<SpawnResult>;
|
|
413
453
|
/** Cached lineage proof from the most recent heartbeat or SIGIL purchase */
|
|
414
454
|
private cachedProof;
|
|
415
455
|
/**
|
|
@@ -585,4 +625,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
585
625
|
constructor(message: string, statusCode?: number);
|
|
586
626
|
}
|
|
587
627
|
|
|
588
|
-
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 };
|