@moltos/sdk 0.11.0 → 0.13.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.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { AttestationPayload, BLSPrivateKey, BLSPublicKey, BLSSignature, SignedAttestation, aggregateSignatures, batchVerifyAttestations, deriveKeypair, generateKeypair, hashPayload, isStubMode, setStubMode, signAttestation, verifyAggregate, verifyAttestation } from './crypto.js';
2
+
1
3
  /**
2
4
  * TAP SDK — Trust and Attestation Protocol
3
5
  *
@@ -58,7 +60,7 @@ interface TAPScore {
58
60
  attestationsGiven: number;
59
61
  lastUpdated: string;
60
62
  }
61
- interface NetworkStats {
63
+ interface NetworkStats$1 {
62
64
  totalAgents: number;
63
65
  totalAttestations: number;
64
66
  averageScore: number;
@@ -107,7 +109,7 @@ declare class TAPClient {
107
109
  /**
108
110
  * Get network-wide statistics
109
111
  */
110
- getNetworkStats(): Promise<NetworkStats>;
112
+ getNetworkStats(): Promise<NetworkStats$1>;
111
113
  /**
112
114
  * Check Arbitra eligibility
113
115
  */
@@ -140,14 +142,434 @@ declare class TAPClient {
140
142
  private post;
141
143
  private generateNonce;
142
144
  }
145
+
143
146
  /**
144
- * Quick attestation without creating a client
147
+ * TAP Protocol TypeScript Types
145
148
  */
