@memnexus-ai/typescript-sdk 1.42.12 → 1.42.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -432,77 +432,23 @@ function serializeQueryParam(key, param) {
432
432
  return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;
433
433
  }
434
434
 
435
- // src/services/admin-service.ts
436
- var AdminService = class extends BaseService {
437
- /**
438
- * List invite codes
439
- * List all invite codes with optional status filter
440
- * @param status - Filter by status
441
- * @param limit -
442
- * @param offset -
443
- */
444
- async adminListInviteCodes(options) {
445
- const request = new Request({
446
- baseUrl: this.config.baseUrl || "http://localhost:3000",
447
- method: "GET",
448
- path: "/api/admin/invites",
449
- config: this.config,
450
- retry: {
451
- attempts: 3,
452
- delayMs: 150,
453
- maxDelayMs: 5e3,
454
- jitterMs: 50,
455
- backoffFactor: 2
456
- }
457
- });
458
- if (options?.status !== void 0) {
459
- request.addQueryParam("status", {
460
- key: "status",
461
- value: options.status,
462
- explode: false,
463
- encode: true,
464
- style: "form",
465
- isLimit: false,
466
- isOffset: false,
467
- isCursor: false
468
- });
469
- }
470
- if (options?.limit !== void 0) {
471
- request.addQueryParam("limit", {
472
- key: "limit",
473
- value: options.limit,
474
- explode: false,
475
- encode: true,
476
- style: "form",
477
- isLimit: true,
478
- isOffset: false,
479
- isCursor: false
480
- });
481
- }
482
- if (options?.offset !== void 0) {
483
- request.addQueryParam("offset", {
484
- key: "offset",
485
- value: options.offset,
486
- explode: false,
487
- encode: true,
488
- style: "form",
489
- isLimit: false,
490
- isOffset: true,
491
- isCursor: false
492
- });
493
- }
494
- return this.client.call(request);
495
- }
435
+ // src/services/users-service.ts
436
+ var UsersService = class extends BaseService {
496
437
  /**
497
- * Create invite code
498
- * Create a new invite code for the gated preview
499
- * @param body - Request body
500
- */
501
- async adminCreateInviteCode(body) {
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) {
502
448
  const request = new Request({
503
449
  baseUrl: this.config.baseUrl || "http://localhost:3000",
504
450
  method: "POST",
505
- path: "/api/admin/invites",
451
+ path: "/api/users/sync",
506
452
  config: this.config,
507
453
  retry: {
508
454
  attempts: 3,
@@ -518,14 +464,14 @@ var AdminService = class extends BaseService {
518
464
  return this.client.call(request);
519
465
  }
520
466
  /**
521
- * Get invite system statistics
522
- * Aggregate statistics for the invite system
467
+ * Get current user
468
+ * Get the currently authenticated user's profile and usage information
523
469
  */
524
- async adminGetInviteStats() {
470
+ async getCurrentUser() {
525
471
  const request = new Request({
526
472
  baseUrl: this.config.baseUrl || "http://localhost:3000",
527
473
  method: "GET",
528
- path: "/api/admin/invites/stats",
474
+ path: "/api/users/me",
529
475
  config: this.config,
530
476
  retry: {
531
477
  attempts: 3,
@@ -538,15 +484,15 @@ var AdminService = class extends BaseService {
538
484
  return this.client.call(request);
539
485
  }
540
486
  /**
541
- * Get invite code details
542
- * Get details for a single invite code including redemptions
543
- * @param code - The invite code
487
+ * Update current user
488
+ * Update the currently authenticated user's profile
489
+ * @param body - Request body
544
490
  */
545
- async adminGetInviteCode(code) {
491
+ async updateCurrentUser(options) {
546
492
  const request = new Request({
547
493
  baseUrl: this.config.baseUrl || "http://localhost:3000",
548
- method: "GET",
549
- path: "/api/admin/invites/{code}",
494
+ method: "PATCH",
495
+ path: "/api/users/me",
550
496
  config: this.config,
551
497
  retry: {
552
498
  attempts: 3,
@@ -556,28 +502,20 @@ var AdminService = class extends BaseService {
556
502
  backoffFactor: 2
557
503
  }
558
504
  });
559
- request.addPathParam("code", {
560
- key: "code",
561
- value: code,
562
- explode: false,
563
- encode: true,
564
- style: "simple",
565
- isLimit: false,
566
- isOffset: false,
567
- isCursor: false
568
- });
505
+ if (options?.body !== void 0) {
506
+ request.addBody(options?.body);
507
+ }
569
508
  return this.client.call(request);
570
509
  }
571
510
  /**
572
- * Revoke an invite code
573
- * Revoke an invite code. Existing accounts created with this code are unaffected.
574
- * @param code -
511
+ * Get current user's usage
512
+ * Get the currently authenticated user's memory usage statistics
575
513
  */
576
- async adminRevokeInviteCode(code) {
514
+ async getCurrentUserUsage() {
577
515
  const request = new Request({
578
516
  baseUrl: this.config.baseUrl || "http://localhost:3000",
579
- method: "DELETE",
580
- path: "/api/admin/invites/{code}",
517
+ method: "GET",
518
+ path: "/api/users/me/usage",
581
519
  config: this.config,
582
520
  retry: {
583
521
  attempts: 3,
@@ -587,27 +525,21 @@ var AdminService = class extends BaseService {
587
525
  backoffFactor: 2
588
526
  }
589
527
  });
590
- request.addPathParam("code", {
591
- key: "code",
592
- value: code,
593
- explode: false,
594
- encode: true,
595
- style: "simple",
596
- isLimit: false,
597
- isOffset: false,
598
- isCursor: false
599
- });
600
528
  return this.client.call(request);
601
529
  }
602
530
  /**
603
- * Get gate status with audit info
604
- * Get current invite gate state with audit information
605
- */
606
- async adminGetGateStatus() {
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() {
607
539
  const request = new Request({
608
540
  baseUrl: this.config.baseUrl || "http://localhost:3000",
609
541
  method: "GET",
610
- path: "/api/admin/gate",
542
+ path: "/api/users/me/export",
611
543
  config: this.config,
612
544
  retry: {
613
545
  attempts: 3,
@@ -620,17 +552,18 @@ var AdminService = class extends BaseService {
620
552
  return this.client.call(request);
621
553
  }
622
554
  /**
623
- * Toggle invite gate
624
- * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
625
- When disabled (false), registration is open. Takes effect immediately.
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.
626
559
 
627
560
  * @param body - Request body
628
561
  */
629
- async adminSetGateStatus(body) {
562
+ async initiateAccountDeletion(body) {
630
563
  const request = new Request({
631
564
  baseUrl: this.config.baseUrl || "http://localhost:3000",
632
565
  method: "POST",
633
- path: "/api/admin/gate",
566
+ path: "/api/users/me/deletion",
634
567
  config: this.config,
635
568
  retry: {
636
569
  attempts: 3,
@@ -645,19 +578,18 @@ var AdminService = class extends BaseService {
645
578
  }
646
579
  return this.client.call(request);
647
580
  }
648
- };
649
-
650
- // src/services/api-keys-service.ts
651
- var ApiKeysService = class extends BaseService {
652
581
  /**
653
- * Get user information for current API key
654
- * Debug endpoint to retrieve user ID and authentication method from the current API key
655
- */
656
- async debugUser() {
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() {
657
589
  const request = new Request({
658
590
  baseUrl: this.config.baseUrl || "http://localhost:3000",
659
- method: "GET",
660
- path: "/api/apikeys/debug-user",
591
+ method: "DELETE",
592
+ path: "/api/users/me/deletion",
661
593
  config: this.config,
662
594
  retry: {
663
595
  attempts: 3,
@@ -670,59 +602,15 @@ var ApiKeysService = class extends BaseService {
670
602
  return this.client.call(request);
671
603
  }
672
604
  /**
673
- * List API keys
674
- * List all API keys for the authenticated user
605
+ * Get user by ID
606
+ * Get a user by their internal ID (admin only)
607
+ * @param id -
675
608
  */
676
- async listApiKeys() {
609
+ async getUserById(id) {
677
610
  const request = new Request({
678
611
  baseUrl: this.config.baseUrl || "http://localhost:3000",
679
612
  method: "GET",
680
- path: "/api/apikeys",
681
- config: this.config,
682
- retry: {
683
- attempts: 3,
684
- delayMs: 150,
685
- maxDelayMs: 5e3,
686
- jitterMs: 50,
687
- backoffFactor: 2
688
- }
689
- });
690
- return this.client.call(request);
691
- }
692
- /**
693
- * Create API key
694
- * Create a new API key for the authenticated user
695
- * @param body - Request body
696
- */
697
- async createApiKey(options) {
698
- const request = new Request({
699
- baseUrl: this.config.baseUrl || "http://localhost:3000",
700
- method: "POST",
701
- path: "/api/apikeys",
702
- config: this.config,
703
- retry: {
704
- attempts: 3,
705
- delayMs: 150,
706
- maxDelayMs: 5e3,
707
- jitterMs: 50,
708
- backoffFactor: 2
709
- }
710
- });
711
- if (options?.body !== void 0) {
712
- request.addBody(options?.body);
713
- }
714
- return this.client.call(request);
715
- }
716
- /**
717
- * Delete API key
718
- * Delete (revoke) an API key by its ID
719
- * @param id - The API key ID
720
- */
721
- async deleteApiKey(id) {
722
- const request = new Request({
723
- baseUrl: this.config.baseUrl || "http://localhost:3000",
724
- method: "DELETE",
725
- path: "/api/apikeys/{id}",
613
+ path: "/api/users/{id}",
726
614
  config: this.config,
727
615
  retry: {
728
616
  attempts: 3,
@@ -746,22 +634,19 @@ var ApiKeysService = class extends BaseService {
746
634
  }
747
635
  };
748
636
 
749
- // src/services/artifacts-service.ts
750
- var ArtifactsService = class extends BaseService {
637
+ // src/services/topics-service.ts
638
+ var TopicsService = class extends BaseService {
751
639
  /**
752
- * List artifacts
753
- * List all artifacts for the authenticated user with optional filters
754
- * @param limit - Maximum number of artifacts to return
755
- * @param offset - Number of artifacts to skip
756
- * @param memoryId - Filter by memory ID
757
- * @param conversationId - Filter by conversation ID
758
- * @param type - Filter by artifact type
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
759
644
  */
760
- async listArtifacts(options) {
645
+ async listTopics(options) {
761
646
  const request = new Request({
762
647
  baseUrl: this.config.baseUrl || "http://localhost:3000",
763
648
  method: "GET",
764
- path: "/api/artifacts",
649
+ path: "/api/topics",
765
650
  config: this.config,
766
651
  retry: {
767
652
  attempts: 3,
@@ -795,78 +680,18 @@ var ArtifactsService = class extends BaseService {
795
680
  isCursor: false
796
681
  });
797
682
  }
798
- if (options?.memoryId !== void 0) {
799
- request.addQueryParam("memoryId", {
800
- key: "memoryId",
801
- value: options.memoryId,
802
- explode: false,
803
- encode: true,
804
- style: "form",
805
- isLimit: false,
806
- isOffset: false,
807
- isCursor: false
808
- });
809
- }
810
- if (options?.conversationId !== void 0) {
811
- request.addQueryParam("conversationId", {
812
- key: "conversationId",
813
- value: options.conversationId,
814
- explode: false,
815
- encode: true,
816
- style: "form",
817
- isLimit: false,
818
- isOffset: false,
819
- isCursor: false
820
- });
821
- }
822
- if (options?.type !== void 0) {
823
- request.addQueryParam("type", {
824
- key: "type",
825
- value: options.type,
826
- explode: false,
827
- encode: true,
828
- style: "form",
829
- isLimit: false,
830
- isOffset: false,
831
- isCursor: false
832
- });
833
- }
834
- return this.client.call(request);
835
- }
836
- /**
837
- * Create artifact
838
- * Create a new artifact for the authenticated user
839
- * @param body - Request body
840
- */
841
- async createArtifact(body) {
842
- const request = new Request({
843
- baseUrl: this.config.baseUrl || "http://localhost:3000",
844
- method: "POST",
845
- path: "/api/artifacts",
846
- config: this.config,
847
- retry: {
848
- attempts: 3,
849
- delayMs: 150,
850
- maxDelayMs: 5e3,
851
- jitterMs: 50,
852
- backoffFactor: 2
853
- }
854
- });
855
- if (body !== void 0) {
856
- request.addBody(body);
857
- }
858
683
  return this.client.call(request);
859
684
  }
860
685
  /**
861
- * Get artifact by ID
862
- * Retrieve a specific artifact by its ID
863
- * @param id - The artifact ID
686
+ * Get topic by ID
687
+ * Retrieve a specific topic by its ID
688
+ * @param id - The topic ID
864
689
  */
865
- async getArtifactById(id) {
690
+ async getTopicById(id) {
866
691
  const request = new Request({
867
692
  baseUrl: this.config.baseUrl || "http://localhost:3000",
868
693
  method: "GET",
869
- path: "/api/artifacts/{id}",
694
+ path: "/api/topics/{id}",
870
695
  config: this.config,
871
696
  retry: {
872
697
  attempts: 3,
@@ -889,15 +714,15 @@ var ArtifactsService = class extends BaseService {
889
714
  return this.client.call(request);
890
715
  }
891
716
  /**
892
- * Delete artifact
893
- * Delete an artifact by its ID
894
- * @param id - The artifact ID
717
+ * Merge topics
718
+ * Merge two topics into one
719
+ * @param body - Request body
895
720
  */
896
- async deleteArtifact(id) {
721
+ async mergeTopics(body) {
897
722
  const request = new Request({
898
723
  baseUrl: this.config.baseUrl || "http://localhost:3000",
899
- method: "DELETE",
900
- path: "/api/artifacts/{id}",
724
+ method: "POST",
725
+ path: "/api/topics/merge",
901
726
  config: this.config,
902
727
  retry: {
903
728
  attempts: 3,
@@ -907,29 +732,21 @@ var ArtifactsService = class extends BaseService {
907
732
  backoffFactor: 2
908
733
  }
909
734
  });
910
- request.addPathParam("id", {
911
- key: "id",
912
- value: id,
913
- explode: false,
914
- encode: true,
915
- style: "simple",
916
- isLimit: false,
917
- isOffset: false,
918
- isCursor: false
919
- });
735
+ if (body !== void 0) {
736
+ request.addBody(body);
737
+ }
920
738
  return this.client.call(request);
921
739
  }
922
740
  /**
923
- * Update artifact
924
- * Update an existing artifact with partial data
925
- * @param id - The artifact ID
741
+ * Discover related topics
742
+ * Discover topics related to a given topic
926
743
  * @param body - Request body
927
744
  */
928
- async updateArtifact(id, body) {
745
+ async discoverRelatedTopics(body) {
929
746
  const request = new Request({
930
747
  baseUrl: this.config.baseUrl || "http://localhost:3000",
931
- method: "PATCH",
932
- path: "/api/artifacts/{id}",
748
+ method: "POST",
749
+ path: "/api/topics/discover-related",
933
750
  config: this.config,
934
751
  retry: {
935
752
  attempts: 3,
@@ -939,34 +756,21 @@ var ArtifactsService = class extends BaseService {
939
756
  backoffFactor: 2
940
757
  }
941
758
  });
942
- request.addPathParam("id", {
943
- key: "id",
944
- value: id,
945
- explode: false,
946
- encode: true,
947
- style: "simple",
948
- isLimit: false,
949
- isOffset: false,
950
- isCursor: false
951
- });
952
759
  if (body !== void 0) {
953
760
  request.addBody(body);
954
761
  }
955
762
  return this.client.call(request);
956
763
  }
957
- };
958
-
959
- // src/services/billing-service.ts
960
- var BillingService = class extends BaseService {
961
764
  /**
962
- * Get billing overview
963
- * Get subscription, payment method, and upcoming invoice information
765
+ * Calculate topic similarity
766
+ * Calculate similarity score between two topics
767
+ * @param body - Request body
964
768
  */
965
- async getBillingOverview() {
769
+ async calculateTopicSimilarity(body) {
966
770
  const request = new Request({
967
771
  baseUrl: this.config.baseUrl || "http://localhost:3000",
968
- method: "GET",
969
- path: "/api/billing/overview",
772
+ method: "POST",
773
+ path: "/api/topics/similarity",
970
774
  config: this.config,
971
775
  retry: {
972
776
  attempts: 3,
@@ -976,18 +780,21 @@ var BillingService = class extends BaseService {
976
780
  backoffFactor: 2
977
781
  }
978
782
  });
783
+ if (body !== void 0) {
784
+ request.addBody(body);
785
+ }
979
786
  return this.client.call(request);
980
787
  }
981
788
  /**
982
- * Create checkout session
983
- * Create a Stripe checkout session for subscription upgrade
789
+ * Find similar topics
790
+ * Find topics similar to a given topic
984
791
  * @param body - Request body
985
792
  */
986
- async createCheckoutSession(body) {
793
+ async findSimilarTopics(body) {
987
794
  const request = new Request({
988
795
  baseUrl: this.config.baseUrl || "http://localhost:3000",
989
796
  method: "POST",
990
- path: "/api/billing/checkout",
797
+ path: "/api/topics/similar",
991
798
  config: this.config,
992
799
  retry: {
993
800
  attempts: 3,
@@ -1003,15 +810,15 @@ var BillingService = class extends BaseService {
1003
810
  return this.client.call(request);
1004
811
  }
1005
812
  /**
1006
- * Create billing portal session
1007
- * Create a Stripe billing portal session for managing subscription
813
+ * Cluster topics
814
+ * Cluster topics using community detection algorithms
1008
815
  * @param body - Request body
1009
816
  */
1010
- async createPortalSession(body) {
817
+ async clusterTopics(options) {
1011
818
  const request = new Request({
1012
819
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1013
820
  method: "POST",
1014
- path: "/api/billing/portal",
821
+ path: "/api/topics/cluster",
1015
822
  config: this.config,
1016
823
  retry: {
1017
824
  attempts: 3,
@@ -1021,20 +828,21 @@ var BillingService = class extends BaseService {
1021
828
  backoffFactor: 2
1022
829
  }
1023
830
  });
1024
- if (body !== void 0) {
1025
- request.addBody(body);
831
+ if (options?.body !== void 0) {
832
+ request.addBody(options?.body);
1026
833
  }
1027
834
  return this.client.call(request);
1028
835
  }
1029
836
  /**
1030
- * Get current subscription
1031
- * Get the current subscription details for the authenticated user
837
+ * Detect communities
838
+ * Detect communities in the topic graph using specified algorithm
839
+ * @param body - Request body
1032
840
  */
1033
- async getSubscription() {
841
+ async detectCommunities(options) {
1034
842
  const request = new Request({
1035
843
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1036
- method: "GET",
1037
- path: "/api/billing/subscription",
844
+ method: "POST",
845
+ path: "/api/topics/detect-communities",
1038
846
  config: this.config,
1039
847
  retry: {
1040
848
  attempts: 3,
@@ -1044,18 +852,21 @@ var BillingService = class extends BaseService {
1044
852
  backoffFactor: 2
1045
853
  }
1046
854
  });
855
+ if (options?.body !== void 0) {
856
+ request.addBody(options?.body);
857
+ }
1047
858
  return this.client.call(request);
1048
859
  }
1049
860
  /**
1050
- * Cancel subscription
1051
- * Cancel the current subscription at the end of the billing period
861
+ * Search topics
862
+ * Search topics by query string using fulltext search
1052
863
  * @param body - Request body
1053
864
  */
1054
- async cancelSubscription(options) {
865
+ async searchTopics(body) {
1055
866
  const request = new Request({
1056
867
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1057
868
  method: "POST",
1058
- path: "/api/billing/subscription/cancel",
869
+ path: "/api/topics/search",
1059
870
  config: this.config,
1060
871
  retry: {
1061
872
  attempts: 3,
@@ -1065,21 +876,24 @@ var BillingService = class extends BaseService {
1065
876
  backoffFactor: 2
1066
877
  }
1067
878
  });
1068
- if (options?.body !== void 0) {
1069
- request.addBody(options?.body);
879
+ if (body !== void 0) {
880
+ request.addBody(body);
1070
881
  }
1071
882
  return this.client.call(request);
1072
883
  }
884
+ };
885
+
886
+ // src/services/system-service.ts
887
+ var SystemService = class extends BaseService {
1073
888
  /**
1074
- * Reactivate subscription
1075
- * Reactivate a subscription that was scheduled for cancellation
1076
- * @param body - Request body
889
+ * Get system health status
890
+ * Get the current health status of the system including database connectivity
1077
891
  */
1078
- async reactivateSubscription(options) {
892
+ async getSystemHealth() {
1079
893
  const request = new Request({
1080
894
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1081
- method: "POST",
1082
- path: "/api/billing/subscription/reactivate",
895
+ method: "GET",
896
+ path: "/api/system/health",
1083
897
  config: this.config,
1084
898
  retry: {
1085
899
  attempts: 3,
@@ -1089,21 +903,17 @@ var BillingService = class extends BaseService {
1089
903
  backoffFactor: 2
1090
904
  }
1091
905
  });
1092
- if (options?.body !== void 0) {
1093
- request.addBody(options?.body);
1094
- }
1095
906
  return this.client.call(request);
1096
907
  }
1097
908
  /**
1098
- * List invoices
1099
- * Get a list of invoices for the authenticated user
1100
- * @param limit - Maximum number of invoices to return
909
+ * Get context status
910
+ * Get database statistics and context information
1101
911
  */
1102
- async listInvoices(options) {
912
+ async getContextStatus() {
1103
913
  const request = new Request({
1104
914
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1105
915
  method: "GET",
1106
- path: "/api/billing/invoices",
916
+ path: "/api/system/context/status",
1107
917
  config: this.config,
1108
918
  retry: {
1109
919
  attempts: 3,
@@ -1113,29 +923,17 @@ var BillingService = class extends BaseService {
1113
923
  backoffFactor: 2
1114
924
  }
1115
925
  });
1116
- if (options?.limit !== void 0) {
1117
- request.addQueryParam("limit", {
1118
- key: "limit",
1119
- value: options.limit,
1120
- explode: false,
1121
- encode: true,
1122
- style: "form",
1123
- isLimit: true,
1124
- isOffset: false,
1125
- isCursor: false
1126
- });
1127
- }
1128
926
  return this.client.call(request);
1129
927
  }
1130
928
  /**
1131
- * List payment methods
1132
- * Get a list of payment methods for the authenticated user
929
+ * Get feature flags
930
+ * Get all feature flags for the authenticated user
1133
931
  */
1134
- async listPaymentMethods() {
932
+ async getFeatureFlags() {
1135
933
  const request = new Request({
1136
934
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1137
935
  method: "GET",
1138
- path: "/api/billing/payment-methods",
936
+ path: "/api/system/feature-flags",
1139
937
  config: this.config,
1140
938
  retry: {
1141
939
  attempts: 3,
@@ -1148,16 +946,15 @@ var BillingService = class extends BaseService {
1148
946
  return this.client.call(request);
1149
947
  }
1150
948
  /**
1151
- * Set default payment method
1152
- * Set a payment method as the default for future payments
1153
- * @param id - The payment method ID
949
+ * Evaluate feature flag
950
+ * Evaluate a specific feature flag for the authenticated user
1154
951
  * @param body - Request body
1155
952
  */
1156
- async setDefaultPaymentMethod(id, options) {
953
+ async evaluateFeatureFlag(body) {
1157
954
  const request = new Request({
1158
955
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1159
956
  method: "POST",
1160
- path: "/api/billing/payment-methods/{id}/default",
957
+ path: "/api/system/feature-flags/evaluate",
1161
958
  config: this.config,
1162
959
  retry: {
1163
960
  attempts: 3,
@@ -1167,31 +964,22 @@ var BillingService = class extends BaseService {
1167
964
  backoffFactor: 2
1168
965
  }
1169
966
  });
1170
- request.addPathParam("id", {
1171
- key: "id",
1172
- value: id,
1173
- explode: false,
1174
- encode: true,
1175
- style: "simple",
1176
- isLimit: false,
1177
- isOffset: false,
1178
- isCursor: false
1179
- });
1180
- if (options?.body !== void 0) {
1181
- request.addBody(options?.body);
967
+ if (body !== void 0) {
968
+ request.addBody(body);
1182
969
  }
1183
970
  return this.client.call(request);
1184
971
  }
1185
972
  /**
1186
- * Delete payment method
1187
- * Remove a payment method from the account
1188
- * @param id - The payment method ID
973
+ * Analyze memory quality distribution
974
+ * Analyze the quality distribution of memories for the authenticated user
975
+ * @param includeDetails - Include detailed pruning candidate information
976
+ * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
1189
977
  */
1190
- async deletePaymentMethod(id) {
978
+ async analyzeMemoryQuality(options) {
1191
979
  const request = new Request({
1192
980
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1193
- method: "DELETE",
1194
- path: "/api/billing/payment-methods/{id}",
981
+ method: "GET",
982
+ path: "/api/system/memory/quality",
1195
983
  config: this.config,
1196
984
  retry: {
1197
985
  attempts: 3,
@@ -1201,28 +989,42 @@ var BillingService = class extends BaseService {
1201
989
  backoffFactor: 2
1202
990
  }
1203
991
  });
1204
- request.addPathParam("id", {
1205
- key: "id",
1206
- value: id,
1207
- explode: false,
1208
- encode: true,
1209
- style: "simple",
1210
- isLimit: false,
1211
- isOffset: false,
1212
- isCursor: false
1213
- });
992
+ if (options?.includeDetails !== void 0) {
993
+ request.addQueryParam("includeDetails", {
994
+ key: "includeDetails",
995
+ value: options.includeDetails,
996
+ explode: false,
997
+ encode: true,
998
+ style: "form",
999
+ isLimit: false,
1000
+ isOffset: false,
1001
+ isCursor: false
1002
+ });
1003
+ }
1004
+ if (options?.minQualityThreshold !== void 0) {
1005
+ request.addQueryParam("minQualityThreshold", {
1006
+ key: "minQualityThreshold",
1007
+ value: options.minQualityThreshold,
1008
+ explode: false,
1009
+ encode: true,
1010
+ style: "form",
1011
+ isLimit: false,
1012
+ isOffset: false,
1013
+ isCursor: false
1014
+ });
1015
+ }
1214
1016
  return this.client.call(request);
1215
1017
  }
1216
1018
  /**
1217
- * Stripe webhook endpoint
1218
- * Receive and process Stripe webhook events
1019
+ * Prune low-quality memories
1020
+ * Prune (soft delete) low-quality memories for the authenticated user
1219
1021
  * @param body - Request body
1220
1022
  */
1221
- async stripeWebhook(body) {
1023
+ async pruneMemories(options) {
1222
1024
  const request = new Request({
1223
1025
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1224
1026
  method: "POST",
1225
- path: "/api/billing/webhooks",
1027
+ path: "/api/system/memory/prune",
1226
1028
  config: this.config,
1227
1029
  retry: {
1228
1030
  attempts: 3,
@@ -1232,27 +1034,59 @@ var BillingService = class extends BaseService {
1232
1034
  backoffFactor: 2
1233
1035
  }
1234
1036
  });
1235
- if (body !== void 0) {
1236
- request.addBody(body);
1037
+ if (options?.body !== void 0) {
1038
+ request.addBody(options?.body);
1039
+ }
1040
+ return this.client.call(request);
1041
+ }
1042
+ /**
1043
+ * Get OpenAPI specification
1044
+ * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
1045
+ * @param noCache - Bypass cache and regenerate specification
1046
+ */
1047
+ async getOpenApiSpec(options) {
1048
+ const request = new Request({
1049
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
1050
+ method: "GET",
1051
+ path: "/api/openapi.json",
1052
+ config: this.config,
1053
+ retry: {
1054
+ attempts: 3,
1055
+ delayMs: 150,
1056
+ maxDelayMs: 5e3,
1057
+ jitterMs: 50,
1058
+ backoffFactor: 2
1059
+ }
1060
+ });
1061
+ if (options?.noCache !== void 0) {
1062
+ request.addQueryParam("noCache", {
1063
+ key: "noCache",
1064
+ value: options.noCache,
1065
+ explode: false,
1066
+ encode: true,
1067
+ style: "form",
1068
+ isLimit: false,
1069
+ isOffset: false,
1070
+ isCursor: false
1071
+ });
1237
1072
  }
1238
1073
  return this.client.call(request);
1239
1074
  }
1240
1075
  };
1241
1076
 
1242
- // src/services/conversations-service.ts
1243
- var ConversationsService = class extends BaseService {
1077
+ // src/services/patterns-service.ts
1078
+ var PatternsService = class extends BaseService {
1244
1079
  /**
1245
- * List conversations
1246
- * List all conversations for the authenticated user with pagination
1247
- * @param limit - Maximum number of conversations to return
1248
- * @param offset - Number of conversations to skip
1249
- * @param since - Return only conversations created after this timestamp (ISO 8601 format)
1080
+ * List patterns
1081
+ * List all patterns for the authenticated user
1082
+ * @param limit - Maximum number of patterns to return
1083
+ * @param offset - Number of patterns to skip
1250
1084
  */
1251
- async listConversations(options) {
1085
+ async listPatterns(options) {
1252
1086
  const request = new Request({
1253
1087
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1254
1088
  method: "GET",
1255
- path: "/api/conversations",
1089
+ path: "/api/patterns",
1256
1090
  config: this.config,
1257
1091
  retry: {
1258
1092
  attempts: 3,
@@ -1286,30 +1120,18 @@ var ConversationsService = class extends BaseService {
1286
1120
  isCursor: false
1287
1121
  });
1288
1122
  }
1289
- if (options?.since !== void 0) {
1290
- request.addQueryParam("since", {
1291
- key: "since",
1292
- value: options.since,
1293
- explode: false,
1294
- encode: true,
1295
- style: "form",
1296
- isLimit: false,
1297
- isOffset: false,
1298
- isCursor: false
1299
- });
1300
- }
1301
1123
  return this.client.call(request);
1302
1124
  }
1303
1125
  /**
1304
- * Create conversation
1305
- * Create a new conversation for the authenticated user
1126
+ * Compile patterns
1127
+ * Compile patterns from user's memories
1306
1128
  * @param body - Request body
1307
1129
  */
1308
- async createConversation(body) {
1130
+ async compilePatterns(options) {
1309
1131
  const request = new Request({
1310
1132
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1311
1133
  method: "POST",
1312
- path: "/api/conversations",
1134
+ path: "/api/patterns/compile",
1313
1135
  config: this.config,
1314
1136
  retry: {
1315
1137
  attempts: 3,
@@ -1319,21 +1141,21 @@ var ConversationsService = class extends BaseService {
1319
1141
  backoffFactor: 2
1320
1142
  }
1321
1143
  });
1322
- if (body !== void 0) {
1323
- request.addBody(body);
1144
+ if (options?.body !== void 0) {
1145
+ request.addBody(options?.body);
1324
1146
  }
1325
1147
  return this.client.call(request);
1326
1148
  }
1327
1149
  /**
1328
- * Get conversation summary
1329
- * Retrieve a conversation summary by its ID
1330
- * @param conversationId - The conversation ID
1150
+ * Detect behavioral patterns
1151
+ * Run pattern detection algorithms to identify recurring behavioral patterns
1152
+ * @param body - Request body
1331
1153
  */
1332
- async getConversationSummary(conversationId) {
1154
+ async detectPatterns(options) {
1333
1155
  const request = new Request({
1334
1156
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1335
- method: "GET",
1336
- path: "/api/conversations/{conversationId}",
1157
+ method: "POST",
1158
+ path: "/api/patterns/detect",
1337
1159
  config: this.config,
1338
1160
  retry: {
1339
1161
  attempts: 3,
@@ -1343,28 +1165,21 @@ var ConversationsService = class extends BaseService {
1343
1165
  backoffFactor: 2
1344
1166
  }
1345
1167
  });
1346
- request.addPathParam("conversationId", {
1347
- key: "conversationId",
1348
- value: conversationId,
1349
- explode: false,
1350
- encode: true,
1351
- style: "simple",
1352
- isLimit: false,
1353
- isOffset: false,
1354
- isCursor: false
1355
- });
1168
+ if (options?.body !== void 0) {
1169
+ request.addBody(options?.body);
1170
+ }
1356
1171
  return this.client.call(request);
1357
1172
  }
1358
1173
  /**
1359
- * Delete conversation
1360
- * Delete a conversation and soft-delete all associated memories
1361
- * @param conversationId - The conversation ID
1174
+ * Analyze pattern trends
1175
+ * Analyze pattern trends, correlations, and generate insights
1176
+ * @param body - Request body
1362
1177
  */
1363
- async deleteConversation(conversationId) {
1178
+ async analyzePatterns(options) {
1364
1179
  const request = new Request({
1365
1180
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1366
- method: "DELETE",
1367
- path: "/api/conversations/{conversationId}",
1181
+ method: "POST",
1182
+ path: "/api/patterns/analyze",
1368
1183
  config: this.config,
1369
1184
  retry: {
1370
1185
  attempts: 3,
@@ -1374,28 +1189,22 @@ var ConversationsService = class extends BaseService {
1374
1189
  backoffFactor: 2
1375
1190
  }
1376
1191
  });
1377
- request.addPathParam("conversationId", {
1378
- key: "conversationId",
1379
- value: conversationId,
1380
- explode: false,
1381
- encode: true,
1382
- style: "simple",
1383
- isLimit: false,
1384
- isOffset: false,
1385
- isCursor: false
1386
- });
1192
+ if (options?.body !== void 0) {
1193
+ request.addBody(options?.body);
1194
+ }
1387
1195
  return this.client.call(request);
1388
1196
  }
1389
1197
  /**
1390
- * Get conversation timeline
1391
- * Get all memories in a conversation in chronological order
1392
- * @param conversationId - The conversation ID
1198
+ * Update pattern
1199
+ * Update an existing pattern with partial data
1200
+ * @param id - The pattern ID
1201
+ * @param body - Request body
1393
1202
  */
1394
- async getConversationTimeline(conversationId) {
1203
+ async updatePattern(id, body) {
1395
1204
  const request = new Request({
1396
1205
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1397
- method: "GET",
1398
- path: "/api/conversations/{conversationId}/timeline",
1206
+ method: "PATCH",
1207
+ path: "/api/patterns/{id}",
1399
1208
  config: this.config,
1400
1209
  retry: {
1401
1210
  attempts: 3,
@@ -1405,9 +1214,9 @@ var ConversationsService = class extends BaseService {
1405
1214
  backoffFactor: 2
1406
1215
  }
1407
1216
  });
1408
- request.addPathParam("conversationId", {
1409
- key: "conversationId",
1410
- value: conversationId,
1217
+ request.addPathParam("id", {
1218
+ key: "id",
1219
+ value: id,
1411
1220
  explode: false,
1412
1221
  encode: true,
1413
1222
  style: "simple",
@@ -1415,18 +1224,21 @@ var ConversationsService = class extends BaseService {
1415
1224
  isOffset: false,
1416
1225
  isCursor: false
1417
1226
  });
1227
+ if (body !== void 0) {
1228
+ request.addBody(body);
1229
+ }
1418
1230
  return this.client.call(request);
1419
1231
  }
1420
1232
  /**
1421
- * Search conversations
1422
- * Search conversations by query string
1233
+ * Record pattern feedback
1234
+ * Record feedback on a pattern
1423
1235
  * @param body - Request body
1424
1236
  */
1425
- async searchConversations(body) {
1237
+ async recordPatternFeedback(body) {
1426
1238
  const request = new Request({
1427
1239
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1428
1240
  method: "POST",
1429
- path: "/api/conversations/search",
1241
+ path: "/api/patterns/feedback",
1430
1242
  config: this.config,
1431
1243
  retry: {
1432
1244
  attempts: 3,
@@ -1441,16 +1253,19 @@ var ConversationsService = class extends BaseService {
1441
1253
  }
1442
1254
  return this.client.call(request);
1443
1255
  }
1256
+ };
1257
+
1258
+ // src/services/behavior-service.ts
1259
+ var BehaviorService = class extends BaseService {
1444
1260
  /**
1445
- * Find conversations by topic
1446
- * Find conversations that contain a specific topic
1447
- * @param body - Request body
1261
+ * Get behavioral state
1262
+ * Get current behavioral state for the authenticated user
1448
1263
  */
1449
- async findConversationsByTopic(body) {
1264
+ async getBehavioralState() {
1450
1265
  const request = new Request({
1451
1266
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1452
- method: "POST",
1453
- path: "/api/conversations/by-topic",
1267
+ method: "GET",
1268
+ path: "/api/patterns/behavior/state",
1454
1269
  config: this.config,
1455
1270
  retry: {
1456
1271
  attempts: 3,
@@ -1460,27 +1275,18 @@ var ConversationsService = class extends BaseService {
1460
1275
  backoffFactor: 2
1461
1276
  }
1462
1277
  });
1463
- if (body !== void 0) {
1464
- request.addBody(body);
1465
- }
1466
1278
  return this.client.call(request);
1467
1279
  }
1468
- };
1469
-
1470
- // src/services/entities-service.ts
1471
- var EntitiesService = class extends BaseService {
1472
1280
  /**
1473
- * List entities
1474
- * List all entities for the authenticated user, optionally filtered by type
1475
- * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
1476
- * @param limit - Maximum number of entities to return
1477
- * @param offset - Number of entities to skip
1281
+ * Update behavioral state
1282
+ * Update or mutate behavioral state
1283
+ * @param body - Request body
1478
1284
  */
1479
- async listEntities(options) {
1285
+ async updateBehavioralState(options) {
1480
1286
  const request = new Request({
1481
1287
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1482
- method: "GET",
1483
- path: "/api/entities",
1288
+ method: "POST",
1289
+ path: "/api/patterns/behavior/state",
1484
1290
  config: this.config,
1485
1291
  retry: {
1486
1292
  attempts: 3,
@@ -1490,87 +1296,30 @@ var EntitiesService = class extends BaseService {
1490
1296
  backoffFactor: 2
1491
1297
  }
1492
1298
  });
1493
- if (options?.type !== void 0) {
1494
- request.addQueryParam("type", {
1495
- key: "type",
1496
- value: options.type,
1497
- explode: false,
1498
- encode: true,
1499
- style: "form",
1500
- isLimit: false,
1501
- isOffset: false,
1502
- isCursor: false
1503
- });
1299
+ if (options?.body !== void 0) {
1300
+ request.addBody(options?.body);
1504
1301
  }
1505
- if (options?.limit !== void 0) {
1506
- request.addQueryParam("limit", {
1507
- key: "limit",
1508
- value: options.limit,
1509
- explode: false,
1510
- encode: true,
1511
- style: "form",
1512
- isLimit: true,
1513
- isOffset: false,
1514
- isCursor: false
1515
- });
1516
- }
1517
- if (options?.offset !== void 0) {
1518
- request.addQueryParam("offset", {
1519
- key: "offset",
1520
- value: options.offset,
1521
- explode: false,
1522
- encode: true,
1523
- style: "form",
1524
- isLimit: false,
1525
- isOffset: true,
1526
- isCursor: false
1527
- });
1528
- }
1529
- return this.client.call(request);
1530
- }
1531
- /**
1532
- * Get entity by ID
1533
- * Retrieve a specific entity by its ID
1534
- * @param id - The entity ID
1535
- */
1536
- async getEntityById(id) {
1537
- const request = new Request({
1538
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1539
- method: "GET",
1540
- path: "/api/entities/{id}",
1541
- config: this.config,
1542
- retry: {
1543
- attempts: 3,
1544
- delayMs: 150,
1545
- maxDelayMs: 5e3,
1546
- jitterMs: 50,
1547
- backoffFactor: 2
1548
- }
1549
- });
1550
- request.addPathParam("id", {
1551
- key: "id",
1552
- value: id,
1553
- explode: false,
1554
- encode: true,
1555
- style: "simple",
1556
- isLimit: false,
1557
- isOffset: false,
1558
- isCursor: false
1559
- });
1560
1302
  return this.client.call(request);
1561
1303
  }
1304
+ };
1305
+
1306
+ // src/services/narratives-service.ts
1307
+ var NarrativesService = class extends BaseService {
1562
1308
  /**
1563
- * Get memories mentioning entity
1564
- * Get all memories that mention a specific entity
1565
- * @param id - The entity ID
1566
- * @param limit - Maximum number of memories to return
1567
- * @param offset - Number of memories to skip
1568
- */
1569
- async getEntityMemories(id, options) {
1309
+ * List narrative threads
1310
+ * List all narrative threads for the authenticated user.
1311
+ Narratives group related memories into coherent storylines.
1312
+
1313
+ * @param limit - Maximum number of narratives to return
1314
+ * @param offset - Number of narratives to skip
1315
+ * @param state - Filter by narrative state
1316
+ * @param topics - Comma-separated list of topics to filter by
1317
+ */
1318
+ async listNarratives(options) {
1570
1319
  const request = new Request({
1571
1320
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1572
1321
  method: "GET",
1573
- path: "/api/entities/{id}/memories",
1322
+ path: "/api/narratives",
1574
1323
  config: this.config,
1575
1324
  retry: {
1576
1325
  attempts: 3,
@@ -1580,16 +1329,6 @@ var EntitiesService = class extends BaseService {
1580
1329
  backoffFactor: 2
1581
1330
  }
1582
1331
  });
1583
- request.addPathParam("id", {
1584
- key: "id",
1585
- value: id,
1586
- explode: false,
1587
- encode: true,
1588
- style: "simple",
1589
- isLimit: false,
1590
- isOffset: false,
1591
- isCursor: false
1592
- });
1593
1332
  if (options?.limit !== void 0) {
1594
1333
  request.addQueryParam("limit", {
1595
1334
  key: "limit",
@@ -1614,68 +1353,44 @@ var EntitiesService = class extends BaseService {
1614
1353
  isCursor: false
1615
1354
  });
1616
1355
  }
1617
- return this.client.call(request);
1618
- }
1619
- };
1620
-
1621
- // src/services/facts-service.ts
1622
- var FactsService = class extends BaseService {
1623
- /**
1624
- * List facts
1625
- * List all facts for the authenticated user
1626
- * @param limit - Maximum number of facts to return
1627
- * @param offset - Number of facts to skip
1628
- */
1629
- async listFacts(options) {
1630
- const request = new Request({
1631
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1632
- method: "GET",
1633
- path: "/api/facts",
1634
- config: this.config,
1635
- retry: {
1636
- attempts: 3,
1637
- delayMs: 150,
1638
- maxDelayMs: 5e3,
1639
- jitterMs: 50,
1640
- backoffFactor: 2
1641
- }
1642
- });
1643
- if (options?.limit !== void 0) {
1644
- request.addQueryParam("limit", {
1645
- key: "limit",
1646
- value: options.limit,
1356
+ if (options?.state !== void 0) {
1357
+ request.addQueryParam("state", {
1358
+ key: "state",
1359
+ value: options.state,
1647
1360
  explode: false,
1648
1361
  encode: true,
1649
1362
  style: "form",
1650
- isLimit: true,
1363
+ isLimit: false,
1651
1364
  isOffset: false,
1652
1365
  isCursor: false
1653
1366
  });
1654
1367
  }
1655
- if (options?.offset !== void 0) {
1656
- request.addQueryParam("offset", {
1657
- key: "offset",
1658
- value: options.offset,
1368
+ if (options?.topics !== void 0) {
1369
+ request.addQueryParam("topics", {
1370
+ key: "topics",
1371
+ value: options.topics,
1659
1372
  explode: false,
1660
1373
  encode: true,
1661
1374
  style: "form",
1662
1375
  isLimit: false,
1663
- isOffset: true,
1376
+ isOffset: false,
1664
1377
  isCursor: false
1665
1378
  });
1666
1379
  }
1667
1380
  return this.client.call(request);
1668
1381
  }
1669
1382
  /**
1670
- * Create fact
1671
- * Create a new semantic fact
1672
- * @param body - Request body
1673
- */
1674
- async createFact(body) {
1383
+ * Create a narrative thread
1384
+ * Create a new narrative thread starting from a root memory.
1385
+ Narratives help organize related memories into coherent storylines.
1386
+
1387
+ * @param body - Request body
1388
+ */
1389
+ async createNarrative(body) {
1675
1390
  const request = new Request({
1676
1391
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1677
1392
  method: "POST",
1678
- path: "/api/facts",
1393
+ path: "/api/narratives",
1679
1394
  config: this.config,
1680
1395
  retry: {
1681
1396
  attempts: 3,
@@ -1691,15 +1406,15 @@ var FactsService = class extends BaseService {
1691
1406
  return this.client.call(request);
1692
1407
  }
1693
1408
  /**
1694
- * Get fact by ID
1695
- * Retrieve a specific fact by its ID
1696
- * @param id - The fact ID
1409
+ * Get a narrative thread
1410
+ * Retrieve a specific narrative thread by ID
1411
+ * @param id - The narrative ID
1697
1412
  */
1698
- async getFactById(id) {
1413
+ async getNarrative(id) {
1699
1414
  const request = new Request({
1700
1415
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1701
1416
  method: "GET",
1702
- path: "/api/facts/{id}",
1417
+ path: "/api/narratives/{id}",
1703
1418
  config: this.config,
1704
1419
  retry: {
1705
1420
  attempts: 3,
@@ -1722,16 +1437,17 @@ var FactsService = class extends BaseService {
1722
1437
  return this.client.call(request);
1723
1438
  }
1724
1439
  /**
1725
- * Update fact
1726
- * Update an existing fact completely
1727
- * @param id - The fact ID
1728
- * @param body - Request body
1729
- */
1730
- async updateFact(id, body) {
1440
+ * Delete a narrative thread
1441
+ * Delete a narrative thread.
1442
+ This does not delete the associated memories, only the narrative structure.
1443
+
1444
+ * @param id - The narrative ID
1445
+ */
1446
+ async deleteNarrative(id) {
1731
1447
  const request = new Request({
1732
1448
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1733
- method: "PUT",
1734
- path: "/api/facts/{id}",
1449
+ method: "DELETE",
1450
+ path: "/api/narratives/{id}",
1735
1451
  config: this.config,
1736
1452
  retry: {
1737
1453
  attempts: 3,
@@ -1751,21 +1467,21 @@ var FactsService = class extends BaseService {
1751
1467
  isOffset: false,
1752
1468
  isCursor: false
1753
1469
  });
1754
- if (body !== void 0) {
1755
- request.addBody(body);
1756
- }
1757
1470
  return this.client.call(request);
1758
1471
  }
1759
1472
  /**
1760
- * Delete fact
1761
- * Delete a fact by its ID
1762
- * @param id - The fact ID
1763
- */
1764
- async deleteFact(id) {
1473
+ * Update a narrative thread
1474
+ * Update a narrative thread's title, topics, or state.
1475
+ Use this to resolve, reopen, or modify narratives.
1476
+
1477
+ * @param id - The narrative ID
1478
+ * @param body - Request body
1479
+ */
1480
+ async updateNarrative(id, body) {
1765
1481
  const request = new Request({
1766
1482
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1767
- method: "DELETE",
1768
- path: "/api/facts/{id}",
1483
+ method: "PATCH",
1484
+ path: "/api/narratives/{id}",
1769
1485
  config: this.config,
1770
1486
  retry: {
1771
1487
  attempts: 3,
@@ -1785,46 +1501,25 @@ var FactsService = class extends BaseService {
1785
1501
  isOffset: false,
1786
1502
  isCursor: false
1787
1503
  });
1788
- return this.client.call(request);
1789
- }
1790
- /**
1791
- * Search facts
1792
- * Search semantic facts by query string
1793
- * @param body - Request body
1794
- */
1795
- async searchFacts(body) {
1796
- const request = new Request({
1797
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1798
- method: "POST",
1799
- path: "/api/facts/search",
1800
- config: this.config,
1801
- retry: {
1802
- attempts: 3,
1803
- delayMs: 150,
1804
- maxDelayMs: 5e3,
1805
- jitterMs: 50,
1806
- backoffFactor: 2
1807
- }
1808
- });
1809
1504
  if (body !== void 0) {
1810
1505
  request.addBody(body);
1811
1506
  }
1812
1507
  return this.client.call(request);
1813
1508
  }
1814
- };
1815
-
1816
- // src/services/graphrag-service.ts
1817
- var GraphragService = class extends BaseService {
1818
1509
  /**
1819
- * Explain a GraphRAG query
1820
- * Get explanation for a previously executed GraphRAG query result
1821
- * @param queryId - The query ID to explain
1822
- */
1823
- async explainGraphRAGQuery(options) {
1510
+ * Get narrative timeline
1511
+ * Get all memories in a narrative, ordered by their position in the narrative.
1512
+ Each memory includes its position and effective state.
1513
+
1514
+ * @param id - The narrative ID
1515
+ * @param limit - Maximum number of memories to return
1516
+ * @param offset - Number of memories to skip
1517
+ */
1518
+ async getNarrativeTimeline(id, options) {
1824
1519
  const request = new Request({
1825
1520
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1826
1521
  method: "GET",
1827
- path: "/api/graphrag/explain",
1522
+ path: "/api/narratives/{id}/timeline",
1828
1523
  config: this.config,
1829
1524
  retry: {
1830
1525
  attempts: 3,
@@ -1834,54 +1529,55 @@ var GraphragService = class extends BaseService {
1834
1529
  backoffFactor: 2
1835
1530
  }
1836
1531
  });
1837
- if (options?.queryId !== void 0) {
1838
- request.addQueryParam("queryId", {
1839
- key: "queryId",
1840
- value: options.queryId,
1532
+ request.addPathParam("id", {
1533
+ key: "id",
1534
+ value: id,
1535
+ explode: false,
1536
+ encode: true,
1537
+ style: "simple",
1538
+ isLimit: false,
1539
+ isOffset: false,
1540
+ isCursor: false
1541
+ });
1542
+ if (options?.limit !== void 0) {
1543
+ request.addQueryParam("limit", {
1544
+ key: "limit",
1545
+ value: options.limit,
1841
1546
  explode: false,
1842
1547
  encode: true,
1843
1548
  style: "form",
1844
- isLimit: false,
1549
+ isLimit: true,
1845
1550
  isOffset: false,
1846
1551
  isCursor: false
1847
1552
  });
1848
1553
  }
1849
- return this.client.call(request);
1850
- }
1851
- /**
1852
- * Query communities
1853
- * Query communities for relevant information using semantic search
1854
- * @param body - Request body
1855
- */
1856
- async queryCommunities(body) {
1857
- const request = new Request({
1858
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1859
- method: "POST",
1860
- path: "/api/graphrag/query-communities",
1861
- config: this.config,
1862
- retry: {
1863
- attempts: 3,
1864
- delayMs: 150,
1865
- maxDelayMs: 5e3,
1866
- jitterMs: 50,
1867
- backoffFactor: 2
1868
- }
1869
- });
1870
- if (body !== void 0) {
1871
- request.addBody(body);
1554
+ if (options?.offset !== void 0) {
1555
+ request.addQueryParam("offset", {
1556
+ key: "offset",
1557
+ value: options.offset,
1558
+ explode: false,
1559
+ encode: true,
1560
+ style: "form",
1561
+ isLimit: false,
1562
+ isOffset: true,
1563
+ isCursor: false
1564
+ });
1872
1565
  }
1873
1566
  return this.client.call(request);
1874
1567
  }
1875
1568
  /**
1876
- * Execute a GraphRAG query
1877
- * Execute a graph-based retrieval augmented generation query
1878
- * @param body - Request body
1879
- */
1880
- async executeGraphRAGQuery(body) {
1569
+ * Add a memory to a narrative
1570
+ * Add an existing memory to a narrative thread.
1571
+ Optionally specify a position to insert the memory at.
1572
+
1573
+ * @param id - The narrative ID
1574
+ * @param body - Request body
1575
+ */
1576
+ async addMemoryToNarrative(id, body) {
1881
1577
  const request = new Request({
1882
1578
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1883
1579
  method: "POST",
1884
- path: "/api/graphrag/query",
1580
+ path: "/api/narratives/{id}/memories",
1885
1581
  config: this.config,
1886
1582
  retry: {
1887
1583
  attempts: 3,
@@ -1891,28 +1587,34 @@ var GraphragService = class extends BaseService {
1891
1587
  backoffFactor: 2
1892
1588
  }
1893
1589
  });
1590
+ request.addPathParam("id", {
1591
+ key: "id",
1592
+ value: id,
1593
+ explode: false,
1594
+ encode: true,
1595
+ style: "simple",
1596
+ isLimit: false,
1597
+ isOffset: false,
1598
+ isCursor: false
1599
+ });
1894
1600
  if (body !== void 0) {
1895
1601
  request.addBody(body);
1896
1602
  }
1897
1603
  return this.client.call(request);
1898
1604
  }
1899
- };
1900
-
1901
- // src/services/health-service.ts
1902
- var HealthService = class extends BaseService {
1903
1605
  /**
1904
- * API health check endpoint
1905
- * Returns the health status and uptime of the API service.
1906
- This endpoint is public and requires no authentication.
1907
- Use this endpoint for monitoring, health checks, and service availability verification.
1908
- Returns 200 when healthy, 503 when the database is unreachable.
1606
+ * Remove a memory from a narrative
1607
+ * Remove a memory from a narrative thread.
1608
+ This does not delete the memory itself, only removes it from the narrative.
1909
1609
 
1610
+ * @param id - The narrative ID
1611
+ * @param memoryId - The memory ID to remove
1910
1612
  */
1911
- async healthCheck() {
1613
+ async removeMemoryFromNarrative(id, memoryId) {
1912
1614
  const request = new Request({
1913
1615
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1914
- method: "GET",
1915
- path: "/health",
1616
+ method: "DELETE",
1617
+ path: "/api/narratives/{id}/memories/{memoryId}",
1916
1618
  config: this.config,
1917
1619
  retry: {
1918
1620
  attempts: 3,
@@ -1922,48 +1624,44 @@ var HealthService = class extends BaseService {
1922
1624
  backoffFactor: 2
1923
1625
  }
1924
1626
  });
1627
+ request.addPathParam("id", {
1628
+ key: "id",
1629
+ value: id,
1630
+ explode: false,
1631
+ encode: true,
1632
+ style: "simple",
1633
+ isLimit: false,
1634
+ isOffset: false,
1635
+ isCursor: false
1636
+ });
1637
+ request.addPathParam("memoryId", {
1638
+ key: "memoryId",
1639
+ value: memoryId,
1640
+ explode: false,
1641
+ encode: true,
1642
+ style: "simple",
1643
+ isLimit: false,
1644
+ isOffset: false,
1645
+ isCursor: false
1646
+ });
1925
1647
  return this.client.call(request);
1926
1648
  }
1927
1649
  };
1928
1650
 
1929
- // src/services/invites-service.ts
1930
- var InvitesService = class extends BaseService {
1651
+ // src/services/monitoring-service.ts
1652
+ var MonitoringService = class extends BaseService {
1931
1653
  /**
1932
- * Check invite gate status
1933
- * Check whether the invite gate is currently open or closed.
1934
- When gated is true, new signups require a valid invite code.
1935
- Response is cached server-side (30-second TTL).
1654
+ * Prometheus metrics endpoint
1655
+ * Returns Prometheus-formatted metrics for monitoring and observability.
1656
+ This endpoint is public and requires no authentication.
1657
+ Designed to be scraped by Prometheus at regular intervals.
1936
1658
 
1937
1659
  */
1938
- async getGateStatus() {
1660
+ async getMetrics() {
1939
1661
  const request = new Request({
1940
1662
  baseUrl: this.config.baseUrl || "http://localhost:3000",
1941
1663
  method: "GET",
1942
- path: "/api/invites/gate-status",
1943
- config: this.config,
1944
- retry: {
1945
- attempts: 3,
1946
- delayMs: 150,
1947
- maxDelayMs: 5e3,
1948
- jitterMs: 50,
1949
- backoffFactor: 2
1950
- }
1951
- });
1952
- return this.client.call(request);
1953
- }
1954
- /**
1955
- * Validate an invite code
1956
- * Validate an invite code without redeeming it.
1957
- Rate limited to 10 requests per minute per IP to prevent enumeration.
1958
- Error messages are intentionally generic.
1959
-
1960
- * @param body - Request body
1961
- */
1962
- async validateInviteCode(body) {
1963
- const request = new Request({
1964
- baseUrl: this.config.baseUrl || "http://localhost:3000",
1965
- method: "POST",
1966
- path: "/api/invites/validate",
1664
+ path: "/metrics",
1967
1665
  config: this.config,
1968
1666
  retry: {
1969
1667
  attempts: 3,
@@ -1973,9 +1671,6 @@ var InvitesService = class extends BaseService {
1973
1671
  backoffFactor: 2
1974
1672
  }
1975
1673
  });
1976
- if (body !== void 0) {
1977
- request.addBody(body);
1978
- }
1979
1674
  return this.client.call(request);
1980
1675
  }
1981
1676
  };
@@ -3124,20 +2819,20 @@ var MemoriesService = class extends BaseService {
3124
2819
  }
3125
2820
  };
3126
2821
 
3127
- // src/services/monitoring-service.ts
3128
- var MonitoringService = class extends BaseService {
2822
+ // src/services/invites-service.ts
2823
+ var InvitesService = class extends BaseService {
3129
2824
  /**
3130
- * Prometheus metrics endpoint
3131
- * Returns Prometheus-formatted metrics for monitoring and observability.
3132
- This endpoint is public and requires no authentication.
3133
- Designed to be scraped by Prometheus at regular intervals.
2825
+ * Check invite gate status
2826
+ * Check whether the invite gate is currently open or closed.
2827
+ When gated is true, new signups require a valid invite code.
2828
+ Response is cached server-side (30-second TTL).
3134
2829
 
3135
2830
  */
3136
- async getMetrics() {
2831
+ async getGateStatus() {
3137
2832
  const request = new Request({
3138
2833
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3139
2834
  method: "GET",
3140
- path: "/metrics",
2835
+ path: "/api/invites/gate-status",
3141
2836
  config: this.config,
3142
2837
  retry: {
3143
2838
  attempts: 3,
@@ -3149,25 +2844,19 @@ var MonitoringService = class extends BaseService {
3149
2844
  });
3150
2845
  return this.client.call(request);
3151
2846
  }
3152
- };
3153
-
3154
- // src/services/narratives-service.ts
3155
- var NarrativesService = class extends BaseService {
3156
2847
  /**
3157
- * List narrative threads
3158
- * List all narrative threads for the authenticated user.
3159
- Narratives group related memories into coherent storylines.
2848
+ * Validate an invite code
2849
+ * Validate an invite code without redeeming it.
2850
+ Rate limited to 10 requests per minute per IP to prevent enumeration.
2851
+ Error messages are intentionally generic.
3160
2852
 
3161
- * @param limit - Maximum number of narratives to return
3162
- * @param offset - Number of narratives to skip
3163
- * @param state - Filter by narrative state
3164
- * @param topics - Comma-separated list of topics to filter by
2853
+ * @param body - Request body
3165
2854
  */
3166
- async listNarratives(options) {
2855
+ async validateInviteCode(body) {
3167
2856
  const request = new Request({
3168
2857
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3169
- method: "GET",
3170
- path: "/api/narratives",
2858
+ method: "POST",
2859
+ path: "/api/invites/validate",
3171
2860
  config: this.config,
3172
2861
  retry: {
3173
2862
  attempts: 3,
@@ -3177,68 +2866,28 @@ var NarrativesService = class extends BaseService {
3177
2866
  backoffFactor: 2
3178
2867
  }
3179
2868
  });
3180
- if (options?.limit !== void 0) {
3181
- request.addQueryParam("limit", {
3182
- key: "limit",
3183
- value: options.limit,
3184
- explode: false,
3185
- encode: true,
3186
- style: "form",
3187
- isLimit: true,
3188
- isOffset: false,
3189
- isCursor: false
3190
- });
3191
- }
3192
- if (options?.offset !== void 0) {
3193
- request.addQueryParam("offset", {
3194
- key: "offset",
3195
- value: options.offset,
3196
- explode: false,
3197
- encode: true,
3198
- style: "form",
3199
- isLimit: false,
3200
- isOffset: true,
3201
- isCursor: false
3202
- });
3203
- }
3204
- if (options?.state !== void 0) {
3205
- request.addQueryParam("state", {
3206
- key: "state",
3207
- value: options.state,
3208
- explode: false,
3209
- encode: true,
3210
- style: "form",
3211
- isLimit: false,
3212
- isOffset: false,
3213
- isCursor: false
3214
- });
3215
- }
3216
- if (options?.topics !== void 0) {
3217
- request.addQueryParam("topics", {
3218
- key: "topics",
3219
- value: options.topics,
3220
- explode: false,
3221
- encode: true,
3222
- style: "form",
3223
- isLimit: false,
3224
- isOffset: false,
3225
- isCursor: false
3226
- });
2869
+ if (body !== void 0) {
2870
+ request.addBody(body);
3227
2871
  }
3228
2872
  return this.client.call(request);
3229
2873
  }
2874
+ };
2875
+
2876
+ // src/services/health-service.ts
2877
+ var HealthService = class extends BaseService {
3230
2878
  /**
3231
- * Create a narrative thread
3232
- * Create a new narrative thread starting from a root memory.
3233
- Narratives help organize related memories into coherent storylines.
2879
+ * API health check endpoint
2880
+ * Returns the health status and uptime of the API service.
2881
+ This endpoint is public and requires no authentication.
2882
+ Use this endpoint for monitoring, health checks, and service availability verification.
2883
+ Returns 200 when healthy, 503 when the database is unreachable.
3234
2884
 
3235
- * @param body - Request body
3236
2885
  */
3237
- async createNarrative(body) {
2886
+ async healthCheck() {
3238
2887
  const request = new Request({
3239
2888
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3240
- method: "POST",
3241
- path: "/api/narratives",
2889
+ method: "GET",
2890
+ path: "/health",
3242
2891
  config: this.config,
3243
2892
  retry: {
3244
2893
  attempts: 3,
@@ -3248,21 +2897,177 @@ var NarrativesService = class extends BaseService {
3248
2897
  backoffFactor: 2
3249
2898
  }
3250
2899
  });
3251
- if (body !== void 0) {
3252
- request.addBody(body);
3253
- }
3254
2900
  return this.client.call(request);
3255
2901
  }
2902
+ };
2903
+
2904
+ // src/services/graphrag-service.ts
2905
+ var GraphragService = class extends BaseService {
3256
2906
  /**
3257
- * Get a narrative thread
3258
- * Retrieve a specific narrative thread by ID
3259
- * @param id - The narrative ID
2907
+ * Explain a GraphRAG query
2908
+ * Get explanation for a previously executed GraphRAG query result
2909
+ * @param queryId - The query ID to explain
3260
2910
  */
3261
- async getNarrative(id) {
2911
+ async explainGraphRAGQuery(options) {
3262
2912
  const request = new Request({
3263
2913
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3264
2914
  method: "GET",
3265
- path: "/api/narratives/{id}",
2915
+ path: "/api/graphrag/explain",
2916
+ config: this.config,
2917
+ retry: {
2918
+ attempts: 3,
2919
+ delayMs: 150,
2920
+ maxDelayMs: 5e3,
2921
+ jitterMs: 50,
2922
+ backoffFactor: 2
2923
+ }
2924
+ });
2925
+ if (options?.queryId !== void 0) {
2926
+ request.addQueryParam("queryId", {
2927
+ key: "queryId",
2928
+ value: options.queryId,
2929
+ explode: false,
2930
+ encode: true,
2931
+ style: "form",
2932
+ isLimit: false,
2933
+ isOffset: false,
2934
+ isCursor: false
2935
+ });
2936
+ }
2937
+ return this.client.call(request);
2938
+ }
2939
+ /**
2940
+ * Query communities
2941
+ * Query communities for relevant information using semantic search
2942
+ * @param body - Request body
2943
+ */
2944
+ async queryCommunities(body) {
2945
+ const request = new Request({
2946
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2947
+ method: "POST",
2948
+ path: "/api/graphrag/query-communities",
2949
+ config: this.config,
2950
+ retry: {
2951
+ attempts: 3,
2952
+ delayMs: 150,
2953
+ maxDelayMs: 5e3,
2954
+ jitterMs: 50,
2955
+ backoffFactor: 2
2956
+ }
2957
+ });
2958
+ if (body !== void 0) {
2959
+ request.addBody(body);
2960
+ }
2961
+ return this.client.call(request);
2962
+ }
2963
+ /**
2964
+ * Execute a GraphRAG query
2965
+ * Execute a graph-based retrieval augmented generation query
2966
+ * @param body - Request body
2967
+ */
2968
+ async executeGraphRAGQuery(body) {
2969
+ const request = new Request({
2970
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
2971
+ method: "POST",
2972
+ path: "/api/graphrag/query",
2973
+ config: this.config,
2974
+ retry: {
2975
+ attempts: 3,
2976
+ delayMs: 150,
2977
+ maxDelayMs: 5e3,
2978
+ jitterMs: 50,
2979
+ backoffFactor: 2
2980
+ }
2981
+ });
2982
+ if (body !== void 0) {
2983
+ request.addBody(body);
2984
+ }
2985
+ return this.client.call(request);
2986
+ }
2987
+ };
2988
+
2989
+ // src/services/facts-service.ts
2990
+ var FactsService = class extends BaseService {
2991
+ /**
2992
+ * List facts
2993
+ * List all facts for the authenticated user
2994
+ * @param limit - Maximum number of facts to return
2995
+ * @param offset - Number of facts to skip
2996
+ */
2997
+ async listFacts(options) {
2998
+ const request = new Request({
2999
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3000
+ method: "GET",
3001
+ path: "/api/facts",
3002
+ config: this.config,
3003
+ retry: {
3004
+ attempts: 3,
3005
+ delayMs: 150,
3006
+ maxDelayMs: 5e3,
3007
+ jitterMs: 50,
3008
+ backoffFactor: 2
3009
+ }
3010
+ });
3011
+ if (options?.limit !== void 0) {
3012
+ request.addQueryParam("limit", {
3013
+ key: "limit",
3014
+ value: options.limit,
3015
+ explode: false,
3016
+ encode: true,
3017
+ style: "form",
3018
+ isLimit: true,
3019
+ isOffset: false,
3020
+ isCursor: false
3021
+ });
3022
+ }
3023
+ if (options?.offset !== void 0) {
3024
+ request.addQueryParam("offset", {
3025
+ key: "offset",
3026
+ value: options.offset,
3027
+ explode: false,
3028
+ encode: true,
3029
+ style: "form",
3030
+ isLimit: false,
3031
+ isOffset: true,
3032
+ isCursor: false
3033
+ });
3034
+ }
3035
+ return this.client.call(request);
3036
+ }
3037
+ /**
3038
+ * Create fact
3039
+ * Create a new semantic fact
3040
+ * @param body - Request body
3041
+ */
3042
+ async createFact(body) {
3043
+ const request = new Request({
3044
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3045
+ method: "POST",
3046
+ path: "/api/facts",
3047
+ config: this.config,
3048
+ retry: {
3049
+ attempts: 3,
3050
+ delayMs: 150,
3051
+ maxDelayMs: 5e3,
3052
+ jitterMs: 50,
3053
+ backoffFactor: 2
3054
+ }
3055
+ });
3056
+ if (body !== void 0) {
3057
+ request.addBody(body);
3058
+ }
3059
+ return this.client.call(request);
3060
+ }
3061
+ /**
3062
+ * Get fact by ID
3063
+ * Retrieve a specific fact by its ID
3064
+ * @param id - The fact ID
3065
+ */
3066
+ async getFactById(id) {
3067
+ const request = new Request({
3068
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3069
+ method: "GET",
3070
+ path: "/api/facts/{id}",
3266
3071
  config: this.config,
3267
3072
  retry: {
3268
3073
  attempts: 3,
@@ -3285,17 +3090,16 @@ var NarrativesService = class extends BaseService {
3285
3090
  return this.client.call(request);
3286
3091
  }
3287
3092
  /**
3288
- * Delete a narrative thread
3289
- * Delete a narrative thread.
3290
- This does not delete the associated memories, only the narrative structure.
3291
-
3292
- * @param id - The narrative ID
3293
- */
3294
- async deleteNarrative(id) {
3093
+ * Update fact
3094
+ * Update an existing fact completely
3095
+ * @param id - The fact ID
3096
+ * @param body - Request body
3097
+ */
3098
+ async updateFact(id, body) {
3295
3099
  const request = new Request({
3296
3100
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3297
- method: "DELETE",
3298
- path: "/api/narratives/{id}",
3101
+ method: "PUT",
3102
+ path: "/api/facts/{id}",
3299
3103
  config: this.config,
3300
3104
  retry: {
3301
3105
  attempts: 3,
@@ -3315,21 +3119,21 @@ var NarrativesService = class extends BaseService {
3315
3119
  isOffset: false,
3316
3120
  isCursor: false
3317
3121
  });
3122
+ if (body !== void 0) {
3123
+ request.addBody(body);
3124
+ }
3318
3125
  return this.client.call(request);
3319
3126
  }
3320
3127
  /**
3321
- * Update a narrative thread
3322
- * Update a narrative thread's title, topics, or state.
3323
- Use this to resolve, reopen, or modify narratives.
3324
-
3325
- * @param id - The narrative ID
3326
- * @param body - Request body
3327
- */
3328
- async updateNarrative(id, body) {
3128
+ * Delete fact
3129
+ * Delete a fact by its ID
3130
+ * @param id - The fact ID
3131
+ */
3132
+ async deleteFact(id) {
3329
3133
  const request = new Request({
3330
3134
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3331
- method: "PATCH",
3332
- path: "/api/narratives/{id}",
3135
+ method: "DELETE",
3136
+ path: "/api/facts/{id}",
3333
3137
  config: this.config,
3334
3138
  retry: {
3335
3139
  attempts: 3,
@@ -3349,25 +3153,199 @@ var NarrativesService = class extends BaseService {
3349
3153
  isOffset: false,
3350
3154
  isCursor: false
3351
3155
  });
3156
+ return this.client.call(request);
3157
+ }
3158
+ /**
3159
+ * Search facts
3160
+ * Search semantic facts by query string
3161
+ * @param body - Request body
3162
+ */
3163
+ async searchFacts(body) {
3164
+ const request = new Request({
3165
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3166
+ method: "POST",
3167
+ path: "/api/facts/search",
3168
+ config: this.config,
3169
+ retry: {
3170
+ attempts: 3,
3171
+ delayMs: 150,
3172
+ maxDelayMs: 5e3,
3173
+ jitterMs: 50,
3174
+ backoffFactor: 2
3175
+ }
3176
+ });
3352
3177
  if (body !== void 0) {
3353
3178
  request.addBody(body);
3354
3179
  }
3355
3180
  return this.client.call(request);
3356
3181
  }
3182
+ };
3183
+
3184
+ // src/services/entities-service.ts
3185
+ var EntitiesService = class extends BaseService {
3186
+ /**
3187
+ * List entities
3188
+ * List all entities for the authenticated user, optionally filtered by type
3189
+ * @param type - Filter by entity type (e.g., PERSON, TECHNOLOGY)
3190
+ * @param limit - Maximum number of entities to return
3191
+ * @param offset - Number of entities to skip
3192
+ */
3193
+ async listEntities(options) {
3194
+ const request = new Request({
3195
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3196
+ method: "GET",
3197
+ path: "/api/entities",
3198
+ config: this.config,
3199
+ retry: {
3200
+ attempts: 3,
3201
+ delayMs: 150,
3202
+ maxDelayMs: 5e3,
3203
+ jitterMs: 50,
3204
+ backoffFactor: 2
3205
+ }
3206
+ });
3207
+ if (options?.type !== void 0) {
3208
+ request.addQueryParam("type", {
3209
+ key: "type",
3210
+ value: options.type,
3211
+ explode: false,
3212
+ encode: true,
3213
+ style: "form",
3214
+ isLimit: false,
3215
+ isOffset: false,
3216
+ isCursor: false
3217
+ });
3218
+ }
3219
+ if (options?.limit !== void 0) {
3220
+ request.addQueryParam("limit", {
3221
+ key: "limit",
3222
+ value: options.limit,
3223
+ explode: false,
3224
+ encode: true,
3225
+ style: "form",
3226
+ isLimit: true,
3227
+ isOffset: false,
3228
+ isCursor: false
3229
+ });
3230
+ }
3231
+ if (options?.offset !== void 0) {
3232
+ request.addQueryParam("offset", {
3233
+ key: "offset",
3234
+ value: options.offset,
3235
+ explode: false,
3236
+ encode: true,
3237
+ style: "form",
3238
+ isLimit: false,
3239
+ isOffset: true,
3240
+ isCursor: false
3241
+ });
3242
+ }
3243
+ return this.client.call(request);
3244
+ }
3245
+ /**
3246
+ * Get entity by ID
3247
+ * Retrieve a specific entity by its ID
3248
+ * @param id - The entity ID
3249
+ */
3250
+ async getEntityById(id) {
3251
+ const request = new Request({
3252
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3253
+ method: "GET",
3254
+ path: "/api/entities/{id}",
3255
+ config: this.config,
3256
+ retry: {
3257
+ attempts: 3,
3258
+ delayMs: 150,
3259
+ maxDelayMs: 5e3,
3260
+ jitterMs: 50,
3261
+ backoffFactor: 2
3262
+ }
3263
+ });
3264
+ request.addPathParam("id", {
3265
+ key: "id",
3266
+ value: id,
3267
+ explode: false,
3268
+ encode: true,
3269
+ style: "simple",
3270
+ isLimit: false,
3271
+ isOffset: false,
3272
+ isCursor: false
3273
+ });
3274
+ return this.client.call(request);
3275
+ }
3276
+ /**
3277
+ * Get memories mentioning entity
3278
+ * Get all memories that mention a specific entity
3279
+ * @param id - The entity ID
3280
+ * @param limit - Maximum number of memories to return
3281
+ * @param offset - Number of memories to skip
3282
+ */
3283
+ async getEntityMemories(id, options) {
3284
+ const request = new Request({
3285
+ baseUrl: this.config.baseUrl || "http://localhost:3000",
3286
+ method: "GET",
3287
+ path: "/api/entities/{id}/memories",
3288
+ config: this.config,
3289
+ retry: {
3290
+ attempts: 3,
3291
+ delayMs: 150,
3292
+ maxDelayMs: 5e3,
3293
+ jitterMs: 50,
3294
+ backoffFactor: 2
3295
+ }
3296
+ });
3297
+ request.addPathParam("id", {
3298
+ key: "id",
3299
+ value: id,
3300
+ explode: false,
3301
+ encode: true,
3302
+ style: "simple",
3303
+ isLimit: false,
3304
+ isOffset: false,
3305
+ isCursor: false
3306
+ });
3307
+ if (options?.limit !== void 0) {
3308
+ request.addQueryParam("limit", {
3309
+ key: "limit",
3310
+ value: options.limit,
3311
+ explode: false,
3312
+ encode: true,
3313
+ style: "form",
3314
+ isLimit: true,
3315
+ isOffset: false,
3316
+ isCursor: false
3317
+ });
3318
+ }
3319
+ if (options?.offset !== void 0) {
3320
+ request.addQueryParam("offset", {
3321
+ key: "offset",
3322
+ value: options.offset,
3323
+ explode: false,
3324
+ encode: true,
3325
+ style: "form",
3326
+ isLimit: false,
3327
+ isOffset: true,
3328
+ isCursor: false
3329
+ });
3330
+ }
3331
+ return this.client.call(request);
3332
+ }
3333
+ };
3334
+
3335
+ // src/services/conversations-service.ts
3336
+ var ConversationsService = class extends BaseService {
3357
3337
  /**
3358
- * Get narrative timeline
3359
- * Get all memories in a narrative, ordered by their position in the narrative.
3360
- Each memory includes its position and effective state.
3361
-
3362
- * @param id - The narrative ID
3363
- * @param limit - Maximum number of memories to return
3364
- * @param offset - Number of memories to skip
3365
- */
3366
- async getNarrativeTimeline(id, options) {
3338
+ * List conversations
3339
+ * List all conversations for the authenticated user with pagination
3340
+ * @param limit - Maximum number of conversations to return
3341
+ * @param offset - Number of conversations to skip
3342
+ * @param since - Return only conversations created after this timestamp (ISO 8601 format)
3343
+ */
3344
+ async listConversations(options) {
3367
3345
  const request = new Request({
3368
3346
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3369
3347
  method: "GET",
3370
- path: "/api/narratives/{id}/timeline",
3348
+ path: "/api/conversations",
3371
3349
  config: this.config,
3372
3350
  retry: {
3373
3351
  attempts: 3,
@@ -3377,16 +3355,6 @@ var NarrativesService = class extends BaseService {
3377
3355
  backoffFactor: 2
3378
3356
  }
3379
3357
  });
3380
- request.addPathParam("id", {
3381
- key: "id",
3382
- value: id,
3383
- explode: false,
3384
- encode: true,
3385
- style: "simple",
3386
- isLimit: false,
3387
- isOffset: false,
3388
- isCursor: false
3389
- });
3390
3358
  if (options?.limit !== void 0) {
3391
3359
  request.addQueryParam("limit", {
3392
3360
  key: "limit",
@@ -3411,21 +3379,30 @@ var NarrativesService = class extends BaseService {
3411
3379
  isCursor: false
3412
3380
  });
3413
3381
  }
3382
+ if (options?.since !== void 0) {
3383
+ request.addQueryParam("since", {
3384
+ key: "since",
3385
+ value: options.since,
3386
+ explode: false,
3387
+ encode: true,
3388
+ style: "form",
3389
+ isLimit: false,
3390
+ isOffset: false,
3391
+ isCursor: false
3392
+ });
3393
+ }
3414
3394
  return this.client.call(request);
3415
3395
  }
3416
3396
  /**
3417
- * Add a memory to a narrative
3418
- * Add an existing memory to a narrative thread.
3419
- Optionally specify a position to insert the memory at.
3420
-
3421
- * @param id - The narrative ID
3422
- * @param body - Request body
3423
- */
3424
- async addMemoryToNarrative(id, body) {
3397
+ * Create conversation
3398
+ * Create a new conversation for the authenticated user
3399
+ * @param body - Request body
3400
+ */
3401
+ async createConversation(body) {
3425
3402
  const request = new Request({
3426
3403
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3427
3404
  method: "POST",
3428
- path: "/api/narratives/{id}/memories",
3405
+ path: "/api/conversations",
3429
3406
  config: this.config,
3430
3407
  retry: {
3431
3408
  attempts: 3,
@@ -3435,34 +3412,21 @@ var NarrativesService = class extends BaseService {
3435
3412
  backoffFactor: 2
3436
3413
  }
3437
3414
  });
3438
- request.addPathParam("id", {
3439
- key: "id",
3440
- value: id,
3441
- explode: false,
3442
- encode: true,
3443
- style: "simple",
3444
- isLimit: false,
3445
- isOffset: false,
3446
- isCursor: false
3447
- });
3448
3415
  if (body !== void 0) {
3449
3416
  request.addBody(body);
3450
3417
  }
3451
3418
  return this.client.call(request);
3452
3419
  }
3453
3420
  /**
3454
- * Remove a memory from a narrative
3455
- * Remove a memory from a narrative thread.
3456
- This does not delete the memory itself, only removes it from the narrative.
3457
-
3458
- * @param id - The narrative ID
3459
- * @param memoryId - The memory ID to remove
3460
- */
3461
- async removeMemoryFromNarrative(id, memoryId) {
3421
+ * Get conversation summary
3422
+ * Retrieve a conversation summary by its ID
3423
+ * @param conversationId - The conversation ID
3424
+ */
3425
+ async getConversationSummary(conversationId) {
3462
3426
  const request = new Request({
3463
3427
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3464
- method: "DELETE",
3465
- path: "/api/narratives/{id}/memories/{memoryId}",
3428
+ method: "GET",
3429
+ path: "/api/conversations/{conversationId}",
3466
3430
  config: this.config,
3467
3431
  retry: {
3468
3432
  attempts: 3,
@@ -3472,19 +3436,9 @@ var NarrativesService = class extends BaseService {
3472
3436
  backoffFactor: 2
3473
3437
  }
3474
3438
  });
3475
- request.addPathParam("id", {
3476
- key: "id",
3477
- value: id,
3478
- explode: false,
3479
- encode: true,
3480
- style: "simple",
3481
- isLimit: false,
3482
- isOffset: false,
3483
- isCursor: false
3484
- });
3485
- request.addPathParam("memoryId", {
3486
- key: "memoryId",
3487
- value: memoryId,
3439
+ request.addPathParam("conversationId", {
3440
+ key: "conversationId",
3441
+ value: conversationId,
3488
3442
  explode: false,
3489
3443
  encode: true,
3490
3444
  style: "simple",
@@ -3494,20 +3448,16 @@ var NarrativesService = class extends BaseService {
3494
3448
  });
3495
3449
  return this.client.call(request);
3496
3450
  }
3497
- };
3498
-
3499
- // src/services/system-service.ts
3500
- var SystemService = class extends BaseService {
3501
3451
  /**
3502
- * Get OpenAPI specification
3503
- * Returns the OpenAPI 3.x specification for the entire API. This endpoint is used by CI/CD to sync the API Gateway.
3504
- * @param noCache - Bypass cache and regenerate specification
3452
+ * Delete conversation
3453
+ * Delete a conversation and soft-delete all associated memories
3454
+ * @param conversationId - The conversation ID
3505
3455
  */
3506
- async getOpenApiSpec(options) {
3456
+ async deleteConversation(conversationId) {
3507
3457
  const request = new Request({
3508
3458
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3509
- method: "GET",
3510
- path: "/api/openapi.json",
3459
+ method: "DELETE",
3460
+ path: "/api/conversations/{conversationId}",
3511
3461
  config: this.config,
3512
3462
  retry: {
3513
3463
  attempts: 3,
@@ -3517,29 +3467,28 @@ var SystemService = class extends BaseService {
3517
3467
  backoffFactor: 2
3518
3468
  }
3519
3469
  });
3520
- if (options?.noCache !== void 0) {
3521
- request.addQueryParam("noCache", {
3522
- key: "noCache",
3523
- value: options.noCache,
3524
- explode: false,
3525
- encode: true,
3526
- style: "form",
3527
- isLimit: false,
3528
- isOffset: false,
3529
- isCursor: false
3530
- });
3531
- }
3470
+ request.addPathParam("conversationId", {
3471
+ key: "conversationId",
3472
+ value: conversationId,
3473
+ explode: false,
3474
+ encode: true,
3475
+ style: "simple",
3476
+ isLimit: false,
3477
+ isOffset: false,
3478
+ isCursor: false
3479
+ });
3532
3480
  return this.client.call(request);
3533
3481
  }
3534
3482
  /**
3535
- * Get system health status
3536
- * Get the current health status of the system including database connectivity
3483
+ * Get conversation timeline
3484
+ * Get all memories in a conversation in chronological order
3485
+ * @param conversationId - The conversation ID
3537
3486
  */
3538
- async getSystemHealth() {
3487
+ async getConversationTimeline(conversationId) {
3539
3488
  const request = new Request({
3540
3489
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3541
3490
  method: "GET",
3542
- path: "/api/system/health",
3491
+ path: "/api/conversations/{conversationId}/timeline",
3543
3492
  config: this.config,
3544
3493
  retry: {
3545
3494
  attempts: 3,
@@ -3549,17 +3498,28 @@ var SystemService = class extends BaseService {
3549
3498
  backoffFactor: 2
3550
3499
  }
3551
3500
  });
3501
+ request.addPathParam("conversationId", {
3502
+ key: "conversationId",
3503
+ value: conversationId,
3504
+ explode: false,
3505
+ encode: true,
3506
+ style: "simple",
3507
+ isLimit: false,
3508
+ isOffset: false,
3509
+ isCursor: false
3510
+ });
3552
3511
  return this.client.call(request);
3553
3512
  }
3554
3513
  /**
3555
- * Get context status
3556
- * Get database statistics and context information
3514
+ * Search conversations
3515
+ * Search conversations by query string
3516
+ * @param body - Request body
3557
3517
  */
3558
- async getContextStatus() {
3518
+ async searchConversations(body) {
3559
3519
  const request = new Request({
3560
3520
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3561
- method: "GET",
3562
- path: "/api/system/context/status",
3521
+ method: "POST",
3522
+ path: "/api/conversations/search",
3563
3523
  config: this.config,
3564
3524
  retry: {
3565
3525
  attempts: 3,
@@ -3569,17 +3529,21 @@ var SystemService = class extends BaseService {
3569
3529
  backoffFactor: 2
3570
3530
  }
3571
3531
  });
3532
+ if (body !== void 0) {
3533
+ request.addBody(body);
3534
+ }
3572
3535
  return this.client.call(request);
3573
3536
  }
3574
3537
  /**
3575
- * Get feature flags
3576
- * Get all feature flags for the authenticated user
3538
+ * Find conversations by topic
3539
+ * Find conversations that contain a specific topic
3540
+ * @param body - Request body
3577
3541
  */
3578
- async getFeatureFlags() {
3542
+ async findConversationsByTopic(body) {
3579
3543
  const request = new Request({
3580
3544
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3581
- method: "GET",
3582
- path: "/api/system/feature-flags",
3545
+ method: "POST",
3546
+ path: "/api/conversations/by-topic",
3583
3547
  config: this.config,
3584
3548
  retry: {
3585
3549
  attempts: 3,
@@ -3589,18 +3553,24 @@ var SystemService = class extends BaseService {
3589
3553
  backoffFactor: 2
3590
3554
  }
3591
3555
  });
3556
+ if (body !== void 0) {
3557
+ request.addBody(body);
3558
+ }
3592
3559
  return this.client.call(request);
3593
3560
  }
3561
+ };
3562
+
3563
+ // src/services/billing-service.ts
3564
+ var BillingService = class extends BaseService {
3594
3565
  /**
3595
- * Evaluate feature flag
3596
- * Evaluate a specific feature flag for the authenticated user
3597
- * @param body - Request body
3566
+ * Get billing overview
3567
+ * Get subscription, payment method, and upcoming invoice information
3598
3568
  */
3599
- async evaluateFeatureFlag(body) {
3569
+ async getBillingOverview() {
3600
3570
  const request = new Request({
3601
3571
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3602
- method: "POST",
3603
- path: "/api/system/feature-flags/evaluate",
3572
+ method: "GET",
3573
+ path: "/api/billing/overview",
3604
3574
  config: this.config,
3605
3575
  retry: {
3606
3576
  attempts: 3,
@@ -3610,22 +3580,18 @@ var SystemService = class extends BaseService {
3610
3580
  backoffFactor: 2
3611
3581
  }
3612
3582
  });
3613
- if (body !== void 0) {
3614
- request.addBody(body);
3615
- }
3616
3583
  return this.client.call(request);
3617
3584
  }
3618
3585
  /**
3619
- * Analyze memory quality distribution
3620
- * Analyze the quality distribution of memories for the authenticated user
3621
- * @param includeDetails - Include detailed pruning candidate information
3622
- * @param minQualityThreshold - Minimum quality threshold for pruning candidates (default 0.4)
3586
+ * Create checkout session
3587
+ * Create a Stripe checkout session for subscription upgrade
3588
+ * @param body - Request body
3623
3589
  */
3624
- async analyzeMemoryQuality(options) {
3590
+ async createCheckoutSession(body) {
3625
3591
  const request = new Request({
3626
3592
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3627
- method: "GET",
3628
- path: "/api/system/memory/quality",
3593
+ method: "POST",
3594
+ path: "/api/billing/checkout",
3629
3595
  config: this.config,
3630
3596
  retry: {
3631
3597
  attempts: 3,
@@ -3635,42 +3601,21 @@ var SystemService = class extends BaseService {
3635
3601
  backoffFactor: 2
3636
3602
  }
3637
3603
  });
3638
- if (options?.includeDetails !== void 0) {
3639
- request.addQueryParam("includeDetails", {
3640
- key: "includeDetails",
3641
- value: options.includeDetails,
3642
- explode: false,
3643
- encode: true,
3644
- style: "form",
3645
- isLimit: false,
3646
- isOffset: false,
3647
- isCursor: false
3648
- });
3649
- }
3650
- if (options?.minQualityThreshold !== void 0) {
3651
- request.addQueryParam("minQualityThreshold", {
3652
- key: "minQualityThreshold",
3653
- value: options.minQualityThreshold,
3654
- explode: false,
3655
- encode: true,
3656
- style: "form",
3657
- isLimit: false,
3658
- isOffset: false,
3659
- isCursor: false
3660
- });
3604
+ if (body !== void 0) {
3605
+ request.addBody(body);
3661
3606
  }
3662
3607
  return this.client.call(request);
3663
3608
  }
3664
3609
  /**
3665
- * Prune low-quality memories
3666
- * Prune (soft delete) low-quality memories for the authenticated user
3610
+ * Create billing portal session
3611
+ * Create a Stripe billing portal session for managing subscription
3667
3612
  * @param body - Request body
3668
3613
  */
3669
- async pruneMemories(options) {
3614
+ async createPortalSession(body) {
3670
3615
  const request = new Request({
3671
3616
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3672
3617
  method: "POST",
3673
- path: "/api/system/memory/prune",
3618
+ path: "/api/billing/portal",
3674
3619
  config: this.config,
3675
3620
  retry: {
3676
3621
  attempts: 3,
@@ -3680,26 +3625,20 @@ var SystemService = class extends BaseService {
3680
3625
  backoffFactor: 2
3681
3626
  }
3682
3627
  });
3683
- if (options?.body !== void 0) {
3684
- request.addBody(options?.body);
3628
+ if (body !== void 0) {
3629
+ request.addBody(body);
3685
3630
  }
3686
3631
  return this.client.call(request);
3687
3632
  }
3688
- };
3689
-
3690
- // src/services/patterns-service.ts
3691
- var PatternsService = class extends BaseService {
3692
3633
  /**
3693
- * List patterns
3694
- * List all patterns for the authenticated user
3695
- * @param limit - Maximum number of patterns to return
3696
- * @param offset - Number of patterns to skip
3634
+ * Get current subscription
3635
+ * Get the current subscription details for the authenticated user
3697
3636
  */
3698
- async listPatterns(options) {
3637
+ async getSubscription() {
3699
3638
  const request = new Request({
3700
3639
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3701
3640
  method: "GET",
3702
- path: "/api/patterns",
3641
+ path: "/api/billing/subscription",
3703
3642
  config: this.config,
3704
3643
  retry: {
3705
3644
  attempts: 3,
@@ -3709,42 +3648,18 @@ var PatternsService = class extends BaseService {
3709
3648
  backoffFactor: 2
3710
3649
  }
3711
3650
  });
3712
- if (options?.limit !== void 0) {
3713
- request.addQueryParam("limit", {
3714
- key: "limit",
3715
- value: options.limit,
3716
- explode: false,
3717
- encode: true,
3718
- style: "form",
3719
- isLimit: true,
3720
- isOffset: false,
3721
- isCursor: false
3722
- });
3723
- }
3724
- if (options?.offset !== void 0) {
3725
- request.addQueryParam("offset", {
3726
- key: "offset",
3727
- value: options.offset,
3728
- explode: false,
3729
- encode: true,
3730
- style: "form",
3731
- isLimit: false,
3732
- isOffset: true,
3733
- isCursor: false
3734
- });
3735
- }
3736
3651
  return this.client.call(request);
3737
3652
  }
3738
3653
  /**
3739
- * Compile patterns
3740
- * Compile patterns from user's memories
3654
+ * Cancel subscription
3655
+ * Cancel the current subscription at the end of the billing period
3741
3656
  * @param body - Request body
3742
3657
  */
3743
- async compilePatterns(options) {
3658
+ async cancelSubscription(options) {
3744
3659
  const request = new Request({
3745
3660
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3746
3661
  method: "POST",
3747
- path: "/api/patterns/compile",
3662
+ path: "/api/billing/subscription/cancel",
3748
3663
  config: this.config,
3749
3664
  retry: {
3750
3665
  attempts: 3,
@@ -3760,15 +3675,15 @@ var PatternsService = class extends BaseService {
3760
3675
  return this.client.call(request);
3761
3676
  }
3762
3677
  /**
3763
- * Detect behavioral patterns
3764
- * Run pattern detection algorithms to identify recurring behavioral patterns
3678
+ * Reactivate subscription
3679
+ * Reactivate a subscription that was scheduled for cancellation
3765
3680
  * @param body - Request body
3766
3681
  */
3767
- async detectPatterns(options) {
3682
+ async reactivateSubscription(options) {
3768
3683
  const request = new Request({
3769
3684
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3770
3685
  method: "POST",
3771
- path: "/api/patterns/detect",
3686
+ path: "/api/billing/subscription/reactivate",
3772
3687
  config: this.config,
3773
3688
  retry: {
3774
3689
  attempts: 3,
@@ -3784,15 +3699,15 @@ var PatternsService = class extends BaseService {
3784
3699
  return this.client.call(request);
3785
3700
  }
3786
3701
  /**
3787
- * Analyze pattern trends
3788
- * Analyze pattern trends, correlations, and generate insights
3789
- * @param body - Request body
3702
+ * List invoices
3703
+ * Get a list of invoices for the authenticated user
3704
+ * @param limit - Maximum number of invoices to return
3790
3705
  */
3791
- async analyzePatterns(options) {
3706
+ async listInvoices(options) {
3792
3707
  const request = new Request({
3793
3708
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3794
- method: "POST",
3795
- path: "/api/patterns/analyze",
3709
+ method: "GET",
3710
+ path: "/api/billing/invoices",
3796
3711
  config: this.config,
3797
3712
  retry: {
3798
3713
  attempts: 3,
@@ -3802,22 +3717,29 @@ var PatternsService = class extends BaseService {
3802
3717
  backoffFactor: 2
3803
3718
  }
3804
3719
  });
3805
- if (options?.body !== void 0) {
3806
- request.addBody(options?.body);
3720
+ if (options?.limit !== void 0) {
3721
+ request.addQueryParam("limit", {
3722
+ key: "limit",
3723
+ value: options.limit,
3724
+ explode: false,
3725
+ encode: true,
3726
+ style: "form",
3727
+ isLimit: true,
3728
+ isOffset: false,
3729
+ isCursor: false
3730
+ });
3807
3731
  }
3808
3732
  return this.client.call(request);
3809
3733
  }
3810
3734
  /**
3811
- * Update pattern
3812
- * Update an existing pattern with partial data
3813
- * @param id - The pattern ID
3814
- * @param body - Request body
3735
+ * List payment methods
3736
+ * Get a list of payment methods for the authenticated user
3815
3737
  */
3816
- async updatePattern(id, body) {
3738
+ async listPaymentMethods() {
3817
3739
  const request = new Request({
3818
3740
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3819
- method: "PATCH",
3820
- path: "/api/patterns/{id}",
3741
+ method: "GET",
3742
+ path: "/api/billing/payment-methods",
3821
3743
  config: this.config,
3822
3744
  retry: {
3823
3745
  attempts: 3,
@@ -3827,31 +3749,19 @@ var PatternsService = class extends BaseService {
3827
3749
  backoffFactor: 2
3828
3750
  }
3829
3751
  });
3830
- request.addPathParam("id", {
3831
- key: "id",
3832
- value: id,
3833
- explode: false,
3834
- encode: true,
3835
- style: "simple",
3836
- isLimit: false,
3837
- isOffset: false,
3838
- isCursor: false
3839
- });
3840
- if (body !== void 0) {
3841
- request.addBody(body);
3842
- }
3843
3752
  return this.client.call(request);
3844
3753
  }
3845
3754
  /**
3846
- * Record pattern feedback
3847
- * Record feedback on a pattern
3755
+ * Set default payment method
3756
+ * Set a payment method as the default for future payments
3757
+ * @param id - The payment method ID
3848
3758
  * @param body - Request body
3849
3759
  */
3850
- async recordPatternFeedback(body) {
3760
+ async setDefaultPaymentMethod(id, options) {
3851
3761
  const request = new Request({
3852
3762
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3853
3763
  method: "POST",
3854
- path: "/api/patterns/feedback",
3764
+ path: "/api/billing/payment-methods/{id}/default",
3855
3765
  config: this.config,
3856
3766
  retry: {
3857
3767
  attempts: 3,
@@ -3861,24 +3771,31 @@ var PatternsService = class extends BaseService {
3861
3771
  backoffFactor: 2
3862
3772
  }
3863
3773
  });
3864
- if (body !== void 0) {
3865
- request.addBody(body);
3774
+ request.addPathParam("id", {
3775
+ key: "id",
3776
+ value: id,
3777
+ explode: false,
3778
+ encode: true,
3779
+ style: "simple",
3780
+ isLimit: false,
3781
+ isOffset: false,
3782
+ isCursor: false
3783
+ });
3784
+ if (options?.body !== void 0) {
3785
+ request.addBody(options?.body);
3866
3786
  }
3867
3787
  return this.client.call(request);
3868
3788
  }
3869
- };
3870
-
3871
- // src/services/behavior-service.ts
3872
- var BehaviorService = class extends BaseService {
3873
3789
  /**
3874
- * Get behavioral state
3875
- * Get current behavioral state for the authenticated user
3790
+ * Delete payment method
3791
+ * Remove a payment method from the account
3792
+ * @param id - The payment method ID
3876
3793
  */
3877
- async getBehavioralState() {
3794
+ async deletePaymentMethod(id) {
3878
3795
  const request = new Request({
3879
3796
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3880
- method: "GET",
3881
- path: "/api/patterns/behavior/state",
3797
+ method: "DELETE",
3798
+ path: "/api/billing/payment-methods/{id}",
3882
3799
  config: this.config,
3883
3800
  retry: {
3884
3801
  attempts: 3,
@@ -3888,18 +3805,28 @@ var BehaviorService = class extends BaseService {
3888
3805
  backoffFactor: 2
3889
3806
  }
3890
3807
  });
3808
+ request.addPathParam("id", {
3809
+ key: "id",
3810
+ value: id,
3811
+ explode: false,
3812
+ encode: true,
3813
+ style: "simple",
3814
+ isLimit: false,
3815
+ isOffset: false,
3816
+ isCursor: false
3817
+ });
3891
3818
  return this.client.call(request);
3892
3819
  }
3893
3820
  /**
3894
- * Update behavioral state
3895
- * Update or mutate behavioral state
3821
+ * Stripe webhook endpoint
3822
+ * Receive and process Stripe webhook events
3896
3823
  * @param body - Request body
3897
3824
  */
3898
- async updateBehavioralState(options) {
3825
+ async stripeWebhook(body) {
3899
3826
  const request = new Request({
3900
3827
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3901
3828
  method: "POST",
3902
- path: "/api/patterns/behavior/state",
3829
+ path: "/api/billing/webhooks",
3903
3830
  config: this.config,
3904
3831
  retry: {
3905
3832
  attempts: 3,
@@ -3909,26 +3836,29 @@ var BehaviorService = class extends BaseService {
3909
3836
  backoffFactor: 2
3910
3837
  }
3911
3838
  });
3912
- if (options?.body !== void 0) {
3913
- request.addBody(options?.body);
3839
+ if (body !== void 0) {
3840
+ request.addBody(body);
3914
3841
  }
3915
3842
  return this.client.call(request);
3916
3843
  }
3917
3844
  };
3918
3845
 
3919
- // src/services/topics-service.ts
3920
- var TopicsService = class extends BaseService {
3846
+ // src/services/artifacts-service.ts
3847
+ var ArtifactsService = class extends BaseService {
3921
3848
  /**
3922
- * List topics
3923
- * List all topics with pagination
3924
- * @param limit - Maximum number of topics to return
3925
- * @param offset - Number of topics to skip
3849
+ * List artifacts
3850
+ * List all artifacts for the authenticated user with optional filters
3851
+ * @param limit - Maximum number of artifacts to return
3852
+ * @param offset - Number of artifacts to skip
3853
+ * @param memoryId - Filter by memory ID
3854
+ * @param conversationId - Filter by conversation ID
3855
+ * @param type - Filter by artifact type
3926
3856
  */
3927
- async listTopics(options) {
3857
+ async listArtifacts(options) {
3928
3858
  const request = new Request({
3929
3859
  baseUrl: this.config.baseUrl || "http://localhost:3000",
3930
3860
  method: "GET",
3931
- path: "/api/topics",
3861
+ path: "/api/artifacts",
3932
3862
  config: this.config,
3933
3863
  retry: {
3934
3864
  attempts: 3,
@@ -3962,49 +3892,54 @@ var TopicsService = class extends BaseService {
3962
3892
  isCursor: false
3963
3893
  });
3964
3894
  }
3895
+ if (options?.memoryId !== void 0) {
3896
+ request.addQueryParam("memoryId", {
3897
+ key: "memoryId",
3898
+ value: options.memoryId,
3899
+ explode: false,
3900
+ encode: true,
3901
+ style: "form",
3902
+ isLimit: false,
3903
+ isOffset: false,
3904
+ isCursor: false
3905
+ });
3906
+ }
3907
+ if (options?.conversationId !== void 0) {
3908
+ request.addQueryParam("conversationId", {
3909
+ key: "conversationId",
3910
+ value: options.conversationId,
3911
+ explode: false,
3912
+ encode: true,
3913
+ style: "form",
3914
+ isLimit: false,
3915
+ isOffset: false,
3916
+ isCursor: false
3917
+ });
3918
+ }
3919
+ if (options?.type !== void 0) {
3920
+ request.addQueryParam("type", {
3921
+ key: "type",
3922
+ value: options.type,
3923
+ explode: false,
3924
+ encode: true,
3925
+ style: "form",
3926
+ isLimit: false,
3927
+ isOffset: false,
3928
+ isCursor: false
3929
+ });
3930
+ }
3965
3931
  return this.client.call(request);
3966
3932
  }
3967
3933
  /**
3968
- * Get topic by ID
3969
- * Retrieve a specific topic by its ID
3970
- * @param id - The topic ID
3971
- */
3972
- async getTopicById(id) {
3973
- const request = new Request({
3974
- baseUrl: this.config.baseUrl || "http://localhost:3000",
3975
- method: "GET",
3976
- path: "/api/topics/{id}",
3977
- config: this.config,
3978
- retry: {
3979
- attempts: 3,
3980
- delayMs: 150,
3981
- maxDelayMs: 5e3,
3982
- jitterMs: 50,
3983
- backoffFactor: 2
3984
- }
3985
- });
3986
- request.addPathParam("id", {
3987
- key: "id",
3988
- value: id,
3989
- explode: false,
3990
- encode: true,
3991
- style: "simple",
3992
- isLimit: false,
3993
- isOffset: false,
3994
- isCursor: false
3995
- });
3996
- return this.client.call(request);
3997
- }
3998
- /**
3999
- * Merge topics
4000
- * Merge two topics into one
3934
+ * Create artifact
3935
+ * Create a new artifact for the authenticated user
4001
3936
  * @param body - Request body
4002
3937
  */
4003
- async mergeTopics(body) {
3938
+ async createArtifact(body) {
4004
3939
  const request = new Request({
4005
3940
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4006
3941
  method: "POST",
4007
- path: "/api/topics/merge",
3942
+ path: "/api/artifacts",
4008
3943
  config: this.config,
4009
3944
  retry: {
4010
3945
  attempts: 3,
@@ -4020,15 +3955,15 @@ var TopicsService = class extends BaseService {
4020
3955
  return this.client.call(request);
4021
3956
  }
4022
3957
  /**
4023
- * Discover related topics
4024
- * Discover topics related to a given topic
4025
- * @param body - Request body
3958
+ * Get artifact by ID
3959
+ * Retrieve a specific artifact by its ID
3960
+ * @param id - The artifact ID
4026
3961
  */
4027
- async discoverRelatedTopics(body) {
3962
+ async getArtifactById(id) {
4028
3963
  const request = new Request({
4029
3964
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4030
- method: "POST",
4031
- path: "/api/topics/discover-related",
3965
+ method: "GET",
3966
+ path: "/api/artifacts/{id}",
4032
3967
  config: this.config,
4033
3968
  retry: {
4034
3969
  attempts: 3,
@@ -4038,21 +3973,28 @@ var TopicsService = class extends BaseService {
4038
3973
  backoffFactor: 2
4039
3974
  }
4040
3975
  });
4041
- if (body !== void 0) {
4042
- request.addBody(body);
4043
- }
3976
+ request.addPathParam("id", {
3977
+ key: "id",
3978
+ value: id,
3979
+ explode: false,
3980
+ encode: true,
3981
+ style: "simple",
3982
+ isLimit: false,
3983
+ isOffset: false,
3984
+ isCursor: false
3985
+ });
4044
3986
  return this.client.call(request);
4045
3987
  }
4046
3988
  /**
4047
- * Calculate topic similarity
4048
- * Calculate similarity score between two topics
4049
- * @param body - Request body
3989
+ * Delete artifact
3990
+ * Delete an artifact by its ID
3991
+ * @param id - The artifact ID
4050
3992
  */
4051
- async calculateTopicSimilarity(body) {
3993
+ async deleteArtifact(id) {
4052
3994
  const request = new Request({
4053
3995
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4054
- method: "POST",
4055
- path: "/api/topics/similarity",
3996
+ method: "DELETE",
3997
+ path: "/api/artifacts/{id}",
4056
3998
  config: this.config,
4057
3999
  retry: {
4058
4000
  attempts: 3,
@@ -4062,21 +4004,29 @@ var TopicsService = class extends BaseService {
4062
4004
  backoffFactor: 2
4063
4005
  }
4064
4006
  });
4065
- if (body !== void 0) {
4066
- request.addBody(body);
4067
- }
4007
+ request.addPathParam("id", {
4008
+ key: "id",
4009
+ value: id,
4010
+ explode: false,
4011
+ encode: true,
4012
+ style: "simple",
4013
+ isLimit: false,
4014
+ isOffset: false,
4015
+ isCursor: false
4016
+ });
4068
4017
  return this.client.call(request);
4069
4018
  }
4070
4019
  /**
4071
- * Find similar topics
4072
- * Find topics similar to a given topic
4020
+ * Update artifact
4021
+ * Update an existing artifact with partial data
4022
+ * @param id - The artifact ID
4073
4023
  * @param body - Request body
4074
4024
  */
4075
- async findSimilarTopics(body) {
4025
+ async updateArtifact(id, body) {
4076
4026
  const request = new Request({
4077
4027
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4078
- method: "POST",
4079
- path: "/api/topics/similar",
4028
+ method: "PATCH",
4029
+ path: "/api/artifacts/{id}",
4080
4030
  config: this.config,
4081
4031
  retry: {
4082
4032
  attempts: 3,
@@ -4086,21 +4036,34 @@ var TopicsService = class extends BaseService {
4086
4036
  backoffFactor: 2
4087
4037
  }
4088
4038
  });
4039
+ request.addPathParam("id", {
4040
+ key: "id",
4041
+ value: id,
4042
+ explode: false,
4043
+ encode: true,
4044
+ style: "simple",
4045
+ isLimit: false,
4046
+ isOffset: false,
4047
+ isCursor: false
4048
+ });
4089
4049
  if (body !== void 0) {
4090
4050
  request.addBody(body);
4091
4051
  }
4092
4052
  return this.client.call(request);
4093
4053
  }
4054
+ };
4055
+
4056
+ // src/services/api-keys-service.ts
4057
+ var ApiKeysService = class extends BaseService {
4094
4058
  /**
4095
- * Cluster topics
4096
- * Cluster topics using community detection algorithms
4097
- * @param body - Request body
4059
+ * Get user information for current API key
4060
+ * Debug endpoint to retrieve user ID and authentication method from the current API key
4098
4061
  */
4099
- async clusterTopics(options) {
4062
+ async debugUser() {
4100
4063
  const request = new Request({
4101
4064
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4102
- method: "POST",
4103
- path: "/api/topics/cluster",
4065
+ method: "GET",
4066
+ path: "/api/apikeys/debug-user",
4104
4067
  config: this.config,
4105
4068
  retry: {
4106
4069
  attempts: 3,
@@ -4110,21 +4073,17 @@ var TopicsService = class extends BaseService {
4110
4073
  backoffFactor: 2
4111
4074
  }
4112
4075
  });
4113
- if (options?.body !== void 0) {
4114
- request.addBody(options?.body);
4115
- }
4116
4076
  return this.client.call(request);
4117
4077
  }
4118
4078
  /**
4119
- * Detect communities
4120
- * Detect communities in the topic graph using specified algorithm
4121
- * @param body - Request body
4079
+ * List API keys
4080
+ * List all API keys for the authenticated user
4122
4081
  */
4123
- async detectCommunities(options) {
4082
+ async listApiKeys() {
4124
4083
  const request = new Request({
4125
4084
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4126
- method: "POST",
4127
- path: "/api/topics/detect-communities",
4085
+ method: "GET",
4086
+ path: "/api/apikeys",
4128
4087
  config: this.config,
4129
4088
  retry: {
4130
4089
  attempts: 3,
@@ -4134,21 +4093,18 @@ var TopicsService = class extends BaseService {
4134
4093
  backoffFactor: 2
4135
4094
  }
4136
4095
  });
4137
- if (options?.body !== void 0) {
4138
- request.addBody(options?.body);
4139
- }
4140
4096
  return this.client.call(request);
4141
4097
  }
4142
4098
  /**
4143
- * Search topics
4144
- * Search topics by query string using fulltext search
4099
+ * Create API key
4100
+ * Create a new API key for the authenticated user
4145
4101
  * @param body - Request body
4146
4102
  */
4147
- async searchTopics(body) {
4103
+ async createApiKey(options) {
4148
4104
  const request = new Request({
4149
4105
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4150
4106
  method: "POST",
4151
- path: "/api/topics/search",
4107
+ path: "/api/apikeys",
4152
4108
  config: this.config,
4153
4109
  retry: {
4154
4110
  attempts: 3,
@@ -4158,30 +4114,21 @@ var TopicsService = class extends BaseService {
4158
4114
  backoffFactor: 2
4159
4115
  }
4160
4116
  });
4161
- if (body !== void 0) {
4162
- request.addBody(body);
4117
+ if (options?.body !== void 0) {
4118
+ request.addBody(options?.body);
4163
4119
  }
4164
4120
  return this.client.call(request);
4165
4121
  }
4166
- };
4167
-
4168
- // src/services/users-service.ts
4169
- var UsersService = class extends BaseService {
4170
4122
  /**
4171
- * Sync user from WorkOS
4172
- * Called by the customer portal after WorkOS authentication.
4173
- Creates a new user if they don't exist, or updates their profile if they do.
4174
- This is the main entry point for user provisioning.
4175
- When the invite gate is closed and a new user is created, the inviteCode
4176
- is redeemed atomically to track which code was used for registration.
4177
-
4178
- * @param body - Request body
4179
- */
4180
- async syncUser(body) {
4123
+ * Delete API key
4124
+ * Delete (revoke) an API key by its ID
4125
+ * @param id - The API key ID
4126
+ */
4127
+ async deleteApiKey(id) {
4181
4128
  const request = new Request({
4182
4129
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4183
- method: "POST",
4184
- path: "/api/users/sync",
4130
+ method: "DELETE",
4131
+ path: "/api/apikeys/{id}",
4185
4132
  config: this.config,
4186
4133
  retry: {
4187
4134
  attempts: 3,
@@ -4191,20 +4138,34 @@ var UsersService = class extends BaseService {
4191
4138
  backoffFactor: 2
4192
4139
  }
4193
4140
  });
4194
- if (body !== void 0) {
4195
- request.addBody(body);
4196
- }
4141
+ request.addPathParam("id", {
4142
+ key: "id",
4143
+ value: id,
4144
+ explode: false,
4145
+ encode: true,
4146
+ style: "simple",
4147
+ isLimit: false,
4148
+ isOffset: false,
4149
+ isCursor: false
4150
+ });
4197
4151
  return this.client.call(request);
4198
4152
  }
4153
+ };
4154
+
4155
+ // src/services/admin-service.ts
4156
+ var AdminService = class extends BaseService {
4199
4157
  /**
4200
- * Get current user
4201
- * Get the currently authenticated user's profile and usage information
4158
+ * List invite codes
4159
+ * List all invite codes with optional status filter
4160
+ * @param status - Filter by status
4161
+ * @param limit -
4162
+ * @param offset -
4202
4163
  */
4203
- async getCurrentUser() {
4164
+ async adminListInviteCodes(options) {
4204
4165
  const request = new Request({
4205
4166
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4206
4167
  method: "GET",
4207
- path: "/api/users/me",
4168
+ path: "/api/admin/invites",
4208
4169
  config: this.config,
4209
4170
  retry: {
4210
4171
  attempts: 3,
@@ -4214,18 +4175,54 @@ var UsersService = class extends BaseService {
4214
4175
  backoffFactor: 2
4215
4176
  }
4216
4177
  });
4178
+ if (options?.status !== void 0) {
4179
+ request.addQueryParam("status", {
4180
+ key: "status",
4181
+ value: options.status,
4182
+ explode: false,
4183
+ encode: true,
4184
+ style: "form",
4185
+ isLimit: false,
4186
+ isOffset: false,
4187
+ isCursor: false
4188
+ });
4189
+ }
4190
+ if (options?.limit !== void 0) {
4191
+ request.addQueryParam("limit", {
4192
+ key: "limit",
4193
+ value: options.limit,
4194
+ explode: false,
4195
+ encode: true,
4196
+ style: "form",
4197
+ isLimit: true,
4198
+ isOffset: false,
4199
+ isCursor: false
4200
+ });
4201
+ }
4202
+ if (options?.offset !== void 0) {
4203
+ request.addQueryParam("offset", {
4204
+ key: "offset",
4205
+ value: options.offset,
4206
+ explode: false,
4207
+ encode: true,
4208
+ style: "form",
4209
+ isLimit: false,
4210
+ isOffset: true,
4211
+ isCursor: false
4212
+ });
4213
+ }
4217
4214
  return this.client.call(request);
4218
4215
  }
4219
4216
  /**
4220
- * Update current user
4221
- * Update the currently authenticated user's profile
4217
+ * Create invite code
4218
+ * Create a new invite code for the gated preview
4222
4219
  * @param body - Request body
4223
4220
  */
4224
- async updateCurrentUser(options) {
4221
+ async adminCreateInviteCode(body) {
4225
4222
  const request = new Request({
4226
4223
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4227
- method: "PATCH",
4228
- path: "/api/users/me",
4224
+ method: "POST",
4225
+ path: "/api/admin/invites",
4229
4226
  config: this.config,
4230
4227
  retry: {
4231
4228
  attempts: 3,
@@ -4235,20 +4232,20 @@ var UsersService = class extends BaseService {
4235
4232
  backoffFactor: 2
4236
4233
  }
4237
4234
  });
4238
- if (options?.body !== void 0) {
4239
- request.addBody(options?.body);
4235
+ if (body !== void 0) {
4236
+ request.addBody(body);
4240
4237
  }
4241
4238
  return this.client.call(request);
4242
4239
  }
4243
4240
  /**
4244
- * Get current user's usage
4245
- * Get the currently authenticated user's memory usage statistics
4241
+ * Get invite system statistics
4242
+ * Aggregate statistics for the invite system
4246
4243
  */
4247
- async getCurrentUserUsage() {
4244
+ async adminGetInviteStats() {
4248
4245
  const request = new Request({
4249
4246
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4250
4247
  method: "GET",
4251
- path: "/api/users/me/usage",
4248
+ path: "/api/admin/invites/stats",
4252
4249
  config: this.config,
4253
4250
  retry: {
4254
4251
  attempts: 3,
@@ -4261,18 +4258,15 @@ var UsersService = class extends BaseService {
4261
4258
  return this.client.call(request);
4262
4259
  }
4263
4260
  /**
4264
- * Export all user data
4265
- * Export all user data as a JSON archive. Includes profile, memories,
4266
- conversations, facts, and patterns. Supports GDPR Article 20
4267
- (right to data portability). Sensitive fields (Stripe customer ID,
4268
- WorkOS ID, embeddings) are excluded.
4269
-
4270
- */
4271
- async exportUserData() {
4261
+ * Get invite code details
4262
+ * Get details for a single invite code including redemptions
4263
+ * @param code - The invite code
4264
+ */
4265
+ async adminGetInviteCode(code) {
4272
4266
  const request = new Request({
4273
4267
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4274
4268
  method: "GET",
4275
- path: "/api/users/me/export",
4269
+ path: "/api/admin/invites/{code}",
4276
4270
  config: this.config,
4277
4271
  retry: {
4278
4272
  attempts: 3,
@@ -4282,21 +4276,28 @@ var UsersService = class extends BaseService {
4282
4276
  backoffFactor: 2
4283
4277
  }
4284
4278
  });
4279
+ request.addPathParam("code", {
4280
+ key: "code",
4281
+ value: code,
4282
+ explode: false,
4283
+ encode: true,
4284
+ style: "simple",
4285
+ isLimit: false,
4286
+ isOffset: false,
4287
+ isCursor: false
4288
+ });
4285
4289
  return this.client.call(request);
4286
4290
  }
4287
4291
  /**
4288
- * Initiate account deletion
4289
- * Schedule the current user's account for deletion after a 7-day grace period.
4290
- Requires email confirmation. Immediately revokes API keys and cancels
4291
- any active subscription. The account enters read-only mode.
4292
-
4293
- * @param body - Request body
4294
- */
4295
- async initiateAccountDeletion(body) {
4292
+ * Revoke an invite code
4293
+ * Revoke an invite code. Existing accounts created with this code are unaffected.
4294
+ * @param code -
4295
+ */
4296
+ async adminRevokeInviteCode(code) {
4296
4297
  const request = new Request({
4297
4298
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4298
- method: "POST",
4299
- path: "/api/users/me/deletion",
4299
+ method: "DELETE",
4300
+ path: "/api/admin/invites/{code}",
4300
4301
  config: this.config,
4301
4302
  retry: {
4302
4303
  attempts: 3,
@@ -4306,23 +4307,27 @@ var UsersService = class extends BaseService {
4306
4307
  backoffFactor: 2
4307
4308
  }
4308
4309
  });
4309
- if (body !== void 0) {
4310
- request.addBody(body);
4311
- }
4310
+ request.addPathParam("code", {
4311
+ key: "code",
4312
+ value: code,
4313
+ explode: false,
4314
+ encode: true,
4315
+ style: "simple",
4316
+ isLimit: false,
4317
+ isOffset: false,
4318
+ isCursor: false
4319
+ });
4312
4320
  return this.client.call(request);
4313
4321
  }
4314
4322
  /**
4315
- * Cancel account deletion
4316
- * Cancel a pending account deletion during the grace period.
4317
- Note: Previously revoked API keys are not restored — new keys must be created.
4318
- Stripe subscription may need manual reactivation via the billing portal.
4319
-
4320
- */
4321
- async cancelAccountDeletion() {
4323
+ * Get gate status with audit info
4324
+ * Get current invite gate state with audit information
4325
+ */
4326
+ async adminGetGateStatus() {
4322
4327
  const request = new Request({
4323
4328
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4324
- method: "DELETE",
4325
- path: "/api/users/me/deletion",
4329
+ method: "GET",
4330
+ path: "/api/admin/gate",
4326
4331
  config: this.config,
4327
4332
  retry: {
4328
4333
  attempts: 3,
@@ -4335,15 +4340,17 @@ var UsersService = class extends BaseService {
4335
4340
  return this.client.call(request);
4336
4341
  }
4337
4342
  /**
4338
- * Get user by ID
4339
- * Get a user by their internal ID (admin only)
4340
- * @param id -
4341
- */
4342
- async getUserById(id) {
4343
+ * Toggle invite gate
4344
+ * Toggle the invite gate. When enabled (true), new signups require a valid invite code.
4345
+ When disabled (false), registration is open. Takes effect immediately.
4346
+
4347
+ * @param body - Request body
4348
+ */
4349
+ async adminSetGateStatus(body) {
4343
4350
  const request = new Request({
4344
4351
  baseUrl: this.config.baseUrl || "http://localhost:3000",
4345
- method: "GET",
4346
- path: "/api/users/{id}",
4352
+ method: "POST",
4353
+ path: "/api/admin/gate",
4347
4354
  config: this.config,
4348
4355
  retry: {
4349
4356
  attempts: 3,
@@ -4353,16 +4360,9 @@ var UsersService = class extends BaseService {
4353
4360
  backoffFactor: 2
4354
4361
  }
4355
4362
  });
4356
- request.addPathParam("id", {
4357
- key: "id",
4358
- value: id,
4359
- explode: false,
4360
- encode: true,
4361
- style: "simple",
4362
- isLimit: false,
4363
- isOffset: false,
4364
- isCursor: false
4365
- });
4363
+ if (body !== void 0) {
4364
+ request.addBody(body);
4365
+ }
4366
4366
  return this.client.call(request);
4367
4367
  }
4368
4368
  };
@@ -5475,42 +5475,42 @@ var digestResponse = z.lazy(() => z.object({
5475
5475
  // src/index.ts
5476
5476
  var Memnexus = class {
5477
5477
  config;
5478
- /** Admin management endpoints for invite codes and platform configuration operations */
5479
- admin;
5480
- /** API key management endpoints operations */
5481
- apiKeys;
5482
- /** Artifact storage and retrieval endpoints operations */
5483
- artifacts;
5484
- /** Subscription billing and payment management endpoints operations */
5485
- billing;
5486
- /** Conversation tracking and analysis endpoints operations */
5487
- conversations;
5488
- /** Entity extraction and discovery endpoints operations */
5489
- entities;
5490
- /** Fact extraction and management endpoints operations */
5491
- facts;
5492
- /** Graph-based retrieval augmented generation endpoints operations */
5493
- graphrag;
5494
- /** Health check endpoints operations */
5495
- health;
5496
- /** Invite code validation and gate status endpoints operations */
5497
- invites;
5498
- /** Memory management and retrieval endpoints operations */
5499
- memories;
5500
- /** Observability and metrics endpoints for production monitoring operations */
5501
- monitoring;
5502
- /** Narrative thread management endpoints operations */
5503
- narratives;
5478
+ /** User management and profile endpoints operations */
5479
+ users;
5480
+ /** Topic detection, clustering, and management endpoints operations */
5481
+ topics;
5504
5482
  /** System health, monitoring, and configuration endpoints operations */
5505
5483
  system;
5506
5484
  /** Pattern detection and behavioral analysis endpoints operations */
5507
5485
  patterns;
5508
5486
  /** Behavioral pattern tracking and state management endpoints operations */
5509
5487
  behavior;
5510
- /** Topic detection, clustering, and management endpoints operations */
5511
- topics;
5512
- /** User management and profile endpoints operations */
5513
- users;
5488
+ /** Narrative thread management endpoints operations */
5489
+ narratives;
5490
+ /** Observability and metrics endpoints for production monitoring operations */
5491
+ monitoring;
5492
+ /** Memory management and retrieval endpoints operations */
5493
+ memories;
5494
+ /** Invite code validation and gate status endpoints operations */
5495
+ invites;
5496
+ /** Health check endpoints operations */
5497
+ health;
5498
+ /** Graph-based retrieval augmented generation endpoints operations */
5499
+ graphrag;
5500
+ /** Fact extraction and management endpoints operations */
5501
+ facts;
5502
+ /** Entity extraction and discovery endpoints operations */
5503
+ entities;
5504
+ /** Conversation tracking and analysis endpoints operations */
5505
+ conversations;
5506
+ /** Subscription billing and payment management endpoints operations */
5507
+ billing;
5508
+ /** Artifact storage and retrieval endpoints operations */
5509
+ artifacts;
5510
+ /** API key management endpoints operations */
5511
+ apiKeys;
5512
+ /** Admin management endpoints for invite codes and platform configuration operations */
5513
+ admin;
5514
5514
  /**
5515
5515
  * Create a new SDK client.
5516
5516
  * @param config - SDK configuration
@@ -5520,24 +5520,24 @@ var Memnexus = class {
5520
5520
  baseUrl: config.baseUrl || "http://localhost:3000",
5521
5521
  ...config
5522
5522
  };
5523
- this.admin = new AdminService(this.config);
5524
- this.apiKeys = new ApiKeysService(this.config);
5525
- this.artifacts = new ArtifactsService(this.config);
5526
- this.billing = new BillingService(this.config);
5527
- this.conversations = new ConversationsService(this.config);
5528
- this.entities = new EntitiesService(this.config);
5529
- this.facts = new FactsService(this.config);
5530
- this.graphrag = new GraphragService(this.config);
5531
- this.health = new HealthService(this.config);
5532
- this.invites = new InvitesService(this.config);
5533
- this.memories = new MemoriesService(this.config);
5534
- this.monitoring = new MonitoringService(this.config);
5535
- this.narratives = new NarrativesService(this.config);
5523
+ this.users = new UsersService(this.config);
5524
+ this.topics = new TopicsService(this.config);
5536
5525
  this.system = new SystemService(this.config);
5537
5526
  this.patterns = new PatternsService(this.config);
5538
5527
  this.behavior = new BehaviorService(this.config);
5539
- this.topics = new TopicsService(this.config);
5540
- this.users = new UsersService(this.config);
5528
+ this.narratives = new NarrativesService(this.config);
5529
+ this.monitoring = new MonitoringService(this.config);
5530
+ this.memories = new MemoriesService(this.config);
5531
+ this.invites = new InvitesService(this.config);
5532
+ this.health = new HealthService(this.config);
5533
+ this.graphrag = new GraphragService(this.config);
5534
+ this.facts = new FactsService(this.config);
5535
+ this.entities = new EntitiesService(this.config);
5536
+ this.conversations = new ConversationsService(this.config);
5537
+ this.billing = new BillingService(this.config);
5538
+ this.artifacts = new ArtifactsService(this.config);
5539
+ this.apiKeys = new ApiKeysService(this.config);
5540
+ this.admin = new AdminService(this.config);
5541
5541
  }
5542
5542
  /**
5543
5543
  * Set the API token for authentication.
@@ -5545,24 +5545,24 @@ var Memnexus = class {
5545
5545
  */
5546
5546
  setToken(token) {
5547
5547
  this.config.token = token;
5548
- this.admin.token = token;
5549
- this.apiKeys.token = token;
5550
- this.artifacts.token = token;
5551
- this.billing.token = token;
5552
- this.conversations.token = token;
5553
- this.entities.token = token;
5554
- this.facts.token = token;
5555
- this.graphrag.token = token;
5556
- this.health.token = token;
5557
- this.invites.token = token;
5558
- this.memories.token = token;
5559
- this.monitoring.token = token;
5560
- this.narratives.token = token;
5548
+ this.users.token = token;
5549
+ this.topics.token = token;
5561
5550
  this.system.token = token;
5562
5551
  this.patterns.token = token;
5563
5552
  this.behavior.token = token;
5564
- this.topics.token = token;
5565
- this.users.token = token;
5553
+ this.narratives.token = token;
5554
+ this.monitoring.token = token;
5555
+ this.memories.token = token;
5556
+ this.invites.token = token;
5557
+ this.health.token = token;
5558
+ this.graphrag.token = token;
5559
+ this.facts.token = token;
5560
+ this.entities.token = token;
5561
+ this.conversations.token = token;
5562
+ this.billing.token = token;
5563
+ this.artifacts.token = token;
5564
+ this.apiKeys.token = token;
5565
+ this.admin.token = token;
5566
5566
  }
5567
5567
  /**
5568
5568
  * Set the base URL for API requests.
@@ -5570,24 +5570,24 @@ var Memnexus = class {
5570
5570
  */
5571
5571
  setBaseUrl(baseUrl) {
5572
5572
  this.config.baseUrl = baseUrl;
5573
- this.admin.baseUrl = baseUrl;
5574
- this.apiKeys.baseUrl = baseUrl;
5575
- this.artifacts.baseUrl = baseUrl;
5576
- this.billing.baseUrl = baseUrl;
5577
- this.conversations.baseUrl = baseUrl;
5578
- this.entities.baseUrl = baseUrl;
5579
- this.facts.baseUrl = baseUrl;
5580
- this.graphrag.baseUrl = baseUrl;
5581
- this.health.baseUrl = baseUrl;
5582
- this.invites.baseUrl = baseUrl;
5583
- this.memories.baseUrl = baseUrl;
5584
- this.monitoring.baseUrl = baseUrl;
5585
- this.narratives.baseUrl = baseUrl;
5573
+ this.users.baseUrl = baseUrl;
5574
+ this.topics.baseUrl = baseUrl;
5586
5575
  this.system.baseUrl = baseUrl;
5587
5576
  this.patterns.baseUrl = baseUrl;
5588
5577
  this.behavior.baseUrl = baseUrl;
5589
- this.topics.baseUrl = baseUrl;
5590
- this.users.baseUrl = baseUrl;
5578
+ this.narratives.baseUrl = baseUrl;
5579
+ this.monitoring.baseUrl = baseUrl;
5580
+ this.memories.baseUrl = baseUrl;
5581
+ this.invites.baseUrl = baseUrl;
5582
+ this.health.baseUrl = baseUrl;
5583
+ this.graphrag.baseUrl = baseUrl;
5584
+ this.facts.baseUrl = baseUrl;
5585
+ this.entities.baseUrl = baseUrl;
5586
+ this.conversations.baseUrl = baseUrl;
5587
+ this.billing.baseUrl = baseUrl;
5588
+ this.artifacts.baseUrl = baseUrl;
5589
+ this.apiKeys.baseUrl = baseUrl;
5590
+ this.admin.baseUrl = baseUrl;
5591
5591
  }
5592
5592
  /**
5593
5593
  * Set the environment.
@@ -5595,24 +5595,24 @@ var Memnexus = class {
5595
5595
  */
5596
5596
  setEnvironment(environment) {
5597
5597
  this.config.environment = environment;
5598
- this.admin.environment = environment;
5599
- this.apiKeys.environment = environment;
5600
- this.artifacts.environment = environment;
5601
- this.billing.environment = environment;
5602
- this.conversations.environment = environment;
5603
- this.entities.environment = environment;
5604
- this.facts.environment = environment;
5605
- this.graphrag.environment = environment;
5606
- this.health.environment = environment;
5607
- this.invites.environment = environment;
5608
- this.memories.environment = environment;
5609
- this.monitoring.environment = environment;
5610
- this.narratives.environment = environment;
5598
+ this.users.environment = environment;
5599
+ this.topics.environment = environment;
5611
5600
  this.system.environment = environment;
5612
5601
  this.patterns.environment = environment;
5613
5602
  this.behavior.environment = environment;
5614
- this.topics.environment = environment;
5615
- this.users.environment = environment;
5603
+ this.narratives.environment = environment;
5604
+ this.monitoring.environment = environment;
5605
+ this.memories.environment = environment;
5606
+ this.invites.environment = environment;
5607
+ this.health.environment = environment;
5608
+ this.graphrag.environment = environment;
5609
+ this.facts.environment = environment;
5610
+ this.entities.environment = environment;
5611
+ this.conversations.environment = environment;
5612
+ this.billing.environment = environment;
5613
+ this.artifacts.environment = environment;
5614
+ this.apiKeys.environment = environment;
5615
+ this.admin.environment = environment;
5616
5616
  }
5617
5617
  };
5618
5618
  var index_default = Memnexus;