@memnexus-ai/typescript-sdk 1.53.28 → 1.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,44 @@
1
+ // src/http/http-types.ts
2
+ var SerializationStyle = /* @__PURE__ */ ((SerializationStyle2) => {
3
+ SerializationStyle2["SIMPLE"] = "simple";
4
+ SerializationStyle2["LABEL"] = "label";
5
+ SerializationStyle2["MATRIX"] = "matrix";
6
+ SerializationStyle2["FORM"] = "form";
7
+ SerializationStyle2["SPACE_DELIMITED"] = "space_delimited";
8
+ SerializationStyle2["PIPE_DELIMITED"] = "pipe_delimited";
9
+ SerializationStyle2["DEEP_OBJECT"] = "deep_object";
10
+ SerializationStyle2["NONE"] = "none";
11
+ return SerializationStyle2;
12
+ })(SerializationStyle || {});
13
+ var ContentType = /* @__PURE__ */ ((ContentType2) => {
14
+ ContentType2["Json"] = "json";
15
+ ContentType2["Xml"] = "xml";
16
+ ContentType2["Pdf"] = "pdf";
17
+ ContentType2["Image"] = "image";
18
+ ContentType2["File"] = "file";
19
+ ContentType2["Binary"] = "binary";
20
+ ContentType2["FormUrlEncoded"] = "form";
21
+ ContentType2["Text"] = "text";
22
+ ContentType2["MultipartFormData"] = "multipartFormData";
23
+ ContentType2["EventStream"] = "eventStream";
24
+ ContentType2["NoContent"] = "noContent";
25
+ return ContentType2;
26
+ })(ContentType || {});
27
+ var Environment = /* @__PURE__ */ ((Environment2) => {
28
+ Environment2["DEFAULT"] = "http://localhost:3000";
29
+ return Environment2;
30
+ })(Environment || {});
31
+ var SdkError = class _SdkError extends Error {
32
+ constructor(status, statusText, data, message) {
33
+ super(message);
34
+ this.status = status;
35
+ this.statusText = statusText;
36
+ this.data = data;
37
+ this.name = "SdkError";
38
+ Object.setPrototypeOf(this, _SdkError.prototype);
39
+ }
40
+ };
41
+
1
42
  // src/http/handlers.ts
