@memnexus-ai/typescript-sdk 1.53.28 → 1.54.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.cjs CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  MonitoringService: () => MonitoringService,
39
39
  NarrativesService: () => NarrativesService,
40
40
  PatternsService: () => PatternsService,
41
+ SdkError: () => SdkError,
41
42
  SerializationStyle: () => SerializationStyle,
42
43
  SystemService: () => SystemService,
43
44
  TopicsService: () => TopicsService,
@@ -123,6 +124,47 @@ __export(index_exports, {
123
124
  });
124
125
  module.exports = __toCommonJS(index_exports);
125
126
 
127
+ // src/http/http-types.ts
128
+ var SerializationStyle = /* @__PURE__ */ ((SerializationStyle2) => {
129
+ SerializationStyle2["SIMPLE"] = "simple";
130
+ SerializationStyle2["LABEL"] = "label";
131
+ SerializationStyle2["MATRIX"] = "matrix";
132
+ SerializationStyle2["FORM"] = "form";
133
+ SerializationStyle2["SPACE_DELIMITED"] = "space_delimited";
134
+ SerializationStyle2["PIPE_DELIMITED"] = "pipe_delimited";
135
+ SerializationStyle2["DEEP_OBJECT"] = "deep_object";
136
+ SerializationStyle2["NONE"] = "none";
137
+ return SerializationStyle2;
138
+ })(SerializationStyle || {});
139
+ var ContentType = /* @__PURE__ */ ((ContentType2) => {
140
+ ContentType2["Json"] = "json";
141
+ ContentType2["Xml"] = "xml";
142
+ ContentType2["Pdf"] = "pdf";
143
+ ContentType2["Image"] = "image";
144
+ ContentType2["File"] = "file";
145
+ ContentType2["Binary"] = "binary";
146
+ ContentType2["FormUrlEncoded"] = "form";
147
+ ContentType2["Text"] = "text";
148
+ ContentType2["MultipartFormData"] = "multipartFormData";
149
+ ContentType2["EventStream"] = "eventStream";
150
+ ContentType2["NoContent"] = "noContent";
151
+ return ContentType2;
152
+ })(ContentType || {});
153
+ var Environment = /* @__PURE__ */ ((Environment2) => {
154
+ Environment2["DEFAULT"] = "http://localhost:3000";
155
+ return Environment2;
156
+ })(Environment || {});
157
+ var SdkError = class _SdkError extends Error {
158
+ constructor(status, statusText, data, message) {
159
+ super(message);
160
+ this.status = status;
161
+ this.statusText = statusText;
162
+ this.data = data;
163
+ this.name = "SdkError";
164
+ Object.setPrototypeOf(this, _SdkError.prototype);
165
+ }
166
+ };
167
+
126
168
  // src/http/handlers.ts