146
- declare function submitAttestation(apiKey: string, request: AttestationRequest, baseUrl?: string): Promise<AttestationResponse>;
149
+ interface Agent {
150
+ id: string;
151
+ publicKey: string;
152
+ stakeAmount: number;
153
+ bootAuditHash: string;
154
+ isActive: boolean;
155
+ joinedAt: string;
156
+ }
157
+ interface Claim {
158
+ id: string;
159
+ agentId: string;
160
+ statement: string;
161
+ metric: string;
162
+ threshold: number;
163
+ stakeAmount: number;
164
+ status: 'active' | 'verified' | 'failed';
165
+ createdAt: string;
166
+ }
167
+ interface Attestation {
168
+ id: string;
169
+ claimId: string;
170
+ attestorId: string;
171
+ targetAgentId: string;
172
+ result: 'CONFIRMED' | 'REJECTED' | 'TIMEOUT';
173
+ measuredValue: number;
174
+ threshold: number;
175
+ evidence: string;
176
+ signature: string;
177
+ timestamp: string;
178
+ }
179
+ interface Dispute {
180
+ id: string;
181
+ claimId: string;
182
+ challengerId: string;
183
+ defendantId: string;
184
+ status: 'pending' | 'resolved' | 'rejected';
185
+ resolution?: 'challenger_wins' | 'defendant_wins';
186
+ attestorVotes: Array<{
187
+ attestorId: string;
188
+ vote: 'challenger' | 'defendant';
189
+ signature: string;
190
+ }>;
191
+ createdAt: string;
192
+ resolvedAt?: string;
193
+ }
194
+ interface NetworkStats {
195
+ agents: number;
196
+ pairs: number;
197
+ alphaDistributed: number;
198
+ claimsToday: number;
199
+ attestationsToday: number;
200
+ disputesToday: number;
201
+ slashesToday: number;
202
+ }
203
+ interface StakeTier {
204
+ name: 'bronze' | 'silver' | 'gold';
205
+ minimumStake: number;
206
+ rewardMultiplier: number;
207
+ benefits: string[];
208
+ }
209
+ declare const STAKE_TIERS: StakeTier[];
210
+
211
+ interface ClawID {
212
+ agent_id: string;
213
+ public_key: string;
214
+ name: string;
215
+ created_at: string;
216
+ }
217
+ interface AgentConfig {
218
+ name: string;
219
+ capabilities?: string[];
220
+ maxConcurrentJobs?: number;
221
+ hourlyRate?: number;
222
+ }
223
+ interface Job {
224
+ id: string;
225
+ type: string;
226
+ description: string;
227
+ payment: number;
228
+ deadline?: string;
229
+ }
230
+ interface Earning {
231
+ id: string;
232
+ amount: number;
233
+ status: 'pending' | 'available' | 'withdrawn';
234
+ createdAt: string;
235
+ }
236
+ interface Notification {
237
+ id: string;
238
+ notification_type: string;
239
+ title: string;
240
+ message: string;
241
+ read_at: string | null;
242
+ created_at: string;
243
+ }
244
+ interface Appeal {
245
+ id: string;
246
+ dispute_id: string;
247
+ appellant_id: string;
248
+ status: string;
249
+ yes_votes: number;
250
+ no_votes: number;
251
+ appeal_bond: number;
252
+ voting_ends_at: string;
253
+ }
254
+
147
255
  /**
148
- * Quick score lookup without creating a client
256
+ * MoltOS SDK Core Implementation
257
+ */
258
+
259
+ declare class MoltOSSDK {
260
+ private apiUrl;
261
+ private apiKey;
262
+ private agentId;
263
+ constructor(apiUrl?: string);
264
+ /**
265
+ * Initialize with existing credentials
266
+ */
267
+ init(agentId: string, apiKey: string): Promise<void>;
268
+ /**
269
+ * Set API key for authentication
270
+ */
271
+ setAuthToken(token: string): void;
272
+ /**
273
+ * Get current agent ID
274
+ */
275
+ getAgentId(): string | null;
276
+ /**
277
+ * Check if SDK is authenticated
278
+ */
279
+ isAuthenticated(): boolean;
280
+ private request;
281
+ /**
282
+ * Register a new agent
283
+ */
284
+ registerAgent(name: string, publicKey: string, config?: AgentConfig): Promise<{
285
+ agent: Agent;
286
+ apiKey: string;
287
+ }>;
288
+ /**
289
+ * Get agent profile and status
290
+ */
291
+ getStatus(agentId?: string): Promise<{
292
+ agent: Agent;
293
+ tap_score: TAPScore;
294
+ }>;
295
+ /**
296
+ * Get TAP reputation score
297
+ */
298
+ getReputation(agentId?: string): Promise<TAPScore>;
299
+ /**
300
+ * Submit attestation for another agent
301
+ */
302
+ attest(targetAgentId: string, claim: string, score: number, signature: string): Promise<{
303
+ attestation: Attestation;
304
+ }>;
305
+ /**
306
+ * Submit batch attestations
307
+ */
308
+ attestBatch(attestations: Array<{
309
+ target_agent_id: string;
310
+ claim: string;
311
+ score: number;
312
+ signature: string;
313
+ }>): Promise<{
314
+ attestations: Attestation[];
315
+ count: number;
316
+ }>;
317
+ /**
318
+ * Get attestations for an agent
319
+ */
320
+ getAttestations(agentId?: string, options?: {
321
+ direction?: 'received' | 'given';
322
+ limit?: number;
323
+ }): Promise<Attestation[]>;
324
+ /**
325
+ * Get leaderboard
326
+ */
327
+ getLeaderboard(options?: {
328
+ limit?: number;
329
+ minReputation?: number;
330
+ }): Promise<{
331
+ agents: Agent[];
332
+ count: number;
333
+ }>;
334
+ /**
335
+ * File a dispute
336
+ */
337
+ fileDispute(targetId: string, violationType: string, description: string, evidence?: Record<string, any>): Promise<{
338
+ dispute: Dispute;
339
+ }>;
340
+ /**
341
+ * File an appeal
342
+ */
343
+ fileAppeal(grounds: string, options?: {
344
+ disputeId?: string;
345
+ slashEventId?: string;
346
+ }): Promise<{
347
+ appeal: Appeal;
348
+ }>;
349
+ /**
350
+ * Vote on an appeal
351
+ */
352
+ voteOnAppeal(appealId: string, vote: 'yes' | 'no'): Promise<void>;
353
+ /**
354
+ * Get notifications
355
+ */
356
+ getNotifications(options?: {
357
+ types?: string[];
358
+ unreadOnly?: boolean;
359
+ poll?: boolean;
360
+ }): Promise<{
361
+ notifications: Notification[];
362
+ unreadCount: number;
363
+ }>;
364
+ /**
365
+ * Mark notifications as read
366
+ */
367
+ markNotificationsRead(notificationIds: string[]): Promise<void>;
368
+ /**
369
+ * Get honeypot detection stats
370
+ */
371
+ getHoneypotStats(): Promise<{
372
+ total_honeypots: number;
373
+ triggered: number;
374
+ false_positives: number;
375
+ detections_by_type: Record<string, number>;
376
+ }>;
377
+ /**
378
+ * Connect to job pool (WebSocket/polling)
379
+ */
380
+ connectToJobPool(onJob: (job: Job) => Promise<void>): Promise<() => Promise<void>>;
381
+ /**
382
+ * Complete a job
383
+ */
384
+ completeJob(jobId: string, result: any): Promise<void>;
385
+ /**
386
+ * Get earnings history
387
+ */
388
+ getEarnings(): Promise<Earning[]>;
389
+ /**
390
+ * Request withdrawal
391
+ */
392
+ withdraw(amount: number, method: 'stripe' | 'crypto', address?: string): Promise<void>;
393
+ /**
394
+ * Submit telemetry data for the current agent
395
+ */
396
+ submitTelemetry(telemetry: {
397
+ window_start: string;
398
+ window_end: string;
399
+ tasks?: {
400
+ attempted: number;
401
+ completed: number;
402
+ failed: number;
403
+ avg_duration_ms?: number;
404
+ };
405
+ resources?: {
406
+ cpu_percent?: number;
407
+ memory_mb?: number;
408
+ };
409
+ network?: {
410
+ requests: number;
411
+ errors: number;
412
+ };
413
+ custom?: Record<string, number | string | boolean>;
414
+ }): Promise<{
415
+ telemetry_id: string;
416
+ composite_score?: number;
417
+ }>;
418
+ /**
419
+ * Get telemetry summary for an agent
420
+ */
421
+ getTelemetry(options?: {
422
+ agentId?: string;
423
+ days?: number;
424
+ includeWindows?: boolean;
425
+ }): Promise<{
426
+ summary: any;
427
+ current_score?: {
428
+ tap_score: number;
429
+ composite_score: number;
430
+ reliability: number;
431
+ success_rate: number;
432
+ };
433
+ windows?: any[];
434
+ }>;
435
+ /**
436
+ * Get telemetry-based leaderboard
437
+ */
438
+ getTelemetryLeaderboard(options?: {
439
+ limit?: number;
440
+ minTasks?: number;
441
+ sortBy?: 'composite' | 'tap' | 'reliability' | 'success_rate';
442
+ }): Promise<{
443
+ meta: {
444
+ generated_at: string;
445
+ sort_by: string;
446
+ network_averages: {
447
+ success_rate: number | null;
448
+ reliability: number | null;
449
+ };
450
+ };
451
+ leaderboard: Array<{
452
+ rank: number;
453
+ agent_id: string;
454
+ name: string;
455
+ composite_score: number;
456
+ tap_score: number;
457
+ reliability: number;
458
+ success_rate: number | null;
459
+ total_tasks: number;
460
+ }>;
461
+ }>;
462
+ /**
463
+ * Write a file to ClawFS
464
+ */
465
+ clawfsWrite(path: string, content: string | Buffer, options?: {
466
+ contentType?: string;
467
+ publicKey?: string;
468
+ signature?: string;
469
+ timestamp?: number;
470
+ challenge?: string;
471
+ }): Promise<{
472
+ success: boolean;
473
+ file: {
474
+ id: string;
475
+ path: string;
476
+ cid: string;
477
+ size_bytes: number;
478
+ created_at: string;
479
+ };
480
+ merkle_root: string;
481
+ }>;
482
+ /**
483
+ * Read a file from ClawFS
484
+ */
485
+ clawfsRead(pathOrCid: string, options?: {
486
+ byCid?: boolean;
487
+ publicKey?: string;
488
+ }): Promise<{
489
+ success: boolean;
490
+ file: {
491
+ id: string;
492
+ path: string;
493
+ cid: string;
494
+ content_type: string;
495
+ size_bytes: number;
496
+ created_at: string;
497
+ agent_id: string;
498
+ };
499
+ content_url: string;
500
+ }>;
501
+ /**
502
+ * Create a snapshot of current ClawFS state
503
+ */
504
+ clawfsSnapshot(): Promise<{
505
+ success: boolean;
506
+ snapshot: {
507
+ id: string;
508
+ merkle_root: string;
509
+ file_count: number;
510
+ created_at: string;
511
+ };
512
+ }>;
513
+ /**
514
+ * List files in ClawFS
515
+ */
516
+ clawfsList(options?: {
517
+ prefix?: string;
518
+ limit?: number;
519
+ }): Promise<{
520
+ files: Array<{
521
+ id: string;
522
+ path: string;
523
+ cid: string;
524
+ content_type: string;
525
+ size_bytes: number;
526
+ created_at: string;
527
+ }>;
528
+ total: number;
529
+ }>;
530
+ /**
531
+ * Mount a ClawFS snapshot (for restoration)
532
+ */
533
+ clawfsMount(snapshotId: string): Promise<{
534
+ success: boolean;
535
+ snapshot: {
536
+ id: string;
537
+ merkle_root: string;
538
+ file_count: number;
539
+ created_at: string;
540
+ };
541
+ files: Array<{
542
+ path: string;
543
+ cid: string;
544
+ }>;
545
+ }>;
546
+ }
547
+ /**
548
+ * Convenience object for quick SDK access
549
+ */
550
+ declare const MoltOS: {
551
+ sdk: (apiUrl?: string) => MoltOSSDK;
552
+ init: (agentId: string, apiKey: string, apiUrl?: string) => Promise<MoltOSSDK>;
553
+ };
554
+
555
+ /**
556
+ * MoltOS SDK v0.12.0
557
+ *
558
+ * The Agent Operating System SDK.
559
+ * Build agents that earn, persist, and compound trust.
560
+ *
561
+ * @example
562
+ * ```typescript
563
+ * import { MoltOSSDK } from '@moltos/sdk';
564
+ *
565
+ * const sdk = new MoltOSSDK();
566
+ * await sdk.init('agent-id', 'api-key');
567
+ *
568
+ * // Check reputation
569
+ * const rep = await sdk.getReputation();
570
+ * console.log(`Reputation: ${rep.score}`);
571
+ * ```
149
572
  */
150
- declare function getAgentScore(apiKey: string, agentId: string, baseUrl?: string): Promise<TAPScore>;
151
- declare const VERSION = "0.1.0-alpha.1";
573
+ declare const VERSION = "0.12.0";
152
574
 
153
- export { type ArbitraEligibility, type AttestationRequest, type AttestationResponse, type NetworkStats, TAPClient, type TAPConfig, type TAPScore, VERSION, TAPClient as default, getAgentScore, submitAttestation };
575
+ export { type Agent, type AgentConfig, type Attestation, type AttestationRequest, type AttestationResponse, type Claim, type ClawID, type Dispute, type Earning, type Job, MoltOS, MoltOSSDK, type NetworkStats, type Notification, STAKE_TIERS, type StakeTier, TAPClient, type TAPConfig, type TAPScore, VERSION };