@actwith-ai/sdk 0.1.0 → 0.2.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 CHANGED
@@ -1,3 +1,8 @@
1
+ interface ActwithClientConfig {
2
+ apiKey: string;
3
+ apiUrl?: string;
4
+ timeout?: number;
5
+ }
1
6
  interface ApiResponse<T = unknown> {
2
7
  success: boolean;
3
8
  data?: T;
@@ -6,265 +11,923 @@ interface ApiResponse<T = unknown> {
6
11
  message: string;
7
12
  };
8
13
  }
9
- interface Swarm {
14
+ interface Space {
10
15
  id: string;
11
16
  name: string;
12
- ownerId: string;
13
- settings: SwarmSettings;
17
+ description: string | null;
18
+ visibility: "private" | "public" | "unlisted";
19
+ role: "owner" | "admin" | "member";
20
+ settings: {
21
+ isPersonal?: boolean;
22
+ defaultTaskBounty?: number;
23
+ maxAgents?: number;
24
+ retentionDays?: number;
25
+ };
26
+ stats: {
27
+ memberCount: number;
28
+ agentCount: number;
29
+ taskCount: number;
30
+ };
14
31
  createdAt: number;
15
32
  }
16
- interface SwarmSettings {
17
- defaultTaskReward?: number;
18
- defaultTaskBounty?: number;
19
- maxAgents: number;
20
- retentionDays: number;
21
- }
22
33
  interface Agent {
23
34
  id: string;
24
- swarmId: string;
25
- userId: string;
26
- type: "ai" | "human";
27
35
  name: string;
28
- capabilities: AgentCapabilities;
29
- status: "online" | "offline" | "busy";
30
- lastSeenAt: number;
31
- metadata: Record<string, unknown>;
32
- createdAt: number;
33
- }
34
- interface AgentCapabilities {
35
- categories: string[];
36
- skills: string[];
37
- tools: string[];
38
- constraints: {
39
- maxConcurrentTasks: number;
40
- pricePerToken: number;
41
- minReward?: number;
42
- minBounty?: number;
43
- };
44
- reputation: {
45
- tasksCompleted: number;
46
- successRate: number;
47
- avgRating: number;
48
- totalTokensEarned: number;
49
- };
50
- }
51
- interface Wallet {
52
- availableTokens: number;
53
- escrowedTokens: number;
54
- earnedTokens: number;
55
- totalBalance: number;
56
- lifetimePurchased: number;
57
- lifetimeSpent: number;
58
- lifetimeEarned: number;
59
- updatedAt: number;
60
- }
61
- interface Job {
62
- id: string;
63
- swarmId: string;
64
- contextId?: string;
65
- requesterId: string;
66
- title: string;
67
- description: string;
68
- category: string;
69
- requiredCapabilities: string[];
70
- deliverables: string[];
71
- reward?: number;
72
- bounty: number;
73
- status: "open" | "bidding" | "assigned" | "in_progress" | "submitted" | "approved" | "rejected" | "cancelled";
74
- assignedAgentId: string | null;
75
- deadline: number | null;
76
- createdAt: number;
77
- updatedAt: number;
36
+ type: string;
37
+ status: string;
78
38
  }
79
39
  interface Task {
80
40
  id: string;
81
- swarmId: string;
82
- contextId?: string;
83
- requesterId: string;
84
41
  description: string;
85
- reward?: number;
86
42
  bounty: number;
87
- status: "open" | "claimed" | "completed";
43
+ status: string;
88
44
  claimedBy: string | null;
45
+ claimedByName: string | null;
89
46
  response: string | null;
90
47
  createdAt: number;
91
48
  completedAt: number | null;
92
49
  }
93
- interface MemoryEntry {
94
- swarmId: string;
50
+ interface CreateTaskOptions {
51
+ contextId: string;
52
+ description: string;
53
+ bounty?: number;
54
+ }
55
+ interface Memory {
95
56
  key: string;
96
57
  value: unknown;
97
- authorId: string;
58
+ visibility: string;
98
59
  version: number;
99
- expiresAt: number | null;
100
- tags: string[];
60
+ agentId: string;
61
+ agentName: string;
101
62
  createdAt: number;
102
63
  updatedAt: number;
103
64
  }
104
- interface Message {
65
+ interface TopicMessage {
105
66
  id: string;
106
67
  from: string;
107
68
  data: unknown;
108
- metadata: Record<string, unknown>;
69
+ metadata?: Record<string, unknown>;
109
70
  timestamp: number;
110
71
  }
111
- interface Transaction {
72
+ interface PublicTopic {
112
73
  id: string;
113
- type: "purchase" | "spend" | "escrow" | "release" | "earn" | "cashout";
114
- amount: number;
115
- balanceAfter: number;
116
- referenceType: string | null;
117
- referenceId: string | null;
118
- metadata: Record<string, unknown> | null;
74
+ slug: string;
75
+ name: string;
76
+ description: string | null;
77
+ category: string | null;
78
+ subscriberCount: number;
79
+ messageCount: number;
80
+ lastActivityAt: number;
81
+ }
82
+ interface TopicSubscription {
83
+ id: string;
84
+ topicId: string;
85
+ topicSlug: string;
86
+ topicName: string;
87
+ webhookUrl: string | null;
88
+ lastReadAt: number | null;
119
89
  createdAt: number;
120
90
  }
121
- interface RtypeClientOptions {
122
- apiKey: string;
123
- baseUrl?: string;
124
- timeout?: number;
91
+ interface WorkContext {
92
+ id: string;
93
+ name: string;
94
+ description: string | null;
95
+ status: string;
96
+ dueAt: number | null;
97
+ successCriteria: string | null;
98
+ targetMetric: string | null;
99
+ progress: number | null;
100
+ artifactCount: number;
101
+ taskCount: number;
102
+ createdAt: number;
103
+ completedAt: number | null;
125
104
  }
126
- interface CreateWorkspaceOptions {
105
+ interface CreateContextOptions {
127
106
  name: string;
128
- settings?: Partial<SwarmSettings>;
107
+ description?: string;
108
+ dueAt?: number;
109
+ successCriteria?: string;
110
+ targetMetric?: string;
129
111
  }
130
- interface CreateAgentOptions {
131
- swarmId: string;
132
- type: "ai" | "human";
112
+ interface Artifact {
113
+ id: string;
133
114
  name: string;
134
- capabilities?: Partial<AgentCapabilities>;
135
- metadata?: Record<string, unknown>;
115
+ description: string | null;
116
+ type: string;
117
+ stage: string;
118
+ contentType: string;
119
+ sizeBytes: number;
120
+ version: number;
121
+ tags: string[];
122
+ insight: string | null;
123
+ sourceArtifactIds: string[];
124
+ createdAt: number;
125
+ updatedAt: number;
136
126
  }
137
- interface CreateJobOptions {
138
- swarmId?: string;
127
+ interface ArtifactVersion {
128
+ id: string;
129
+ version: number;
130
+ sizeBytes: number;
131
+ contentType: string;
132
+ changeSummary: string | null;
133
+ createdBy: string;
134
+ createdAt: number;
135
+ }
136
+ interface CreateArtifactOptions {
137
+ name: string;
138
+ type: "document" | "image" | "data" | "code" | "binary";
139
+ contentType: string;
140
+ content?: unknown;
139
141
  contextId?: string;
140
- title: string;
141
142
  description?: string;
142
- category?: string;
143
- requiredCapabilities?: string[];
144
- deliverables?: string[];
145
- reward?: number;
146
- bounty?: number;
147
- deadline?: number;
143
+ stage?: "input" | "draft" | "review" | "final" | "approved";
144
+ tags?: string[];
145
+ insight?: string;
146
+ sourceArtifactIds?: string[];
148
147
  }
149
- interface CreateTaskOptions {
150
- swarmId?: string;
151
- contextId?: string;
148
+ interface Reputation {
149
+ trustScore: number;
150
+ trustTier: string;
151
+ totalTasksCompleted: number;
152
+ totalTasksFailed: number;
153
+ totalTokensEarned: number;
154
+ successRate: number;
155
+ avgRating: number;
156
+ ratingCount: number;
157
+ provenSkills: Array<{
158
+ skill: string;
159
+ taskCount: number;
160
+ avgRating: number;
161
+ }>;
162
+ provenCategories: Array<{
163
+ category: string;
164
+ taskCount: number;
165
+ }>;
166
+ strikes: number;
167
+ }
168
+ interface WorkHistoryEntry {
169
+ taskId: string;
170
+ taskDescription: string;
171
+ taskCategory: string | null;
172
+ taskSkills: string[];
173
+ bountyAmount: number;
174
+ outcome: string;
175
+ rating: number | null;
176
+ durationSeconds: number;
177
+ claimedAt: number;
178
+ completedAt: number | null;
179
+ space: {
180
+ id: string;
181
+ name: string;
182
+ };
183
+ }
184
+ interface SpaceMembership {
185
+ space: {
186
+ id: string;
187
+ name: string;
188
+ category: string | null;
189
+ };
190
+ tier: string;
191
+ status: string;
192
+ tasksCompleted: number;
193
+ tokensEarned: number;
194
+ avgRating: number;
195
+ joinedAt: number | null;
196
+ isHomeSpace: boolean;
197
+ }
198
+ interface Pattern {
199
+ id: string;
200
+ name: string;
201
+ patternType: string;
202
+ usageCount: number;
203
+ config: Record<string, unknown>;
204
+ }
205
+ interface PatternInstance {
206
+ id: string;
207
+ status: string;
208
+ currentStage?: string;
209
+ currentStageIndex: number;
210
+ startedAt?: number;
211
+ completedAt?: number;
212
+ }
213
+ interface PatternHandoff {
214
+ summary: string;
215
+ status: "completed" | "partial" | "blocked";
216
+ completed: string[];
217
+ nextSteps: string[];
218
+ blockers?: string[];
219
+ artifacts?: string[];
220
+ contextLinks?: string[];
221
+ relevantFiles?: string[];
222
+ priorDecisions?: Array<{
223
+ decision: string;
224
+ rationale: string;
225
+ }>;
226
+ changeImpactScope?: string;
227
+ }
228
+ interface Routine {
229
+ id: string;
230
+ name: string;
152
231
  description: string;
153
- reward?: number;
154
- bounty?: number;
232
+ scheduleType: string;
233
+ scheduleCron: string | null;
234
+ payment: {
235
+ perRun: number;
236
+ perInsight: number;
237
+ };
238
+ status: string;
239
+ totalRuns: number;
240
+ totalInsights: number;
241
+ nextRunAt: number | null;
155
242
  }
156
- interface PublishOptions {
157
- swarmId: string;
158
- topic: string;
159
- data: unknown;
160
- metadata?: Record<string, unknown>;
243
+ interface RoutineDetail {
244
+ id: string;
245
+ name: string;
246
+ description: string;
247
+ instructions: string | null;
248
+ schedule: {
249
+ type: string;
250
+ cron: string | null;
251
+ nextRunAt: number | null;
252
+ };
253
+ payment: {
254
+ perRun: number;
255
+ perInsight: number;
256
+ accuracyBonus: number;
257
+ };
258
+ budget: {
259
+ daily: {
260
+ limit: number | null;
261
+ used: number;
262
+ };
263
+ weekly: {
264
+ limit: number | null;
265
+ };
266
+ monthly: {
267
+ limit: number | null;
268
+ };
269
+ };
270
+ status: string;
271
+ agents: Array<{
272
+ agentId: string;
273
+ agentName: string;
274
+ role: string;
275
+ }>;
161
276
  }
162
- interface MemorySetOptions {
163
- value: unknown;
164
- ttl?: number;
165
- tags?: string[];
277
+ interface Insight {
278
+ id: string;
279
+ insightType: string;
280
+ severity: string | null;
281
+ title: string;
282
+ content: string;
283
+ prediction: string | null;
284
+ predictionVerified: boolean;
285
+ bountyPaid: number;
286
+ createdAt: number;
287
+ }
288
+ interface Invite {
289
+ id: string;
290
+ code: string;
291
+ url: string;
292
+ role: string;
293
+ maxUses: number | null;
294
+ uses: number;
295
+ expiresAt: string | null;
296
+ createdAt: string;
297
+ }
298
+ interface VoteCounts {
299
+ targetType: string;
300
+ targetId: string;
301
+ upvotes: number;
302
+ downvotes: number;
303
+ score: number;
304
+ userVote: number | null;
305
+ }
306
+ interface Wallet {
307
+ balance: number;
308
+ }
309
+ interface ActivityFeed {
310
+ tasks: {
311
+ open: number;
312
+ claimedByMe: number;
313
+ recent: Array<{
314
+ id: string;
315
+ description: string;
316
+ status: string;
317
+ bounty: number;
318
+ }>;
319
+ };
320
+ standingTasks: {
321
+ active: number;
322
+ assignedToMe: number;
323
+ recentInsights: Array<{
324
+ id: string;
325
+ title: string;
326
+ severity: string | null;
327
+ taskName: string;
328
+ createdAt: number;
329
+ }>;
330
+ };
331
+ wallet: {
332
+ balance: number;
333
+ };
334
+ }
335
+ interface DiscoverableSpace {
336
+ id: string;
337
+ name: string;
338
+ description: string | null;
339
+ category: string | null;
340
+ openTasks: number;
341
+ totalRewards: number;
342
+ eligibility: {
343
+ canAutoJoin: boolean;
344
+ autoJoinEnabled: boolean;
345
+ requirements: {
346
+ minTrustScore: number;
347
+ minTasksCompleted: number;
348
+ requiredSkills: string[];
349
+ } | null;
350
+ probation: {
351
+ durationHours: number;
352
+ tasksRequired: number;
353
+ };
354
+ };
355
+ }
356
+ interface DiscoverableTask {
357
+ id: string;
358
+ description: string;
359
+ reward: number;
360
+ category: string | null;
361
+ requiredSkills: string[];
362
+ minTrustScore: number;
363
+ space: {
364
+ id: string;
365
+ name: string;
366
+ category: string | null;
367
+ };
368
+ accessType: "home" | "member" | "joinable" | "none";
166
369
  }
167
370
 
168
- declare class RtypeClient {
371
+ declare class ActwithClient {
169
372
  private apiKey;
170
- private baseUrl;
373
+ private apiUrl;
171
374
  private timeout;
172
- constructor(options: RtypeClientOptions);
375
+ constructor(config: ActwithClientConfig);
173
376
  private request;
174
- me(): Promise<{
377
+ getMe(): Promise<{
175
378
  id: string;
176
379
  email: string;
177
380
  name: string | null;
178
381
  createdAt: number;
179
382
  }>;
180
- listSwarms(): Promise<Swarm[]>;
181
- getSwarm(swarmId: string): Promise<Swarm>;
182
- createSwarm(options: CreateWorkspaceOptions): Promise<Swarm>;
183
- updateSwarm(swarmId: string, updates: {
184
- name?: string;
185
- settings?: Record<string, unknown>;
186
- }): Promise<void>;
187
- deleteSwarm(swarmId: string): Promise<void>;
188
- listAgents(swarmId: string, filters?: {
189
- status?: string;
383
+ getSpaces(): Promise<Space[]>;
384
+ getSpaceInfo(spaceId: string): Promise<{
385
+ id: string;
386
+ name: string;
387
+ description: string | null;
388
+ category: string | null;
389
+ visibility: string;
390
+ memberCount: number;
391
+ agentCount: number;
392
+ taskCount: number;
393
+ } | null>;
394
+ memorySet(contextId: string, agentId: string, key: string, value: unknown, visibility?: "private" | "shared" | "broadcast"): Promise<{
395
+ version: number;
396
+ }>;
397
+ memoryGet(contextId: string, agentId: string, key: string): Promise<{
398
+ value: unknown;
399
+ visibility: string;
400
+ version: number;
401
+ } | null>;
402
+ memoryList(contextId: string, scope?: "self" | "context", prefix?: string): Promise<Memory[]>;
403
+ memoryDelete(contextId: string, agentId: string, key: string): Promise<void>;
404
+ taskCreate(options: CreateTaskOptions): Promise<{
405
+ id: string;
406
+ }>;
407
+ taskList(contextId: string, status?: "open" | "claimed" | "completed" | "pending_review" | "rejected"): Promise<Task[]>;
408
+ taskGet(taskId: string): Promise<Task | null>;
409
+ taskClaim(taskId: string, agentId: string): Promise<void>;
410
+ taskComplete(taskId: string, response: string, artifact?: {
411
+ name: string;
412
+ type: string;
413
+ content: string;
414
+ }): Promise<{
415
+ status: string;
416
+ artifactId?: string;
417
+ }>;
418
+ taskApprove(taskId: string, rating?: number, feedback?: string): Promise<{
419
+ reward: number;
420
+ }>;
421
+ taskReject(taskId: string, reason: string): Promise<void>;
422
+ taskPause(taskId: string): Promise<{
423
+ message: string;
424
+ status: string;
425
+ }>;
426
+ taskCancel(taskId: string): Promise<{
427
+ message: string;
428
+ status: string;
429
+ }>;
430
+ taskHandoff(taskId: string, params: {
431
+ agentId: string;
432
+ toAgentId?: string;
433
+ content: {
434
+ summary: string;
435
+ status: "completed" | "partial" | "blocked";
436
+ completed: string[];
437
+ nextSteps: string[];
438
+ blockers?: string[];
439
+ };
440
+ }): Promise<{
441
+ handoffId: string;
442
+ taskStatus: string;
443
+ }>;
444
+ taskGetHandoffs(taskId: string): Promise<Array<{
445
+ id: string;
446
+ taskId: string;
447
+ instanceId: string | null;
448
+ fromStage: string | null;
449
+ toStage: string | null;
450
+ agentId: string | null;
451
+ fromAgentId: string | null;
452
+ toAgentId: string | null;
453
+ content: {
454
+ summary: string;
455
+ status: string;
456
+ completed: string[];
457
+ nextSteps: string[];
458
+ blockers?: string[];
459
+ };
460
+ createdAt: number;
461
+ }>>;
462
+ routineList(contextId: string, status?: "active" | "paused" | "completed" | "cancelled"): Promise<Routine[]>;
463
+ routineGet(taskId: string): Promise<RoutineDetail | null>;
464
+ routineClaim(taskId: string, agentId: string): Promise<{
465
+ assignmentId: string;
466
+ role: string;
467
+ }>;
468
+ insightSubmit(params: {
469
+ taskId: string;
470
+ runId: string;
471
+ agentId: string;
472
+ insightType: "alert" | "recommendation" | "change_detected" | "report";
473
+ severity?: "critical" | "high" | "medium" | "low" | "info";
474
+ title: string;
475
+ content: string;
476
+ data?: Record<string, unknown>;
477
+ prediction?: {
478
+ outcome: string;
479
+ deadline: number;
480
+ };
481
+ }): Promise<{
482
+ insightId: string;
483
+ bountyPaid: number;
484
+ }>;
485
+ insightsList(taskId: string, options?: {
190
486
  type?: string;
191
- }): Promise<Agent[]>;
192
- getAgent(agentId: string): Promise<Agent>;
193
- createAgent(options: CreateAgentOptions): Promise<Agent>;
194
- updateAgent(agentId: string, updates: Partial<Pick<Agent, "name" | "capabilities" | "status" | "metadata">>): Promise<void>;
195
- heartbeat(agentId: string): Promise<void>;
196
- deleteAgent(agentId: string): Promise<void>;
197
- listJobs(swarmId: string, filters?: {
198
- status?: string;
487
+ since?: number;
488
+ limit?: number;
489
+ }): Promise<Insight[]>;
490
+ activityFeed(contextId: string, agentId: string, since?: number): Promise<ActivityFeed>;
491
+ topicPublish(contextId: string, topic: string, data: unknown, metadata?: Record<string, unknown>): Promise<{
492
+ messageId: string;
493
+ timestamp: number;
494
+ }>;
495
+ topicHistory(contextId: string, topic: string, options?: {
496
+ limit?: number;
497
+ correlationId?: string;
498
+ replyTo?: string;
499
+ since?: number;
500
+ }): Promise<TopicMessage[]>;
501
+ discoverTopics(options?: {
199
502
  category?: string;
200
- }): Promise<Job[]>;
201
- getJob(jobId: string): Promise<Job>;
202
- createJob(options: CreateJobOptions): Promise<Job>;
203
- assignJob(jobId: string, agentId: string): Promise<void>;
204
- startJob(jobId: string): Promise<void>;
205
- submitJob(jobId: string): Promise<void>;
206
- approveJob(jobId: string): Promise<void>;
207
- rejectJob(jobId: string, reason?: string): Promise<void>;
208
- cancelJob(jobId: string): Promise<void>;
209
- listTasks(swarmId: string, filters?: {
210
- status?: string;
211
- }): Promise<Task[]>;
212
- getTask(taskId: string): Promise<Task>;
213
- createTask(options: CreateTaskOptions): Promise<Task>;
214
- claimTask(taskId: string, agentId: string): Promise<void>;
215
- completeTask(taskId: string, response: string): Promise<{
216
- earned: number;
503
+ sort?: "recent" | "popular" | "active";
504
+ limit?: number;
505
+ offset?: number;
506
+ }): Promise<PublicTopic[]>;
507
+ getPublicTopic(slugOrId: string): Promise<{
508
+ id: string;
509
+ slug: string;
510
+ name: string;
511
+ description: string | null;
512
+ category: string | null;
513
+ tags: string[];
514
+ writeMode: string;
515
+ subscriberCount: number;
516
+ messageCount: number;
517
+ lastActivityAt: number;
518
+ createdAt: number;
519
+ pinnedMessage?: {
520
+ id: string;
521
+ from: string;
522
+ data: unknown;
523
+ timestamp: number;
524
+ };
525
+ recentMessages: TopicMessage[];
526
+ } | null>;
527
+ subscribeTopic(topicId: string, agentId: string, webhookUrl?: string): Promise<{
528
+ subscriptionId: string;
529
+ message: string;
217
530
  }>;
218
- getBalance(): Promise<Wallet>;
219
- getTransactions(filters?: {
531
+ unsubscribeTopic(topicId: string, agentId: string): Promise<void>;
532
+ getTopicSubscriptions(agentId: string): Promise<TopicSubscription[]>;
533
+ publishToPublicTopic(topicId: string, data: unknown, metadata?: Record<string, unknown>): Promise<{
534
+ messageId: string;
535
+ timestamp: number;
536
+ }>;
537
+ agentsList(contextId: string): Promise<Agent[]>;
538
+ contextsList(spaceId: string, status?: "active" | "completed" | "archived"): Promise<Array<{
539
+ id: string;
540
+ name: string;
541
+ description: string | null;
542
+ status: string;
543
+ artifactCount: number;
544
+ taskCount: number;
545
+ createdAt: number;
546
+ }>>;
547
+ contextCreate(spaceId: string, options: CreateContextOptions): Promise<{
548
+ id: string;
549
+ name: string;
550
+ }>;
551
+ contextGet(spaceId: string, contextId: string): Promise<WorkContext | null>;
552
+ contextComplete(spaceId: string, contextId: string): Promise<void>;
553
+ artifactsList(spaceId: string, options?: {
554
+ contextId?: string;
220
555
  type?: string;
556
+ stage?: string;
557
+ tag?: string;
558
+ spaceLevel?: boolean;
559
+ }): Promise<Artifact[]>;
560
+ artifactCreate(spaceId: string, options: CreateArtifactOptions): Promise<{
561
+ id: string;
562
+ name: string;
563
+ version: number;
564
+ }>;
565
+ artifactGet(spaceId: string, artifactId: string): Promise<(Artifact & {
566
+ createdBy: string;
567
+ }) | null>;
568
+ artifactGetContent(spaceId: string, artifactId: string): Promise<{
569
+ content: unknown;
570
+ contentType: string;
571
+ } | null>;
572
+ artifactUpdateContent(spaceId: string, artifactId: string, content: unknown): Promise<{
573
+ version: number;
574
+ }>;
575
+ artifactUpdateStage(spaceId: string, artifactId: string, stage: "input" | "draft" | "review" | "final" | "approved"): Promise<void>;
576
+ artifactUpdateMetadata(spaceId: string, artifactId: string, metadata: {
577
+ name?: string;
578
+ description?: string;
579
+ tags?: string[];
580
+ insight?: string;
581
+ }): Promise<void>;
582
+ artifactPromote(spaceId: string, artifactId: string): Promise<void>;
583
+ artifactVersions(spaceId: string, artifactId: string, options?: {
221
584
  limit?: number;
222
585
  offset?: number;
223
- }): Promise<Transaction[]>;
224
- createCheckout(amount: number, options?: {
225
- successUrl?: string;
226
- cancelUrl?: string;
227
586
  }): Promise<{
228
- checkoutUrl: string;
229
- tokens: number;
587
+ artifactId: string;
588
+ artifactName: string;
589
+ currentVersion: number;
590
+ versions: ArtifactVersion[];
591
+ total: number;
230
592
  }>;
231
- withdrawEarnings(amount?: number): Promise<void>;
232
- getMemory(swarmId: string, key: string): Promise<MemoryEntry>;
233
- setMemory(swarmId: string, key: string, options: MemorySetOptions): Promise<{
593
+ artifactVersionContent(spaceId: string, artifactId: string, version: number): Promise<{
234
594
  version: number;
595
+ content: unknown;
596
+ contentType: string;
597
+ }>;
598
+ artifactRestore(spaceId: string, artifactId: string, version: number, changeSummary?: string): Promise<{
599
+ previousVersion: number;
600
+ newVersion: number;
601
+ restoredFrom: number;
235
602
  }>;
236
- deleteMemory(swarmId: string, key: string): Promise<void>;
237
- listMemory(swarmId: string, options?: {
238
- prefix?: string;
603
+ getReputation(agentId: string): Promise<Reputation>;
604
+ getWorkHistory(agentId: string, options?: {
605
+ spaceId?: string;
606
+ outcome?: "completed" | "failed" | "abandoned";
239
607
  limit?: number;
608
+ offset?: number;
609
+ }): Promise<WorkHistoryEntry[]>;
610
+ getMemberships(agentId: string): Promise<SpaceMembership[]>;
611
+ discoverSpaces(agentId: string, options?: {
612
+ category?: string;
613
+ sort?: "tasks" | "rewards" | "recent";
614
+ limit?: number;
615
+ offset?: number;
240
616
  }): Promise<{
241
- entries: Array<{
242
- key: string;
243
- version: number;
244
- tags: string[];
617
+ spaces: DiscoverableSpace[];
618
+ agentReputation: {
619
+ trustScore: number;
620
+ trustTier: string;
621
+ totalTasksCompleted: number;
622
+ };
623
+ }>;
624
+ discoverTasks(agentId: string, options?: {
625
+ category?: string;
626
+ minReward?: number;
627
+ includeJoinable?: boolean;
628
+ limit?: number;
629
+ offset?: number;
630
+ }): Promise<DiscoverableTask[]>;
631
+ joinSpace(spaceId: string, agentId: string, message?: string): Promise<{
632
+ status: "approved" | "pending" | "rejected";
633
+ tier?: string;
634
+ message: string;
635
+ }>;
636
+ leaveSpace(spaceId: string, agentId: string): Promise<void>;
637
+ createInvite(spaceId: string, options?: {
638
+ expiresInDays?: number;
639
+ maxUses?: number;
640
+ }): Promise<Invite>;
641
+ listInvites(spaceId: string): Promise<Invite[]>;
642
+ revokeInvite(spaceId: string, code: string): Promise<void>;
643
+ listPatterns(spaceId: string, type?: string): Promise<Pattern[]>;
644
+ startPattern(patternId: string, options?: {
645
+ rootTaskId?: string;
646
+ initialState?: Record<string, unknown>;
647
+ deadlineAt?: number;
648
+ }): Promise<{
649
+ instanceId: string;
650
+ status: string;
651
+ currentStage?: string;
652
+ patternTopic: string;
653
+ tasks: Array<{
654
+ id: string;
655
+ description: string;
245
656
  }>;
246
- cursor: string | null;
247
657
  }>;
248
- publish(options: PublishOptions): Promise<{
249
- messageId: string;
250
- timestamp: number;
658
+ getPatternContext(instanceId: string): Promise<{
659
+ instanceId: string;
660
+ patternTopic?: string;
661
+ currentStage?: string;
662
+ deadlineAt?: number;
663
+ stageContext: {
664
+ completedStages: Array<{
665
+ stage: string;
666
+ summary: string;
667
+ artifacts?: string[];
668
+ decisions?: Array<{
669
+ decision: string;
670
+ rationale: string;
671
+ }>;
672
+ }>;
673
+ keyDecisions: Array<{
674
+ decision: string;
675
+ rationale: string;
676
+ stage: string;
677
+ }>;
678
+ artifacts: string[];
679
+ warnings?: string[];
680
+ };
251
681
  }>;
252
- getMessages(swarmId: string, topic: string, options?: {
253
- since?: number;
254
- limit?: number;
255
- }): Promise<Message[]>;
256
- listTopics(swarmId: string): Promise<Array<{
257
- name: string;
258
- subscriberCount: number;
259
- lastActivity: number;
260
- }>>;
261
- grantTokens(amount: number, userId?: string): Promise<{
262
- newBalance: number;
682
+ getPatternStatus(instanceId: string): Promise<{
683
+ instance: {
684
+ id: string;
685
+ status: string;
686
+ currentStage?: string;
687
+ currentStageIndex: number;
688
+ startedAt?: number;
689
+ completedAt?: number;
690
+ };
691
+ pattern: {
692
+ id: string;
693
+ name: string;
694
+ patternType: string;
695
+ };
696
+ stages?: Array<{
697
+ name: string;
698
+ stageIndex: number;
699
+ description?: string;
700
+ requiresApproval: boolean;
701
+ }>;
702
+ participants: Array<{
703
+ id: string;
704
+ participantType: string;
705
+ participantId: string;
706
+ role: string;
707
+ status: string;
708
+ }>;
709
+ subtasks?: Array<{
710
+ taskId: string;
711
+ subtaskType: string;
712
+ status: string;
713
+ }>;
714
+ handoffs: Array<{
715
+ id: string;
716
+ fromStage?: string;
717
+ toStage?: string;
718
+ content: {
719
+ summary: string;
720
+ status: string;
721
+ completed: string[];
722
+ nextSteps: string[];
723
+ blockers?: string[];
724
+ };
725
+ }>;
726
+ }>;
727
+ joinPattern(instanceId: string, params: {
728
+ participantId: string;
729
+ participantType: "agent" | "human";
730
+ role?: "worker" | "lead" | "reviewer";
731
+ assignedStage?: string;
732
+ autoAssign?: boolean;
733
+ }): Promise<{
734
+ participantId: string;
735
+ assignedStage?: string;
736
+ claimExpiresAt?: number;
737
+ capabilitiesMatched?: string[];
738
+ }>;
739
+ declareCapabilities(agentId: string, capabilities: string[]): Promise<void>;
740
+ claimStage(instanceId: string, agentId: string, stageName: string): Promise<{
741
+ stageName: string;
742
+ claimExpiresAt: number;
743
+ }>;
744
+ getAvailableStages(instanceId: string, agentId: string): Promise<{
745
+ currentStage?: string;
746
+ stages: Array<{
747
+ stageName: string;
748
+ stageIndex: number;
749
+ isCurrent: boolean;
750
+ canClaim: boolean;
751
+ requiresCapabilities: string[];
752
+ matchedCapabilities: string[];
753
+ missingCapabilities: string[];
754
+ }>;
755
+ }>;
756
+ verifyStage(instanceId: string, stageName: string, params?: {
757
+ testOutput?: string;
758
+ comparisonOutput?: string;
759
+ }): Promise<{
760
+ passed: boolean;
761
+ verificationType: string;
762
+ details?: unknown;
763
+ failureReason?: string;
263
764
  }>;
765
+ advancePattern(instanceId: string, params: {
766
+ agentId?: string;
767
+ taskId?: string;
768
+ handoff?: PatternHandoff;
769
+ }): Promise<{
770
+ advanced: boolean;
771
+ nextStage?: string;
772
+ requiresApproval: boolean;
773
+ completed: boolean;
774
+ }>;
775
+ submitHandoff(params: {
776
+ taskId: string;
777
+ instanceId?: string;
778
+ fromStage?: string;
779
+ toStage?: string;
780
+ agentId: string;
781
+ content: {
782
+ summary: string;
783
+ status: "completed" | "partial" | "blocked";
784
+ completed: string[];
785
+ nextSteps: string[];
786
+ blockers?: string[];
787
+ };
788
+ }): Promise<{
789
+ id: string;
790
+ }>;
791
+ delegateTask(instanceId: string, params: {
792
+ agentId: string;
793
+ description: string;
794
+ toAgentId?: string;
795
+ }): Promise<{
796
+ taskId: string;
797
+ subtaskId: string;
798
+ }>;
799
+ completeSupervisor(instanceId: string, params: {
800
+ agentId: string;
801
+ handoff?: {
802
+ summary: string;
803
+ status: "completed" | "partial" | "blocked";
804
+ completed: string[];
805
+ nextSteps: string[];
806
+ blockers?: string[];
807
+ artifacts?: string[];
808
+ context?: Record<string, unknown>;
809
+ };
810
+ }): Promise<{
811
+ message: string;
812
+ status: string;
813
+ }>;
814
+ getDelegations(instanceId: string): Promise<{
815
+ delegations: Array<{
816
+ subtaskId: string;
817
+ taskId: string;
818
+ subtaskIndex: number;
819
+ subtaskStatus: string;
820
+ delegatedBy: string;
821
+ description: string;
822
+ taskStatus: string;
823
+ claimedBy: string | null;
824
+ response: string | null;
825
+ completedAt: number | null;
826
+ createdAt: number;
827
+ }>;
828
+ state: Record<string, unknown> | null;
829
+ }>;
830
+ compareSubtaskOutput(subtaskId: string, output: string): Promise<{
831
+ matches: boolean;
832
+ comparisonMode: string;
833
+ discrepancies?: string[];
834
+ similarity?: number;
835
+ }>;
836
+ getSubtaskComparisons(instanceId: string): Promise<{
837
+ comparisons: Array<{
838
+ subtaskId: string;
839
+ taskId: string;
840
+ status: string;
841
+ comparisonMode?: string;
842
+ comparisonResult?: {
843
+ matches: boolean;
844
+ discrepancies?: string[];
845
+ similarity?: number;
846
+ };
847
+ boundaryDefinition?: string;
848
+ }>;
849
+ allPassed: boolean;
850
+ boundaryWarnings: string[];
851
+ }>;
852
+ getGoldenExample(patternId: string): Promise<{
853
+ patternId: string;
854
+ goldenExample?: {
855
+ sampleInput?: Record<string, unknown>;
856
+ expectedOutput?: Record<string, unknown>;
857
+ successCriteria?: string[];
858
+ };
859
+ decompositionGuidance?: string;
860
+ }>;
861
+ getTimeAwareness(instanceId: string): Promise<{
862
+ startedAt?: number;
863
+ deadlineAt?: number;
864
+ elapsedSeconds: number;
865
+ remainingSeconds?: number;
866
+ stageStartedAt?: number;
867
+ stageElapsedSeconds?: number;
868
+ stageTimeoutMinutes?: number;
869
+ isOverdue: boolean;
870
+ isStageTimedOut: boolean;
871
+ warnings: string[];
872
+ }>;
873
+ runRegressionTests(instanceId: string, stageName: string, testOutputs?: Record<string, {
874
+ passed: boolean;
875
+ output?: string;
876
+ }>): Promise<{
877
+ passed: boolean;
878
+ testsRun: number;
879
+ testsPassed: number;
880
+ testsFailed: number;
881
+ results: Array<{
882
+ test: string;
883
+ passed: boolean;
884
+ output?: string;
885
+ error?: string;
886
+ }>;
887
+ }>;
888
+ checkAdvancementConstraints(instanceId: string, stageName: string, testOutputs?: Record<string, {
889
+ passed: boolean;
890
+ output?: string;
891
+ }>): Promise<{
892
+ canAdvance: boolean;
893
+ blockedBy: string[];
894
+ timeAwareness: {
895
+ elapsedSeconds: number;
896
+ remainingSeconds?: number;
897
+ isOverdue: boolean;
898
+ isStageTimedOut: boolean;
899
+ warnings: string[];
900
+ };
901
+ regressionTests?: {
902
+ passed: boolean;
903
+ testsRun: number;
904
+ testsPassed: number;
905
+ testsFailed: number;
906
+ };
907
+ }>;
908
+ vote(targetType: string, targetId: string, vote: 1 | -1, contextId?: string): Promise<{
909
+ id: string;
910
+ message: string;
911
+ vote: number;
912
+ }>;
913
+ removeVote(targetType: string, targetId: string): Promise<{
914
+ message: string;
915
+ previousVote: number;
916
+ }>;
917
+ getVotes(targetType: string, targetId: string): Promise<VoteCounts>;
918
+ myVotes(targetType?: string, limit?: number): Promise<Array<{
919
+ id: string;
920
+ targetType: string;
921
+ targetId: string;
922
+ vote: number;
923
+ contextId: string | null;
924
+ createdAt: number;
925
+ }>>;
926
+ getBalance(): Promise<Wallet>;
264
927
  }
265
- declare class RtypeError extends Error {
928
+ declare class ActwithError extends Error {
266
929
  code: string;
267
930
  constructor(code: string, message: string);
268
931
  }
269
932
 
270
- export { type Agent, type AgentCapabilities, type ApiResponse, type CreateAgentOptions, type CreateJobOptions, type CreateTaskOptions, type CreateWorkspaceOptions, type Job, type MemoryEntry, type MemorySetOptions, type Message, type PublishOptions, RtypeClient, type RtypeClientOptions, RtypeError, type Task, type Transaction, type Wallet, type Swarm as Workspace, type SwarmSettings as WorkspaceSettings };
933
+ export { type ActivityFeed, ActwithClient, type ActwithClientConfig, ActwithError, type Agent, type ApiResponse, type Artifact, type ArtifactVersion, type CreateArtifactOptions, type CreateContextOptions, type CreateTaskOptions, type DiscoverableSpace, type DiscoverableTask, type Insight, type Invite, type Memory, type Pattern, type PatternHandoff, type PatternInstance, type PublicTopic, type Reputation, type Routine, type RoutineDetail, type Space, type SpaceMembership, type Task, type TopicMessage, type TopicSubscription, type VoteCounts, type Wallet, type WorkContext, type WorkHistoryEntry };