127
169
  var BaseHandler = class {
128
170
  nextHandler;
@@ -283,9 +325,7 @@ var ExecuteHandler = class extends BaseHandler {
283
325
  raw
284
326
  };
285
327
  if (!response.ok) {
286
- const error2 = new Error(`HTTP ${response.status}: ${response.statusText}`);
287
- error2.response = httpResponse;
288
- throw error2;
328
+ throw new SdkError(response.status, response.statusText, data, `HTTP ${response.status}: ${response.statusText}`);
289
329
  }
290
330
  return httpResponse;
291
331
  } finally {
@@ -557,23 +597,77 @@ function serializeQueryParam(key, param) {
557
597
  return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;
558
598
  }
559
599
 
560
- // src/services/users-service.ts
561
- var UsersService = class extends BaseService {
600
+ // src/services/admin-service.ts
601
+ var AdminService = class extends BaseService {
562
602
  /**
563
- * Sync user from WorkOS
564
- * Called by the customer portal after WorkOS authentication.
565
- Creates a new user if they don't exist, or updates their profile if they do.
566
- This is the main entry point for user provisioning.
567
- When the invite gate is closed and a new user is created, the inviteCode
568
- is redeemed atomically to track which code was used for registration.
569
-
570
- * @param body - Request body
571
- */
572
- async syncUser(body) {
603
+ * List invite codes
604
+ * List all invite codes with optional status filter
605
+ * @param status - Filter by status
606
+ * @param limit -
607
+ * @param offset -
608
+ */
609
+ async adminListInviteCodes(options) {
610
+ const request = new Request({
611
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
612
+ method: "GET",
613
+ path: "/api/admin/invites",
614
+ config: this.config,
615
+ retry: {
616
+ attempts: 3,
617
+ delayMs: 150,
618
+ maxDelayMs: 5e3,
619
+ jitterMs: 50,
620
+ backoffFactor: 2
621
+ }
622
+ });
623
+ if (options?.status !== void 0) {
624
+ request.addQueryParam("status", {
625
+ key: "status",
626
+ value: options.status,
627
+ explode: false,
628
+ encode: true,
629
+ style: "form",
630
+ isLimit: false,
631
+ isOffset: false,
632
+ isCursor: false
633
+ });
634
+ }
635
+ if (options?.limit !== void 0) {
636
+ request.addQueryParam("limit", {
637
+ key: "limit",
638
+ value: options.limit,
639
+ explode: false,
640
+ encode: true,
641
+ style: "form",
642
+ isLimit: true,
643
+ isOffset: false,
644
+ isCursor: false
645
+ });
646
+ }
647
+ if (options?.offset !== void 0) {
648
+ request.addQueryParam("offset", {
649
+ key: "offset",
650
+ value: options.offset,
651
+ explode: false,
652
+ encode: true,
653
+ style: "form",
654
+ isLimit: false,
655
+ isOffset: true,
656
+ isCursor: false
657
+ });
658
+ }
659
+ return this.client.call(request);
660
+ }
661
+ /**
662
+ * Create invite code
663
+ * Create a new invite code for the gated preview
664
+ * @param body - Request body
665
+ */
666
+ async adminCreateInviteCode(body) {
573
667
  const request = new Request({
574
668
  baseUrl: this.config.baseUrl || "http://localhost:3000",
575
669
  method: "POST",
576
- path: "/api/users/sync",
670
+ path: "/api/admin/invites",
577
671
  config: this.config,
578
672
  retry: {
579
673
  attempts: 3,
@@ -589,14 +683,14 @@ var UsersService = class extends BaseService {
589
683
  return this.client.call(request);
590
684
  }
591
685
  /**
592
- * Get current user
593
- * Get the currently authenticated user's profile and usage information
686
+ * Get invite system statistics
687
+ * Aggregate statistics for the invite system
594
688
  */
595
- async getCurrentUser() {
689
+ async adminGetInviteStats() {
596
690
  const request = new Request({
597
691
  baseUrl: this.config.baseUrl || "http://localhost:3000",
598
692
  method: "GET",
599
- path: "/api/users/me",
693
+ path: "/api/admin/invites/stats",
600
694
  config: this.config,
601
695
  retry: {
602
696
  attempts: 3,
@@ -609,15 +703,15 @@ var UsersService = class extends BaseService {
609
703
  return this.client.call(request);
610
704
  }
611
705
  /**
612
- * Update current user
613
- * Update the currently authenticated user's profile
614
- * @param body - Request body
706
+ * Get invite code details
707
+ * Get details for a single invite code including redemptions
708
+ * @param code - The invite code
615
709
  */
616
- async updateCurrentUser(options) {
710
+ async adminGetInviteCode(code) {
617
711
  const request = new Request({
618
712
  baseUrl: this.config.baseUrl || "http://localhost:3000",
619
- method: "PATCH",
620
- path: "/api/users/me",
713
+ method: "GET",
714
+ path: "/api/admin/invites/{code}",
621
715
  config: this.config,
622
716
  retry: {
623
717
  attempts: 3,
@@ -627,20 +721,28 @@ var UsersService = class extends BaseService {
627
721
  backoffFactor: 2
628
722
  }
629
723
  });
630
- if (options?.body !== void 0) {
631
- request.addBody(options?.body);
632
- }
724
+ request.addPathParam("code", {
725
+ key: "code",
726
+ value: code,
727
+ explode: false,
728
+ encode: true,
729
+ style: "simple",
730
+ isLimit: false,
731
+ isOffset: false,
732
+ isCursor: false
733
+ });
633
734
  return this.client.call(request);
634
735
  }
635
736
  /**
636
- * Get current user's usage
637
- * Get the currently authenticated user's memory usage statistics
737
+ * Revoke an invite code
738
+ * Revoke an invite code. Existing accounts created with this code are unaffected.
739
+ * @param code -
638
740
  */
639
- async getCurrentUserUsage() {
741
+ async adminRevokeInviteCode(code) {
640
742
  const request = new Request({
641
743
  baseUrl: this.config.baseUrl || "http://localhost:3000",
642
- method: "GET",
643
- path: "/api/users/me/usage",
744
+ method: "DELETE",
745
+ path: "/api/admin/invites/{code}",
644
746
  config: this.config,
645
747
  retry: {
646
748
  attempts: 3,
@@ -650,21 +752,27 @@ var UsersService = class extends BaseService {
650
752
  backoffFactor: 2
651
753
  }
652
754
  });
755
+ request.addPathParam("code", {
756
+ key: "code",
757
+ value: code,
758
+ explode: false,
759
+ encode: true,
760
+ style: "simple",
761
+ isLimit: false,
762
+ isOffset: false,
763
+ isCursor: false
764
+ });
653
765
  return this.client.call(request);
654
766
  }
655
767
  /**
656
- * Export all user data
657
- * Export all user data as a JSON archive. Includes profile, memories,
658
- conversations, facts, and patterns. Supports GDPR Article 20
659
- (right to data portability). Sensitive fields (Stripe customer ID,
660
- WorkOS ID, embeddings) are excluded.
661
-
662
- */
663
- async exportUserData() {
768
+ * Get gate status with audit info
769
+ * Get current invite gate state with audit information
770
+ */
771
+ async adminGetGateStatus() {
664
772
  const request = new Request({
665
773
  baseUrl: this.config.baseUrl || "http://localhost:3000",
666
774
  method: "GET",
667
- path: "/api/users/me/export",
775
+ path: "/api/admin/gate",
668
776
  config: this.config,
669
777
  retry: {
670
778
  attempts: 3,
@@ -677,18 +785,17 @@ var UsersService = class extends BaseService {
677
785
  return this.client.call(request);
678
786
  }
679
787
  /**
680
- * Initiate account deletion
681
- * Schedule the current user's account for deletion after a 7-day grace period.
682
- Requires email confirmation. Immediately revokes API keys and cancels
683
- any active subscription. The account enters read-only mode.
788
+ * Toggle invite gate
789
+ * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
790
+ When disabled (false), registration is open. Takes effect immediately.
684
791
 
685
792
  * @param body - Request body
686
793
  */
687
- async initiateAccountDeletion(body) {
794
+ async adminSetGateStatus(body) {
688
795
  const request = new Request({
689
796
  baseUrl: this.config.baseUrl || "http://localhost:3000",
690
797
  method: "POST",
691
- path: "/api/users/me/deletion",
798
+ path: "/api/admin/gate",
692
799
  config: this.config,
693
800
  retry: {
694
801
  attempts: 3,
@@ -703,18 +810,19 @@ var UsersService = class extends BaseService {
703
810
  }
704
811
  return this.client.call(request);
705
812
  }
813
+ };
814
+
815
+ // src/services/api-keys-service.ts
816
+ var ApiKeysService = class extends BaseService {
706
817
  /**
707
- * Cancel account deletion
708
- * Cancel a pending account deletion during the grace period.
709
- Note: Previously revoked API keys are not restored — new keys must be created.
710
- Stripe subscription may need manual reactivation via the billing portal.
711
-
712
- */
713
- async cancelAccountDeletion() {
818
+ * Get user information for current API key
819
+ * Debug endpoint to retrieve user ID and authentication method from the current API key
820
+ */
821
+ async debugUser() {
714
822
  const request = new Request({
715
823
  baseUrl: this.config.baseUrl || "http://localhost:3000",
716
- method: "DELETE",
717
- path: "/api/users/me/deletion",
824
+ method: "GET",
825
+ path: "/api/apikeys/debug-user",
718
826
  config: this.config,
719
827
  retry: {
720
828
  attempts: 3,
@@ -727,15 +835,14 @@ var UsersService = class extends BaseService {
727
835
  return this.client.call(request);
728
836
  }
729
837
  /**
730
- * Get user by ID
731
- * Get a user by their internal ID (admin only)
732
- * @param id -
838
+ * List API keys
839
+ * List all API keys for the authenticated user
733
840
  */
734
- async getUserById(id) {
841
+ async listApiKeys() {
735
842
  const request = new Request({
736
843
  baseUrl: this.config.baseUrl || "http://localhost:3000",
737
844
  method: "GET",
738
- path: "/api/users/{id}",
845
+ path: "/api/apikeys",
739
846
  config: this.config,
740
847
  retry: {
741
848
  attempts: 3,
@@ -745,35 +852,18 @@ var UsersService = class extends BaseService {
745
852
  backoffFactor: 2
746
853
  }
747
854
  });
748
- request.addPathParam("id", {
749
- key: "id",
750
- value: id,
751
- explode: false,
752
- encode: true,
753
- style: "simple",
754
- isLimit: false,
755
- isOffset: false,
756
- isCursor: false
757
- });
758
855
  return this.client.call(request);
759
856
  }
760
- };
761
-
762
- // src/services/topics-service.ts
763
- var TopicsService = class extends BaseService {
764
857
  /**
765
- * List topics
766
- * List all topics with pagination
767
- * @param limit - Maximum number of topics to return
768
- * @param offset - Number of topics to skip
769
- * @param sortBy - Field to sort topics by
770
- * @param order - Sort order
858
+ * Create API key
859
+ * Create a new API key for the authenticated user
860
+ * @param body - Request body
771
861
  */
772
- async listTopics(options) {
862
+ async createApiKey(options) {
773
863
  const request = new Request({
774
864
  baseUrl: this.config.baseUrl || "http://localhost:3000",
775
- method: "GET",
776
- path: "/api/topics",
865
+ method: "POST",
866
+ path: "/api/apikeys",
777
867
  config: this.config,
778
868
  retry: {
779
869
  attempts: 3,
@@ -783,13 +873,76 @@ var TopicsService = class extends BaseService {
783
873
  backoffFactor: 2
784
874
  }
785
875
  });
786
- if (options?.limit !== void 0) {
787
- request.addQueryParam("limit", {
788
- key: "limit",
789
- value: options.limit,
790
- explode: false,
791
- encode: true,
792
- style: "form",
876
+ if (options?.body !== void 0) {
877
+ request.addBody(options?.body);
878
+ }
879
+ return this.client.call(request);
880
+ }
881
+ /**
882
+ * Delete API key
883
+ * Delete (revoke) an API key by its ID
884
+ * @param id - The API key ID
885
+ */
886
+ async deleteApiKey(id) {
887
+ const request = new Request({
888
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
889
+ method: "DELETE",
890
+ path: "/api/apikeys/{id}",
891
+ config: this.config,
892
+ retry: {
893
+ attempts: 3,
894
+ delayMs: 150,
895
+ maxDelayMs: 5e3,
896
+ jitterMs: 50,
897
+ backoffFactor: 2
898
+ }
899
+ });
900
+ request.addPathParam("id", {
901
+ key: "id",
902
+ value: id,
903
+ explode: false,
904
+ encode: true,
905
+ style: "simple",
906
+ isLimit: false,
907
+ isOffset: false,
908
+ isCursor: false
909
+ });
910
+ return this.client.call(request);
911
+ }
912
+ };
913
+
914
+ // src/services/artifacts-service.ts
915
+ var ArtifactsService = class extends BaseService {
916
+ /**
917
+ * List artifacts
918
+ * List all artifacts for the authenticated user with optional filters
919
+ * @param limit - Maximum number of artifacts to return
920
+ * @param offset - Number of artifacts to skip
921
+ * @param memoryId - Filter by memory ID
922
+ * @param conversationId - Filter by conversation ID
923
+ * @param type - Filter by artifact type
924
+ */
925
+ async listArtifacts(options) {
926
+ const request = new Request({
927
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
928
+ method: "GET",
929
+ path: "/api/artifacts",
930
+ config: this.config,
931
+ retry: {
932
+ attempts: 3,
933
+ delayMs: 150,
934
+ maxDelayMs: 5e3,
935
+ jitterMs: 50,
936
+ backoffFactor: 2
937
+ }
938
+ });
939
+ if (options?.limit !== void 0) {
940
+ request.addQueryParam("limit", {
941
+ key: "limit",
942
+ value: options.limit,
943
+ explode: false,
944
+ encode: true,
945
+ style: "form",
793
946
  isLimit: true,
794
947
  isOffset: false,
795
948
  isCursor: false
@@ -807,10 +960,10 @@ var TopicsService = class extends BaseService {
807
960
  isCursor: false
808
961
  });
809
962
  }
810
- if (options?.sortBy !== void 0) {
811
- request.addQueryParam("sortBy", {
812
- key: "sortBy",
813
- value: options.sortBy,
963
+ if (options?.memoryId !== void 0) {
964
+ request.addQueryParam("memoryId", {
965
+ key: "memoryId",
966
+ value: options.memoryId,
814
967
  explode: false,
815
968
  encode: true,
816
969
  style: "form",
@@ -819,10 +972,22 @@ var TopicsService = class extends BaseService {
819
972
  isCursor: false
820
973
  });
821
974
  }
822
- if (options?.order !== void 0) {
823
- request.addQueryParam("order", {
824
- key: "order",
825
- value: options.order,
975
+ if (options?.conversationId !== void 0) {
976
+ request.addQueryParam("conversationId", {
977
+ key: "conversationId",
978
+ value: options.conversationId,
979
+ explode: false,
980
+ encode: true,
981
+ style: "form",
982
+ isLimit: false,
983
+ isOffset: false,
984
+ isCursor: false
985
+ });
986
+ }
987
+ if (options?.type !== void 0) {
988
+ request.addQueryParam("type", {
989
+ key: "type",
990
+ value: options.type,
826
991
  explode: false,
827
992
  encode: true,
828
993
  style: "form",
@@ -834,15 +999,39 @@ var TopicsService = class extends BaseService {
834
999
  return this.client.call(request);
835
1000
  }
836
1001
  /**
837
- * Get topic by ID
838
- * Retrieve a specific topic by its ID
839
- * @param id - The topic ID
1002
+ * Create artifact
1003
+ * Create a new artifact for the authenticated user
1004
+ * @param body - Request body
840
1005
  */
841
- async getTopicById(id) {
1006
+ async createArtifact(body) {
1007
+ const request = new Request({
1008
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1009
+ method: "POST",
1010
+ path: "/api/artifacts",
1011
+ config: this.config,
1012
+ retry: {
1013
+ attempts: 3,
1014
+ delayMs: 150,
1015
+ maxDelayMs: 5e3,
1016
+ jitterMs: 50,
1017
+ backoffFactor: 2
1018
+ }
1019
+ });
1020
+ if (body !== void 0) {
1021
+ request.addBody(body);
1022
+ }
1023
+ return this.client.call(request);
1024
+ }
1025
+ /**
1026
+ * Get artifact by ID
1027
+ * Retrieve a specific artifact by its ID
1028
+ * @param id - The artifact ID
1029
+ */
1030
+ async getArtifactById(id) {
842
1031
  const request = new Request({
843
1032
  baseUrl: this.config.baseUrl || "http://localhost:3000",
844
1033
  method: "GET",
845
- path: "/api/topics/{id}",
1034
+ path: "/api/artifacts/{id}",
846
1035
  config: this.config,
847
1036
  retry: {
848
1037
  attempts: 3,
@@ -865,15 +1054,15 @@ var TopicsService = class extends BaseService {
865
1054
  return this.client.call(request);
866
1055
  }
867
1056
  /**
868
- * Merge topics
869
- * Merge two topics into one
870
- * @param body - Request body
1057
+ * Delete artifact
1058
+ * Delete an artifact by its ID
1059
+ * @param id - The artifact ID
871
1060
  */
872
- async mergeTopics(body) {
1061
+ async deleteArtifact(id) {
873
1062
  const request = new Request({
874
1063
  baseUrl: this.config.baseUrl || "http://localhost:3000",
875
- method: "POST",
876
- path: "/api/topics/merge",
1064
+ method: "DELETE",
1065
+ path: "/api/artifacts/{id}",
877
1066
  config: this.config,
878
1067
  retry: {
879
1068
  attempts: 3,
@@ -883,21 +1072,29 @@ var TopicsService = class extends BaseService {
883
1072
  backoffFactor: 2
884
1073
  }
885
1074
  });
886
- if (body !== void 0) {
887
- request.addBody(body);
888
- }
1075
+ request.addPathParam("id", {
1076
+ key: "id",
1077
+ value: id,
1078
+ explode: false,
1079
+ encode: true,
1080
+ style: "simple",
1081
+ isLimit: false,
1082
+ isOffset: false,
1083
+ isCursor: false
1084
+ });
889
1085
  return this.client.call(request);
890
1086
  }
891
1087
  /**
892
- * Discover related topics
893
- * Discover topics related to a given topic
1088
+ * Update artifact
1089
+ * Update an existing artifact with partial data
1090
+ * @param id - The artifact ID
894
1091
  * @param body - Request body
895
1092
  */
896
- async discoverRelatedTopics(body) {
1093
+ async updateArtifact(id, body) {
897
1094
  const request = new Request({
898
1095
  baseUrl: this.config.baseUrl || "http://localhost:3000",
899
- method: "POST",
900
- path: "/api/topics/discover-related",
1096
+ method: "PATCH",
1097
+ path: "/api/artifacts/{id}",
901
1098
  config: this.config,
902
1099
  retry: {
903
1100
  attempts: 3,
@@ -907,21 +1104,55 @@ var TopicsService = class extends BaseService {
907
1104
  backoffFactor: 2
908
1105
  }
909
1106
  });
1107
+ request.addPathParam("id", {
1108
+ key: "id",
1109
+ value: id,
1110
+ explode: false,
1111
+ encode: true,
1112
+ style: "simple",
1113
+ isLimit: false,
1114
+ isOffset: false,
1115
+ isCursor: false
1116
+ });
910
1117
  if (body !== void 0) {
911
1118
  request.addBody(body);
912
1119
  }
913
1120
  return this.client.call(request);
914
1121
  }
1122
+ };
1123
+
1124
+ // src/services/billing-service.ts
1125
+ var BillingService = class extends BaseService {
915
1126
  /**
916
- * Calculate topic similarity
917
- * Calculate similarity score between two topics
1127
+ * Get billing overview
1128
+ * Get subscription, payment method, and upcoming invoice information
1129
+ */
1130
+ async getBillingOverview() {
1131
+ const request = new Request({
1132
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1133
+ method: "GET",
1134
+ path: "/api/billing/overview",
1135
+ config: this.config,
1136
+ retry: {
1137
+ attempts: 3,
1138
+ delayMs: 150,
1139
+ maxDelayMs: 5e3,
1140
+ jitterMs: 50,
1141
+ backoffFactor: 2
1142
+ }
1143
+ });
1144
+ return this.client.call(request);
1145
+ }
1146
+ /**
1147
+ * Create checkout session
1148
+ * Create a Stripe checkout session for subscription upgrade
918
1149
  * @param body - Request body
919
1150
  */
920
- async calculateTopicSimilarity(body) {
1151
+ async createCheckoutSession(body) {
921
1152
  const request = new Request({
922
1153
  baseUrl: this.config.baseUrl || "http://localhost:3000",
923
1154
  method: "POST",
924
- path: "/api/topics/similarity",
1155
+ path: "/api/billing/checkout",
925
1156
  config: this.config,
926
1157
  retry: {
927
1158
  attempts: 3,
@@ -937,15 +1168,15 @@ var TopicsService = class extends BaseService {
937
1168
  return this.client.call(request);
938
1169
  }
939
1170
  /**
940
- * Find similar topics
941
- * Find topics similar to a given topic
1171
+ * Create billing portal session
1172
+ * Create a Stripe billing portal session for managing subscription
942
1173
  * @param body - Request body
943
1174
  */
944
- async findSimilarTopics(body) {
1175
+ async createPortalSession(body) {
945
1176
  const request = new Request({
946
1177
  baseUrl: this.config.baseUrl || "http://localhost:3000",
947
1178
  method: "POST",
948
- path: "/api/topics/similar",
1179
+ path: "/api/billing/portal",
949
1180
  config: this.config,
950
1181
  retry: {
951
1182
  attempts: 3,
@@ -961,15 +1192,14 @@ var TopicsService = class extends BaseService {
961
1192
  return this.client.call(request);
962
1193
  }
963
1194
  /**
964
- * Cluster topics
965
- * Cluster topics using community detection algorithms
966
- * @param body - Request body
1195
+ * Get current subscription
1196
+ * Get the current subscription details for the authenticated user
967
1197
  */
968
- async clusterTopics(options) {
1198
+ async getSubscription() {
969
1199
  const request = new Request({
970
1200
  baseUrl: this.config.baseUrl || "http://localhost:3000",
971
- method: "POST",
972
- path: "/api/topics/cluster",
1201
+ method: "GET",
1202
+ path: "/api/billing/subscription",
973
1203
  config: this.config,
974
1204
  retry: {
975
1205
  attempts: 3,
@@ -979,21 +1209,18 @@ var TopicsService = class extends BaseService {
979
1209
  backoffFactor: 2
980
1210
  }
981
1211
  });
982
- if (options?.body !== void 0) {
983
- request.addBody(options?.body);
984
- }
985
1212
  return this.client.call(request);
986
1213
  }
987
1214
  /**
988
- * Detect communities
989
- * Detect communities in the topic graph using specified algorithm
1215
+ * Cancel subscription
1216
+ * Cancel the current subscription at the end of the billing period
990
1217
  * @param body - Request body
991
1218
  */
992
- async detectCommunities(options) {
1219
+ async cancelSubscription(options) {
993
1220
  const request = new Request({
994
1221
  baseUrl: this.config.baseUrl || "http://localhost:3000",
995
1222
  method: "POST",
996
- path: "/api/topics/detect-communities",
1223
+ path: "/api/billing/subscription/cancel",
997
1224
  config: this.config,
998
1225
  retry: {
999
1226
  attempts: 3,
@@ -1009,15 +1236,15 @@ var TopicsService = class extends BaseService {
1009
1236
  return this.client.call(request);
1010
1237
  }
1011
1238
  /**
1012
- * Search topics
1013
- * Search topics by query string using fulltext search
1239
+ * Reactivate subscription
1240
+ * Reactivate a subscription that was scheduled for cancellation
1014
1241
  * @param body - Request body
1015
1242
  */
1016
- async searchTopics(body) {
1243
+ async reactivateSubscription(options) {
1017
1244
  const request = new Request({
1018
1245
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1019
1246
  method: "POST",
1020
- path: "/api/topics/search",
1247
+ path: "/api/billing/subscription/reactivate",
1021
1248
  config: this.config,
1022
1249
  retry: {
1023
1250
  attempts: 3,
@@ -1027,44 +1254,21 @@ var TopicsService = class extends BaseService {
1027
1254
  backoffFactor: 2
1028
1255
  }
1029
1256
  });
1030
- if (body !== void 0) {
1031
- request.addBody(body);
1257
+ if (options?.body !== void 0) {
1258
+ request.addBody(options?.body);
1032
1259
  }
1033
1260
  return this.client.call(request);
1034
1261
  }
1035
- };
1036
-
1037
- // src/services/system-service.ts
1038
- var SystemService = class extends BaseService {
1039
1262
  /**
1040
- * Get system health status
1041
- * Get the current health status of the system including database connectivity
1042
- */
1043
- async getSystemHealth() {
1044
- const request = new Request({
1045
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1046
- method: "GET",
1047
- path: "/api/system/health",
1048
- config: this.config,
1049
- retry: {
1050
- attempts: 3,
1051
- delayMs: 150,
1052
- maxDelayMs: 5e3,
1053
- jitterMs: 50,
1054
- backoffFactor: 2
1055
- }
1056
- });
1057
- return this.client.call(request);
1058
- }
1059
- /**
1060
- * Get context status
1061
- * Get database statistics and context information
1263
+ * List invoices
1264
+ * Get a list of invoices for the authenticated user
1265
+ * @param limit - Maximum number of invoices to return
1062
1266
  */
1063
- async getContextStatus() {
1267
+ async listInvoices(options) {
1064
1268
  const request = new Request({
1065
1269
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1066
1270
  method: "GET",
1067
- path: "/api/system/context/status",
1271
+ path: "/api/billing/invoices",
1068
1272
  config: this.config,
1069
1273
  retry: {
1070
1274
  attempts: 3,
@@ -1074,17 +1278,29 @@ var SystemService = class extends BaseService {
1074
1278
  backoffFactor: 2
1075
1279
  }
1076
1280
  });
1281
+ if (options?.limit !== void 0) {
1282
+ request.addQueryParam("limit", {
1283
+ key: "limit",
1284
+ value: options.limit,
1285
+ explode: false,
1286
+ encode: true,
1287
+ style: "form",
1288
+ isLimit: true,
1289
+ isOffset: false,
1290
+ isCursor: false
1291
+ });
1292
+ }
1077
1293
  return this.client.call(request);
1078
1294
  }
1079
1295
  /**
1080
- * Get feature flags
1081
- * Get all feature flags for the authenticated user
1296
+ * List payment methods
1297
+ * Get a list of payment methods for the authenticated user
1082
1298
  */
1083
- async getFeatureFlags() {
1299
+ async listPaymentMethods() {
1084
1300
  const request = new Request({
1085
1301
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1086
1302
  method: "GET",
1087
- path: "/api/system/feature-flags",
1303
+ path: "/api/billing/payment-methods",
1088
1304
  config: this.config,
1089
1305
  retry: {
1090
1306
  attempts: 3,
@@ -1097,15 +1313,16 @@ var SystemService = class extends BaseService {
1097
1313
  return this.client.call(request);
1098
1314
  }
1099
1315
  /**
1100
- * Evaluate feature flag
1101
- * Evaluate a specific feature flag for the authenticated user
1316
+ * Set default payment method
1317
+ * Set a payment method as the default for future payments
1318
+ * @param id - The payment method ID
1102
1319
  * @param body - Request body
1103
1320
  */
1104
- async evaluateFeatureFlag(body) {
1321
+ async setDefaultPaymentMethod(id, options) {
1105
1322
  const request = new Request({
1106
1323
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1107
1324
  method: "POST",
1108
- path: "/api/system/feature-flags/evaluate",
1325
+ path: "/api/billing/payment-methods/{id}/default",
1109
1326
  config: this.config,
1110
1327
  retry: {
1111
1328
  attempts: 3,
@@ -1115,22 +1332,31 @@ var SystemService = class extends BaseService {
1115
1332
  backoffFactor: 2
1116
1333
  }
1117
1334
  });
1118
- if (body !== void 0) {
1119
- request.addBody(body);
1335
+ request.addPathParam("id", {
1336
+ key: "id",
1337
+ value: id,
1338
+ explode: false,
1339
+ encode: true,
1340
+ style: "simple",
1341
+ isLimit: false,
1342
+ isOffset: false,
1343
+ isCursor: false
1344
+ });
1345
+ if (options?.body !== void 0) {
1346
+ request.addBody(options?.body);
1120
1347
  }
1121
1348
  return this.client.call(request);
1122
1349
  }
1123
1350
  /**
1124
- * Analyze memory quality distribution
1125
- * Analyze the quality distribution of memories for the authenticated user
1126
- * @param includeDetails - Include detailed pruning candidate information
1127
- * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
1351
+ * Delete payment method
1352
+ * Remove a payment method from the account
1353
+ * @param id - The payment method ID
1128
1354
  */
1129
- async analyzeMemoryQuality(options) {
1355
+ async deletePaymentMethod(id) {
1130
1356
  const request = new Request({
1131
1357
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1132
- method: "GET",
1133
- path: "/api/system/memory/quality",
1358
+ method: "DELETE",
1359
+ path: "/api/billing/payment-methods/{id}",
1134
1360
  config: this.config,
1135
1361
  retry: {
1136
1362
  attempts: 3,
@@ -1140,66 +1366,28 @@ var SystemService = class extends BaseService {
1140
1366
  backoffFactor: 2
1141
1367
  }
1142
1368
  });
1143
- if (options?.includeDetails !== void 0) {
1144
- request.addQueryParam("includeDetails", {
1145
- key: "includeDetails",
1146
- value: options.includeDetails,
1147
- explode: false,
1148
- encode: true,
1149
- style: "form",
1150
- isLimit: false,
1151
- isOffset: false,
1152
- isCursor: false
1153
- });
1154
- }
1155
- if (options?.minQualityThreshold !== void 0) {
1156
- request.addQueryParam("minQualityThreshold", {
1157
- key: "minQualityThreshold",
1158
- value: options.minQualityThreshold,
1159
- explode: false,
1160
- encode: true,
1161
- style: "form",
1162
- isLimit: false,
1163
- isOffset: false,
1164
- isCursor: false
1165
- });
1166
- }
1369
+ request.addPathParam("id", {
1370
+ key: "id",
1371
+ value: id,
1372
+ explode: false,
1373
+ encode: true,
1374
+ style: "simple",
1375
+ isLimit: false,
1376
+ isOffset: false,
1377
+ isCursor: false
1378
+ });
1167
1379
  return this.client.call(request);
1168
1380
  }
1169
1381
  /**
1170
- * Prune low-quality memories
1171
- * Prune (soft delete) low-quality memories for the authenticated user
1382
+ * Stripe webhook endpoint
1383
+ * Receive and process Stripe webhook events
1172
1384
  * @param body - Request body
1173
1385
  */
1174
- async pruneMemories(options) {
1386
+ async stripeWebhook(body) {
1175
1387
  const request = new Request({
1176
1388
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1177
1389
  method: "POST",
1178
- path: "/api/system/memory/prune",
1179
- config: this.config,
1180
- retry: {
1181
- attempts: 3,
1182
- delayMs: 150,
1183
- maxDelayMs: 5e3,
1184
- jitterMs: 50,
1185
- backoffFactor: 2
1186
- }
1187
- });
1188
- if (options?.body !== void 0) {
1189
- request.addBody(options?.body);
1190
- }
1191
- return this.client.call(request);
1192
- }
1193
- /**
1194
- * Get OpenAPI specification
1195
- * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
1196
- * @param noCache - Bypass cache and regenerate specification
1197
- */
1198
- async getOpenApiSpec(options) {
1199
- const request = new Request({
1200
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1201
- method: "GET",
1202
- path: "/api/openapi.json",
1390
+ path: "/api/billing/webhooks",
1203
1391
  config: this.config,
1204
1392
  retry: {
1205
1393
  attempts: 3,
@@ -1209,35 +1397,30 @@ var SystemService = class extends BaseService {
1209
1397
  backoffFactor: 2
1210
1398
  }
1211
1399
  });
1212
- if (options?.noCache !== void 0) {
1213
- request.addQueryParam("noCache", {
1214
- key: "noCache",
1215
- value: options.noCache,
1216
- explode: false,
1217
- encode: true,
1218
- style: "form",
1219
- isLimit: false,
1220
- isOffset: false,
1221
- isCursor: false
1222
- });
1400
+ if (body !== void 0) {
1401
+ request.addBody(body);
1223
1402
  }
1224
1403
  return this.client.call(request);
1225
1404
  }
1226
1405
  };
1227
1406
 
1228
- // src/services/patterns-service.ts
1229
- var PatternsService = class extends BaseService {
1407
+ // src/services/conversations-service.ts
1408
+ var ConversationsService = class extends BaseService {
1230
1409
  /**
1231
- * List patterns
1232
- * List all patterns for the authenticated user
1233
- * @param limit - Maximum number of patterns to return
1234
- * @param offset - Number of patterns to skip
1410
+ * List conversations
1411
+ * List all conversations for the authenticated user with pagination
1412
+ * @param limit - Maximum number of conversations to return
1413
+ * @param offset - Number of conversations to skip
1414
+ * @param since - Return only conversations created after this timestamp (ISO 8601 format)
1415
+ * @param sortBy - Field to sort conversations by
1416
+ * @param order - Sort order
1417
+ * @param hasMemories - When true, return only conversations that contain at least one memory
1235
1418
  */
1236
- async listPatterns(options) {
1419
+ async listConversations(options) {
1237
1420
  const request = new Request({
1238
1421
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1239
1422
  method: "GET",
1240
- path: "/api/patterns",
1423
+ path: "/api/conversations",
1241
1424
  config: this.config,
1242
1425
  retry: {
1243
1426
  attempts: 3,
@@ -1271,18 +1454,66 @@ var PatternsService = class extends BaseService {
1271
1454
  isCursor: false
1272
1455
  });
1273
1456
  }
1457
+ if (options?.since !== void 0) {
1458
+ request.addQueryParam("since", {
1459
+ key: "since",
1460
+ value: options.since,
1461
+ explode: false,
1462
+ encode: true,
1463
+ style: "form",
1464
+ isLimit: false,
1465
+ isOffset: false,
1466
+ isCursor: false
1467
+ });
1468
+ }
1469
+ if (options?.sortBy !== void 0) {
1470
+ request.addQueryParam("sortBy", {
1471
+ key: "sortBy",
1472
+ value: options.sortBy,
1473
+ explode: false,
1474
+ encode: true,
1475
+ style: "form",
1476
+ isLimit: false,
1477
+ isOffset: false,
1478
+ isCursor: false
1479
+ });
1480
+ }
1481
+ if (options?.order !== void 0) {
1482
+ request.addQueryParam("order", {
1483
+ key: "order",
1484
+ value: options.order,
1485
+ explode: false,
1486
+ encode: true,
1487
+ style: "form",
1488
+ isLimit: false,
1489
+ isOffset: false,
1490
+ isCursor: false
1491
+ });
1492
+ }
1493
+ if (options?.hasMemories !== void 0) {
1494
+ request.addQueryParam("hasMemories", {
1495
+ key: "hasMemories",
1496
+ value: options.hasMemories,
1497
+ explode: false,
1498
+ encode: true,
1499
+ style: "form",
1500
+ isLimit: false,
1501
+ isOffset: false,
1502
+ isCursor: false
1503
+ });
1504
+ }
1274
1505
  return this.client.call(request);
1275
1506
  }
1276
1507
  /**
1277
- * Compile patterns
1278
- * Compile patterns from user's memories
1508
+ * Create conversation
1509
+ * Create a new conversation for the authenticated user
1279
1510
  * @param body - Request body
1280
1511
  */
1281
- async compilePatterns(options) {
1512
+ async createConversation(body) {
1282
1513
  const request = new Request({
1283
1514
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1284
1515
  method: "POST",
1285
- path: "/api/patterns/compile",
1516
+ path: "/api/conversations",
1286
1517
  config: this.config,
1287
1518
  retry: {
1288
1519
  attempts: 3,
@@ -1292,21 +1523,21 @@ var PatternsService = class extends BaseService {
1292
1523
  backoffFactor: 2
1293
1524
  }
1294
1525
  });
1295
- if (options?.body !== void 0) {
1296
- request.addBody(options?.body);
1526
+ if (body !== void 0) {
1527
+ request.addBody(body);
1297
1528
  }
1298
1529
  return this.client.call(request);
1299
1530
  }
1300
1531
  /**
1301
- * Detect behavioral patterns
1302
- * Run pattern detection algorithms to identify recurring behavioral patterns
1303
- * @param body - Request body
1532
+ * Get conversation summary
1533
+ * Retrieve a conversation summary by its ID
1534
+ * @param conversationId - The conversation ID
1304
1535
  */
1305
- async detectPatterns(options) {
1536
+ async getConversationSummary(conversationId) {
1306
1537
  const request = new Request({
1307
1538
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1308
- method: "POST",
1309
- path: "/api/patterns/detect",
1539
+ method: "GET",
1540
+ path: "/api/conversations/{conversationId}",
1310
1541
  config: this.config,
1311
1542
  retry: {
1312
1543
  attempts: 3,
@@ -1316,21 +1547,28 @@ var PatternsService = class extends BaseService {
1316
1547
  backoffFactor: 2
1317
1548
  }
1318
1549
  });
1319
- if (options?.body !== void 0) {
1320
- request.addBody(options?.body);
1321
- }
1322
- return this.client.call(request);
1323
- }
1550
+ request.addPathParam("conversationId", {
1551
+ key: "conversationId",
1552
+ value: conversationId,
1553
+ explode: false,
1554
+ encode: true,
1555
+ style: "simple",
1556
+ isLimit: false,
1557
+ isOffset: false,
1558
+ isCursor: false
1559
+ });
1560
+ return this.client.call(request);
1561
+ }
1324
1562
  /**
1325
- * Analyze pattern trends
1326
- * Analyze pattern trends, correlations, and generate insights
1327
- * @param body - Request body
1563
+ * Delete conversation
1564
+ * Delete a conversation and soft-delete all associated memories
1565
+ * @param conversationId - The conversation ID
1328
1566
  */
1329
- async analyzePatterns(options) {
1567
+ async deleteConversation(conversationId) {
1330
1568
  const request = new Request({
1331
1569
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1332
- method: "POST",
1333
- path: "/api/patterns/analyze",
1570
+ method: "DELETE",
1571
+ path: "/api/conversations/{conversationId}",
1334
1572
  config: this.config,
1335
1573
  retry: {
1336
1574
  attempts: 3,
@@ -1340,22 +1578,28 @@ var PatternsService = class extends BaseService {
1340
1578
  backoffFactor: 2
1341
1579
  }
1342
1580
  });
1343
- if (options?.body !== void 0) {
1344
- request.addBody(options?.body);
1345
- }
1581
+ request.addPathParam("conversationId", {
1582
+ key: "conversationId",
1583
+ value: conversationId,
1584
+ explode: false,
1585
+ encode: true,
1586
+ style: "simple",
1587
+ isLimit: false,
1588
+ isOffset: false,
1589
+ isCursor: false
1590
+ });
1346
1591
  return this.client.call(request);
1347
1592
  }
1348
1593
  /**
1349
- * Update pattern
1350
- * Update an existing pattern with partial data
1351
- * @param id - The pattern ID
1352
- * @param body - Request body
1594
+ * Get conversation timeline
1595
+ * Get all memories in a conversation in chronological order
1596
+ * @param conversationId - The conversation ID
1353
1597
  */
1354
- async updatePattern(id, body) {
1598
+ async getConversationTimeline(conversationId) {
1355
1599
  const request = new Request({
1356
1600
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1357
- method: "PATCH",
1358
- path: "/api/patterns/{id}",
1601
+ method: "GET",
1602
+ path: "/api/conversations/{conversationId}/timeline",
1359
1603
  config: this.config,
1360
1604
  retry: {
1361
1605
  attempts: 3,
@@ -1365,9 +1609,9 @@ var PatternsService = class extends BaseService {
1365
1609
  backoffFactor: 2
1366
1610
  }
1367
1611
  });
1368
- request.addPathParam("id", {
1369
- key: "id",
1370
- value: id,
1612
+ request.addPathParam("conversationId", {
1613
+ key: "conversationId",
1614
+ value: conversationId,
1371
1615
  explode: false,
1372
1616
  encode: true,
1373
1617
  style: "simple",
@@ -1375,21 +1619,18 @@ var PatternsService = class extends BaseService {
1375
1619
  isOffset: false,
1376
1620
  isCursor: false
1377
1621
  });
1378
- if (body !== void 0) {
1379
- request.addBody(body);
1380
- }
1381
1622
  return this.client.call(request);
1382
1623
  }
1383
1624
  /**
1384
- * Record pattern feedback
1385
- * Record feedback on a pattern
1625
+ * Search conversations
1626
+ * Search conversations by query string
1386
1627
  * @param body - Request body
1387
1628
  */
1388
- async recordPatternFeedback(body) {
1629
+ async searchConversations(body) {
1389
1630
  const request = new Request({
1390
1631
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1391
1632
  method: "POST",
1392
- path: "/api/patterns/feedback",
1633
+ path: "/api/conversations/search",
1393
1634
  config: this.config,
1394
1635
  retry: {
1395
1636
  attempts: 3,
@@ -1404,40 +1645,16 @@ var PatternsService = class extends BaseService {
1404
1645
  }
1405
1646
  return this.client.call(request);
1406
1647
  }
1407
- };
1408
-
1409
- // src/services/behavior-service.ts
1410
- var BehaviorService = class extends BaseService {
1411
- /**
1412
- * Get behavioral state
1413
- * Get current behavioral state for the authenticated user
1414
- */
1415
- async getBehavioralState() {
1416
- const request = new Request({
1417
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1418
- method: "GET",
1419
- path: "/api/patterns/behavior/state",
1420
- config: this.config,
1421
- retry: {
1422
- attempts: 3,
1423
- delayMs: 150,
1424
- maxDelayMs: 5e3,
1425
- jitterMs: 50,
1426
- backoffFactor: 2
1427
- }
1428
- });
1429
- return this.client.call(request);
1430
- }
1431
1648
  /**
1432
- * Update behavioral state
1433
- * Update or mutate behavioral state
1649
+ * Find conversations by topic
1650
+ * Find conversations that contain a specific topic
1434
1651
  * @param body - Request body
1435
1652
  */
1436
- async updateBehavioralState(options) {
1653
+ async findConversationsByTopic(body) {
1437
1654
  const request = new Request({
1438
1655
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1439
1656
  method: "POST",
1440
- path: "/api/patterns/behavior/state",
1657
+ path: "/api/conversations/by-topic",
1441
1658
  config: this.config,
1442
1659
  retry: {
1443
1660
  attempts: 3,
@@ -1447,30 +1664,27 @@ var BehaviorService = class extends BaseService {
1447
1664
  backoffFactor: 2
1448
1665
  }
1449
1666
  });
1450
- if (options?.body !== void 0) {
1451
- request.addBody(options?.body);
1667
+ if (body !== void 0) {
1668
+ request.addBody(body);
1452
1669
  }
1453
1670
  return this.client.call(request);
1454
1671
  }
1455
1672
  };
1456
1673
 
1457
- // src/services/narratives-service.ts
1458
- var NarrativesService = class extends BaseService {
1674
+ // src/services/entities-service.ts
1675
+ var EntitiesService = class extends BaseService {
1459
1676
  /**
1460
- * List narrative threads
1461
- * List all narrative threads for the authenticated user.
1462
- Narratives group related memories into coherent storylines.
1463
-
1464
- * @param limit - Maximum number of narratives to return
1465
- * @param offset - Number of narratives to skip
1466
- * @param state - Filter by narrative state
1467
- * @param topics - Comma-separated list of topics to filter by
1468
- */
1469
- async listNarratives(options) {
1677
+ * List entities
1678
+ * List all entities for the authenticated user, optionally filtered by type
1679
+ * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
1680
+ * @param limit - Maximum number of entities to return
1681
+ * @param offset - Number of entities to skip
1682
+ */
1683
+ async listEntities(options) {
1470
1684
  const request = new Request({
1471
1685
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1472
1686
  method: "GET",
1473
- path: "/api/narratives",
1687
+ path: "/api/entities",
1474
1688
  config: this.config,
1475
1689
  retry: {
1476
1690
  attempts: 3,
@@ -1480,6 +1694,18 @@ var NarrativesService = class extends BaseService {
1480
1694
  backoffFactor: 2
1481
1695
  }
1482
1696
  });
1697
+ if (options?.type !== void 0) {
1698
+ request.addQueryParam("type", {
1699
+ key: "type",
1700
+ value: options.type,
1701
+ explode: false,
1702
+ encode: true,
1703
+ style: "form",
1704
+ isLimit: false,
1705
+ isOffset: false,
1706
+ isCursor: false
1707
+ });
1708
+ }
1483
1709
  if (options?.limit !== void 0) {
1484
1710
  request.addQueryParam("limit", {
1485
1711
  key: "limit",
@@ -1504,68 +1730,18 @@ var NarrativesService = class extends BaseService {
1504
1730
  isCursor: false
1505
1731
  });
1506
1732
  }
1507
- if (options?.state !== void 0) {
1508
- request.addQueryParam("state", {
1509
- key: "state",
1510
- value: options.state,
1511
- explode: false,
1512
- encode: true,
1513
- style: "form",
1514
- isLimit: false,
1515
- isOffset: false,
1516
- isCursor: false
1517
- });
1518
- }
1519
- if (options?.topics !== void 0) {
1520
- request.addQueryParam("topics", {
1521
- key: "topics",
1522
- value: options.topics,
1523
- explode: false,
1524
- encode: true,
1525
- style: "form",
1526
- isLimit: false,
1527
- isOffset: false,
1528
- isCursor: false
1529
- });
1530
- }
1531
- return this.client.call(request);
1532
- }
1533
- /**
1534
- * Create a narrative thread
1535
- * Create a new narrative thread starting from a root memory.
1536
- Narratives help organize related memories into coherent storylines.
1537
-
1538
- * @param body - Request body
1539
- */
1540
- async createNarrative(body) {
1541
- const request = new Request({
1542
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1543
- method: "POST",
1544
- path: "/api/narratives",
1545
- config: this.config,
1546
- retry: {
1547
- attempts: 3,
1548
- delayMs: 150,
1549
- maxDelayMs: 5e3,
1550
- jitterMs: 50,
1551
- backoffFactor: 2
1552
- }
1553
- });
1554
- if (body !== void 0) {
1555
- request.addBody(body);
1556
- }
1557
1733
  return this.client.call(request);
1558
1734
  }
1559
1735
  /**
1560
- * Get a narrative thread
1561
- * Retrieve a specific narrative thread by ID
1562
- * @param id - The narrative ID
1736
+ * Get entity by ID
1737
+ * Retrieve a specific entity by its ID
1738
+ * @param id - The entity ID
1563
1739
  */
1564
- async getNarrative(id) {
1740
+ async getEntityById(id) {
1565
1741
  const request = new Request({
1566
1742
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1567
1743
  method: "GET",
1568
- path: "/api/narratives/{id}",
1744
+ path: "/api/entities/{id}",
1569
1745
  config: this.config,
1570
1746
  retry: {
1571
1747
  attempts: 3,
@@ -1588,17 +1764,17 @@ var NarrativesService = class extends BaseService {
1588
1764
  return this.client.call(request);
1589
1765
  }
1590
1766
  /**
1591
- * Delete a narrative thread
1592
- * Delete a narrative thread.
1593
- This does not delete the associated memories, only the narrative structure.
1594
-
1595
- * @param id - The narrative ID
1596
- */
1597
- async deleteNarrative(id) {
1767
+ * Get memories mentioning entity
1768
+ * Get all memories that mention a specific entity
1769
+ * @param id - The entity ID
1770
+ * @param limit - Maximum number of memories to return
1771
+ * @param offset - Number of memories to skip
1772
+ */
1773
+ async getEntityMemories(id, options) {
1598
1774
  const request = new Request({
1599
1775
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1600
- method: "DELETE",
1601
- path: "/api/narratives/{id}",
1776
+ method: "GET",
1777
+ path: "/api/entities/{id}/memories",
1602
1778
  config: this.config,
1603
1779
  retry: {
1604
1780
  attempts: 3,
@@ -1618,21 +1794,41 @@ var NarrativesService = class extends BaseService {
1618
1794
  isOffset: false,
1619
1795
  isCursor: false
1620
1796
  });
1797
+ if (options?.limit !== void 0) {
1798
+ request.addQueryParam("limit", {
1799
+ key: "limit",
1800
+ value: options.limit,
1801
+ explode: false,
1802
+ encode: true,
1803
+ style: "form",
1804
+ isLimit: true,
1805
+ isOffset: false,
1806
+ isCursor: false
1807
+ });
1808
+ }
1809
+ if (options?.offset !== void 0) {
1810
+ request.addQueryParam("offset", {
1811
+ key: "offset",
1812
+ value: options.offset,
1813
+ explode: false,
1814
+ encode: true,
1815
+ style: "form",
1816
+ isLimit: false,
1817
+ isOffset: true,
1818
+ isCursor: false
1819
+ });
1820
+ }
1621
1821
  return this.client.call(request);
1622
1822
  }
1623
1823
  /**
1624
- * Update a narrative thread
1625
- * Update a narrative thread's title, topics, or state.
1626
- Use this to resolve, reopen, or modify narratives.
1627
-
1628
- * @param id - The narrative ID
1629
- * @param body - Request body
1630
- */
1631
- async updateNarrative(id, body) {
1824
+ * Get graph health metrics
1825
+ * Returns knowledge graph health metrics including entity counts, fact counts, topic counts, and extraction coverage
1826
+ */
1827
+ async getGraphHealth() {
1632
1828
  const request = new Request({
1633
1829
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1634
- method: "PATCH",
1635
- path: "/api/narratives/{id}",
1830
+ method: "GET",
1831
+ path: "/api/entities/health",
1636
1832
  config: this.config,
1637
1833
  retry: {
1638
1834
  attempts: 3,
@@ -1642,35 +1838,25 @@ var NarrativesService = class extends BaseService {
1642
1838
  backoffFactor: 2
1643
1839
  }
1644
1840
  });
1645
- request.addPathParam("id", {
1646
- key: "id",
1647
- value: id,
1648
- explode: false,
1649
- encode: true,
1650
- style: "simple",
1651
- isLimit: false,
1652
- isOffset: false,
1653
- isCursor: false
1654
- });
1655
- if (body !== void 0) {
1656
- request.addBody(body);
1657
- }
1658
1841
  return this.client.call(request);
1659
1842
  }
1843
+ };
1844
+
1845
+ // src/services/facts-service.ts
1846
+ var FactsService = class extends BaseService {
1660
1847
  /**
1661
- * Get narrative timeline
1662
- * Get all memories in a narrative, ordered by their position in the narrative.
1663
- Each memory includes its position and effective state.
1664
-
1665
- * @param id - The narrative ID
1666
- * @param limit - Maximum number of memories to return
1667
- * @param offset - Number of memories to skip
1668
- */
1669
- async getNarrativeTimeline(id, options) {
1848
+ * List facts
1849
+ * List all facts for the authenticated user
1850
+ * @param limit - Maximum number of facts to return
1851
+ * @param offset - Number of facts to skip
1852
+ * @param sortBy - Field to sort facts by
1853
+ * @param order - Sort order
1854
+ */
1855
+ async listFacts(options) {
1670
1856
  const request = new Request({
1671
1857
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1672
1858
  method: "GET",
1673
- path: "/api/narratives/{id}/timeline",
1859
+ path: "/api/facts",
1674
1860
  config: this.config,
1675
1861
  retry: {
1676
1862
  attempts: 3,
@@ -1680,16 +1866,6 @@ var NarrativesService = class extends BaseService {
1680
1866
  backoffFactor: 2
1681
1867
  }
1682
1868
  });
1683
- request.addPathParam("id", {
1684
- key: "id",
1685
- value: id,
1686
- explode: false,
1687
- encode: true,
1688
- style: "simple",
1689
- isLimit: false,
1690
- isOffset: false,
1691
- isCursor: false
1692
- });
1693
1869
  if (options?.limit !== void 0) {
1694
1870
  request.addQueryParam("limit", {
1695
1871
  key: "limit",
@@ -1714,21 +1890,66 @@ var NarrativesService = class extends BaseService {
1714
1890
  isCursor: false
1715
1891
  });
1716
1892
  }
1893
+ if (options?.sortBy !== void 0) {
1894
+ request.addQueryParam("sortBy", {
1895
+ key: "sortBy",
1896
+ value: options.sortBy,
1897
+ explode: false,
1898
+ encode: true,
1899
+ style: "form",
1900
+ isLimit: false,
1901
+ isOffset: false,
1902
+ isCursor: false
1903
+ });
1904
+ }
1905
+ if (options?.order !== void 0) {
1906
+ request.addQueryParam("order", {
1907
+ key: "order",
1908
+ value: options.order,
1909
+ explode: false,
1910
+ encode: true,
1911
+ style: "form",
1912
+ isLimit: false,
1913
+ isOffset: false,
1914
+ isCursor: false
1915
+ });
1916
+ }
1717
1917
  return this.client.call(request);
1718
1918
  }
1719
1919
  /**
1720
- * Add a memory to a narrative
1721
- * Add an existing memory to a narrative thread.
1722
- Optionally specify a position to insert the memory at.
1723
-
1724
- * @param id - The narrative ID
1725
- * @param body - Request body
1726
- */
1727
- async addMemoryToNarrative(id, body) {
1920
+ * Create fact
1921
+ * Create a new semantic fact
1922
+ * @param body - Request body
1923
+ */
1924
+ async createFact(body) {
1728
1925
  const request = new Request({
1729
1926
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1730
1927
  method: "POST",
1731
- path: "/api/narratives/{id}/memories",
1928
+ path: "/api/facts",
1929
+ config: this.config,
1930
+ retry: {
1931
+ attempts: 3,
1932
+ delayMs: 150,
1933
+ maxDelayMs: 5e3,
1934
+ jitterMs: 50,
1935
+ backoffFactor: 2
1936
+ }
1937
+ });
1938
+ if (body !== void 0) {
1939
+ request.addBody(body);
1940
+ }
1941
+ return this.client.call(request);
1942
+ }
1943
+ /**
1944
+ * Get fact by ID
1945
+ * Retrieve a specific fact by its ID
1946
+ * @param id - The fact ID
1947
+ */
1948
+ async getFactById(id) {
1949
+ const request = new Request({
1950
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1951
+ method: "GET",
1952
+ path: "/api/facts/{id}",
1732
1953
  config: this.config,
1733
1954
  retry: {
1734
1955
  attempts: 3,
@@ -1748,24 +1969,19 @@ var NarrativesService = class extends BaseService {
1748
1969
  isOffset: false,
1749
1970
  isCursor: false
1750
1971
  });
1751
- if (body !== void 0) {
1752
- request.addBody(body);
1753
- }
1754
1972
  return this.client.call(request);
1755
1973
  }
1756
1974
  /**
1757
- * Remove a memory from a narrative
1758
- * Remove a memory from a narrative thread.
1759
- This does not delete the memory itself, only removes it from the narrative.
1760
-
1761
- * @param id - The narrative ID
1762
- * @param memoryId - The memory ID to remove
1763
- */
1764
- async removeMemoryFromNarrative(id, memoryId) {
1975
+ * Update fact
1976
+ * Update an existing fact completely
1977
+ * @param id - The fact ID
1978
+ * @param body - Request body
1979
+ */
1980
+ async updateFact(id, body) {
1765
1981
  const request = new Request({
1766
1982
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1767
- method: "DELETE",
1768
- path: "/api/narratives/{id}/memories/{memoryId}",
1983
+ method: "PUT",
1984
+ path: "/api/facts/{id}",
1769
1985
  config: this.config,
1770
1986
  retry: {
1771
1987
  attempts: 3,
@@ -1785,9 +2001,33 @@ var NarrativesService = class extends BaseService {
1785
2001
  isOffset: false,
1786
2002
  isCursor: false
1787
2003
  });
1788
- request.addPathParam("memoryId", {
1789
- key: "memoryId",
1790
- value: memoryId,
2004
+ if (body !== void 0) {
2005
+ request.addBody(body);
2006
+ }
2007
+ return this.client.call(request);
2008
+ }
2009
+ /**
2010
+ * Delete fact
2011
+ * Delete a fact by its ID
2012
+ * @param id - The fact ID
2013
+ */
2014
+ async deleteFact(id) {
2015
+ const request = new Request({
2016
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2017
+ method: "DELETE",
2018
+ path: "/api/facts/{id}",
2019
+ config: this.config,
2020
+ retry: {
2021
+ attempts: 3,
2022
+ delayMs: 150,
2023
+ maxDelayMs: 5e3,
2024
+ jitterMs: 50,
2025
+ backoffFactor: 2
2026
+ }
2027
+ });
2028
+ request.addPathParam("id", {
2029
+ key: "id",
2030
+ value: id,
1791
2031
  explode: false,
1792
2032
  encode: true,
1793
2033
  style: "simple",
@@ -1797,22 +2037,16 @@ var NarrativesService = class extends BaseService {
1797
2037
  });
1798
2038
  return this.client.call(request);
1799
2039
  }
1800
- };
1801
-
1802
- // src/services/monitoring-service.ts
1803
- var MonitoringService = class extends BaseService {
1804
2040
  /**
1805
- * Prometheus metrics endpoint
1806
- * Returns Prometheus-formatted metrics for monitoring and observability.
1807
- This endpoint is public and requires no authentication.
1808
- Designed to be scraped by Prometheus at regular intervals.
1809
-
1810
- */
1811
- async getMetrics() {
2041
+ * Search facts
2042
+ * Search semantic facts by query string
2043
+ * @param body - Request body
2044
+ */
2045
+ async searchFacts(body) {
1812
2046
  const request = new Request({
1813
2047
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1814
- method: "GET",
1815
- path: "/metrics",
2048
+ method: "POST",
2049
+ path: "/api/facts/search",
1816
2050
  config: this.config,
1817
2051
  retry: {
1818
2052
  attempts: 3,
@@ -1822,29 +2056,25 @@ var MonitoringService = class extends BaseService {
1822
2056
  backoffFactor: 2
1823
2057
  }
1824
2058
  });
2059
+ if (body !== void 0) {
2060
+ request.addBody(body);
2061
+ }
1825
2062
  return this.client.call(request);
1826
2063
  }
1827
2064
  };
1828
2065
 
1829
- // src/services/memories-service.ts
1830
- var MemoriesService = class extends BaseService {
2066
+ // src/services/graphrag-service.ts
2067
+ var GraphragService = class extends BaseService {
1831
2068
  /**
1832
- * Get memory by ID
1833
- * Retrieve a specific memory by its ID with configurable detail level.
1834
-
1835
- **Detail levels:**
1836
- - `minimal` — raw memory only, no extra queries
1837
- - `standard` (default) — adds userTopics, extractedTopics, entities, facts, relationships
1838
- - `full` — adds conversationContext (title, memoryCount, position) and relationship target previews
1839
-
1840
- * @param id - The memory ID
1841
- * @param detail - Detail level: minimal (raw memory), standard (default, + topics/entities/facts/relationships), full (+ conversation context and relationship previews)
1842
- */
1843
- async getMemoryById(id, options) {
2069
+ * Explain a GraphRAG query
2070
+ * Get explanation for a previously executed GraphRAG query result
2071
+ * @param queryId - The query ID to explain
2072
+ */
2073
+ async explainGraphRAGQuery(options) {
1844
2074
  const request = new Request({
1845
2075
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1846
2076
  method: "GET",
1847
- path: "/api/memories/{id}",
2077
+ path: "/api/graphrag/explain",
1848
2078
  config: this.config,
1849
2079
  retry: {
1850
2080
  attempts: 3,
@@ -1854,20 +2084,10 @@ var MemoriesService = class extends BaseService {
1854
2084
  backoffFactor: 2
1855
2085
  }
1856
2086
  });
1857
- request.addPathParam("id", {
1858
- key: "id",
1859
- value: id,
1860
- explode: false,
1861
- encode: true,
1862
- style: "simple",
1863
- isLimit: false,
1864
- isOffset: false,
1865
- isCursor: false
1866
- });
1867
- if (options?.detail !== void 0) {
1868
- request.addQueryParam("detail", {
1869
- key: "detail",
1870
- value: options.detail,
2087
+ if (options?.queryId !== void 0) {
2088
+ request.addQueryParam("queryId", {
2089
+ key: "queryId",
2090
+ value: options.queryId,
1871
2091
  explode: false,
1872
2092
  encode: true,
1873
2093
  style: "form",
@@ -1879,16 +2099,15 @@ var MemoriesService = class extends BaseService {
1879
2099
  return this.client.call(request);
1880
2100
  }
1881
2101
  /**
1882
- * Update a memory
1883
- * Update an existing memory for the authenticated user
1884
- * @param id - Memory ID
2102
+ * Query communities
2103
+ * Query communities for relevant information using semantic search
1885
2104
  * @param body - Request body
1886
2105
  */
1887
- async updateMemory(id, body) {
2106
+ async queryCommunities(body) {
1888
2107
  const request = new Request({
1889
2108
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1890
- method: "PUT",
1891
- path: "/api/memories/{id}",
2109
+ method: "POST",
2110
+ path: "/api/graphrag/query-communities",
1892
2111
  config: this.config,
1893
2112
  retry: {
1894
2113
  attempts: 3,
@@ -1898,32 +2117,217 @@ var MemoriesService = class extends BaseService {
1898
2117
  backoffFactor: 2
1899
2118
  }
1900
2119
  });
1901
- request.addPathParam("id", {
1902
- key: "id",
1903
- value: id,
1904
- explode: false,
1905
- encode: true,
1906
- style: "simple",
1907
- isLimit: false,
1908
- isOffset: false,
1909
- isCursor: false
1910
- });
1911
2120
  if (body !== void 0) {
1912
2121
  request.addBody(body);
1913
2122
  }
1914
2123
  return this.client.call(request);
1915
2124
  }
1916
2125
  /**
1917
- * Delete memory
1918
- * Delete a memory by its ID
1919
- * @param id - The memory ID
2126
+ * Execute a GraphRAG query
2127
+ * Execute a graph-based retrieval augmented generation query
2128
+ * @param body - Request body
1920
2129
  */
1921
- async deleteMemory(id) {
2130
+ async executeGraphRAGQuery(body) {
1922
2131
  const request = new Request({
1923
2132
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1924
- method: "DELETE",
1925
- path: "/api/memories/{id}",
1926
- config: this.config,
2133
+ method: "POST",
2134
+ path: "/api/graphrag/query",
2135
+ config: this.config,
2136
+ retry: {
2137
+ attempts: 3,
2138
+ delayMs: 150,
2139
+ maxDelayMs: 5e3,
2140
+ jitterMs: 50,
2141
+ backoffFactor: 2
2142
+ }
2143
+ });
2144
+ if (body !== void 0) {
2145
+ request.addBody(body);
2146
+ }
2147
+ return this.client.call(request);
2148
+ }
2149
+ };
2150
+
2151
+ // src/services/health-service.ts
2152
+ var HealthService = class extends BaseService {
2153
+ /**
2154
+ * API health check endpoint
2155
+ * Returns the health status and uptime of the API service.
2156
+ This endpoint is public and requires no authentication.
2157
+ Use this endpoint for monitoring, health checks, and service availability verification.
2158
+ Returns 200 when healthy, 503 when the database is unreachable.
2159
+
2160
+ */
2161
+ async healthCheck() {
2162
+ const request = new Request({
2163
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2164
+ method: "GET",
2165
+ path: "/health",
2166
+ config: this.config,
2167
+ retry: {
2168
+ attempts: 3,
2169
+ delayMs: 150,
2170
+ maxDelayMs: 5e3,
2171
+ jitterMs: 50,
2172
+ backoffFactor: 2
2173
+ }
2174
+ });
2175
+ return this.client.call(request);
2176
+ }
2177
+ };
2178
+
2179
+ // src/services/invites-service.ts
2180
+ var InvitesService = class extends BaseService {
2181
+ /**
2182
+ * Check invite gate status
2183
+ * Check whether the invite gate is currently open or closed.
2184
+ When gated is true, new signups require a valid invite code.
2185
+ Response is cached server-side (30-second TTL).
2186
+
2187
+ */
2188
+ async getGateStatus() {
2189
+ const request = new Request({
2190
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2191
+ method: "GET",
2192
+ path: "/api/invites/gate-status",
2193
+ config: this.config,
2194
+ retry: {
2195
+ attempts: 3,
2196
+ delayMs: 150,
2197
+ maxDelayMs: 5e3,
2198
+ jitterMs: 50,
2199
+ backoffFactor: 2
2200
+ }
2201
+ });
2202
+ return this.client.call(request);
2203
+ }
2204
+ /**
2205
+ * Validate an invite code
2206
+ * Validate an invite code without redeeming it.
2207
+ Rate limited to 10 requests per minute per IP to prevent enumeration.
2208
+ Error messages are intentionally generic.
2209
+
2210
+ * @param body - Request body
2211
+ */
2212
+ async validateInviteCode(body) {
2213
+ const request = new Request({
2214
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2215
+ method: "POST",
2216
+ path: "/api/invites/validate",
2217
+ config: this.config,
2218
+ retry: {
2219
+ attempts: 3,
2220
+ delayMs: 150,
2221
+ maxDelayMs: 5e3,
2222
+ jitterMs: 50,
2223
+ backoffFactor: 2
2224
+ }
2225
+ });
2226
+ if (body !== void 0) {
2227
+ request.addBody(body);
2228
+ }
2229
+ return this.client.call(request);
2230
+ }
2231
+ };
2232
+
2233
+ // src/services/memories-service.ts
2234
+ var MemoriesService = class extends BaseService {
2235
+ /**
2236
+ * Get memory by ID
2237
+ * Retrieve a specific memory by its ID with configurable detail level.
2238
+
2239
+ **Detail levels:**
2240
+ - `minimal` — raw memory only, no extra queries
2241
+ - `standard` (default) — adds userTopics, extractedTopics, entities, facts, relationships
2242
+ - `full` — adds conversationContext (title, memoryCount, position) and relationship target previews
2243
+
2244
+ * @param id - The memory ID
2245
+ * @param detail - Detail level: minimal (raw memory), standard (default, + topics/entities/facts/relationships), full (+ conversation context and relationship previews)
2246
+ */
2247
+ async getMemoryById(id, options) {
2248
+ const request = new Request({
2249
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2250
+ method: "GET",
2251
+ path: "/api/memories/{id}",
2252
+ config: this.config,
2253
+ retry: {
2254
+ attempts: 3,
2255
+ delayMs: 150,
2256
+ maxDelayMs: 5e3,
2257
+ jitterMs: 50,
2258
+ backoffFactor: 2
2259
+ }
2260
+ });
2261
+ request.addPathParam("id", {
2262
+ key: "id",
2263
+ value: id,
2264
+ explode: false,
2265
+ encode: true,
2266
+ style: "simple",
2267
+ isLimit: false,
2268
+ isOffset: false,
2269
+ isCursor: false
2270
+ });
2271
+ if (options?.detail !== void 0) {
2272
+ request.addQueryParam("detail", {
2273
+ key: "detail",
2274
+ value: options.detail,
2275
+ explode: false,
2276
+ encode: true,
2277
+ style: "form",
2278
+ isLimit: false,
2279
+ isOffset: false,
2280
+ isCursor: false
2281
+ });
2282
+ }
2283
+ return this.client.call(request);
2284
+ }
2285
+ /**
2286
+ * Update a memory
2287
+ * Update an existing memory for the authenticated user
2288
+ * @param id - Memory ID
2289
+ * @param body - Request body
2290
+ */
2291
+ async updateMemory(id, body) {
2292
+ const request = new Request({
2293
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2294
+ method: "PUT",
2295
+ path: "/api/memories/{id}",
2296
+ config: this.config,
2297
+ retry: {
2298
+ attempts: 3,
2299
+ delayMs: 150,
2300
+ maxDelayMs: 5e3,
2301
+ jitterMs: 50,
2302
+ backoffFactor: 2
2303
+ }
2304
+ });
2305
+ request.addPathParam("id", {
2306
+ key: "id",
2307
+ value: id,
2308
+ explode: false,
2309
+ encode: true,
2310
+ style: "simple",
2311
+ isLimit: false,
2312
+ isOffset: false,
2313
+ isCursor: false
2314
+ });
2315
+ if (body !== void 0) {
2316
+ request.addBody(body);
2317
+ }
2318
+ return this.client.call(request);
2319
+ }
2320
+ /**
2321
+ * Delete memory
2322
+ * Delete a memory by its ID
2323
+ * @param id - The memory ID
2324
+ */
2325
+ async deleteMemory(id) {
2326
+ const request = new Request({
2327
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2328
+ method: "DELETE",
2329
+ path: "/api/memories/{id}",
2330
+ config: this.config,
1927
2331
  retry: {
1928
2332
  attempts: 3,
1929
2333
  delayMs: 150,
@@ -3212,20 +3616,20 @@ var MemoriesService = class extends BaseService {
3212
3616
  }
3213
3617
  };
3214
3618
 
3215
- // src/services/invites-service.ts
3216
- var InvitesService = class extends BaseService {
3619
+ // src/services/monitoring-service.ts
3620
+ var MonitoringService = class extends BaseService {
3217
3621
  /**
3218
- * Check invite gate status
3219
- * Check whether the invite gate is currently open or closed.
3220
- When gated is true, new signups require a valid invite code.
3221
- Response is cached server-side (30-second TTL).
3622
+ * Prometheus metrics endpoint
3623
+ * Returns Prometheus-formatted metrics for monitoring and observability.
3624
+ This endpoint is public and requires no authentication.
3625
+ Designed to be scraped by Prometheus at regular intervals.
3222
3626
 
3223
3627
  */
3224
- async getGateStatus() {
3628
+ async getMetrics() {
3225
3629
  const request = new Request({
3226
3630
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3227
3631
  method: "GET",
3228
- path: "/api/invites/gate-status",
3632
+ path: "/metrics",
3229
3633
  config: this.config,
3230
3634
  retry: {
3231
3635
  attempts: 3,
@@ -3237,19 +3641,25 @@ var InvitesService = class extends BaseService {
3237
3641
  });
3238
3642
  return this.client.call(request);
3239
3643
  }
3644
+ };
3645
+
3646
+ // src/services/narratives-service.ts
3647
+ var NarrativesService = class extends BaseService {
3240
3648
  /**
3241
- * Validate an invite code
3242
- * Validate an invite code without redeeming it.
3243
- Rate limited to 10 requests per minute per IP to prevent enumeration.
3244
- Error messages are intentionally generic.
3649
+ * List narrative threads
3650
+ * List all narrative threads for the authenticated user.
3651
+ Narratives group related memories into coherent storylines.
3245
3652
 
3246
- * @param body - Request body
3653
+ * @param limit - Maximum number of narratives to return
3654
+ * @param offset - Number of narratives to skip
3655
+ * @param state - Filter by narrative state
3656
+ * @param topics - Comma-separated list of topics to filter by
3247
3657
  */
3248
- async validateInviteCode(body) {
3658
+ async listNarratives(options) {
3249
3659
  const request = new Request({
3250
3660
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3251
- method: "POST",
3252
- path: "/api/invites/validate",
3661
+ method: "GET",
3662
+ path: "/api/narratives",
3253
3663
  config: this.config,
3254
3664
  retry: {
3255
3665
  attempts: 3,
@@ -3259,161 +3669,17 @@ var InvitesService = class extends BaseService {
3259
3669
  backoffFactor: 2
3260
3670
  }
3261
3671
  });
3262
- if (body !== void 0) {
3263
- request.addBody(body);
3264
- }
3265
- return this.client.call(request);
3266
- }
3267
- };
3268
-
3269
- // src/services/health-service.ts
3270
- var HealthService = class extends BaseService {
3271
- /**
3272
- * API health check endpoint
3273
- * Returns the health status and uptime of the API service.
3274
- This endpoint is public and requires no authentication.
3275
- Use this endpoint for monitoring, health checks, and service availability verification.
3276
- Returns 200 when healthy, 503 when the database is unreachable.
3277
-
3278
- */
3279
- async healthCheck() {
3280
- const request = new Request({
3281
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3282
- method: "GET",
3283
- path: "/health",
3284
- config: this.config,
3285
- retry: {
3286
- attempts: 3,
3287
- delayMs: 150,
3288
- maxDelayMs: 5e3,
3289
- jitterMs: 50,
3290
- backoffFactor: 2
3291
- }
3292
- });
3293
- return this.client.call(request);
3294
- }
3295
- };
3296
-
3297
- // src/services/graphrag-service.ts
3298
- var GraphragService = class extends BaseService {
3299
- /**
3300
- * Explain a GraphRAG query
3301
- * Get explanation for a previously executed GraphRAG query result
3302
- * @param queryId - The query ID to explain
3303
- */
3304
- async explainGraphRAGQuery(options) {
3305
- const request = new Request({
3306
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3307
- method: "GET",
3308
- path: "/api/graphrag/explain",
3309
- config: this.config,
3310
- retry: {
3311
- attempts: 3,
3312
- delayMs: 150,
3313
- maxDelayMs: 5e3,
3314
- jitterMs: 50,
3315
- backoffFactor: 2
3316
- }
3317
- });
3318
- if (options?.queryId !== void 0) {
3319
- request.addQueryParam("queryId", {
3320
- key: "queryId",
3321
- value: options.queryId,
3322
- explode: false,
3323
- encode: true,
3324
- style: "form",
3325
- isLimit: false,
3326
- isOffset: false,
3327
- isCursor: false
3328
- });
3329
- }
3330
- return this.client.call(request);
3331
- }
3332
- /**
3333
- * Query communities
3334
- * Query communities for relevant information using semantic search
3335
- * @param body - Request body
3336
- */
3337
- async queryCommunities(body) {
3338
- const request = new Request({
3339
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3340
- method: "POST",
3341
- path: "/api/graphrag/query-communities",
3342
- config: this.config,
3343
- retry: {
3344
- attempts: 3,
3345
- delayMs: 150,
3346
- maxDelayMs: 5e3,
3347
- jitterMs: 50,
3348
- backoffFactor: 2
3349
- }
3350
- });
3351
- if (body !== void 0) {
3352
- request.addBody(body);
3353
- }
3354
- return this.client.call(request);
3355
- }
3356
- /**
3357
- * Execute a GraphRAG query
3358
- * Execute a graph-based retrieval augmented generation query
3359
- * @param body - Request body
3360
- */
3361
- async executeGraphRAGQuery(body) {
3362
- const request = new Request({
3363
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3364
- method: "POST",
3365
- path: "/api/graphrag/query",
3366
- config: this.config,
3367
- retry: {
3368
- attempts: 3,
3369
- delayMs: 150,
3370
- maxDelayMs: 5e3,
3371
- jitterMs: 50,
3372
- backoffFactor: 2
3373
- }
3374
- });
3375
- if (body !== void 0) {
3376
- request.addBody(body);
3377
- }
3378
- return this.client.call(request);
3379
- }
3380
- };
3381
-
3382
- // src/services/facts-service.ts
3383
- var FactsService = class extends BaseService {
3384
- /**
3385
- * List facts
3386
- * List all facts for the authenticated user
3387
- * @param limit - Maximum number of facts to return
3388
- * @param offset - Number of facts to skip
3389
- * @param sortBy - Field to sort facts by
3390
- * @param order - Sort order
3391
- */
3392
- async listFacts(options) {
3393
- const request = new Request({
3394
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3395
- method: "GET",
3396
- path: "/api/facts",
3397
- config: this.config,
3398
- retry: {
3399
- attempts: 3,
3400
- delayMs: 150,
3401
- maxDelayMs: 5e3,
3402
- jitterMs: 50,
3403
- backoffFactor: 2
3404
- }
3405
- });
3406
- if (options?.limit !== void 0) {
3407
- request.addQueryParam("limit", {
3408
- key: "limit",
3409
- value: options.limit,
3410
- explode: false,
3411
- encode: true,
3412
- style: "form",
3413
- isLimit: true,
3414
- isOffset: false,
3415
- isCursor: false
3416
- });
3672
+ if (options?.limit !== void 0) {
3673
+ request.addQueryParam("limit", {
3674
+ key: "limit",
3675
+ value: options.limit,
3676
+ explode: false,
3677
+ encode: true,
3678
+ style: "form",
3679
+ isLimit: true,
3680
+ isOffset: false,
3681
+ isCursor: false
3682
+ });
3417
3683
  }
3418
3684
  if (options?.offset !== void 0) {
3419
3685
  request.addQueryParam("offset", {
@@ -3427,10 +3693,10 @@ var FactsService = class extends BaseService {
3427
3693
  isCursor: false
3428
3694
  });
3429
3695
  }
3430
- if (options?.sortBy !== void 0) {
3431
- request.addQueryParam("sortBy", {
3432
- key: "sortBy",
3433
- value: options.sortBy,
3696
+ if (options?.state !== void 0) {
3697
+ request.addQueryParam("state", {
3698
+ key: "state",
3699
+ value: options.state,
3434
3700
  explode: false,
3435
3701
  encode: true,
3436
3702
  style: "form",
@@ -3439,10 +3705,10 @@ var FactsService = class extends BaseService {
3439
3705
  isCursor: false
3440
3706
  });
3441
3707
  }
3442
- if (options?.order !== void 0) {
3443
- request.addQueryParam("order", {
3444
- key: "order",
3445
- value: options.order,
3708
+ if (options?.topics !== void 0) {
3709
+ request.addQueryParam("topics", {
3710
+ key: "topics",
3711
+ value: options.topics,
3446
3712
  explode: false,
3447
3713
  encode: true,
3448
3714
  style: "form",
@@ -3454,15 +3720,17 @@ var FactsService = class extends BaseService {
3454
3720
  return this.client.call(request);
3455
3721
  }
3456
3722
  /**
3457
- * Create fact
3458
- * Create a new semantic fact
3459
- * @param body - Request body
3460
- */
3461
- async createFact(body) {
3723
+ * Create a narrative thread
3724
+ * Create a new narrative thread starting from a root memory.
3725
+ Narratives help organize related memories into coherent storylines.
3726
+
3727
+ * @param body - Request body
3728
+ */
3729
+ async createNarrative(body) {
3462
3730
  const request = new Request({
3463
3731
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3464
3732
  method: "POST",
3465
- path: "/api/facts",
3733
+ path: "/api/narratives",
3466
3734
  config: this.config,
3467
3735
  retry: {
3468
3736
  attempts: 3,
@@ -3478,15 +3746,15 @@ var FactsService = class extends BaseService {
3478
3746
  return this.client.call(request);
3479
3747
  }
3480
3748
  /**
3481
- * Get fact by ID
3482
- * Retrieve a specific fact by its ID
3483
- * @param id - The fact ID
3749
+ * Get a narrative thread
3750
+ * Retrieve a specific narrative thread by ID
3751
+ * @param id - The narrative ID
3484
3752
  */
3485
- async getFactById(id) {
3753
+ async getNarrative(id) {
3486
3754
  const request = new Request({
3487
3755
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3488
3756
  method: "GET",
3489
- path: "/api/facts/{id}",
3757
+ path: "/api/narratives/{id}",
3490
3758
  config: this.config,
3491
3759
  retry: {
3492
3760
  attempts: 3,
@@ -3509,16 +3777,17 @@ var FactsService = class extends BaseService {
3509
3777
  return this.client.call(request);
3510
3778
  }
3511
3779
  /**
3512
- * Update fact
3513
- * Update an existing fact completely
3514
- * @param id - The fact ID
3515
- * @param body - Request body
3516
- */
3517
- async updateFact(id, body) {
3780
+ * Delete a narrative thread
3781
+ * Delete a narrative thread.
3782
+ This does not delete the associated memories, only the narrative structure.
3783
+
3784
+ * @param id - The narrative ID
3785
+ */
3786
+ async deleteNarrative(id) {
3518
3787
  const request = new Request({
3519
3788
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3520
- method: "PUT",
3521
- path: "/api/facts/{id}",
3789
+ method: "DELETE",
3790
+ path: "/api/narratives/{id}",
3522
3791
  config: this.config,
3523
3792
  retry: {
3524
3793
  attempts: 3,
@@ -3538,21 +3807,21 @@ var FactsService = class extends BaseService {
3538
3807
  isOffset: false,
3539
3808
  isCursor: false
3540
3809
  });
3541
- if (body !== void 0) {
3542
- request.addBody(body);
3543
- }
3544
3810
  return this.client.call(request);
3545
3811
  }
3546
3812
  /**
3547
- * Delete fact
3548
- * Delete a fact by its ID
3549
- * @param id - The fact ID
3550
- */
3551
- async deleteFact(id) {
3813
+ * Update a narrative thread
3814
+ * Update a narrative thread's title, topics, or state.
3815
+ Use this to resolve, reopen, or modify narratives.
3816
+
3817
+ * @param id - The narrative ID
3818
+ * @param body - Request body
3819
+ */
3820
+ async updateNarrative(id, body) {
3552
3821
  const request = new Request({
3553
3822
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3554
- method: "DELETE",
3555
- path: "/api/facts/{id}",
3823
+ method: "PATCH",
3824
+ path: "/api/narratives/{id}",
3556
3825
  config: this.config,
3557
3826
  retry: {
3558
3827
  attempts: 3,
@@ -3572,138 +3841,25 @@ var FactsService = class extends BaseService {
3572
3841
  isOffset: false,
3573
3842
  isCursor: false
3574
3843
  });
3575
- return this.client.call(request);
3576
- }
3577
- /**
3578
- * Search facts
3579
- * Search semantic facts by query string
3580
- * @param body - Request body
3581
- */
3582
- async searchFacts(body) {
3583
- const request = new Request({
3584
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3585
- method: "POST",
3586
- path: "/api/facts/search",
3587
- config: this.config,
3588
- retry: {
3589
- attempts: 3,
3590
- delayMs: 150,
3591
- maxDelayMs: 5e3,
3592
- jitterMs: 50,
3593
- backoffFactor: 2
3594
- }
3595
- });
3596
3844
  if (body !== void 0) {
3597
3845
  request.addBody(body);
3598
3846
  }
3599
3847
  return this.client.call(request);
3600
3848
  }
3601
- };
3602
-
3603
- // src/services/entities-service.ts
3604
- var EntitiesService = class extends BaseService {
3605
- /**
3606
- * List entities
3607
- * List all entities for the authenticated user, optionally filtered by type
3608
- * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
3609
- * @param limit - Maximum number of entities to return
3610
- * @param offset - Number of entities to skip
3611
- */
3612
- async listEntities(options) {
3613
- const request = new Request({
3614
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3615
- method: "GET",
3616
- path: "/api/entities",
3617
- config: this.config,
3618
- retry: {
3619
- attempts: 3,
3620
- delayMs: 150,
3621
- maxDelayMs: 5e3,
3622
- jitterMs: 50,
3623
- backoffFactor: 2
3624
- }
3625
- });
3626
- if (options?.type !== void 0) {
3627
- request.addQueryParam("type", {
3628
- key: "type",
3629
- value: options.type,
3630
- explode: false,
3631
- encode: true,
3632
- style: "form",
3633
- isLimit: false,
3634
- isOffset: false,
3635
- isCursor: false
3636
- });
3637
- }
3638
- if (options?.limit !== void 0) {
3639
- request.addQueryParam("limit", {
3640
- key: "limit",
3641
- value: options.limit,
3642
- explode: false,
3643
- encode: true,
3644
- style: "form",
3645
- isLimit: true,
3646
- isOffset: false,
3647
- isCursor: false
3648
- });
3649
- }
3650
- if (options?.offset !== void 0) {
3651
- request.addQueryParam("offset", {
3652
- key: "offset",
3653
- value: options.offset,
3654
- explode: false,
3655
- encode: true,
3656
- style: "form",
3657
- isLimit: false,
3658
- isOffset: true,
3659
- isCursor: false
3660
- });
3661
- }
3662
- return this.client.call(request);
3663
- }
3664
3849
  /**
3665
- * Get entity by ID
3666
- * Retrieve a specific entity by its ID
3667
- * @param id - The entity ID
3668
- */
3669
- async getEntityById(id) {
3670
- const request = new Request({
3671
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3672
- method: "GET",
3673
- path: "/api/entities/{id}",
3674
- config: this.config,
3675
- retry: {
3676
- attempts: 3,
3677
- delayMs: 150,
3678
- maxDelayMs: 5e3,
3679
- jitterMs: 50,
3680
- backoffFactor: 2
3681
- }
3682
- });
3683
- request.addPathParam("id", {
3684
- key: "id",
3685
- value: id,
3686
- explode: false,
3687
- encode: true,
3688
- style: "simple",
3689
- isLimit: false,
3690
- isOffset: false,
3691
- isCursor: false
3692
- });
3693
- return this.client.call(request);
3694
- }
3695
- /**
3696
- * Get memories mentioning entity
3697
- * Get all memories that mention a specific entity
3698
- * @param id - The entity ID
3699
- * @param limit - Maximum number of memories to return
3700
- * @param offset - Number of memories to skip
3701
- */
3702
- async getEntityMemories(id, options) {
3850
+ * Get narrative timeline
3851
+ * Get all memories in a narrative, ordered by their position in the narrative.
3852
+ Each memory includes its position and effective state.
3853
+
3854
+ * @param id - The narrative ID
3855
+ * @param limit - Maximum number of memories to return
3856
+ * @param offset - Number of memories to skip
3857
+ */
3858
+ async getNarrativeTimeline(id, options) {
3703
3859
  const request = new Request({
3704
3860
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3705
3861
  method: "GET",
3706
- path: "/api/entities/{id}/memories",
3862
+ path: "/api/narratives/{id}/timeline",
3707
3863
  config: this.config,
3708
3864
  retry: {
3709
3865
  attempts: 3,
@@ -3732,142 +3888,36 @@ var EntitiesService = class extends BaseService {
3732
3888
  style: "form",
3733
3889
  isLimit: true,
3734
3890
  isOffset: false,
3735
- isCursor: false
3736
- });
3737
- }
3738
- if (options?.offset !== void 0) {
3739
- request.addQueryParam("offset", {
3740
- key: "offset",
3741
- value: options.offset,
3742
- explode: false,
3743
- encode: true,
3744
- style: "form",
3745
- isLimit: false,
3746
- isOffset: true,
3747
- isCursor: false
3748
- });
3749
- }
3750
- return this.client.call(request);
3751
- }
3752
- /**
3753
- * Get graph health metrics
3754
- * Returns knowledge graph health metrics including entity counts, fact counts, topic counts, and extraction coverage
3755
- */
3756
- async getGraphHealth() {
3757
- const request = new Request({
3758
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3759
- method: "GET",
3760
- path: "/api/entities/health",
3761
- config: this.config,
3762
- retry: {
3763
- attempts: 3,
3764
- delayMs: 150,
3765
- maxDelayMs: 5e3,
3766
- jitterMs: 50,
3767
- backoffFactor: 2
3768
- }
3769
- });
3770
- return this.client.call(request);
3771
- }
3772
- };
3773
-
3774
- // src/services/conversations-service.ts
3775
- var ConversationsService = class extends BaseService {
3776
- /**
3777
- * List conversations
3778
- * List all conversations for the authenticated user with pagination
3779
- * @param limit - Maximum number of conversations to return
3780
- * @param offset - Number of conversations to skip
3781
- * @param since - Return only conversations created after this timestamp (ISO 8601 format)
3782
- * @param sortBy - Field to sort conversations by
3783
- * @param order - Sort order
3784
- */
3785
- async listConversations(options) {
3786
- const request = new Request({
3787
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3788
- method: "GET",
3789
- path: "/api/conversations",
3790
- config: this.config,
3791
- retry: {
3792
- attempts: 3,
3793
- delayMs: 150,
3794
- maxDelayMs: 5e3,
3795
- jitterMs: 50,
3796
- backoffFactor: 2
3797
- }
3798
- });
3799
- if (options?.limit !== void 0) {
3800
- request.addQueryParam("limit", {
3801
- key: "limit",
3802
- value: options.limit,
3803
- explode: false,
3804
- encode: true,
3805
- style: "form",
3806
- isLimit: true,
3807
- isOffset: false,
3808
- isCursor: false
3809
- });
3810
- }
3811
- if (options?.offset !== void 0) {
3812
- request.addQueryParam("offset", {
3813
- key: "offset",
3814
- value: options.offset,
3815
- explode: false,
3816
- encode: true,
3817
- style: "form",
3818
- isLimit: false,
3819
- isOffset: true,
3820
- isCursor: false
3821
- });
3822
- }
3823
- if (options?.since !== void 0) {
3824
- request.addQueryParam("since", {
3825
- key: "since",
3826
- value: options.since,
3827
- explode: false,
3828
- encode: true,
3829
- style: "form",
3830
- isLimit: false,
3831
- isOffset: false,
3832
- isCursor: false
3833
- });
3834
- }
3835
- if (options?.sortBy !== void 0) {
3836
- request.addQueryParam("sortBy", {
3837
- key: "sortBy",
3838
- value: options.sortBy,
3839
- explode: false,
3840
- encode: true,
3841
- style: "form",
3842
- isLimit: false,
3843
- isOffset: false,
3844
- isCursor: false
3845
- });
3846
- }
3847
- if (options?.order !== void 0) {
3848
- request.addQueryParam("order", {
3849
- key: "order",
3850
- value: options.order,
3891
+ isCursor: false
3892
+ });
3893
+ }
3894
+ if (options?.offset !== void 0) {
3895
+ request.addQueryParam("offset", {
3896
+ key: "offset",
3897
+ value: options.offset,
3851
3898
  explode: false,
3852
3899
  encode: true,
3853
3900
  style: "form",
3854
3901
  isLimit: false,
3855
- isOffset: false,
3902
+ isOffset: true,
3856
3903
  isCursor: false
3857
3904
  });
3858
3905
  }
3859
3906
  return this.client.call(request);
3860
3907
  }
3861
3908
  /**
3862
- * Create conversation
3863
- * Create a new conversation for the authenticated user
3864
- * @param body - Request body
3865
- */
3866
- async createConversation(body) {
3909
+ * Add a memory to a narrative
3910
+ * Add an existing memory to a narrative thread.
3911
+ Optionally specify a position to insert the memory at.
3912
+
3913
+ * @param id - The narrative ID
3914
+ * @param body - Request body
3915
+ */
3916
+ async addMemoryToNarrative(id, body) {
3867
3917
  const request = new Request({
3868
3918
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3869
3919
  method: "POST",
3870
- path: "/api/conversations",
3920
+ path: "/api/narratives/{id}/memories",
3871
3921
  config: this.config,
3872
3922
  retry: {
3873
3923
  attempts: 3,
@@ -3877,21 +3927,34 @@ var ConversationsService = class extends BaseService {
3877
3927
  backoffFactor: 2
3878
3928
  }
3879
3929
  });
3930
+ request.addPathParam("id", {
3931
+ key: "id",
3932
+ value: id,
3933
+ explode: false,
3934
+ encode: true,
3935
+ style: "simple",
3936
+ isLimit: false,
3937
+ isOffset: false,
3938
+ isCursor: false
3939
+ });
3880
3940
  if (body !== void 0) {
3881
3941
  request.addBody(body);
3882
3942
  }
3883
3943
  return this.client.call(request);
3884
3944
  }
3885
3945
  /**
3886
- * Get conversation summary
3887
- * Retrieve a conversation summary by its ID
3888
- * @param conversationId - The conversation ID
3889
- */
3890
- async getConversationSummary(conversationId) {
3946
+ * Remove a memory from a narrative
3947
+ * Remove a memory from a narrative thread.
3948
+ This does not delete the memory itself, only removes it from the narrative.
3949
+
3950
+ * @param id - The narrative ID
3951
+ * @param memoryId - The memory ID to remove
3952
+ */
3953
+ async removeMemoryFromNarrative(id, memoryId) {
3891
3954
  const request = new Request({
3892
3955
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3893
- method: "GET",
3894
- path: "/api/conversations/{conversationId}",
3956
+ method: "DELETE",
3957
+ path: "/api/narratives/{id}/memories/{memoryId}",
3895
3958
  config: this.config,
3896
3959
  retry: {
3897
3960
  attempts: 3,
@@ -3901,9 +3964,19 @@ var ConversationsService = class extends BaseService {
3901
3964
  backoffFactor: 2
3902
3965
  }
3903
3966
  });
3904
- request.addPathParam("conversationId", {
3905
- key: "conversationId",
3906
- value: conversationId,
3967
+ request.addPathParam("id", {
3968
+ key: "id",
3969
+ value: id,
3970
+ explode: false,
3971
+ encode: true,
3972
+ style: "simple",
3973
+ isLimit: false,
3974
+ isOffset: false,
3975
+ isCursor: false
3976
+ });
3977
+ request.addPathParam("memoryId", {
3978
+ key: "memoryId",
3979
+ value: memoryId,
3907
3980
  explode: false,
3908
3981
  encode: true,
3909
3982
  style: "simple",
@@ -3913,16 +3986,20 @@ var ConversationsService = class extends BaseService {
3913
3986
  });
3914
3987
  return this.client.call(request);
3915
3988
  }
3989
+ };
3990
+
3991
+ // src/services/system-service.ts
3992
+ var SystemService = class extends BaseService {
3916
3993
  /**
3917
- * Delete conversation
3918
- * Delete a conversation and soft-delete all associated memories
3919
- * @param conversationId - The conversation ID
3994
+ * Get OpenAPI specification
3995
+ * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
3996
+ * @param noCache - Bypass cache and regenerate specification
3920
3997
  */
3921
- async deleteConversation(conversationId) {
3998
+ async getOpenApiSpec(options) {
3922
3999
  const request = new Request({
3923
4000
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3924
- method: "DELETE",
3925
- path: "/api/conversations/{conversationId}",
4001
+ method: "GET",
4002
+ path: "/api/openapi.json",
3926
4003
  config: this.config,
3927
4004
  retry: {
3928
4005
  attempts: 3,
@@ -3932,28 +4009,29 @@ var ConversationsService = class extends BaseService {
3932
4009
  backoffFactor: 2
3933
4010
  }
3934
4011
  });
3935
- request.addPathParam("conversationId", {
3936
- key: "conversationId",
3937
- value: conversationId,
3938
- explode: false,
3939
- encode: true,
3940
- style: "simple",
3941
- isLimit: false,
3942
- isOffset: false,
3943
- isCursor: false
3944
- });
4012
+ if (options?.noCache !== void 0) {
4013
+ request.addQueryParam("noCache", {
4014
+ key: "noCache",
4015
+ value: options.noCache,
4016
+ explode: false,
4017
+ encode: true,
4018
+ style: "form",
4019
+ isLimit: false,
4020
+ isOffset: false,
4021
+ isCursor: false
4022
+ });
4023
+ }
3945
4024
  return this.client.call(request);
3946
4025
  }
3947
4026
  /**
3948
- * Get conversation timeline
3949
- * Get all memories in a conversation in chronological order
3950
- * @param conversationId - The conversation ID
4027
+ * Get system health status
4028
+ * Get the current health status of the system including database connectivity
3951
4029
  */
3952
- async getConversationTimeline(conversationId) {
4030
+ async getSystemHealth() {
3953
4031
  const request = new Request({
3954
4032
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3955
4033
  method: "GET",
3956
- path: "/api/conversations/{conversationId}/timeline",
4034
+ path: "/api/system/health",
3957
4035
  config: this.config,
3958
4036
  retry: {
3959
4037
  attempts: 3,
@@ -3963,28 +4041,37 @@ var ConversationsService = class extends BaseService {
3963
4041
  backoffFactor: 2
3964
4042
  }
3965
4043
  });
3966
- request.addPathParam("conversationId", {
3967
- key: "conversationId",
3968
- value: conversationId,
3969
- explode: false,
3970
- encode: true,
3971
- style: "simple",
3972
- isLimit: false,
3973
- isOffset: false,
3974
- isCursor: false
4044
+ return this.client.call(request);
4045
+ }
4046
+ /**
4047
+ * Get context status
4048
+ * Get database statistics and context information
4049
+ */
4050
+ async getContextStatus() {
4051
+ const request = new Request({
4052
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
4053
+ method: "GET",
4054
+ path: "/api/system/context/status",
4055
+ config: this.config,
4056
+ retry: {
4057
+ attempts: 3,
4058
+ delayMs: 150,
4059
+ maxDelayMs: 5e3,
4060
+ jitterMs: 50,
4061
+ backoffFactor: 2
4062
+ }
3975
4063
  });
3976
4064
  return this.client.call(request);
3977
4065
  }
3978
4066
  /**
3979
- * Search conversations
3980
- * Search conversations by query string
3981
- * @param body - Request body
4067
+ * Get feature flags
4068
+ * Get all feature flags for the authenticated user
3982
4069
  */
3983
- async searchConversations(body) {
4070
+ async getFeatureFlags() {
3984
4071
  const request = new Request({
3985
4072
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3986
- method: "POST",
3987
- path: "/api/conversations/search",
4073
+ method: "GET",
4074
+ path: "/api/system/feature-flags",
3988
4075
  config: this.config,
3989
4076
  retry: {
3990
4077
  attempts: 3,
@@ -3994,21 +4081,18 @@ var ConversationsService = class extends BaseService {
3994
4081
  backoffFactor: 2
3995
4082
  }
3996
4083
  });
3997
- if (body !== void 0) {
3998
- request.addBody(body);
3999
- }
4000
4084
  return this.client.call(request);
4001
4085
  }
4002
4086
  /**
4003
- * Find conversations by topic
4004
- * Find conversations that contain a specific topic
4087
+ * Evaluate feature flag
4088
+ * Evaluate a specific feature flag for the authenticated user
4005
4089
  * @param body - Request body
4006
4090
  */
4007
- async findConversationsByTopic(body) {
4091
+ async evaluateFeatureFlag(body) {
4008
4092
  const request = new Request({
4009
4093
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4010
4094
  method: "POST",
4011
- path: "/api/conversations/by-topic",
4095
+ path: "/api/system/feature-flags/evaluate",
4012
4096
  config: this.config,
4013
4097
  retry: {
4014
4098
  attempts: 3,
@@ -4023,19 +4107,17 @@ var ConversationsService = class extends BaseService {
4023
4107
  }
4024
4108
  return this.client.call(request);
4025
4109
  }
4026
- };
4027
-
4028
- // src/services/billing-service.ts
4029
- var BillingService = class extends BaseService {
4030
4110
  /**
4031
- * Get billing overview
4032
- * Get subscription, payment method, and upcoming invoice information
4111
+ * Analyze memory quality distribution
4112
+ * Analyze the quality distribution of memories for the authenticated user
4113
+ * @param includeDetails - Include detailed pruning candidate information
4114
+ * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
4033
4115
  */
4034
- async getBillingOverview() {
4116
+ async analyzeMemoryQuality(options) {
4035
4117
  const request = new Request({
4036
4118
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4037
4119
  method: "GET",
4038
- path: "/api/billing/overview",
4120
+ path: "/api/system/memory/quality",
4039
4121
  config: this.config,
4040
4122
  retry: {
4041
4123
  attempts: 3,
@@ -4045,18 +4127,42 @@ var BillingService = class extends BaseService {
4045
4127
  backoffFactor: 2
4046
4128
  }
4047
4129
  });
4130
+ if (options?.includeDetails !== void 0) {
4131
+ request.addQueryParam("includeDetails", {
4132
+ key: "includeDetails",
4133
+ value: options.includeDetails,
4134
+ explode: false,
4135
+ encode: true,
4136
+ style: "form",
4137
+ isLimit: false,
4138
+ isOffset: false,
4139
+ isCursor: false
4140
+ });
4141
+ }
4142
+ if (options?.minQualityThreshold !== void 0) {
4143
+ request.addQueryParam("minQualityThreshold", {
4144
+ key: "minQualityThreshold",
4145
+ value: options.minQualityThreshold,
4146
+ explode: false,
4147
+ encode: true,
4148
+ style: "form",
4149
+ isLimit: false,
4150
+ isOffset: false,
4151
+ isCursor: false
4152
+ });
4153
+ }
4048
4154
  return this.client.call(request);
4049
4155
  }
4050
4156
  /**
4051
- * Create checkout session
4052
- * Create a Stripe checkout session for subscription upgrade
4157
+ * Prune low-quality memories
4158
+ * Prune (soft delete) low-quality memories for the authenticated user
4053
4159
  * @param body - Request body
4054
4160
  */
4055
- async createCheckoutSession(body) {
4161
+ async pruneMemories(options) {
4056
4162
  const request = new Request({
4057
4163
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4058
4164
  method: "POST",
4059
- path: "/api/billing/checkout",
4165
+ path: "/api/system/memory/prune",
4060
4166
  config: this.config,
4061
4167
  retry: {
4062
4168
  attempts: 3,
@@ -4066,21 +4172,26 @@ var BillingService = class extends BaseService {
4066
4172
  backoffFactor: 2
4067
4173
  }
4068
4174
  });
4069
- if (body !== void 0) {
4070
- request.addBody(body);
4175
+ if (options?.body !== void 0) {
4176
+ request.addBody(options?.body);
4071
4177
  }
4072
4178
  return this.client.call(request);
4073
4179
  }
4180
+ };
4181
+
4182
+ // src/services/patterns-service.ts
4183
+ var PatternsService = class extends BaseService {
4074
4184
  /**
4075
- * Create billing portal session
4076
- * Create a Stripe billing portal session for managing subscription
4077
- * @param body - Request body
4185
+ * List patterns
4186
+ * List all patterns for the authenticated user
4187
+ * @param limit - Maximum number of patterns to return
4188
+ * @param offset - Number of patterns to skip
4078
4189
  */
4079
- async createPortalSession(body) {
4190
+ async listPatterns(options) {
4080
4191
  const request = new Request({
4081
4192
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4082
- method: "POST",
4083
- path: "/api/billing/portal",
4193
+ method: "GET",
4194
+ path: "/api/patterns",
4084
4195
  config: this.config,
4085
4196
  retry: {
4086
4197
  attempts: 3,
@@ -4090,41 +4201,42 @@ var BillingService = class extends BaseService {
4090
4201
  backoffFactor: 2
4091
4202
  }
4092
4203
  });
4093
- if (body !== void 0) {
4094
- request.addBody(body);
4204
+ if (options?.limit !== void 0) {
4205
+ request.addQueryParam("limit", {
4206
+ key: "limit",
4207
+ value: options.limit,
4208
+ explode: false,
4209
+ encode: true,
4210
+ style: "form",
4211
+ isLimit: true,
4212
+ isOffset: false,
4213
+ isCursor: false
4214
+ });
4215
+ }
4216
+ if (options?.offset !== void 0) {
4217
+ request.addQueryParam("offset", {
4218
+ key: "offset",
4219
+ value: options.offset,
4220
+ explode: false,
4221
+ encode: true,
4222
+ style: "form",
4223
+ isLimit: false,
4224
+ isOffset: true,
4225
+ isCursor: false
4226
+ });
4095
4227
  }
4096
4228
  return this.client.call(request);
4097
4229
  }
4098
4230
  /**
4099
- * Get current subscription
4100
- * Get the current subscription details for the authenticated user
4101
- */
4102
- async getSubscription() {
4103
- const request = new Request({
4104
- baseUrl: this.config.baseUrl || "http://localhost:3000",
4105
- method: "GET",
4106
- path: "/api/billing/subscription",
4107
- config: this.config,
4108
- retry: {
4109
- attempts: 3,
4110
- delayMs: 150,
4111
- maxDelayMs: 5e3,
4112
- jitterMs: 50,
4113
- backoffFactor: 2
4114
- }
4115
- });
4116
- return this.client.call(request);
4117
- }
4118
- /**
4119
- * Cancel subscription
4120
- * Cancel the current subscription at the end of the billing period
4231
+ * Compile patterns
4232
+ * Compile patterns from user's memories
4121
4233
  * @param body - Request body
4122
4234
  */
4123
- async cancelSubscription(options) {
4235
+ async compilePatterns(options) {
4124
4236
  const request = new Request({
4125
4237
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4126
4238
  method: "POST",
4127
- path: "/api/billing/subscription/cancel",
4239
+ path: "/api/patterns/compile",
4128
4240
  config: this.config,
4129
4241
  retry: {
4130
4242
  attempts: 3,
@@ -4140,15 +4252,15 @@ var BillingService = class extends BaseService {
4140
4252
  return this.client.call(request);
4141
4253
  }
4142
4254
  /**
4143
- * Reactivate subscription
4144
- * Reactivate a subscription that was scheduled for cancellation
4255
+ * Detect behavioral patterns
4256
+ * Run pattern detection algorithms to identify recurring behavioral patterns
4145
4257
  * @param body - Request body
4146
4258
  */
4147
- async reactivateSubscription(options) {
4259
+ async detectPatterns(options) {
4148
4260
  const request = new Request({
4149
4261
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4150
4262
  method: "POST",
4151
- path: "/api/billing/subscription/reactivate",
4263
+ path: "/api/patterns/detect",
4152
4264
  config: this.config,
4153
4265
  retry: {
4154
4266
  attempts: 3,
@@ -4164,15 +4276,15 @@ var BillingService = class extends BaseService {
4164
4276
  return this.client.call(request);
4165
4277
  }
4166
4278
  /**
4167
- * List invoices
4168
- * Get a list of invoices for the authenticated user
4169
- * @param limit - Maximum number of invoices to return
4279
+ * Analyze pattern trends
4280
+ * Analyze pattern trends, correlations, and generate insights
4281
+ * @param body - Request body
4170
4282
  */
4171
- async listInvoices(options) {
4283
+ async analyzePatterns(options) {
4172
4284
  const request = new Request({
4173
4285
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4174
- method: "GET",
4175
- path: "/api/billing/invoices",
4286
+ method: "POST",
4287
+ path: "/api/patterns/analyze",
4176
4288
  config: this.config,
4177
4289
  retry: {
4178
4290
  attempts: 3,
@@ -4182,29 +4294,22 @@ var BillingService = class extends BaseService {
4182
4294
  backoffFactor: 2
4183
4295
  }
4184
4296
  });
4185
- if (options?.limit !== void 0) {
4186
- request.addQueryParam("limit", {
4187
- key: "limit",
4188
- value: options.limit,
4189
- explode: false,
4190
- encode: true,
4191
- style: "form",
4192
- isLimit: true,
4193
- isOffset: false,
4194
- isCursor: false
4195
- });
4297
+ if (options?.body !== void 0) {
4298
+ request.addBody(options?.body);
4196
4299
  }
4197
4300
  return this.client.call(request);
4198
4301
  }
4199
4302
  /**
4200
- * List payment methods
4201
- * Get a list of payment methods for the authenticated user
4303
+ * Update pattern
4304
+ * Update an existing pattern with partial data
4305
+ * @param id - The pattern ID
4306
+ * @param body - Request body
4202
4307
  */
4203
- async listPaymentMethods() {
4308
+ async updatePattern(id, body) {
4204
4309
  const request = new Request({
4205
4310
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4206
- method: "GET",
4207
- path: "/api/billing/payment-methods",
4311
+ method: "PATCH",
4312
+ path: "/api/patterns/{id}",
4208
4313
  config: this.config,
4209
4314
  retry: {
4210
4315
  attempts: 3,
@@ -4214,19 +4319,31 @@ var BillingService = class extends BaseService {
4214
4319
  backoffFactor: 2
4215
4320
  }
4216
4321
  });
4322
+ request.addPathParam("id", {
4323
+ key: "id",
4324
+ value: id,
4325
+ explode: false,
4326
+ encode: true,
4327
+ style: "simple",
4328
+ isLimit: false,
4329
+ isOffset: false,
4330
+ isCursor: false
4331
+ });
4332
+ if (body !== void 0) {
4333
+ request.addBody(body);
4334
+ }
4217
4335
  return this.client.call(request);
4218
4336
  }
4219
4337
  /**
4220
- * Set default payment method
4221
- * Set a payment method as the default for future payments
4222
- * @param id - The payment method ID
4338
+ * Record pattern feedback
4339
+ * Record feedback on a pattern
4223
4340
  * @param body - Request body
4224
4341
  */
4225
- async setDefaultPaymentMethod(id, options) {
4342
+ async recordPatternFeedback(body) {
4226
4343
  const request = new Request({
4227
4344
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4228
4345
  method: "POST",
4229
- path: "/api/billing/payment-methods/{id}/default",
4346
+ path: "/api/patterns/feedback",
4230
4347
  config: this.config,
4231
4348
  retry: {
4232
4349
  attempts: 3,
@@ -4236,31 +4353,24 @@ var BillingService = class extends BaseService {
4236
4353
  backoffFactor: 2
4237
4354
  }
4238
4355
  });
4239
- request.addPathParam("id", {
4240
- key: "id",
4241
- value: id,
4242
- explode: false,
4243
- encode: true,
4244
- style: "simple",
4245
- isLimit: false,
4246
- isOffset: false,
4247
- isCursor: false
4248
- });
4249
- if (options?.body !== void 0) {
4250
- request.addBody(options?.body);
4356
+ if (body !== void 0) {
4357
+ request.addBody(body);
4251
4358
  }
4252
4359
  return this.client.call(request);
4253
4360
  }
4361
+ };
4362
+
4363
+ // src/services/behavior-service.ts
4364
+ var BehaviorService = class extends BaseService {
4254
4365
  /**
4255
- * Delete payment method
4256
- * Remove a payment method from the account
4257
- * @param id - The payment method ID
4366
+ * Get behavioral state
4367
+ * Get current behavioral state for the authenticated user
4258
4368
  */
4259
- async deletePaymentMethod(id) {
4369
+ async getBehavioralState() {
4260
4370
  const request = new Request({
4261
4371
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4262
- method: "DELETE",
4263
- path: "/api/billing/payment-methods/{id}",
4372
+ method: "GET",
4373
+ path: "/api/patterns/behavior/state",
4264
4374
  config: this.config,
4265
4375
  retry: {
4266
4376
  attempts: 3,
@@ -4270,28 +4380,18 @@ var BillingService = class extends BaseService {
4270
4380
  backoffFactor: 2
4271
4381
  }
4272
4382
  });
4273
- request.addPathParam("id", {
4274
- key: "id",
4275
- value: id,
4276
- explode: false,
4277
- encode: true,
4278
- style: "simple",
4279
- isLimit: false,
4280
- isOffset: false,
4281
- isCursor: false
4282
- });
4283
4383
  return this.client.call(request);
4284
4384
  }
4285
4385
  /**
4286
- * Stripe webhook endpoint
4287
- * Receive and process Stripe webhook events
4386
+ * Update behavioral state
4387
+ * Update or mutate behavioral state
4288
4388
  * @param body - Request body
4289
4389
  */
4290
- async stripeWebhook(body) {
4390
+ async updateBehavioralState(options) {
4291
4391
  const request = new Request({
4292
4392
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4293
4393
  method: "POST",
4294
- path: "/api/billing/webhooks",
4394
+ path: "/api/patterns/behavior/state",
4295
4395
  config: this.config,
4296
4396
  retry: {
4297
4397
  attempts: 3,
@@ -4301,29 +4401,28 @@ var BillingService = class extends BaseService {
4301
4401
  backoffFactor: 2
4302
4402
  }
4303
4403
  });
4304
- if (body !== void 0) {
4305
- request.addBody(body);
4404
+ if (options?.body !== void 0) {
4405
+ request.addBody(options?.body);
4306
4406
  }
4307
4407
  return this.client.call(request);
4308
4408
  }
4309
4409
  };
4310
4410
 
4311
- // src/services/artifacts-service.ts
4312
- var ArtifactsService = class extends BaseService {
4411
+ // src/services/topics-service.ts
4412
+ var TopicsService = class extends BaseService {
4313
4413
  /**
4314
- * List artifacts
4315
- * List all artifacts for the authenticated user with optional filters
4316
- * @param limit - Maximum number of artifacts to return
4317
- * @param offset - Number of artifacts to skip
4318
- * @param memoryId - Filter by memory ID
4319
- * @param conversationId - Filter by conversation ID
4320
- * @param type - Filter by artifact type
4414
+ * List topics
4415
+ * List all topics with pagination
4416
+ * @param limit - Maximum number of topics to return
4417
+ * @param offset - Number of topics to skip
4418
+ * @param sortBy - Field to sort topics by
4419
+ * @param order - Sort order
4321
4420
  */
4322
- async listArtifacts(options) {
4421
+ async listTopics(options) {
4323
4422
  const request = new Request({
4324
4423
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4325
4424
  method: "GET",
4326
- path: "/api/artifacts",
4425
+ path: "/api/topics",
4327
4426
  config: this.config,
4328
4427
  retry: {
4329
4428
  attempts: 3,
@@ -4357,22 +4456,10 @@ var ArtifactsService = class extends BaseService {
4357
4456
  isCursor: false
4358
4457
  });
4359
4458
  }
4360
- if (options?.memoryId !== void 0) {
4361
- request.addQueryParam("memoryId", {
4362
- key: "memoryId",
4363
- value: options.memoryId,
4364
- explode: false,
4365
- encode: true,
4366
- style: "form",
4367
- isLimit: false,
4368
- isOffset: false,
4369
- isCursor: false
4370
- });
4371
- }
4372
- if (options?.conversationId !== void 0) {
4373
- request.addQueryParam("conversationId", {
4374
- key: "conversationId",
4375
- value: options.conversationId,
4459
+ if (options?.sortBy !== void 0) {
4460
+ request.addQueryParam("sortBy", {
4461
+ key: "sortBy",
4462
+ value: options.sortBy,
4376
4463
  explode: false,
4377
4464
  encode: true,
4378
4465
  style: "form",
@@ -4381,10 +4468,10 @@ var ArtifactsService = class extends BaseService {
4381
4468
  isCursor: false
4382
4469
  });
4383
4470
  }
4384
- if (options?.type !== void 0) {
4385
- request.addQueryParam("type", {
4386
- key: "type",
4387
- value: options.type,
4471
+ if (options?.order !== void 0) {
4472
+ request.addQueryParam("order", {
4473
+ key: "order",
4474
+ value: options.order,
4388
4475
  explode: false,
4389
4476
  encode: true,
4390
4477
  style: "form",
@@ -4396,15 +4483,46 @@ var ArtifactsService = class extends BaseService {
4396
4483
  return this.client.call(request);
4397
4484
  }
4398
4485
  /**
4399
- * Create artifact
4400
- * Create a new artifact for the authenticated user
4486
+ * Get topic by ID
4487
+ * Retrieve a specific topic by its ID
4488
+ * @param id - The topic ID
4489
+ */
4490
+ async getTopicById(id) {
4491
+ const request = new Request({
4492
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
4493
+ method: "GET",
4494
+ path: "/api/topics/{id}",
4495
+ config: this.config,
4496
+ retry: {
4497
+ attempts: 3,
4498
+ delayMs: 150,
4499
+ maxDelayMs: 5e3,
4500
+ jitterMs: 50,
4501
+ backoffFactor: 2
4502
+ }
4503
+ });
4504
+ request.addPathParam("id", {
4505
+ key: "id",
4506
+ value: id,
4507
+ explode: false,
4508
+ encode: true,
4509
+ style: "simple",
4510
+ isLimit: false,
4511
+ isOffset: false,
4512
+ isCursor: false
4513
+ });
4514
+ return this.client.call(request);
4515
+ }
4516
+ /**
4517
+ * Merge topics
4518
+ * Merge two topics into one
4401
4519
  * @param body - Request body
4402
4520
  */
4403
- async createArtifact(body) {
4521
+ async mergeTopics(body) {
4404
4522
  const request = new Request({
4405
4523
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4406
4524
  method: "POST",
4407
- path: "/api/artifacts",
4525
+ path: "/api/topics/merge",
4408
4526
  config: this.config,
4409
4527
  retry: {
4410
4528
  attempts: 3,
@@ -4420,15 +4538,15 @@ var ArtifactsService = class extends BaseService {
4420
4538
  return this.client.call(request);
4421
4539
  }
4422
4540
  /**
4423
- * Get artifact by ID
4424
- * Retrieve a specific artifact by its ID
4425
- * @param id - The artifact ID
4541
+ * Discover related topics
4542
+ * Discover topics related to a given topic
4543
+ * @param body - Request body
4426
4544
  */
4427
- async getArtifactById(id) {
4545
+ async discoverRelatedTopics(body) {
4428
4546
  const request = new Request({
4429
4547
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4430
- method: "GET",
4431
- path: "/api/artifacts/{id}",
4548
+ method: "POST",
4549
+ path: "/api/topics/discover-related",
4432
4550
  config: this.config,
4433
4551
  retry: {
4434
4552
  attempts: 3,
@@ -4438,28 +4556,21 @@ var ArtifactsService = class extends BaseService {
4438
4556
  backoffFactor: 2
4439
4557
  }
4440
4558
  });
4441
- request.addPathParam("id", {
4442
- key: "id",
4443
- value: id,
4444
- explode: false,
4445
- encode: true,
4446
- style: "simple",
4447
- isLimit: false,
4448
- isOffset: false,
4449
- isCursor: false
4450
- });
4559
+ if (body !== void 0) {
4560
+ request.addBody(body);
4561
+ }
4451
4562
  return this.client.call(request);
4452
4563
  }
4453
4564
  /**
4454
- * Delete artifact
4455
- * Delete an artifact by its ID
4456
- * @param id - The artifact ID
4565
+ * Calculate topic similarity
4566
+ * Calculate similarity score between two topics
4567
+ * @param body - Request body
4457
4568
  */
4458
- async deleteArtifact(id) {
4569
+ async calculateTopicSimilarity(body) {
4459
4570
  const request = new Request({
4460
4571
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4461
- method: "DELETE",
4462
- path: "/api/artifacts/{id}",
4572
+ method: "POST",
4573
+ path: "/api/topics/similarity",
4463
4574
  config: this.config,
4464
4575
  retry: {
4465
4576
  attempts: 3,
@@ -4469,29 +4580,21 @@ var ArtifactsService = class extends BaseService {
4469
4580
  backoffFactor: 2
4470
4581
  }
4471
4582
  });
4472
- request.addPathParam("id", {
4473
- key: "id",
4474
- value: id,
4475
- explode: false,
4476
- encode: true,
4477
- style: "simple",
4478
- isLimit: false,
4479
- isOffset: false,
4480
- isCursor: false
4481
- });
4583
+ if (body !== void 0) {
4584
+ request.addBody(body);
4585
+ }
4482
4586
  return this.client.call(request);
4483
4587
  }
4484
4588
  /**
4485
- * Update artifact
4486
- * Update an existing artifact with partial data
4487
- * @param id - The artifact ID
4589
+ * Find similar topics
4590
+ * Find topics similar to a given topic
4488
4591
  * @param body - Request body
4489
4592
  */
4490
- async updateArtifact(id, body) {
4593
+ async findSimilarTopics(body) {
4491
4594
  const request = new Request({
4492
4595
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4493
- method: "PATCH",
4494
- path: "/api/artifacts/{id}",
4596
+ method: "POST",
4597
+ path: "/api/topics/similar",
4495
4598
  config: this.config,
4496
4599
  retry: {
4497
4600
  attempts: 3,
@@ -4501,34 +4604,21 @@ var ArtifactsService = class extends BaseService {
4501
4604
  backoffFactor: 2
4502
4605
  }
4503
4606
  });
4504
- request.addPathParam("id", {
4505
- key: "id",
4506
- value: id,
4507
- explode: false,
4508
- encode: true,
4509
- style: "simple",
4510
- isLimit: false,
4511
- isOffset: false,
4512
- isCursor: false
4513
- });
4514
4607
  if (body !== void 0) {
4515
4608
  request.addBody(body);
4516
4609
  }
4517
4610
  return this.client.call(request);
4518
4611
  }
4519
- };
4520
-
4521
- // src/services/api-keys-service.ts
4522
- var ApiKeysService = class extends BaseService {
4523
4612
  /**
4524
- * Get user information for current API key
4525
- * Debug endpoint to retrieve user ID and authentication method from the current API key
4613
+ * Cluster topics
4614
+ * Cluster topics using community detection algorithms
4615
+ * @param body - Request body
4526
4616
  */
4527
- async debugUser() {
4617
+ async clusterTopics(options) {
4528
4618
  const request = new Request({
4529
4619
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4530
- method: "GET",
4531
- path: "/api/apikeys/debug-user",
4620
+ method: "POST",
4621
+ path: "/api/topics/cluster",
4532
4622
  config: this.config,
4533
4623
  retry: {
4534
4624
  attempts: 3,
@@ -4538,17 +4628,21 @@ var ApiKeysService = class extends BaseService {
4538
4628
  backoffFactor: 2
4539
4629
  }
4540
4630
  });
4631
+ if (options?.body !== void 0) {
4632
+ request.addBody(options?.body);
4633
+ }
4541
4634
  return this.client.call(request);
4542
4635
  }
4543
4636
  /**
4544
- * List API keys
4545
- * List all API keys for the authenticated user
4637
+ * Detect communities
4638
+ * Detect communities in the topic graph using specified algorithm
4639
+ * @param body - Request body
4546
4640
  */
4547
- async listApiKeys() {
4641
+ async detectCommunities(options) {
4548
4642
  const request = new Request({
4549
4643
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4550
- method: "GET",
4551
- path: "/api/apikeys",
4644
+ method: "POST",
4645
+ path: "/api/topics/detect-communities",
4552
4646
  config: this.config,
4553
4647
  retry: {
4554
4648
  attempts: 3,
@@ -4558,18 +4652,21 @@ var ApiKeysService = class extends BaseService {
4558
4652
  backoffFactor: 2
4559
4653
  }
4560
4654
  });
4655
+ if (options?.body !== void 0) {
4656
+ request.addBody(options?.body);
4657
+ }
4561
4658
  return this.client.call(request);
4562
4659
  }
4563
4660
  /**
4564
- * Create API key
4565
- * Create a new API key for the authenticated user
4661
+ * Search topics
4662
+ * Search topics by query string using fulltext search
4566
4663
  * @param body - Request body
4567
4664
  */
4568
- async createApiKey(options) {
4665
+ async searchTopics(body) {
4569
4666
  const request = new Request({
4570
4667
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4571
4668
  method: "POST",
4572
- path: "/api/apikeys",
4669
+ path: "/api/topics/search",
4573
4670
  config: this.config,
4574
4671
  retry: {
4575
4672
  attempts: 3,
@@ -4579,21 +4676,30 @@ var ApiKeysService = class extends BaseService {
4579
4676
  backoffFactor: 2
4580
4677
  }
4581
4678
  });
4582
- if (options?.body !== void 0) {
4583
- request.addBody(options?.body);
4679
+ if (body !== void 0) {
4680
+ request.addBody(body);
4584
4681
  }
4585
4682
  return this.client.call(request);
4586
4683
  }
4684
+ };
4685
+
4686
+ // src/services/users-service.ts
4687
+ var UsersService = class extends BaseService {
4587
4688
  /**
4588
- * Delete API key
4589
- * Delete (revoke) an API key by its ID
4590
- * @param id - The API key ID
4591
- */
4592
- async deleteApiKey(id) {
4689
+ * Sync user from WorkOS
4690
+ * Called by the customer portal after WorkOS authentication.
4691
+ Creates a new user if they don't exist, or updates their profile if they do.
4692
+ This is the main entry point for user provisioning.
4693
+ When the invite gate is closed and a new user is created, the inviteCode
4694
+ is redeemed atomically to track which code was used for registration.
4695
+
4696
+ * @param body - Request body
4697
+ */
4698
+ async syncUser(body) {
4593
4699
  const request = new Request({
4594
4700
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4595
- method: "DELETE",
4596
- path: "/api/apikeys/{id}",
4701
+ method: "POST",
4702
+ path: "/api/users/sync",
4597
4703
  config: this.config,
4598
4704
  retry: {
4599
4705
  attempts: 3,
@@ -4603,34 +4709,20 @@ var ApiKeysService = class extends BaseService {
4603
4709
  backoffFactor: 2
4604
4710
  }
4605
4711
  });
4606
- request.addPathParam("id", {
4607
- key: "id",
4608
- value: id,
4609
- explode: false,
4610
- encode: true,
4611
- style: "simple",
4612
- isLimit: false,
4613
- isOffset: false,
4614
- isCursor: false
4615
- });
4712
+ if (body !== void 0) {
4713
+ request.addBody(body);
4714
+ }
4616
4715
  return this.client.call(request);
4617
4716
  }
4618
- };
4619
-
4620
- // src/services/admin-service.ts
4621
- var AdminService = class extends BaseService {
4622
4717
  /**
4623
- * List invite codes
4624
- * List all invite codes with optional status filter
4625
- * @param status - Filter by status
4626
- * @param limit -
4627
- * @param offset -
4718
+ * Get current user
4719
+ * Get the currently authenticated user's profile and usage information
4628
4720
  */
4629
- async adminListInviteCodes(options) {
4721
+ async getCurrentUser() {
4630
4722
  const request = new Request({
4631
4723
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4632
4724
  method: "GET",
4633
- path: "/api/admin/invites",
4725
+ path: "/api/users/me",
4634
4726
  config: this.config,
4635
4727
  retry: {
4636
4728
  attempts: 3,
@@ -4640,54 +4732,18 @@ var AdminService = class extends BaseService {
4640
4732
  backoffFactor: 2
4641
4733
  }
4642
4734
  });
4643
- if (options?.status !== void 0) {
4644
- request.addQueryParam("status", {
4645
- key: "status",
4646
- value: options.status,
4647
- explode: false,
4648
- encode: true,
4649
- style: "form",
4650
- isLimit: false,
4651
- isOffset: false,
4652
- isCursor: false
4653
- });
4654
- }
4655
- if (options?.limit !== void 0) {
4656
- request.addQueryParam("limit", {
4657
- key: "limit",
4658
- value: options.limit,
4659
- explode: false,
4660
- encode: true,
4661
- style: "form",
4662
- isLimit: true,
4663
- isOffset: false,
4664
- isCursor: false
4665
- });
4666
- }
4667
- if (options?.offset !== void 0) {
4668
- request.addQueryParam("offset", {
4669
- key: "offset",
4670
- value: options.offset,
4671
- explode: false,
4672
- encode: true,
4673
- style: "form",
4674
- isLimit: false,
4675
- isOffset: true,
4676
- isCursor: false
4677
- });
4678
- }
4679
4735
  return this.client.call(request);
4680
4736
  }
4681
4737
  /**
4682
- * Create invite code
4683
- * Create a new invite code for the gated preview
4738
+ * Update current user
4739
+ * Update the currently authenticated user's profile
4684
4740
  * @param body - Request body
4685
4741
  */
4686
- async adminCreateInviteCode(body) {
4742
+ async updateCurrentUser(options) {
4687
4743
  const request = new Request({
4688
4744
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4689
- method: "POST",
4690
- path: "/api/admin/invites",
4745
+ method: "PATCH",
4746
+ path: "/api/users/me",
4691
4747
  config: this.config,
4692
4748
  retry: {
4693
4749
  attempts: 3,
@@ -4697,20 +4753,20 @@ var AdminService = class extends BaseService {
4697
4753
  backoffFactor: 2
4698
4754
  }
4699
4755
  });
4700
- if (body !== void 0) {
4701
- request.addBody(body);
4756
+ if (options?.body !== void 0) {
4757
+ request.addBody(options?.body);
4702
4758
  }
4703
4759
  return this.client.call(request);
4704
4760
  }
4705
4761
  /**
4706
- * Get invite system statistics
4707
- * Aggregate statistics for the invite system
4762
+ * Get current user's usage
4763
+ * Get the currently authenticated user's memory usage statistics
4708
4764
  */
4709
- async adminGetInviteStats() {
4765
+ async getCurrentUserUsage() {
4710
4766
  const request = new Request({
4711
4767
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4712
4768
  method: "GET",
4713
- path: "/api/admin/invites/stats",
4769
+ path: "/api/users/me/usage",
4714
4770
  config: this.config,
4715
4771
  retry: {
4716
4772
  attempts: 3,
@@ -4723,15 +4779,18 @@ var AdminService = class extends BaseService {
4723
4779
  return this.client.call(request);
4724
4780
  }
4725
4781
  /**
4726
- * Get invite code details
4727
- * Get details for a single invite code including redemptions
4728
- * @param code - The invite code
4729
- */
4730
- async adminGetInviteCode(code) {
4782
+ * Export all user data
4783
+ * Export all user data as a JSON archive. Includes profile, memories,
4784
+ conversations, facts, and patterns. Supports GDPR Article 20
4785
+ (right to data portability). Sensitive fields (Stripe customer ID,
4786
+ WorkOS ID, embeddings) are excluded.
4787
+
4788
+ */
4789
+ async exportUserData() {
4731
4790
  const request = new Request({
4732
4791
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4733
4792
  method: "GET",
4734
- path: "/api/admin/invites/{code}",
4793
+ path: "/api/users/me/export",
4735
4794
  config: this.config,
4736
4795
  retry: {
4737
4796
  attempts: 3,
@@ -4741,28 +4800,21 @@ var AdminService = class extends BaseService {
4741
4800
  backoffFactor: 2
4742
4801
  }
4743
4802
  });
4744
- request.addPathParam("code", {
4745
- key: "code",
4746
- value: code,
4747
- explode: false,
4748
- encode: true,
4749
- style: "simple",
4750
- isLimit: false,
4751
- isOffset: false,
4752
- isCursor: false
4753
- });
4754
4803
  return this.client.call(request);
4755
4804
  }
4756
4805
  /**
4757
- * Revoke an invite code
4758
- * Revoke an invite code. Existing accounts created with this code are unaffected.
4759
- * @param code -
4760
- */
4761
- async adminRevokeInviteCode(code) {
4806
+ * Initiate account deletion
4807
+ * Schedule the current user's account for deletion after a 7-day grace period.
4808
+ Requires email confirmation. Immediately revokes API keys and cancels
4809
+ any active subscription. The account enters read-only mode.
4810
+
4811
+ * @param body - Request body
4812
+ */
4813
+ async initiateAccountDeletion(body) {
4762
4814
  const request = new Request({
4763
4815
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4764
- method: "DELETE",
4765
- path: "/api/admin/invites/{code}",
4816
+ method: "POST",
4817
+ path: "/api/users/me/deletion",
4766
4818
  config: this.config,
4767
4819
  retry: {
4768
4820
  attempts: 3,
@@ -4772,27 +4824,23 @@ var AdminService = class extends BaseService {
4772
4824
  backoffFactor: 2
4773
4825
  }
4774
4826
  });
4775
- request.addPathParam("code", {
4776
- key: "code",
4777
- value: code,
4778
- explode: false,
4779
- encode: true,
4780
- style: "simple",
4781
- isLimit: false,
4782
- isOffset: false,
4783
- isCursor: false
4784
- });
4827
+ if (body !== void 0) {
4828
+ request.addBody(body);
4829
+ }
4785
4830
  return this.client.call(request);
4786
4831
  }
4787
4832
  /**
4788
- * Get gate status with audit info
4789
- * Get current invite gate state with audit information
4790
- */
4791
- async adminGetGateStatus() {
4833
+ * Cancel account deletion
4834
+ * Cancel a pending account deletion during the grace period.
4835
+ Note: Previously revoked API keys are not restored — new keys must be created.
4836
+ Stripe subscription may need manual reactivation via the billing portal.
4837
+
4838
+ */
4839
+ async cancelAccountDeletion() {
4792
4840
  const request = new Request({
4793
4841
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4794
- method: "GET",
4795
- path: "/api/admin/gate",
4842
+ method: "DELETE",
4843
+ path: "/api/users/me/deletion",
4796
4844
  config: this.config,
4797
4845
  retry: {
4798
4846
  attempts: 3,
@@ -4805,17 +4853,15 @@ var AdminService = class extends BaseService {
4805
4853
  return this.client.call(request);
4806
4854
  }
4807
4855
  /**
4808
- * Toggle invite gate
4809
- * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
4810
- When disabled (false), registration is open. Takes effect immediately.
4811
-
4812
- * @param body - Request body
4813
- */
4814
- async adminSetGateStatus(body) {
4856
+ * Get user by ID
4857
+ * Get a user by their internal ID (admin only)
4858
+ * @param id -
4859
+ */
4860
+ async getUserById(id) {
4815
4861
  const request = new Request({
4816
4862
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4817
- method: "POST",
4818
- path: "/api/admin/gate",
4863
+ method: "GET",
4864
+ path: "/api/users/{id}",
4819
4865
  config: this.config,
4820
4866
  retry: {
4821
4867
  attempts: 3,
@@ -4825,44 +4871,20 @@ var AdminService = class extends BaseService {
4825
4871
  backoffFactor: 2
4826
4872
  }
4827
4873
  });
4828
- if (body !== void 0) {
4829
- request.addBody(body);
4830
- }
4874
+ request.addPathParam("id", {
4875
+ key: "id",
4876
+ value: id,
4877
+ explode: false,
4878
+ encode: true,
4879
+ style: "simple",
4880
+ isLimit: false,
4881
+ isOffset: false,
4882
+ isCursor: false
4883
+ });
4831
4884
  return this.client.call(request);
4832
4885
  }
4833
4886
  };
4834
4887
 
4835
- // src/http/http-types.ts
4836
- var SerializationStyle = /* @__PURE__ */ ((SerializationStyle2) => {
4837
- SerializationStyle2["SIMPLE"] = "simple";
4838
- SerializationStyle2["LABEL"] = "label";
4839
- SerializationStyle2["MATRIX"] = "matrix";
4840
- SerializationStyle2["FORM"] = "form";
4841
- SerializationStyle2["SPACE_DELIMITED"] = "space_delimited";
4842
- SerializationStyle2["PIPE_DELIMITED"] = "pipe_delimited";
4843
- SerializationStyle2["DEEP_OBJECT"] = "deep_object";
4844
- SerializationStyle2["NONE"] = "none";
4845
- return SerializationStyle2;
4846
- })(SerializationStyle || {});
4847
- var ContentType = /* @__PURE__ */ ((ContentType2) => {
4848
- ContentType2["Json"] = "json";
4849
- ContentType2["Xml"] = "xml";
4850
- ContentType2["Pdf"] = "pdf";
4851
- ContentType2["Image"] = "image";
4852
- ContentType2["File"] = "file";
4853
- ContentType2["Binary"] = "binary";
4854
- ContentType2["FormUrlEncoded"] = "form";
4855
- ContentType2["Text"] = "text";
4856
- ContentType2["MultipartFormData"] = "multipartFormData";
4857
- ContentType2["EventStream"] = "eventStream";
4858
- ContentType2["NoContent"] = "noContent";
4859
- return ContentType2;
4860
- })(ContentType || {});
4861
- var Environment = /* @__PURE__ */ ((Environment2) => {
4862
- Environment2["DEFAULT"] = "http://localhost:3000";
4863
- return Environment2;
4864
- })(Environment || {});
4865
-
4866
4888
  // src/models/schemas.ts
4867
4889
  var import_zod = require("zod");
4868
4890
  var error = import_zod.z.object({
@@ -6078,42 +6100,42 @@ var buildContextResponse = import_zod.z.lazy(() => import_zod.z.object({
6078
6100
  // src/index.ts
6079
6101
  var Memnexus = class {
6080
6102
  config;
6081
- /** User management and profile endpoints operations */
6082
- users;
6083
- /** Topic detection, clustering, and management endpoints operations */
6084
- topics;
6103
+ /** Admin management endpoints for invite codes and platform configuration operations */
6104
+ admin;
6105
+ /** API key management endpoints operations */
6106
+ apiKeys;
6107
+ /** Artifact storage and retrieval endpoints operations */
6108
+ artifacts;
6109
+ /** Subscription billing and payment management endpoints operations */
6110
+ billing;
6111
+ /** Conversation tracking and analysis endpoints operations */
6112
+ conversations;
6113
+ /** Entity extraction and discovery endpoints operations */
6114
+ entities;
6115
+ /** Fact extraction and management endpoints operations */
6116
+ facts;
6117
+ /** Graph-based retrieval augmented generation endpoints operations */
6118
+ graphrag;
6119
+ /** Health check endpoints operations */
6120
+ health;
6121
+ /** Invite code validation and gate status endpoints operations */
6122
+ invites;
6123
+ /** Memory management and retrieval endpoints operations */
6124
+ memories;
6125
+ /** Observability and metrics endpoints for production monitoring operations */
6126
+ monitoring;
6127
+ /** Narrative thread management endpoints operations */
6128
+ narratives;
6085
6129
  /** System health, monitoring, and configuration endpoints operations */
6086
6130
  system;
6087
6131
  /** Pattern detection and behavioral analysis endpoints operations */
6088
6132
  patterns;
6089
6133
  /** Behavioral pattern tracking and state management endpoints operations */
6090
6134
  behavior;
6091
- /** Narrative thread management endpoints operations */
6092
- narratives;
6093
- /** Observability and metrics endpoints for production monitoring operations */
6094
- monitoring;
6095
- /** Memory management and retrieval endpoints operations */
6096
- memories;
6097
- /** Invite code validation and gate status endpoints operations */
6098
- invites;
6099
- /** Health check endpoints operations */
6100
- health;
6101
- /** Graph-based retrieval augmented generation endpoints operations */
6102
- graphrag;
6103
- /** Fact extraction and management endpoints operations */
6104
- facts;
6105
- /** Entity extraction and discovery endpoints operations */
6106
- entities;
6107
- /** Conversation tracking and analysis endpoints operations */
6108
- conversations;
6109
- /** Subscription billing and payment management endpoints operations */
6110
- billing;
6111
- /** Artifact storage and retrieval endpoints operations */
6112
- artifacts;
6113
- /** API key management endpoints operations */
6114
- apiKeys;
6115
- /** Admin management endpoints for invite codes and platform configuration operations */
6116
- admin;
6135
+ /** Topic detection, clustering, and management endpoints operations */
6136
+ topics;
6137
+ /** User management and profile endpoints operations */
6138
+ users;
6117
6139
  /**
6118
6140
  * Create a new SDK client.
6119
6141
  * @param config - SDK configuration
@@ -6123,24 +6145,24 @@ var Memnexus = class {
6123
6145
  baseUrl: config.baseUrl || "http://localhost:3000",
6124
6146
  ...config
6125
6147
  };
6126
- this.users = new UsersService(this.config);
6127
- this.topics = new TopicsService(this.config);
6148
+ this.admin = new AdminService(this.config);
6149
+ this.apiKeys = new ApiKeysService(this.config);
6150
+ this.artifacts = new ArtifactsService(this.config);
6151
+ this.billing = new BillingService(this.config);
6152
+ this.conversations = new ConversationsService(this.config);
6153
+ this.entities = new EntitiesService(this.config);
6154
+ this.facts = new FactsService(this.config);
6155
+ this.graphrag = new GraphragService(this.config);
6156
+ this.health = new HealthService(this.config);
6157
+ this.invites = new InvitesService(this.config);
6158
+ this.memories = new MemoriesService(this.config);
6159
+ this.monitoring = new MonitoringService(this.config);
6160
+ this.narratives = new NarrativesService(this.config);
6128
6161
  this.system = new SystemService(this.config);
6129
6162
  this.patterns = new PatternsService(this.config);
6130
6163
  this.behavior = new BehaviorService(this.config);
6131
- this.narratives = new NarrativesService(this.config);
6132
- this.monitoring = new MonitoringService(this.config);
6133
- this.memories = new MemoriesService(this.config);
6134
- this.invites = new InvitesService(this.config);
6135
- this.health = new HealthService(this.config);
6136
- this.graphrag = new GraphragService(this.config);
6137
- this.facts = new FactsService(this.config);
6138
- this.entities = new EntitiesService(this.config);
6139
- this.conversations = new ConversationsService(this.config);
6140
- this.billing = new BillingService(this.config);
6141
- this.artifacts = new ArtifactsService(this.config);
6142
- this.apiKeys = new ApiKeysService(this.config);
6143
- this.admin = new AdminService(this.config);
6164
+ this.topics = new TopicsService(this.config);
6165
+ this.users = new UsersService(this.config);
6144
6166
  }
6145
6167
  /**
6146
6168
  * Set the API token for authentication.
@@ -6148,24 +6170,24 @@ var Memnexus = class {
6148
6170
  */
6149
6171
  setToken(token) {
6150
6172
  this.config.token = token;
6151
- this.users.token = token;
6152
- this.topics.token = token;
6173
+ this.admin.token = token;
6174
+ this.apiKeys.token = token;
6175
+ this.artifacts.token = token;
6176
+ this.billing.token = token;
6177
+ this.conversations.token = token;
6178
+ this.entities.token = token;
6179
+ this.facts.token = token;
6180
+ this.graphrag.token = token;
6181
+ this.health.token = token;
6182
+ this.invites.token = token;
6183
+ this.memories.token = token;
6184
+ this.monitoring.token = token;
6185
+ this.narratives.token = token;
6153
6186
  this.system.token = token;
6154
6187
  this.patterns.token = token;
6155
6188
  this.behavior.token = token;
6156
- this.narratives.token = token;
6157
- this.monitoring.token = token;
6158
- this.memories.token = token;
6159
- this.invites.token = token;
6160
- this.health.token = token;
6161
- this.graphrag.token = token;
6162
- this.facts.token = token;
6163
- this.entities.token = token;
6164
- this.conversations.token = token;
6165
- this.billing.token = token;
6166
- this.artifacts.token = token;
6167
- this.apiKeys.token = token;
6168
- this.admin.token = token;
6189
+ this.topics.token = token;
6190
+ this.users.token = token;
6169
6191
  }
6170
6192
  /**
6171
6193
  * Set the base URL for API requests.
@@ -6173,24 +6195,24 @@ var Memnexus = class {
6173
6195
  */
6174
6196
  setBaseUrl(baseUrl) {
6175
6197
  this.config.baseUrl = baseUrl;
6176
- this.users.baseUrl = baseUrl;
6177
- this.topics.baseUrl = baseUrl;
6198
+ this.admin.baseUrl = baseUrl;
6199
+ this.apiKeys.baseUrl = baseUrl;
6200
+ this.artifacts.baseUrl = baseUrl;
6201
+ this.billing.baseUrl = baseUrl;
6202
+ this.conversations.baseUrl = baseUrl;
6203
+ this.entities.baseUrl = baseUrl;
6204
+ this.facts.baseUrl = baseUrl;
6205
+ this.graphrag.baseUrl = baseUrl;
6206
+ this.health.baseUrl = baseUrl;
6207
+ this.invites.baseUrl = baseUrl;
6208
+ this.memories.baseUrl = baseUrl;
6209
+ this.monitoring.baseUrl = baseUrl;
6210
+ this.narratives.baseUrl = baseUrl;
6178
6211
  this.system.baseUrl = baseUrl;
6179
6212
  this.patterns.baseUrl = baseUrl;
6180
6213
  this.behavior.baseUrl = baseUrl;
6181
- this.narratives.baseUrl = baseUrl;
6182
- this.monitoring.baseUrl = baseUrl;
6183
- this.memories.baseUrl = baseUrl;
6184
- this.invites.baseUrl = baseUrl;
6185
- this.health.baseUrl = baseUrl;
6186
- this.graphrag.baseUrl = baseUrl;
6187
- this.facts.baseUrl = baseUrl;
6188
- this.entities.baseUrl = baseUrl;
6189
- this.conversations.baseUrl = baseUrl;
6190
- this.billing.baseUrl = baseUrl;
6191
- this.artifacts.baseUrl = baseUrl;
6192
- this.apiKeys.baseUrl = baseUrl;
6193
- this.admin.baseUrl = baseUrl;
6214
+ this.topics.baseUrl = baseUrl;
6215
+ this.users.baseUrl = baseUrl;
6194
6216
  }
6195
6217
  /**
6196
6218
  * Set the environment.
@@ -6198,24 +6220,24 @@ var Memnexus = class {
6198
6220
  */
6199
6221
  setEnvironment(environment) {
6200
6222
  this.config.environment = environment;
6201
- this.users.environment = environment;
6202
- this.topics.environment = environment;
6223
+ this.admin.environment = environment;
6224
+ this.apiKeys.environment = environment;
6225
+ this.artifacts.environment = environment;
6226
+ this.billing.environment = environment;
6227
+ this.conversations.environment = environment;
6228
+ this.entities.environment = environment;
6229
+ this.facts.environment = environment;
6230
+ this.graphrag.environment = environment;
6231
+ this.health.environment = environment;
6232
+ this.invites.environment = environment;
6233
+ this.memories.environment = environment;
6234
+ this.monitoring.environment = environment;
6235
+ this.narratives.environment = environment;
6203
6236
  this.system.environment = environment;
6204
6237
  this.patterns.environment = environment;
6205
6238
  this.behavior.environment = environment;
6206
- this.narratives.environment = environment;
6207
- this.monitoring.environment = environment;
6208
- this.memories.environment = environment;
6209
- this.invites.environment = environment;
6210
- this.health.environment = environment;
6211
- this.graphrag.environment = environment;
6212
- this.facts.environment = environment;
6213
- this.entities.environment = environment;
6214
- this.conversations.environment = environment;
6215
- this.billing.environment = environment;
6216
- this.artifacts.environment = environment;
6217
- this.apiKeys.environment = environment;
6218
- this.admin.environment = environment;
6239
+ this.topics.environment = environment;
6240
+ this.users.environment = environment;
6219
6241
  }
6220
6242
  };
6221
6243
  var index_default = Memnexus;
@@ -6239,6 +6261,7 @@ var index_default = Memnexus;
6239
6261
  MonitoringService,
6240
6262
  NarrativesService,
6241
6263
  PatternsService,
6264
+ SdkError,
6242
6265
  SerializationStyle,
6243
6266
  SystemService,
6244
6267
  TopicsService,