@memnexus-ai/typescript-sdk 1.42.12 → 1.42.13

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
@@ -546,77 +546,23 @@ function serializeQueryParam(key, param) {
546
546
  return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;
547
547
  }
548
548
 
549
- // src/services/admin-service.ts
550
- var AdminService = class extends BaseService {
551
- /**
552
- * List invite codes
553
- * List all invite codes with optional status filter
554
- * @param status - Filter by status
555
- * @param limit -
556
- * @param offset -
557
- */
558
- async adminListInviteCodes(options) {
559
- const request = new Request({
560
- baseUrl: this.config.baseUrl || "http://localhost:3000",
561
- method: "GET",
562
- path: "/api/admin/invites",
563
- config: this.config,
564
- retry: {
565
- attempts: 3,
566
- delayMs: 150,
567
- maxDelayMs: 5e3,
568
- jitterMs: 50,
569
- backoffFactor: 2
570
- }
571
- });
572
- if (options?.status !== void 0) {
573
- request.addQueryParam("status", {
574
- key: "status",
575
- value: options.status,
576
- explode: false,
577
- encode: true,
578
- style: "form",
579
- isLimit: false,
580
- isOffset: false,
581
- isCursor: false
582
- });
583
- }
584
- if (options?.limit !== void 0) {
585
- request.addQueryParam("limit", {
586
- key: "limit",
587
- value: options.limit,
588
- explode: false,
589
- encode: true,
590
- style: "form",
591
- isLimit: true,
592
- isOffset: false,
593
- isCursor: false
594
- });
595
- }
596
- if (options?.offset !== void 0) {
597
- request.addQueryParam("offset", {
598
- key: "offset",
599
- value: options.offset,
600
- explode: false,
601
- encode: true,
602
- style: "form",
603
- isLimit: false,
604
- isOffset: true,
605
- isCursor: false
606
- });
607
- }
608
- return this.client.call(request);
609
- }
549
+ // src/services/users-service.ts
550
+ var UsersService = class extends BaseService {
610
551
  /**
611
- * Create invite code
612
- * Create a new invite code for the gated preview
613
- * @param body - Request body
614
- */
615
- async adminCreateInviteCode(body) {
552
+ * Sync user from WorkOS
553
+ * Called by the customer portal after WorkOS authentication.
554
+ Creates a new user if they don't exist, or updates their profile if they do.
555
+ This is the main entry point for user provisioning.
556
+ When the invite gate is closed and a new user is created, the inviteCode
557
+ is redeemed atomically to track which code was used for registration.
558
+
559
+ * @param body - Request body
560
+ */
561
+ async syncUser(body) {
616
562
  const request = new Request({
617
563
  baseUrl: this.config.baseUrl || "http://localhost:3000",
618
564
  method: "POST",
619
- path: "/api/admin/invites",
565
+ path: "/api/users/sync",
620
566
  config: this.config,
621
567
  retry: {
622
568
  attempts: 3,
@@ -632,14 +578,14 @@ var AdminService = class extends BaseService {
632
578
  return this.client.call(request);
633
579
  }
634
580
  /**
635
- * Get invite system statistics
636
- * Aggregate statistics for the invite system
581
+ * Get current user
582
+ * Get the currently authenticated user's profile and usage information
637
583
  */
638
- async adminGetInviteStats() {
584
+ async getCurrentUser() {
639
585
  const request = new Request({
640
586
  baseUrl: this.config.baseUrl || "http://localhost:3000",
641
587
  method: "GET",
642
- path: "/api/admin/invites/stats",
588
+ path: "/api/users/me",
643
589
  config: this.config,
644
590
  retry: {
645
591
  attempts: 3,
@@ -652,15 +598,15 @@ var AdminService = class extends BaseService {
652
598
  return this.client.call(request);
653
599
  }
654
600
  /**
655
- * Get invite code details
656
- * Get details for a single invite code including redemptions
657
- * @param code - The invite code
601
+ * Update current user
602
+ * Update the currently authenticated user's profile
603
+ * @param body - Request body
658
604
  */
659
- async adminGetInviteCode(code) {
605
+ async updateCurrentUser(options) {
660
606
  const request = new Request({
661
607
  baseUrl: this.config.baseUrl || "http://localhost:3000",
662
- method: "GET",
663
- path: "/api/admin/invites/{code}",
608
+ method: "PATCH",
609
+ path: "/api/users/me",
664
610
  config: this.config,
665
611
  retry: {
666
612
  attempts: 3,
@@ -670,28 +616,20 @@ var AdminService = class extends BaseService {
670
616
  backoffFactor: 2
671
617
  }
672
618
  });
673
- request.addPathParam("code", {
674
- key: "code",
675
- value: code,
676
- explode: false,
677
- encode: true,
678
- style: "simple",
679
- isLimit: false,
680
- isOffset: false,
681
- isCursor: false
682
- });
619
+ if (options?.body !== void 0) {
620
+ request.addBody(options?.body);
621
+ }
683
622
  return this.client.call(request);
684
623
  }
685
624
  /**
686
- * Revoke an invite code
687
- * Revoke an invite code. Existing accounts created with this code are unaffected.
688
- * @param code -
625
+ * Get current user's usage
626
+ * Get the currently authenticated user's memory usage statistics
689
627
  */
690
- async adminRevokeInviteCode(code) {
628
+ async getCurrentUserUsage() {
691
629
  const request = new Request({
692
630
  baseUrl: this.config.baseUrl || "http://localhost:3000",
693
- method: "DELETE",
694
- path: "/api/admin/invites/{code}",
631
+ method: "GET",
632
+ path: "/api/users/me/usage",
695
633
  config: this.config,
696
634
  retry: {
697
635
  attempts: 3,
@@ -701,27 +639,21 @@ var AdminService = class extends BaseService {
701
639
  backoffFactor: 2
702
640
  }
703
641
  });
704
- request.addPathParam("code", {
705
- key: "code",
706
- value: code,
707
- explode: false,
708
- encode: true,
709
- style: "simple",
710
- isLimit: false,
711
- isOffset: false,
712
- isCursor: false
713
- });
714
642
  return this.client.call(request);
715
643
  }
716
644
  /**
717
- * Get gate status with audit info
718
- * Get current invite gate state with audit information
719
- */
720
- async adminGetGateStatus() {
645
+ * Export all user data
646
+ * Export all user data as a JSON archive. Includes profile, memories,
647
+ conversations, facts, and patterns. Supports GDPR Article 20
648
+ (right to data portability). Sensitive fields (Stripe customer ID,
649
+ WorkOS ID, embeddings) are excluded.
650
+
651
+ */
652
+ async exportUserData() {
721
653
  const request = new Request({
722
654
  baseUrl: this.config.baseUrl || "http://localhost:3000",
723
655
  method: "GET",
724
- path: "/api/admin/gate",
656
+ path: "/api/users/me/export",
725
657
  config: this.config,
726
658
  retry: {
727
659
  attempts: 3,
@@ -734,17 +666,18 @@ var AdminService = class extends BaseService {
734
666
  return this.client.call(request);
735
667
  }
736
668
  /**
737
- * Toggle invite gate
738
- * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
739
- When disabled (false), registration is open. Takes effect immediately.
669
+ * Initiate account deletion
670
+ * Schedule the current user's account for deletion after a 7-day grace period.
671
+ Requires email confirmation. Immediately revokes API keys and cancels
672
+ any active subscription. The account enters read-only mode.
740
673
 
741
674
  * @param body - Request body
742
675
  */
743
- async adminSetGateStatus(body) {
676
+ async initiateAccountDeletion(body) {
744
677
  const request = new Request({
745
678
  baseUrl: this.config.baseUrl || "http://localhost:3000",
746
679
  method: "POST",
747
- path: "/api/admin/gate",
680
+ path: "/api/users/me/deletion",
748
681
  config: this.config,
749
682
  retry: {
750
683
  attempts: 3,
@@ -759,19 +692,18 @@ var AdminService = class extends BaseService {
759
692
  }
760
693
  return this.client.call(request);
761
694
  }
762
- };
763
-
764
- // src/services/api-keys-service.ts
765
- var ApiKeysService = class extends BaseService {
766
695
  /**
767
- * Get user information for current API key
768
- * Debug endpoint to retrieve user ID and authentication method from the current API key
769
- */
770
- async debugUser() {
696
+ * Cancel account deletion
697
+ * Cancel a pending account deletion during the grace period.
698
+ Note: Previously revoked API keys are not restored — new keys must be created.
699
+ Stripe subscription may need manual reactivation via the billing portal.
700
+
701
+ */
702
+ async cancelAccountDeletion() {
771
703
  const request = new Request({
772
704
  baseUrl: this.config.baseUrl || "http://localhost:3000",
773
- method: "GET",
774
- path: "/api/apikeys/debug-user",
705
+ method: "DELETE",
706
+ path: "/api/users/me/deletion",
775
707
  config: this.config,
776
708
  retry: {
777
709
  attempts: 3,
@@ -784,59 +716,15 @@ var ApiKeysService = class extends BaseService {
784
716
  return this.client.call(request);
785
717
  }
786
718
  /**
787
- * List API keys
788
- * List all API keys for the authenticated user
719
+ * Get user by ID
720
+ * Get a user by their internal ID (admin only)
721
+ * @param id -
789
722
  */
790
- async listApiKeys() {
723
+ async getUserById(id) {
791
724
  const request = new Request({
792
725
  baseUrl: this.config.baseUrl || "http://localhost:3000",
793
726
  method: "GET",
794
- path: "/api/apikeys",
795
- config: this.config,
796
- retry: {
797
- attempts: 3,
798
- delayMs: 150,
799
- maxDelayMs: 5e3,
800
- jitterMs: 50,
801
- backoffFactor: 2
802
- }
803
- });
804
- return this.client.call(request);
805
- }
806
- /**
807
- * Create API key
808
- * Create a new API key for the authenticated user
809
- * @param body - Request body
810
- */
811
- async createApiKey(options) {
812
- const request = new Request({
813
- baseUrl: this.config.baseUrl || "http://localhost:3000",
814
- method: "POST",
815
- path: "/api/apikeys",
816
- config: this.config,
817
- retry: {
818
- attempts: 3,
819
- delayMs: 150,
820
- maxDelayMs: 5e3,
821
- jitterMs: 50,
822
- backoffFactor: 2
823
- }
824
- });
825
- if (options?.body !== void 0) {
826
- request.addBody(options?.body);
827
- }
828
- return this.client.call(request);
829
- }
830
- /**
831
- * Delete API key
832
- * Delete (revoke) an API key by its ID
833
- * @param id - The API key ID
834
- */
835
- async deleteApiKey(id) {
836
- const request = new Request({
837
- baseUrl: this.config.baseUrl || "http://localhost:3000",
838
- method: "DELETE",
839
- path: "/api/apikeys/{id}",
727
+ path: "/api/users/{id}",
840
728
  config: this.config,
841
729
  retry: {
842
730
  attempts: 3,
@@ -860,22 +748,19 @@ var ApiKeysService = class extends BaseService {
860
748
  }
861
749
  };
862
750
 
863
- // src/services/artifacts-service.ts
864
- var ArtifactsService = class extends BaseService {
751
+ // src/services/topics-service.ts
752
+ var TopicsService = class extends BaseService {
865
753
  /**
866
- * List artifacts
867
- * List all artifacts for the authenticated user with optional filters
868
- * @param limit - Maximum number of artifacts to return
869
- * @param offset - Number of artifacts to skip
870
- * @param memoryId - Filter by memory ID
871
- * @param conversationId - Filter by conversation ID
872
- * @param type - Filter by artifact type
754
+ * List topics
755
+ * List all topics with pagination
756
+ * @param limit - Maximum number of topics to return
757
+ * @param offset - Number of topics to skip
873
758
  */
874
- async listArtifacts(options) {
759
+ async listTopics(options) {
875
760
  const request = new Request({
876
761
  baseUrl: this.config.baseUrl || "http://localhost:3000",
877
762
  method: "GET",
878
- path: "/api/artifacts",
763
+ path: "/api/topics",
879
764
  config: this.config,
880
765
  retry: {
881
766
  attempts: 3,
@@ -909,78 +794,18 @@ var ArtifactsService = class extends BaseService {
909
794
  isCursor: false
910
795
  });
911
796
  }
912
- if (options?.memoryId !== void 0) {
913
- request.addQueryParam("memoryId", {
914
- key: "memoryId",
915
- value: options.memoryId,
916
- explode: false,
917
- encode: true,
918
- style: "form",
919
- isLimit: false,
920
- isOffset: false,
921
- isCursor: false
922
- });
923
- }
924
- if (options?.conversationId !== void 0) {
925
- request.addQueryParam("conversationId", {
926
- key: "conversationId",
927
- value: options.conversationId,
928
- explode: false,
929
- encode: true,
930
- style: "form",
931
- isLimit: false,
932
- isOffset: false,
933
- isCursor: false
934
- });
935
- }
936
- if (options?.type !== void 0) {
937
- request.addQueryParam("type", {
938
- key: "type",
939
- value: options.type,
940
- explode: false,
941
- encode: true,
942
- style: "form",
943
- isLimit: false,
944
- isOffset: false,
945
- isCursor: false
946
- });
947
- }
948
- return this.client.call(request);
949
- }
950
- /**
951
- * Create artifact
952
- * Create a new artifact for the authenticated user
953
- * @param body - Request body
954
- */
955
- async createArtifact(body) {
956
- const request = new Request({
957
- baseUrl: this.config.baseUrl || "http://localhost:3000",
958
- method: "POST",
959
- path: "/api/artifacts",
960
- config: this.config,
961
- retry: {
962
- attempts: 3,
963
- delayMs: 150,
964
- maxDelayMs: 5e3,
965
- jitterMs: 50,
966
- backoffFactor: 2
967
- }
968
- });
969
- if (body !== void 0) {
970
- request.addBody(body);
971
- }
972
797
  return this.client.call(request);
973
798
  }
974
799
  /**
975
- * Get artifact by ID
976
- * Retrieve a specific artifact by its ID
977
- * @param id - The artifact ID
800
+ * Get topic by ID
801
+ * Retrieve a specific topic by its ID
802
+ * @param id - The topic ID
978
803
  */
979
- async getArtifactById(id) {
804
+ async getTopicById(id) {
980
805
  const request = new Request({
981
806
  baseUrl: this.config.baseUrl || "http://localhost:3000",
982
807
  method: "GET",
983
- path: "/api/artifacts/{id}",
808
+ path: "/api/topics/{id}",
984
809
  config: this.config,
985
810
  retry: {
986
811
  attempts: 3,
@@ -1003,15 +828,15 @@ var ArtifactsService = class extends BaseService {
1003
828
  return this.client.call(request);
1004
829
  }
1005
830
  /**
1006
- * Delete artifact
1007
- * Delete an artifact by its ID
1008
- * @param id - The artifact ID
831
+ * Merge topics
832
+ * Merge two topics into one
833
+ * @param body - Request body
1009
834
  */
1010
- async deleteArtifact(id) {
835
+ async mergeTopics(body) {
1011
836
  const request = new Request({
1012
837
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1013
- method: "DELETE",
1014
- path: "/api/artifacts/{id}",
838
+ method: "POST",
839
+ path: "/api/topics/merge",
1015
840
  config: this.config,
1016
841
  retry: {
1017
842
  attempts: 3,
@@ -1021,29 +846,21 @@ var ArtifactsService = class extends BaseService {
1021
846
  backoffFactor: 2
1022
847
  }
1023
848
  });
1024
- request.addPathParam("id", {
1025
- key: "id",
1026
- value: id,
1027
- explode: false,
1028
- encode: true,
1029
- style: "simple",
1030
- isLimit: false,
1031
- isOffset: false,
1032
- isCursor: false
1033
- });
849
+ if (body !== void 0) {
850
+ request.addBody(body);
851
+ }
1034
852
  return this.client.call(request);
1035
853
  }
1036
854
  /**
1037
- * Update artifact
1038
- * Update an existing artifact with partial data
1039
- * @param id - The artifact ID
855
+ * Discover related topics
856
+ * Discover topics related to a given topic
1040
857
  * @param body - Request body
1041
858
  */
1042
- async updateArtifact(id, body) {
859
+ async discoverRelatedTopics(body) {
1043
860
  const request = new Request({
1044
861
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1045
- method: "PATCH",
1046
- path: "/api/artifacts/{id}",
862
+ method: "POST",
863
+ path: "/api/topics/discover-related",
1047
864
  config: this.config,
1048
865
  retry: {
1049
866
  attempts: 3,
@@ -1053,34 +870,21 @@ var ArtifactsService = class extends BaseService {
1053
870
  backoffFactor: 2
1054
871
  }
1055
872
  });
1056
- request.addPathParam("id", {
1057
- key: "id",
1058
- value: id,
1059
- explode: false,
1060
- encode: true,
1061
- style: "simple",
1062
- isLimit: false,
1063
- isOffset: false,
1064
- isCursor: false
1065
- });
1066
873
  if (body !== void 0) {
1067
874
  request.addBody(body);
1068
875
  }
1069
876
  return this.client.call(request);
1070
877
  }
1071
- };
1072
-
1073
- // src/services/billing-service.ts
1074
- var BillingService = class extends BaseService {
1075
878
  /**
1076
- * Get billing overview
1077
- * Get subscription, payment method, and upcoming invoice information
879
+ * Calculate topic similarity
880
+ * Calculate similarity score between two topics
881
+ * @param body - Request body
1078
882
  */
1079
- async getBillingOverview() {
883
+ async calculateTopicSimilarity(body) {
1080
884
  const request = new Request({
1081
885
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1082
- method: "GET",
1083
- path: "/api/billing/overview",
886
+ method: "POST",
887
+ path: "/api/topics/similarity",
1084
888
  config: this.config,
1085
889
  retry: {
1086
890
  attempts: 3,
@@ -1090,18 +894,21 @@ var BillingService = class extends BaseService {
1090
894
  backoffFactor: 2
1091
895
  }
1092
896
  });
897
+ if (body !== void 0) {
898
+ request.addBody(body);
899
+ }
1093
900
  return this.client.call(request);
1094
901
  }
1095
902
  /**
1096
- * Create checkout session
1097
- * Create a Stripe checkout session for subscription upgrade
903
+ * Find similar topics
904
+ * Find topics similar to a given topic
1098
905
  * @param body - Request body
1099
906
  */
1100
- async createCheckoutSession(body) {
907
+ async findSimilarTopics(body) {
1101
908
  const request = new Request({
1102
909
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1103
910
  method: "POST",
1104
- path: "/api/billing/checkout",
911
+ path: "/api/topics/similar",
1105
912
  config: this.config,
1106
913
  retry: {
1107
914
  attempts: 3,
@@ -1117,15 +924,15 @@ var BillingService = class extends BaseService {
1117
924
  return this.client.call(request);
1118
925
  }
1119
926
  /**
1120
- * Create billing portal session
1121
- * Create a Stripe billing portal session for managing subscription
927
+ * Cluster topics
928
+ * Cluster topics using community detection algorithms
1122
929
  * @param body - Request body
1123
930
  */
1124
- async createPortalSession(body) {
931
+ async clusterTopics(options) {
1125
932
  const request = new Request({
1126
933
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1127
934
  method: "POST",
1128
- path: "/api/billing/portal",
935
+ path: "/api/topics/cluster",
1129
936
  config: this.config,
1130
937
  retry: {
1131
938
  attempts: 3,
@@ -1135,20 +942,21 @@ var BillingService = class extends BaseService {
1135
942
  backoffFactor: 2
1136
943
  }
1137
944
  });
1138
- if (body !== void 0) {
1139
- request.addBody(body);
945
+ if (options?.body !== void 0) {
946
+ request.addBody(options?.body);
1140
947
  }
1141
948
  return this.client.call(request);
1142
949
  }
1143
950
  /**
1144
- * Get current subscription
1145
- * Get the current subscription details for the authenticated user
951
+ * Detect communities
952
+ * Detect communities in the topic graph using specified algorithm
953
+ * @param body - Request body
1146
954
  */
1147
- async getSubscription() {
955
+ async detectCommunities(options) {
1148
956
  const request = new Request({
1149
957
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1150
- method: "GET",
1151
- path: "/api/billing/subscription",
958
+ method: "POST",
959
+ path: "/api/topics/detect-communities",
1152
960
  config: this.config,
1153
961
  retry: {
1154
962
  attempts: 3,
@@ -1158,18 +966,21 @@ var BillingService = class extends BaseService {
1158
966
  backoffFactor: 2
1159
967
  }
1160
968
  });
969
+ if (options?.body !== void 0) {
970
+ request.addBody(options?.body);
971
+ }
1161
972
  return this.client.call(request);
1162
973
  }
1163
974
  /**
1164
- * Cancel subscription
1165
- * Cancel the current subscription at the end of the billing period
975
+ * Search topics
976
+ * Search topics by query string using fulltext search
1166
977
  * @param body - Request body
1167
978
  */
1168
- async cancelSubscription(options) {
979
+ async searchTopics(body) {
1169
980
  const request = new Request({
1170
981
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1171
982
  method: "POST",
1172
- path: "/api/billing/subscription/cancel",
983
+ path: "/api/topics/search",
1173
984
  config: this.config,
1174
985
  retry: {
1175
986
  attempts: 3,
@@ -1179,21 +990,24 @@ var BillingService = class extends BaseService {
1179
990
  backoffFactor: 2
1180
991
  }
1181
992
  });
1182
- if (options?.body !== void 0) {
1183
- request.addBody(options?.body);
993
+ if (body !== void 0) {
994
+ request.addBody(body);
1184
995
  }
1185
996
  return this.client.call(request);
1186
997
  }
998
+ };
999
+
1000
+ // src/services/system-service.ts
1001
+ var SystemService = class extends BaseService {
1187
1002
  /**
1188
- * Reactivate subscription
1189
- * Reactivate a subscription that was scheduled for cancellation
1190
- * @param body - Request body
1003
+ * Get system health status
1004
+ * Get the current health status of the system including database connectivity
1191
1005
  */
1192
- async reactivateSubscription(options) {
1006
+ async getSystemHealth() {
1193
1007
  const request = new Request({
1194
1008
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1195
- method: "POST",
1196
- path: "/api/billing/subscription/reactivate",
1009
+ method: "GET",
1010
+ path: "/api/system/health",
1197
1011
  config: this.config,
1198
1012
  retry: {
1199
1013
  attempts: 3,
@@ -1203,21 +1017,17 @@ var BillingService = class extends BaseService {
1203
1017
  backoffFactor: 2
1204
1018
  }
1205
1019
  });
1206
- if (options?.body !== void 0) {
1207
- request.addBody(options?.body);
1208
- }
1209
1020
  return this.client.call(request);
1210
1021
  }
1211
1022
  /**
1212
- * List invoices
1213
- * Get a list of invoices for the authenticated user
1214
- * @param limit - Maximum number of invoices to return
1023
+ * Get context status
1024
+ * Get database statistics and context information
1215
1025
  */
1216
- async listInvoices(options) {
1026
+ async getContextStatus() {
1217
1027
  const request = new Request({
1218
1028
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1219
1029
  method: "GET",
1220
- path: "/api/billing/invoices",
1030
+ path: "/api/system/context/status",
1221
1031
  config: this.config,
1222
1032
  retry: {
1223
1033
  attempts: 3,
@@ -1227,29 +1037,17 @@ var BillingService = class extends BaseService {
1227
1037
  backoffFactor: 2
1228
1038
  }
1229
1039
  });
1230
- if (options?.limit !== void 0) {
1231
- request.addQueryParam("limit", {
1232
- key: "limit",
1233
- value: options.limit,
1234
- explode: false,
1235
- encode: true,
1236
- style: "form",
1237
- isLimit: true,
1238
- isOffset: false,
1239
- isCursor: false
1240
- });
1241
- }
1242
1040
  return this.client.call(request);
1243
1041
  }
1244
1042
  /**
1245
- * List payment methods
1246
- * Get a list of payment methods for the authenticated user
1043
+ * Get feature flags
1044
+ * Get all feature flags for the authenticated user
1247
1045
  */
1248
- async listPaymentMethods() {
1046
+ async getFeatureFlags() {
1249
1047
  const request = new Request({
1250
1048
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1251
1049
  method: "GET",
1252
- path: "/api/billing/payment-methods",
1050
+ path: "/api/system/feature-flags",
1253
1051
  config: this.config,
1254
1052
  retry: {
1255
1053
  attempts: 3,
@@ -1262,16 +1060,15 @@ var BillingService = class extends BaseService {
1262
1060
  return this.client.call(request);
1263
1061
  }
1264
1062
  /**
1265
- * Set default payment method
1266
- * Set a payment method as the default for future payments
1267
- * @param id - The payment method ID
1063
+ * Evaluate feature flag
1064
+ * Evaluate a specific feature flag for the authenticated user
1268
1065
  * @param body - Request body
1269
1066
  */
1270
- async setDefaultPaymentMethod(id, options) {
1067
+ async evaluateFeatureFlag(body) {
1271
1068
  const request = new Request({
1272
1069
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1273
1070
  method: "POST",
1274
- path: "/api/billing/payment-methods/{id}/default",
1071
+ path: "/api/system/feature-flags/evaluate",
1275
1072
  config: this.config,
1276
1073
  retry: {
1277
1074
  attempts: 3,
@@ -1281,31 +1078,22 @@ var BillingService = class extends BaseService {
1281
1078
  backoffFactor: 2
1282
1079
  }
1283
1080
  });
1284
- request.addPathParam("id", {
1285
- key: "id",
1286
- value: id,
1287
- explode: false,
1288
- encode: true,
1289
- style: "simple",
1290
- isLimit: false,
1291
- isOffset: false,
1292
- isCursor: false
1293
- });
1294
- if (options?.body !== void 0) {
1295
- request.addBody(options?.body);
1081
+ if (body !== void 0) {
1082
+ request.addBody(body);
1296
1083
  }
1297
1084
  return this.client.call(request);
1298
1085
  }
1299
1086
  /**
1300
- * Delete payment method
1301
- * Remove a payment method from the account
1302
- * @param id - The payment method ID
1087
+ * Analyze memory quality distribution
1088
+ * Analyze the quality distribution of memories for the authenticated user
1089
+ * @param includeDetails - Include detailed pruning candidate information
1090
+ * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
1303
1091
  */
1304
- async deletePaymentMethod(id) {
1092
+ async analyzeMemoryQuality(options) {
1305
1093
  const request = new Request({
1306
1094
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1307
- method: "DELETE",
1308
- path: "/api/billing/payment-methods/{id}",
1095
+ method: "GET",
1096
+ path: "/api/system/memory/quality",
1309
1097
  config: this.config,
1310
1098
  retry: {
1311
1099
  attempts: 3,
@@ -1315,28 +1103,42 @@ var BillingService = class extends BaseService {
1315
1103
  backoffFactor: 2
1316
1104
  }
1317
1105
  });
1318
- request.addPathParam("id", {
1319
- key: "id",
1320
- value: id,
1321
- explode: false,
1322
- encode: true,
1323
- style: "simple",
1324
- isLimit: false,
1325
- isOffset: false,
1326
- isCursor: false
1327
- });
1106
+ if (options?.includeDetails !== void 0) {
1107
+ request.addQueryParam("includeDetails", {
1108
+ key: "includeDetails",
1109
+ value: options.includeDetails,
1110
+ explode: false,
1111
+ encode: true,
1112
+ style: "form",
1113
+ isLimit: false,
1114
+ isOffset: false,
1115
+ isCursor: false
1116
+ });
1117
+ }
1118
+ if (options?.minQualityThreshold !== void 0) {
1119
+ request.addQueryParam("minQualityThreshold", {
1120
+ key: "minQualityThreshold",
1121
+ value: options.minQualityThreshold,
1122
+ explode: false,
1123
+ encode: true,
1124
+ style: "form",
1125
+ isLimit: false,
1126
+ isOffset: false,
1127
+ isCursor: false
1128
+ });
1129
+ }
1328
1130
  return this.client.call(request);
1329
1131
  }
1330
1132
  /**
1331
- * Stripe webhook endpoint
1332
- * Receive and process Stripe webhook events
1133
+ * Prune low-quality memories
1134
+ * Prune (soft delete) low-quality memories for the authenticated user
1333
1135
  * @param body - Request body
1334
1136
  */
1335
- async stripeWebhook(body) {
1137
+ async pruneMemories(options) {
1336
1138
  const request = new Request({
1337
1139
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1338
1140
  method: "POST",
1339
- path: "/api/billing/webhooks",
1141
+ path: "/api/system/memory/prune",
1340
1142
  config: this.config,
1341
1143
  retry: {
1342
1144
  attempts: 3,
@@ -1346,27 +1148,59 @@ var BillingService = class extends BaseService {
1346
1148
  backoffFactor: 2
1347
1149
  }
1348
1150
  });
1349
- if (body !== void 0) {
1350
- request.addBody(body);
1151
+ if (options?.body !== void 0) {
1152
+ request.addBody(options?.body);
1153
+ }
1154
+ return this.client.call(request);
1155
+ }
1156
+ /**
1157
+ * Get OpenAPI specification
1158
+ * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
1159
+ * @param noCache - Bypass cache and regenerate specification
1160
+ */
1161
+ async getOpenApiSpec(options) {
1162
+ const request = new Request({
1163
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1164
+ method: "GET",
1165
+ path: "/api/openapi.json",
1166
+ config: this.config,
1167
+ retry: {
1168
+ attempts: 3,
1169
+ delayMs: 150,
1170
+ maxDelayMs: 5e3,
1171
+ jitterMs: 50,
1172
+ backoffFactor: 2
1173
+ }
1174
+ });
1175
+ if (options?.noCache !== void 0) {
1176
+ request.addQueryParam("noCache", {
1177
+ key: "noCache",
1178
+ value: options.noCache,
1179
+ explode: false,
1180
+ encode: true,
1181
+ style: "form",
1182
+ isLimit: false,
1183
+ isOffset: false,
1184
+ isCursor: false
1185
+ });
1351
1186
  }
1352
1187
  return this.client.call(request);
1353
1188
  }
1354
1189
  };
1355
1190
 
1356
- // src/services/conversations-service.ts
1357
- var ConversationsService = class extends BaseService {
1191
+ // src/services/patterns-service.ts
1192
+ var PatternsService = class extends BaseService {
1358
1193
  /**
1359
- * List conversations
1360
- * List all conversations for the authenticated user with pagination
1361
- * @param limit - Maximum number of conversations to return
1362
- * @param offset - Number of conversations to skip
1363
- * @param since - Return only conversations created after this timestamp (ISO 8601 format)
1194
+ * List patterns
1195
+ * List all patterns for the authenticated user
1196
+ * @param limit - Maximum number of patterns to return
1197
+ * @param offset - Number of patterns to skip
1364
1198
  */
1365
- async listConversations(options) {
1199
+ async listPatterns(options) {
1366
1200
  const request = new Request({
1367
1201
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1368
1202
  method: "GET",
1369
- path: "/api/conversations",
1203
+ path: "/api/patterns",
1370
1204
  config: this.config,
1371
1205
  retry: {
1372
1206
  attempts: 3,
@@ -1400,30 +1234,18 @@ var ConversationsService = class extends BaseService {
1400
1234
  isCursor: false
1401
1235
  });
1402
1236
  }
1403
- if (options?.since !== void 0) {
1404
- request.addQueryParam("since", {
1405
- key: "since",
1406
- value: options.since,
1407
- explode: false,
1408
- encode: true,
1409
- style: "form",
1410
- isLimit: false,
1411
- isOffset: false,
1412
- isCursor: false
1413
- });
1414
- }
1415
1237
  return this.client.call(request);
1416
1238
  }
1417
1239
  /**
1418
- * Create conversation
1419
- * Create a new conversation for the authenticated user
1240
+ * Compile patterns
1241
+ * Compile patterns from user's memories
1420
1242
  * @param body - Request body
1421
1243
  */
1422
- async createConversation(body) {
1244
+ async compilePatterns(options) {
1423
1245
  const request = new Request({
1424
1246
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1425
1247
  method: "POST",
1426
- path: "/api/conversations",
1248
+ path: "/api/patterns/compile",
1427
1249
  config: this.config,
1428
1250
  retry: {
1429
1251
  attempts: 3,
@@ -1433,21 +1255,21 @@ var ConversationsService = class extends BaseService {
1433
1255
  backoffFactor: 2
1434
1256
  }
1435
1257
  });
1436
- if (body !== void 0) {
1437
- request.addBody(body);
1258
+ if (options?.body !== void 0) {
1259
+ request.addBody(options?.body);
1438
1260
  }
1439
1261
  return this.client.call(request);
1440
1262
  }
1441
1263
  /**
1442
- * Get conversation summary
1443
- * Retrieve a conversation summary by its ID
1444
- * @param conversationId - The conversation ID
1264
+ * Detect behavioral patterns
1265
+ * Run pattern detection algorithms to identify recurring behavioral patterns
1266
+ * @param body - Request body
1445
1267
  */
1446
- async getConversationSummary(conversationId) {
1268
+ async detectPatterns(options) {
1447
1269
  const request = new Request({
1448
1270
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1449
- method: "GET",
1450
- path: "/api/conversations/{conversationId}",
1271
+ method: "POST",
1272
+ path: "/api/patterns/detect",
1451
1273
  config: this.config,
1452
1274
  retry: {
1453
1275
  attempts: 3,
@@ -1457,28 +1279,21 @@ var ConversationsService = class extends BaseService {
1457
1279
  backoffFactor: 2
1458
1280
  }
1459
1281
  });
1460
- request.addPathParam("conversationId", {
1461
- key: "conversationId",
1462
- value: conversationId,
1463
- explode: false,
1464
- encode: true,
1465
- style: "simple",
1466
- isLimit: false,
1467
- isOffset: false,
1468
- isCursor: false
1469
- });
1282
+ if (options?.body !== void 0) {
1283
+ request.addBody(options?.body);
1284
+ }
1470
1285
  return this.client.call(request);
1471
1286
  }
1472
1287
  /**
1473
- * Delete conversation
1474
- * Delete a conversation and soft-delete all associated memories
1475
- * @param conversationId - The conversation ID
1288
+ * Analyze pattern trends
1289
+ * Analyze pattern trends, correlations, and generate insights
1290
+ * @param body - Request body
1476
1291
  */
1477
- async deleteConversation(conversationId) {
1292
+ async analyzePatterns(options) {
1478
1293
  const request = new Request({
1479
1294
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1480
- method: "DELETE",
1481
- path: "/api/conversations/{conversationId}",
1295
+ method: "POST",
1296
+ path: "/api/patterns/analyze",
1482
1297
  config: this.config,
1483
1298
  retry: {
1484
1299
  attempts: 3,
@@ -1488,28 +1303,22 @@ var ConversationsService = class extends BaseService {
1488
1303
  backoffFactor: 2
1489
1304
  }
1490
1305
  });
1491
- request.addPathParam("conversationId", {
1492
- key: "conversationId",
1493
- value: conversationId,
1494
- explode: false,
1495
- encode: true,
1496
- style: "simple",
1497
- isLimit: false,
1498
- isOffset: false,
1499
- isCursor: false
1500
- });
1306
+ if (options?.body !== void 0) {
1307
+ request.addBody(options?.body);
1308
+ }
1501
1309
  return this.client.call(request);
1502
1310
  }
1503
1311
  /**
1504
- * Get conversation timeline
1505
- * Get all memories in a conversation in chronological order
1506
- * @param conversationId - The conversation ID
1312
+ * Update pattern
1313
+ * Update an existing pattern with partial data
1314
+ * @param id - The pattern ID
1315
+ * @param body - Request body
1507
1316
  */
1508
- async getConversationTimeline(conversationId) {
1317
+ async updatePattern(id, body) {
1509
1318
  const request = new Request({
1510
1319
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1511
- method: "GET",
1512
- path: "/api/conversations/{conversationId}/timeline",
1320
+ method: "PATCH",
1321
+ path: "/api/patterns/{id}",
1513
1322
  config: this.config,
1514
1323
  retry: {
1515
1324
  attempts: 3,
@@ -1519,9 +1328,9 @@ var ConversationsService = class extends BaseService {
1519
1328
  backoffFactor: 2
1520
1329
  }
1521
1330
  });
1522
- request.addPathParam("conversationId", {
1523
- key: "conversationId",
1524
- value: conversationId,
1331
+ request.addPathParam("id", {
1332
+ key: "id",
1333
+ value: id,
1525
1334
  explode: false,
1526
1335
  encode: true,
1527
1336
  style: "simple",
@@ -1529,18 +1338,21 @@ var ConversationsService = class extends BaseService {
1529
1338
  isOffset: false,
1530
1339
  isCursor: false
1531
1340
  });
1341
+ if (body !== void 0) {
1342
+ request.addBody(body);
1343
+ }
1532
1344
  return this.client.call(request);
1533
1345
  }
1534
1346
  /**
1535
- * Search conversations
1536
- * Search conversations by query string
1347
+ * Record pattern feedback
1348
+ * Record feedback on a pattern
1537
1349
  * @param body - Request body
1538
1350
  */
1539
- async searchConversations(body) {
1351
+ async recordPatternFeedback(body) {
1540
1352
  const request = new Request({
1541
1353
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1542
1354
  method: "POST",
1543
- path: "/api/conversations/search",
1355
+ path: "/api/patterns/feedback",
1544
1356
  config: this.config,
1545
1357
  retry: {
1546
1358
  attempts: 3,
@@ -1555,16 +1367,19 @@ var ConversationsService = class extends BaseService {
1555
1367
  }
1556
1368
  return this.client.call(request);
1557
1369
  }
1370
+ };
1371
+
1372
+ // src/services/behavior-service.ts
1373
+ var BehaviorService = class extends BaseService {
1558
1374
  /**
1559
- * Find conversations by topic
1560
- * Find conversations that contain a specific topic
1561
- * @param body - Request body
1375
+ * Get behavioral state
1376
+ * Get current behavioral state for the authenticated user
1562
1377
  */
1563
- async findConversationsByTopic(body) {
1378
+ async getBehavioralState() {
1564
1379
  const request = new Request({
1565
1380
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1566
- method: "POST",
1567
- path: "/api/conversations/by-topic",
1381
+ method: "GET",
1382
+ path: "/api/patterns/behavior/state",
1568
1383
  config: this.config,
1569
1384
  retry: {
1570
1385
  attempts: 3,
@@ -1574,27 +1389,18 @@ var ConversationsService = class extends BaseService {
1574
1389
  backoffFactor: 2
1575
1390
  }
1576
1391
  });
1577
- if (body !== void 0) {
1578
- request.addBody(body);
1579
- }
1580
1392
  return this.client.call(request);
1581
1393
  }
1582
- };
1583
-
1584
- // src/services/entities-service.ts
1585
- var EntitiesService = class extends BaseService {
1586
1394
  /**
1587
- * List entities
1588
- * List all entities for the authenticated user, optionally filtered by type
1589
- * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
1590
- * @param limit - Maximum number of entities to return
1591
- * @param offset - Number of entities to skip
1395
+ * Update behavioral state
1396
+ * Update or mutate behavioral state
1397
+ * @param body - Request body
1592
1398
  */
1593
- async listEntities(options) {
1399
+ async updateBehavioralState(options) {
1594
1400
  const request = new Request({
1595
1401
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1596
- method: "GET",
1597
- path: "/api/entities",
1402
+ method: "POST",
1403
+ path: "/api/patterns/behavior/state",
1598
1404
  config: this.config,
1599
1405
  retry: {
1600
1406
  attempts: 3,
@@ -1604,87 +1410,30 @@ var EntitiesService = class extends BaseService {
1604
1410
  backoffFactor: 2
1605
1411
  }
1606
1412
  });
1607
- if (options?.type !== void 0) {
1608
- request.addQueryParam("type", {
1609
- key: "type",
1610
- value: options.type,
1611
- explode: false,
1612
- encode: true,
1613
- style: "form",
1614
- isLimit: false,
1615
- isOffset: false,
1616
- isCursor: false
1617
- });
1413
+ if (options?.body !== void 0) {
1414
+ request.addBody(options?.body);
1618
1415
  }
1619
- if (options?.limit !== void 0) {
1620
- request.addQueryParam("limit", {
1621
- key: "limit",
1622
- value: options.limit,
1623
- explode: false,
1624
- encode: true,
1625
- style: "form",
1626
- isLimit: true,
1627
- isOffset: false,
1628
- isCursor: false
1629
- });
1630
- }
1631
- if (options?.offset !== void 0) {
1632
- request.addQueryParam("offset", {
1633
- key: "offset",
1634
- value: options.offset,
1635
- explode: false,
1636
- encode: true,
1637
- style: "form",
1638
- isLimit: false,
1639
- isOffset: true,
1640
- isCursor: false
1641
- });
1642
- }
1643
- return this.client.call(request);
1644
- }
1645
- /**
1646
- * Get entity by ID
1647
- * Retrieve a specific entity by its ID
1648
- * @param id - The entity ID
1649
- */
1650
- async getEntityById(id) {
1651
- const request = new Request({
1652
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1653
- method: "GET",
1654
- path: "/api/entities/{id}",
1655
- config: this.config,
1656
- retry: {
1657
- attempts: 3,
1658
- delayMs: 150,
1659
- maxDelayMs: 5e3,
1660
- jitterMs: 50,
1661
- backoffFactor: 2
1662
- }
1663
- });
1664
- request.addPathParam("id", {
1665
- key: "id",
1666
- value: id,
1667
- explode: false,
1668
- encode: true,
1669
- style: "simple",
1670
- isLimit: false,
1671
- isOffset: false,
1672
- isCursor: false
1673
- });
1674
1416
  return this.client.call(request);
1675
1417
  }
1418
+ };
1419
+
1420
+ // src/services/narratives-service.ts
1421
+ var NarrativesService = class extends BaseService {
1676
1422
  /**
1677
- * Get memories mentioning entity
1678
- * Get all memories that mention a specific entity
1679
- * @param id - The entity ID
1680
- * @param limit - Maximum number of memories to return
1681
- * @param offset - Number of memories to skip
1682
- */
1683
- async getEntityMemories(id, options) {
1423
+ * List narrative threads
1424
+ * List all narrative threads for the authenticated user.
1425
+ Narratives group related memories into coherent storylines.
1426
+
1427
+ * @param limit - Maximum number of narratives to return
1428
+ * @param offset - Number of narratives to skip
1429
+ * @param state - Filter by narrative state
1430
+ * @param topics - Comma-separated list of topics to filter by
1431
+ */
1432
+ async listNarratives(options) {
1684
1433
  const request = new Request({
1685
1434
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1686
1435
  method: "GET",
1687
- path: "/api/entities/{id}/memories",
1436
+ path: "/api/narratives",
1688
1437
  config: this.config,
1689
1438
  retry: {
1690
1439
  attempts: 3,
@@ -1694,16 +1443,6 @@ var EntitiesService = class extends BaseService {
1694
1443
  backoffFactor: 2
1695
1444
  }
1696
1445
  });
1697
- request.addPathParam("id", {
1698
- key: "id",
1699
- value: id,
1700
- explode: false,
1701
- encode: true,
1702
- style: "simple",
1703
- isLimit: false,
1704
- isOffset: false,
1705
- isCursor: false
1706
- });
1707
1446
  if (options?.limit !== void 0) {
1708
1447
  request.addQueryParam("limit", {
1709
1448
  key: "limit",
@@ -1728,68 +1467,44 @@ var EntitiesService = class extends BaseService {
1728
1467
  isCursor: false
1729
1468
  });
1730
1469
  }
1731
- return this.client.call(request);
1732
- }
1733
- };
1734
-
1735
- // src/services/facts-service.ts
1736
- var FactsService = class extends BaseService {
1737
- /**
1738
- * List facts
1739
- * List all facts for the authenticated user
1740
- * @param limit - Maximum number of facts to return
1741
- * @param offset - Number of facts to skip
1742
- */
1743
- async listFacts(options) {
1744
- const request = new Request({
1745
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1746
- method: "GET",
1747
- path: "/api/facts",
1748
- config: this.config,
1749
- retry: {
1750
- attempts: 3,
1751
- delayMs: 150,
1752
- maxDelayMs: 5e3,
1753
- jitterMs: 50,
1754
- backoffFactor: 2
1755
- }
1756
- });
1757
- if (options?.limit !== void 0) {
1758
- request.addQueryParam("limit", {
1759
- key: "limit",
1760
- value: options.limit,
1470
+ if (options?.state !== void 0) {
1471
+ request.addQueryParam("state", {
1472
+ key: "state",
1473
+ value: options.state,
1761
1474
  explode: false,
1762
1475
  encode: true,
1763
1476
  style: "form",
1764
- isLimit: true,
1477
+ isLimit: false,
1765
1478
  isOffset: false,
1766
1479
  isCursor: false
1767
1480
  });
1768
1481
  }
1769
- if (options?.offset !== void 0) {
1770
- request.addQueryParam("offset", {
1771
- key: "offset",
1772
- value: options.offset,
1482
+ if (options?.topics !== void 0) {
1483
+ request.addQueryParam("topics", {
1484
+ key: "topics",
1485
+ value: options.topics,
1773
1486
  explode: false,
1774
1487
  encode: true,
1775
1488
  style: "form",
1776
1489
  isLimit: false,
1777
- isOffset: true,
1490
+ isOffset: false,
1778
1491
  isCursor: false
1779
1492
  });
1780
1493
  }
1781
1494
  return this.client.call(request);
1782
1495
  }
1783
1496
  /**
1784
- * Create fact
1785
- * Create a new semantic fact
1786
- * @param body - Request body
1787
- */
1788
- async createFact(body) {
1497
+ * Create a narrative thread
1498
+ * Create a new narrative thread starting from a root memory.
1499
+ Narratives help organize related memories into coherent storylines.
1500
+
1501
+ * @param body - Request body
1502
+ */
1503
+ async createNarrative(body) {
1789
1504
  const request = new Request({
1790
1505
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1791
1506
  method: "POST",
1792
- path: "/api/facts",
1507
+ path: "/api/narratives",
1793
1508
  config: this.config,
1794
1509
  retry: {
1795
1510
  attempts: 3,
@@ -1805,15 +1520,15 @@ var FactsService = class extends BaseService {
1805
1520
  return this.client.call(request);
1806
1521
  }
1807
1522
  /**
1808
- * Get fact by ID
1809
- * Retrieve a specific fact by its ID
1810
- * @param id - The fact ID
1523
+ * Get a narrative thread
1524
+ * Retrieve a specific narrative thread by ID
1525
+ * @param id - The narrative ID
1811
1526
  */
1812
- async getFactById(id) {
1527
+ async getNarrative(id) {
1813
1528
  const request = new Request({
1814
1529
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1815
1530
  method: "GET",
1816
- path: "/api/facts/{id}",
1531
+ path: "/api/narratives/{id}",
1817
1532
  config: this.config,
1818
1533
  retry: {
1819
1534
  attempts: 3,
@@ -1836,16 +1551,17 @@ var FactsService = class extends BaseService {
1836
1551
  return this.client.call(request);
1837
1552
  }
1838
1553
  /**
1839
- * Update fact
1840
- * Update an existing fact completely
1841
- * @param id - The fact ID
1842
- * @param body - Request body
1843
- */
1844
- async updateFact(id, body) {
1554
+ * Delete a narrative thread
1555
+ * Delete a narrative thread.
1556
+ This does not delete the associated memories, only the narrative structure.
1557
+
1558
+ * @param id - The narrative ID
1559
+ */
1560
+ async deleteNarrative(id) {
1845
1561
  const request = new Request({
1846
1562
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1847
- method: "PUT",
1848
- path: "/api/facts/{id}",
1563
+ method: "DELETE",
1564
+ path: "/api/narratives/{id}",
1849
1565
  config: this.config,
1850
1566
  retry: {
1851
1567
  attempts: 3,
@@ -1865,21 +1581,21 @@ var FactsService = class extends BaseService {
1865
1581
  isOffset: false,
1866
1582
  isCursor: false
1867
1583
  });
1868
- if (body !== void 0) {
1869
- request.addBody(body);
1870
- }
1871
1584
  return this.client.call(request);
1872
1585
  }
1873
1586
  /**
1874
- * Delete fact
1875
- * Delete a fact by its ID
1876
- * @param id - The fact ID
1877
- */
1878
- async deleteFact(id) {
1587
+ * Update a narrative thread
1588
+ * Update a narrative thread's title, topics, or state.
1589
+ Use this to resolve, reopen, or modify narratives.
1590
+
1591
+ * @param id - The narrative ID
1592
+ * @param body - Request body
1593
+ */
1594
+ async updateNarrative(id, body) {
1879
1595
  const request = new Request({
1880
1596
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1881
- method: "DELETE",
1882
- path: "/api/facts/{id}",
1597
+ method: "PATCH",
1598
+ path: "/api/narratives/{id}",
1883
1599
  config: this.config,
1884
1600
  retry: {
1885
1601
  attempts: 3,
@@ -1899,46 +1615,25 @@ var FactsService = class extends BaseService {
1899
1615
  isOffset: false,
1900
1616
  isCursor: false
1901
1617
  });
1902
- return this.client.call(request);
1903
- }
1904
- /**
1905
- * Search facts
1906
- * Search semantic facts by query string
1907
- * @param body - Request body
1908
- */
1909
- async searchFacts(body) {
1910
- const request = new Request({
1911
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1912
- method: "POST",
1913
- path: "/api/facts/search",
1914
- config: this.config,
1915
- retry: {
1916
- attempts: 3,
1917
- delayMs: 150,
1918
- maxDelayMs: 5e3,
1919
- jitterMs: 50,
1920
- backoffFactor: 2
1921
- }
1922
- });
1923
1618
  if (body !== void 0) {
1924
1619
  request.addBody(body);
1925
1620
  }
1926
1621
  return this.client.call(request);
1927
1622
  }
1928
- };
1929
-
1930
- // src/services/graphrag-service.ts
1931
- var GraphragService = class extends BaseService {
1932
1623
  /**
1933
- * Explain a GraphRAG query
1934
- * Get explanation for a previously executed GraphRAG query result
1935
- * @param queryId - The query ID to explain
1936
- */
1937
- async explainGraphRAGQuery(options) {
1624
+ * Get narrative timeline
1625
+ * Get all memories in a narrative, ordered by their position in the narrative.
1626
+ Each memory includes its position and effective state.
1627
+
1628
+ * @param id - The narrative ID
1629
+ * @param limit - Maximum number of memories to return
1630
+ * @param offset - Number of memories to skip
1631
+ */
1632
+ async getNarrativeTimeline(id, options) {
1938
1633
  const request = new Request({
1939
1634
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1940
1635
  method: "GET",
1941
- path: "/api/graphrag/explain",
1636
+ path: "/api/narratives/{id}/timeline",
1942
1637
  config: this.config,
1943
1638
  retry: {
1944
1639
  attempts: 3,
@@ -1948,54 +1643,55 @@ var GraphragService = class extends BaseService {
1948
1643
  backoffFactor: 2
1949
1644
  }
1950
1645
  });
1951
- if (options?.queryId !== void 0) {
1952
- request.addQueryParam("queryId", {
1953
- key: "queryId",
1954
- value: options.queryId,
1646
+ request.addPathParam("id", {
1647
+ key: "id",
1648
+ value: id,
1649
+ explode: false,
1650
+ encode: true,
1651
+ style: "simple",
1652
+ isLimit: false,
1653
+ isOffset: false,
1654
+ isCursor: false
1655
+ });
1656
+ if (options?.limit !== void 0) {
1657
+ request.addQueryParam("limit", {
1658
+ key: "limit",
1659
+ value: options.limit,
1955
1660
  explode: false,
1956
1661
  encode: true,
1957
1662
  style: "form",
1958
- isLimit: false,
1663
+ isLimit: true,
1959
1664
  isOffset: false,
1960
1665
  isCursor: false
1961
1666
  });
1962
1667
  }
1963
- return this.client.call(request);
1964
- }
1965
- /**
1966
- * Query communities
1967
- * Query communities for relevant information using semantic search
1968
- * @param body - Request body
1969
- */
1970
- async queryCommunities(body) {
1971
- const request = new Request({
1972
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1973
- method: "POST",
1974
- path: "/api/graphrag/query-communities",
1975
- config: this.config,
1976
- retry: {
1977
- attempts: 3,
1978
- delayMs: 150,
1979
- maxDelayMs: 5e3,
1980
- jitterMs: 50,
1981
- backoffFactor: 2
1982
- }
1983
- });
1984
- if (body !== void 0) {
1985
- request.addBody(body);
1668
+ if (options?.offset !== void 0) {
1669
+ request.addQueryParam("offset", {
1670
+ key: "offset",
1671
+ value: options.offset,
1672
+ explode: false,
1673
+ encode: true,
1674
+ style: "form",
1675
+ isLimit: false,
1676
+ isOffset: true,
1677
+ isCursor: false
1678
+ });
1986
1679
  }
1987
1680
  return this.client.call(request);
1988
1681
  }
1989
1682
  /**
1990
- * Execute a GraphRAG query
1991
- * Execute a graph-based retrieval augmented generation query
1992
- * @param body - Request body
1993
- */
1994
- async executeGraphRAGQuery(body) {
1683
+ * Add a memory to a narrative
1684
+ * Add an existing memory to a narrative thread.
1685
+ Optionally specify a position to insert the memory at.
1686
+
1687
+ * @param id - The narrative ID
1688
+ * @param body - Request body
1689
+ */
1690
+ async addMemoryToNarrative(id, body) {
1995
1691
  const request = new Request({
1996
1692
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1997
1693
  method: "POST",
1998
- path: "/api/graphrag/query",
1694
+ path: "/api/narratives/{id}/memories",
1999
1695
  config: this.config,
2000
1696
  retry: {
2001
1697
  attempts: 3,
@@ -2005,28 +1701,34 @@ var GraphragService = class extends BaseService {
2005
1701
  backoffFactor: 2
2006
1702
  }
2007
1703
  });
1704
+ request.addPathParam("id", {
1705
+ key: "id",
1706
+ value: id,
1707
+ explode: false,
1708
+ encode: true,
1709
+ style: "simple",
1710
+ isLimit: false,
1711
+ isOffset: false,
1712
+ isCursor: false
1713
+ });
2008
1714
  if (body !== void 0) {
2009
1715
  request.addBody(body);
2010
1716
  }
2011
1717
  return this.client.call(request);
2012
1718
  }
2013
- };
2014
-
2015
- // src/services/health-service.ts
2016
- var HealthService = class extends BaseService {
2017
1719
  /**
2018
- * API health check endpoint
2019
- * Returns the health status and uptime of the API service.
2020
- This endpoint is public and requires no authentication.
2021
- Use this endpoint for monitoring, health checks, and service availability verification.
2022
- Returns 200 when healthy, 503 when the database is unreachable.
1720
+ * Remove a memory from a narrative
1721
+ * Remove a memory from a narrative thread.
1722
+ This does not delete the memory itself, only removes it from the narrative.
2023
1723
 
1724
+ * @param id - The narrative ID
1725
+ * @param memoryId - The memory ID to remove
2024
1726
  */
2025
- async healthCheck() {
1727
+ async removeMemoryFromNarrative(id, memoryId) {
2026
1728
  const request = new Request({
2027
1729
  baseUrl: this.config.baseUrl || "http://localhost:3000",
2028
- method: "GET",
2029
- path: "/health",
1730
+ method: "DELETE",
1731
+ path: "/api/narratives/{id}/memories/{memoryId}",
2030
1732
  config: this.config,
2031
1733
  retry: {
2032
1734
  attempts: 3,
@@ -2036,48 +1738,44 @@ var HealthService = class extends BaseService {
2036
1738
  backoffFactor: 2
2037
1739
  }
2038
1740
  });
1741
+ request.addPathParam("id", {
1742
+ key: "id",
1743
+ value: id,
1744
+ explode: false,
1745
+ encode: true,
1746
+ style: "simple",
1747
+ isLimit: false,
1748
+ isOffset: false,
1749
+ isCursor: false
1750
+ });
1751
+ request.addPathParam("memoryId", {
1752
+ key: "memoryId",
1753
+ value: memoryId,
1754
+ explode: false,
1755
+ encode: true,
1756
+ style: "simple",
1757
+ isLimit: false,
1758
+ isOffset: false,
1759
+ isCursor: false
1760
+ });
2039
1761
  return this.client.call(request);
2040
1762
  }
2041
1763
  };
2042
1764
 
2043
- // src/services/invites-service.ts
2044
- var InvitesService = class extends BaseService {
1765
+ // src/services/monitoring-service.ts
1766
+ var MonitoringService = class extends BaseService {
2045
1767
  /**
2046
- * Check invite gate status
2047
- * Check whether the invite gate is currently open or closed.
2048
- When gated is true, new signups require a valid invite code.
2049
- Response is cached server-side (30-second TTL).
1768
+ * Prometheus metrics endpoint
1769
+ * Returns Prometheus-formatted metrics for monitoring and observability.
1770
+ This endpoint is public and requires no authentication.
1771
+ Designed to be scraped by Prometheus at regular intervals.
2050
1772
 
2051
1773
  */
2052
- async getGateStatus() {
1774
+ async getMetrics() {
2053
1775
  const request = new Request({
2054
1776
  baseUrl: this.config.baseUrl || "http://localhost:3000",
2055
1777
  method: "GET",
2056
- path: "/api/invites/gate-status",
2057
- config: this.config,
2058
- retry: {
2059
- attempts: 3,
2060
- delayMs: 150,
2061
- maxDelayMs: 5e3,
2062
- jitterMs: 50,
2063
- backoffFactor: 2
2064
- }
2065
- });
2066
- return this.client.call(request);
2067
- }
2068
- /**
2069
- * Validate an invite code
2070
- * Validate an invite code without redeeming it.
2071
- Rate limited to 10 requests per minute per IP to prevent enumeration.
2072
- Error messages are intentionally generic.
2073
-
2074
- * @param body - Request body
2075
- */
2076
- async validateInviteCode(body) {
2077
- const request = new Request({
2078
- baseUrl: this.config.baseUrl || "http://localhost:3000",
2079
- method: "POST",
2080
- path: "/api/invites/validate",
1778
+ path: "/metrics",
2081
1779
  config: this.config,
2082
1780
  retry: {
2083
1781
  attempts: 3,
@@ -2087,9 +1785,6 @@ var InvitesService = class extends BaseService {
2087
1785
  backoffFactor: 2
2088
1786
  }
2089
1787
  });
2090
- if (body !== void 0) {
2091
- request.addBody(body);
2092
- }
2093
1788
  return this.client.call(request);
2094
1789
  }
2095
1790
  };
@@ -3238,20 +2933,20 @@ var MemoriesService = class extends BaseService {
3238
2933
  }
3239
2934
  };
3240
2935
 
3241
- // src/services/monitoring-service.ts
3242
- var MonitoringService = class extends BaseService {
2936
+ // src/services/invites-service.ts
2937
+ var InvitesService = class extends BaseService {
3243
2938
  /**
3244
- * Prometheus metrics endpoint
3245
- * Returns Prometheus-formatted metrics for monitoring and observability.
3246
- This endpoint is public and requires no authentication.
3247
- Designed to be scraped by Prometheus at regular intervals.
2939
+ * Check invite gate status
2940
+ * Check whether the invite gate is currently open or closed.
2941
+ When gated is true, new signups require a valid invite code.
2942
+ Response is cached server-side (30-second TTL).
3248
2943
 
3249
2944
  */
3250
- async getMetrics() {
2945
+ async getGateStatus() {
3251
2946
  const request = new Request({
3252
2947
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3253
2948
  method: "GET",
3254
- path: "/metrics",
2949
+ path: "/api/invites/gate-status",
3255
2950
  config: this.config,
3256
2951
  retry: {
3257
2952
  attempts: 3,
@@ -3263,25 +2958,19 @@ var MonitoringService = class extends BaseService {
3263
2958
  });
3264
2959
  return this.client.call(request);
3265
2960
  }
3266
- };
3267
-
3268
- // src/services/narratives-service.ts
3269
- var NarrativesService = class extends BaseService {
3270
2961
  /**
3271
- * List narrative threads
3272
- * List all narrative threads for the authenticated user.
3273
- Narratives group related memories into coherent storylines.
2962
+ * Validate an invite code
2963
+ * Validate an invite code without redeeming it.
2964
+ Rate limited to 10 requests per minute per IP to prevent enumeration.
2965
+ Error messages are intentionally generic.
3274
2966
 
3275
- * @param limit - Maximum number of narratives to return
3276
- * @param offset - Number of narratives to skip
3277
- * @param state - Filter by narrative state
3278
- * @param topics - Comma-separated list of topics to filter by
2967
+ * @param body - Request body
3279
2968
  */
3280
- async listNarratives(options) {
2969
+ async validateInviteCode(body) {
3281
2970
  const request = new Request({
3282
2971
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3283
- method: "GET",
3284
- path: "/api/narratives",
2972
+ method: "POST",
2973
+ path: "/api/invites/validate",
3285
2974
  config: this.config,
3286
2975
  retry: {
3287
2976
  attempts: 3,
@@ -3291,68 +2980,28 @@ var NarrativesService = class extends BaseService {
3291
2980
  backoffFactor: 2
3292
2981
  }
3293
2982
  });
3294
- if (options?.limit !== void 0) {
3295
- request.addQueryParam("limit", {
3296
- key: "limit",
3297
- value: options.limit,
3298
- explode: false,
3299
- encode: true,
3300
- style: "form",
3301
- isLimit: true,
3302
- isOffset: false,
3303
- isCursor: false
3304
- });
3305
- }
3306
- if (options?.offset !== void 0) {
3307
- request.addQueryParam("offset", {
3308
- key: "offset",
3309
- value: options.offset,
3310
- explode: false,
3311
- encode: true,
3312
- style: "form",
3313
- isLimit: false,
3314
- isOffset: true,
3315
- isCursor: false
3316
- });
3317
- }
3318
- if (options?.state !== void 0) {
3319
- request.addQueryParam("state", {
3320
- key: "state",
3321
- value: options.state,
3322
- explode: false,
3323
- encode: true,
3324
- style: "form",
3325
- isLimit: false,
3326
- isOffset: false,
3327
- isCursor: false
3328
- });
3329
- }
3330
- if (options?.topics !== void 0) {
3331
- request.addQueryParam("topics", {
3332
- key: "topics",
3333
- value: options.topics,
3334
- explode: false,
3335
- encode: true,
3336
- style: "form",
3337
- isLimit: false,
3338
- isOffset: false,
3339
- isCursor: false
3340
- });
2983
+ if (body !== void 0) {
2984
+ request.addBody(body);
3341
2985
  }
3342
2986
  return this.client.call(request);
3343
2987
  }
2988
+ };
2989
+
2990
+ // src/services/health-service.ts
2991
+ var HealthService = class extends BaseService {
3344
2992
  /**
3345
- * Create a narrative thread
3346
- * Create a new narrative thread starting from a root memory.
3347
- Narratives help organize related memories into coherent storylines.
2993
+ * API health check endpoint
2994
+ * Returns the health status and uptime of the API service.
2995
+ This endpoint is public and requires no authentication.
2996
+ Use this endpoint for monitoring, health checks, and service availability verification.
2997
+ Returns 200 when healthy, 503 when the database is unreachable.
3348
2998
 
3349
- * @param body - Request body
3350
2999
  */
3351
- async createNarrative(body) {
3000
+ async healthCheck() {
3352
3001
  const request = new Request({
3353
3002
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3354
- method: "POST",
3355
- path: "/api/narratives",
3003
+ method: "GET",
3004
+ path: "/health",
3356
3005
  config: this.config,
3357
3006
  retry: {
3358
3007
  attempts: 3,
@@ -3362,21 +3011,177 @@ var NarrativesService = class extends BaseService {
3362
3011
  backoffFactor: 2
3363
3012
  }
3364
3013
  });
3365
- if (body !== void 0) {
3366
- request.addBody(body);
3367
- }
3368
3014
  return this.client.call(request);
3369
3015
  }
3016
+ };
3017
+
3018
+ // src/services/graphrag-service.ts
3019
+ var GraphragService = class extends BaseService {
3370
3020
  /**
3371
- * Get a narrative thread
3372
- * Retrieve a specific narrative thread by ID
3373
- * @param id - The narrative ID
3021
+ * Explain a GraphRAG query
3022
+ * Get explanation for a previously executed GraphRAG query result
3023
+ * @param queryId - The query ID to explain
3374
3024
  */
3375
- async getNarrative(id) {
3025
+ async explainGraphRAGQuery(options) {
3376
3026
  const request = new Request({
3377
3027
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3378
3028
  method: "GET",
3379
- path: "/api/narratives/{id}",
3029
+ path: "/api/graphrag/explain",
3030
+ config: this.config,
3031
+ retry: {
3032
+ attempts: 3,
3033
+ delayMs: 150,
3034
+ maxDelayMs: 5e3,
3035
+ jitterMs: 50,
3036
+ backoffFactor: 2
3037
+ }
3038
+ });
3039
+ if (options?.queryId !== void 0) {
3040
+ request.addQueryParam("queryId", {
3041
+ key: "queryId",
3042
+ value: options.queryId,
3043
+ explode: false,
3044
+ encode: true,
3045
+ style: "form",
3046
+ isLimit: false,
3047
+ isOffset: false,
3048
+ isCursor: false
3049
+ });
3050
+ }
3051
+ return this.client.call(request);
3052
+ }
3053
+ /**
3054
+ * Query communities
3055
+ * Query communities for relevant information using semantic search
3056
+ * @param body - Request body
3057
+ */
3058
+ async queryCommunities(body) {
3059
+ const request = new Request({
3060
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3061
+ method: "POST",
3062
+ path: "/api/graphrag/query-communities",
3063
+ config: this.config,
3064
+ retry: {
3065
+ attempts: 3,
3066
+ delayMs: 150,
3067
+ maxDelayMs: 5e3,
3068
+ jitterMs: 50,
3069
+ backoffFactor: 2
3070
+ }
3071
+ });
3072
+ if (body !== void 0) {
3073
+ request.addBody(body);
3074
+ }
3075
+ return this.client.call(request);
3076
+ }
3077
+ /**
3078
+ * Execute a GraphRAG query
3079
+ * Execute a graph-based retrieval augmented generation query
3080
+ * @param body - Request body
3081
+ */
3082
+ async executeGraphRAGQuery(body) {
3083
+ const request = new Request({
3084
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3085
+ method: "POST",
3086
+ path: "/api/graphrag/query",
3087
+ config: this.config,
3088
+ retry: {
3089
+ attempts: 3,
3090
+ delayMs: 150,
3091
+ maxDelayMs: 5e3,
3092
+ jitterMs: 50,
3093
+ backoffFactor: 2
3094
+ }
3095
+ });
3096
+ if (body !== void 0) {
3097
+ request.addBody(body);
3098
+ }
3099
+ return this.client.call(request);
3100
+ }
3101
+ };
3102
+
3103
+ // src/services/facts-service.ts
3104
+ var FactsService = class extends BaseService {
3105
+ /**
3106
+ * List facts
3107
+ * List all facts for the authenticated user
3108
+ * @param limit - Maximum number of facts to return
3109
+ * @param offset - Number of facts to skip
3110
+ */
3111
+ async listFacts(options) {
3112
+ const request = new Request({
3113
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3114
+ method: "GET",
3115
+ path: "/api/facts",
3116
+ config: this.config,
3117
+ retry: {
3118
+ attempts: 3,
3119
+ delayMs: 150,
3120
+ maxDelayMs: 5e3,
3121
+ jitterMs: 50,
3122
+ backoffFactor: 2
3123
+ }
3124
+ });
3125
+ if (options?.limit !== void 0) {
3126
+ request.addQueryParam("limit", {
3127
+ key: "limit",
3128
+ value: options.limit,
3129
+ explode: false,
3130
+ encode: true,
3131
+ style: "form",
3132
+ isLimit: true,
3133
+ isOffset: false,
3134
+ isCursor: false
3135
+ });
3136
+ }
3137
+ if (options?.offset !== void 0) {
3138
+ request.addQueryParam("offset", {
3139
+ key: "offset",
3140
+ value: options.offset,
3141
+ explode: false,
3142
+ encode: true,
3143
+ style: "form",
3144
+ isLimit: false,
3145
+ isOffset: true,
3146
+ isCursor: false
3147
+ });
3148
+ }
3149
+ return this.client.call(request);
3150
+ }
3151
+ /**
3152
+ * Create fact
3153
+ * Create a new semantic fact
3154
+ * @param body - Request body
3155
+ */
3156
+ async createFact(body) {
3157
+ const request = new Request({
3158
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3159
+ method: "POST",
3160
+ path: "/api/facts",
3161
+ config: this.config,
3162
+ retry: {
3163
+ attempts: 3,
3164
+ delayMs: 150,
3165
+ maxDelayMs: 5e3,
3166
+ jitterMs: 50,
3167
+ backoffFactor: 2
3168
+ }
3169
+ });
3170
+ if (body !== void 0) {
3171
+ request.addBody(body);
3172
+ }
3173
+ return this.client.call(request);
3174
+ }
3175
+ /**
3176
+ * Get fact by ID
3177
+ * Retrieve a specific fact by its ID
3178
+ * @param id - The fact ID
3179
+ */
3180
+ async getFactById(id) {
3181
+ const request = new Request({
3182
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3183
+ method: "GET",
3184
+ path: "/api/facts/{id}",
3380
3185
  config: this.config,
3381
3186
  retry: {
3382
3187
  attempts: 3,
@@ -3399,17 +3204,16 @@ var NarrativesService = class extends BaseService {
3399
3204
  return this.client.call(request);
3400
3205
  }
3401
3206
  /**
3402
- * Delete a narrative thread
3403
- * Delete a narrative thread.
3404
- This does not delete the associated memories, only the narrative structure.
3405
-
3406
- * @param id - The narrative ID
3407
- */
3408
- async deleteNarrative(id) {
3207
+ * Update fact
3208
+ * Update an existing fact completely
3209
+ * @param id - The fact ID
3210
+ * @param body - Request body
3211
+ */
3212
+ async updateFact(id, body) {
3409
3213
  const request = new Request({
3410
3214
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3411
- method: "DELETE",
3412
- path: "/api/narratives/{id}",
3215
+ method: "PUT",
3216
+ path: "/api/facts/{id}",
3413
3217
  config: this.config,
3414
3218
  retry: {
3415
3219
  attempts: 3,
@@ -3429,21 +3233,21 @@ var NarrativesService = class extends BaseService {
3429
3233
  isOffset: false,
3430
3234
  isCursor: false
3431
3235
  });
3236
+ if (body !== void 0) {
3237
+ request.addBody(body);
3238
+ }
3432
3239
  return this.client.call(request);
3433
3240
  }
3434
3241
  /**
3435
- * Update a narrative thread
3436
- * Update a narrative thread's title, topics, or state.
3437
- Use this to resolve, reopen, or modify narratives.
3438
-
3439
- * @param id - The narrative ID
3440
- * @param body - Request body
3441
- */
3442
- async updateNarrative(id, body) {
3242
+ * Delete fact
3243
+ * Delete a fact by its ID
3244
+ * @param id - The fact ID
3245
+ */
3246
+ async deleteFact(id) {
3443
3247
  const request = new Request({
3444
3248
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3445
- method: "PATCH",
3446
- path: "/api/narratives/{id}",
3249
+ method: "DELETE",
3250
+ path: "/api/facts/{id}",
3447
3251
  config: this.config,
3448
3252
  retry: {
3449
3253
  attempts: 3,
@@ -3463,25 +3267,199 @@ var NarrativesService = class extends BaseService {
3463
3267
  isOffset: false,
3464
3268
  isCursor: false
3465
3269
  });
3270
+ return this.client.call(request);
3271
+ }
3272
+ /**
3273
+ * Search facts
3274
+ * Search semantic facts by query string
3275
+ * @param body - Request body
3276
+ */
3277
+ async searchFacts(body) {
3278
+ const request = new Request({
3279
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3280
+ method: "POST",
3281
+ path: "/api/facts/search",
3282
+ config: this.config,
3283
+ retry: {
3284
+ attempts: 3,
3285
+ delayMs: 150,
3286
+ maxDelayMs: 5e3,
3287
+ jitterMs: 50,
3288
+ backoffFactor: 2
3289
+ }
3290
+ });
3466
3291
  if (body !== void 0) {
3467
3292
  request.addBody(body);
3468
3293
  }
3469
3294
  return this.client.call(request);
3470
3295
  }
3296
+ };
3297
+
3298
+ // src/services/entities-service.ts
3299
+ var EntitiesService = class extends BaseService {
3300
+ /**
3301
+ * List entities
3302
+ * List all entities for the authenticated user, optionally filtered by type
3303
+ * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
3304
+ * @param limit - Maximum number of entities to return
3305
+ * @param offset - Number of entities to skip
3306
+ */
3307
+ async listEntities(options) {
3308
+ const request = new Request({
3309
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3310
+ method: "GET",
3311
+ path: "/api/entities",
3312
+ config: this.config,
3313
+ retry: {
3314
+ attempts: 3,
3315
+ delayMs: 150,
3316
+ maxDelayMs: 5e3,
3317
+ jitterMs: 50,
3318
+ backoffFactor: 2
3319
+ }
3320
+ });
3321
+ if (options?.type !== void 0) {
3322
+ request.addQueryParam("type", {
3323
+ key: "type",
3324
+ value: options.type,
3325
+ explode: false,
3326
+ encode: true,
3327
+ style: "form",
3328
+ isLimit: false,
3329
+ isOffset: false,
3330
+ isCursor: false
3331
+ });
3332
+ }
3333
+ if (options?.limit !== void 0) {
3334
+ request.addQueryParam("limit", {
3335
+ key: "limit",
3336
+ value: options.limit,
3337
+ explode: false,
3338
+ encode: true,
3339
+ style: "form",
3340
+ isLimit: true,
3341
+ isOffset: false,
3342
+ isCursor: false
3343
+ });
3344
+ }
3345
+ if (options?.offset !== void 0) {
3346
+ request.addQueryParam("offset", {
3347
+ key: "offset",
3348
+ value: options.offset,
3349
+ explode: false,
3350
+ encode: true,
3351
+ style: "form",
3352
+ isLimit: false,
3353
+ isOffset: true,
3354
+ isCursor: false
3355
+ });
3356
+ }
3357
+ return this.client.call(request);
3358
+ }
3359
+ /**
3360
+ * Get entity by ID
3361
+ * Retrieve a specific entity by its ID
3362
+ * @param id - The entity ID
3363
+ */
3364
+ async getEntityById(id) {
3365
+ const request = new Request({
3366
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3367
+ method: "GET",
3368
+ path: "/api/entities/{id}",
3369
+ config: this.config,
3370
+ retry: {
3371
+ attempts: 3,
3372
+ delayMs: 150,
3373
+ maxDelayMs: 5e3,
3374
+ jitterMs: 50,
3375
+ backoffFactor: 2
3376
+ }
3377
+ });
3378
+ request.addPathParam("id", {
3379
+ key: "id",
3380
+ value: id,
3381
+ explode: false,
3382
+ encode: true,
3383
+ style: "simple",
3384
+ isLimit: false,
3385
+ isOffset: false,
3386
+ isCursor: false
3387
+ });
3388
+ return this.client.call(request);
3389
+ }
3390
+ /**
3391
+ * Get memories mentioning entity
3392
+ * Get all memories that mention a specific entity
3393
+ * @param id - The entity ID
3394
+ * @param limit - Maximum number of memories to return
3395
+ * @param offset - Number of memories to skip
3396
+ */
3397
+ async getEntityMemories(id, options) {
3398
+ const request = new Request({
3399
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3400
+ method: "GET",
3401
+ path: "/api/entities/{id}/memories",
3402
+ config: this.config,
3403
+ retry: {
3404
+ attempts: 3,
3405
+ delayMs: 150,
3406
+ maxDelayMs: 5e3,
3407
+ jitterMs: 50,
3408
+ backoffFactor: 2
3409
+ }
3410
+ });
3411
+ request.addPathParam("id", {
3412
+ key: "id",
3413
+ value: id,
3414
+ explode: false,
3415
+ encode: true,
3416
+ style: "simple",
3417
+ isLimit: false,
3418
+ isOffset: false,
3419
+ isCursor: false
3420
+ });
3421
+ if (options?.limit !== void 0) {
3422
+ request.addQueryParam("limit", {
3423
+ key: "limit",
3424
+ value: options.limit,
3425
+ explode: false,
3426
+ encode: true,
3427
+ style: "form",
3428
+ isLimit: true,
3429
+ isOffset: false,
3430
+ isCursor: false
3431
+ });
3432
+ }
3433
+ if (options?.offset !== void 0) {
3434
+ request.addQueryParam("offset", {
3435
+ key: "offset",
3436
+ value: options.offset,
3437
+ explode: false,
3438
+ encode: true,
3439
+ style: "form",
3440
+ isLimit: false,
3441
+ isOffset: true,
3442
+ isCursor: false
3443
+ });
3444
+ }
3445
+ return this.client.call(request);
3446
+ }
3447
+ };
3448
+
3449
+ // src/services/conversations-service.ts
3450
+ var ConversationsService = class extends BaseService {
3471
3451
  /**
3472
- * Get narrative timeline
3473
- * Get all memories in a narrative, ordered by their position in the narrative.
3474
- Each memory includes its position and effective state.
3475
-
3476
- * @param id - The narrative ID
3477
- * @param limit - Maximum number of memories to return
3478
- * @param offset - Number of memories to skip
3479
- */
3480
- async getNarrativeTimeline(id, options) {
3452
+ * List conversations
3453
+ * List all conversations for the authenticated user with pagination
3454
+ * @param limit - Maximum number of conversations to return
3455
+ * @param offset - Number of conversations to skip
3456
+ * @param since - Return only conversations created after this timestamp (ISO 8601 format)
3457
+ */
3458
+ async listConversations(options) {
3481
3459
  const request = new Request({
3482
3460
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3483
3461
  method: "GET",
3484
- path: "/api/narratives/{id}/timeline",
3462
+ path: "/api/conversations",
3485
3463
  config: this.config,
3486
3464
  retry: {
3487
3465
  attempts: 3,
@@ -3491,16 +3469,6 @@ var NarrativesService = class extends BaseService {
3491
3469
  backoffFactor: 2
3492
3470
  }
3493
3471
  });
3494
- request.addPathParam("id", {
3495
- key: "id",
3496
- value: id,
3497
- explode: false,
3498
- encode: true,
3499
- style: "simple",
3500
- isLimit: false,
3501
- isOffset: false,
3502
- isCursor: false
3503
- });
3504
3472
  if (options?.limit !== void 0) {
3505
3473
  request.addQueryParam("limit", {
3506
3474
  key: "limit",
@@ -3525,21 +3493,30 @@ var NarrativesService = class extends BaseService {
3525
3493
  isCursor: false
3526
3494
  });
3527
3495
  }
3496
+ if (options?.since !== void 0) {
3497
+ request.addQueryParam("since", {
3498
+ key: "since",
3499
+ value: options.since,
3500
+ explode: false,
3501
+ encode: true,
3502
+ style: "form",
3503
+ isLimit: false,
3504
+ isOffset: false,
3505
+ isCursor: false
3506
+ });
3507
+ }
3528
3508
  return this.client.call(request);
3529
3509
  }
3530
3510
  /**
3531
- * Add a memory to a narrative
3532
- * Add an existing memory to a narrative thread.
3533
- Optionally specify a position to insert the memory at.
3534
-
3535
- * @param id - The narrative ID
3536
- * @param body - Request body
3537
- */
3538
- async addMemoryToNarrative(id, body) {
3511
+ * Create conversation
3512
+ * Create a new conversation for the authenticated user
3513
+ * @param body - Request body
3514
+ */
3515
+ async createConversation(body) {
3539
3516
  const request = new Request({
3540
3517
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3541
3518
  method: "POST",
3542
- path: "/api/narratives/{id}/memories",
3519
+ path: "/api/conversations",
3543
3520
  config: this.config,
3544
3521
  retry: {
3545
3522
  attempts: 3,
@@ -3549,34 +3526,21 @@ var NarrativesService = class extends BaseService {
3549
3526
  backoffFactor: 2
3550
3527
  }
3551
3528
  });
3552
- request.addPathParam("id", {
3553
- key: "id",
3554
- value: id,
3555
- explode: false,
3556
- encode: true,
3557
- style: "simple",
3558
- isLimit: false,
3559
- isOffset: false,
3560
- isCursor: false
3561
- });
3562
3529
  if (body !== void 0) {
3563
3530
  request.addBody(body);
3564
3531
  }
3565
3532
  return this.client.call(request);
3566
3533
  }
3567
3534
  /**
3568
- * Remove a memory from a narrative
3569
- * Remove a memory from a narrative thread.
3570
- This does not delete the memory itself, only removes it from the narrative.
3571
-
3572
- * @param id - The narrative ID
3573
- * @param memoryId - The memory ID to remove
3574
- */
3575
- async removeMemoryFromNarrative(id, memoryId) {
3535
+ * Get conversation summary
3536
+ * Retrieve a conversation summary by its ID
3537
+ * @param conversationId - The conversation ID
3538
+ */
3539
+ async getConversationSummary(conversationId) {
3576
3540
  const request = new Request({
3577
3541
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3578
- method: "DELETE",
3579
- path: "/api/narratives/{id}/memories/{memoryId}",
3542
+ method: "GET",
3543
+ path: "/api/conversations/{conversationId}",
3580
3544
  config: this.config,
3581
3545
  retry: {
3582
3546
  attempts: 3,
@@ -3586,19 +3550,9 @@ var NarrativesService = class extends BaseService {
3586
3550
  backoffFactor: 2
3587
3551
  }
3588
3552
  });
3589
- request.addPathParam("id", {
3590
- key: "id",
3591
- value: id,
3592
- explode: false,
3593
- encode: true,
3594
- style: "simple",
3595
- isLimit: false,
3596
- isOffset: false,
3597
- isCursor: false
3598
- });
3599
- request.addPathParam("memoryId", {
3600
- key: "memoryId",
3601
- value: memoryId,
3553
+ request.addPathParam("conversationId", {
3554
+ key: "conversationId",
3555
+ value: conversationId,
3602
3556
  explode: false,
3603
3557
  encode: true,
3604
3558
  style: "simple",
@@ -3608,20 +3562,16 @@ var NarrativesService = class extends BaseService {
3608
3562
  });
3609
3563
  return this.client.call(request);
3610
3564
  }
3611
- };
3612
-
3613
- // src/services/system-service.ts
3614
- var SystemService = class extends BaseService {
3615
3565
  /**
3616
- * Get OpenAPI specification
3617
- * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
3618
- * @param noCache - Bypass cache and regenerate specification
3566
+ * Delete conversation
3567
+ * Delete a conversation and soft-delete all associated memories
3568
+ * @param conversationId - The conversation ID
3619
3569
  */
3620
- async getOpenApiSpec(options) {
3570
+ async deleteConversation(conversationId) {
3621
3571
  const request = new Request({
3622
3572
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3623
- method: "GET",
3624
- path: "/api/openapi.json",
3573
+ method: "DELETE",
3574
+ path: "/api/conversations/{conversationId}",
3625
3575
  config: this.config,
3626
3576
  retry: {
3627
3577
  attempts: 3,
@@ -3631,29 +3581,28 @@ var SystemService = class extends BaseService {
3631
3581
  backoffFactor: 2
3632
3582
  }
3633
3583
  });
3634
- if (options?.noCache !== void 0) {
3635
- request.addQueryParam("noCache", {
3636
- key: "noCache",
3637
- value: options.noCache,
3638
- explode: false,
3639
- encode: true,
3640
- style: "form",
3641
- isLimit: false,
3642
- isOffset: false,
3643
- isCursor: false
3644
- });
3645
- }
3584
+ request.addPathParam("conversationId", {
3585
+ key: "conversationId",
3586
+ value: conversationId,
3587
+ explode: false,
3588
+ encode: true,
3589
+ style: "simple",
3590
+ isLimit: false,
3591
+ isOffset: false,
3592
+ isCursor: false
3593
+ });
3646
3594
  return this.client.call(request);
3647
3595
  }
3648
3596
  /**
3649
- * Get system health status
3650
- * Get the current health status of the system including database connectivity
3597
+ * Get conversation timeline
3598
+ * Get all memories in a conversation in chronological order
3599
+ * @param conversationId - The conversation ID
3651
3600
  */
3652
- async getSystemHealth() {
3601
+ async getConversationTimeline(conversationId) {
3653
3602
  const request = new Request({
3654
3603
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3655
3604
  method: "GET",
3656
- path: "/api/system/health",
3605
+ path: "/api/conversations/{conversationId}/timeline",
3657
3606
  config: this.config,
3658
3607
  retry: {
3659
3608
  attempts: 3,
@@ -3663,17 +3612,28 @@ var SystemService = class extends BaseService {
3663
3612
  backoffFactor: 2
3664
3613
  }
3665
3614
  });
3615
+ request.addPathParam("conversationId", {
3616
+ key: "conversationId",
3617
+ value: conversationId,
3618
+ explode: false,
3619
+ encode: true,
3620
+ style: "simple",
3621
+ isLimit: false,
3622
+ isOffset: false,
3623
+ isCursor: false
3624
+ });
3666
3625
  return this.client.call(request);
3667
3626
  }
3668
3627
  /**
3669
- * Get context status
3670
- * Get database statistics and context information
3628
+ * Search conversations
3629
+ * Search conversations by query string
3630
+ * @param body - Request body
3671
3631
  */
3672
- async getContextStatus() {
3632
+ async searchConversations(body) {
3673
3633
  const request = new Request({
3674
3634
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3675
- method: "GET",
3676
- path: "/api/system/context/status",
3635
+ method: "POST",
3636
+ path: "/api/conversations/search",
3677
3637
  config: this.config,
3678
3638
  retry: {
3679
3639
  attempts: 3,
@@ -3683,17 +3643,21 @@ var SystemService = class extends BaseService {
3683
3643
  backoffFactor: 2
3684
3644
  }
3685
3645
  });
3646
+ if (body !== void 0) {
3647
+ request.addBody(body);
3648
+ }
3686
3649
  return this.client.call(request);
3687
3650
  }
3688
3651
  /**
3689
- * Get feature flags
3690
- * Get all feature flags for the authenticated user
3652
+ * Find conversations by topic
3653
+ * Find conversations that contain a specific topic
3654
+ * @param body - Request body
3691
3655
  */
3692
- async getFeatureFlags() {
3656
+ async findConversationsByTopic(body) {
3693
3657
  const request = new Request({
3694
3658
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3695
- method: "GET",
3696
- path: "/api/system/feature-flags",
3659
+ method: "POST",
3660
+ path: "/api/conversations/by-topic",
3697
3661
  config: this.config,
3698
3662
  retry: {
3699
3663
  attempts: 3,
@@ -3703,18 +3667,24 @@ var SystemService = class extends BaseService {
3703
3667
  backoffFactor: 2
3704
3668
  }
3705
3669
  });
3670
+ if (body !== void 0) {
3671
+ request.addBody(body);
3672
+ }
3706
3673
  return this.client.call(request);
3707
3674
  }
3675
+ };
3676
+
3677
+ // src/services/billing-service.ts
3678
+ var BillingService = class extends BaseService {
3708
3679
  /**
3709
- * Evaluate feature flag
3710
- * Evaluate a specific feature flag for the authenticated user
3711
- * @param body - Request body
3680
+ * Get billing overview
3681
+ * Get subscription, payment method, and upcoming invoice information
3712
3682
  */
3713
- async evaluateFeatureFlag(body) {
3683
+ async getBillingOverview() {
3714
3684
  const request = new Request({
3715
3685
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3716
- method: "POST",
3717
- path: "/api/system/feature-flags/evaluate",
3686
+ method: "GET",
3687
+ path: "/api/billing/overview",
3718
3688
  config: this.config,
3719
3689
  retry: {
3720
3690
  attempts: 3,
@@ -3724,22 +3694,18 @@ var SystemService = class extends BaseService {
3724
3694
  backoffFactor: 2
3725
3695
  }
3726
3696
  });
3727
- if (body !== void 0) {
3728
- request.addBody(body);
3729
- }
3730
3697
  return this.client.call(request);
3731
3698
  }
3732
3699
  /**
3733
- * Analyze memory quality distribution
3734
- * Analyze the quality distribution of memories for the authenticated user
3735
- * @param includeDetails - Include detailed pruning candidate information
3736
- * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
3700
+ * Create checkout session
3701
+ * Create a Stripe checkout session for subscription upgrade
3702
+ * @param body - Request body
3737
3703
  */
3738
- async analyzeMemoryQuality(options) {
3704
+ async createCheckoutSession(body) {
3739
3705
  const request = new Request({
3740
3706
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3741
- method: "GET",
3742
- path: "/api/system/memory/quality",
3707
+ method: "POST",
3708
+ path: "/api/billing/checkout",
3743
3709
  config: this.config,
3744
3710
  retry: {
3745
3711
  attempts: 3,
@@ -3749,42 +3715,21 @@ var SystemService = class extends BaseService {
3749
3715
  backoffFactor: 2
3750
3716
  }
3751
3717
  });
3752
- if (options?.includeDetails !== void 0) {
3753
- request.addQueryParam("includeDetails", {
3754
- key: "includeDetails",
3755
- value: options.includeDetails,
3756
- explode: false,
3757
- encode: true,
3758
- style: "form",
3759
- isLimit: false,
3760
- isOffset: false,
3761
- isCursor: false
3762
- });
3763
- }
3764
- if (options?.minQualityThreshold !== void 0) {
3765
- request.addQueryParam("minQualityThreshold", {
3766
- key: "minQualityThreshold",
3767
- value: options.minQualityThreshold,
3768
- explode: false,
3769
- encode: true,
3770
- style: "form",
3771
- isLimit: false,
3772
- isOffset: false,
3773
- isCursor: false
3774
- });
3718
+ if (body !== void 0) {
3719
+ request.addBody(body);
3775
3720
  }
3776
3721
  return this.client.call(request);
3777
3722
  }
3778
3723
  /**
3779
- * Prune low-quality memories
3780
- * Prune (soft delete) low-quality memories for the authenticated user
3724
+ * Create billing portal session
3725
+ * Create a Stripe billing portal session for managing subscription
3781
3726
  * @param body - Request body
3782
3727
  */
3783
- async pruneMemories(options) {
3728
+ async createPortalSession(body) {
3784
3729
  const request = new Request({
3785
3730
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3786
3731
  method: "POST",
3787
- path: "/api/system/memory/prune",
3732
+ path: "/api/billing/portal",
3788
3733
  config: this.config,
3789
3734
  retry: {
3790
3735
  attempts: 3,
@@ -3794,26 +3739,20 @@ var SystemService = class extends BaseService {
3794
3739
  backoffFactor: 2
3795
3740
  }
3796
3741
  });
3797
- if (options?.body !== void 0) {
3798
- request.addBody(options?.body);
3742
+ if (body !== void 0) {
3743
+ request.addBody(body);
3799
3744
  }
3800
3745
  return this.client.call(request);
3801
3746
  }
3802
- };
3803
-
3804
- // src/services/patterns-service.ts
3805
- var PatternsService = class extends BaseService {
3806
3747
  /**
3807
- * List patterns
3808
- * List all patterns for the authenticated user
3809
- * @param limit - Maximum number of patterns to return
3810
- * @param offset - Number of patterns to skip
3748
+ * Get current subscription
3749
+ * Get the current subscription details for the authenticated user
3811
3750
  */
3812
- async listPatterns(options) {
3751
+ async getSubscription() {
3813
3752
  const request = new Request({
3814
3753
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3815
3754
  method: "GET",
3816
- path: "/api/patterns",
3755
+ path: "/api/billing/subscription",
3817
3756
  config: this.config,
3818
3757
  retry: {
3819
3758
  attempts: 3,
@@ -3823,42 +3762,18 @@ var PatternsService = class extends BaseService {
3823
3762
  backoffFactor: 2
3824
3763
  }
3825
3764
  });
3826
- if (options?.limit !== void 0) {
3827
- request.addQueryParam("limit", {
3828
- key: "limit",
3829
- value: options.limit,
3830
- explode: false,
3831
- encode: true,
3832
- style: "form",
3833
- isLimit: true,
3834
- isOffset: false,
3835
- isCursor: false
3836
- });
3837
- }
3838
- if (options?.offset !== void 0) {
3839
- request.addQueryParam("offset", {
3840
- key: "offset",
3841
- value: options.offset,
3842
- explode: false,
3843
- encode: true,
3844
- style: "form",
3845
- isLimit: false,
3846
- isOffset: true,
3847
- isCursor: false
3848
- });
3849
- }
3850
3765
  return this.client.call(request);
3851
3766
  }
3852
3767
  /**
3853
- * Compile patterns
3854
- * Compile patterns from user's memories
3768
+ * Cancel subscription
3769
+ * Cancel the current subscription at the end of the billing period
3855
3770
  * @param body - Request body
3856
3771
  */
3857
- async compilePatterns(options) {
3772
+ async cancelSubscription(options) {
3858
3773
  const request = new Request({
3859
3774
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3860
3775
  method: "POST",
3861
- path: "/api/patterns/compile",
3776
+ path: "/api/billing/subscription/cancel",
3862
3777
  config: this.config,
3863
3778
  retry: {
3864
3779
  attempts: 3,
@@ -3874,15 +3789,15 @@ var PatternsService = class extends BaseService {
3874
3789
  return this.client.call(request);
3875
3790
  }
3876
3791
  /**
3877
- * Detect behavioral patterns
3878
- * Run pattern detection algorithms to identify recurring behavioral patterns
3792
+ * Reactivate subscription
3793
+ * Reactivate a subscription that was scheduled for cancellation
3879
3794
  * @param body - Request body
3880
3795
  */
3881
- async detectPatterns(options) {
3796
+ async reactivateSubscription(options) {
3882
3797
  const request = new Request({
3883
3798
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3884
3799
  method: "POST",
3885
- path: "/api/patterns/detect",
3800
+ path: "/api/billing/subscription/reactivate",
3886
3801
  config: this.config,
3887
3802
  retry: {
3888
3803
  attempts: 3,
@@ -3898,15 +3813,15 @@ var PatternsService = class extends BaseService {
3898
3813
  return this.client.call(request);
3899
3814
  }
3900
3815
  /**
3901
- * Analyze pattern trends
3902
- * Analyze pattern trends, correlations, and generate insights
3903
- * @param body - Request body
3816
+ * List invoices
3817
+ * Get a list of invoices for the authenticated user
3818
+ * @param limit - Maximum number of invoices to return
3904
3819
  */
3905
- async analyzePatterns(options) {
3820
+ async listInvoices(options) {
3906
3821
  const request = new Request({
3907
3822
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3908
- method: "POST",
3909
- path: "/api/patterns/analyze",
3823
+ method: "GET",
3824
+ path: "/api/billing/invoices",
3910
3825
  config: this.config,
3911
3826
  retry: {
3912
3827
  attempts: 3,
@@ -3916,22 +3831,29 @@ var PatternsService = class extends BaseService {
3916
3831
  backoffFactor: 2
3917
3832
  }
3918
3833
  });
3919
- if (options?.body !== void 0) {
3920
- request.addBody(options?.body);
3834
+ if (options?.limit !== void 0) {
3835
+ request.addQueryParam("limit", {
3836
+ key: "limit",
3837
+ value: options.limit,
3838
+ explode: false,
3839
+ encode: true,
3840
+ style: "form",
3841
+ isLimit: true,
3842
+ isOffset: false,
3843
+ isCursor: false
3844
+ });
3921
3845
  }
3922
3846
  return this.client.call(request);
3923
3847
  }
3924
3848
  /**
3925
- * Update pattern
3926
- * Update an existing pattern with partial data
3927
- * @param id - The pattern ID
3928
- * @param body - Request body
3849
+ * List payment methods
3850
+ * Get a list of payment methods for the authenticated user
3929
3851
  */
3930
- async updatePattern(id, body) {
3852
+ async listPaymentMethods() {
3931
3853
  const request = new Request({
3932
3854
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3933
- method: "PATCH",
3934
- path: "/api/patterns/{id}",
3855
+ method: "GET",
3856
+ path: "/api/billing/payment-methods",
3935
3857
  config: this.config,
3936
3858
  retry: {
3937
3859
  attempts: 3,
@@ -3941,31 +3863,19 @@ var PatternsService = class extends BaseService {
3941
3863
  backoffFactor: 2
3942
3864
  }
3943
3865
  });
3944
- request.addPathParam("id", {
3945
- key: "id",
3946
- value: id,
3947
- explode: false,
3948
- encode: true,
3949
- style: "simple",
3950
- isLimit: false,
3951
- isOffset: false,
3952
- isCursor: false
3953
- });
3954
- if (body !== void 0) {
3955
- request.addBody(body);
3956
- }
3957
3866
  return this.client.call(request);
3958
3867
  }
3959
3868
  /**
3960
- * Record pattern feedback
3961
- * Record feedback on a pattern
3869
+ * Set default payment method
3870
+ * Set a payment method as the default for future payments
3871
+ * @param id - The payment method ID
3962
3872
  * @param body - Request body
3963
3873
  */
3964
- async recordPatternFeedback(body) {
3874
+ async setDefaultPaymentMethod(id, options) {
3965
3875
  const request = new Request({
3966
3876
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3967
3877
  method: "POST",
3968
- path: "/api/patterns/feedback",
3878
+ path: "/api/billing/payment-methods/{id}/default",
3969
3879
  config: this.config,
3970
3880
  retry: {
3971
3881
  attempts: 3,
@@ -3975,24 +3885,31 @@ var PatternsService = class extends BaseService {
3975
3885
  backoffFactor: 2
3976
3886
  }
3977
3887
  });
3978
- if (body !== void 0) {
3979
- request.addBody(body);
3888
+ request.addPathParam("id", {
3889
+ key: "id",
3890
+ value: id,
3891
+ explode: false,
3892
+ encode: true,
3893
+ style: "simple",
3894
+ isLimit: false,
3895
+ isOffset: false,
3896
+ isCursor: false
3897
+ });
3898
+ if (options?.body !== void 0) {
3899
+ request.addBody(options?.body);
3980
3900
  }
3981
3901
  return this.client.call(request);
3982
3902
  }
3983
- };
3984
-
3985
- // src/services/behavior-service.ts
3986
- var BehaviorService = class extends BaseService {
3987
3903
  /**
3988
- * Get behavioral state
3989
- * Get current behavioral state for the authenticated user
3904
+ * Delete payment method
3905
+ * Remove a payment method from the account
3906
+ * @param id - The payment method ID
3990
3907
  */
3991
- async getBehavioralState() {
3908
+ async deletePaymentMethod(id) {
3992
3909
  const request = new Request({
3993
3910
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3994
- method: "GET",
3995
- path: "/api/patterns/behavior/state",
3911
+ method: "DELETE",
3912
+ path: "/api/billing/payment-methods/{id}",
3996
3913
  config: this.config,
3997
3914
  retry: {
3998
3915
  attempts: 3,
@@ -4002,18 +3919,28 @@ var BehaviorService = class extends BaseService {
4002
3919
  backoffFactor: 2
4003
3920
  }
4004
3921
  });
3922
+ request.addPathParam("id", {
3923
+ key: "id",
3924
+ value: id,
3925
+ explode: false,
3926
+ encode: true,
3927
+ style: "simple",
3928
+ isLimit: false,
3929
+ isOffset: false,
3930
+ isCursor: false
3931
+ });
4005
3932
  return this.client.call(request);
4006
3933
  }
4007
3934
  /**
4008
- * Update behavioral state
4009
- * Update or mutate behavioral state
3935
+ * Stripe webhook endpoint
3936
+ * Receive and process Stripe webhook events
4010
3937
  * @param body - Request body
4011
3938
  */
4012
- async updateBehavioralState(options) {
3939
+ async stripeWebhook(body) {
4013
3940
  const request = new Request({
4014
3941
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4015
3942
  method: "POST",
4016
- path: "/api/patterns/behavior/state",
3943
+ path: "/api/billing/webhooks",
4017
3944
  config: this.config,
4018
3945
  retry: {
4019
3946
  attempts: 3,
@@ -4023,26 +3950,29 @@ var BehaviorService = class extends BaseService {
4023
3950
  backoffFactor: 2
4024
3951
  }
4025
3952
  });
4026
- if (options?.body !== void 0) {
4027
- request.addBody(options?.body);
3953
+ if (body !== void 0) {
3954
+ request.addBody(body);
4028
3955
  }
4029
3956
  return this.client.call(request);
4030
3957
  }
4031
3958
  };
4032
3959
 
4033
- // src/services/topics-service.ts
4034
- var TopicsService = class extends BaseService {
3960
+ // src/services/artifacts-service.ts
3961
+ var ArtifactsService = class extends BaseService {
4035
3962
  /**
4036
- * List topics
4037
- * List all topics with pagination
4038
- * @param limit - Maximum number of topics to return
4039
- * @param offset - Number of topics to skip
3963
+ * List artifacts
3964
+ * List all artifacts for the authenticated user with optional filters
3965
+ * @param limit - Maximum number of artifacts to return
3966
+ * @param offset - Number of artifacts to skip
3967
+ * @param memoryId - Filter by memory ID
3968
+ * @param conversationId - Filter by conversation ID
3969
+ * @param type - Filter by artifact type
4040
3970
  */
4041
- async listTopics(options) {
3971
+ async listArtifacts(options) {
4042
3972
  const request = new Request({
4043
3973
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4044
3974
  method: "GET",
4045
- path: "/api/topics",
3975
+ path: "/api/artifacts",
4046
3976
  config: this.config,
4047
3977
  retry: {
4048
3978
  attempts: 3,
@@ -4076,49 +4006,54 @@ var TopicsService = class extends BaseService {
4076
4006
  isCursor: false
4077
4007
  });
4078
4008
  }
4009
+ if (options?.memoryId !== void 0) {
4010
+ request.addQueryParam("memoryId", {
4011
+ key: "memoryId",
4012
+ value: options.memoryId,
4013
+ explode: false,
4014
+ encode: true,
4015
+ style: "form",
4016
+ isLimit: false,
4017
+ isOffset: false,
4018
+ isCursor: false
4019
+ });
4020
+ }
4021
+ if (options?.conversationId !== void 0) {
4022
+ request.addQueryParam("conversationId", {
4023
+ key: "conversationId",
4024
+ value: options.conversationId,
4025
+ explode: false,
4026
+ encode: true,
4027
+ style: "form",
4028
+ isLimit: false,
4029
+ isOffset: false,
4030
+ isCursor: false
4031
+ });
4032
+ }
4033
+ if (options?.type !== void 0) {
4034
+ request.addQueryParam("type", {
4035
+ key: "type",
4036
+ value: options.type,
4037
+ explode: false,
4038
+ encode: true,
4039
+ style: "form",
4040
+ isLimit: false,
4041
+ isOffset: false,
4042
+ isCursor: false
4043
+ });
4044
+ }
4079
4045
  return this.client.call(request);
4080
4046
  }
4081
4047
  /**
4082
- * Get topic by ID
4083
- * Retrieve a specific topic by its ID
4084
- * @param id - The topic ID
4085
- */
4086
- async getTopicById(id) {
4087
- const request = new Request({
4088
- baseUrl: this.config.baseUrl || "http://localhost:3000",
4089
- method: "GET",
4090
- path: "/api/topics/{id}",
4091
- config: this.config,
4092
- retry: {
4093
- attempts: 3,
4094
- delayMs: 150,
4095
- maxDelayMs: 5e3,
4096
- jitterMs: 50,
4097
- backoffFactor: 2
4098
- }
4099
- });
4100
- request.addPathParam("id", {
4101
- key: "id",
4102
- value: id,
4103
- explode: false,
4104
- encode: true,
4105
- style: "simple",
4106
- isLimit: false,
4107
- isOffset: false,
4108
- isCursor: false
4109
- });
4110
- return this.client.call(request);
4111
- }
4112
- /**
4113
- * Merge topics
4114
- * Merge two topics into one
4048
+ * Create artifact
4049
+ * Create a new artifact for the authenticated user
4115
4050
  * @param body - Request body
4116
4051
  */
4117
- async mergeTopics(body) {
4052
+ async createArtifact(body) {
4118
4053
  const request = new Request({
4119
4054
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4120
4055
  method: "POST",
4121
- path: "/api/topics/merge",
4056
+ path: "/api/artifacts",
4122
4057
  config: this.config,
4123
4058
  retry: {
4124
4059
  attempts: 3,
@@ -4134,15 +4069,15 @@ var TopicsService = class extends BaseService {
4134
4069
  return this.client.call(request);
4135
4070
  }
4136
4071
  /**
4137
- * Discover related topics
4138
- * Discover topics related to a given topic
4139
- * @param body - Request body
4072
+ * Get artifact by ID
4073
+ * Retrieve a specific artifact by its ID
4074
+ * @param id - The artifact ID
4140
4075
  */
4141
- async discoverRelatedTopics(body) {
4076
+ async getArtifactById(id) {
4142
4077
  const request = new Request({
4143
4078
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4144
- method: "POST",
4145
- path: "/api/topics/discover-related",
4079
+ method: "GET",
4080
+ path: "/api/artifacts/{id}",
4146
4081
  config: this.config,
4147
4082
  retry: {
4148
4083
  attempts: 3,
@@ -4152,21 +4087,28 @@ var TopicsService = class extends BaseService {
4152
4087
  backoffFactor: 2
4153
4088
  }
4154
4089
  });
4155
- if (body !== void 0) {
4156
- request.addBody(body);
4157
- }
4090
+ request.addPathParam("id", {
4091
+ key: "id",
4092
+ value: id,
4093
+ explode: false,
4094
+ encode: true,
4095
+ style: "simple",
4096
+ isLimit: false,
4097
+ isOffset: false,
4098
+ isCursor: false
4099
+ });
4158
4100
  return this.client.call(request);
4159
4101
  }
4160
4102
  /**
4161
- * Calculate topic similarity
4162
- * Calculate similarity score between two topics
4163
- * @param body - Request body
4103
+ * Delete artifact
4104
+ * Delete an artifact by its ID
4105
+ * @param id - The artifact ID
4164
4106
  */
4165
- async calculateTopicSimilarity(body) {
4107
+ async deleteArtifact(id) {
4166
4108
  const request = new Request({
4167
4109
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4168
- method: "POST",
4169
- path: "/api/topics/similarity",
4110
+ method: "DELETE",
4111
+ path: "/api/artifacts/{id}",
4170
4112
  config: this.config,
4171
4113
  retry: {
4172
4114
  attempts: 3,
@@ -4176,21 +4118,29 @@ var TopicsService = class extends BaseService {
4176
4118
  backoffFactor: 2
4177
4119
  }
4178
4120
  });
4179
- if (body !== void 0) {
4180
- request.addBody(body);
4181
- }
4121
+ request.addPathParam("id", {
4122
+ key: "id",
4123
+ value: id,
4124
+ explode: false,
4125
+ encode: true,
4126
+ style: "simple",
4127
+ isLimit: false,
4128
+ isOffset: false,
4129
+ isCursor: false
4130
+ });
4182
4131
  return this.client.call(request);
4183
4132
  }
4184
4133
  /**
4185
- * Find similar topics
4186
- * Find topics similar to a given topic
4134
+ * Update artifact
4135
+ * Update an existing artifact with partial data
4136
+ * @param id - The artifact ID
4187
4137
  * @param body - Request body
4188
4138
  */
4189
- async findSimilarTopics(body) {
4139
+ async updateArtifact(id, body) {
4190
4140
  const request = new Request({
4191
4141
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4192
- method: "POST",
4193
- path: "/api/topics/similar",
4142
+ method: "PATCH",
4143
+ path: "/api/artifacts/{id}",
4194
4144
  config: this.config,
4195
4145
  retry: {
4196
4146
  attempts: 3,
@@ -4200,21 +4150,34 @@ var TopicsService = class extends BaseService {
4200
4150
  backoffFactor: 2
4201
4151
  }
4202
4152
  });
4153
+ request.addPathParam("id", {
4154
+ key: "id",
4155
+ value: id,
4156
+ explode: false,
4157
+ encode: true,
4158
+ style: "simple",
4159
+ isLimit: false,
4160
+ isOffset: false,
4161
+ isCursor: false
4162
+ });
4203
4163
  if (body !== void 0) {
4204
4164
  request.addBody(body);
4205
4165
  }
4206
4166
  return this.client.call(request);
4207
4167
  }
4168
+ };
4169
+
4170
+ // src/services/api-keys-service.ts
4171
+ var ApiKeysService = class extends BaseService {
4208
4172
  /**
4209
- * Cluster topics
4210
- * Cluster topics using community detection algorithms
4211
- * @param body - Request body
4173
+ * Get user information for current API key
4174
+ * Debug endpoint to retrieve user ID and authentication method from the current API key
4212
4175
  */
4213
- async clusterTopics(options) {
4176
+ async debugUser() {
4214
4177
  const request = new Request({
4215
4178
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4216
- method: "POST",
4217
- path: "/api/topics/cluster",
4179
+ method: "GET",
4180
+ path: "/api/apikeys/debug-user",
4218
4181
  config: this.config,
4219
4182
  retry: {
4220
4183
  attempts: 3,
@@ -4224,21 +4187,17 @@ var TopicsService = class extends BaseService {
4224
4187
  backoffFactor: 2
4225
4188
  }
4226
4189
  });
4227
- if (options?.body !== void 0) {
4228
- request.addBody(options?.body);
4229
- }
4230
4190
  return this.client.call(request);
4231
4191
  }
4232
4192
  /**
4233
- * Detect communities
4234
- * Detect communities in the topic graph using specified algorithm
4235
- * @param body - Request body
4193
+ * List API keys
4194
+ * List all API keys for the authenticated user
4236
4195
  */
4237
- async detectCommunities(options) {
4196
+ async listApiKeys() {
4238
4197
  const request = new Request({
4239
4198
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4240
- method: "POST",
4241
- path: "/api/topics/detect-communities",
4199
+ method: "GET",
4200
+ path: "/api/apikeys",
4242
4201
  config: this.config,
4243
4202
  retry: {
4244
4203
  attempts: 3,
@@ -4248,21 +4207,18 @@ var TopicsService = class extends BaseService {
4248
4207
  backoffFactor: 2
4249
4208
  }
4250
4209
  });
4251
- if (options?.body !== void 0) {
4252
- request.addBody(options?.body);
4253
- }
4254
4210
  return this.client.call(request);
4255
4211
  }
4256
4212
  /**
4257
- * Search topics
4258
- * Search topics by query string using fulltext search
4213
+ * Create API key
4214
+ * Create a new API key for the authenticated user
4259
4215
  * @param body - Request body
4260
4216
  */
4261
- async searchTopics(body) {
4217
+ async createApiKey(options) {
4262
4218
  const request = new Request({
4263
4219
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4264
4220
  method: "POST",
4265
- path: "/api/topics/search",
4221
+ path: "/api/apikeys",
4266
4222
  config: this.config,
4267
4223
  retry: {
4268
4224
  attempts: 3,
@@ -4272,30 +4228,21 @@ var TopicsService = class extends BaseService {
4272
4228
  backoffFactor: 2
4273
4229
  }
4274
4230
  });
4275
- if (body !== void 0) {
4276
- request.addBody(body);
4231
+ if (options?.body !== void 0) {
4232
+ request.addBody(options?.body);
4277
4233
  }
4278
4234
  return this.client.call(request);
4279
4235
  }
4280
- };
4281
-
4282
- // src/services/users-service.ts
4283
- var UsersService = class extends BaseService {
4284
4236
  /**
4285
- * Sync user from WorkOS
4286
- * Called by the customer portal after WorkOS authentication.
4287
- Creates a new user if they don't exist, or updates their profile if they do.
4288
- This is the main entry point for user provisioning.
4289
- When the invite gate is closed and a new user is created, the inviteCode
4290
- is redeemed atomically to track which code was used for registration.
4291
-
4292
- * @param body - Request body
4293
- */
4294
- async syncUser(body) {
4237
+ * Delete API key
4238
+ * Delete (revoke) an API key by its ID
4239
+ * @param id - The API key ID
4240
+ */
4241
+ async deleteApiKey(id) {
4295
4242
  const request = new Request({
4296
4243
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4297
- method: "POST",
4298
- path: "/api/users/sync",
4244
+ method: "DELETE",
4245
+ path: "/api/apikeys/{id}",
4299
4246
  config: this.config,
4300
4247
  retry: {
4301
4248
  attempts: 3,
@@ -4305,20 +4252,34 @@ var UsersService = class extends BaseService {
4305
4252
  backoffFactor: 2
4306
4253
  }
4307
4254
  });
4308
- if (body !== void 0) {
4309
- request.addBody(body);
4310
- }
4255
+ request.addPathParam("id", {
4256
+ key: "id",
4257
+ value: id,
4258
+ explode: false,
4259
+ encode: true,
4260
+ style: "simple",
4261
+ isLimit: false,
4262
+ isOffset: false,
4263
+ isCursor: false
4264
+ });
4311
4265
  return this.client.call(request);
4312
4266
  }
4267
+ };
4268
+
4269
+ // src/services/admin-service.ts
4270
+ var AdminService = class extends BaseService {
4313
4271
  /**
4314
- * Get current user
4315
- * Get the currently authenticated user's profile and usage information
4272
+ * List invite codes
4273
+ * List all invite codes with optional status filter
4274
+ * @param status - Filter by status
4275
+ * @param limit -
4276
+ * @param offset -
4316
4277
  */
4317
- async getCurrentUser() {
4278
+ async adminListInviteCodes(options) {
4318
4279
  const request = new Request({
4319
4280
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4320
4281
  method: "GET",
4321
- path: "/api/users/me",
4282
+ path: "/api/admin/invites",
4322
4283
  config: this.config,
4323
4284
  retry: {
4324
4285
  attempts: 3,
@@ -4328,18 +4289,54 @@ var UsersService = class extends BaseService {
4328
4289
  backoffFactor: 2
4329
4290
  }
4330
4291
  });
4292
+ if (options?.status !== void 0) {
4293
+ request.addQueryParam("status", {
4294
+ key: "status",
4295
+ value: options.status,
4296
+ explode: false,
4297
+ encode: true,
4298
+ style: "form",
4299
+ isLimit: false,
4300
+ isOffset: false,
4301
+ isCursor: false
4302
+ });
4303
+ }
4304
+ if (options?.limit !== void 0) {
4305
+ request.addQueryParam("limit", {
4306
+ key: "limit",
4307
+ value: options.limit,
4308
+ explode: false,
4309
+ encode: true,
4310
+ style: "form",
4311
+ isLimit: true,
4312
+ isOffset: false,
4313
+ isCursor: false
4314
+ });
4315
+ }
4316
+ if (options?.offset !== void 0) {
4317
+ request.addQueryParam("offset", {
4318
+ key: "offset",
4319
+ value: options.offset,
4320
+ explode: false,
4321
+ encode: true,
4322
+ style: "form",
4323
+ isLimit: false,
4324
+ isOffset: true,
4325
+ isCursor: false
4326
+ });
4327
+ }
4331
4328
  return this.client.call(request);
4332
4329
  }
4333
4330
  /**
4334
- * Update current user
4335
- * Update the currently authenticated user's profile
4331
+ * Create invite code
4332
+ * Create a new invite code for the gated preview
4336
4333
  * @param body - Request body
4337
4334
  */
4338
- async updateCurrentUser(options) {
4335
+ async adminCreateInviteCode(body) {
4339
4336
  const request = new Request({
4340
4337
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4341
- method: "PATCH",
4342
- path: "/api/users/me",
4338
+ method: "POST",
4339
+ path: "/api/admin/invites",
4343
4340
  config: this.config,
4344
4341
  retry: {
4345
4342
  attempts: 3,
@@ -4349,20 +4346,20 @@ var UsersService = class extends BaseService {
4349
4346
  backoffFactor: 2
4350
4347
  }
4351
4348
  });
4352
- if (options?.body !== void 0) {
4353
- request.addBody(options?.body);
4349
+ if (body !== void 0) {
4350
+ request.addBody(body);
4354
4351
  }
4355
4352
  return this.client.call(request);
4356
4353
  }
4357
4354
  /**
4358
- * Get current user's usage
4359
- * Get the currently authenticated user's memory usage statistics
4355
+ * Get invite system statistics
4356
+ * Aggregate statistics for the invite system
4360
4357
  */
4361
- async getCurrentUserUsage() {
4358
+ async adminGetInviteStats() {
4362
4359
  const request = new Request({
4363
4360
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4364
4361
  method: "GET",
4365
- path: "/api/users/me/usage",
4362
+ path: "/api/admin/invites/stats",
4366
4363
  config: this.config,
4367
4364
  retry: {
4368
4365
  attempts: 3,
@@ -4375,18 +4372,15 @@ var UsersService = class extends BaseService {
4375
4372
  return this.client.call(request);
4376
4373
  }
4377
4374
  /**
4378
- * Export all user data
4379
- * Export all user data as a JSON archive. Includes profile, memories,
4380
- conversations, facts, and patterns. Supports GDPR Article 20
4381
- (right to data portability). Sensitive fields (Stripe customer ID,
4382
- WorkOS ID, embeddings) are excluded.
4383
-
4384
- */
4385
- async exportUserData() {
4375
+ * Get invite code details
4376
+ * Get details for a single invite code including redemptions
4377
+ * @param code - The invite code
4378
+ */
4379
+ async adminGetInviteCode(code) {
4386
4380
  const request = new Request({
4387
4381
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4388
4382
  method: "GET",
4389
- path: "/api/users/me/export",
4383
+ path: "/api/admin/invites/{code}",
4390
4384
  config: this.config,
4391
4385
  retry: {
4392
4386
  attempts: 3,
@@ -4396,21 +4390,28 @@ var UsersService = class extends BaseService {
4396
4390
  backoffFactor: 2
4397
4391
  }
4398
4392
  });
4393
+ request.addPathParam("code", {
4394
+ key: "code",
4395
+ value: code,
4396
+ explode: false,
4397
+ encode: true,
4398
+ style: "simple",
4399
+ isLimit: false,
4400
+ isOffset: false,
4401
+ isCursor: false
4402
+ });
4399
4403
  return this.client.call(request);
4400
4404
  }
4401
4405
  /**
4402
- * Initiate account deletion
4403
- * Schedule the current user's account for deletion after a 7-day grace period.
4404
- Requires email confirmation. Immediately revokes API keys and cancels
4405
- any active subscription. The account enters read-only mode.
4406
-
4407
- * @param body - Request body
4408
- */
4409
- async initiateAccountDeletion(body) {
4406
+ * Revoke an invite code
4407
+ * Revoke an invite code. Existing accounts created with this code are unaffected.
4408
+ * @param code -
4409
+ */
4410
+ async adminRevokeInviteCode(code) {
4410
4411
  const request = new Request({
4411
4412
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4412
- method: "POST",
4413
- path: "/api/users/me/deletion",
4413
+ method: "DELETE",
4414
+ path: "/api/admin/invites/{code}",
4414
4415
  config: this.config,
4415
4416
  retry: {
4416
4417
  attempts: 3,
@@ -4420,23 +4421,27 @@ var UsersService = class extends BaseService {
4420
4421
  backoffFactor: 2
4421
4422
  }
4422
4423
  });
4423
- if (body !== void 0) {
4424
- request.addBody(body);
4425
- }
4424
+ request.addPathParam("code", {
4425
+ key: "code",
4426
+ value: code,
4427
+ explode: false,
4428
+ encode: true,
4429
+ style: "simple",
4430
+ isLimit: false,
4431
+ isOffset: false,
4432
+ isCursor: false
4433
+ });
4426
4434
  return this.client.call(request);
4427
4435
  }
4428
4436
  /**
4429
- * Cancel account deletion
4430
- * Cancel a pending account deletion during the grace period.
4431
- Note: Previously revoked API keys are not restored — new keys must be created.
4432
- Stripe subscription may need manual reactivation via the billing portal.
4433
-
4434
- */
4435
- async cancelAccountDeletion() {
4437
+ * Get gate status with audit info
4438
+ * Get current invite gate state with audit information
4439
+ */
4440
+ async adminGetGateStatus() {
4436
4441
  const request = new Request({
4437
4442
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4438
- method: "DELETE",
4439
- path: "/api/users/me/deletion",
4443
+ method: "GET",
4444
+ path: "/api/admin/gate",
4440
4445
  config: this.config,
4441
4446
  retry: {
4442
4447
  attempts: 3,
@@ -4449,15 +4454,17 @@ var UsersService = class extends BaseService {
4449
4454
  return this.client.call(request);
4450
4455
  }
4451
4456
  /**
4452
- * Get user by ID
4453
- * Get a user by their internal ID (admin only)
4454
- * @param id -
4455
- */
4456
- async getUserById(id) {
4457
+ * Toggle invite gate
4458
+ * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
4459
+ When disabled (false), registration is open. Takes effect immediately.
4460
+
4461
+ * @param body - Request body
4462
+ */
4463
+ async adminSetGateStatus(body) {
4457
4464
  const request = new Request({
4458
4465
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4459
- method: "GET",
4460
- path: "/api/users/{id}",
4466
+ method: "POST",
4467
+ path: "/api/admin/gate",
4461
4468
  config: this.config,
4462
4469
  retry: {
4463
4470
  attempts: 3,
@@ -4467,16 +4474,9 @@ var UsersService = class extends BaseService {
4467
4474
  backoffFactor: 2
4468
4475
  }
4469
4476
  });
4470
- request.addPathParam("id", {
4471
- key: "id",
4472
- value: id,
4473
- explode: false,
4474
- encode: true,
4475
- style: "simple",
4476
- isLimit: false,
4477
- isOffset: false,
4478
- isCursor: false
4479
- });
4477
+ if (body !== void 0) {
4478
+ request.addBody(body);
4479
+ }
4480
4480
  return this.client.call(request);
4481
4481
  }
4482
4482
  };
@@ -5589,42 +5589,42 @@ var digestResponse = import_zod.z.lazy(() => import_zod.z.object({
5589
5589
  // src/index.ts
5590
5590
  var Memnexus = class {
5591
5591
  config;
5592
- /** Admin management endpoints for invite codes and platform configuration operations */
5593
- admin;
5594
- /** API key management endpoints operations */
5595
- apiKeys;
5596
- /** Artifact storage and retrieval endpoints operations */
5597
- artifacts;
5598
- /** Subscription billing and payment management endpoints operations */
5599
- billing;
5600
- /** Conversation tracking and analysis endpoints operations */
5601
- conversations;
5602
- /** Entity extraction and discovery endpoints operations */
5603
- entities;
5604
- /** Fact extraction and management endpoints operations */
5605
- facts;
5606
- /** Graph-based retrieval augmented generation endpoints operations */
5607
- graphrag;
5608
- /** Health check endpoints operations */
5609
- health;
5610
- /** Invite code validation and gate status endpoints operations */
5611
- invites;
5612
- /** Memory management and retrieval endpoints operations */
5613
- memories;
5614
- /** Observability and metrics endpoints for production monitoring operations */
5615
- monitoring;
5616
- /** Narrative thread management endpoints operations */
5617
- narratives;
5592
+ /** User management and profile endpoints operations */
5593
+ users;
5594
+ /** Topic detection, clustering, and management endpoints operations */
5595
+ topics;
5618
5596
  /** System health, monitoring, and configuration endpoints operations */
5619
5597
  system;
5620
5598
  /** Pattern detection and behavioral analysis endpoints operations */
5621
5599
  patterns;
5622
5600
  /** Behavioral pattern tracking and state management endpoints operations */
5623
5601
  behavior;
5624
- /** Topic detection, clustering, and management endpoints operations */
5625
- topics;
5626
- /** User management and profile endpoints operations */
5627
- users;
5602
+ /** Narrative thread management endpoints operations */
5603
+ narratives;
5604
+ /** Observability and metrics endpoints for production monitoring operations */
5605
+ monitoring;
5606
+ /** Memory management and retrieval endpoints operations */
5607
+ memories;
5608
+ /** Invite code validation and gate status endpoints operations */
5609
+ invites;
5610
+ /** Health check endpoints operations */
5611
+ health;
5612
+ /** Graph-based retrieval augmented generation endpoints operations */
5613
+ graphrag;
5614
+ /** Fact extraction and management endpoints operations */
5615
+ facts;
5616
+ /** Entity extraction and discovery endpoints operations */
5617
+ entities;
5618
+ /** Conversation tracking and analysis endpoints operations */
5619
+ conversations;
5620
+ /** Subscription billing and payment management endpoints operations */
5621
+ billing;
5622
+ /** Artifact storage and retrieval endpoints operations */
5623
+ artifacts;
5624
+ /** API key management endpoints operations */
5625
+ apiKeys;
5626
+ /** Admin management endpoints for invite codes and platform configuration operations */
5627
+ admin;
5628
5628
  /**
5629
5629
  * Create a new SDK client.
5630
5630
  * @param config - SDK configuration
@@ -5634,24 +5634,24 @@ var Memnexus = class {
5634
5634
  baseUrl: config.baseUrl || "http://localhost:3000",
5635
5635
  ...config
5636
5636
  };
5637
- this.admin = new AdminService(this.config);
5638
- this.apiKeys = new ApiKeysService(this.config);
5639
- this.artifacts = new ArtifactsService(this.config);
5640
- this.billing = new BillingService(this.config);
5641
- this.conversations = new ConversationsService(this.config);
5642
- this.entities = new EntitiesService(this.config);
5643
- this.facts = new FactsService(this.config);
5644
- this.graphrag = new GraphragService(this.config);
5645
- this.health = new HealthService(this.config);
5646
- this.invites = new InvitesService(this.config);
5647
- this.memories = new MemoriesService(this.config);
5648
- this.monitoring = new MonitoringService(this.config);
5649
- this.narratives = new NarrativesService(this.config);
5637
+ this.users = new UsersService(this.config);
5638
+ this.topics = new TopicsService(this.config);
5650
5639
  this.system = new SystemService(this.config);
5651
5640
  this.patterns = new PatternsService(this.config);
5652
5641
  this.behavior = new BehaviorService(this.config);
5653
- this.topics = new TopicsService(this.config);
5654
- this.users = new UsersService(this.config);
5642
+ this.narratives = new NarrativesService(this.config);
5643
+ this.monitoring = new MonitoringService(this.config);
5644
+ this.memories = new MemoriesService(this.config);
5645
+ this.invites = new InvitesService(this.config);
5646
+ this.health = new HealthService(this.config);
5647
+ this.graphrag = new GraphragService(this.config);
5648
+ this.facts = new FactsService(this.config);
5649
+ this.entities = new EntitiesService(this.config);
5650
+ this.conversations = new ConversationsService(this.config);
5651
+ this.billing = new BillingService(this.config);
5652
+ this.artifacts = new ArtifactsService(this.config);
5653
+ this.apiKeys = new ApiKeysService(this.config);
5654
+ this.admin = new AdminService(this.config);
5655
5655
  }
5656
5656
  /**
5657
5657
  * Set the API token for authentication.
@@ -5659,24 +5659,24 @@ var Memnexus = class {
5659
5659
  */
5660
5660
  setToken(token) {
5661
5661
  this.config.token = token;
5662
- this.admin.token = token;
5663
- this.apiKeys.token = token;
5664
- this.artifacts.token = token;
5665
- this.billing.token = token;
5666
- this.conversations.token = token;
5667
- this.entities.token = token;
5668
- this.facts.token = token;
5669
- this.graphrag.token = token;
5670
- this.health.token = token;
5671
- this.invites.token = token;
5672
- this.memories.token = token;
5673
- this.monitoring.token = token;
5674
- this.narratives.token = token;
5662
+ this.users.token = token;
5663
+ this.topics.token = token;
5675
5664
  this.system.token = token;
5676
5665
  this.patterns.token = token;
5677
5666
  this.behavior.token = token;
5678
- this.topics.token = token;
5679
- this.users.token = token;
5667
+ this.narratives.token = token;
5668
+ this.monitoring.token = token;
5669
+ this.memories.token = token;
5670
+ this.invites.token = token;
5671
+ this.health.token = token;
5672
+ this.graphrag.token = token;
5673
+ this.facts.token = token;
5674
+ this.entities.token = token;
5675
+ this.conversations.token = token;
5676
+ this.billing.token = token;
5677
+ this.artifacts.token = token;
5678
+ this.apiKeys.token = token;
5679
+ this.admin.token = token;
5680
5680
  }
5681
5681
  /**
5682
5682
  * Set the base URL for API requests.
@@ -5684,24 +5684,24 @@ var Memnexus = class {
5684
5684
  */
5685
5685
  setBaseUrl(baseUrl) {
5686
5686
  this.config.baseUrl = baseUrl;
5687
- this.admin.baseUrl = baseUrl;
5688
- this.apiKeys.baseUrl = baseUrl;
5689
- this.artifacts.baseUrl = baseUrl;
5690
- this.billing.baseUrl = baseUrl;
5691
- this.conversations.baseUrl = baseUrl;
5692
- this.entities.baseUrl = baseUrl;
5693
- this.facts.baseUrl = baseUrl;
5694
- this.graphrag.baseUrl = baseUrl;
5695
- this.health.baseUrl = baseUrl;
5696
- this.invites.baseUrl = baseUrl;
5697
- this.memories.baseUrl = baseUrl;
5698
- this.monitoring.baseUrl = baseUrl;
5699
- this.narratives.baseUrl = baseUrl;
5687
+ this.users.baseUrl = baseUrl;
5688
+ this.topics.baseUrl = baseUrl;
5700
5689
  this.system.baseUrl = baseUrl;
5701
5690
  this.patterns.baseUrl = baseUrl;
5702
5691
  this.behavior.baseUrl = baseUrl;
5703
- this.topics.baseUrl = baseUrl;
5704
- this.users.baseUrl = baseUrl;
5692
+ this.narratives.baseUrl = baseUrl;
5693
+ this.monitoring.baseUrl = baseUrl;
5694
+ this.memories.baseUrl = baseUrl;
5695
+ this.invites.baseUrl = baseUrl;
5696
+ this.health.baseUrl = baseUrl;
5697
+ this.graphrag.baseUrl = baseUrl;
5698
+ this.facts.baseUrl = baseUrl;
5699
+ this.entities.baseUrl = baseUrl;
5700
+ this.conversations.baseUrl = baseUrl;
5701
+ this.billing.baseUrl = baseUrl;
5702
+ this.artifacts.baseUrl = baseUrl;
5703
+ this.apiKeys.baseUrl = baseUrl;
5704
+ this.admin.baseUrl = baseUrl;
5705
5705
  }
5706
5706
  /**
5707
5707
  * Set the environment.
@@ -5709,24 +5709,24 @@ var Memnexus = class {
5709
5709
  */
5710
5710
  setEnvironment(environment) {
5711
5711
  this.config.environment = environment;
5712
- this.admin.environment = environment;
5713
- this.apiKeys.environment = environment;
5714
- this.artifacts.environment = environment;
5715
- this.billing.environment = environment;
5716
- this.conversations.environment = environment;
5717
- this.entities.environment = environment;
5718
- this.facts.environment = environment;
5719
- this.graphrag.environment = environment;
5720
- this.health.environment = environment;
5721
- this.invites.environment = environment;
5722
- this.memories.environment = environment;
5723
- this.monitoring.environment = environment;
5724
- this.narratives.environment = environment;
5712
+ this.users.environment = environment;
5713
+ this.topics.environment = environment;
5725
5714
  this.system.environment = environment;
5726
5715
  this.patterns.environment = environment;
5727
5716
  this.behavior.environment = environment;
5728
- this.topics.environment = environment;
5729
- this.users.environment = environment;
5717
+ this.narratives.environment = environment;
5718
+ this.monitoring.environment = environment;
5719
+ this.memories.environment = environment;
5720
+ this.invites.environment = environment;
5721
+ this.health.environment = environment;
5722
+ this.graphrag.environment = environment;
5723
+ this.facts.environment = environment;
5724
+ this.entities.environment = environment;
5725
+ this.conversations.environment = environment;
5726
+ this.billing.environment = environment;
5727
+ this.artifacts.environment = environment;
5728
+ this.apiKeys.environment = environment;
5729
+ this.admin.environment = environment;
5730
5730
  }
5731
5731
  };
5732
5732
  var index_default = Memnexus;