2
43
  var BaseHandler = class {
3
44
  nextHandler;
@@ -158,9 +199,7 @@ var ExecuteHandler = class extends BaseHandler {
158
199
  raw
159
200
  };
160
201
  if (!response.ok) {
161
- const error2 = new Error(`HTTP ${response.status}: ${response.statusText}`);
162
- error2.response = httpResponse;
163
- throw error2;
202
+ throw new SdkError(response.status, response.statusText, data, `HTTP ${response.status}: ${response.statusText}`);
164
203
  }
165
204
  return httpResponse;
166
205
  } finally {
@@ -432,23 +471,77 @@ function serializeQueryParam(key, param) {
432
471
  return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;
433
472
  }
434
473
 
435
- // src/services/users-service.ts
436
- var UsersService = class extends BaseService {
474
+ // src/services/admin-service.ts
475
+ var AdminService = class extends BaseService {
437
476
  /**
438
- * Sync user from WorkOS
439
- * Called by the customer portal after WorkOS authentication.
440
- Creates a new user if they don't exist, or updates their profile if they do.
441
- This is the main entry point for user provisioning.
442
- When the invite gate is closed and a new user is created, the inviteCode
443
- is redeemed atomically to track which code was used for registration.
444
-
445
- * @param body - Request body
446
- */
447
- async syncUser(body) {
477
+ * List invite codes
478
+ * List all invite codes with optional status filter
479
+ * @param status - Filter by status
480
+ * @param limit -
481
+ * @param offset -
482
+ */
483
+ async adminListInviteCodes(options) {
484
+ const request = new Request({
485
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
486
+ method: "GET",
487
+ path: "/api/admin/invites",
488
+ config: this.config,
489
+ retry: {
490
+ attempts: 3,
491
+ delayMs: 150,
492
+ maxDelayMs: 5e3,
493
+ jitterMs: 50,
494
+ backoffFactor: 2
495
+ }
496
+ });
497
+ if (options?.status !== void 0) {
498
+ request.addQueryParam("status", {
499
+ key: "status",
500
+ value: options.status,
501
+ explode: false,
502
+ encode: true,
503
+ style: "form",
504
+ isLimit: false,
505
+ isOffset: false,
506
+ isCursor: false
507
+ });
508
+ }
509
+ if (options?.limit !== void 0) {
510
+ request.addQueryParam("limit", {
511
+ key: "limit",
512
+ value: options.limit,
513
+ explode: false,
514
+ encode: true,
515
+ style: "form",
516
+ isLimit: true,
517
+ isOffset: false,
518
+ isCursor: false
519
+ });
520
+ }
521
+ if (options?.offset !== void 0) {
522
+ request.addQueryParam("offset", {
523
+ key: "offset",
524
+ value: options.offset,
525
+ explode: false,
526
+ encode: true,
527
+ style: "form",
528
+ isLimit: false,
529
+ isOffset: true,
530
+ isCursor: false
531
+ });
532
+ }
533
+ return this.client.call(request);
534
+ }
535
+ /**
536
+ * Create invite code
537
+ * Create a new invite code for the gated preview
538
+ * @param body - Request body
539
+ */
540
+ async adminCreateInviteCode(body) {
448
541
  const request = new Request({
449
542
  baseUrl: this.config.baseUrl || "http://localhost:3000",
450
543
  method: "POST",
451
- path: "/api/users/sync",
544
+ path: "/api/admin/invites",
452
545
  config: this.config,
453
546
  retry: {
454
547
  attempts: 3,
@@ -464,14 +557,14 @@ var UsersService = class extends BaseService {
464
557
  return this.client.call(request);
465
558
  }
466
559
  /**
467
- * Get current user
468
- * Get the currently authenticated user's profile and usage information
560
+ * Get invite system statistics
561
+ * Aggregate statistics for the invite system
469
562
  */
470
- async getCurrentUser() {
563
+ async adminGetInviteStats() {
471
564
  const request = new Request({
472
565
  baseUrl: this.config.baseUrl || "http://localhost:3000",
473
566
  method: "GET",
474
- path: "/api/users/me",
567
+ path: "/api/admin/invites/stats",
475
568
  config: this.config,
476
569
  retry: {
477
570
  attempts: 3,
@@ -484,15 +577,15 @@ var UsersService = class extends BaseService {
484
577
  return this.client.call(request);
485
578
  }
486
579
  /**
487
- * Update current user
488
- * Update the currently authenticated user's profile
489
- * @param body - Request body
580
+ * Get invite code details
581
+ * Get details for a single invite code including redemptions
582
+ * @param code - The invite code
490
583
  */
491
- async updateCurrentUser(options) {
584
+ async adminGetInviteCode(code) {
492
585
  const request = new Request({
493
586
  baseUrl: this.config.baseUrl || "http://localhost:3000",
494
- method: "PATCH",
495
- path: "/api/users/me",
587
+ method: "GET",
588
+ path: "/api/admin/invites/{code}",
496
589
  config: this.config,
497
590
  retry: {
498
591
  attempts: 3,
@@ -502,20 +595,28 @@ var UsersService = class extends BaseService {
502
595
  backoffFactor: 2
503
596
  }
504
597
  });
505
- if (options?.body !== void 0) {
506
- request.addBody(options?.body);
507
- }
598
+ request.addPathParam("code", {
599
+ key: "code",
600
+ value: code,
601
+ explode: false,
602
+ encode: true,
603
+ style: "simple",
604
+ isLimit: false,
605
+ isOffset: false,
606
+ isCursor: false
607
+ });
508
608
  return this.client.call(request);
509
609
  }
510
610
  /**
511
- * Get current user's usage
512
- * Get the currently authenticated user's memory usage statistics
611
+ * Revoke an invite code
612
+ * Revoke an invite code. Existing accounts created with this code are unaffected.
613
+ * @param code -
513
614
  */
514
- async getCurrentUserUsage() {
615
+ async adminRevokeInviteCode(code) {
515
616
  const request = new Request({
516
617
  baseUrl: this.config.baseUrl || "http://localhost:3000",
517
- method: "GET",
518
- path: "/api/users/me/usage",
618
+ method: "DELETE",
619
+ path: "/api/admin/invites/{code}",
519
620
  config: this.config,
520
621
  retry: {
521
622
  attempts: 3,
@@ -525,21 +626,27 @@ var UsersService = class extends BaseService {
525
626
  backoffFactor: 2
526
627
  }
527
628
  });
629
+ request.addPathParam("code", {
630
+ key: "code",
631
+ value: code,
632
+ explode: false,
633
+ encode: true,
634
+ style: "simple",
635
+ isLimit: false,
636
+ isOffset: false,
637
+ isCursor: false
638
+ });
528
639
  return this.client.call(request);
529
640
  }
530
641
  /**
531
- * Export all user data
532
- * Export all user data as a JSON archive. Includes profile, memories,
533
- conversations, facts, and patterns. Supports GDPR Article 20
534
- (right to data portability). Sensitive fields (Stripe customer ID,
535
- WorkOS ID, embeddings) are excluded.
536
-
537
- */
538
- async exportUserData() {
642
+ * Get gate status with audit info
643
+ * Get current invite gate state with audit information
644
+ */
645
+ async adminGetGateStatus() {
539
646
  const request = new Request({
540
647
  baseUrl: this.config.baseUrl || "http://localhost:3000",
541
648
  method: "GET",
542
- path: "/api/users/me/export",
649
+ path: "/api/admin/gate",
543
650
  config: this.config,
544
651
  retry: {
545
652
  attempts: 3,
@@ -552,18 +659,17 @@ var UsersService = class extends BaseService {
552
659
  return this.client.call(request);
553
660
  }
554
661
  /**
555
- * Initiate account deletion
556
- * Schedule the current user's account for deletion after a 7-day grace period.
557
- Requires email confirmation. Immediately revokes API keys and cancels
558
- any active subscription. The account enters read-only mode.
662
+ * Toggle invite gate
663
+ * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
664
+ When disabled (false), registration is open. Takes effect immediately.
559
665
 
560
666
  * @param body - Request body
561
667
  */
562
- async initiateAccountDeletion(body) {
668
+ async adminSetGateStatus(body) {
563
669
  const request = new Request({
564
670
  baseUrl: this.config.baseUrl || "http://localhost:3000",
565
671
  method: "POST",
566
- path: "/api/users/me/deletion",
672
+ path: "/api/admin/gate",
567
673
  config: this.config,
568
674
  retry: {
569
675
  attempts: 3,
@@ -578,18 +684,19 @@ var UsersService = class extends BaseService {
578
684
  }
579
685
  return this.client.call(request);
580
686
  }
687
+ };
688
+
689
+ // src/services/api-keys-service.ts
690
+ var ApiKeysService = class extends BaseService {
581
691
  /**
582
- * Cancel account deletion
583
- * Cancel a pending account deletion during the grace period.
584
- Note: Previously revoked API keys are not restored — new keys must be created.
585
- Stripe subscription may need manual reactivation via the billing portal.
586
-
587
- */
588
- async cancelAccountDeletion() {
692
+ * Get user information for current API key
693
+ * Debug endpoint to retrieve user ID and authentication method from the current API key
694
+ */
695
+ async debugUser() {
589
696
  const request = new Request({
590
697
  baseUrl: this.config.baseUrl || "http://localhost:3000",
591
- method: "DELETE",
592
- path: "/api/users/me/deletion",
698
+ method: "GET",
699
+ path: "/api/apikeys/debug-user",
593
700
  config: this.config,
594
701
  retry: {
595
702
  attempts: 3,
@@ -602,15 +709,14 @@ var UsersService = class extends BaseService {
602
709
  return this.client.call(request);
603
710
  }
604
711
  /**
605
- * Get user by ID
606
- * Get a user by their internal ID (admin only)
607
- * @param id -
712
+ * List API keys
713
+ * List all API keys for the authenticated user
608
714
  */
609
- async getUserById(id) {
715
+ async listApiKeys() {
610
716
  const request = new Request({
611
717
  baseUrl: this.config.baseUrl || "http://localhost:3000",
612
718
  method: "GET",
613
- path: "/api/users/{id}",
719
+ path: "/api/apikeys",
614
720
  config: this.config,
615
721
  retry: {
616
722
  attempts: 3,
@@ -620,35 +726,18 @@ var UsersService = class extends BaseService {
620
726
  backoffFactor: 2
621
727
  }
622
728
  });
623
- request.addPathParam("id", {
624
- key: "id",
625
- value: id,
626
- explode: false,
627
- encode: true,
628
- style: "simple",
629
- isLimit: false,
630
- isOffset: false,
631
- isCursor: false
632
- });
633
729
  return this.client.call(request);
634
730
  }
635
- };
636
-
637
- // src/services/topics-service.ts
638
- var TopicsService = class extends BaseService {
639
731
  /**
640
- * List topics
641
- * List all topics with pagination
642
- * @param limit - Maximum number of topics to return
643
- * @param offset - Number of topics to skip
644
- * @param sortBy - Field to sort topics by
645
- * @param order - Sort order
732
+ * Create API key
733
+ * Create a new API key for the authenticated user
734
+ * @param body - Request body
646
735
  */
647
- async listTopics(options) {
736
+ async createApiKey(options) {
648
737
  const request = new Request({
649
738
  baseUrl: this.config.baseUrl || "http://localhost:3000",
650
- method: "GET",
651
- path: "/api/topics",
739
+ method: "POST",
740
+ path: "/api/apikeys",
652
741
  config: this.config,
653
742
  retry: {
654
743
  attempts: 3,
@@ -658,13 +747,76 @@ var TopicsService = class extends BaseService {
658
747
  backoffFactor: 2
659
748
  }
660
749
  });
661
- if (options?.limit !== void 0) {
662
- request.addQueryParam("limit", {
663
- key: "limit",
664
- value: options.limit,
665
- explode: false,
666
- encode: true,
667
- style: "form",
750
+ if (options?.body !== void 0) {
751
+ request.addBody(options?.body);
752
+ }
753
+ return this.client.call(request);
754
+ }
755
+ /**
756
+ * Delete API key
757
+ * Delete (revoke) an API key by its ID
758
+ * @param id - The API key ID
759
+ */
760
+ async deleteApiKey(id) {
761
+ const request = new Request({
762
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
763
+ method: "DELETE",
764
+ path: "/api/apikeys/{id}",
765
+ config: this.config,
766
+ retry: {
767
+ attempts: 3,
768
+ delayMs: 150,
769
+ maxDelayMs: 5e3,
770
+ jitterMs: 50,
771
+ backoffFactor: 2
772
+ }
773
+ });
774
+ request.addPathParam("id", {
775
+ key: "id",
776
+ value: id,
777
+ explode: false,
778
+ encode: true,
779
+ style: "simple",
780
+ isLimit: false,
781
+ isOffset: false,
782
+ isCursor: false
783
+ });
784
+ return this.client.call(request);
785
+ }
786
+ };
787
+
788
+ // src/services/artifacts-service.ts
789
+ var ArtifactsService = class extends BaseService {
790
+ /**
791
+ * List artifacts
792
+ * List all artifacts for the authenticated user with optional filters
793
+ * @param limit - Maximum number of artifacts to return
794
+ * @param offset - Number of artifacts to skip
795
+ * @param memoryId - Filter by memory ID
796
+ * @param conversationId - Filter by conversation ID
797
+ * @param type - Filter by artifact type
798
+ */
799
+ async listArtifacts(options) {
800
+ const request = new Request({
801
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
802
+ method: "GET",
803
+ path: "/api/artifacts",
804
+ config: this.config,
805
+ retry: {
806
+ attempts: 3,
807
+ delayMs: 150,
808
+ maxDelayMs: 5e3,
809
+ jitterMs: 50,
810
+ backoffFactor: 2
811
+ }
812
+ });
813
+ if (options?.limit !== void 0) {
814
+ request.addQueryParam("limit", {
815
+ key: "limit",
816
+ value: options.limit,
817
+ explode: false,
818
+ encode: true,
819
+ style: "form",
668
820
  isLimit: true,
669
821
  isOffset: false,
670
822
  isCursor: false
@@ -682,10 +834,10 @@ var TopicsService = class extends BaseService {
682
834
  isCursor: false
683
835
  });
684
836
  }
685
- if (options?.sortBy !== void 0) {
686
- request.addQueryParam("sortBy", {
687
- key: "sortBy",
688
- value: options.sortBy,
837
+ if (options?.memoryId !== void 0) {
838
+ request.addQueryParam("memoryId", {
839
+ key: "memoryId",
840
+ value: options.memoryId,
689
841
  explode: false,
690
842
  encode: true,
691
843
  style: "form",
@@ -694,10 +846,22 @@ var TopicsService = class extends BaseService {
694
846
  isCursor: false
695
847
  });
696
848
  }
697
- if (options?.order !== void 0) {
698
- request.addQueryParam("order", {
699
- key: "order",
700
- value: options.order,
849
+ if (options?.conversationId !== void 0) {
850
+ request.addQueryParam("conversationId", {
851
+ key: "conversationId",
852
+ value: options.conversationId,
853
+ explode: false,
854
+ encode: true,
855
+ style: "form",
856
+ isLimit: false,
857
+ isOffset: false,
858
+ isCursor: false
859
+ });
860
+ }
861
+ if (options?.type !== void 0) {
862
+ request.addQueryParam("type", {
863
+ key: "type",
864
+ value: options.type,
701
865
  explode: false,
702
866
  encode: true,
703
867
  style: "form",
@@ -709,15 +873,39 @@ var TopicsService = class extends BaseService {
709
873
  return this.client.call(request);
710
874
  }
711
875
  /**
712
- * Get topic by ID
713
- * Retrieve a specific topic by its ID
714
- * @param id - The topic ID
876
+ * Create artifact
877
+ * Create a new artifact for the authenticated user
878
+ * @param body - Request body
715
879
  */
716
- async getTopicById(id) {
880
+ async createArtifact(body) {
881
+ const request = new Request({
882
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
883
+ method: "POST",
884
+ path: "/api/artifacts",
885
+ config: this.config,
886
+ retry: {
887
+ attempts: 3,
888
+ delayMs: 150,
889
+ maxDelayMs: 5e3,
890
+ jitterMs: 50,
891
+ backoffFactor: 2
892
+ }
893
+ });
894
+ if (body !== void 0) {
895
+ request.addBody(body);
896
+ }
897
+ return this.client.call(request);
898
+ }
899
+ /**
900
+ * Get artifact by ID
901
+ * Retrieve a specific artifact by its ID
902
+ * @param id - The artifact ID
903
+ */
904
+ async getArtifactById(id) {
717
905
  const request = new Request({
718
906
  baseUrl: this.config.baseUrl || "http://localhost:3000",
719
907
  method: "GET",
720
- path: "/api/topics/{id}",
908
+ path: "/api/artifacts/{id}",
721
909
  config: this.config,
722
910
  retry: {
723
911
  attempts: 3,
@@ -740,15 +928,15 @@ var TopicsService = class extends BaseService {
740
928
  return this.client.call(request);
741
929
  }
742
930
  /**
743
- * Merge topics
744
- * Merge two topics into one
745
- * @param body - Request body
931
+ * Delete artifact
932
+ * Delete an artifact by its ID
933
+ * @param id - The artifact ID
746
934
  */
747
- async mergeTopics(body) {
935
+ async deleteArtifact(id) {
748
936
  const request = new Request({
749
937
  baseUrl: this.config.baseUrl || "http://localhost:3000",
750
- method: "POST",
751
- path: "/api/topics/merge",
938
+ method: "DELETE",
939
+ path: "/api/artifacts/{id}",
752
940
  config: this.config,
753
941
  retry: {
754
942
  attempts: 3,
@@ -758,21 +946,29 @@ var TopicsService = class extends BaseService {
758
946
  backoffFactor: 2
759
947
  }
760
948
  });
761
- if (body !== void 0) {
762
- request.addBody(body);
763
- }
949
+ request.addPathParam("id", {
950
+ key: "id",
951
+ value: id,
952
+ explode: false,
953
+ encode: true,
954
+ style: "simple",
955
+ isLimit: false,
956
+ isOffset: false,
957
+ isCursor: false
958
+ });
764
959
  return this.client.call(request);
765
960
  }
766
961
  /**
767
- * Discover related topics
768
- * Discover topics related to a given topic
962
+ * Update artifact
963
+ * Update an existing artifact with partial data
964
+ * @param id - The artifact ID
769
965
  * @param body - Request body
770
966
  */
771
- async discoverRelatedTopics(body) {
967
+ async updateArtifact(id, body) {
772
968
  const request = new Request({
773
969
  baseUrl: this.config.baseUrl || "http://localhost:3000",
774
- method: "POST",
775
- path: "/api/topics/discover-related",
970
+ method: "PATCH",
971
+ path: "/api/artifacts/{id}",
776
972
  config: this.config,
777
973
  retry: {
778
974
  attempts: 3,
@@ -782,21 +978,55 @@ var TopicsService = class extends BaseService {
782
978
  backoffFactor: 2
783
979
  }
784
980
  });
981
+ request.addPathParam("id", {
982
+ key: "id",
983
+ value: id,
984
+ explode: false,
985
+ encode: true,
986
+ style: "simple",
987
+ isLimit: false,
988
+ isOffset: false,
989
+ isCursor: false
990
+ });
785
991
  if (body !== void 0) {
786
992
  request.addBody(body);
787
993
  }
788
994
  return this.client.call(request);
789
995
  }
996
+ };
997
+
998
+ // src/services/billing-service.ts
999
+ var BillingService = class extends BaseService {
790
1000
  /**
791
- * Calculate topic similarity
792
- * Calculate similarity score between two topics
1001
+ * Get billing overview
1002
+ * Get subscription, payment method, and upcoming invoice information
1003
+ */
1004
+ async getBillingOverview() {
1005
+ const request = new Request({
1006
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1007
+ method: "GET",
1008
+ path: "/api/billing/overview",
1009
+ config: this.config,
1010
+ retry: {
1011
+ attempts: 3,
1012
+ delayMs: 150,
1013
+ maxDelayMs: 5e3,
1014
+ jitterMs: 50,
1015
+ backoffFactor: 2
1016
+ }
1017
+ });
1018
+ return this.client.call(request);
1019
+ }
1020
+ /**
1021
+ * Create checkout session
1022
+ * Create a Stripe checkout session for subscription upgrade
793
1023
  * @param body - Request body
794
1024
  */
795
- async calculateTopicSimilarity(body) {
1025
+ async createCheckoutSession(body) {
796
1026
  const request = new Request({
797
1027
  baseUrl: this.config.baseUrl || "http://localhost:3000",
798
1028
  method: "POST",
799
- path: "/api/topics/similarity",
1029
+ path: "/api/billing/checkout",
800
1030
  config: this.config,
801
1031
  retry: {
802
1032
  attempts: 3,
@@ -812,15 +1042,15 @@ var TopicsService = class extends BaseService {
812
1042
  return this.client.call(request);
813
1043
  }
814
1044
  /**
815
- * Find similar topics
816
- * Find topics similar to a given topic
1045
+ * Create billing portal session
1046
+ * Create a Stripe billing portal session for managing subscription
817
1047
  * @param body - Request body
818
1048
  */
819
- async findSimilarTopics(body) {
1049
+ async createPortalSession(body) {
820
1050
  const request = new Request({
821
1051
  baseUrl: this.config.baseUrl || "http://localhost:3000",
822
1052
  method: "POST",
823
- path: "/api/topics/similar",
1053
+ path: "/api/billing/portal",
824
1054
  config: this.config,
825
1055
  retry: {
826
1056
  attempts: 3,
@@ -836,15 +1066,14 @@ var TopicsService = class extends BaseService {
836
1066
  return this.client.call(request);
837
1067
  }
838
1068
  /**
839
- * Cluster topics
840
- * Cluster topics using community detection algorithms
841
- * @param body - Request body
1069
+ * Get current subscription
1070
+ * Get the current subscription details for the authenticated user
842
1071
  */
843
- async clusterTopics(options) {
1072
+ async getSubscription() {
844
1073
  const request = new Request({
845
1074
  baseUrl: this.config.baseUrl || "http://localhost:3000",
846
- method: "POST",
847
- path: "/api/topics/cluster",
1075
+ method: "GET",
1076
+ path: "/api/billing/subscription",
848
1077
  config: this.config,
849
1078
  retry: {
850
1079
  attempts: 3,
@@ -854,21 +1083,18 @@ var TopicsService = class extends BaseService {
854
1083
  backoffFactor: 2
855
1084
  }
856
1085
  });
857
- if (options?.body !== void 0) {
858
- request.addBody(options?.body);
859
- }
860
1086
  return this.client.call(request);
861
1087
  }
862
1088
  /**
863
- * Detect communities
864
- * Detect communities in the topic graph using specified algorithm
1089
+ * Cancel subscription
1090
+ * Cancel the current subscription at the end of the billing period
865
1091
  * @param body - Request body
866
1092
  */
867
- async detectCommunities(options) {
1093
+ async cancelSubscription(options) {
868
1094
  const request = new Request({
869
1095
  baseUrl: this.config.baseUrl || "http://localhost:3000",
870
1096
  method: "POST",
871
- path: "/api/topics/detect-communities",
1097
+ path: "/api/billing/subscription/cancel",
872
1098
  config: this.config,
873
1099
  retry: {
874
1100
  attempts: 3,
@@ -884,15 +1110,15 @@ var TopicsService = class extends BaseService {
884
1110
  return this.client.call(request);
885
1111
  }
886
1112
  /**
887
- * Search topics
888
- * Search topics by query string using fulltext search
1113
+ * Reactivate subscription
1114
+ * Reactivate a subscription that was scheduled for cancellation
889
1115
  * @param body - Request body
890
1116
  */
891
- async searchTopics(body) {
1117
+ async reactivateSubscription(options) {
892
1118
  const request = new Request({
893
1119
  baseUrl: this.config.baseUrl || "http://localhost:3000",
894
1120
  method: "POST",
895
- path: "/api/topics/search",
1121
+ path: "/api/billing/subscription/reactivate",
896
1122
  config: this.config,
897
1123
  retry: {
898
1124
  attempts: 3,
@@ -902,44 +1128,21 @@ var TopicsService = class extends BaseService {
902
1128
  backoffFactor: 2
903
1129
  }
904
1130
  });
905
- if (body !== void 0) {
906
- request.addBody(body);
1131
+ if (options?.body !== void 0) {
1132
+ request.addBody(options?.body);
907
1133
  }
908
1134
  return this.client.call(request);
909
1135
  }
910
- };
911
-
912
- // src/services/system-service.ts
913
- var SystemService = class extends BaseService {
914
1136
  /**
915
- * Get system health status
916
- * Get the current health status of the system including database connectivity
917
- */
918
- async getSystemHealth() {
919
- const request = new Request({
920
- baseUrl: this.config.baseUrl || "http://localhost:3000",
921
- method: "GET",
922
- path: "/api/system/health",
923
- config: this.config,
924
- retry: {
925
- attempts: 3,
926
- delayMs: 150,
927
- maxDelayMs: 5e3,
928
- jitterMs: 50,
929
- backoffFactor: 2
930
- }
931
- });
932
- return this.client.call(request);
933
- }
934
- /**
935
- * Get context status
936
- * Get database statistics and context information
1137
+ * List invoices
1138
+ * Get a list of invoices for the authenticated user
1139
+ * @param limit - Maximum number of invoices to return
937
1140
  */
938
- async getContextStatus() {
1141
+ async listInvoices(options) {
939
1142
  const request = new Request({
940
1143
  baseUrl: this.config.baseUrl || "http://localhost:3000",
941
1144
  method: "GET",
942
- path: "/api/system/context/status",
1145
+ path: "/api/billing/invoices",
943
1146
  config: this.config,
944
1147
  retry: {
945
1148
  attempts: 3,
@@ -949,17 +1152,29 @@ var SystemService = class extends BaseService {
949
1152
  backoffFactor: 2
950
1153
  }
951
1154
  });
1155
+ if (options?.limit !== void 0) {
1156
+ request.addQueryParam("limit", {
1157
+ key: "limit",
1158
+ value: options.limit,
1159
+ explode: false,
1160
+ encode: true,
1161
+ style: "form",
1162
+ isLimit: true,
1163
+ isOffset: false,
1164
+ isCursor: false
1165
+ });
1166
+ }
952
1167
  return this.client.call(request);
953
1168
  }
954
1169
  /**
955
- * Get feature flags
956
- * Get all feature flags for the authenticated user
1170
+ * List payment methods
1171
+ * Get a list of payment methods for the authenticated user
957
1172
  */
958
- async getFeatureFlags() {
1173
+ async listPaymentMethods() {
959
1174
  const request = new Request({
960
1175
  baseUrl: this.config.baseUrl || "http://localhost:3000",
961
1176
  method: "GET",
962
- path: "/api/system/feature-flags",
1177
+ path: "/api/billing/payment-methods",
963
1178
  config: this.config,
964
1179
  retry: {
965
1180
  attempts: 3,
@@ -972,15 +1187,16 @@ var SystemService = class extends BaseService {
972
1187
  return this.client.call(request);
973
1188
  }
974
1189
  /**
975
- * Evaluate feature flag
976
- * Evaluate a specific feature flag for the authenticated user
1190
+ * Set default payment method
1191
+ * Set a payment method as the default for future payments
1192
+ * @param id - The payment method ID
977
1193
  * @param body - Request body
978
1194
  */
979
- async evaluateFeatureFlag(body) {
1195
+ async setDefaultPaymentMethod(id, options) {
980
1196
  const request = new Request({
981
1197
  baseUrl: this.config.baseUrl || "http://localhost:3000",
982
1198
  method: "POST",
983
- path: "/api/system/feature-flags/evaluate",
1199
+ path: "/api/billing/payment-methods/{id}/default",
984
1200
  config: this.config,
985
1201
  retry: {
986
1202
  attempts: 3,
@@ -990,22 +1206,31 @@ var SystemService = class extends BaseService {
990
1206
  backoffFactor: 2
991
1207
  }
992
1208
  });
993
- if (body !== void 0) {
994
- request.addBody(body);
1209
+ request.addPathParam("id", {
1210
+ key: "id",
1211
+ value: id,
1212
+ explode: false,
1213
+ encode: true,
1214
+ style: "simple",
1215
+ isLimit: false,
1216
+ isOffset: false,
1217
+ isCursor: false
1218
+ });
1219
+ if (options?.body !== void 0) {
1220
+ request.addBody(options?.body);
995
1221
  }
996
1222
  return this.client.call(request);
997
1223
  }
998
1224
  /**
999
- * Analyze memory quality distribution
1000
- * Analyze the quality distribution of memories for the authenticated user
1001
- * @param includeDetails - Include detailed pruning candidate information
1002
- * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
1225
+ * Delete payment method
1226
+ * Remove a payment method from the account
1227
+ * @param id - The payment method ID
1003
1228
  */
1004
- async analyzeMemoryQuality(options) {
1229
+ async deletePaymentMethod(id) {
1005
1230
  const request = new Request({
1006
1231
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1007
- method: "GET",
1008
- path: "/api/system/memory/quality",
1232
+ method: "DELETE",
1233
+ path: "/api/billing/payment-methods/{id}",
1009
1234
  config: this.config,
1010
1235
  retry: {
1011
1236
  attempts: 3,
@@ -1015,66 +1240,28 @@ var SystemService = class extends BaseService {
1015
1240
  backoffFactor: 2
1016
1241
  }
1017
1242
  });
1018
- if (options?.includeDetails !== void 0) {
1019
- request.addQueryParam("includeDetails", {
1020
- key: "includeDetails",
1021
- value: options.includeDetails,
1022
- explode: false,
1023
- encode: true,
1024
- style: "form",
1025
- isLimit: false,
1026
- isOffset: false,
1027
- isCursor: false
1028
- });
1029
- }
1030
- if (options?.minQualityThreshold !== void 0) {
1031
- request.addQueryParam("minQualityThreshold", {
1032
- key: "minQualityThreshold",
1033
- value: options.minQualityThreshold,
1034
- explode: false,
1035
- encode: true,
1036
- style: "form",
1037
- isLimit: false,
1038
- isOffset: false,
1039
- isCursor: false
1040
- });
1041
- }
1243
+ request.addPathParam("id", {
1244
+ key: "id",
1245
+ value: id,
1246
+ explode: false,
1247
+ encode: true,
1248
+ style: "simple",
1249
+ isLimit: false,
1250
+ isOffset: false,
1251
+ isCursor: false
1252
+ });
1042
1253
  return this.client.call(request);
1043
1254
  }
1044
1255
  /**
1045
- * Prune low-quality memories
1046
- * Prune (soft delete) low-quality memories for the authenticated user
1256
+ * Stripe webhook endpoint
1257
+ * Receive and process Stripe webhook events
1047
1258
  * @param body - Request body
1048
1259
  */
1049
- async pruneMemories(options) {
1260
+ async stripeWebhook(body) {
1050
1261
  const request = new Request({
1051
1262
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1052
1263
  method: "POST",
1053
- path: "/api/system/memory/prune",
1054
- config: this.config,
1055
- retry: {
1056
- attempts: 3,
1057
- delayMs: 150,
1058
- maxDelayMs: 5e3,
1059
- jitterMs: 50,
1060
- backoffFactor: 2
1061
- }
1062
- });
1063
- if (options?.body !== void 0) {
1064
- request.addBody(options?.body);
1065
- }
1066
- return this.client.call(request);
1067
- }
1068
- /**
1069
- * Get OpenAPI specification
1070
- * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
1071
- * @param noCache - Bypass cache and regenerate specification
1072
- */
1073
- async getOpenApiSpec(options) {
1074
- const request = new Request({
1075
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1076
- method: "GET",
1077
- path: "/api/openapi.json",
1264
+ path: "/api/billing/webhooks",
1078
1265
  config: this.config,
1079
1266
  retry: {
1080
1267
  attempts: 3,
@@ -1084,35 +1271,30 @@ var SystemService = class extends BaseService {
1084
1271
  backoffFactor: 2
1085
1272
  }
1086
1273
  });
1087
- if (options?.noCache !== void 0) {
1088
- request.addQueryParam("noCache", {
1089
- key: "noCache",
1090
- value: options.noCache,
1091
- explode: false,
1092
- encode: true,
1093
- style: "form",
1094
- isLimit: false,
1095
- isOffset: false,
1096
- isCursor: false
1097
- });
1274
+ if (body !== void 0) {
1275
+ request.addBody(body);
1098
1276
  }
1099
1277
  return this.client.call(request);
1100
1278
  }
1101
1279
  };
1102
1280
 
1103
- // src/services/patterns-service.ts
1104
- var PatternsService = class extends BaseService {
1281
+ // src/services/conversations-service.ts
1282
+ var ConversationsService = class extends BaseService {
1105
1283
  /**
1106
- * List patterns
1107
- * List all patterns for the authenticated user
1108
- * @param limit - Maximum number of patterns to return
1109
- * @param offset - Number of patterns to skip
1284
+ * List conversations
1285
+ * List all conversations for the authenticated user with pagination
1286
+ * @param limit - Maximum number of conversations to return
1287
+ * @param offset - Number of conversations to skip
1288
+ * @param since - Return only conversations created after this timestamp (ISO 8601 format)
1289
+ * @param sortBy - Field to sort conversations by
1290
+ * @param order - Sort order
1291
+ * @param hasMemories - When true, return only conversations that contain at least one memory
1110
1292
  */
1111
- async listPatterns(options) {
1293
+ async listConversations(options) {
1112
1294
  const request = new Request({
1113
1295
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1114
1296
  method: "GET",
1115
- path: "/api/patterns",
1297
+ path: "/api/conversations",
1116
1298
  config: this.config,
1117
1299
  retry: {
1118
1300
  attempts: 3,
@@ -1146,18 +1328,66 @@ var PatternsService = class extends BaseService {
1146
1328
  isCursor: false
1147
1329
  });
1148
1330
  }
1331
+ if (options?.since !== void 0) {
1332
+ request.addQueryParam("since", {
1333
+ key: "since",
1334
+ value: options.since,
1335
+ explode: false,
1336
+ encode: true,
1337
+ style: "form",
1338
+ isLimit: false,
1339
+ isOffset: false,
1340
+ isCursor: false
1341
+ });
1342
+ }
1343
+ if (options?.sortBy !== void 0) {
1344
+ request.addQueryParam("sortBy", {
1345
+ key: "sortBy",
1346
+ value: options.sortBy,
1347
+ explode: false,
1348
+ encode: true,
1349
+ style: "form",
1350
+ isLimit: false,
1351
+ isOffset: false,
1352
+ isCursor: false
1353
+ });
1354
+ }
1355
+ if (options?.order !== void 0) {
1356
+ request.addQueryParam("order", {
1357
+ key: "order",
1358
+ value: options.order,
1359
+ explode: false,
1360
+ encode: true,
1361
+ style: "form",
1362
+ isLimit: false,
1363
+ isOffset: false,
1364
+ isCursor: false
1365
+ });
1366
+ }
1367
+ if (options?.hasMemories !== void 0) {
1368
+ request.addQueryParam("hasMemories", {
1369
+ key: "hasMemories",
1370
+ value: options.hasMemories,
1371
+ explode: false,
1372
+ encode: true,
1373
+ style: "form",
1374
+ isLimit: false,
1375
+ isOffset: false,
1376
+ isCursor: false
1377
+ });
1378
+ }
1149
1379
  return this.client.call(request);
1150
1380
  }
1151
1381
  /**
1152
- * Compile patterns
1153
- * Compile patterns from user's memories
1382
+ * Create conversation
1383
+ * Create a new conversation for the authenticated user
1154
1384
  * @param body - Request body
1155
1385
  */
1156
- async compilePatterns(options) {
1386
+ async createConversation(body) {
1157
1387
  const request = new Request({
1158
1388
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1159
1389
  method: "POST",
1160
- path: "/api/patterns/compile",
1390
+ path: "/api/conversations",
1161
1391
  config: this.config,
1162
1392
  retry: {
1163
1393
  attempts: 3,
@@ -1167,21 +1397,21 @@ var PatternsService = class extends BaseService {
1167
1397
  backoffFactor: 2
1168
1398
  }
1169
1399
  });
1170
- if (options?.body !== void 0) {
1171
- request.addBody(options?.body);
1400
+ if (body !== void 0) {
1401
+ request.addBody(body);
1172
1402
  }
1173
1403
  return this.client.call(request);
1174
1404
  }
1175
1405
  /**
1176
- * Detect behavioral patterns
1177
- * Run pattern detection algorithms to identify recurring behavioral patterns
1178
- * @param body - Request body
1406
+ * Get conversation summary
1407
+ * Retrieve a conversation summary by its ID
1408
+ * @param conversationId - The conversation ID
1179
1409
  */
1180
- async detectPatterns(options) {
1410
+ async getConversationSummary(conversationId) {
1181
1411
  const request = new Request({
1182
1412
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1183
- method: "POST",
1184
- path: "/api/patterns/detect",
1413
+ method: "GET",
1414
+ path: "/api/conversations/{conversationId}",
1185
1415
  config: this.config,
1186
1416
  retry: {
1187
1417
  attempts: 3,
@@ -1191,21 +1421,28 @@ var PatternsService = class extends BaseService {
1191
1421
  backoffFactor: 2
1192
1422
  }
1193
1423
  });
1194
- if (options?.body !== void 0) {
1195
- request.addBody(options?.body);
1196
- }
1197
- return this.client.call(request);
1198
- }
1424
+ request.addPathParam("conversationId", {
1425
+ key: "conversationId",
1426
+ value: conversationId,
1427
+ explode: false,
1428
+ encode: true,
1429
+ style: "simple",
1430
+ isLimit: false,
1431
+ isOffset: false,
1432
+ isCursor: false
1433
+ });
1434
+ return this.client.call(request);
1435
+ }
1199
1436
  /**
1200
- * Analyze pattern trends
1201
- * Analyze pattern trends, correlations, and generate insights
1202
- * @param body - Request body
1437
+ * Delete conversation
1438
+ * Delete a conversation and soft-delete all associated memories
1439
+ * @param conversationId - The conversation ID
1203
1440
  */
1204
- async analyzePatterns(options) {
1441
+ async deleteConversation(conversationId) {
1205
1442
  const request = new Request({
1206
1443
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1207
- method: "POST",
1208
- path: "/api/patterns/analyze",
1444
+ method: "DELETE",
1445
+ path: "/api/conversations/{conversationId}",
1209
1446
  config: this.config,
1210
1447
  retry: {
1211
1448
  attempts: 3,
@@ -1215,22 +1452,28 @@ var PatternsService = class extends BaseService {
1215
1452
  backoffFactor: 2
1216
1453
  }
1217
1454
  });
1218
- if (options?.body !== void 0) {
1219
- request.addBody(options?.body);
1220
- }
1455
+ request.addPathParam("conversationId", {
1456
+ key: "conversationId",
1457
+ value: conversationId,
1458
+ explode: false,
1459
+ encode: true,
1460
+ style: "simple",
1461
+ isLimit: false,
1462
+ isOffset: false,
1463
+ isCursor: false
1464
+ });
1221
1465
  return this.client.call(request);
1222
1466
  }
1223
1467
  /**
1224
- * Update pattern
1225
- * Update an existing pattern with partial data
1226
- * @param id - The pattern ID
1227
- * @param body - Request body
1468
+ * Get conversation timeline
1469
+ * Get all memories in a conversation in chronological order
1470
+ * @param conversationId - The conversation ID
1228
1471
  */
1229
- async updatePattern(id, body) {
1472
+ async getConversationTimeline(conversationId) {
1230
1473
  const request = new Request({
1231
1474
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1232
- method: "PATCH",
1233
- path: "/api/patterns/{id}",
1475
+ method: "GET",
1476
+ path: "/api/conversations/{conversationId}/timeline",
1234
1477
  config: this.config,
1235
1478
  retry: {
1236
1479
  attempts: 3,
@@ -1240,9 +1483,9 @@ var PatternsService = class extends BaseService {
1240
1483
  backoffFactor: 2
1241
1484
  }
1242
1485
  });
1243
- request.addPathParam("id", {
1244
- key: "id",
1245
- value: id,
1486
+ request.addPathParam("conversationId", {
1487
+ key: "conversationId",
1488
+ value: conversationId,
1246
1489
  explode: false,
1247
1490
  encode: true,
1248
1491
  style: "simple",
@@ -1250,21 +1493,18 @@ var PatternsService = class extends BaseService {
1250
1493
  isOffset: false,
1251
1494
  isCursor: false
1252
1495
  });
1253
- if (body !== void 0) {
1254
- request.addBody(body);
1255
- }
1256
1496
  return this.client.call(request);
1257
1497
  }
1258
1498
  /**
1259
- * Record pattern feedback
1260
- * Record feedback on a pattern
1499
+ * Search conversations
1500
+ * Search conversations by query string
1261
1501
  * @param body - Request body
1262
1502
  */
1263
- async recordPatternFeedback(body) {
1503
+ async searchConversations(body) {
1264
1504
  const request = new Request({
1265
1505
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1266
1506
  method: "POST",
1267
- path: "/api/patterns/feedback",
1507
+ path: "/api/conversations/search",
1268
1508
  config: this.config,
1269
1509
  retry: {
1270
1510
  attempts: 3,
@@ -1279,40 +1519,16 @@ var PatternsService = class extends BaseService {
1279
1519
  }
1280
1520
  return this.client.call(request);
1281
1521
  }
1282
- };
1283
-
1284
- // src/services/behavior-service.ts
1285
- var BehaviorService = class extends BaseService {
1286
- /**
1287
- * Get behavioral state
1288
- * Get current behavioral state for the authenticated user
1289
- */
1290
- async getBehavioralState() {
1291
- const request = new Request({
1292
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1293
- method: "GET",
1294
- path: "/api/patterns/behavior/state",
1295
- config: this.config,
1296
- retry: {
1297
- attempts: 3,
1298
- delayMs: 150,
1299
- maxDelayMs: 5e3,
1300
- jitterMs: 50,
1301
- backoffFactor: 2
1302
- }
1303
- });
1304
- return this.client.call(request);
1305
- }
1306
1522
  /**
1307
- * Update behavioral state
1308
- * Update or mutate behavioral state
1523
+ * Find conversations by topic
1524
+ * Find conversations that contain a specific topic
1309
1525
  * @param body - Request body
1310
1526
  */
1311
- async updateBehavioralState(options) {
1527
+ async findConversationsByTopic(body) {
1312
1528
  const request = new Request({
1313
1529
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1314
1530
  method: "POST",
1315
- path: "/api/patterns/behavior/state",
1531
+ path: "/api/conversations/by-topic",
1316
1532
  config: this.config,
1317
1533
  retry: {
1318
1534
  attempts: 3,
@@ -1322,30 +1538,27 @@ var BehaviorService = class extends BaseService {
1322
1538
  backoffFactor: 2
1323
1539
  }
1324
1540
  });
1325
- if (options?.body !== void 0) {
1326
- request.addBody(options?.body);
1541
+ if (body !== void 0) {
1542
+ request.addBody(body);
1327
1543
  }
1328
1544
  return this.client.call(request);
1329
1545
  }
1330
1546
  };
1331
1547
 
1332
- // src/services/narratives-service.ts
1333
- var NarrativesService = class extends BaseService {
1548
+ // src/services/entities-service.ts
1549
+ var EntitiesService = class extends BaseService {
1334
1550
  /**
1335
- * List narrative threads
1336
- * List all narrative threads for the authenticated user.
1337
- Narratives group related memories into coherent storylines.
1338
-
1339
- * @param limit - Maximum number of narratives to return
1340
- * @param offset - Number of narratives to skip
1341
- * @param state - Filter by narrative state
1342
- * @param topics - Comma-separated list of topics to filter by
1343
- */
1344
- async listNarratives(options) {
1551
+ * List entities
1552
+ * List all entities for the authenticated user, optionally filtered by type
1553
+ * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
1554
+ * @param limit - Maximum number of entities to return
1555
+ * @param offset - Number of entities to skip
1556
+ */
1557
+ async listEntities(options) {
1345
1558
  const request = new Request({
1346
1559
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1347
1560
  method: "GET",
1348
- path: "/api/narratives",
1561
+ path: "/api/entities",
1349
1562
  config: this.config,
1350
1563
  retry: {
1351
1564
  attempts: 3,
@@ -1355,6 +1568,18 @@ var NarrativesService = class extends BaseService {
1355
1568
  backoffFactor: 2
1356
1569
  }
1357
1570
  });
1571
+ if (options?.type !== void 0) {
1572
+ request.addQueryParam("type", {
1573
+ key: "type",
1574
+ value: options.type,
1575
+ explode: false,
1576
+ encode: true,
1577
+ style: "form",
1578
+ isLimit: false,
1579
+ isOffset: false,
1580
+ isCursor: false
1581
+ });
1582
+ }
1358
1583
  if (options?.limit !== void 0) {
1359
1584
  request.addQueryParam("limit", {
1360
1585
  key: "limit",
@@ -1379,68 +1604,18 @@ var NarrativesService = class extends BaseService {
1379
1604
  isCursor: false
1380
1605
  });
1381
1606
  }
1382
- if (options?.state !== void 0) {
1383
- request.addQueryParam("state", {
1384
- key: "state",
1385
- value: options.state,
1386
- explode: false,
1387
- encode: true,
1388
- style: "form",
1389
- isLimit: false,
1390
- isOffset: false,
1391
- isCursor: false
1392
- });
1393
- }
1394
- if (options?.topics !== void 0) {
1395
- request.addQueryParam("topics", {
1396
- key: "topics",
1397
- value: options.topics,
1398
- explode: false,
1399
- encode: true,
1400
- style: "form",
1401
- isLimit: false,
1402
- isOffset: false,
1403
- isCursor: false
1404
- });
1405
- }
1406
- return this.client.call(request);
1407
- }
1408
- /**
1409
- * Create a narrative thread
1410
- * Create a new narrative thread starting from a root memory.
1411
- Narratives help organize related memories into coherent storylines.
1412
-
1413
- * @param body - Request body
1414
- */
1415
- async createNarrative(body) {
1416
- const request = new Request({
1417
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1418
- method: "POST",
1419
- path: "/api/narratives",
1420
- config: this.config,
1421
- retry: {
1422
- attempts: 3,
1423
- delayMs: 150,
1424
- maxDelayMs: 5e3,
1425
- jitterMs: 50,
1426
- backoffFactor: 2
1427
- }
1428
- });
1429
- if (body !== void 0) {
1430
- request.addBody(body);
1431
- }
1432
1607
  return this.client.call(request);
1433
1608
  }
1434
1609
  /**
1435
- * Get a narrative thread
1436
- * Retrieve a specific narrative thread by ID
1437
- * @param id - The narrative ID
1610
+ * Get entity by ID
1611
+ * Retrieve a specific entity by its ID
1612
+ * @param id - The entity ID
1438
1613
  */
1439
- async getNarrative(id) {
1614
+ async getEntityById(id) {
1440
1615
  const request = new Request({
1441
1616
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1442
1617
  method: "GET",
1443
- path: "/api/narratives/{id}",
1618
+ path: "/api/entities/{id}",
1444
1619
  config: this.config,
1445
1620
  retry: {
1446
1621
  attempts: 3,
@@ -1463,17 +1638,17 @@ var NarrativesService = class extends BaseService {
1463
1638
  return this.client.call(request);
1464
1639
  }
1465
1640
  /**
1466
- * Delete a narrative thread
1467
- * Delete a narrative thread.
1468
- This does not delete the associated memories, only the narrative structure.
1469
-
1470
- * @param id - The narrative ID
1471
- */
1472
- async deleteNarrative(id) {
1641
+ * Get memories mentioning entity
1642
+ * Get all memories that mention a specific entity
1643
+ * @param id - The entity ID
1644
+ * @param limit - Maximum number of memories to return
1645
+ * @param offset - Number of memories to skip
1646
+ */
1647
+ async getEntityMemories(id, options) {
1473
1648
  const request = new Request({
1474
1649
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1475
- method: "DELETE",
1476
- path: "/api/narratives/{id}",
1650
+ method: "GET",
1651
+ path: "/api/entities/{id}/memories",
1477
1652
  config: this.config,
1478
1653
  retry: {
1479
1654
  attempts: 3,
@@ -1493,21 +1668,41 @@ var NarrativesService = class extends BaseService {
1493
1668
  isOffset: false,
1494
1669
  isCursor: false
1495
1670
  });
1671
+ if (options?.limit !== void 0) {
1672
+ request.addQueryParam("limit", {
1673
+ key: "limit",
1674
+ value: options.limit,
1675
+ explode: false,
1676
+ encode: true,
1677
+ style: "form",
1678
+ isLimit: true,
1679
+ isOffset: false,
1680
+ isCursor: false
1681
+ });
1682
+ }
1683
+ if (options?.offset !== void 0) {
1684
+ request.addQueryParam("offset", {
1685
+ key: "offset",
1686
+ value: options.offset,
1687
+ explode: false,
1688
+ encode: true,
1689
+ style: "form",
1690
+ isLimit: false,
1691
+ isOffset: true,
1692
+ isCursor: false
1693
+ });
1694
+ }
1496
1695
  return this.client.call(request);
1497
1696
  }
1498
1697
  /**
1499
- * Update a narrative thread
1500
- * Update a narrative thread's title, topics, or state.
1501
- Use this to resolve, reopen, or modify narratives.
1502
-
1503
- * @param id - The narrative ID
1504
- * @param body - Request body
1505
- */
1506
- async updateNarrative(id, body) {
1698
+ * Get graph health metrics
1699
+ * Returns knowledge graph health metrics including entity counts, fact counts, topic counts, and extraction coverage
1700
+ */
1701
+ async getGraphHealth() {
1507
1702
  const request = new Request({
1508
1703
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1509
- method: "PATCH",
1510
- path: "/api/narratives/{id}",
1704
+ method: "GET",
1705
+ path: "/api/entities/health",
1511
1706
  config: this.config,
1512
1707
  retry: {
1513
1708
  attempts: 3,
@@ -1517,35 +1712,25 @@ var NarrativesService = class extends BaseService {
1517
1712
  backoffFactor: 2
1518
1713
  }
1519
1714
  });
1520
- request.addPathParam("id", {
1521
- key: "id",
1522
- value: id,
1523
- explode: false,
1524
- encode: true,
1525
- style: "simple",
1526
- isLimit: false,
1527
- isOffset: false,
1528
- isCursor: false
1529
- });
1530
- if (body !== void 0) {
1531
- request.addBody(body);
1532
- }
1533
1715
  return this.client.call(request);
1534
1716
  }
1717
+ };
1718
+
1719
+ // src/services/facts-service.ts
1720
+ var FactsService = class extends BaseService {
1535
1721
  /**
1536
- * Get narrative timeline
1537
- * Get all memories in a narrative, ordered by their position in the narrative.
1538
- Each memory includes its position and effective state.
1539
-
1540
- * @param id - The narrative ID
1541
- * @param limit - Maximum number of memories to return
1542
- * @param offset - Number of memories to skip
1543
- */
1544
- async getNarrativeTimeline(id, options) {
1722
+ * List facts
1723
+ * List all facts for the authenticated user
1724
+ * @param limit - Maximum number of facts to return
1725
+ * @param offset - Number of facts to skip
1726
+ * @param sortBy - Field to sort facts by
1727
+ * @param order - Sort order
1728
+ */
1729
+ async listFacts(options) {
1545
1730
  const request = new Request({
1546
1731
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1547
1732
  method: "GET",
1548
- path: "/api/narratives/{id}/timeline",
1733
+ path: "/api/facts",
1549
1734
  config: this.config,
1550
1735
  retry: {
1551
1736
  attempts: 3,
@@ -1555,16 +1740,6 @@ var NarrativesService = class extends BaseService {
1555
1740
  backoffFactor: 2
1556
1741
  }
1557
1742
  });
1558
- request.addPathParam("id", {
1559
- key: "id",
1560
- value: id,
1561
- explode: false,
1562
- encode: true,
1563
- style: "simple",
1564
- isLimit: false,
1565
- isOffset: false,
1566
- isCursor: false
1567
- });
1568
1743
  if (options?.limit !== void 0) {
1569
1744
  request.addQueryParam("limit", {
1570
1745
  key: "limit",
@@ -1589,21 +1764,66 @@ var NarrativesService = class extends BaseService {
1589
1764
  isCursor: false
1590
1765
  });
1591
1766
  }
1767
+ if (options?.sortBy !== void 0) {
1768
+ request.addQueryParam("sortBy", {
1769
+ key: "sortBy",
1770
+ value: options.sortBy,
1771
+ explode: false,
1772
+ encode: true,
1773
+ style: "form",
1774
+ isLimit: false,
1775
+ isOffset: false,
1776
+ isCursor: false
1777
+ });
1778
+ }
1779
+ if (options?.order !== void 0) {
1780
+ request.addQueryParam("order", {
1781
+ key: "order",
1782
+ value: options.order,
1783
+ explode: false,
1784
+ encode: true,
1785
+ style: "form",
1786
+ isLimit: false,
1787
+ isOffset: false,
1788
+ isCursor: false
1789
+ });
1790
+ }
1592
1791
  return this.client.call(request);
1593
1792
  }
1594
1793
  /**
1595
- * Add a memory to a narrative
1596
- * Add an existing memory to a narrative thread.
1597
- Optionally specify a position to insert the memory at.
1598
-
1599
- * @param id - The narrative ID
1600
- * @param body - Request body
1601
- */
1602
- async addMemoryToNarrative(id, body) {
1794
+ * Create fact
1795
+ * Create a new semantic fact
1796
+ * @param body - Request body
1797
+ */
1798
+ async createFact(body) {
1603
1799
  const request = new Request({
1604
1800
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1605
1801
  method: "POST",
1606
- path: "/api/narratives/{id}/memories",
1802
+ path: "/api/facts",
1803
+ config: this.config,
1804
+ retry: {
1805
+ attempts: 3,
1806
+ delayMs: 150,
1807
+ maxDelayMs: 5e3,
1808
+ jitterMs: 50,
1809
+ backoffFactor: 2
1810
+ }
1811
+ });
1812
+ if (body !== void 0) {
1813
+ request.addBody(body);
1814
+ }
1815
+ return this.client.call(request);
1816
+ }
1817
+ /**
1818
+ * Get fact by ID
1819
+ * Retrieve a specific fact by its ID
1820
+ * @param id - The fact ID
1821
+ */
1822
+ async getFactById(id) {
1823
+ const request = new Request({
1824
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1825
+ method: "GET",
1826
+ path: "/api/facts/{id}",
1607
1827
  config: this.config,
1608
1828
  retry: {
1609
1829
  attempts: 3,
@@ -1623,24 +1843,19 @@ var NarrativesService = class extends BaseService {
1623
1843
  isOffset: false,
1624
1844
  isCursor: false
1625
1845
  });
1626
- if (body !== void 0) {
1627
- request.addBody(body);
1628
- }
1629
1846
  return this.client.call(request);
1630
1847
  }
1631
1848
  /**
1632
- * Remove a memory from a narrative
1633
- * Remove a memory from a narrative thread.
1634
- This does not delete the memory itself, only removes it from the narrative.
1635
-
1636
- * @param id - The narrative ID
1637
- * @param memoryId - The memory ID to remove
1638
- */
1639
- async removeMemoryFromNarrative(id, memoryId) {
1849
+ * Update fact
1850
+ * Update an existing fact completely
1851
+ * @param id - The fact ID
1852
+ * @param body - Request body
1853
+ */
1854
+ async updateFact(id, body) {
1640
1855
  const request = new Request({
1641
1856
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1642
- method: "DELETE",
1643
- path: "/api/narratives/{id}/memories/{memoryId}",
1857
+ method: "PUT",
1858
+ path: "/api/facts/{id}",
1644
1859
  config: this.config,
1645
1860
  retry: {
1646
1861
  attempts: 3,
@@ -1660,9 +1875,33 @@ var NarrativesService = class extends BaseService {
1660
1875
  isOffset: false,
1661
1876
  isCursor: false
1662
1877
  });
1663
- request.addPathParam("memoryId", {
1664
- key: "memoryId",
1665
- value: memoryId,
1878
+ if (body !== void 0) {
1879
+ request.addBody(body);
1880
+ }
1881
+ return this.client.call(request);
1882
+ }
1883
+ /**
1884
+ * Delete fact
1885
+ * Delete a fact by its ID
1886
+ * @param id - The fact ID
1887
+ */
1888
+ async deleteFact(id) {
1889
+ const request = new Request({
1890
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1891
+ method: "DELETE",
1892
+ path: "/api/facts/{id}",
1893
+ config: this.config,
1894
+ retry: {
1895
+ attempts: 3,
1896
+ delayMs: 150,
1897
+ maxDelayMs: 5e3,
1898
+ jitterMs: 50,
1899
+ backoffFactor: 2
1900
+ }
1901
+ });
1902
+ request.addPathParam("id", {
1903
+ key: "id",
1904
+ value: id,
1666
1905
  explode: false,
1667
1906
  encode: true,
1668
1907
  style: "simple",
@@ -1672,22 +1911,16 @@ var NarrativesService = class extends BaseService {
1672
1911
  });
1673
1912
  return this.client.call(request);
1674
1913
  }
1675
- };
1676
-
1677
- // src/services/monitoring-service.ts
1678
- var MonitoringService = class extends BaseService {
1679
1914
  /**
1680
- * Prometheus metrics endpoint
1681
- * Returns Prometheus-formatted metrics for monitoring and observability.
1682
- This endpoint is public and requires no authentication.
1683
- Designed to be scraped by Prometheus at regular intervals.
1684
-
1685
- */
1686
- async getMetrics() {
1915
+ * Search facts
1916
+ * Search semantic facts by query string
1917
+ * @param body - Request body
1918
+ */
1919
+ async searchFacts(body) {
1687
1920
  const request = new Request({
1688
1921
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1689
- method: "GET",
1690
- path: "/metrics",
1922
+ method: "POST",
1923
+ path: "/api/facts/search",
1691
1924
  config: this.config,
1692
1925
  retry: {
1693
1926
  attempts: 3,
@@ -1697,29 +1930,25 @@ var MonitoringService = class extends BaseService {
1697
1930
  backoffFactor: 2
1698
1931
  }
1699
1932
  });
1933
+ if (body !== void 0) {
1934
+ request.addBody(body);
1935
+ }
1700
1936
  return this.client.call(request);
1701
1937
  }
1702
1938
  };
1703
1939
 
1704
- // src/services/memories-service.ts
1705
- var MemoriesService = class extends BaseService {
1940
+ // src/services/graphrag-service.ts
1941
+ var GraphragService = class extends BaseService {
1706
1942
  /**
1707
- * Get memory by ID
1708
- * Retrieve a specific memory by its ID with configurable detail level.
1709
-
1710
- **Detail levels:**
1711
- - `minimal` — raw memory only, no extra queries
1712
- - `standard` (default) — adds userTopics, extractedTopics, entities, facts, relationships
1713
- - `full` — adds conversationContext (title, memoryCount, position) and relationship target previews
1714
-
1715
- * @param id - The memory ID
1716
- * @param detail - Detail level: minimal (raw memory), standard (default, + topics/entities/facts/relationships), full (+ conversation context and relationship previews)
1717
- */
1718
- async getMemoryById(id, options) {
1943
+ * Explain a GraphRAG query
1944
+ * Get explanation for a previously executed GraphRAG query result
1945
+ * @param queryId - The query ID to explain
1946
+ */
1947
+ async explainGraphRAGQuery(options) {
1719
1948
  const request = new Request({
1720
1949
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1721
1950
  method: "GET",
1722
- path: "/api/memories/{id}",
1951
+ path: "/api/graphrag/explain",
1723
1952
  config: this.config,
1724
1953
  retry: {
1725
1954
  attempts: 3,
@@ -1729,20 +1958,10 @@ var MemoriesService = class extends BaseService {
1729
1958
  backoffFactor: 2
1730
1959
  }
1731
1960
  });
1732
- request.addPathParam("id", {
1733
- key: "id",
1734
- value: id,
1735
- explode: false,
1736
- encode: true,
1737
- style: "simple",
1738
- isLimit: false,
1739
- isOffset: false,
1740
- isCursor: false
1741
- });
1742
- if (options?.detail !== void 0) {
1743
- request.addQueryParam("detail", {
1744
- key: "detail",
1745
- value: options.detail,
1961
+ if (options?.queryId !== void 0) {
1962
+ request.addQueryParam("queryId", {
1963
+ key: "queryId",
1964
+ value: options.queryId,
1746
1965
  explode: false,
1747
1966
  encode: true,
1748
1967
  style: "form",
@@ -1754,16 +1973,15 @@ var MemoriesService = class extends BaseService {
1754
1973
  return this.client.call(request);
1755
1974
  }
1756
1975
  /**
1757
- * Update a memory
1758
- * Update an existing memory for the authenticated user
1759
- * @param id - Memory ID
1976
+ * Query communities
1977
+ * Query communities for relevant information using semantic search
1760
1978
  * @param body - Request body
1761
1979
  */
1762
- async updateMemory(id, body) {
1980
+ async queryCommunities(body) {
1763
1981
  const request = new Request({
1764
1982
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1765
- method: "PUT",
1766
- path: "/api/memories/{id}",
1983
+ method: "POST",
1984
+ path: "/api/graphrag/query-communities",
1767
1985
  config: this.config,
1768
1986
  retry: {
1769
1987
  attempts: 3,
@@ -1773,32 +1991,217 @@ var MemoriesService = class extends BaseService {
1773
1991
  backoffFactor: 2
1774
1992
  }
1775
1993
  });
1776
- request.addPathParam("id", {
1777
- key: "id",
1778
- value: id,
1779
- explode: false,
1780
- encode: true,
1781
- style: "simple",
1782
- isLimit: false,
1783
- isOffset: false,
1784
- isCursor: false
1785
- });
1786
1994
  if (body !== void 0) {
1787
1995
  request.addBody(body);
1788
1996
  }
1789
1997
  return this.client.call(request);
1790
1998
  }
1791
1999
  /**
1792
- * Delete memory
1793
- * Delete a memory by its ID
1794
- * @param id - The memory ID
2000
+ * Execute a GraphRAG query
2001
+ * Execute a graph-based retrieval augmented generation query
2002
+ * @param body - Request body
1795
2003
  */
1796
- async deleteMemory(id) {
2004
+ async executeGraphRAGQuery(body) {
1797
2005
  const request = new Request({
1798
2006
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1799
- method: "DELETE",
1800
- path: "/api/memories/{id}",
1801
- config: this.config,
2007
+ method: "POST",
2008
+ path: "/api/graphrag/query",
2009
+ config: this.config,
2010
+ retry: {
2011
+ attempts: 3,
2012
+ delayMs: 150,
2013
+ maxDelayMs: 5e3,
2014
+ jitterMs: 50,
2015
+ backoffFactor: 2
2016
+ }
2017
+ });
2018
+ if (body !== void 0) {
2019
+ request.addBody(body);
2020
+ }
2021
+ return this.client.call(request);
2022
+ }
2023
+ };
2024
+
2025
+ // src/services/health-service.ts
2026
+ var HealthService = class extends BaseService {
2027
+ /**
2028
+ * API health check endpoint
2029
+ * Returns the health status and uptime of the API service.
2030
+ This endpoint is public and requires no authentication.
2031
+ Use this endpoint for monitoring, health checks, and service availability verification.
2032
+ Returns 200 when healthy, 503 when the database is unreachable.
2033
+
2034
+ */
2035
+ async healthCheck() {
2036
+ const request = new Request({
2037
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2038
+ method: "GET",
2039
+ path: "/health",
2040
+ config: this.config,
2041
+ retry: {
2042
+ attempts: 3,
2043
+ delayMs: 150,
2044
+ maxDelayMs: 5e3,
2045
+ jitterMs: 50,
2046
+ backoffFactor: 2
2047
+ }
2048
+ });
2049
+ return this.client.call(request);
2050
+ }
2051
+ };
2052
+
2053
+ // src/services/invites-service.ts
2054
+ var InvitesService = class extends BaseService {
2055
+ /**
2056
+ * Check invite gate status
2057
+ * Check whether the invite gate is currently open or closed.
2058
+ When gated is true, new signups require a valid invite code.
2059
+ Response is cached server-side (30-second TTL).
2060
+
2061
+ */
2062
+ async getGateStatus() {
2063
+ const request = new Request({
2064
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2065
+ method: "GET",
2066
+ path: "/api/invites/gate-status",
2067
+ config: this.config,
2068
+ retry: {
2069
+ attempts: 3,
2070
+ delayMs: 150,
2071
+ maxDelayMs: 5e3,
2072
+ jitterMs: 50,
2073
+ backoffFactor: 2
2074
+ }
2075
+ });
2076
+ return this.client.call(request);
2077
+ }
2078
+ /**
2079
+ * Validate an invite code
2080
+ * Validate an invite code without redeeming it.
2081
+ Rate limited to 10 requests per minute per IP to prevent enumeration.
2082
+ Error messages are intentionally generic.
2083
+
2084
+ * @param body - Request body
2085
+ */
2086
+ async validateInviteCode(body) {
2087
+ const request = new Request({
2088
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2089
+ method: "POST",
2090
+ path: "/api/invites/validate",
2091
+ config: this.config,
2092
+ retry: {
2093
+ attempts: 3,
2094
+ delayMs: 150,
2095
+ maxDelayMs: 5e3,
2096
+ jitterMs: 50,
2097
+ backoffFactor: 2
2098
+ }
2099
+ });
2100
+ if (body !== void 0) {
2101
+ request.addBody(body);
2102
+ }
2103
+ return this.client.call(request);
2104
+ }
2105
+ };
2106
+
2107
+ // src/services/memories-service.ts
2108
+ var MemoriesService = class extends BaseService {
2109
+ /**
2110
+ * Get memory by ID
2111
+ * Retrieve a specific memory by its ID with configurable detail level.
2112
+
2113
+ **Detail levels:**
2114
+ - `minimal` — raw memory only, no extra queries
2115
+ - `standard` (default) — adds userTopics, extractedTopics, entities, facts, relationships
2116
+ - `full` — adds conversationContext (title, memoryCount, position) and relationship target previews
2117
+
2118
+ * @param id - The memory ID
2119
+ * @param detail - Detail level: minimal (raw memory), standard (default, + topics/entities/facts/relationships), full (+ conversation context and relationship previews)
2120
+ */
2121
+ async getMemoryById(id, options) {
2122
+ const request = new Request({
2123
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2124
+ method: "GET",
2125
+ path: "/api/memories/{id}",
2126
+ config: this.config,
2127
+ retry: {
2128
+ attempts: 3,
2129
+ delayMs: 150,
2130
+ maxDelayMs: 5e3,
2131
+ jitterMs: 50,
2132
+ backoffFactor: 2
2133
+ }
2134
+ });
2135
+ request.addPathParam("id", {
2136
+ key: "id",
2137
+ value: id,
2138
+ explode: false,
2139
+ encode: true,
2140
+ style: "simple",
2141
+ isLimit: false,
2142
+ isOffset: false,
2143
+ isCursor: false
2144
+ });
2145
+ if (options?.detail !== void 0) {
2146
+ request.addQueryParam("detail", {
2147
+ key: "detail",
2148
+ value: options.detail,
2149
+ explode: false,
2150
+ encode: true,
2151
+ style: "form",
2152
+ isLimit: false,
2153
+ isOffset: false,
2154
+ isCursor: false
2155
+ });
2156
+ }
2157
+ return this.client.call(request);
2158
+ }
2159
+ /**
2160
+ * Update a memory
2161
+ * Update an existing memory for the authenticated user
2162
+ * @param id - Memory ID
2163
+ * @param body - Request body
2164
+ */
2165
+ async updateMemory(id, body) {
2166
+ const request = new Request({
2167
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2168
+ method: "PUT",
2169
+ path: "/api/memories/{id}",
2170
+ config: this.config,
2171
+ retry: {
2172
+ attempts: 3,
2173
+ delayMs: 150,
2174
+ maxDelayMs: 5e3,
2175
+ jitterMs: 50,
2176
+ backoffFactor: 2
2177
+ }
2178
+ });
2179
+ request.addPathParam("id", {
2180
+ key: "id",
2181
+ value: id,
2182
+ explode: false,
2183
+ encode: true,
2184
+ style: "simple",
2185
+ isLimit: false,
2186
+ isOffset: false,
2187
+ isCursor: false
2188
+ });
2189
+ if (body !== void 0) {
2190
+ request.addBody(body);
2191
+ }
2192
+ return this.client.call(request);
2193
+ }
2194
+ /**
2195
+ * Delete memory
2196
+ * Delete a memory by its ID
2197
+ * @param id - The memory ID
2198
+ */
2199
+ async deleteMemory(id) {
2200
+ const request = new Request({
2201
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2202
+ method: "DELETE",
2203
+ path: "/api/memories/{id}",
2204
+ config: this.config,
1802
2205
  retry: {
1803
2206
  attempts: 3,
1804
2207
  delayMs: 150,
@@ -3087,20 +3490,20 @@ var MemoriesService = class extends BaseService {
3087
3490
  }
3088
3491
  };
3089
3492
 
3090
- // src/services/invites-service.ts
3091
- var InvitesService = class extends BaseService {
3493
+ // src/services/monitoring-service.ts
3494
+ var MonitoringService = class extends BaseService {
3092
3495
  /**
3093
- * Check invite gate status
3094
- * Check whether the invite gate is currently open or closed.
3095
- When gated is true, new signups require a valid invite code.
3096
- Response is cached server-side (30-second TTL).
3496
+ * Prometheus metrics endpoint
3497
+ * Returns Prometheus-formatted metrics for monitoring and observability.
3498
+ This endpoint is public and requires no authentication.
3499
+ Designed to be scraped by Prometheus at regular intervals.
3097
3500
 
3098
3501
  */
3099
- async getGateStatus() {
3502
+ async getMetrics() {
3100
3503
  const request = new Request({
3101
3504
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3102
3505
  method: "GET",
3103
- path: "/api/invites/gate-status",
3506
+ path: "/metrics",
3104
3507
  config: this.config,
3105
3508
  retry: {
3106
3509
  attempts: 3,
@@ -3112,19 +3515,25 @@ var InvitesService = class extends BaseService {
3112
3515
  });
3113
3516
  return this.client.call(request);
3114
3517
  }
3518
+ };
3519
+
3520
+ // src/services/narratives-service.ts
3521
+ var NarrativesService = class extends BaseService {
3115
3522
  /**
3116
- * Validate an invite code
3117
- * Validate an invite code without redeeming it.
3118
- Rate limited to 10 requests per minute per IP to prevent enumeration.
3119
- Error messages are intentionally generic.
3523
+ * List narrative threads
3524
+ * List all narrative threads for the authenticated user.
3525
+ Narratives group related memories into coherent storylines.
3120
3526
 
3121
- * @param body - Request body
3527
+ * @param limit - Maximum number of narratives to return
3528
+ * @param offset - Number of narratives to skip
3529
+ * @param state - Filter by narrative state
3530
+ * @param topics - Comma-separated list of topics to filter by
3122
3531
  */
3123
- async validateInviteCode(body) {
3532
+ async listNarratives(options) {
3124
3533
  const request = new Request({
3125
3534
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3126
- method: "POST",
3127
- path: "/api/invites/validate",
3535
+ method: "GET",
3536
+ path: "/api/narratives",
3128
3537
  config: this.config,
3129
3538
  retry: {
3130
3539
  attempts: 3,
@@ -3134,161 +3543,17 @@ var InvitesService = class extends BaseService {
3134
3543
  backoffFactor: 2
3135
3544
  }
3136
3545
  });
3137
- if (body !== void 0) {
3138
- request.addBody(body);
3139
- }
3140
- return this.client.call(request);
3141
- }
3142
- };
3143
-
3144
- // src/services/health-service.ts
3145
- var HealthService = class extends BaseService {
3146
- /**
3147
- * API health check endpoint
3148
- * Returns the health status and uptime of the API service.
3149
- This endpoint is public and requires no authentication.
3150
- Use this endpoint for monitoring, health checks, and service availability verification.
3151
- Returns 200 when healthy, 503 when the database is unreachable.
3152
-
3153
- */
3154
- async healthCheck() {
3155
- const request = new Request({
3156
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3157
- method: "GET",
3158
- path: "/health",
3159
- config: this.config,
3160
- retry: {
3161
- attempts: 3,
3162
- delayMs: 150,
3163
- maxDelayMs: 5e3,
3164
- jitterMs: 50,
3165
- backoffFactor: 2
3166
- }
3167
- });
3168
- return this.client.call(request);
3169
- }
3170
- };
3171
-
3172
- // src/services/graphrag-service.ts
3173
- var GraphragService = class extends BaseService {
3174
- /**
3175
- * Explain a GraphRAG query
3176
- * Get explanation for a previously executed GraphRAG query result
3177
- * @param queryId - The query ID to explain
3178
- */
3179
- async explainGraphRAGQuery(options) {
3180
- const request = new Request({
3181
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3182
- method: "GET",
3183
- path: "/api/graphrag/explain",
3184
- config: this.config,
3185
- retry: {
3186
- attempts: 3,
3187
- delayMs: 150,
3188
- maxDelayMs: 5e3,
3189
- jitterMs: 50,
3190
- backoffFactor: 2
3191
- }
3192
- });
3193
- if (options?.queryId !== void 0) {
3194
- request.addQueryParam("queryId", {
3195
- key: "queryId",
3196
- value: options.queryId,
3197
- explode: false,
3198
- encode: true,
3199
- style: "form",
3200
- isLimit: false,
3201
- isOffset: false,
3202
- isCursor: false
3203
- });
3204
- }
3205
- return this.client.call(request);
3206
- }
3207
- /**
3208
- * Query communities
3209
- * Query communities for relevant information using semantic search
3210
- * @param body - Request body
3211
- */
3212
- async queryCommunities(body) {
3213
- const request = new Request({
3214
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3215
- method: "POST",
3216
- path: "/api/graphrag/query-communities",
3217
- config: this.config,
3218
- retry: {
3219
- attempts: 3,
3220
- delayMs: 150,
3221
- maxDelayMs: 5e3,
3222
- jitterMs: 50,
3223
- backoffFactor: 2
3224
- }
3225
- });
3226
- if (body !== void 0) {
3227
- request.addBody(body);
3228
- }
3229
- return this.client.call(request);
3230
- }
3231
- /**
3232
- * Execute a GraphRAG query
3233
- * Execute a graph-based retrieval augmented generation query
3234
- * @param body - Request body
3235
- */
3236
- async executeGraphRAGQuery(body) {
3237
- const request = new Request({
3238
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3239
- method: "POST",
3240
- path: "/api/graphrag/query",
3241
- config: this.config,
3242
- retry: {
3243
- attempts: 3,
3244
- delayMs: 150,
3245
- maxDelayMs: 5e3,
3246
- jitterMs: 50,
3247
- backoffFactor: 2
3248
- }
3249
- });
3250
- if (body !== void 0) {
3251
- request.addBody(body);
3252
- }
3253
- return this.client.call(request);
3254
- }
3255
- };
3256
-
3257
- // src/services/facts-service.ts
3258
- var FactsService = class extends BaseService {
3259
- /**
3260
- * List facts
3261
- * List all facts for the authenticated user
3262
- * @param limit - Maximum number of facts to return
3263
- * @param offset - Number of facts to skip
3264
- * @param sortBy - Field to sort facts by
3265
- * @param order - Sort order
3266
- */
3267
- async listFacts(options) {
3268
- const request = new Request({
3269
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3270
- method: "GET",
3271
- path: "/api/facts",
3272
- config: this.config,
3273
- retry: {
3274
- attempts: 3,
3275
- delayMs: 150,
3276
- maxDelayMs: 5e3,
3277
- jitterMs: 50,
3278
- backoffFactor: 2
3279
- }
3280
- });
3281
- if (options?.limit !== void 0) {
3282
- request.addQueryParam("limit", {
3283
- key: "limit",
3284
- value: options.limit,
3285
- explode: false,
3286
- encode: true,
3287
- style: "form",
3288
- isLimit: true,
3289
- isOffset: false,
3290
- isCursor: false
3291
- });
3546
+ if (options?.limit !== void 0) {
3547
+ request.addQueryParam("limit", {
3548
+ key: "limit",
3549
+ value: options.limit,
3550
+ explode: false,
3551
+ encode: true,
3552
+ style: "form",
3553
+ isLimit: true,
3554
+ isOffset: false,
3555
+ isCursor: false
3556
+ });
3292
3557
  }
3293
3558
  if (options?.offset !== void 0) {
3294
3559
  request.addQueryParam("offset", {
@@ -3302,10 +3567,10 @@ var FactsService = class extends BaseService {
3302
3567
  isCursor: false
3303
3568
  });
3304
3569
  }
3305
- if (options?.sortBy !== void 0) {
3306
- request.addQueryParam("sortBy", {
3307
- key: "sortBy",
3308
- value: options.sortBy,
3570
+ if (options?.state !== void 0) {
3571
+ request.addQueryParam("state", {
3572
+ key: "state",
3573
+ value: options.state,
3309
3574
  explode: false,
3310
3575
  encode: true,
3311
3576
  style: "form",
@@ -3314,10 +3579,10 @@ var FactsService = class extends BaseService {
3314
3579
  isCursor: false
3315
3580
  });
3316
3581
  }
3317
- if (options?.order !== void 0) {
3318
- request.addQueryParam("order", {
3319
- key: "order",
3320
- value: options.order,
3582
+ if (options?.topics !== void 0) {
3583
+ request.addQueryParam("topics", {
3584
+ key: "topics",
3585
+ value: options.topics,
3321
3586
  explode: false,
3322
3587
  encode: true,
3323
3588
  style: "form",
@@ -3329,15 +3594,17 @@ var FactsService = class extends BaseService {
3329
3594
  return this.client.call(request);
3330
3595
  }
3331
3596
  /**
3332
- * Create fact
3333
- * Create a new semantic fact
3334
- * @param body - Request body
3335
- */
3336
- async createFact(body) {
3597
+ * Create a narrative thread
3598
+ * Create a new narrative thread starting from a root memory.
3599
+ Narratives help organize related memories into coherent storylines.
3600
+
3601
+ * @param body - Request body
3602
+ */
3603
+ async createNarrative(body) {
3337
3604
  const request = new Request({
3338
3605
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3339
3606
  method: "POST",
3340
- path: "/api/facts",
3607
+ path: "/api/narratives",
3341
3608
  config: this.config,
3342
3609
  retry: {
3343
3610
  attempts: 3,
@@ -3353,15 +3620,15 @@ var FactsService = class extends BaseService {
3353
3620
  return this.client.call(request);
3354
3621
  }
3355
3622
  /**
3356
- * Get fact by ID
3357
- * Retrieve a specific fact by its ID
3358
- * @param id - The fact ID
3623
+ * Get a narrative thread
3624
+ * Retrieve a specific narrative thread by ID
3625
+ * @param id - The narrative ID
3359
3626
  */
3360
- async getFactById(id) {
3627
+ async getNarrative(id) {
3361
3628
  const request = new Request({
3362
3629
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3363
3630
  method: "GET",
3364
- path: "/api/facts/{id}",
3631
+ path: "/api/narratives/{id}",
3365
3632
  config: this.config,
3366
3633
  retry: {
3367
3634
  attempts: 3,
@@ -3384,16 +3651,17 @@ var FactsService = class extends BaseService {
3384
3651
  return this.client.call(request);
3385
3652
  }
3386
3653
  /**
3387
- * Update fact
3388
- * Update an existing fact completely
3389
- * @param id - The fact ID
3390
- * @param body - Request body
3391
- */
3392
- async updateFact(id, body) {
3654
+ * Delete a narrative thread
3655
+ * Delete a narrative thread.
3656
+ This does not delete the associated memories, only the narrative structure.
3657
+
3658
+ * @param id - The narrative ID
3659
+ */
3660
+ async deleteNarrative(id) {
3393
3661
  const request = new Request({
3394
3662
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3395
- method: "PUT",
3396
- path: "/api/facts/{id}",
3663
+ method: "DELETE",
3664
+ path: "/api/narratives/{id}",
3397
3665
  config: this.config,
3398
3666
  retry: {
3399
3667
  attempts: 3,
@@ -3413,21 +3681,21 @@ var FactsService = class extends BaseService {
3413
3681
  isOffset: false,
3414
3682
  isCursor: false
3415
3683
  });
3416
- if (body !== void 0) {
3417
- request.addBody(body);
3418
- }
3419
3684
  return this.client.call(request);
3420
3685
  }
3421
3686
  /**
3422
- * Delete fact
3423
- * Delete a fact by its ID
3424
- * @param id - The fact ID
3425
- */
3426
- async deleteFact(id) {
3687
+ * Update a narrative thread
3688
+ * Update a narrative thread's title, topics, or state.
3689
+ Use this to resolve, reopen, or modify narratives.
3690
+
3691
+ * @param id - The narrative ID
3692
+ * @param body - Request body
3693
+ */
3694
+ async updateNarrative(id, body) {
3427
3695
  const request = new Request({
3428
3696
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3429
- method: "DELETE",
3430
- path: "/api/facts/{id}",
3697
+ method: "PATCH",
3698
+ path: "/api/narratives/{id}",
3431
3699
  config: this.config,
3432
3700
  retry: {
3433
3701
  attempts: 3,
@@ -3447,138 +3715,25 @@ var FactsService = class extends BaseService {
3447
3715
  isOffset: false,
3448
3716
  isCursor: false
3449
3717
  });
3450
- return this.client.call(request);
3451
- }
3452
- /**
3453
- * Search facts
3454
- * Search semantic facts by query string
3455
- * @param body - Request body
3456
- */
3457
- async searchFacts(body) {
3458
- const request = new Request({
3459
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3460
- method: "POST",
3461
- path: "/api/facts/search",
3462
- config: this.config,
3463
- retry: {
3464
- attempts: 3,
3465
- delayMs: 150,
3466
- maxDelayMs: 5e3,
3467
- jitterMs: 50,
3468
- backoffFactor: 2
3469
- }
3470
- });
3471
3718
  if (body !== void 0) {
3472
3719
  request.addBody(body);
3473
3720
  }
3474
3721
  return this.client.call(request);
3475
3722
  }
3476
- };
3477
-
3478
- // src/services/entities-service.ts
3479
- var EntitiesService = class extends BaseService {
3480
- /**
3481
- * List entities
3482
- * List all entities for the authenticated user, optionally filtered by type
3483
- * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
3484
- * @param limit - Maximum number of entities to return
3485
- * @param offset - Number of entities to skip
3486
- */
3487
- async listEntities(options) {
3488
- const request = new Request({
3489
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3490
- method: "GET",
3491
- path: "/api/entities",
3492
- config: this.config,
3493
- retry: {
3494
- attempts: 3,
3495
- delayMs: 150,
3496
- maxDelayMs: 5e3,
3497
- jitterMs: 50,
3498
- backoffFactor: 2
3499
- }
3500
- });
3501
- if (options?.type !== void 0) {
3502
- request.addQueryParam("type", {
3503
- key: "type",
3504
- value: options.type,
3505
- explode: false,
3506
- encode: true,
3507
- style: "form",
3508
- isLimit: false,
3509
- isOffset: false,
3510
- isCursor: false
3511
- });
3512
- }
3513
- if (options?.limit !== void 0) {
3514
- request.addQueryParam("limit", {
3515
- key: "limit",
3516
- value: options.limit,
3517
- explode: false,
3518
- encode: true,
3519
- style: "form",
3520
- isLimit: true,
3521
- isOffset: false,
3522
- isCursor: false
3523
- });
3524
- }
3525
- if (options?.offset !== void 0) {
3526
- request.addQueryParam("offset", {
3527
- key: "offset",
3528
- value: options.offset,
3529
- explode: false,
3530
- encode: true,
3531
- style: "form",
3532
- isLimit: false,
3533
- isOffset: true,
3534
- isCursor: false
3535
- });
3536
- }
3537
- return this.client.call(request);
3538
- }
3539
3723
  /**
3540
- * Get entity by ID
3541
- * Retrieve a specific entity by its ID
3542
- * @param id - The entity ID
3543
- */
3544
- async getEntityById(id) {
3545
- const request = new Request({
3546
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3547
- method: "GET",
3548
- path: "/api/entities/{id}",
3549
- config: this.config,
3550
- retry: {
3551
- attempts: 3,
3552
- delayMs: 150,
3553
- maxDelayMs: 5e3,
3554
- jitterMs: 50,
3555
- backoffFactor: 2
3556
- }
3557
- });
3558
- request.addPathParam("id", {
3559
- key: "id",
3560
- value: id,
3561
- explode: false,
3562
- encode: true,
3563
- style: "simple",
3564
- isLimit: false,
3565
- isOffset: false,
3566
- isCursor: false
3567
- });
3568
- return this.client.call(request);
3569
- }
3570
- /**
3571
- * Get memories mentioning entity
3572
- * Get all memories that mention a specific entity
3573
- * @param id - The entity ID
3574
- * @param limit - Maximum number of memories to return
3575
- * @param offset - Number of memories to skip
3576
- */
3577
- async getEntityMemories(id, options) {
3724
+ * Get narrative timeline
3725
+ * Get all memories in a narrative, ordered by their position in the narrative.
3726
+ Each memory includes its position and effective state.
3727
+
3728
+ * @param id - The narrative ID
3729
+ * @param limit - Maximum number of memories to return
3730
+ * @param offset - Number of memories to skip
3731
+ */
3732
+ async getNarrativeTimeline(id, options) {
3578
3733
  const request = new Request({
3579
3734
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3580
3735
  method: "GET",
3581
- path: "/api/entities/{id}/memories",
3736
+ path: "/api/narratives/{id}/timeline",
3582
3737
  config: this.config,
3583
3738
  retry: {
3584
3739
  attempts: 3,
@@ -3607,142 +3762,36 @@ var EntitiesService = class extends BaseService {
3607
3762
  style: "form",
3608
3763
  isLimit: true,
3609
3764
  isOffset: false,
3610
- isCursor: false
3611
- });
3612
- }
3613
- if (options?.offset !== void 0) {
3614
- request.addQueryParam("offset", {
3615
- key: "offset",
3616
- value: options.offset,
3617
- explode: false,
3618
- encode: true,
3619
- style: "form",
3620
- isLimit: false,
3621
- isOffset: true,
3622
- isCursor: false
3623
- });
3624
- }
3625
- return this.client.call(request);
3626
- }
3627
- /**
3628
- * Get graph health metrics
3629
- * Returns knowledge graph health metrics including entity counts, fact counts, topic counts, and extraction coverage
3630
- */
3631
- async getGraphHealth() {
3632
- const request = new Request({
3633
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3634
- method: "GET",
3635
- path: "/api/entities/health",
3636
- config: this.config,
3637
- retry: {
3638
- attempts: 3,
3639
- delayMs: 150,
3640
- maxDelayMs: 5e3,
3641
- jitterMs: 50,
3642
- backoffFactor: 2
3643
- }
3644
- });
3645
- return this.client.call(request);
3646
- }
3647
- };
3648
-
3649
- // src/services/conversations-service.ts
3650
- var ConversationsService = class extends BaseService {
3651
- /**
3652
- * List conversations
3653
- * List all conversations for the authenticated user with pagination
3654
- * @param limit - Maximum number of conversations to return
3655
- * @param offset - Number of conversations to skip
3656
- * @param since - Return only conversations created after this timestamp (ISO 8601 format)
3657
- * @param sortBy - Field to sort conversations by
3658
- * @param order - Sort order
3659
- */
3660
- async listConversations(options) {
3661
- const request = new Request({
3662
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3663
- method: "GET",
3664
- path: "/api/conversations",
3665
- config: this.config,
3666
- retry: {
3667
- attempts: 3,
3668
- delayMs: 150,
3669
- maxDelayMs: 5e3,
3670
- jitterMs: 50,
3671
- backoffFactor: 2
3672
- }
3673
- });
3674
- if (options?.limit !== void 0) {
3675
- request.addQueryParam("limit", {
3676
- key: "limit",
3677
- value: options.limit,
3678
- explode: false,
3679
- encode: true,
3680
- style: "form",
3681
- isLimit: true,
3682
- isOffset: false,
3683
- isCursor: false
3684
- });
3685
- }
3686
- if (options?.offset !== void 0) {
3687
- request.addQueryParam("offset", {
3688
- key: "offset",
3689
- value: options.offset,
3690
- explode: false,
3691
- encode: true,
3692
- style: "form",
3693
- isLimit: false,
3694
- isOffset: true,
3695
- isCursor: false
3696
- });
3697
- }
3698
- if (options?.since !== void 0) {
3699
- request.addQueryParam("since", {
3700
- key: "since",
3701
- value: options.since,
3702
- explode: false,
3703
- encode: true,
3704
- style: "form",
3705
- isLimit: false,
3706
- isOffset: false,
3707
- isCursor: false
3708
- });
3709
- }
3710
- if (options?.sortBy !== void 0) {
3711
- request.addQueryParam("sortBy", {
3712
- key: "sortBy",
3713
- value: options.sortBy,
3714
- explode: false,
3715
- encode: true,
3716
- style: "form",
3717
- isLimit: false,
3718
- isOffset: false,
3719
- isCursor: false
3720
- });
3721
- }
3722
- if (options?.order !== void 0) {
3723
- request.addQueryParam("order", {
3724
- key: "order",
3725
- value: options.order,
3765
+ isCursor: false
3766
+ });
3767
+ }
3768
+ if (options?.offset !== void 0) {
3769
+ request.addQueryParam("offset", {
3770
+ key: "offset",
3771
+ value: options.offset,
3726
3772
  explode: false,
3727
3773
  encode: true,
3728
3774
  style: "form",
3729
3775
  isLimit: false,
3730
- isOffset: false,
3776
+ isOffset: true,
3731
3777
  isCursor: false
3732
3778
  });
3733
3779
  }
3734
3780
  return this.client.call(request);
3735
3781
  }
3736
3782
  /**
3737
- * Create conversation
3738
- * Create a new conversation for the authenticated user
3739
- * @param body - Request body
3740
- */
3741
- async createConversation(body) {
3783
+ * Add a memory to a narrative
3784
+ * Add an existing memory to a narrative thread.
3785
+ Optionally specify a position to insert the memory at.
3786
+
3787
+ * @param id - The narrative ID
3788
+ * @param body - Request body
3789
+ */
3790
+ async addMemoryToNarrative(id, body) {
3742
3791
  const request = new Request({
3743
3792
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3744
3793
  method: "POST",
3745
- path: "/api/conversations",
3794
+ path: "/api/narratives/{id}/memories",
3746
3795
  config: this.config,
3747
3796
  retry: {
3748
3797
  attempts: 3,
@@ -3752,21 +3801,34 @@ var ConversationsService = class extends BaseService {
3752
3801
  backoffFactor: 2
3753
3802
  }
3754
3803
  });
3804
+ request.addPathParam("id", {
3805
+ key: "id",
3806
+ value: id,
3807
+ explode: false,
3808
+ encode: true,
3809
+ style: "simple",
3810
+ isLimit: false,
3811
+ isOffset: false,
3812
+ isCursor: false
3813
+ });
3755
3814
  if (body !== void 0) {
3756
3815
  request.addBody(body);
3757
3816
  }
3758
3817
  return this.client.call(request);
3759
3818
  }
3760
3819
  /**
3761
- * Get conversation summary
3762
- * Retrieve a conversation summary by its ID
3763
- * @param conversationId - The conversation ID
3764
- */
3765
- async getConversationSummary(conversationId) {
3820
+ * Remove a memory from a narrative
3821
+ * Remove a memory from a narrative thread.
3822
+ This does not delete the memory itself, only removes it from the narrative.
3823
+
3824
+ * @param id - The narrative ID
3825
+ * @param memoryId - The memory ID to remove
3826
+ */
3827
+ async removeMemoryFromNarrative(id, memoryId) {
3766
3828
  const request = new Request({
3767
3829
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3768
- method: "GET",
3769
- path: "/api/conversations/{conversationId}",
3830
+ method: "DELETE",
3831
+ path: "/api/narratives/{id}/memories/{memoryId}",
3770
3832
  config: this.config,
3771
3833
  retry: {
3772
3834
  attempts: 3,
@@ -3776,9 +3838,19 @@ var ConversationsService = class extends BaseService {
3776
3838
  backoffFactor: 2
3777
3839
  }
3778
3840
  });
3779
- request.addPathParam("conversationId", {
3780
- key: "conversationId",
3781
- value: conversationId,
3841
+ request.addPathParam("id", {
3842
+ key: "id",
3843
+ value: id,
3844
+ explode: false,
3845
+ encode: true,
3846
+ style: "simple",
3847
+ isLimit: false,
3848
+ isOffset: false,
3849
+ isCursor: false
3850
+ });
3851
+ request.addPathParam("memoryId", {
3852
+ key: "memoryId",
3853
+ value: memoryId,
3782
3854
  explode: false,
3783
3855
  encode: true,
3784
3856
  style: "simple",
@@ -3788,16 +3860,20 @@ var ConversationsService = class extends BaseService {
3788
3860
  });
3789
3861
  return this.client.call(request);
3790
3862
  }
3863
+ };
3864
+
3865
+ // src/services/system-service.ts
3866
+ var SystemService = class extends BaseService {
3791
3867
  /**
3792
- * Delete conversation
3793
- * Delete a conversation and soft-delete all associated memories
3794
- * @param conversationId - The conversation ID
3868
+ * Get OpenAPI specification
3869
+ * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
3870
+ * @param noCache - Bypass cache and regenerate specification
3795
3871
  */
3796
- async deleteConversation(conversationId) {
3872
+ async getOpenApiSpec(options) {
3797
3873
  const request = new Request({
3798
3874
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3799
- method: "DELETE",
3800
- path: "/api/conversations/{conversationId}",
3875
+ method: "GET",
3876
+ path: "/api/openapi.json",
3801
3877
  config: this.config,
3802
3878
  retry: {
3803
3879
  attempts: 3,
@@ -3807,28 +3883,29 @@ var ConversationsService = class extends BaseService {
3807
3883
  backoffFactor: 2
3808
3884
  }
3809
3885
  });
3810
- request.addPathParam("conversationId", {
3811
- key: "conversationId",
3812
- value: conversationId,
3813
- explode: false,
3814
- encode: true,
3815
- style: "simple",
3816
- isLimit: false,
3817
- isOffset: false,
3818
- isCursor: false
3819
- });
3886
+ if (options?.noCache !== void 0) {
3887
+ request.addQueryParam("noCache", {
3888
+ key: "noCache",
3889
+ value: options.noCache,
3890
+ explode: false,
3891
+ encode: true,
3892
+ style: "form",
3893
+ isLimit: false,
3894
+ isOffset: false,
3895
+ isCursor: false
3896
+ });
3897
+ }
3820
3898
  return this.client.call(request);
3821
3899
  }
3822
3900
  /**
3823
- * Get conversation timeline
3824
- * Get all memories in a conversation in chronological order
3825
- * @param conversationId - The conversation ID
3901
+ * Get system health status
3902
+ * Get the current health status of the system including database connectivity
3826
3903
  */
3827
- async getConversationTimeline(conversationId) {
3904
+ async getSystemHealth() {
3828
3905
  const request = new Request({
3829
3906
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3830
3907
  method: "GET",
3831
- path: "/api/conversations/{conversationId}/timeline",
3908
+ path: "/api/system/health",
3832
3909
  config: this.config,
3833
3910
  retry: {
3834
3911
  attempts: 3,
@@ -3838,28 +3915,37 @@ var ConversationsService = class extends BaseService {
3838
3915
  backoffFactor: 2
3839
3916
  }
3840
3917
  });
3841
- request.addPathParam("conversationId", {
3842
- key: "conversationId",
3843
- value: conversationId,
3844
- explode: false,
3845
- encode: true,
3846
- style: "simple",
3847
- isLimit: false,
3848
- isOffset: false,
3849
- isCursor: false
3918
+ return this.client.call(request);
3919
+ }
3920
+ /**
3921
+ * Get context status
3922
+ * Get database statistics and context information
3923
+ */
3924
+ async getContextStatus() {
3925
+ const request = new Request({
3926
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3927
+ method: "GET",
3928
+ path: "/api/system/context/status",
3929
+ config: this.config,
3930
+ retry: {
3931
+ attempts: 3,
3932
+ delayMs: 150,
3933
+ maxDelayMs: 5e3,
3934
+ jitterMs: 50,
3935
+ backoffFactor: 2
3936
+ }
3850
3937
  });
3851
3938
  return this.client.call(request);
3852
3939
  }
3853
3940
  /**
3854
- * Search conversations
3855
- * Search conversations by query string
3856
- * @param body - Request body
3941
+ * Get feature flags
3942
+ * Get all feature flags for the authenticated user
3857
3943
  */
3858
- async searchConversations(body) {
3944
+ async getFeatureFlags() {
3859
3945
  const request = new Request({
3860
3946
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3861
- method: "POST",
3862
- path: "/api/conversations/search",
3947
+ method: "GET",
3948
+ path: "/api/system/feature-flags",
3863
3949
  config: this.config,
3864
3950
  retry: {
3865
3951
  attempts: 3,
@@ -3869,21 +3955,18 @@ var ConversationsService = class extends BaseService {
3869
3955
  backoffFactor: 2
3870
3956
  }
3871
3957
  });
3872
- if (body !== void 0) {
3873
- request.addBody(body);
3874
- }
3875
3958
  return this.client.call(request);
3876
3959
  }
3877
3960
  /**
3878
- * Find conversations by topic
3879
- * Find conversations that contain a specific topic
3961
+ * Evaluate feature flag
3962
+ * Evaluate a specific feature flag for the authenticated user
3880
3963
  * @param body - Request body
3881
3964
  */
3882
- async findConversationsByTopic(body) {
3965
+ async evaluateFeatureFlag(body) {
3883
3966
  const request = new Request({
3884
3967
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3885
3968
  method: "POST",
3886
- path: "/api/conversations/by-topic",
3969
+ path: "/api/system/feature-flags/evaluate",
3887
3970
  config: this.config,
3888
3971
  retry: {
3889
3972
  attempts: 3,
@@ -3898,19 +3981,17 @@ var ConversationsService = class extends BaseService {
3898
3981
  }
3899
3982
  return this.client.call(request);
3900
3983
  }
3901
- };
3902
-
3903
- // src/services/billing-service.ts
3904
- var BillingService = class extends BaseService {
3905
3984
  /**
3906
- * Get billing overview
3907
- * Get subscription, payment method, and upcoming invoice information
3985
+ * Analyze memory quality distribution
3986
+ * Analyze the quality distribution of memories for the authenticated user
3987
+ * @param includeDetails - Include detailed pruning candidate information
3988
+ * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
3908
3989
  */
3909
- async getBillingOverview() {
3990
+ async analyzeMemoryQuality(options) {
3910
3991
  const request = new Request({
3911
3992
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3912
3993
  method: "GET",
3913
- path: "/api/billing/overview",
3994
+ path: "/api/system/memory/quality",
3914
3995
  config: this.config,
3915
3996
  retry: {
3916
3997
  attempts: 3,
@@ -3920,18 +4001,42 @@ var BillingService = class extends BaseService {
3920
4001
  backoffFactor: 2
3921
4002
  }
3922
4003
  });
4004
+ if (options?.includeDetails !== void 0) {
4005
+ request.addQueryParam("includeDetails", {
4006
+ key: "includeDetails",
4007
+ value: options.includeDetails,
4008
+ explode: false,
4009
+ encode: true,
4010
+ style: "form",
4011
+ isLimit: false,
4012
+ isOffset: false,
4013
+ isCursor: false
4014
+ });
4015
+ }
4016
+ if (options?.minQualityThreshold !== void 0) {
4017
+ request.addQueryParam("minQualityThreshold", {
4018
+ key: "minQualityThreshold",
4019
+ value: options.minQualityThreshold,
4020
+ explode: false,
4021
+ encode: true,
4022
+ style: "form",
4023
+ isLimit: false,
4024
+ isOffset: false,
4025
+ isCursor: false
4026
+ });
4027
+ }
3923
4028
  return this.client.call(request);
3924
4029
  }
3925
4030
  /**
3926
- * Create checkout session
3927
- * Create a Stripe checkout session for subscription upgrade
4031
+ * Prune low-quality memories
4032
+ * Prune (soft delete) low-quality memories for the authenticated user
3928
4033
  * @param body - Request body
3929
4034
  */
3930
- async createCheckoutSession(body) {
4035
+ async pruneMemories(options) {
3931
4036
  const request = new Request({
3932
4037
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3933
4038
  method: "POST",
3934
- path: "/api/billing/checkout",
4039
+ path: "/api/system/memory/prune",
3935
4040
  config: this.config,
3936
4041
  retry: {
3937
4042
  attempts: 3,
@@ -3941,21 +4046,26 @@ var BillingService = class extends BaseService {
3941
4046
  backoffFactor: 2
3942
4047
  }
3943
4048
  });
3944
- if (body !== void 0) {
3945
- request.addBody(body);
4049
+ if (options?.body !== void 0) {
4050
+ request.addBody(options?.body);
3946
4051
  }
3947
4052
  return this.client.call(request);
3948
4053
  }
4054
+ };
4055
+
4056
+ // src/services/patterns-service.ts
4057
+ var PatternsService = class extends BaseService {
3949
4058
  /**
3950
- * Create billing portal session
3951
- * Create a Stripe billing portal session for managing subscription
3952
- * @param body - Request body
4059
+ * List patterns
4060
+ * List all patterns for the authenticated user
4061
+ * @param limit - Maximum number of patterns to return
4062
+ * @param offset - Number of patterns to skip
3953
4063
  */
3954
- async createPortalSession(body) {
4064
+ async listPatterns(options) {
3955
4065
  const request = new Request({
3956
4066
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3957
- method: "POST",
3958
- path: "/api/billing/portal",
4067
+ method: "GET",
4068
+ path: "/api/patterns",
3959
4069
  config: this.config,
3960
4070
  retry: {
3961
4071
  attempts: 3,
@@ -3965,41 +4075,42 @@ var BillingService = class extends BaseService {
3965
4075
  backoffFactor: 2
3966
4076
  }
3967
4077
  });
3968
- if (body !== void 0) {
3969
- request.addBody(body);
4078
+ if (options?.limit !== void 0) {
4079
+ request.addQueryParam("limit", {
4080
+ key: "limit",
4081
+ value: options.limit,
4082
+ explode: false,
4083
+ encode: true,
4084
+ style: "form",
4085
+ isLimit: true,
4086
+ isOffset: false,
4087
+ isCursor: false
4088
+ });
4089
+ }
4090
+ if (options?.offset !== void 0) {
4091
+ request.addQueryParam("offset", {
4092
+ key: "offset",
4093
+ value: options.offset,
4094
+ explode: false,
4095
+ encode: true,
4096
+ style: "form",
4097
+ isLimit: false,
4098
+ isOffset: true,
4099
+ isCursor: false
4100
+ });
3970
4101
  }
3971
4102
  return this.client.call(request);
3972
4103
  }
3973
4104
  /**
3974
- * Get current subscription
3975
- * Get the current subscription details for the authenticated user
3976
- */
3977
- async getSubscription() {
3978
- const request = new Request({
3979
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3980
- method: "GET",
3981
- path: "/api/billing/subscription",
3982
- config: this.config,
3983
- retry: {
3984
- attempts: 3,
3985
- delayMs: 150,
3986
- maxDelayMs: 5e3,
3987
- jitterMs: 50,
3988
- backoffFactor: 2
3989
- }
3990
- });
3991
- return this.client.call(request);
3992
- }
3993
- /**
3994
- * Cancel subscription
3995
- * Cancel the current subscription at the end of the billing period
4105
+ * Compile patterns
4106
+ * Compile patterns from user's memories
3996
4107
  * @param body - Request body
3997
4108
  */
3998
- async cancelSubscription(options) {
4109
+ async compilePatterns(options) {
3999
4110
  const request = new Request({
4000
4111
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4001
4112
  method: "POST",
4002
- path: "/api/billing/subscription/cancel",
4113
+ path: "/api/patterns/compile",
4003
4114
  config: this.config,
4004
4115
  retry: {
4005
4116
  attempts: 3,
@@ -4015,15 +4126,15 @@ var BillingService = class extends BaseService {
4015
4126
  return this.client.call(request);
4016
4127
  }
4017
4128
  /**
4018
- * Reactivate subscription
4019
- * Reactivate a subscription that was scheduled for cancellation
4129
+ * Detect behavioral patterns
4130
+ * Run pattern detection algorithms to identify recurring behavioral patterns
4020
4131
  * @param body - Request body
4021
4132
  */
4022
- async reactivateSubscription(options) {
4133
+ async detectPatterns(options) {
4023
4134
  const request = new Request({
4024
4135
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4025
4136
  method: "POST",
4026
- path: "/api/billing/subscription/reactivate",
4137
+ path: "/api/patterns/detect",
4027
4138
  config: this.config,
4028
4139
  retry: {
4029
4140
  attempts: 3,
@@ -4039,15 +4150,15 @@ var BillingService = class extends BaseService {
4039
4150
  return this.client.call(request);
4040
4151
  }
4041
4152
  /**
4042
- * List invoices
4043
- * Get a list of invoices for the authenticated user
4044
- * @param limit - Maximum number of invoices to return
4153
+ * Analyze pattern trends
4154
+ * Analyze pattern trends, correlations, and generate insights
4155
+ * @param body - Request body
4045
4156
  */
4046
- async listInvoices(options) {
4157
+ async analyzePatterns(options) {
4047
4158
  const request = new Request({
4048
4159
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4049
- method: "GET",
4050
- path: "/api/billing/invoices",
4160
+ method: "POST",
4161
+ path: "/api/patterns/analyze",
4051
4162
  config: this.config,
4052
4163
  retry: {
4053
4164
  attempts: 3,
@@ -4057,29 +4168,22 @@ var BillingService = class extends BaseService {
4057
4168
  backoffFactor: 2
4058
4169
  }
4059
4170
  });
4060
- if (options?.limit !== void 0) {
4061
- request.addQueryParam("limit", {
4062
- key: "limit",
4063
- value: options.limit,
4064
- explode: false,
4065
- encode: true,
4066
- style: "form",
4067
- isLimit: true,
4068
- isOffset: false,
4069
- isCursor: false
4070
- });
4171
+ if (options?.body !== void 0) {
4172
+ request.addBody(options?.body);
4071
4173
  }
4072
4174
  return this.client.call(request);
4073
4175
  }
4074
4176
  /**
4075
- * List payment methods
4076
- * Get a list of payment methods for the authenticated user
4177
+ * Update pattern
4178
+ * Update an existing pattern with partial data
4179
+ * @param id - The pattern ID
4180
+ * @param body - Request body
4077
4181
  */
4078
- async listPaymentMethods() {
4182
+ async updatePattern(id, body) {
4079
4183
  const request = new Request({
4080
4184
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4081
- method: "GET",
4082
- path: "/api/billing/payment-methods",
4185
+ method: "PATCH",
4186
+ path: "/api/patterns/{id}",
4083
4187
  config: this.config,
4084
4188
  retry: {
4085
4189
  attempts: 3,
@@ -4089,19 +4193,31 @@ var BillingService = class extends BaseService {
4089
4193
  backoffFactor: 2
4090
4194
  }
4091
4195
  });
4196
+ request.addPathParam("id", {
4197
+ key: "id",
4198
+ value: id,
4199
+ explode: false,
4200
+ encode: true,
4201
+ style: "simple",
4202
+ isLimit: false,
4203
+ isOffset: false,
4204
+ isCursor: false
4205
+ });
4206
+ if (body !== void 0) {
4207
+ request.addBody(body);
4208
+ }
4092
4209
  return this.client.call(request);
4093
4210
  }
4094
4211
  /**
4095
- * Set default payment method
4096
- * Set a payment method as the default for future payments
4097
- * @param id - The payment method ID
4212
+ * Record pattern feedback
4213
+ * Record feedback on a pattern
4098
4214
  * @param body - Request body
4099
4215
  */
4100
- async setDefaultPaymentMethod(id, options) {
4216
+ async recordPatternFeedback(body) {
4101
4217
  const request = new Request({
4102
4218
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4103
4219
  method: "POST",
4104
- path: "/api/billing/payment-methods/{id}/default",
4220
+ path: "/api/patterns/feedback",
4105
4221
  config: this.config,
4106
4222
  retry: {
4107
4223
  attempts: 3,
@@ -4111,31 +4227,24 @@ var BillingService = class extends BaseService {
4111
4227
  backoffFactor: 2
4112
4228
  }
4113
4229
  });
4114
- request.addPathParam("id", {
4115
- key: "id",
4116
- value: id,
4117
- explode: false,
4118
- encode: true,
4119
- style: "simple",
4120
- isLimit: false,
4121
- isOffset: false,
4122
- isCursor: false
4123
- });
4124
- if (options?.body !== void 0) {
4125
- request.addBody(options?.body);
4230
+ if (body !== void 0) {
4231
+ request.addBody(body);
4126
4232
  }
4127
4233
  return this.client.call(request);
4128
4234
  }
4235
+ };
4236
+
4237
+ // src/services/behavior-service.ts
4238
+ var BehaviorService = class extends BaseService {
4129
4239
  /**
4130
- * Delete payment method
4131
- * Remove a payment method from the account
4132
- * @param id - The payment method ID
4240
+ * Get behavioral state
4241
+ * Get current behavioral state for the authenticated user
4133
4242
  */
4134
- async deletePaymentMethod(id) {
4243
+ async getBehavioralState() {
4135
4244
  const request = new Request({
4136
4245
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4137
- method: "DELETE",
4138
- path: "/api/billing/payment-methods/{id}",
4246
+ method: "GET",
4247
+ path: "/api/patterns/behavior/state",
4139
4248
  config: this.config,
4140
4249
  retry: {
4141
4250
  attempts: 3,
@@ -4145,28 +4254,18 @@ var BillingService = class extends BaseService {
4145
4254
  backoffFactor: 2
4146
4255
  }
4147
4256
  });
4148
- request.addPathParam("id", {
4149
- key: "id",
4150
- value: id,
4151
- explode: false,
4152
- encode: true,
4153
- style: "simple",
4154
- isLimit: false,
4155
- isOffset: false,
4156
- isCursor: false
4157
- });
4158
4257
  return this.client.call(request);
4159
4258
  }
4160
4259
  /**
4161
- * Stripe webhook endpoint
4162
- * Receive and process Stripe webhook events
4260
+ * Update behavioral state
4261
+ * Update or mutate behavioral state
4163
4262
  * @param body - Request body
4164
4263
  */
4165
- async stripeWebhook(body) {
4264
+ async updateBehavioralState(options) {
4166
4265
  const request = new Request({
4167
4266
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4168
4267
  method: "POST",
4169
- path: "/api/billing/webhooks",
4268
+ path: "/api/patterns/behavior/state",
4170
4269
  config: this.config,
4171
4270
  retry: {
4172
4271
  attempts: 3,
@@ -4176,29 +4275,28 @@ var BillingService = class extends BaseService {
4176
4275
  backoffFactor: 2
4177
4276
  }
4178
4277
  });
4179
- if (body !== void 0) {
4180
- request.addBody(body);
4278
+ if (options?.body !== void 0) {
4279
+ request.addBody(options?.body);
4181
4280
  }
4182
4281
  return this.client.call(request);
4183
4282
  }
4184
4283
  };
4185
4284
 
4186
- // src/services/artifacts-service.ts
4187
- var ArtifactsService = class extends BaseService {
4285
+ // src/services/topics-service.ts
4286
+ var TopicsService = class extends BaseService {
4188
4287
  /**
4189
- * List artifacts
4190
- * List all artifacts for the authenticated user with optional filters
4191
- * @param limit - Maximum number of artifacts to return
4192
- * @param offset - Number of artifacts to skip
4193
- * @param memoryId - Filter by memory ID
4194
- * @param conversationId - Filter by conversation ID
4195
- * @param type - Filter by artifact type
4288
+ * List topics
4289
+ * List all topics with pagination
4290
+ * @param limit - Maximum number of topics to return
4291
+ * @param offset - Number of topics to skip
4292
+ * @param sortBy - Field to sort topics by
4293
+ * @param order - Sort order
4196
4294
  */
4197
- async listArtifacts(options) {
4295
+ async listTopics(options) {
4198
4296
  const request = new Request({
4199
4297
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4200
4298
  method: "GET",
4201
- path: "/api/artifacts",
4299
+ path: "/api/topics",
4202
4300
  config: this.config,
4203
4301
  retry: {
4204
4302
  attempts: 3,
@@ -4232,22 +4330,10 @@ var ArtifactsService = class extends BaseService {
4232
4330
  isCursor: false
4233
4331
  });
4234
4332
  }
4235
- if (options?.memoryId !== void 0) {
4236
- request.addQueryParam("memoryId", {
4237
- key: "memoryId",
4238
- value: options.memoryId,
4239
- explode: false,
4240
- encode: true,
4241
- style: "form",
4242
- isLimit: false,
4243
- isOffset: false,
4244
- isCursor: false
4245
- });
4246
- }
4247
- if (options?.conversationId !== void 0) {
4248
- request.addQueryParam("conversationId", {
4249
- key: "conversationId",
4250
- value: options.conversationId,
4333
+ if (options?.sortBy !== void 0) {
4334
+ request.addQueryParam("sortBy", {
4335
+ key: "sortBy",
4336
+ value: options.sortBy,
4251
4337
  explode: false,
4252
4338
  encode: true,
4253
4339
  style: "form",
@@ -4256,10 +4342,10 @@ var ArtifactsService = class extends BaseService {
4256
4342
  isCursor: false
4257
4343
  });
4258
4344
  }
4259
- if (options?.type !== void 0) {
4260
- request.addQueryParam("type", {
4261
- key: "type",
4262
- value: options.type,
4345
+ if (options?.order !== void 0) {
4346
+ request.addQueryParam("order", {
4347
+ key: "order",
4348
+ value: options.order,
4263
4349
  explode: false,
4264
4350
  encode: true,
4265
4351
  style: "form",
@@ -4271,15 +4357,46 @@ var ArtifactsService = class extends BaseService {
4271
4357
  return this.client.call(request);
4272
4358
  }
4273
4359
  /**
4274
- * Create artifact
4275
- * Create a new artifact for the authenticated user
4360
+ * Get topic by ID
4361
+ * Retrieve a specific topic by its ID
4362
+ * @param id - The topic ID
4363
+ */
4364
+ async getTopicById(id) {
4365
+ const request = new Request({
4366
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
4367
+ method: "GET",
4368
+ path: "/api/topics/{id}",
4369
+ config: this.config,
4370
+ retry: {
4371
+ attempts: 3,
4372
+ delayMs: 150,
4373
+ maxDelayMs: 5e3,
4374
+ jitterMs: 50,
4375
+ backoffFactor: 2
4376
+ }
4377
+ });
4378
+ request.addPathParam("id", {
4379
+ key: "id",
4380
+ value: id,
4381
+ explode: false,
4382
+ encode: true,
4383
+ style: "simple",
4384
+ isLimit: false,
4385
+ isOffset: false,
4386
+ isCursor: false
4387
+ });
4388
+ return this.client.call(request);
4389
+ }
4390
+ /**
4391
+ * Merge topics
4392
+ * Merge two topics into one
4276
4393
  * @param body - Request body
4277
4394
  */
4278
- async createArtifact(body) {
4395
+ async mergeTopics(body) {
4279
4396
  const request = new Request({
4280
4397
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4281
4398
  method: "POST",
4282
- path: "/api/artifacts",
4399
+ path: "/api/topics/merge",
4283
4400
  config: this.config,
4284
4401
  retry: {
4285
4402
  attempts: 3,
@@ -4295,15 +4412,15 @@ var ArtifactsService = class extends BaseService {
4295
4412
  return this.client.call(request);
4296
4413
  }
4297
4414
  /**
4298
- * Get artifact by ID
4299
- * Retrieve a specific artifact by its ID
4300
- * @param id - The artifact ID
4415
+ * Discover related topics
4416
+ * Discover topics related to a given topic
4417
+ * @param body - Request body
4301
4418
  */
4302
- async getArtifactById(id) {
4419
+ async discoverRelatedTopics(body) {
4303
4420
  const request = new Request({
4304
4421
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4305
- method: "GET",
4306
- path: "/api/artifacts/{id}",
4422
+ method: "POST",
4423
+ path: "/api/topics/discover-related",
4307
4424
  config: this.config,
4308
4425
  retry: {
4309
4426
  attempts: 3,
@@ -4313,28 +4430,21 @@ var ArtifactsService = class extends BaseService {
4313
4430
  backoffFactor: 2
4314
4431
  }
4315
4432
  });
4316
- request.addPathParam("id", {
4317
- key: "id",
4318
- value: id,
4319
- explode: false,
4320
- encode: true,
4321
- style: "simple",
4322
- isLimit: false,
4323
- isOffset: false,
4324
- isCursor: false
4325
- });
4433
+ if (body !== void 0) {
4434
+ request.addBody(body);
4435
+ }
4326
4436
  return this.client.call(request);
4327
4437
  }
4328
4438
  /**
4329
- * Delete artifact
4330
- * Delete an artifact by its ID
4331
- * @param id - The artifact ID
4439
+ * Calculate topic similarity
4440
+ * Calculate similarity score between two topics
4441
+ * @param body - Request body
4332
4442
  */
4333
- async deleteArtifact(id) {
4443
+ async calculateTopicSimilarity(body) {
4334
4444
  const request = new Request({
4335
4445
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4336
- method: "DELETE",
4337
- path: "/api/artifacts/{id}",
4446
+ method: "POST",
4447
+ path: "/api/topics/similarity",
4338
4448
  config: this.config,
4339
4449
  retry: {
4340
4450
  attempts: 3,
@@ -4344,29 +4454,21 @@ var ArtifactsService = class extends BaseService {
4344
4454
  backoffFactor: 2
4345
4455
  }
4346
4456
  });
4347
- request.addPathParam("id", {
4348
- key: "id",
4349
- value: id,
4350
- explode: false,
4351
- encode: true,
4352
- style: "simple",
4353
- isLimit: false,
4354
- isOffset: false,
4355
- isCursor: false
4356
- });
4457
+ if (body !== void 0) {
4458
+ request.addBody(body);
4459
+ }
4357
4460
  return this.client.call(request);
4358
4461
  }
4359
4462
  /**
4360
- * Update artifact
4361
- * Update an existing artifact with partial data
4362
- * @param id - The artifact ID
4463
+ * Find similar topics
4464
+ * Find topics similar to a given topic
4363
4465
  * @param body - Request body
4364
4466
  */
4365
- async updateArtifact(id, body) {
4467
+ async findSimilarTopics(body) {
4366
4468
  const request = new Request({
4367
4469
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4368
- method: "PATCH",
4369
- path: "/api/artifacts/{id}",
4470
+ method: "POST",
4471
+ path: "/api/topics/similar",
4370
4472
  config: this.config,
4371
4473
  retry: {
4372
4474
  attempts: 3,
@@ -4376,34 +4478,21 @@ var ArtifactsService = class extends BaseService {
4376
4478
  backoffFactor: 2
4377
4479
  }
4378
4480
  });
4379
- request.addPathParam("id", {
4380
- key: "id",
4381
- value: id,
4382
- explode: false,
4383
- encode: true,
4384
- style: "simple",
4385
- isLimit: false,
4386
- isOffset: false,
4387
- isCursor: false
4388
- });
4389
4481
  if (body !== void 0) {
4390
4482
  request.addBody(body);
4391
4483
  }
4392
4484
  return this.client.call(request);
4393
4485
  }
4394
- };
4395
-
4396
- // src/services/api-keys-service.ts
4397
- var ApiKeysService = class extends BaseService {
4398
4486
  /**
4399
- * Get user information for current API key
4400
- * Debug endpoint to retrieve user ID and authentication method from the current API key
4487
+ * Cluster topics
4488
+ * Cluster topics using community detection algorithms
4489
+ * @param body - Request body
4401
4490
  */
4402
- async debugUser() {
4491
+ async clusterTopics(options) {
4403
4492
  const request = new Request({
4404
4493
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4405
- method: "GET",
4406
- path: "/api/apikeys/debug-user",
4494
+ method: "POST",
4495
+ path: "/api/topics/cluster",
4407
4496
  config: this.config,
4408
4497
  retry: {
4409
4498
  attempts: 3,
@@ -4413,17 +4502,21 @@ var ApiKeysService = class extends BaseService {
4413
4502
  backoffFactor: 2
4414
4503
  }
4415
4504
  });
4505
+ if (options?.body !== void 0) {
4506
+ request.addBody(options?.body);
4507
+ }
4416
4508
  return this.client.call(request);
4417
4509
  }
4418
4510
  /**
4419
- * List API keys
4420
- * List all API keys for the authenticated user
4511
+ * Detect communities
4512
+ * Detect communities in the topic graph using specified algorithm
4513
+ * @param body - Request body
4421
4514
  */
4422
- async listApiKeys() {
4515
+ async detectCommunities(options) {
4423
4516
  const request = new Request({
4424
4517
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4425
- method: "GET",
4426
- path: "/api/apikeys",
4518
+ method: "POST",
4519
+ path: "/api/topics/detect-communities",
4427
4520
  config: this.config,
4428
4521
  retry: {
4429
4522
  attempts: 3,
@@ -4433,18 +4526,21 @@ var ApiKeysService = class extends BaseService {
4433
4526
  backoffFactor: 2
4434
4527
  }
4435
4528
  });
4529
+ if (options?.body !== void 0) {
4530
+ request.addBody(options?.body);
4531
+ }
4436
4532
  return this.client.call(request);
4437
4533
  }
4438
4534
  /**
4439
- * Create API key
4440
- * Create a new API key for the authenticated user
4535
+ * Search topics
4536
+ * Search topics by query string using fulltext search
4441
4537
  * @param body - Request body
4442
4538
  */
4443
- async createApiKey(options) {
4539
+ async searchTopics(body) {
4444
4540
  const request = new Request({
4445
4541
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4446
4542
  method: "POST",
4447
- path: "/api/apikeys",
4543
+ path: "/api/topics/search",
4448
4544
  config: this.config,
4449
4545
  retry: {
4450
4546
  attempts: 3,
@@ -4454,21 +4550,30 @@ var ApiKeysService = class extends BaseService {
4454
4550
  backoffFactor: 2
4455
4551
  }
4456
4552
  });
4457
- if (options?.body !== void 0) {
4458
- request.addBody(options?.body);
4553
+ if (body !== void 0) {
4554
+ request.addBody(body);
4459
4555
  }
4460
4556
  return this.client.call(request);
4461
4557
  }
4558
+ };
4559
+
4560
+ // src/services/users-service.ts
4561
+ var UsersService = class extends BaseService {
4462
4562
  /**
4463
- * Delete API key
4464
- * Delete (revoke) an API key by its ID
4465
- * @param id - The API key ID
4466
- */
4467
- async deleteApiKey(id) {
4563
+ * Sync user from WorkOS
4564
+ * Called by the customer portal after WorkOS authentication.
4565
+ Creates a new user if they don't exist, or updates their profile if they do.
4566
+ This is the main entry point for user provisioning.
4567
+ When the invite gate is closed and a new user is created, the inviteCode
4568
+ is redeemed atomically to track which code was used for registration.
4569
+
4570
+ * @param body - Request body
4571
+ */
4572
+ async syncUser(body) {
4468
4573
  const request = new Request({
4469
4574
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4470
- method: "DELETE",
4471
- path: "/api/apikeys/{id}",
4575
+ method: "POST",
4576
+ path: "/api/users/sync",
4472
4577
  config: this.config,
4473
4578
  retry: {
4474
4579
  attempts: 3,
@@ -4478,34 +4583,20 @@ var ApiKeysService = class extends BaseService {
4478
4583
  backoffFactor: 2
4479
4584
  }
4480
4585
  });
4481
- request.addPathParam("id", {
4482
- key: "id",
4483
- value: id,
4484
- explode: false,
4485
- encode: true,
4486
- style: "simple",
4487
- isLimit: false,
4488
- isOffset: false,
4489
- isCursor: false
4490
- });
4586
+ if (body !== void 0) {
4587
+ request.addBody(body);
4588
+ }
4491
4589
  return this.client.call(request);
4492
4590
  }
4493
- };
4494
-
4495
- // src/services/admin-service.ts
4496
- var AdminService = class extends BaseService {
4497
4591
  /**
4498
- * List invite codes
4499
- * List all invite codes with optional status filter
4500
- * @param status - Filter by status
4501
- * @param limit -
4502
- * @param offset -
4592
+ * Get current user
4593
+ * Get the currently authenticated user's profile and usage information
4503
4594
  */
4504
- async adminListInviteCodes(options) {
4595
+ async getCurrentUser() {
4505
4596
  const request = new Request({
4506
4597
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4507
4598
  method: "GET",
4508
- path: "/api/admin/invites",
4599
+ path: "/api/users/me",
4509
4600
  config: this.config,
4510
4601
  retry: {
4511
4602
  attempts: 3,
@@ -4515,54 +4606,18 @@ var AdminService = class extends BaseService {
4515
4606
  backoffFactor: 2
4516
4607
  }
4517
4608
  });
4518
- if (options?.status !== void 0) {
4519
- request.addQueryParam("status", {
4520
- key: "status",
4521
- value: options.status,
4522
- explode: false,
4523
- encode: true,
4524
- style: "form",
4525
- isLimit: false,
4526
- isOffset: false,
4527
- isCursor: false
4528
- });
4529
- }
4530
- if (options?.limit !== void 0) {
4531
- request.addQueryParam("limit", {
4532
- key: "limit",
4533
- value: options.limit,
4534
- explode: false,
4535
- encode: true,
4536
- style: "form",
4537
- isLimit: true,
4538
- isOffset: false,
4539
- isCursor: false
4540
- });
4541
- }
4542
- if (options?.offset !== void 0) {
4543
- request.addQueryParam("offset", {
4544
- key: "offset",
4545
- value: options.offset,
4546
- explode: false,
4547
- encode: true,
4548
- style: "form",
4549
- isLimit: false,
4550
- isOffset: true,
4551
- isCursor: false
4552
- });
4553
- }
4554
4609
  return this.client.call(request);
4555
4610
  }
4556
4611
  /**
4557
- * Create invite code
4558
- * Create a new invite code for the gated preview
4612
+ * Update current user
4613
+ * Update the currently authenticated user's profile
4559
4614
  * @param body - Request body
4560
4615
  */
4561
- async adminCreateInviteCode(body) {
4616
+ async updateCurrentUser(options) {
4562
4617
  const request = new Request({
4563
4618
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4564
- method: "POST",
4565
- path: "/api/admin/invites",
4619
+ method: "PATCH",
4620
+ path: "/api/users/me",
4566
4621
  config: this.config,
4567
4622
  retry: {
4568
4623
  attempts: 3,
@@ -4572,20 +4627,20 @@ var AdminService = class extends BaseService {
4572
4627
  backoffFactor: 2
4573
4628
  }
4574
4629
  });
4575
- if (body !== void 0) {
4576
- request.addBody(body);
4630
+ if (options?.body !== void 0) {
4631
+ request.addBody(options?.body);
4577
4632
  }
4578
4633
  return this.client.call(request);
4579
4634
  }
4580
4635
  /**
4581
- * Get invite system statistics
4582
- * Aggregate statistics for the invite system
4636
+ * Get current user's usage
4637
+ * Get the currently authenticated user's memory usage statistics
4583
4638
  */
4584
- async adminGetInviteStats() {
4639
+ async getCurrentUserUsage() {
4585
4640
  const request = new Request({
4586
4641
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4587
4642
  method: "GET",
4588
- path: "/api/admin/invites/stats",
4643
+ path: "/api/users/me/usage",
4589
4644
  config: this.config,
4590
4645
  retry: {
4591
4646
  attempts: 3,
@@ -4598,15 +4653,18 @@ var AdminService = class extends BaseService {
4598
4653
  return this.client.call(request);
4599
4654
  }
4600
4655
  /**
4601
- * Get invite code details
4602
- * Get details for a single invite code including redemptions
4603
- * @param code - The invite code
4604
- */
4605
- async adminGetInviteCode(code) {
4656
+ * Export all user data
4657
+ * Export all user data as a JSON archive. Includes profile, memories,
4658
+ conversations, facts, and patterns. Supports GDPR Article 20
4659
+ (right to data portability). Sensitive fields (Stripe customer ID,
4660
+ WorkOS ID, embeddings) are excluded.
4661
+
4662
+ */
4663
+ async exportUserData() {
4606
4664
  const request = new Request({
4607
4665
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4608
4666
  method: "GET",
4609
- path: "/api/admin/invites/{code}",
4667
+ path: "/api/users/me/export",
4610
4668
  config: this.config,
4611
4669
  retry: {
4612
4670
  attempts: 3,
@@ -4616,28 +4674,21 @@ var AdminService = class extends BaseService {
4616
4674
  backoffFactor: 2
4617
4675
  }
4618
4676
  });
4619
- request.addPathParam("code", {
4620
- key: "code",
4621
- value: code,
4622
- explode: false,
4623
- encode: true,
4624
- style: "simple",
4625
- isLimit: false,
4626
- isOffset: false,
4627
- isCursor: false
4628
- });
4629
4677
  return this.client.call(request);
4630
4678
  }
4631
4679
  /**
4632
- * Revoke an invite code
4633
- * Revoke an invite code. Existing accounts created with this code are unaffected.
4634
- * @param code -
4635
- */
4636
- async adminRevokeInviteCode(code) {
4680
+ * Initiate account deletion
4681
+ * Schedule the current user's account for deletion after a 7-day grace period.
4682
+ Requires email confirmation. Immediately revokes API keys and cancels
4683
+ any active subscription. The account enters read-only mode.
4684
+
4685
+ * @param body - Request body
4686
+ */
4687
+ async initiateAccountDeletion(body) {
4637
4688
  const request = new Request({
4638
4689
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4639
- method: "DELETE",
4640
- path: "/api/admin/invites/{code}",
4690
+ method: "POST",
4691
+ path: "/api/users/me/deletion",
4641
4692
  config: this.config,
4642
4693
  retry: {
4643
4694
  attempts: 3,
@@ -4647,27 +4698,23 @@ var AdminService = class extends BaseService {
4647
4698
  backoffFactor: 2
4648
4699
  }
4649
4700
  });
4650
- request.addPathParam("code", {
4651
- key: "code",
4652
- value: code,
4653
- explode: false,
4654
- encode: true,
4655
- style: "simple",
4656
- isLimit: false,
4657
- isOffset: false,
4658
- isCursor: false
4659
- });
4701
+ if (body !== void 0) {
4702
+ request.addBody(body);
4703
+ }
4660
4704
  return this.client.call(request);
4661
4705
  }
4662
4706
  /**
4663
- * Get gate status with audit info
4664
- * Get current invite gate state with audit information
4665
- */
4666
- async adminGetGateStatus() {
4707
+ * Cancel account deletion
4708
+ * Cancel a pending account deletion during the grace period.
4709
+ Note: Previously revoked API keys are not restored — new keys must be created.
4710
+ Stripe subscription may need manual reactivation via the billing portal.
4711
+
4712
+ */
4713
+ async cancelAccountDeletion() {
4667
4714
  const request = new Request({
4668
4715
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4669
- method: "GET",
4670
- path: "/api/admin/gate",
4716
+ method: "DELETE",
4717
+ path: "/api/users/me/deletion",
4671
4718
  config: this.config,
4672
4719
  retry: {
4673
4720
  attempts: 3,
@@ -4680,17 +4727,15 @@ var AdminService = class extends BaseService {
4680
4727
  return this.client.call(request);
4681
4728
  }
4682
4729
  /**
4683
- * Toggle invite gate
4684
- * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
4685
- When disabled (false), registration is open. Takes effect immediately.
4686
-
4687
- * @param body - Request body
4688
- */
4689
- async adminSetGateStatus(body) {
4730
+ * Get user by ID
4731
+ * Get a user by their internal ID (admin only)
4732
+ * @param id -
4733
+ */
4734
+ async getUserById(id) {
4690
4735
  const request = new Request({
4691
4736
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4692
- method: "POST",
4693
- path: "/api/admin/gate",
4737
+ method: "GET",
4738
+ path: "/api/users/{id}",
4694
4739
  config: this.config,
4695
4740
  retry: {
4696
4741
  attempts: 3,
@@ -4700,44 +4745,20 @@ var AdminService = class extends BaseService {
4700
4745
  backoffFactor: 2
4701
4746
  }
4702
4747
  });
4703
- if (body !== void 0) {
4704
- request.addBody(body);
4705
- }
4748
+ request.addPathParam("id", {
4749
+ key: "id",
4750
+ value: id,
4751
+ explode: false,
4752
+ encode: true,
4753
+ style: "simple",
4754
+ isLimit: false,
4755
+ isOffset: false,
4756
+ isCursor: false
4757
+ });
4706
4758
  return this.client.call(request);
4707
4759
  }
4708
4760
  };
4709
4761
 
4710
- // src/http/http-types.ts
4711
- var SerializationStyle = /* @__PURE__ */ ((SerializationStyle2) => {
4712
- SerializationStyle2["SIMPLE"] = "simple";
4713
- SerializationStyle2["LABEL"] = "label";
4714
- SerializationStyle2["MATRIX"] = "matrix";
4715
- SerializationStyle2["FORM"] = "form";
4716
- SerializationStyle2["SPACE_DELIMITED"] = "space_delimited";
4717
- SerializationStyle2["PIPE_DELIMITED"] = "pipe_delimited";
4718
- SerializationStyle2["DEEP_OBJECT"] = "deep_object";
4719
- SerializationStyle2["NONE"] = "none";
4720
- return SerializationStyle2;
4721
- })(SerializationStyle || {});
4722
- var ContentType = /* @__PURE__ */ ((ContentType2) => {
4723
- ContentType2["Json"] = "json";
4724
- ContentType2["Xml"] = "xml";
4725
- ContentType2["Pdf"] = "pdf";
4726
- ContentType2["Image"] = "image";
4727
- ContentType2["File"] = "file";
4728
- ContentType2["Binary"] = "binary";
4729
- ContentType2["FormUrlEncoded"] = "form";
4730
- ContentType2["Text"] = "text";
4731
- ContentType2["MultipartFormData"] = "multipartFormData";
4732
- ContentType2["EventStream"] = "eventStream";
4733
- ContentType2["NoContent"] = "noContent";
4734
- return ContentType2;
4735
- })(ContentType || {});
4736
- var Environment = /* @__PURE__ */ ((Environment2) => {
4737
- Environment2["DEFAULT"] = "http://localhost:3000";
4738
- return Environment2;
4739
- })(Environment || {});
4740
-
4741
4762
  // src/models/schemas.ts
4742
4763
  import { z } from "zod";
4743
4764
  var error = z.object({
@@ -5953,42 +5974,42 @@ var buildContextResponse = z.lazy(() => z.object({
5953
5974
  // src/index.ts
5954
5975
  var Memnexus = class {
5955
5976
  config;
5956
- /** User management and profile endpoints operations */
5957
- users;
5958
- /** Topic detection, clustering, and management endpoints operations */
5959
- topics;
5977
+ /** Admin management endpoints for invite codes and platform configuration operations */
5978
+ admin;
5979
+ /** API key management endpoints operations */
5980
+ apiKeys;
5981
+ /** Artifact storage and retrieval endpoints operations */
5982
+ artifacts;
5983
+ /** Subscription billing and payment management endpoints operations */
5984
+ billing;
5985
+ /** Conversation tracking and analysis endpoints operations */
5986
+ conversations;
5987
+ /** Entity extraction and discovery endpoints operations */
5988
+ entities;
5989
+ /** Fact extraction and management endpoints operations */
5990
+ facts;
5991
+ /** Graph-based retrieval augmented generation endpoints operations */
5992
+ graphrag;
5993
+ /** Health check endpoints operations */
5994
+ health;
5995
+ /** Invite code validation and gate status endpoints operations */
5996
+ invites;
5997
+ /** Memory management and retrieval endpoints operations */
5998
+ memories;
5999
+ /** Observability and metrics endpoints for production monitoring operations */
6000
+ monitoring;
6001
+ /** Narrative thread management endpoints operations */
6002
+ narratives;
5960
6003
  /** System health, monitoring, and configuration endpoints operations */
5961
6004
  system;
5962
6005
  /** Pattern detection and behavioral analysis endpoints operations */
5963
6006
  patterns;
5964
6007
  /** Behavioral pattern tracking and state management endpoints operations */
5965
6008
  behavior;
5966
- /** Narrative thread management endpoints operations */
5967
- narratives;
5968
- /** Observability and metrics endpoints for production monitoring operations */
5969
- monitoring;
5970
- /** Memory management and retrieval endpoints operations */
5971
- memories;
5972
- /** Invite code validation and gate status endpoints operations */
5973
- invites;
5974
- /** Health check endpoints operations */
5975
- health;
5976
- /** Graph-based retrieval augmented generation endpoints operations */
5977
- graphrag;
5978
- /** Fact extraction and management endpoints operations */
5979
- facts;
5980
- /** Entity extraction and discovery endpoints operations */
5981
- entities;
5982
- /** Conversation tracking and analysis endpoints operations */
5983
- conversations;
5984
- /** Subscription billing and payment management endpoints operations */
5985
- billing;
5986
- /** Artifact storage and retrieval endpoints operations */
5987
- artifacts;
5988
- /** API key management endpoints operations */
5989
- apiKeys;
5990
- /** Admin management endpoints for invite codes and platform configuration operations */
5991
- admin;
6009
+ /** Topic detection, clustering, and management endpoints operations */
6010
+ topics;
6011
+ /** User management and profile endpoints operations */
6012
+ users;
5992
6013
  /**
5993
6014
  * Create a new SDK client.
5994
6015
  * @param config - SDK configuration
@@ -5998,24 +6019,24 @@ var Memnexus = class {
5998
6019
  baseUrl: config.baseUrl || "http://localhost:3000",
5999
6020
  ...config
6000
6021
  };
6001
- this.users = new UsersService(this.config);
6002
- this.topics = new TopicsService(this.config);
6022
+ this.admin = new AdminService(this.config);
6023
+ this.apiKeys = new ApiKeysService(this.config);
6024
+ this.artifacts = new ArtifactsService(this.config);
6025
+ this.billing = new BillingService(this.config);
6026
+ this.conversations = new ConversationsService(this.config);
6027
+ this.entities = new EntitiesService(this.config);
6028
+ this.facts = new FactsService(this.config);
6029
+ this.graphrag = new GraphragService(this.config);
6030
+ this.health = new HealthService(this.config);
6031
+ this.invites = new InvitesService(this.config);
6032
+ this.memories = new MemoriesService(this.config);
6033
+ this.monitoring = new MonitoringService(this.config);
6034
+ this.narratives = new NarrativesService(this.config);
6003
6035
  this.system = new SystemService(this.config);
6004
6036
  this.patterns = new PatternsService(this.config);
6005
6037
  this.behavior = new BehaviorService(this.config);
6006
- this.narratives = new NarrativesService(this.config);
6007
- this.monitoring = new MonitoringService(this.config);
6008
- this.memories = new MemoriesService(this.config);
6009
- this.invites = new InvitesService(this.config);
6010
- this.health = new HealthService(this.config);
6011
- this.graphrag = new GraphragService(this.config);
6012
- this.facts = new FactsService(this.config);
6013
- this.entities = new EntitiesService(this.config);
6014
- this.conversations = new ConversationsService(this.config);
6015
- this.billing = new BillingService(this.config);
6016
- this.artifacts = new ArtifactsService(this.config);
6017
- this.apiKeys = new ApiKeysService(this.config);
6018
- this.admin = new AdminService(this.config);
6038
+ this.topics = new TopicsService(this.config);
6039
+ this.users = new UsersService(this.config);
6019
6040
  }
6020
6041
  /**
6021
6042
  * Set the API token for authentication.
@@ -6023,24 +6044,24 @@ var Memnexus = class {
6023
6044
  */
6024
6045
  setToken(token) {
6025
6046
  this.config.token = token;
6026
- this.users.token = token;
6027
- this.topics.token = token;
6047
+ this.admin.token = token;
6048
+ this.apiKeys.token = token;
6049
+ this.artifacts.token = token;
6050
+ this.billing.token = token;
6051
+ this.conversations.token = token;
6052
+ this.entities.token = token;
6053
+ this.facts.token = token;
6054
+ this.graphrag.token = token;
6055
+ this.health.token = token;
6056
+ this.invites.token = token;
6057
+ this.memories.token = token;
6058
+ this.monitoring.token = token;
6059
+ this.narratives.token = token;
6028
6060
  this.system.token = token;
6029
6061
  this.patterns.token = token;
6030
6062
  this.behavior.token = token;
6031
- this.narratives.token = token;
6032
- this.monitoring.token = token;
6033
- this.memories.token = token;
6034
- this.invites.token = token;
6035
- this.health.token = token;
6036
- this.graphrag.token = token;
6037
- this.facts.token = token;
6038
- this.entities.token = token;
6039
- this.conversations.token = token;
6040
- this.billing.token = token;
6041
- this.artifacts.token = token;
6042
- this.apiKeys.token = token;
6043
- this.admin.token = token;
6063
+ this.topics.token = token;
6064
+ this.users.token = token;
6044
6065
  }
6045
6066
  /**
6046
6067
  * Set the base URL for API requests.
@@ -6048,24 +6069,24 @@ var Memnexus = class {
6048
6069
  */
6049
6070
  setBaseUrl(baseUrl) {
6050
6071
  this.config.baseUrl = baseUrl;
6051
- this.users.baseUrl = baseUrl;
6052
- this.topics.baseUrl = baseUrl;
6072
+ this.admin.baseUrl = baseUrl;
6073
+ this.apiKeys.baseUrl = baseUrl;
6074
+ this.artifacts.baseUrl = baseUrl;
6075
+ this.billing.baseUrl = baseUrl;
6076
+ this.conversations.baseUrl = baseUrl;
6077
+ this.entities.baseUrl = baseUrl;
6078
+ this.facts.baseUrl = baseUrl;
6079
+ this.graphrag.baseUrl = baseUrl;
6080
+ this.health.baseUrl = baseUrl;
6081
+ this.invites.baseUrl = baseUrl;
6082
+ this.memories.baseUrl = baseUrl;
6083
+ this.monitoring.baseUrl = baseUrl;
6084
+ this.narratives.baseUrl = baseUrl;
6053
6085
  this.system.baseUrl = baseUrl;
6054
6086
  this.patterns.baseUrl = baseUrl;
6055
6087
  this.behavior.baseUrl = baseUrl;
6056
- this.narratives.baseUrl = baseUrl;
6057
- this.monitoring.baseUrl = baseUrl;
6058
- this.memories.baseUrl = baseUrl;
6059
- this.invites.baseUrl = baseUrl;
6060
- this.health.baseUrl = baseUrl;
6061
- this.graphrag.baseUrl = baseUrl;
6062
- this.facts.baseUrl = baseUrl;
6063
- this.entities.baseUrl = baseUrl;
6064
- this.conversations.baseUrl = baseUrl;
6065
- this.billing.baseUrl = baseUrl;
6066
- this.artifacts.baseUrl = baseUrl;
6067
- this.apiKeys.baseUrl = baseUrl;
6068
- this.admin.baseUrl = baseUrl;
6088
+ this.topics.baseUrl = baseUrl;
6089
+ this.users.baseUrl = baseUrl;
6069
6090
  }
6070
6091
  /**
6071
6092
  * Set the environment.
@@ -6073,24 +6094,24 @@ var Memnexus = class {
6073
6094
  */
6074
6095
  setEnvironment(environment) {
6075
6096
  this.config.environment = environment;
6076
- this.users.environment = environment;
6077
- this.topics.environment = environment;
6097
+ this.admin.environment = environment;
6098
+ this.apiKeys.environment = environment;
6099
+ this.artifacts.environment = environment;
6100
+ this.billing.environment = environment;
6101
+ this.conversations.environment = environment;
6102
+ this.entities.environment = environment;
6103
+ this.facts.environment = environment;
6104
+ this.graphrag.environment = environment;
6105
+ this.health.environment = environment;
6106
+ this.invites.environment = environment;
6107
+ this.memories.environment = environment;
6108
+ this.monitoring.environment = environment;
6109
+ this.narratives.environment = environment;
6078
6110
  this.system.environment = environment;
6079
6111
  this.patterns.environment = environment;
6080
6112
  this.behavior.environment = environment;
6081
- this.narratives.environment = environment;
6082
- this.monitoring.environment = environment;
6083
- this.memories.environment = environment;
6084
- this.invites.environment = environment;
6085
- this.health.environment = environment;
6086
- this.graphrag.environment = environment;
6087
- this.facts.environment = environment;
6088
- this.entities.environment = environment;
6089
- this.conversations.environment = environment;
6090
- this.billing.environment = environment;
6091
- this.artifacts.environment = environment;
6092
- this.apiKeys.environment = environment;
6093
- this.admin.environment = environment;
6113
+ this.topics.environment = environment;
6114
+ this.users.environment = environment;
6094
6115
  }
6095
6116
  };
6096
6117
  var index_default = Memnexus;
@@ -6113,6 +6134,7 @@ export {
6113
6134
  MonitoringService,
6114
6135
  NarrativesService,
6115
6136
  PatternsService,
6137
+ SdkError,
6116
6138
  SerializationStyle,
6117
6139
  SystemService,
6118
6140
  TopicsService,