@provenonce/sdk 0.12.0 → 0.17.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/README.md +16 -15
- package/dist/index.d.mts +258 -86
- package/dist/index.d.ts +258 -86
- package/dist/index.js +475 -258
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +475 -258
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,13 +25,13 @@ console.log(creds.hash); // unique agent identity
|
|
|
25
25
|
console.log(creds.api_key); // use this for BeatAgent
|
|
26
26
|
console.log(creds.secret); // save — shown only once
|
|
27
27
|
|
|
28
|
-
// Solana
|
|
28
|
+
// Operator wallet registration (Solana — bring your own wallet)
|
|
29
29
|
const withWallet = await register('my-org', {
|
|
30
30
|
registryUrl: 'https://provenonce.io',
|
|
31
|
-
walletModel: '
|
|
31
|
+
walletModel: 'operator',
|
|
32
|
+
walletAddress: '<your-solana-address>',
|
|
33
|
+
walletSignFn: (msg) => signWithYourWallet(msg),
|
|
32
34
|
});
|
|
33
|
-
// withWallet.wallet.address = Solana address
|
|
34
|
-
// withWallet.wallet.secret_key = SAVE — cannot be recovered
|
|
35
35
|
|
|
36
36
|
// Child registration (requires parent credentials)
|
|
37
37
|
const child = await register('worker-1', {
|
|
@@ -63,7 +63,7 @@ const sigil = await agent.purchaseSigil({
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
// Start heartbeating (paid liveness proofs)
|
|
66
|
-
agent.startHeartbeat();
|
|
66
|
+
agent.startHeartbeat(async () => 'your-solana-tx-signature');
|
|
67
67
|
|
|
68
68
|
// Get your Passport (latest lineage proof)
|
|
69
69
|
const passport = await agent.getPassport();
|
|
@@ -71,7 +71,7 @@ console.log(passport?.identity_class); // 'autonomous'
|
|
|
71
71
|
console.log(passport?.provenonce_signature); // Ed25519 signed
|
|
72
72
|
|
|
73
73
|
// Verify any proof offline — no API call needed
|
|
74
|
-
const valid = BeatAgent.
|
|
74
|
+
const valid = BeatAgent.verifyPassportLocally(passport, authorityPubKeyHex);
|
|
75
75
|
|
|
76
76
|
agent.stopHeartbeat();
|
|
77
77
|
```
|
|
@@ -85,15 +85,16 @@ agent.stopHeartbeat();
|
|
|
85
85
|
| `init()` | Initialize the agent's Beat chain (birth in Logical Time) |
|
|
86
86
|
| `purchaseSigil(opts)` | Purchase a SIGIL identity (required for heartbeating) |
|
|
87
87
|
| `updateMetadata(fields)` | Update mutable SIGIL metadata fields |
|
|
88
|
-
| `heartbeat(paymentTx
|
|
89
|
-
| `startHeartbeat()` | Start autonomous heartbeat loop |
|
|
88
|
+
| `heartbeat(paymentTx, globalAnchor?)` | Submit a paid heartbeat and receive a signed passport |
|
|
89
|
+
| `startHeartbeat(paymentTxFn)` | Start autonomous heartbeat loop |
|
|
90
90
|
| `stopHeartbeat()` | Stop heartbeat |
|
|
91
|
-
| `getPassport()` | Get latest
|
|
92
|
-
| `
|
|
91
|
+
| `getPassport()` | Get latest passport (cached, no network call) |
|
|
92
|
+
| `getLatestPassport()` | Get latest passport (alias for getPassport) |
|
|
93
|
+
| `reissuePassport(paymentTx?)` | Reissue passport without extending lineage |
|
|
93
94
|
| `requestSpawn(name?)` | Spawn a child agent (requires accumulated beats) |
|
|
94
95
|
| `getStatus()` | Get full beat status from registry |
|
|
95
96
|
| `getLocalState()` | Get local state (no network call) |
|
|
96
|
-
| `static
|
|
97
|
+
| `static verifyPassportLocally(proof, pubKey)` | Verify a passport offline |
|
|
97
98
|
|
|
98
99
|
### `BeatAgentConfig`
|
|
99
100
|
|
|
@@ -113,7 +114,7 @@ agent.stopHeartbeat();
|
|
|
113
114
|
|--------|-------------|
|
|
114
115
|
| `registryUrl` | Registry URL (required) |
|
|
115
116
|
| `registrationSecret` | Registration gate (mainnet) |
|
|
116
|
-
| `walletModel` | `'
|
|
117
|
+
| `walletModel` | `'operator'` (opt-in BYO wallet) |
|
|
117
118
|
| `walletChain` | `'solana'` or `'ethereum'` |
|
|
118
119
|
| `walletAddress` | Ethereum BYO address |
|
|
119
120
|
| `walletSignFn` | Signing function for BYO wallets |
|
|
@@ -127,9 +128,9 @@ Returns `RegistrationResult` with `hash`, `api_key`, `secret`, `wallet?`.
|
|
|
127
128
|
### Phase 2 Types
|
|
128
129
|
|
|
129
130
|
```typescript
|
|
130
|
-
import type { Passport,
|
|
131
|
+
import type { Passport, IdentityClass, SigilResult, HeartbeatResult } from '@provenonce/sdk';
|
|
131
132
|
|
|
132
|
-
// Passport
|
|
133
|
+
// Passport is the primary type. LineageProof is a deprecated alias (sunset 2026-09-01).
|
|
133
134
|
// Contains: agent_hash, agent_public_key, identity_class, lineage_chain_hash,
|
|
134
135
|
// provenonce_signature, issued_at, valid_until, etc.
|
|
135
136
|
|
|
@@ -143,7 +144,7 @@ await agent.purchaseSigil({
|
|
|
143
144
|
identity_class: 'narrow_task' | 'autonomous' | 'orchestrator',
|
|
144
145
|
principal: 'my-agent',
|
|
145
146
|
tier: 'sov' | 'org' | 'ind' | 'eph' | 'sbx',
|
|
146
|
-
payment_tx: 'solana-tx-signature...',
|
|
147
|
+
payment_tx: 'solana-tx-signature...',
|
|
147
148
|
name: 'optional-display-name'
|
|
148
149
|
});
|
|
149
150
|
```
|
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
|
*
|
|
@@ -41,14 +40,16 @@ type SigilProtocol = 'http' | 'grpc' | 'websocket' | 'mcp' | 'a2a' | 'custom';
|
|
|
41
40
|
/** Compliance regime */
|
|
42
41
|
type ComplianceRegime = 'gdpr' | 'pdpa' | 'hipaa' | 'sox' | 'aisi' | 'none' | 'custom';
|
|
43
42
|
/**
|
|
44
|
-
* Ed25519-signed
|
|
45
|
-
*
|
|
46
|
-
*
|
|
43
|
+
* Ed25519-signed passport — the agent's portable, offline-verifiable credential.
|
|
44
|
+
* A cryptographic proof of identity that can be verified offline without any
|
|
45
|
+
* API call or SOL cost.
|
|
47
46
|
*/
|
|
48
|
-
interface
|
|
47
|
+
interface Passport {
|
|
48
|
+
format_version?: number;
|
|
49
49
|
agent_hash: string;
|
|
50
50
|
agent_public_key: string | null;
|
|
51
|
-
|
|
51
|
+
authority_key_id?: string;
|
|
52
|
+
identity_class: IdentityClass | null;
|
|
52
53
|
registered_at_beat: number;
|
|
53
54
|
sigil_issued_at_beat: number | null;
|
|
54
55
|
last_heartbeat_beat: number;
|
|
@@ -57,8 +58,38 @@ interface LineageProof {
|
|
|
57
58
|
valid_until: number;
|
|
58
59
|
provenonce_signature: string;
|
|
59
60
|
}
|
|
60
|
-
/** Passport
|
|
61
|
-
type
|
|
61
|
+
/** @deprecated Use `Passport` instead. Sunset 2026-09-01. */
|
|
62
|
+
type LineageProof = Passport;
|
|
63
|
+
/** W3C Verifiable Credential envelope wrapping a LineageProof */
|
|
64
|
+
interface ProvenoncePassportVC {
|
|
65
|
+
'@context': [string, string];
|
|
66
|
+
type: ['VerifiableCredential', 'ProvenoncePassport'];
|
|
67
|
+
issuer: {
|
|
68
|
+
id: string;
|
|
69
|
+
authority_key_id: string;
|
|
70
|
+
};
|
|
71
|
+
issuanceDate: string;
|
|
72
|
+
expirationDate: string;
|
|
73
|
+
credentialSubject: {
|
|
74
|
+
id: string;
|
|
75
|
+
agent_hash: string;
|
|
76
|
+
agent_public_key: string | null;
|
|
77
|
+
identity_class: IdentityClass | null;
|
|
78
|
+
registered_at_beat: number;
|
|
79
|
+
sigil_issued_at_beat: number | null;
|
|
80
|
+
last_heartbeat_beat: number;
|
|
81
|
+
lineage_chain_hash: string;
|
|
82
|
+
};
|
|
83
|
+
proof: {
|
|
84
|
+
type: 'Ed25519Signature2020';
|
|
85
|
+
created: string;
|
|
86
|
+
verificationMethod: string;
|
|
87
|
+
proofPurpose: 'assertionMethod';
|
|
88
|
+
cryptosuite: 'eddsa-provenonce-2026';
|
|
89
|
+
proofValue: string;
|
|
90
|
+
};
|
|
91
|
+
format_version: number;
|
|
92
|
+
}
|
|
62
93
|
/** Options for purchasing a SIGIL with full namespace */
|
|
63
94
|
interface SigilPurchaseOptions {
|
|
64
95
|
identity_class: IdentityClass;
|
|
@@ -66,6 +97,9 @@ interface SigilPurchaseOptions {
|
|
|
66
97
|
tier: SigilTier;
|
|
67
98
|
name?: string;
|
|
68
99
|
payment_tx: string;
|
|
100
|
+
at?: string;
|
|
101
|
+
skill_hash?: string;
|
|
102
|
+
ref?: string;
|
|
69
103
|
substrate?: Substrate;
|
|
70
104
|
substrate_provider?: SubstrateProvider;
|
|
71
105
|
substrate_model?: string;
|
|
@@ -78,6 +112,14 @@ interface SigilPurchaseOptions {
|
|
|
78
112
|
endpoint?: string;
|
|
79
113
|
compliance_regime?: ComplianceRegime;
|
|
80
114
|
}
|
|
115
|
+
/** Result from getSigilAttribution() */
|
|
116
|
+
interface SigilAttributionResult {
|
|
117
|
+
ok: boolean;
|
|
118
|
+
attribution_token?: string;
|
|
119
|
+
signup_url?: string | null;
|
|
120
|
+
already_has_sigil?: boolean;
|
|
121
|
+
error?: string;
|
|
122
|
+
}
|
|
81
123
|
/** Mutable SIGIL metadata fields for PATCH updates */
|
|
82
124
|
interface SigilMutableFields {
|
|
83
125
|
substrate?: Substrate;
|
|
@@ -106,7 +148,9 @@ interface SigilResult {
|
|
|
106
148
|
birth_tx: string | null;
|
|
107
149
|
explorer_url: string | null;
|
|
108
150
|
};
|
|
109
|
-
|
|
151
|
+
passport?: Passport;
|
|
152
|
+
/** @deprecated Use `passport` instead. Sunset 2026-09-01. */
|
|
153
|
+
lineage_proof?: Passport;
|
|
110
154
|
fee?: {
|
|
111
155
|
amount_sol: number;
|
|
112
156
|
amount_lamports: number;
|
|
@@ -140,7 +184,10 @@ interface VerificationResult {
|
|
|
140
184
|
/** Result from a paid heartbeat */
|
|
141
185
|
interface HeartbeatResult {
|
|
142
186
|
ok: boolean;
|
|
143
|
-
|
|
187
|
+
sigil_required?: boolean;
|
|
188
|
+
passport?: Passport;
|
|
189
|
+
/** @deprecated Use `passport` instead. Sunset 2026-09-01. */
|
|
190
|
+
lineage_proof?: Passport;
|
|
144
191
|
heartbeat_count_epoch?: number;
|
|
145
192
|
billing_epoch?: number;
|
|
146
193
|
current_beat?: number;
|
|
@@ -150,6 +197,24 @@ interface HeartbeatResult {
|
|
|
150
197
|
tier: number;
|
|
151
198
|
payment_tx: string | null;
|
|
152
199
|
};
|
|
200
|
+
sponsor?: {
|
|
201
|
+
parent_hash: string;
|
|
202
|
+
};
|
|
203
|
+
error?: string;
|
|
204
|
+
}
|
|
205
|
+
/** RFC-021: Sponsorship record returned by the /agent/sponsor endpoint. */
|
|
206
|
+
interface SponsorshipRecord {
|
|
207
|
+
parent_hash: string;
|
|
208
|
+
child_hash: string;
|
|
209
|
+
status: 'active' | 'revoked' | 'expired';
|
|
210
|
+
max_heartbeats_epoch: number;
|
|
211
|
+
heartbeats_used_epoch: number;
|
|
212
|
+
expires_at: string | null;
|
|
213
|
+
created_at?: string;
|
|
214
|
+
}
|
|
215
|
+
interface SponsorshipResult {
|
|
216
|
+
ok: boolean;
|
|
217
|
+
sponsorship?: SponsorshipRecord;
|
|
153
218
|
error?: string;
|
|
154
219
|
}
|
|
155
220
|
interface Beat {
|
|
@@ -189,8 +254,34 @@ interface SpawnResult {
|
|
|
189
254
|
ok: boolean;
|
|
190
255
|
eligible: boolean;
|
|
191
256
|
child_hash?: string;
|
|
257
|
+
spawn_authorization?: string;
|
|
258
|
+
receipt_based?: boolean;
|
|
259
|
+
required_beats?: number;
|
|
260
|
+
accumulated_beats?: number;
|
|
192
261
|
progress_pct?: number;
|
|
193
262
|
deficit?: number;
|
|
263
|
+
error?: string;
|
|
264
|
+
}
|
|
265
|
+
/** A signed work-proof receipt from the Beats service. */
|
|
266
|
+
interface WorkProofReceipt {
|
|
267
|
+
type: string;
|
|
268
|
+
beats_verified: number;
|
|
269
|
+
difficulty: number;
|
|
270
|
+
anchor_index: number;
|
|
271
|
+
anchor_hash: string | null;
|
|
272
|
+
from_hash: string;
|
|
273
|
+
to_hash: string;
|
|
274
|
+
utc: string;
|
|
275
|
+
signature: string;
|
|
276
|
+
[key: string]: unknown;
|
|
277
|
+
}
|
|
278
|
+
/** Result of computeWorkProof() */
|
|
279
|
+
interface WorkProofResult {
|
|
280
|
+
ok: boolean;
|
|
281
|
+
receipt?: WorkProofReceipt;
|
|
282
|
+
beats_computed?: number;
|
|
283
|
+
elapsed_ms?: number;
|
|
284
|
+
error?: string;
|
|
194
285
|
}
|
|
195
286
|
/** Agent status from the registry */
|
|
196
287
|
interface AgentStatus {
|
|
@@ -205,21 +296,8 @@ interface AgentStatus {
|
|
|
205
296
|
};
|
|
206
297
|
difficulty?: number;
|
|
207
298
|
}
|
|
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
299
|
/** Wallet info returned from root registration */
|
|
218
300
|
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
301
|
/** Solana-compatible base58 address (Solana wallets only) */
|
|
224
302
|
solana_address?: string;
|
|
225
303
|
/** The wallet address (base58 for Solana, 0x for Ethereum) */
|
|
@@ -266,10 +344,8 @@ interface RegisterOptions {
|
|
|
266
344
|
registrationToken?: string;
|
|
267
345
|
/** Admin-minted invite token */
|
|
268
346
|
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';
|
|
347
|
+
/** Wallet model: 'operator' (Model B). Must be set explicitly to opt in. */
|
|
348
|
+
walletModel?: 'operator';
|
|
273
349
|
/** Wallet chain: 'solana' (default when wallet is used) or 'ethereum' (D-63) */
|
|
274
350
|
walletChain?: 'solana' | 'ethereum';
|
|
275
351
|
/** Wallet address for Ethereum bring-your-own (0x + 40 hex chars) */
|
|
@@ -295,20 +371,6 @@ interface RegisterOptions {
|
|
|
295
371
|
* No wallet (default, single-phase):
|
|
296
372
|
* const creds = await register('my-agent', { registryUrl: '...' });
|
|
297
373
|
*
|
|
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
374
|
* Ethereum bring-your-own (two-phase):
|
|
313
375
|
* const creds = await register('my-org', {
|
|
314
376
|
* registryUrl: '...',
|
|
@@ -358,6 +420,8 @@ interface BeatAgentConfig {
|
|
|
358
420
|
verbose?: boolean;
|
|
359
421
|
/** Verify anchor hash locally before trusting it (default: true). */
|
|
360
422
|
verifyAnchors?: boolean;
|
|
423
|
+
/** Beats service URL for work-proof submission (default: https://beats.provenonce.dev). */
|
|
424
|
+
beatsUrl?: string;
|
|
361
425
|
}
|
|
362
426
|
declare class BeatAgent {
|
|
363
427
|
private config;
|
|
@@ -371,6 +435,7 @@ declare class BeatAgent {
|
|
|
371
435
|
private heartbeatInterval;
|
|
372
436
|
private globalBeat;
|
|
373
437
|
private globalAnchorHash;
|
|
438
|
+
private cachedIdentityClass;
|
|
374
439
|
constructor(config: BeatAgentConfig);
|
|
375
440
|
/**
|
|
376
441
|
* Initialize the agent's Beat chain.
|
|
@@ -382,39 +447,28 @@ declare class BeatAgent {
|
|
|
382
447
|
genesis?: string;
|
|
383
448
|
error?: string;
|
|
384
449
|
}>;
|
|
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(). */
|
|
450
|
+
/** Internal beat computation — no status check. Used by resync(). */
|
|
393
451
|
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
452
|
/**
|
|
404
453
|
* Start the autonomous heartbeat loop.
|
|
405
454
|
* Phase 2: Sends paid heartbeats at regular intervals.
|
|
406
455
|
*
|
|
407
|
-
* @param paymentTxFn -
|
|
408
|
-
* If not provided, uses 'devnet-skip' (devnet only).
|
|
456
|
+
* @param paymentTxFn - Function that returns a Solana payment tx signature for each heartbeat (required).
|
|
409
457
|
*/
|
|
410
|
-
startHeartbeat(paymentTxFn
|
|
458
|
+
startHeartbeat(paymentTxFn: () => Promise<string> | string): void;
|
|
411
459
|
/**
|
|
412
460
|
* Stop the heartbeat loop.
|
|
413
461
|
*/
|
|
414
462
|
stopHeartbeat(): void;
|
|
415
463
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
464
|
+
* Re-Sync Challenge (D-67 reversal): reactivate a frozen agent by proving CPU work.
|
|
465
|
+
*
|
|
466
|
+
* When BEATS_REQUIRED=true on the server: requires a signed Beats work-proof
|
|
467
|
+
* receipt. This method computes the proof automatically using computeWorkProof().
|
|
468
|
+
*
|
|
469
|
+
* When BEATS_REQUIRED=false (devnet): no receipt needed — agent is reactivated freely.
|
|
470
|
+
*
|
|
471
|
+
* Gap formula: min(gap_anchors * 100, 10_000) beats required (matches Beats constants).
|
|
418
472
|
*/
|
|
419
473
|
resync(): Promise<{
|
|
420
474
|
ok: boolean;
|
|
@@ -423,11 +477,47 @@ declare class BeatAgent {
|
|
|
423
477
|
}>;
|
|
424
478
|
/**
|
|
425
479
|
* Request to spawn a child agent.
|
|
426
|
-
* Requires sufficient accumulated beats (Temporal Gestation).
|
|
480
|
+
* Requires sufficient accumulated beats (Temporal Gestation), OR a valid Beats work-proof receipt.
|
|
481
|
+
*
|
|
482
|
+
* @param childName Optional name for the child agent
|
|
483
|
+
* @param childHash Pre-registered child hash (Step 2 finalization)
|
|
484
|
+
* @param beatsReceipt Signed work-proof receipt from computeWorkProof() (receipt-based spawn)
|
|
485
|
+
*/
|
|
486
|
+
requestSpawn(childName?: string, childHash?: string, beatsReceipt?: WorkProofReceipt): Promise<SpawnResult>;
|
|
487
|
+
/**
|
|
488
|
+
* Compute a Beats work-proof for spawn or resync authorization.
|
|
489
|
+
*
|
|
490
|
+
* Computes `beatsNeeded` sequential SHA-256 beats at `difficulty`, weaving in
|
|
491
|
+
* the given anchor hash, then submits to the Beats service and returns a signed receipt.
|
|
492
|
+
*
|
|
493
|
+
* @param opts.beatsNeeded Minimum beats required (from spawn/resync response.required_beats)
|
|
494
|
+
* @param opts.anchorHash Current global anchor hash (from syncGlobal or getAnchor)
|
|
495
|
+
* @param opts.anchorIndex Current global anchor index
|
|
496
|
+
* @param opts.difficulty Beat difficulty (default: agent's current difficulty)
|
|
497
|
+
*/
|
|
498
|
+
computeWorkProof(opts: {
|
|
499
|
+
beatsNeeded: number;
|
|
500
|
+
anchorHash: string;
|
|
501
|
+
anchorIndex: number;
|
|
502
|
+
difficulty?: number;
|
|
503
|
+
}): Promise<WorkProofResult>;
|
|
504
|
+
/**
|
|
505
|
+
* Compute a Beats work-proof and use it to request spawn authorization.
|
|
506
|
+
*
|
|
507
|
+
* Probes the spawn endpoint to determine required beats, computes the proof,
|
|
508
|
+
* and returns the spawn_authorization token. The caller still needs to:
|
|
509
|
+
* 1. Register the child via POST /api/v1/register with spawn_authorization
|
|
510
|
+
* 2. Finalize via POST /api/v1/agent/spawn with child_hash
|
|
511
|
+
*
|
|
512
|
+
* @param opts.childName Optional name for the child agent
|
|
513
|
+
* @param opts.beatsNeeded Override the required beats (default: auto-probed)
|
|
427
514
|
*/
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
515
|
+
requestSpawnWithBeatsProof(opts?: {
|
|
516
|
+
childName?: string;
|
|
517
|
+
beatsNeeded?: number;
|
|
518
|
+
}): Promise<SpawnResult>;
|
|
519
|
+
/** Cached passport from the most recent heartbeat or SIGIL purchase */
|
|
520
|
+
private cachedPassport;
|
|
431
521
|
/**
|
|
432
522
|
* Purchase a SIGIL (cryptographic identity) for this agent.
|
|
433
523
|
* SIGILs gate heartbeating, lineage proofs, and offline verification.
|
|
@@ -440,6 +530,19 @@ declare class BeatAgent {
|
|
|
440
530
|
* @param paymentTx - Solana transaction signature or 'devnet-skip'
|
|
441
531
|
*/
|
|
442
532
|
purchaseSigil(optionsOrClass: SigilPurchaseOptions | IdentityClass, paymentTx?: string): Promise<SigilResult>;
|
|
533
|
+
/**
|
|
534
|
+
* Get a SIGIL attribution token from a partner skill's ref_token (RFC-018).
|
|
535
|
+
*
|
|
536
|
+
* Call this after receiving a skill's ref_token in its response.
|
|
537
|
+
* Returns a pvr_ attribution token to include as `at` in purchaseSigil().
|
|
538
|
+
*
|
|
539
|
+
* This is the agent-side half of the two-sided witnessed proof:
|
|
540
|
+
* the skill's server already called /sigil/check for this agent hash.
|
|
541
|
+
* This call completes the proof — our server witnesses both sides.
|
|
542
|
+
*
|
|
543
|
+
* @param partnerRef - The skill's 16-char ref_token
|
|
544
|
+
*/
|
|
545
|
+
getSigilAttribution(partnerRef: string): Promise<SigilAttributionResult>;
|
|
443
546
|
/**
|
|
444
547
|
* Update mutable SIGIL metadata fields.
|
|
445
548
|
* Requires a SIGIL. Cannot modify immutable fields.
|
|
@@ -452,44 +555,102 @@ declare class BeatAgent {
|
|
|
452
555
|
* Requires a SIGIL. Returns a signed lineage proof.
|
|
453
556
|
* This is the Phase 2 replacement for pulse() + checkin().
|
|
454
557
|
*
|
|
455
|
-
* @param paymentTx - Solana transaction signature
|
|
558
|
+
* @param paymentTx - Solana transaction signature (required).
|
|
456
559
|
* @param globalAnchor - Optional: the global anchor index to reference.
|
|
457
560
|
*/
|
|
458
|
-
heartbeat(paymentTx
|
|
561
|
+
heartbeat(paymentTx: string, globalAnchor?: number, opts?: {
|
|
562
|
+
sponsoredBy?: string;
|
|
563
|
+
}): Promise<HeartbeatResult>;
|
|
459
564
|
/**
|
|
460
|
-
* Reissue a
|
|
565
|
+
* Reissue a passport. "Reprint, not a renewal."
|
|
461
566
|
* Does NOT create a new lineage event.
|
|
462
567
|
*
|
|
463
|
-
* @param paymentTx - Solana transaction signature
|
|
568
|
+
* @param paymentTx - Solana transaction signature (required).
|
|
464
569
|
*/
|
|
465
|
-
|
|
570
|
+
reissuePassport(paymentTx: string): Promise<{
|
|
466
571
|
ok: boolean;
|
|
467
|
-
|
|
572
|
+
passport?: Passport;
|
|
573
|
+
lineage_proof?: Passport;
|
|
574
|
+
error?: string;
|
|
575
|
+
}>;
|
|
576
|
+
/** @deprecated Use `reissuePassport()` instead. Sunset 2026-09-01. */
|
|
577
|
+
reissueProof(paymentTx: string): Promise<{
|
|
578
|
+
ok: boolean;
|
|
579
|
+
passport?: Passport;
|
|
580
|
+
lineage_proof?: Passport;
|
|
468
581
|
error?: string;
|
|
469
582
|
}>;
|
|
470
583
|
/**
|
|
471
|
-
*
|
|
472
|
-
*
|
|
584
|
+
* Sponsor a child agent's heartbeats.
|
|
585
|
+
* The authenticated agent (this instance) becomes the sponsor, paying heartbeat
|
|
586
|
+
* fees on behalf of the specified child from this agent's operator wallet.
|
|
587
|
+
*
|
|
588
|
+
* @param childHash - Hash of the child agent to sponsor
|
|
589
|
+
* @param opts.maxHeartbeatsEpoch - Max heartbeats per billing epoch (default: 100, max: 10,000)
|
|
590
|
+
* @param opts.expiresInHours - Optional TTL for the sponsorship
|
|
473
591
|
*/
|
|
474
|
-
|
|
592
|
+
sponsorChild(childHash: string, opts?: {
|
|
593
|
+
maxHeartbeatsEpoch?: number;
|
|
594
|
+
expiresInHours?: number;
|
|
595
|
+
}): Promise<SponsorshipResult>;
|
|
475
596
|
/**
|
|
476
|
-
*
|
|
597
|
+
* Revoke a sponsorship for a child agent.
|
|
598
|
+
* The child will no longer be able to use this agent's wallet for heartbeat payments.
|
|
599
|
+
*/
|
|
600
|
+
revokeSponsor(childHash: string): Promise<{
|
|
601
|
+
ok: boolean;
|
|
602
|
+
error?: string;
|
|
603
|
+
}>;
|
|
604
|
+
/**
|
|
605
|
+
* List all active sponsorships for this agent (as parent).
|
|
606
|
+
*/
|
|
607
|
+
listSponsorships(): Promise<{
|
|
608
|
+
ok: boolean;
|
|
609
|
+
sponsorships?: SponsorshipRecord[];
|
|
610
|
+
error?: string;
|
|
611
|
+
}>;
|
|
612
|
+
/**
|
|
613
|
+
* Get the latest cached passport (no network call).
|
|
614
|
+
* Returns null if no passport has been obtained yet.
|
|
615
|
+
*/
|
|
616
|
+
getLatestPassport(): Passport | null;
|
|
617
|
+
/** @deprecated Use `getLatestPassport()` instead. Sunset 2026-09-01. */
|
|
618
|
+
getLatestProof(): Passport | null;
|
|
619
|
+
/**
|
|
620
|
+
* Get the agent's passport (alias for getLatestPassport).
|
|
477
621
|
* The passport is the agent's portable, offline-verifiable credential.
|
|
478
622
|
* Returns null if no passport has been issued yet (requires SIGIL + heartbeat).
|
|
479
623
|
*/
|
|
480
624
|
getPassport(): Passport | null;
|
|
481
625
|
/**
|
|
482
|
-
*
|
|
626
|
+
* Export this agent's passport in both flat (Passport) and W3C VC envelope formats.
|
|
627
|
+
* Fetches a freshly signed passport from the server. Free endpoint, rate-limited 10/hr.
|
|
628
|
+
* Returns null if the request fails.
|
|
629
|
+
*/
|
|
630
|
+
exportPassport(): Promise<{
|
|
631
|
+
passport: Passport;
|
|
632
|
+
passport_vc: ProvenoncePassportVC;
|
|
633
|
+
lineage_proof: Passport;
|
|
634
|
+
} | null>;
|
|
635
|
+
/**
|
|
636
|
+
* Wrap a Passport in a W3C Verifiable Credential envelope (client-side).
|
|
637
|
+
* Does not make any network call. Requires the passport to have authority_key_id.
|
|
638
|
+
*/
|
|
639
|
+
static proofToPassportVC(proof: Passport, authorityKeyId?: string): ProvenoncePassportVC;
|
|
640
|
+
/**
|
|
641
|
+
* Verify a passport locally using the authority public key.
|
|
483
642
|
* Offline verification — no API call, no SOL cost.
|
|
484
643
|
*
|
|
485
644
|
* Returns a VerificationResult object. The object is truthy when valid,
|
|
486
|
-
* so `if (BeatAgent.
|
|
645
|
+
* so `if (BeatAgent.verifyPassportLocally(proof, key))` still works.
|
|
487
646
|
*
|
|
488
|
-
* @param proof - The
|
|
647
|
+
* @param proof - The Passport to verify
|
|
489
648
|
* @param authorityPubKeyHex - 32-byte hex-encoded Ed25519 public key from /.well-known/provenonce-authority.json
|
|
490
649
|
* @param currentBeat - Optional current global beat index (for beatsSinceHeartbeat calculation)
|
|
491
650
|
*/
|
|
492
|
-
static
|
|
651
|
+
static verifyPassportLocally(proof: Passport, authorityPubKeyHex: string, currentBeat?: number): VerificationResult;
|
|
652
|
+
/** @deprecated Use `verifyPassportLocally()` instead. Sunset 2026-09-01. */
|
|
653
|
+
static verifyProofLocally(proof: Passport, authorityPubKeyHex: string, currentBeat?: number): VerificationResult;
|
|
493
654
|
/**
|
|
494
655
|
* Get this agent's full beat status from the registry.
|
|
495
656
|
*/
|
|
@@ -506,6 +667,12 @@ declare class BeatAgent {
|
|
|
506
667
|
globalBeat: number;
|
|
507
668
|
chainLength: number;
|
|
508
669
|
};
|
|
670
|
+
/**
|
|
671
|
+
* Returns true if this agent has purchased a SIGIL in this session,
|
|
672
|
+
* or if a cached passport contains an identity_class.
|
|
673
|
+
* For an authoritative check, use GET /api/v1/agent/me.
|
|
674
|
+
*/
|
|
675
|
+
hasSigil(): boolean;
|
|
509
676
|
private syncGlobal;
|
|
510
677
|
private refreshState;
|
|
511
678
|
private api;
|
|
@@ -545,6 +712,7 @@ declare enum ErrorCode {
|
|
|
545
712
|
VALIDATION = "VALIDATION",
|
|
546
713
|
AUTH_INVALID = "AUTH_INVALID",
|
|
547
714
|
AUTH_MISSING = "AUTH_MISSING",
|
|
715
|
+
SIGIL_REQUIRED = "SIGIL_REQUIRED",
|
|
548
716
|
RATE_LIMITED = "RATE_LIMITED",
|
|
549
717
|
AGENT_FROZEN = "AGENT_FROZEN",
|
|
550
718
|
AGENT_NOT_INITIALIZED = "AGENT_NOT_INITIALIZED",
|
|
@@ -572,6 +740,10 @@ declare class ValidationError extends ProvenonceError {
|
|
|
572
740
|
declare class AuthError extends ProvenonceError {
|
|
573
741
|
constructor(message: string, code?: ErrorCode.AUTH_INVALID | ErrorCode.AUTH_MISSING, statusCode?: number);
|
|
574
742
|
}
|
|
743
|
+
/** Thrown on 403 SIGIL_REQUIRED — agent has not purchased a SIGIL */
|
|
744
|
+
declare class SigilRequiredError extends ProvenonceError {
|
|
745
|
+
constructor(message?: string);
|
|
746
|
+
}
|
|
575
747
|
/** Thrown on 429 — rate limit exceeded */
|
|
576
748
|
declare class RateLimitError extends ProvenonceError {
|
|
577
749
|
/** Milliseconds until the rate limit resets (if provided by server) */
|
|
@@ -601,4 +773,4 @@ declare class ServerError extends ProvenonceError {
|
|
|
601
773
|
constructor(message: string, statusCode?: number);
|
|
602
774
|
}
|
|
603
775
|
|
|
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,
|
|
776
|
+
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, type ProvenoncePassportVC, RateLimitError, type RegisterOptions, type RegistrationResult, ServerError, type SigilAttributionResult, type SigilMutableFields, type SigilProtocol, type SigilPurchaseOptions, SigilRequiredError, type SigilResult, type SigilTier, type SpawnResult, type SponsorshipRecord, type SponsorshipResult, StateError, type Substrate, type SubstrateProvider, ValidationError, type VerificationResult, type WalletInfo, type WorkProofReceipt, type WorkProofResult, computeBeat, computeBeatsLite, register, verifyAnchorHash };
|