@stacknet/stacks 0.1.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.
Files changed (71) hide show
  1. package/README.md +103 -0
  2. package/dist/billing-BaJlf_S8.d.cts +1154 -0
  3. package/dist/billing-BaJlf_S8.d.ts +1154 -0
  4. package/dist/clients/index.cjs +4 -0
  5. package/dist/clients/index.d.cts +752 -0
  6. package/dist/clients/index.d.ts +752 -0
  7. package/dist/clients/index.js +4 -0
  8. package/dist/index-DVzKiF_0.d.cts +198 -0
  9. package/dist/index-DVzKiF_0.d.ts +198 -0
  10. package/dist/index.cjs +17 -0
  11. package/dist/index.d.cts +309 -0
  12. package/dist/index.d.ts +309 -0
  13. package/dist/index.js +17 -0
  14. package/dist/proxy/index.cjs +2 -0
  15. package/dist/proxy/index.d.cts +1 -0
  16. package/dist/proxy/index.d.ts +1 -0
  17. package/dist/proxy/index.js +2 -0
  18. package/dist/streaming/index.cjs +13 -0
  19. package/dist/streaming/index.d.cts +145 -0
  20. package/dist/streaming/index.d.ts +145 -0
  21. package/dist/streaming/index.js +13 -0
  22. package/dist/types/index.cjs +1 -0
  23. package/dist/types/index.d.cts +335 -0
  24. package/dist/types/index.d.ts +335 -0
  25. package/dist/types/index.js +1 -0
  26. package/package.json +75 -0
  27. package/src/clients/agents.ts +233 -0
  28. package/src/clients/billing.ts +157 -0
  29. package/src/clients/coder.ts +655 -0
  30. package/src/clients/files.ts +86 -0
  31. package/src/clients/index.ts +93 -0
  32. package/src/clients/magma.ts +299 -0
  33. package/src/clients/mcp.ts +208 -0
  34. package/src/clients/network.ts +118 -0
  35. package/src/clients/points.ts +403 -0
  36. package/src/clients/skills.ts +236 -0
  37. package/src/clients/social.ts +286 -0
  38. package/src/clients/stack-management.ts +279 -0
  39. package/src/clients/task-network.ts +303 -0
  40. package/src/clients/user.ts +84 -0
  41. package/src/clients/widgets.ts +171 -0
  42. package/src/index.ts +387 -0
  43. package/src/managers/index.ts +10 -0
  44. package/src/managers/task-manager.ts +310 -0
  45. package/src/proxy/forwarder.ts +146 -0
  46. package/src/proxy/index.ts +32 -0
  47. package/src/proxy/route-handlers.ts +950 -0
  48. package/src/streaming/component-stream.ts +319 -0
  49. package/src/streaming/index.ts +21 -0
  50. package/src/streaming/sse.ts +241 -0
  51. package/src/types/agent.ts +106 -0
  52. package/src/types/billing.ts +87 -0
  53. package/src/types/chat.ts +58 -0
  54. package/src/types/coder.ts +345 -0
  55. package/src/types/credential.ts +111 -0
  56. package/src/types/file.ts +15 -0
  57. package/src/types/imagination.ts +50 -0
  58. package/src/types/index.ts +20 -0
  59. package/src/types/mcp.ts +35 -0
  60. package/src/types/network.ts +97 -0
  61. package/src/types/points.ts +250 -0
  62. package/src/types/skill.ts +107 -0
  63. package/src/types/social.ts +109 -0
  64. package/src/types/stack.ts +269 -0
  65. package/src/types/task.ts +41 -0
  66. package/src/types/user.ts +29 -0
  67. package/src/types/widget.ts +57 -0
  68. package/src/utils/constants.ts +26 -0
  69. package/src/utils/errors.ts +169 -0
  70. package/src/utils/helpers.ts +85 -0
  71. package/src/utils/index.ts +7 -0
