@actwith-ai/sdk 0.3.2 → 0.5.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 +5 -1
- package/dist/index.d.mts +830 -1
- package/dist/index.d.ts +830 -1
- package/dist/index.js +715 -51
- package/dist/index.mjs +715 -51
- package/package.json +12 -9
package/dist/index.js
CHANGED
|
@@ -171,6 +171,33 @@ var ActwithClient = class {
|
|
|
171
171
|
return this.request("GET", `/v1/tasks/${taskId}/handoffs`);
|
|
172
172
|
}
|
|
173
173
|
// ============================================================================
|
|
174
|
+
// Subtasks
|
|
175
|
+
// ============================================================================
|
|
176
|
+
async spawnSubtask(parentTaskId, description, opts) {
|
|
177
|
+
return this.request("POST", `/v1/tasks/${parentTaskId}/subtasks`, {
|
|
178
|
+
description,
|
|
179
|
+
...opts?.title && { title: opts.title },
|
|
180
|
+
...opts?.acceptanceCriteria && {
|
|
181
|
+
acceptanceCriteria: opts.acceptanceCriteria
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async getSubtasks(taskId) {
|
|
186
|
+
const result = await this.request("GET", `/v1/tasks/${taskId}/subtasks`);
|
|
187
|
+
return result.data || [];
|
|
188
|
+
}
|
|
189
|
+
// ============================================================================
|
|
190
|
+
// Approvals
|
|
191
|
+
// ============================================================================
|
|
192
|
+
async checkApproval(approvalId) {
|
|
193
|
+
try {
|
|
194
|
+
const result = await this.request("GET", `/v1/approvals/${approvalId}`);
|
|
195
|
+
return result.data || null;
|
|
196
|
+
} catch {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ============================================================================
|
|
174
201
|
// Routines (Standing Tasks)
|
|
175
202
|
// ============================================================================
|
|
176
203
|
async routineList(contextId, status) {
|
|
@@ -340,11 +367,7 @@ var ActwithClient = class {
|
|
|
340
367
|
});
|
|
341
368
|
}
|
|
342
369
|
async promoteTopicToSpace(topicId, options) {
|
|
343
|
-
return this.request(
|
|
344
|
-
"POST",
|
|
345
|
-
`/v1/topics/${topicId}/promote`,
|
|
346
|
-
options || {}
|
|
347
|
-
);
|
|
370
|
+
return this.request("POST", `/v1/topics/${topicId}/promote`, options || {});
|
|
348
371
|
}
|
|
349
372
|
// ============================================================================
|
|
350
373
|
// Agents
|
|
@@ -426,11 +449,9 @@ var ActwithClient = class {
|
|
|
426
449
|
);
|
|
427
450
|
}
|
|
428
451
|
async artifactUpdateStage(spaceId, artifactId, stage) {
|
|
429
|
-
await this.request(
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
{ stage }
|
|
433
|
-
);
|
|
452
|
+
await this.request("PUT", `/v1/spaces/${spaceId}/artifacts/${artifactId}`, {
|
|
453
|
+
stage
|
|
454
|
+
});
|
|
434
455
|
}
|
|
435
456
|
async artifactUpdateMetadata(spaceId, artifactId, metadata) {
|
|
436
457
|
await this.request(
|
|
@@ -480,10 +501,7 @@ var ActwithClient = class {
|
|
|
480
501
|
if (options?.outcome) params.set("outcome", options.outcome);
|
|
481
502
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
482
503
|
if (options?.offset) params.set("offset", String(options.offset));
|
|
483
|
-
return this.request(
|
|
484
|
-
"GET",
|
|
485
|
-
`/v1/agents/${agentId}/work-history?${params}`
|
|
486
|
-
);
|
|
504
|
+
return this.request("GET", `/v1/agents/${agentId}/work-history?${params}`);
|
|
487
505
|
}
|
|
488
506
|
async getMemberships(agentId) {
|
|
489
507
|
return this.request("GET", `/v1/agents/${agentId}/memberships`);
|
|
@@ -529,15 +547,11 @@ var ActwithClient = class {
|
|
|
529
547
|
async discoverTasks(agentId, options) {
|
|
530
548
|
const params = new URLSearchParams({ agentId });
|
|
531
549
|
if (options?.category) params.set("category", options.category);
|
|
532
|
-
if (options?.minReward)
|
|
533
|
-
params.set("min_reward", String(options.minReward));
|
|
550
|
+
if (options?.minReward) params.set("min_reward", String(options.minReward));
|
|
534
551
|
if (options?.includeJoinable) params.set("includeJoinable", "true");
|
|
535
552
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
536
553
|
if (options?.offset) params.set("offset", String(options.offset));
|
|
537
|
-
return this.request(
|
|
538
|
-
"GET",
|
|
539
|
-
`/v1/directory/tasks/for-agent?${params}`
|
|
540
|
-
);
|
|
554
|
+
return this.request("GET", `/v1/directory/tasks/for-agent?${params}`);
|
|
541
555
|
}
|
|
542
556
|
async joinSpace(spaceId, agentId, message) {
|
|
543
557
|
return this.request("POST", `/v1/spaces/${spaceId}/agents/join`, {
|
|
@@ -561,10 +575,7 @@ var ActwithClient = class {
|
|
|
561
575
|
return this.request("GET", `/v1/spaces/${spaceId}/invite-links`);
|
|
562
576
|
}
|
|
563
577
|
async revokeInvite(spaceId, code) {
|
|
564
|
-
await this.request(
|
|
565
|
-
"DELETE",
|
|
566
|
-
`/v1/spaces/${spaceId}/invite-links/${code}`
|
|
567
|
-
);
|
|
578
|
+
await this.request("DELETE", `/v1/spaces/${spaceId}/invite-links/${code}`);
|
|
568
579
|
}
|
|
569
580
|
// ============================================================================
|
|
570
581
|
// Patterns
|
|
@@ -582,10 +593,7 @@ var ActwithClient = class {
|
|
|
582
593
|
});
|
|
583
594
|
}
|
|
584
595
|
async getPatternContext(instanceId) {
|
|
585
|
-
return this.request(
|
|
586
|
-
"GET",
|
|
587
|
-
`/v1/patterns/instances/${instanceId}/context`
|
|
588
|
-
);
|
|
596
|
+
return this.request("GET", `/v1/patterns/instances/${instanceId}/context`);
|
|
589
597
|
}
|
|
590
598
|
async getPatternStatus(instanceId) {
|
|
591
599
|
return this.request("GET", `/v1/patterns/instances/${instanceId}`);
|
|
@@ -598,11 +606,9 @@ var ActwithClient = class {
|
|
|
598
606
|
);
|
|
599
607
|
}
|
|
600
608
|
async declareCapabilities(agentId, capabilities) {
|
|
601
|
-
await this.request(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
{ capabilities }
|
|
605
|
-
);
|
|
609
|
+
await this.request("POST", `/v1/patterns/agents/${agentId}/capabilities`, {
|
|
610
|
+
capabilities
|
|
611
|
+
});
|
|
606
612
|
}
|
|
607
613
|
async claimStage(instanceId, agentId, stageName) {
|
|
608
614
|
const result = await this.request("POST", `/v1/patterns/instances/${instanceId}/claim`, {
|
|
@@ -621,11 +627,10 @@ var ActwithClient = class {
|
|
|
621
627
|
);
|
|
622
628
|
}
|
|
623
629
|
async verifyStage(instanceId, stageName, params) {
|
|
624
|
-
return this.request(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
);
|
|
630
|
+
return this.request("POST", `/v1/patterns/instances/${instanceId}/verify`, {
|
|
631
|
+
stageName,
|
|
632
|
+
...params
|
|
633
|
+
});
|
|
629
634
|
}
|
|
630
635
|
async advancePattern(instanceId, params) {
|
|
631
636
|
return this.request(
|
|
@@ -665,11 +670,9 @@ var ActwithClient = class {
|
|
|
665
670
|
// Parallel Work Quality
|
|
666
671
|
// ============================================================================
|
|
667
672
|
async compareSubtaskOutput(subtaskId, output) {
|
|
668
|
-
return this.request(
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
{ output }
|
|
672
|
-
);
|
|
673
|
+
return this.request("POST", `/v1/patterns/subtasks/${subtaskId}/compare`, {
|
|
674
|
+
output
|
|
675
|
+
});
|
|
673
676
|
}
|
|
674
677
|
async getSubtaskComparisons(instanceId) {
|
|
675
678
|
return this.request(
|
|
@@ -678,19 +681,13 @@ var ActwithClient = class {
|
|
|
678
681
|
);
|
|
679
682
|
}
|
|
680
683
|
async getGoldenExample(patternId) {
|
|
681
|
-
return this.request(
|
|
682
|
-
"GET",
|
|
683
|
-
`/v1/patterns/${patternId}/golden-example`
|
|
684
|
-
);
|
|
684
|
+
return this.request("GET", `/v1/patterns/${patternId}/golden-example`);
|
|
685
685
|
}
|
|
686
686
|
// ============================================================================
|
|
687
687
|
// Time Awareness & Regression
|
|
688
688
|
// ============================================================================
|
|
689
689
|
async getTimeAwareness(instanceId) {
|
|
690
|
-
return this.request(
|
|
691
|
-
"GET",
|
|
692
|
-
`/v1/patterns/instances/${instanceId}/time`
|
|
693
|
-
);
|
|
690
|
+
return this.request("GET", `/v1/patterns/instances/${instanceId}/time`);
|
|
694
691
|
}
|
|
695
692
|
async runRegressionTests(instanceId, stageName, testOutputs) {
|
|
696
693
|
return this.request(
|
|
@@ -739,6 +736,673 @@ var ActwithClient = class {
|
|
|
739
736
|
async getBalance() {
|
|
740
737
|
return this.request("GET", "/v1/wallet");
|
|
741
738
|
}
|
|
739
|
+
// ============================================================================
|
|
740
|
+
// Connectors
|
|
741
|
+
// ============================================================================
|
|
742
|
+
async listAvailableConnectors() {
|
|
743
|
+
return this.request("GET", "/v1/connectors/available");
|
|
744
|
+
}
|
|
745
|
+
async getConnectorDetails(connector) {
|
|
746
|
+
return this.request("GET", `/v1/connectors/available/${connector}`);
|
|
747
|
+
}
|
|
748
|
+
async listConnectors(spaceId) {
|
|
749
|
+
return this.request("GET", `/v1/connectors?context=${spaceId}`);
|
|
750
|
+
}
|
|
751
|
+
async installConnector(spaceId, connector, config) {
|
|
752
|
+
return this.request("POST", "/v1/connectors", {
|
|
753
|
+
contextId: spaceId,
|
|
754
|
+
connector,
|
|
755
|
+
config
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
async setConnectorAuth(spaceId, connector, credentials) {
|
|
759
|
+
await this.request("POST", `/v1/connectors/${connector}/auth`, {
|
|
760
|
+
contextId: spaceId,
|
|
761
|
+
credentials
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
async updateConnectorConfig(spaceId, connector, config) {
|
|
765
|
+
await this.request("PUT", `/v1/connectors/${connector}/config`, {
|
|
766
|
+
contextId: spaceId,
|
|
767
|
+
config
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
async uninstallConnector(spaceId, connector) {
|
|
771
|
+
await this.request(
|
|
772
|
+
"DELETE",
|
|
773
|
+
`/v1/connectors/${connector}?context=${spaceId}`
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
async executeConnectorOperation(spaceId, connector, operation, inputs) {
|
|
777
|
+
return this.request("POST", `/v1/connectors/${connector}/${operation}`, {
|
|
778
|
+
contextId: spaceId,
|
|
779
|
+
inputs
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
async grantConnectorPermission(spaceId, connector, agentId, permissions) {
|
|
783
|
+
await this.request("POST", `/v1/connectors/${connector}/permissions`, {
|
|
784
|
+
contextId: spaceId,
|
|
785
|
+
agentId,
|
|
786
|
+
permissions
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
async revokeConnectorPermission(spaceId, connector, agentId) {
|
|
790
|
+
await this.request(
|
|
791
|
+
"DELETE",
|
|
792
|
+
`/v1/connectors/${connector}/permissions/${agentId}?context=${spaceId}`
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
// ============================================================================
|
|
796
|
+
// Task Connector Bindings
|
|
797
|
+
// ============================================================================
|
|
798
|
+
async createTaskBinding(taskId, connectorName, contextData) {
|
|
799
|
+
return this.request("POST", `/v1/tasks/${taskId}/bindings`, {
|
|
800
|
+
connectorName,
|
|
801
|
+
contextData
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
async listTaskBindings(taskId) {
|
|
805
|
+
return this.request("GET", `/v1/tasks/${taskId}/bindings`);
|
|
806
|
+
}
|
|
807
|
+
async updateTaskBinding(taskId, connectorName, contextData) {
|
|
808
|
+
return this.request(
|
|
809
|
+
"PATCH",
|
|
810
|
+
`/v1/tasks/${taskId}/bindings/${connectorName}`,
|
|
811
|
+
{ contextData }
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
async deleteTaskBinding(taskId, connectorName) {
|
|
815
|
+
await this.request(
|
|
816
|
+
"DELETE",
|
|
817
|
+
`/v1/tasks/${taskId}/bindings/${connectorName}`
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
// ============================================================================
|
|
821
|
+
// Realms
|
|
822
|
+
// ============================================================================
|
|
823
|
+
async listMyRealms() {
|
|
824
|
+
return this.request("GET", "/v1/realms/mine");
|
|
825
|
+
}
|
|
826
|
+
async createRealm(options) {
|
|
827
|
+
return this.request("POST", "/v1/realms", options);
|
|
828
|
+
}
|
|
829
|
+
async getRealm(slug) {
|
|
830
|
+
try {
|
|
831
|
+
return await this.request("GET", `/v1/realms/${slug}`);
|
|
832
|
+
} catch (err) {
|
|
833
|
+
if (err instanceof ActwithError && err.code === "NOT_FOUND") return null;
|
|
834
|
+
throw err;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
async updateRealm(realmId, updates) {
|
|
838
|
+
return this.request("PUT", `/v1/realms/${realmId}`, updates);
|
|
839
|
+
}
|
|
840
|
+
async checkRealmSlug(slug) {
|
|
841
|
+
return this.request("GET", `/v1/realms/check-slug?slug=${slug}`);
|
|
842
|
+
}
|
|
843
|
+
async getRealmMembers(realmId) {
|
|
844
|
+
return this.request("GET", `/v1/realms/${realmId}/members`);
|
|
845
|
+
}
|
|
846
|
+
async inviteRealmMember(realmId, options) {
|
|
847
|
+
return this.request("POST", `/v1/realms/${realmId}/invite`, options);
|
|
848
|
+
}
|
|
849
|
+
async removeRealmMember(realmId, userId) {
|
|
850
|
+
await this.request("DELETE", `/v1/realms/${realmId}/members/${userId}`);
|
|
851
|
+
}
|
|
852
|
+
async joinRealm(realmId, options) {
|
|
853
|
+
return this.request("POST", `/v1/realms/${realmId}/join`, options);
|
|
854
|
+
}
|
|
855
|
+
async getRealmJoinRequests(realmId) {
|
|
856
|
+
return this.request("GET", `/v1/realms/${realmId}/join-requests`);
|
|
857
|
+
}
|
|
858
|
+
async approveRealmJoinRequest(realmId, memberId) {
|
|
859
|
+
await this.request(
|
|
860
|
+
"POST",
|
|
861
|
+
`/v1/realms/${realmId}/join-requests/${memberId}/approve`
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
async rejectRealmJoinRequest(realmId, memberId) {
|
|
865
|
+
await this.request(
|
|
866
|
+
"POST",
|
|
867
|
+
`/v1/realms/${realmId}/join-requests/${memberId}/reject`
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
async getRealmSpaces(realmId) {
|
|
871
|
+
return this.request("GET", `/v1/realms/${realmId}/spaces`);
|
|
872
|
+
}
|
|
873
|
+
async getRealmTopics(realmId) {
|
|
874
|
+
return this.request("GET", `/v1/realms/${realmId}/topics`);
|
|
875
|
+
}
|
|
876
|
+
// ==========================================================================
|
|
877
|
+
// Gadgets
|
|
878
|
+
// ==========================================================================
|
|
879
|
+
async createGadget(agentId, spaceId, options) {
|
|
880
|
+
return this.request("POST", "/v1/gadgets", {
|
|
881
|
+
agentId,
|
|
882
|
+
spaceId,
|
|
883
|
+
name: options.name,
|
|
884
|
+
displayName: options.displayName,
|
|
885
|
+
sourceCode: options.sourceCode,
|
|
886
|
+
description: options.description,
|
|
887
|
+
entryFunction: options.entryFunction,
|
|
888
|
+
language: options.language,
|
|
889
|
+
inputSchema: options.inputSchema,
|
|
890
|
+
outputSchema: options.outputSchema,
|
|
891
|
+
dependencies: options.dependencies,
|
|
892
|
+
tags: options.tags
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
async testGadget(gadgetId, input) {
|
|
896
|
+
return this.request("POST", `/v1/gadgets/${gadgetId}/test`, { input });
|
|
897
|
+
}
|
|
898
|
+
async invokeGadget(gadgetId, agentId, input, async) {
|
|
899
|
+
return this.request("POST", `/v1/gadgets/${gadgetId}/invoke`, {
|
|
900
|
+
agentId,
|
|
901
|
+
input,
|
|
902
|
+
async
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
async getGadgetExecution(executionId) {
|
|
906
|
+
return this.request("GET", `/v1/gadgets/executions/${executionId}`);
|
|
907
|
+
}
|
|
908
|
+
async searchGadgets(options) {
|
|
909
|
+
const params = new URLSearchParams();
|
|
910
|
+
if (options?.query) params.set("q", options.query);
|
|
911
|
+
if (options?.tag) params.set("tag", options.tag);
|
|
912
|
+
if (options?.language) params.set("language", options.language);
|
|
913
|
+
if (options?.sort) params.set("sort", options.sort);
|
|
914
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
915
|
+
const qs = params.toString();
|
|
916
|
+
return this.request("GET", `/v1/gadgets/search${qs ? `?${qs}` : ""}`);
|
|
917
|
+
}
|
|
918
|
+
async publishGadget(gadgetId, visibility) {
|
|
919
|
+
return this.request("POST", `/v1/gadgets/${gadgetId}/publish`, {
|
|
920
|
+
visibility
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
async listGadgets(options) {
|
|
924
|
+
const params = new URLSearchParams();
|
|
925
|
+
if (options?.status) params.set("status", options.status);
|
|
926
|
+
const qs = params.toString();
|
|
927
|
+
return this.request("GET", `/v1/gadgets${qs ? `?${qs}` : ""}`);
|
|
928
|
+
}
|
|
929
|
+
async gadgetGet(gadgetId) {
|
|
930
|
+
try {
|
|
931
|
+
return await this.request("GET", `/v1/gadgets/${gadgetId}`);
|
|
932
|
+
} catch (err) {
|
|
933
|
+
if (err instanceof ActwithError && err.code === "NOT_FOUND") return null;
|
|
934
|
+
throw err;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
async gadgetUpdate(gadgetId, data) {
|
|
938
|
+
return this.request("PUT", `/v1/gadgets/${gadgetId}`, data);
|
|
939
|
+
}
|
|
940
|
+
async gadgetDelete(gadgetId) {
|
|
941
|
+
await this.request("DELETE", `/v1/gadgets/${gadgetId}`);
|
|
942
|
+
}
|
|
943
|
+
async gadgetProve(gadgetId, input, expected) {
|
|
944
|
+
return this.request("POST", `/v1/gadgets/${gadgetId}/prove`, {
|
|
945
|
+
input,
|
|
946
|
+
expected
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
async gadgetFork(gadgetId, opts) {
|
|
950
|
+
return this.request("POST", `/v1/gadgets/${gadgetId}/fork`, opts || {});
|
|
951
|
+
}
|
|
952
|
+
async gadgetLineage(gadgetId) {
|
|
953
|
+
return this.request("GET", `/v1/gadgets/${gadgetId}/lineage`);
|
|
954
|
+
}
|
|
955
|
+
async gadgetRatings(gadgetId) {
|
|
956
|
+
return this.request("GET", `/v1/gadgets/${gadgetId}/ratings`);
|
|
957
|
+
}
|
|
958
|
+
async gadgetRate(gadgetId, rating, accuracyRating) {
|
|
959
|
+
return this.request("POST", `/v1/gadgets/${gadgetId}/rate`, {
|
|
960
|
+
rating,
|
|
961
|
+
accuracyRating
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
// ============================================================================
|
|
965
|
+
// Economy
|
|
966
|
+
// ============================================================================
|
|
967
|
+
async economyDashboard(spaceId) {
|
|
968
|
+
const params = new URLSearchParams();
|
|
969
|
+
if (spaceId) params.set("spaceId", spaceId);
|
|
970
|
+
const qs = params.toString();
|
|
971
|
+
return this.request("GET", `/v1/economy/dashboard${qs ? `?${qs}` : ""}`);
|
|
972
|
+
}
|
|
973
|
+
async economyStreak() {
|
|
974
|
+
return this.request("GET", "/v1/economy/streak");
|
|
975
|
+
}
|
|
976
|
+
async economyMasteries() {
|
|
977
|
+
return this.request("GET", "/v1/economy/mastery");
|
|
978
|
+
}
|
|
979
|
+
async economyMastery(category) {
|
|
980
|
+
return this.request("GET", `/v1/economy/mastery/${category}`);
|
|
981
|
+
}
|
|
982
|
+
async economyBoosters() {
|
|
983
|
+
return this.request("GET", "/v1/economy/boosters");
|
|
984
|
+
}
|
|
985
|
+
async economyBoostersAvailable() {
|
|
986
|
+
return this.request("GET", "/v1/economy/boosters/available");
|
|
987
|
+
}
|
|
988
|
+
async economyPurchaseBooster(boosterId) {
|
|
989
|
+
return this.request("POST", "/v1/economy/boosters/purchase", { boosterId });
|
|
990
|
+
}
|
|
991
|
+
async economyReferral() {
|
|
992
|
+
return this.request("GET", "/v1/economy/referral");
|
|
993
|
+
}
|
|
994
|
+
async economyReferralGenerate() {
|
|
995
|
+
return this.request("POST", "/v1/economy/referral/generate");
|
|
996
|
+
}
|
|
997
|
+
async economyEvents(opts) {
|
|
998
|
+
const params = new URLSearchParams();
|
|
999
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1000
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1001
|
+
const qs = params.toString();
|
|
1002
|
+
return this.request("GET", `/v1/economy/events${qs ? `?${qs}` : ""}`);
|
|
1003
|
+
}
|
|
1004
|
+
async economyLeaderboard(opts) {
|
|
1005
|
+
const params = new URLSearchParams();
|
|
1006
|
+
if (opts?.spaceId) params.set("context", opts.spaceId);
|
|
1007
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1008
|
+
const qs = params.toString();
|
|
1009
|
+
return this.request("GET", `/v1/economy/leaderboard${qs ? `?${qs}` : ""}`);
|
|
1010
|
+
}
|
|
1011
|
+
async economyMilestones() {
|
|
1012
|
+
return this.request("GET", "/v1/economy/milestones");
|
|
1013
|
+
}
|
|
1014
|
+
async expLevel() {
|
|
1015
|
+
return this.request("GET", "/v1/economy/level");
|
|
1016
|
+
}
|
|
1017
|
+
async expCosts() {
|
|
1018
|
+
return this.request("GET", "/v1/economy/exp-costs");
|
|
1019
|
+
}
|
|
1020
|
+
async expSpend(purchaseType, targetId) {
|
|
1021
|
+
return this.request("POST", "/v1/economy/spend", {
|
|
1022
|
+
purchaseType,
|
|
1023
|
+
targetId
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
async expPurchases(opts) {
|
|
1027
|
+
const params = new URLSearchParams();
|
|
1028
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1029
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1030
|
+
const qs = params.toString();
|
|
1031
|
+
return this.request("GET", `/v1/economy/purchases${qs ? `?${qs}` : ""}`);
|
|
1032
|
+
}
|
|
1033
|
+
// ============================================================================
|
|
1034
|
+
// Pods
|
|
1035
|
+
// ============================================================================
|
|
1036
|
+
async podList() {
|
|
1037
|
+
return this.request("GET", "/v1/pods");
|
|
1038
|
+
}
|
|
1039
|
+
async podCreate(opts) {
|
|
1040
|
+
return this.request("POST", "/v1/pods", opts);
|
|
1041
|
+
}
|
|
1042
|
+
async podGet(podId) {
|
|
1043
|
+
try {
|
|
1044
|
+
return await this.request("GET", `/v1/pods/${podId}`);
|
|
1045
|
+
} catch (err) {
|
|
1046
|
+
if (err instanceof ActwithError && err.code === "NOT_FOUND") return null;
|
|
1047
|
+
throw err;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
async podUpdate(podId, opts) {
|
|
1051
|
+
return this.request("PUT", `/v1/pods/${podId}`, opts);
|
|
1052
|
+
}
|
|
1053
|
+
async podDelete(podId) {
|
|
1054
|
+
await this.request("DELETE", `/v1/pods/${podId}`);
|
|
1055
|
+
}
|
|
1056
|
+
async podStart(podId) {
|
|
1057
|
+
return this.request("POST", `/v1/pods/${podId}/start`);
|
|
1058
|
+
}
|
|
1059
|
+
async podPause(podId) {
|
|
1060
|
+
return this.request("POST", `/v1/pods/${podId}/pause`);
|
|
1061
|
+
}
|
|
1062
|
+
async podStop(podId) {
|
|
1063
|
+
return this.request("POST", `/v1/pods/${podId}/stop`);
|
|
1064
|
+
}
|
|
1065
|
+
async podStatus(podId) {
|
|
1066
|
+
return this.request("GET", `/v1/pods/${podId}/status`);
|
|
1067
|
+
}
|
|
1068
|
+
async podActivity(podId, opts) {
|
|
1069
|
+
const params = new URLSearchParams();
|
|
1070
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1071
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1072
|
+
const qs = params.toString();
|
|
1073
|
+
return this.request(
|
|
1074
|
+
"GET",
|
|
1075
|
+
`/v1/pods/${podId}/activity${qs ? `?${qs}` : ""}`
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
async podFuel(podId) {
|
|
1079
|
+
return this.request("GET", `/v1/pods/${podId}/fuel`);
|
|
1080
|
+
}
|
|
1081
|
+
async podSuggestedNames() {
|
|
1082
|
+
return this.request("GET", "/v1/pods/suggested-names");
|
|
1083
|
+
}
|
|
1084
|
+
async podTemplates() {
|
|
1085
|
+
return this.request("GET", "/v1/pods/templates");
|
|
1086
|
+
}
|
|
1087
|
+
async podPricing() {
|
|
1088
|
+
return this.request("GET", "/v1/pods/pricing");
|
|
1089
|
+
}
|
|
1090
|
+
async podRotateApiKey(podId, apiKey) {
|
|
1091
|
+
return this.request("PUT", `/v1/pods/${podId}/api-key`, { apiKey });
|
|
1092
|
+
}
|
|
1093
|
+
async podChat(podId, message) {
|
|
1094
|
+
return this.request("POST", `/v1/pods/${podId}/chat`, { message });
|
|
1095
|
+
}
|
|
1096
|
+
async podChatHistory(podId, opts) {
|
|
1097
|
+
const params = new URLSearchParams();
|
|
1098
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1099
|
+
if (opts?.before) params.set("before", opts.before);
|
|
1100
|
+
const qs = params.toString();
|
|
1101
|
+
return this.request("GET", `/v1/pods/${podId}/chat${qs ? `?${qs}` : ""}`);
|
|
1102
|
+
}
|
|
1103
|
+
async podUsage(opts) {
|
|
1104
|
+
const params = new URLSearchParams();
|
|
1105
|
+
if (opts?.since) params.set("since", String(opts.since));
|
|
1106
|
+
if (opts?.until) params.set("until", String(opts.until));
|
|
1107
|
+
const qs = params.toString();
|
|
1108
|
+
return this.request("GET", `/v1/pods/usage${qs ? `?${qs}` : ""}`);
|
|
1109
|
+
}
|
|
1110
|
+
// ============================================================================
|
|
1111
|
+
// Social
|
|
1112
|
+
// ============================================================================
|
|
1113
|
+
async socialFollow(followingType, followingId) {
|
|
1114
|
+
return this.request("POST", "/v1/social/follow", {
|
|
1115
|
+
followingType,
|
|
1116
|
+
followingId
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
async socialUnfollow(followingType, followingId) {
|
|
1120
|
+
await this.request("DELETE", "/v1/social/follow", {
|
|
1121
|
+
followingType,
|
|
1122
|
+
followingId
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
async socialIsFollowing(followingType, followingId) {
|
|
1126
|
+
return this.request(
|
|
1127
|
+
"GET",
|
|
1128
|
+
`/v1/social/is-following/${followingType}/${followingId}`
|
|
1129
|
+
);
|
|
1130
|
+
}
|
|
1131
|
+
async socialFollowers(entityType, entityId, opts) {
|
|
1132
|
+
const params = new URLSearchParams();
|
|
1133
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1134
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1135
|
+
const qs = params.toString();
|
|
1136
|
+
return this.request(
|
|
1137
|
+
"GET",
|
|
1138
|
+
`/v1/social/${entityType}/${entityId}/followers${qs ? `?${qs}` : ""}`
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
async socialFollowing(entityType, entityId, opts) {
|
|
1142
|
+
const params = new URLSearchParams();
|
|
1143
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1144
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1145
|
+
const qs = params.toString();
|
|
1146
|
+
return this.request(
|
|
1147
|
+
"GET",
|
|
1148
|
+
`/v1/social/${entityType}/${entityId}/following${qs ? `?${qs}` : ""}`
|
|
1149
|
+
);
|
|
1150
|
+
}
|
|
1151
|
+
async socialFollowCounts(entityType, entityId) {
|
|
1152
|
+
return this.request(
|
|
1153
|
+
"GET",
|
|
1154
|
+
`/v1/social/${entityType}/${entityId}/follow-counts`
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
async socialConnect(recipientId, message) {
|
|
1158
|
+
return this.request("POST", "/v1/social/connections", {
|
|
1159
|
+
recipientId,
|
|
1160
|
+
message
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
async socialRespondConnection(connectionId, accept) {
|
|
1164
|
+
return this.request("PUT", `/v1/social/connections/${connectionId}`, {
|
|
1165
|
+
accept
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
async socialConnections(opts) {
|
|
1169
|
+
const params = new URLSearchParams();
|
|
1170
|
+
if (opts?.status) params.set("status", opts.status);
|
|
1171
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1172
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1173
|
+
const qs = params.toString();
|
|
1174
|
+
return this.request("GET", `/v1/social/connections${qs ? `?${qs}` : ""}`);
|
|
1175
|
+
}
|
|
1176
|
+
async socialConnectionCounts() {
|
|
1177
|
+
return this.request("GET", "/v1/social/connections/counts");
|
|
1178
|
+
}
|
|
1179
|
+
async socialCheckConnection(userId) {
|
|
1180
|
+
return this.request("GET", `/v1/social/connections/check/${userId}`);
|
|
1181
|
+
}
|
|
1182
|
+
async socialRepost(contentType, contentId, comment, spaceId) {
|
|
1183
|
+
return this.request("POST", "/v1/social/reposts", {
|
|
1184
|
+
contentType,
|
|
1185
|
+
contentId,
|
|
1186
|
+
comment,
|
|
1187
|
+
spaceId
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
async socialDeleteRepost(repostId) {
|
|
1191
|
+
await this.request("DELETE", `/v1/social/reposts/${repostId}`);
|
|
1192
|
+
}
|
|
1193
|
+
async socialReposts(contentType, contentId, opts) {
|
|
1194
|
+
const params = new URLSearchParams();
|
|
1195
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1196
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1197
|
+
const qs = params.toString();
|
|
1198
|
+
return this.request(
|
|
1199
|
+
"GET",
|
|
1200
|
+
`/v1/social/reposts/${contentType}/${contentId}${qs ? `?${qs}` : ""}`
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1203
|
+
async socialFeed(opts) {
|
|
1204
|
+
const params = new URLSearchParams();
|
|
1205
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1206
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1207
|
+
const qs = params.toString();
|
|
1208
|
+
return this.request("GET", `/v1/social/feed${qs ? `?${qs}` : ""}`);
|
|
1209
|
+
}
|
|
1210
|
+
async socialFeedDiscover(opts) {
|
|
1211
|
+
const params = new URLSearchParams();
|
|
1212
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1213
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1214
|
+
const qs = params.toString();
|
|
1215
|
+
return this.request("GET", `/v1/social/feed/discover${qs ? `?${qs}` : ""}`);
|
|
1216
|
+
}
|
|
1217
|
+
async socialAgentTrust(agentId) {
|
|
1218
|
+
return this.request("GET", `/v1/social/trust/${agentId}`);
|
|
1219
|
+
}
|
|
1220
|
+
// ============================================================================
|
|
1221
|
+
// Direct Messages
|
|
1222
|
+
// ============================================================================
|
|
1223
|
+
async dmCreateThread(participants, opts) {
|
|
1224
|
+
return this.request("POST", "/v1/messages/threads", {
|
|
1225
|
+
participants,
|
|
1226
|
+
...opts
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
async dmListThreads(opts) {
|
|
1230
|
+
const params = new URLSearchParams();
|
|
1231
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1232
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1233
|
+
const qs = params.toString();
|
|
1234
|
+
return this.request("GET", `/v1/messages/threads${qs ? `?${qs}` : ""}`);
|
|
1235
|
+
}
|
|
1236
|
+
async dmGetThread(threadId) {
|
|
1237
|
+
try {
|
|
1238
|
+
return await this.request("GET", `/v1/messages/threads/${threadId}`);
|
|
1239
|
+
} catch (err) {
|
|
1240
|
+
if (err instanceof ActwithError && err.code === "NOT_FOUND") return null;
|
|
1241
|
+
throw err;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
async dmMarkRead(threadId) {
|
|
1245
|
+
await this.request("POST", `/v1/messages/threads/${threadId}/read`);
|
|
1246
|
+
}
|
|
1247
|
+
async dmSendMessage(threadId, content, metadata) {
|
|
1248
|
+
return this.request("POST", `/v1/messages/threads/${threadId}/messages`, {
|
|
1249
|
+
content,
|
|
1250
|
+
metadata
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
async dmGetMessages(threadId, opts) {
|
|
1254
|
+
const params = new URLSearchParams();
|
|
1255
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1256
|
+
if (opts?.before) params.set("before", opts.before);
|
|
1257
|
+
const qs = params.toString();
|
|
1258
|
+
return this.request(
|
|
1259
|
+
"GET",
|
|
1260
|
+
`/v1/messages/threads/${threadId}/messages${qs ? `?${qs}` : ""}`
|
|
1261
|
+
);
|
|
1262
|
+
}
|
|
1263
|
+
async dmQuickSend(recipientType, recipientId, content, subject) {
|
|
1264
|
+
return this.request("POST", "/v1/messages/quick-send", {
|
|
1265
|
+
recipientType,
|
|
1266
|
+
recipientId,
|
|
1267
|
+
content,
|
|
1268
|
+
subject
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
async dmUnreadCount() {
|
|
1272
|
+
return this.request("GET", "/v1/messages/unread");
|
|
1273
|
+
}
|
|
1274
|
+
// ============================================================================
|
|
1275
|
+
// Reflections & Insights
|
|
1276
|
+
// ============================================================================
|
|
1277
|
+
async reflectionCreate(data) {
|
|
1278
|
+
return this.request("POST", "/v1/reflections", data);
|
|
1279
|
+
}
|
|
1280
|
+
async reflectionList(opts) {
|
|
1281
|
+
const params = new URLSearchParams();
|
|
1282
|
+
if (opts?.agentId) params.set("agentId", opts.agentId);
|
|
1283
|
+
if (opts?.domain) params.set("domain", opts.domain);
|
|
1284
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1285
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1286
|
+
const qs = params.toString();
|
|
1287
|
+
return this.request("GET", `/v1/reflections${qs ? `?${qs}` : ""}`);
|
|
1288
|
+
}
|
|
1289
|
+
async reflectionRecall(opts) {
|
|
1290
|
+
const params = new URLSearchParams();
|
|
1291
|
+
if (opts?.agentId) params.set("agentId", opts.agentId);
|
|
1292
|
+
if (opts?.domain) params.set("domain", opts.domain);
|
|
1293
|
+
if (opts?.query) params.set("query", opts.query);
|
|
1294
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1295
|
+
const qs = params.toString();
|
|
1296
|
+
return this.request("GET", `/v1/reflections/recall${qs ? `?${qs}` : ""}`);
|
|
1297
|
+
}
|
|
1298
|
+
async insightSynthesize(opts) {
|
|
1299
|
+
return this.request("POST", "/v1/insights/synthesize", opts || {});
|
|
1300
|
+
}
|
|
1301
|
+
async agentExpertise(agentId) {
|
|
1302
|
+
return this.request("GET", `/v1/agents/${agentId}/expertise`);
|
|
1303
|
+
}
|
|
1304
|
+
async agentLibrary(agentId, opts) {
|
|
1305
|
+
const params = new URLSearchParams();
|
|
1306
|
+
if (opts?.domain) params.set("domain", opts.domain);
|
|
1307
|
+
if (opts?.type) params.set("type", opts.type);
|
|
1308
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1309
|
+
const qs = params.toString();
|
|
1310
|
+
return this.request(
|
|
1311
|
+
"GET",
|
|
1312
|
+
`/v1/agents/${agentId}/library${qs ? `?${qs}` : ""}`
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
async agentTimeline(agentId, opts) {
|
|
1316
|
+
const params = new URLSearchParams();
|
|
1317
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1318
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1319
|
+
const qs = params.toString();
|
|
1320
|
+
return this.request(
|
|
1321
|
+
"GET",
|
|
1322
|
+
`/v1/agents/${agentId}/timeline${qs ? `?${qs}` : ""}`
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
async synthesisRunGet(runId) {
|
|
1326
|
+
return this.request("GET", `/v1/synthesis-runs/${runId}`);
|
|
1327
|
+
}
|
|
1328
|
+
async insightVersions(insightId) {
|
|
1329
|
+
return this.request("GET", `/v1/insights/${insightId}/versions`);
|
|
1330
|
+
}
|
|
1331
|
+
// ============================================================================
|
|
1332
|
+
// Notifications
|
|
1333
|
+
// ============================================================================
|
|
1334
|
+
async notificationList(opts) {
|
|
1335
|
+
const params = new URLSearchParams();
|
|
1336
|
+
if (opts?.unreadOnly) params.set("unreadOnly", "true");
|
|
1337
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1338
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1339
|
+
const qs = params.toString();
|
|
1340
|
+
return this.request("GET", `/v1/notifications${qs ? `?${qs}` : ""}`);
|
|
1341
|
+
}
|
|
1342
|
+
async notificationReadAll() {
|
|
1343
|
+
return this.request("POST", "/v1/notifications/read-all");
|
|
1344
|
+
}
|
|
1345
|
+
async notificationRead(id) {
|
|
1346
|
+
await this.request("POST", `/v1/notifications/${id}/read`);
|
|
1347
|
+
}
|
|
1348
|
+
// ============================================================================
|
|
1349
|
+
// Skills
|
|
1350
|
+
// ============================================================================
|
|
1351
|
+
async skillList() {
|
|
1352
|
+
return this.request("GET", "/v1/skills");
|
|
1353
|
+
}
|
|
1354
|
+
async skillDiscover(opts) {
|
|
1355
|
+
const params = new URLSearchParams();
|
|
1356
|
+
if (opts?.query) params.set("q", opts.query);
|
|
1357
|
+
if (opts?.category) params.set("category", opts.category);
|
|
1358
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1359
|
+
const qs = params.toString();
|
|
1360
|
+
return this.request("GET", `/v1/skills/discover${qs ? `?${qs}` : ""}`);
|
|
1361
|
+
}
|
|
1362
|
+
async skillCreate(data) {
|
|
1363
|
+
return this.request("POST", "/v1/skills", data);
|
|
1364
|
+
}
|
|
1365
|
+
async skillInstall(skillId) {
|
|
1366
|
+
return this.request("POST", `/v1/skills/${skillId}/install`);
|
|
1367
|
+
}
|
|
1368
|
+
async skillUninstall(skillId) {
|
|
1369
|
+
await this.request("DELETE", `/v1/skills/${skillId}/install`);
|
|
1370
|
+
}
|
|
1371
|
+
// ============================================================================
|
|
1372
|
+
// Blueprints
|
|
1373
|
+
// ============================================================================
|
|
1374
|
+
async blueprintList(opts) {
|
|
1375
|
+
const params = new URLSearchParams();
|
|
1376
|
+
if (opts?.category) params.set("category", opts.category);
|
|
1377
|
+
if (opts?.sort) params.set("sort", opts.sort);
|
|
1378
|
+
if (opts?.limit) params.set("limit", String(opts.limit));
|
|
1379
|
+
if (opts?.offset) params.set("offset", String(opts.offset));
|
|
1380
|
+
const qs = params.toString();
|
|
1381
|
+
return this.request("GET", `/v1/blueprints${qs ? `?${qs}` : ""}`);
|
|
1382
|
+
}
|
|
1383
|
+
async blueprintGet(slug) {
|
|
1384
|
+
try {
|
|
1385
|
+
return await this.request("GET", `/v1/blueprints/${slug}`);
|
|
1386
|
+
} catch (err) {
|
|
1387
|
+
if (err instanceof ActwithError && err.code === "NOT_FOUND") return null;
|
|
1388
|
+
throw err;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
async blueprintCreate(data) {
|
|
1392
|
+
return this.request("POST", "/v1/blueprints", data);
|
|
1393
|
+
}
|
|
1394
|
+
async blueprintUpdate(id, data) {
|
|
1395
|
+
return this.request("PUT", `/v1/blueprints/${id}`, data);
|
|
1396
|
+
}
|
|
1397
|
+
async blueprintInstall(slug) {
|
|
1398
|
+
return this.request("POST", `/v1/blueprints/${slug}/install`);
|
|
1399
|
+
}
|
|
1400
|
+
async blueprintRate(slug, rating, review) {
|
|
1401
|
+
return this.request("POST", `/v1/blueprints/${slug}/rate`, {
|
|
1402
|
+
rating,
|
|
1403
|
+
review
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
742
1406
|
};
|
|
743
1407
|
var ActwithError = class extends Error {
|
|
744
1408
|
constructor(code, message) {
|