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