@@ -0,0 +1,752 @@
1
+ import { F as ChatCompletionRequest, E as ChatCompletionChunk, b6 as TaskPayload, ao as MagmaFile, ac as ImaginationMetadata, al as MCPSessionConfig, ak as MCPSession, am as MCPToolResult, aP as SocialClientConfig, ap as MediaType, a6 as FeedResponse, aF as PostResponse, I as CommentsResponse, aH as RemixesResponse, ag as LikeCheckResponse, ah as LikeResponse, H as CommentResponse, X as CreatePostInput, Y as CreatePostResponse, aG as ProfileResponse, p as AgentsClientConfig, q as AgentsListResponse, e as Agent, f as AgentCreateInput, j as AgentResponse, l as AgentUpdateInput, g as AgentExecuteRequest, h as AgentExecuteResponse, i as AgentFromPromptInput, bi as WidgetsClientConfig, bj as WidgetsListResponse, bd as Widget, be as WidgetCreateInput, bf as WidgetResponse, bh as WidgetUpdateInput, bg as WidgetSystemPromptResponse, b9 as UserClientConfig, ba as UserProfile, bc as UserProfileUpdateInput, bb as UserProfileResponse, a8 as FilesClientConfig, a7 as FileUploadResponse, aM as SkillsClientConfig, aN as SkillsListResponse, aI as Skill, aJ as SkillCreateInput, aK as SkillResponse, aL as SkillUpdateInput, bn as SkillVerifyResponse, bo as SkillMapResponse, bp as SkillMapPromptResponse, bq as SkillSummaryResponse, aE as PointsClientConfig, ae as InitNetworkResponse, a5 as DomainsListResponse, O as ContextDomain, V as CreateDomainInput, a4 as DomainResponse, Q as ContextsListResponse, az as PointContext, S as CreateContextInput, P as ContextResponse, a0 as DelegationFilters, a3 as DelegationsListResponse, U as CreateDelegationInput, a1 as DelegationResponse, d as AddPointsInput, aB as PointRecordResponse, aU as SpendPointsInput, aD as PointSpendResponse, ay as PointBalance, a9 as HistoryFilters, aa as HistoryResponse, a_ as StackManagementClientConfig, Z as CreateStackRequest, b3 as StackResponse, aZ as StackListResponse, aW as StackConfig, J as ConfigureOAuthInput, b2 as StackOAuthProvider, L as ConfigureWeb3Input, b5 as StackWeb3Provider, K as ConfigureStripeInput, b4 as StackStripeProvider, W as CreateKeyResponse, aY as StackKeysListResponse, r as AllowlistConfig, t as AllowlistUpdateInput, at as ModelLayersResponse, b0 as StackMemberStats, a$ as StackMember, au as NetworkClientConfig, av as NetworkStatus, an as MPCNode, N as ConsensusStatus, af as LeaderStatus, u as AuthMetrics, B as BillingClientConfig, w as BillingPlansResponse, y as BillingState, R as CreateCheckoutSessionResponse, x as BillingPortalResponse } from '../billing-BaJlf_S8.js';
2
+
3
+ /**
4
+ * TaskNetworkClient - OpenAI-compatible SDK for StackNet
5
+ *
6
+ * Provides streaming chat completions via the local StackNet
7
+ */
8
+
9
+ interface TaskNetworkConfig {
10
+ baseUrl?: string;
11
+ apiKey?: string;
12
+ timeout?: number;
13
+ }
14
+ declare class TaskNetworkClient {
15
+ private baseUrl;
16
+ private apiKey?;
17
+ private timeout;
18
+ constructor(config?: TaskNetworkConfig);
19
+ /**
20
+ * OpenAI-compatible streaming chat completions
21
+ */
22
+ chatCompletions(request: ChatCompletionRequest): AsyncIterable<ChatCompletionChunk>;
23
+ /**
24
+ * Submit a task to the network
25
+ * Returns taskId. If result is immediately available, also includes output.
26
+ */
27
+ submitTask(payload: TaskPayload): Promise<string>;
28
+ /**
29
+ * Submit a task and get full response (for immediate results)
30
+ */
31
+ submitTaskFull(payload: TaskPayload): Promise<{
32
+ taskId: string;
33
+ output?: unknown;
34
+ status?: string;
35
+ }>;
36
+ /**
37
+ * Get task status
38
+ */
39
+ getTask(taskId: string): Promise<{
40
+ status: string;
41
+ result?: unknown;
42
+ }>;
43
+ /**
44
+ * Stream task results as OpenAI-compatible chunks
45
+ */
46
+ streamTaskResults(taskId: string, model: string): AsyncIterable<ChatCompletionChunk>;
47
+ /**
48
+ * Stream raw task results (not OpenAI format)
49
+ */
50
+ streamTaskRaw(taskId: string): AsyncIterable<unknown>;
51
+ /**
52
+ * Health check
53
+ */
54
+ healthCheck(): Promise<boolean>;
55
+ /**
56
+ * Get node information
57
+ */
58
+ getNode(): Promise<unknown>;
59
+ }
60
+ /**
61
+ * Factory function to create a client
62
+ */
63
+ declare function createTaskNetworkClient(config?: TaskNetworkConfig): TaskNetworkClient;
64
+ /**
65
+ * Default singleton instance
66
+ */
67
+ declare const taskNetworkClient: TaskNetworkClient;
68
+
69
+ /**
70
+ * MagmaClient - File storage and imagination management
71
+ *
72
+ * Interfaces with the MetaChain P2P network for distributed file storage
73
+ */
74
+
75
+ interface MagmaClientConfig {
76
+ baseUrl?: string;
77
+ localServerUrl?: string;
78
+ }
79
+ declare class MagmaClient {
80
+ private baseUrl;
81
+ private localServerUrl;
82
+ constructor(config?: MagmaClientConfig);
83
+ /**
84
+ * Upload a file and get its CID
85
+ */
86
+ uploadFile(file: File): Promise<MagmaFile>;
87
+ /**
88
+ * Upload text content and get its CID
89
+ */
90
+ uploadText(text: string, name: string): Promise<MagmaFile>;
91
+ /**
92
+ * Store imagination metadata in P2P network
93
+ */
94
+ storeImagination(imagination: ImaginationMetadata & {
95
+ is_public?: boolean;
96
+ }): Promise<string>;
97
+ /**
98
+ * Retrieve imagination from P2P network by ID
99
+ */
100
+ getImagination(id: string): Promise<ImaginationMetadata | null>;
101
+ /**
102
+ * Get imagination by CID
103
+ */
104
+ getImaginationByCID(cid: string): Promise<ImaginationMetadata | null>;
105
+ /**
106
+ * List all imaginations for a user
107
+ */
108
+ listImaginations(creatorMid?: string): Promise<ImaginationMetadata[]>;
109
+ /**
110
+ * Fallback method to list imaginations from localStorage
111
+ */
112
+ private listImaginationsFromLocalStorage;
113
+ /**
114
+ * Retrieve file from Magma network
115
+ */
116
+ getFile(cid: string): Promise<Blob | null>;
117
+ /**
118
+ * Helper to convert ArrayBuffer to base64
119
+ */
120
+ private arrayBufferToBase64;
121
+ }
122
+ /**
123
+ * Factory function to create a client
124
+ */
125
+ declare function createMagmaClient(config?: MagmaClientConfig): MagmaClient;
126
+ /**
127
+ * Default singleton instance
128
+ */
129
+ declare const magmaClient: MagmaClient;
130
+
131
+ /**
132
+ * MCPClient - Model Context Protocol client
133
+ *
134
+ * Simple MCP client for communicating with magmanode MCP services
135
+ */
136
+
137
+ declare class MCPClient {
138
+ private baseUrl;
139
+ private timeout;
140
+ private sessions;
141
+ constructor(config?: MCPSessionConfig);
142
+ /**
143
+ * Create a new MCP session
144
+ */
145
+ createSession(agentId?: string): Promise<MCPSession>;
146
+ /**
147
+ * Get session by ID
148
+ */
149
+ getSession(sessionId: string): MCPSession | undefined;
150
+ /**
151
+ * Close a session
152
+ */
153
+ closeSession(sessionId: string): Promise<void>;
154
+ /**
155
+ * Send a message to an MCP session
156
+ */
157
+ sendMessage(sessionId: string, message: string): Promise<unknown>;
158
+ /**
159
+ * Call an MCP tool
160
+ */
161
+ callTool(sessionId: string, toolName: string, args?: Record<string, unknown>): Promise<MCPToolResult>;
162
+ /**
163
+ * List available tools for a session
164
+ */
165
+ listTools(sessionId: string): Promise<string[]>;
166
+ /**
167
+ * Get all active sessions
168
+ */
169
+ getActiveSessions(): MCPSession[];
170
+ /**
171
+ * Close all sessions
172
+ */
173
+ closeAllSessions(): Promise<void>;
174
+ }
175
+ /**
176
+ * Factory function to create a client
177
+ */
178
+ declare function createMCPClient(config?: MCPSessionConfig): MCPClient;
179
+ /**
180
+ * Default singleton instance
181
+ */
182
+ declare const mcpClient: MCPClient;
183
+
184
+ /**
185
+ * Social Network Client
186
+ * Client for interacting with the P2P social network API
187
+ */
188
+
189
+ declare class SocialClient {
190
+ private baseUrl;
191
+ constructor(config?: SocialClientConfig);
192
+ private get socialUrl();
193
+ /**
194
+ * Fetch feed with pagination
195
+ */
196
+ getFeed(options?: {
197
+ page?: number;
198
+ limit?: number;
199
+ mediaType?: MediaType;
200
+ }): Promise<FeedResponse>;
201
+ /**
202
+ * Fetch a single post by ID
203
+ */
204
+ getPost(postId: string): Promise<PostResponse>;
205
+ /**
206
+ * Fetch comments for a post
207
+ */
208
+ getComments(postId: string): Promise<CommentsResponse>;
209
+ /**
210
+ * Fetch remixes for a post
211
+ */
212
+ getRemixes(postId: string): Promise<RemixesResponse>;
213
+ /**
214
+ * Check if a user has liked a post
215
+ */
216
+ checkLike(postId: string, userMid: string): Promise<LikeCheckResponse>;
217
+ /**
218
+ * Like a post
219
+ */
220
+ likePost(postId: string, userMid: string): Promise<LikeResponse>;
221
+ /**
222
+ * Unlike a post
223
+ */
224
+ unlikePost(postId: string, userMid: string): Promise<LikeResponse>;
225
+ /**
226
+ * Add a comment to a post
227
+ */
228
+ addComment(postId: string, userMid: string, content: string): Promise<CommentResponse>;
229
+ /**
230
+ * Create a new post
231
+ */
232
+ createPost(input: CreatePostInput): Promise<CreatePostResponse>;
233
+ /**
234
+ * Track a view on a post
235
+ */
236
+ trackView(postId: string, userMid?: string): Promise<void>;
237
+ /**
238
+ * Track a play on audio/video post
239
+ */
240
+ trackPlay(postId: string, userMid?: string): Promise<void>;
241
+ /**
242
+ * Get user profile by MID
243
+ */
244
+ getProfile(mid: string): Promise<ProfileResponse | null>;
245
+ }
246
+ /**
247
+ * Create a SocialClient instance
248
+ */
249
+ declare function createSocialClient(config?: SocialClientConfig): SocialClient;
250
+ /**
251
+ * Default social client instance
252
+ */
253
+ declare const socialClient: SocialClient;
254
+
255
+ /**
256
+ * Agents Client
257
+ * Client for interacting with the agents API
258
+ */
259
+
260
+ declare class AgentsClient {
261
+ private baseUrl;
262
+ private useCpxApi;
263
+ constructor(config?: AgentsClientConfig);
264
+ private get agentsUrl();
265
+ /**
266
+ * List all agents
267
+ */
268
+ list(options?: {
269
+ userMid?: string;
270
+ }): Promise<AgentsListResponse>;
271
+ /**
272
+ * Get an agent by ID
273
+ */
274
+ get(id: string): Promise<Agent>;
275
+ /**
276
+ * Create a new agent
277
+ */
278
+ create(input: AgentCreateInput): Promise<AgentResponse>;
279
+ /**
280
+ * Update an agent
281
+ */
282
+ update(id: string, input: AgentUpdateInput): Promise<AgentResponse>;
283
+ /**
284
+ * Delete an agent
285
+ */
286
+ delete(id: string): Promise<{
287
+ success: boolean;
288
+ }>;
289
+ /**
290
+ * Enable an agent
291
+ */
292
+ enable(id: string): Promise<AgentResponse>;
293
+ /**
294
+ * Disable an agent
295
+ */
296
+ disable(id: string): Promise<AgentResponse>;
297
+ /**
298
+ * Execute an agent
299
+ */
300
+ execute(id: string, request?: AgentExecuteRequest): Promise<AgentExecuteResponse>;
301
+ /**
302
+ * Create agent from prompt (AI-generated)
303
+ */
304
+ createFromPrompt(input: AgentFromPromptInput): Promise<AgentResponse>;
305
+ }
306
+ /**
307
+ * Create an AgentsClient instance
308
+ */
309
+ declare function createAgentsClient(config?: AgentsClientConfig): AgentsClient;
310
+ /**
311
+ * Default agents client instance
312
+ */
313
+ declare const agentsClient: AgentsClient;
314
+
315
+ /**
316
+ * Widgets Client
317
+ * Client for interacting with the widgets API
318
+ */
319
+
320
+ declare class WidgetsClient {
321
+ private baseUrl;
322
+ constructor(config?: WidgetsClientConfig);
323
+ private get widgetsUrl();
324
+ /**
325
+ * List all widgets
326
+ */
327
+ list(options?: {
328
+ scope?: 'public' | 'private';
329
+ creatorMid?: string;
330
+ }): Promise<WidgetsListResponse>;
331
+ /**
332
+ * Get a widget by ID
333
+ */
334
+ get(id: string): Promise<Widget>;
335
+ /**
336
+ * Create a new widget
337
+ */
338
+ create(input: WidgetCreateInput): Promise<WidgetResponse>;
339
+ /**
340
+ * Update a widget
341
+ */
342
+ update(id: string, input: WidgetUpdateInput): Promise<WidgetResponse>;
343
+ /**
344
+ * Delete a widget
345
+ */
346
+ delete(id: string): Promise<{
347
+ success: boolean;
348
+ }>;
349
+ /**
350
+ * Get system prompt for widgets
351
+ */
352
+ getSystemPrompt(): Promise<WidgetSystemPromptResponse>;
353
+ /**
354
+ * Track widget usage
355
+ */
356
+ trackUsage(id: string): Promise<void>;
357
+ }
358
+ /**
359
+ * Create a WidgetsClient instance
360
+ */
361
+ declare function createWidgetsClient(config?: WidgetsClientConfig): WidgetsClient;
362
+ /**
363
+ * Default widgets client instance
364
+ */
365
+ declare const widgetsClient: WidgetsClient;
366
+
367
+ /**
368
+ * User Client
369
+ * Client for interacting with user profile API
370
+ */
371
+
372
+ declare class UserClient {
373
+ private baseUrl;
374
+ constructor(config?: UserClientConfig);
375
+ private get userUrl();
376
+ /**
377
+ * Get user profile by MID
378
+ */
379
+ getProfile(mid: string): Promise<UserProfile | null>;
380
+ /**
381
+ * Update user profile
382
+ */
383
+ updateProfile(mid: string, input: UserProfileUpdateInput): Promise<UserProfileResponse>;
384
+ }
385
+ /**
386
+ * Create a UserClient instance
387
+ */
388
+ declare function createUserClient(config?: UserClientConfig): UserClient;
389
+ /**
390
+ * Default user client instance
391
+ */
392
+ declare const userClient: UserClient;
393
+
394
+ /**
395
+ * Files Client
396
+ * Client for file upload operations
397
+ */
398
+
399
+ declare class FilesClient {
400
+ private baseUrl;
401
+ constructor(config?: FilesClientConfig);
402
+ private get filesUrl();
403
+ /**
404
+ * Upload a file
405
+ */
406
+ upload(file: File | Blob, filename?: string): Promise<FileUploadResponse>;
407
+ /**
408
+ * Upload a file from URL
409
+ */
410
+ uploadFromUrl(url: string): Promise<FileUploadResponse>;
411
+ /**
412
+ * Get file URL by CID
413
+ */
414
+ getFileUrl(cid: string): string;
415
+ }
416
+ /**
417
+ * Create a FilesClient instance
418
+ */
419
+ declare function createFilesClient(config?: FilesClientConfig): FilesClient;
420
+ /**
421
+ * Default files client instance
422
+ */
423
+ declare const filesClient: FilesClient;
424
+
425
+ /**
426
+ * Skills Client
427
+ *
428
+ * Client for interacting with the Skills API via the Agent Coprocessor
429
+ */
430
+
431
+ declare class SkillsClient {
432
+ private baseUrl;
433
+ private useCpxApi;
434
+ constructor(config?: SkillsClientConfig);
435
+ private get skillsUrl();
436
+ /**
437
+ * List skills
438
+ */
439
+ list(options?: {
440
+ scope?: 'public' | 'private' | 'all';
441
+ creatorMid?: string;
442
+ contentType?: 'code' | 'text' | 'image' | 'video' | 'music' | string;
443
+ precompiled?: boolean;
444
+ }): Promise<SkillsListResponse>;
445
+ /**
446
+ * Get a skill by ID
447
+ */
448
+ get(id: string): Promise<Skill>;
449
+ /**
450
+ * Create a new skill
451
+ */
452
+ create(skill: SkillCreateInput): Promise<SkillResponse>;
453
+ /**
454
+ * Update a skill
455
+ */
456
+ update(id: string, updates: SkillUpdateInput): Promise<SkillResponse>;
457
+ /**
458
+ * Delete a skill
459
+ */
460
+ delete(id: string): Promise<SkillResponse>;
461
+ /**
462
+ * Track skill usage
463
+ */
464
+ trackUsage(id: string): Promise<void>;
465
+ /**
466
+ * Verify skill hash integrity
467
+ */
468
+ verify(id: string): Promise<SkillVerifyResponse>;
469
+ /**
470
+ * Rehash a skill (recompute its hash)
471
+ */
472
+ rehash(id: string): Promise<{
473
+ skillId: string;
474
+ hash: string | null;
475
+ }>;
476
+ /**
477
+ * Rehash all skills
478
+ */
479
+ rehashAll(): Promise<{
480
+ updated: number;
481
+ total: number;
482
+ }>;
483
+ /**
484
+ * Get skill map (JSON format)
485
+ */
486
+ getMap(contentType?: string): Promise<SkillMapResponse>;
487
+ /**
488
+ * Get skill map as system prompt
489
+ */
490
+ getMapPrompt(contentType?: string): Promise<SkillMapPromptResponse>;
491
+ /**
492
+ * Get non-code skill map prompt
493
+ */
494
+ getNonCodeMap(): Promise<SkillMapPromptResponse>;
495
+ /**
496
+ * Get non-code skill summary
497
+ */
498
+ getNonCodeSummary(): Promise<SkillSummaryResponse>;
499
+ }
500
+ declare function createSkillsClient(config?: SkillsClientConfig): SkillsClient;
501
+ declare const skillsClient: SkillsClient;
502
+
503
+ /**
504
+ * Points Client
505
+ *
506
+ * Client for interacting with the Points Coprocessor API.
507
+ * Provides access to the internal reward and reputation framework for StackNet.
508
+ */
509
+
510
+ declare class PointsClient {
511
+ private baseUrl;
512
+ constructor(config?: PointsClientConfig);
513
+ private get pointsUrl();
514
+ /**
515
+ * Initialize the default geoffnet domain and contexts.
516
+ * Should only be called once during network bootstrap.
517
+ */
518
+ initNetworkDomain(): Promise<InitNetworkResponse>;
519
+ /**
520
+ * List all context domains
521
+ */
522
+ listDomains(): Promise<DomainsListResponse>;
523
+ /**
524
+ * Get a domain by ID
525
+ */
526
+ getDomain(domainId: string): Promise<ContextDomain | null>;
527
+ /**
528
+ * Create a new context domain.
529
+ * Note: Requires 402 payment for non-default domains.
530
+ */
531
+ createDomain(input: CreateDomainInput): Promise<DomainResponse>;
532
+ /**
533
+ * List all point contexts, optionally filtered by domain
534
+ */
535
+ listContexts(domainId?: string): Promise<ContextsListResponse>;
536
+ /**
537
+ * Get a context by ID
538
+ */
539
+ getContext(contextId: string): Promise<PointContext | null>;
540
+ /**
541
+ * Create a new point context.
542
+ * Note: Requires 402 payment for non-default contexts.
543
+ */
544
+ createContext(input: CreateContextInput): Promise<ContextResponse>;
545
+ /**
546
+ * List delegations with optional filters
547
+ */
548
+ listDelegations(filters?: DelegationFilters): Promise<DelegationsListResponse>;
549
+ /**
550
+ * Create a new delegation
551
+ */
552
+ createDelegation(input: CreateDelegationInput): Promise<DelegationResponse>;
553
+ /**
554
+ * Revoke a delegation
555
+ */
556
+ revokeDelegation(delegationId: string): Promise<{
557
+ success: boolean;
558
+ }>;
559
+ /**
560
+ * Add points (positive or negative) to an MID
561
+ */
562
+ addPoints(input: AddPointsInput): Promise<PointRecordResponse>;
563
+ /**
564
+ * Spend points (settlement via MetaChain)
565
+ */
566
+ spendPoints(input: SpendPointsInput): Promise<PointSpendResponse>;
567
+ /**
568
+ * Get points balance for an MID
569
+ */
570
+ getBalance(mid: string, options?: {
571
+ domainId?: string;
572
+ contextId?: string;
573
+ }): Promise<PointBalance>;
574
+ /**
575
+ * Get points history with optional filters
576
+ */
577
+ getHistory(filters?: HistoryFilters): Promise<HistoryResponse>;
578
+ }
579
+ /**
580
+ * Create a PointsClient instance
581
+ */
582
+ declare function createPointsClient(config?: PointsClientConfig): PointsClient;
583
+ /**
584
+ * Default points client instance
585
+ */
586
+ declare const pointsClient: PointsClient;
587
+
588
+ /**
589
+ * Stack Management Client
590
+ * CRUD operations for stacks, providers, keys, allowlists, capabilities, members, and model layers
591
+ */
592
+
593
+ declare class StackManagementClient {
594
+ private baseUrl;
595
+ private authToken;
596
+ constructor(config?: StackManagementClientConfig);
597
+ /** Update the auth token (e.g. after login via userutils) */
598
+ setAuthToken(token: string | null): void;
599
+ private get headers();
600
+ private url;
601
+ private request;
602
+ createStack(input: CreateStackRequest): Promise<StackResponse>;
603
+ listStacks(): Promise<StackListResponse>;
604
+ getStack(stackId: string): Promise<StackResponse>;
605
+ updateStack(stackId: string, updates: Partial<StackConfig>): Promise<StackResponse>;
606
+ deleteStack(stackId: string): Promise<{
607
+ deleted: boolean;
608
+ }>;
609
+ /** @server-only — Sends OAuth clientSecret. Only call from server-side code. */
610
+ configureOAuthProvider(stackId: string, provider: string, config: ConfigureOAuthInput): Promise<StackOAuthProvider>;
611
+ removeOAuthProvider(stackId: string, provider: string): Promise<{
612
+ removed: boolean;
613
+ }>;
614
+ configureWeb3Provider(stackId: string, provider: string, config: ConfigureWeb3Input): Promise<StackWeb3Provider>;
615
+ removeWeb3Provider(stackId: string, provider: string): Promise<{
616
+ removed: boolean;
617
+ }>;
618
+ /** @server-only — Sends Stripe secretKey. Only call from server-side code. */
619
+ configureStripeProvider(stackId: string, config: ConfigureStripeInput): Promise<StackStripeProvider>;
620
+ getStripeProvider(stackId: string): Promise<StackStripeProvider>;
621
+ removeStripeProvider(stackId: string): Promise<{
622
+ removed: boolean;
623
+ }>;
624
+ createPaymentIntent(stackId: string, amountCents: number, metadata?: Record<string, string>): Promise<{
625
+ clientSecret: string;
626
+ paymentIntentId: string;
627
+ }>;
628
+ createKey(stackId: string, name: string, permission: 'read' | 'write'): Promise<CreateKeyResponse>;
629
+ listKeys(stackId: string): Promise<StackKeysListResponse>;
630
+ revokeKey(stackId: string, keyId: string): Promise<{
631
+ success: boolean;
632
+ }>;
633
+ getAllowlist(stackId: string): Promise<AllowlistConfig>;
634
+ updateAllowlist(stackId: string, config: AllowlistUpdateInput): Promise<AllowlistConfig>;
635
+ updateCapabilities(stackId: string, capabilityBitmask: number): Promise<StackResponse>;
636
+ getModelLayers(stackId: string): Promise<ModelLayersResponse>;
637
+ updateModelAlias(stackId: string, layer: string, capability: string, alias: string): Promise<{
638
+ updated: boolean;
639
+ }>;
640
+ resetModelAlias(stackId: string, layer: string, capability: string): Promise<{
641
+ updated: boolean;
642
+ }>;
643
+ uploadLogo(stackId: string, file: File): Promise<StackResponse>;
644
+ deleteLogo(stackId: string): Promise<StackResponse>;
645
+ getMemberStats(stackId: string): Promise<StackMemberStats>;
646
+ getMembers(stackId: string, opts?: {
647
+ limit?: number;
648
+ offset?: number;
649
+ role?: string;
650
+ }): Promise<StackMember[]>;
651
+ updateMemberRole(stackId: string, userId: string, role: 'admin' | 'user'): Promise<{
652
+ success: boolean;
653
+ }>;
654
+ getUsageRecords(stackId: string, opts?: {
655
+ page?: number;
656
+ limit?: number;
657
+ days?: number;
658
+ model?: string;
659
+ }): Promise<{
660
+ data: any[];
661
+ pagination: any;
662
+ }>;
663
+ }
664
+ /**
665
+ * Create a StackManagementClient instance
666
+ */
667
+ declare function createStackManagementClient(config?: StackManagementClientConfig): StackManagementClient;
668
+ /**
669
+ * Default stack management client instance
670
+ */
671
+ declare const stackManagementClient: StackManagementClient;
672
+
673
+ /**
674
+ * Network Client
675
+ * Network status, MPC nodes, consensus, and auth metrics
676
+ */
677
+
678
+ declare class NetworkClient {
679
+ private baseUrl;
680
+ private authToken;
681
+ constructor(config?: NetworkClientConfig);
682
+ setAuthToken(token: string | null): void;
683
+ private get headers();
684
+ private request;
685
+ checkHealth(): Promise<boolean>;
686
+ getNetworkStatus(): Promise<NetworkStatus>;
687
+ getMPCNodes(): Promise<MPCNode[]>;
688
+ getNodeHealth(nodeId: string): Promise<{
689
+ healthy: boolean;
690
+ latency_ms: number;
691
+ }>;
692
+ getConsensusStatus(): Promise<ConsensusStatus>;
693
+ getLeaderStatus(): Promise<LeaderStatus>;
694
+ getAuthMetrics(stackId?: string): Promise<AuthMetrics>;
695
+ }
696
+ /**
697
+ * Create a NetworkClient instance
698
+ */
699
+ declare function createNetworkClient(config?: NetworkClientConfig): NetworkClient;
700
+ /**
701
+ * Default network client instance
702
+ */
703
+ declare const networkClient: NetworkClient;
704
+
705
+ /**
706
+ * Billing Client
707
+ * Plans, checkout, usage, and payment management scoped to a stack
708
+ */
709
+
710
+ declare class BillingClient {
711
+ private baseUrl;
712
+ private authToken;
713
+ constructor(config?: BillingClientConfig);
714
+ setAuthToken(token: string | null): void;
715
+ private get headers();
716
+ private url;
717
+ private request;
718
+ getPlans(stackId: string): Promise<BillingPlansResponse>;
719
+ getBillingState(stackId: string, identityId: string): Promise<BillingState>;
720
+ createCheckoutSession(stackId: string, identityId: string, planId: string, successUrl: string, cancelUrl: string): Promise<CreateCheckoutSessionResponse>;
721
+ createBillingPortal(stackId: string, identityId: string, returnUrl: string): Promise<BillingPortalResponse>;
722
+ recordUsage(stackId: string, identityId: string, usageType: string, quantity: number, idempotencyKey?: string): Promise<{
723
+ recorded: boolean;
724
+ total_usage: number;
725
+ }>;
726
+ getCurrentUsage(stackId: string, identityId: string): Promise<{
727
+ usage: {
728
+ type: string;
729
+ quantity: number;
730
+ amount: number;
731
+ }[];
732
+ total_amount: number;
733
+ }>;
734
+ linkStripeCustomer(stackId: string, identityId: string, stripeCustomerId: string, sessionId: string): Promise<{
735
+ linked: boolean;
736
+ }>;
737
+ hasPaymentMethod(stackId: string, identityId: string): Promise<{
738
+ has_payment_method: boolean;
739
+ card_last_four?: string;
740
+ card_brand?: string;
741
+ }>;
742
+ }
743
+ /**
744
+ * Create a BillingClient instance
745
+ */
746
+ declare function createBillingClient(config?: BillingClientConfig): BillingClient;
747
+ /**
748
+ * Default billing client instance
749
+ */
750
+ declare const billingClient: BillingClient;
751
+
752
+ export { AgentsClient, AgentsClientConfig, BillingClient, BillingClientConfig, FilesClient, FilesClientConfig, MCPClient, MagmaClient, type MagmaClientConfig, NetworkClient, NetworkClientConfig, PointsClient, PointsClientConfig, SkillsClient, SkillsClientConfig, SocialClient, SocialClientConfig, StackManagementClient, StackManagementClientConfig, TaskNetworkClient, type TaskNetworkConfig, UserClient, UserClientConfig, WidgetsClient, WidgetsClientConfig, agentsClient, billingClient, createAgentsClient, createBillingClient, createFilesClient, createMCPClient, createMagmaClient, createNetworkClient, createPointsClient, createSkillsClient, createSocialClient, createStackManagementClient, createTaskNetworkClient, createUserClient, createWidgetsClient, filesClient, magmaClient, mcpClient, networkClient, pointsClient, skillsClient, socialClient, stackManagementClient, taskNetworkClient, userClient, widgetsClient };