@superatomai/sdk-node 0.0.47 → 0.0.48-mds
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.d.mts +881 -66
- package/dist/index.d.ts +881 -66
- package/dist/index.js +14538 -8658
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14509 -8639
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -59,7 +59,18 @@ declare class Logger {
|
|
|
59
59
|
* Log debug message (only shown for verbose level)
|
|
60
60
|
*/
|
|
61
61
|
debug(...args: any[]): void;
|
|
62
|
+
/**
|
|
63
|
+
* Write to log file
|
|
64
|
+
*/
|
|
62
65
|
file(...args: any[]): void;
|
|
66
|
+
/**
|
|
67
|
+
* Clear the log file (call at start of new user request)
|
|
68
|
+
*/
|
|
69
|
+
clearFile(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Log LLM method prompts with clear labeling
|
|
72
|
+
*/
|
|
73
|
+
logLLMPrompt(methodName: string, promptType: 'system' | 'user', content: string | object | any[]): void;
|
|
63
74
|
}
|
|
64
75
|
declare const logger: Logger;
|
|
65
76
|
|
|
@@ -623,19 +634,19 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
623
634
|
type: z.ZodString;
|
|
624
635
|
description: z.ZodString;
|
|
625
636
|
props: z.ZodObject<{
|
|
626
|
-
query: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]
|
|
637
|
+
query: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
|
|
627
638
|
title: z.ZodOptional<z.ZodString>;
|
|
628
639
|
description: z.ZodOptional<z.ZodString>;
|
|
629
640
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
630
641
|
actions: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
631
642
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
632
|
-
query: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]
|
|
643
|
+
query: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
|
|
633
644
|
title: z.ZodOptional<z.ZodString>;
|
|
634
645
|
description: z.ZodOptional<z.ZodString>;
|
|
635
646
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
636
647
|
actions: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
637
648
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
638
|
-
query: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]
|
|
649
|
+
query: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
|
|
639
650
|
title: z.ZodOptional<z.ZodString>;
|
|
640
651
|
description: z.ZodOptional<z.ZodString>;
|
|
641
652
|
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -650,7 +661,7 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
650
661
|
description: string;
|
|
651
662
|
props: {
|
|
652
663
|
description?: string | undefined;
|
|
653
|
-
query?: string | {} | undefined;
|
|
664
|
+
query?: string | {} | null | undefined;
|
|
654
665
|
title?: string | undefined;
|
|
655
666
|
config?: Record<string, unknown> | undefined;
|
|
656
667
|
actions?: any[] | undefined;
|
|
@@ -668,7 +679,7 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
668
679
|
description: string;
|
|
669
680
|
props: {
|
|
670
681
|
description?: string | undefined;
|
|
671
|
-
query?: string | {} | undefined;
|
|
682
|
+
query?: string | {} | null | undefined;
|
|
672
683
|
title?: string | undefined;
|
|
673
684
|
config?: Record<string, unknown> | undefined;
|
|
674
685
|
actions?: any[] | undefined;
|
|
@@ -681,24 +692,137 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
681
692
|
keywords?: string[] | undefined;
|
|
682
693
|
}>;
|
|
683
694
|
type Component = z.infer<typeof ComponentSchema>;
|
|
695
|
+
declare const OutputFieldSchema: z.ZodObject<{
|
|
696
|
+
name: z.ZodString;
|
|
697
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
698
|
+
description: z.ZodString;
|
|
699
|
+
}, "strip", z.ZodTypeAny, {
|
|
700
|
+
type: "string" | "number" | "boolean" | "date";
|
|
701
|
+
name: string;
|
|
702
|
+
description: string;
|
|
703
|
+
}, {
|
|
704
|
+
type: "string" | "number" | "boolean" | "date";
|
|
705
|
+
name: string;
|
|
706
|
+
description: string;
|
|
707
|
+
}>;
|
|
708
|
+
type OutputField = z.infer<typeof OutputFieldSchema>;
|
|
709
|
+
declare const OutputSchema: z.ZodObject<{
|
|
710
|
+
description: z.ZodString;
|
|
711
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
712
|
+
name: z.ZodString;
|
|
713
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
714
|
+
description: z.ZodString;
|
|
715
|
+
}, "strip", z.ZodTypeAny, {
|
|
716
|
+
type: "string" | "number" | "boolean" | "date";
|
|
717
|
+
name: string;
|
|
718
|
+
description: string;
|
|
719
|
+
}, {
|
|
720
|
+
type: "string" | "number" | "boolean" | "date";
|
|
721
|
+
name: string;
|
|
722
|
+
description: string;
|
|
723
|
+
}>, "many">;
|
|
724
|
+
}, "strip", z.ZodTypeAny, {
|
|
725
|
+
description: string;
|
|
726
|
+
fields: {
|
|
727
|
+
type: "string" | "number" | "boolean" | "date";
|
|
728
|
+
name: string;
|
|
729
|
+
description: string;
|
|
730
|
+
}[];
|
|
731
|
+
}, {
|
|
732
|
+
description: string;
|
|
733
|
+
fields: {
|
|
734
|
+
type: "string" | "number" | "boolean" | "date";
|
|
735
|
+
name: string;
|
|
736
|
+
description: string;
|
|
737
|
+
}[];
|
|
738
|
+
}>;
|
|
739
|
+
type ToolOutputSchema = z.infer<typeof OutputSchema>;
|
|
684
740
|
declare const ToolSchema: z.ZodObject<{
|
|
685
741
|
id: z.ZodString;
|
|
686
742
|
name: z.ZodString;
|
|
687
743
|
description: z.ZodString;
|
|
744
|
+
/** Tool type: "source" = routed through SourceAgent, "direct" = called directly by MainAgent */
|
|
745
|
+
toolType: z.ZodOptional<z.ZodEnum<["source", "direct"]>>;
|
|
746
|
+
/** Full untruncated schema for source agent (all columns visible) */
|
|
747
|
+
fullSchema: z.ZodOptional<z.ZodString>;
|
|
688
748
|
params: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
689
749
|
fn: z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodAny>;
|
|
750
|
+
outputSchema: z.ZodOptional<z.ZodObject<{
|
|
751
|
+
description: z.ZodString;
|
|
752
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
753
|
+
name: z.ZodString;
|
|
754
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
755
|
+
description: z.ZodString;
|
|
756
|
+
}, "strip", z.ZodTypeAny, {
|
|
757
|
+
type: "string" | "number" | "boolean" | "date";
|
|
758
|
+
name: string;
|
|
759
|
+
description: string;
|
|
760
|
+
}, {
|
|
761
|
+
type: "string" | "number" | "boolean" | "date";
|
|
762
|
+
name: string;
|
|
763
|
+
description: string;
|
|
764
|
+
}>, "many">;
|
|
765
|
+
}, "strip", z.ZodTypeAny, {
|
|
766
|
+
description: string;
|
|
767
|
+
fields: {
|
|
768
|
+
type: "string" | "number" | "boolean" | "date";
|
|
769
|
+
name: string;
|
|
770
|
+
description: string;
|
|
771
|
+
}[];
|
|
772
|
+
}, {
|
|
773
|
+
description: string;
|
|
774
|
+
fields: {
|
|
775
|
+
type: "string" | "number" | "boolean" | "date";
|
|
776
|
+
name: string;
|
|
777
|
+
description: string;
|
|
778
|
+
}[];
|
|
779
|
+
}>>;
|
|
780
|
+
/** Cache policy. `false` = never cache (live data, write ops). Mirrors HTTP `Cache-Control: no-store`. */
|
|
781
|
+
cache: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<false>, z.ZodObject<{
|
|
782
|
+
ttlMs: z.ZodOptional<z.ZodNumber>;
|
|
783
|
+
}, "strip", z.ZodTypeAny, {
|
|
784
|
+
ttlMs?: number | undefined;
|
|
785
|
+
}, {
|
|
786
|
+
ttlMs?: number | undefined;
|
|
787
|
+
}>]>>;
|
|
690
788
|
}, "strip", z.ZodTypeAny, {
|
|
691
789
|
id: string;
|
|
692
790
|
params: Record<string, string>;
|
|
693
791
|
name: string;
|
|
694
792
|
description: string;
|
|
695
793
|
fn: (args_0: any, ...args: unknown[]) => any;
|
|
794
|
+
toolType?: "source" | "direct" | undefined;
|
|
795
|
+
fullSchema?: string | undefined;
|
|
796
|
+
outputSchema?: {
|
|
797
|
+
description: string;
|
|
798
|
+
fields: {
|
|
799
|
+
type: "string" | "number" | "boolean" | "date";
|
|
800
|
+
name: string;
|
|
801
|
+
description: string;
|
|
802
|
+
}[];
|
|
803
|
+
} | undefined;
|
|
804
|
+
cache?: false | {
|
|
805
|
+
ttlMs?: number | undefined;
|
|
806
|
+
} | undefined;
|
|
696
807
|
}, {
|
|
697
808
|
id: string;
|
|
698
809
|
params: Record<string, string>;
|
|
699
810
|
name: string;
|
|
700
811
|
description: string;
|
|
701
812
|
fn: (args_0: any, ...args: unknown[]) => any;
|
|
813
|
+
toolType?: "source" | "direct" | undefined;
|
|
814
|
+
fullSchema?: string | undefined;
|
|
815
|
+
outputSchema?: {
|
|
816
|
+
description: string;
|
|
817
|
+
fields: {
|
|
818
|
+
type: "string" | "number" | "boolean" | "date";
|
|
819
|
+
name: string;
|
|
820
|
+
description: string;
|
|
821
|
+
}[];
|
|
822
|
+
} | undefined;
|
|
823
|
+
cache?: false | {
|
|
824
|
+
ttlMs?: number | undefined;
|
|
825
|
+
} | undefined;
|
|
702
826
|
}>;
|
|
703
827
|
type Tool$1 = z.infer<typeof ToolSchema>;
|
|
704
828
|
type CollectionOperation = 'getMany' | 'getOne' | 'query' | 'mutation' | 'updateOne' | 'deleteOne' | 'createOne';
|
|
@@ -750,27 +874,61 @@ interface SuperatomSDKConfig {
|
|
|
750
874
|
* - 'balanced': Use best model for complex tasks, fast model for simple tasks (default)
|
|
751
875
|
*/
|
|
752
876
|
modelStrategy?: ModelStrategy;
|
|
877
|
+
/**
|
|
878
|
+
* Model for the main agent (routing + analysis).
|
|
879
|
+
* Format: "provider/model-name" (e.g., "anthropic/claude-haiku-4-5-20251001")
|
|
880
|
+
* If not set, uses the provider's default model.
|
|
881
|
+
*/
|
|
882
|
+
mainAgentModel?: string;
|
|
883
|
+
/**
|
|
884
|
+
* Model for source agents (per-source query generation).
|
|
885
|
+
* Format: "provider/model-name" (e.g., "anthropic/claude-haiku-4-5-20251001")
|
|
886
|
+
* If not set, uses the provider's default model.
|
|
887
|
+
*/
|
|
888
|
+
sourceAgentModel?: string;
|
|
753
889
|
/**
|
|
754
890
|
* Separate model configuration for DASH_COMP flow (dashboard component picking)
|
|
755
891
|
* If not provided, falls back to provider-based model selection
|
|
756
892
|
*/
|
|
757
893
|
dashCompModels?: DashCompModelConfig;
|
|
894
|
+
/**
|
|
895
|
+
* Similarity threshold for conversation search (semantic matching)
|
|
896
|
+
* Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
897
|
+
* Higher values require closer matches, lower values allow more distant matches
|
|
898
|
+
* Default: 0.8
|
|
899
|
+
*/
|
|
900
|
+
conversationSimilarityThreshold?: number;
|
|
901
|
+
/**
|
|
902
|
+
* Query cache TTL (Time To Live) in minutes
|
|
903
|
+
* Cached query results expire after this duration
|
|
904
|
+
* Default: 5 minutes
|
|
905
|
+
*/
|
|
906
|
+
queryCacheTTL?: number;
|
|
907
|
+
/**
|
|
908
|
+
* Dashboard conversation history TTL (Time To Live) in minutes
|
|
909
|
+
* Per-dashboard conversation histories expire after this duration
|
|
910
|
+
* Default: 30 minutes
|
|
911
|
+
*/
|
|
912
|
+
dashboardHistoryTTL?: number;
|
|
758
913
|
}
|
|
759
914
|
|
|
760
915
|
declare const KbNodesQueryFiltersSchema: z.ZodObject<{
|
|
761
916
|
query: z.ZodOptional<z.ZodString>;
|
|
762
917
|
category: z.ZodOptional<z.ZodString>;
|
|
763
918
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
764
|
-
|
|
919
|
+
type: z.ZodOptional<z.ZodEnum<["global", "user", "query"]>>;
|
|
920
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
765
921
|
}, "strip", z.ZodTypeAny, {
|
|
922
|
+
type?: "query" | "user" | "global" | undefined;
|
|
766
923
|
query?: string | undefined;
|
|
767
924
|
category?: string | undefined;
|
|
768
|
-
createdBy?:
|
|
925
|
+
createdBy?: string | undefined;
|
|
769
926
|
tags?: string[] | undefined;
|
|
770
927
|
}, {
|
|
928
|
+
type?: "query" | "user" | "global" | undefined;
|
|
771
929
|
query?: string | undefined;
|
|
772
930
|
category?: string | undefined;
|
|
773
|
-
createdBy?:
|
|
931
|
+
createdBy?: string | undefined;
|
|
774
932
|
tags?: string[] | undefined;
|
|
775
933
|
}>;
|
|
776
934
|
type KbNodesQueryFilters = z.infer<typeof KbNodesQueryFiltersSchema>;
|
|
@@ -782,106 +940,118 @@ declare const KbNodesRequestPayloadSchema: z.ZodObject<{
|
|
|
782
940
|
content: z.ZodOptional<z.ZodString>;
|
|
783
941
|
category: z.ZodOptional<z.ZodString>;
|
|
784
942
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
943
|
+
type: z.ZodOptional<z.ZodEnum<["global", "user", "query"]>>;
|
|
944
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
945
|
+
updatedBy: z.ZodOptional<z.ZodString>;
|
|
946
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
788
947
|
query: z.ZodOptional<z.ZodString>;
|
|
789
948
|
filters: z.ZodOptional<z.ZodObject<{
|
|
790
949
|
query: z.ZodOptional<z.ZodString>;
|
|
791
950
|
category: z.ZodOptional<z.ZodString>;
|
|
792
951
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
793
|
-
|
|
952
|
+
type: z.ZodOptional<z.ZodEnum<["global", "user", "query"]>>;
|
|
953
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
794
954
|
}, "strip", z.ZodTypeAny, {
|
|
955
|
+
type?: "query" | "user" | "global" | undefined;
|
|
795
956
|
query?: string | undefined;
|
|
796
957
|
category?: string | undefined;
|
|
797
|
-
createdBy?:
|
|
958
|
+
createdBy?: string | undefined;
|
|
798
959
|
tags?: string[] | undefined;
|
|
799
960
|
}, {
|
|
961
|
+
type?: "query" | "user" | "global" | undefined;
|
|
800
962
|
query?: string | undefined;
|
|
801
963
|
category?: string | undefined;
|
|
802
|
-
createdBy?:
|
|
964
|
+
createdBy?: string | undefined;
|
|
803
965
|
tags?: string[] | undefined;
|
|
804
966
|
}>>;
|
|
805
967
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
806
968
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
807
969
|
}, "strip", z.ZodTypeAny, {
|
|
808
970
|
id?: number | undefined;
|
|
971
|
+
type?: "query" | "user" | "global" | undefined;
|
|
809
972
|
query?: string | undefined;
|
|
810
973
|
title?: string | undefined;
|
|
811
974
|
category?: string | undefined;
|
|
812
|
-
userId?:
|
|
975
|
+
userId?: string | undefined;
|
|
813
976
|
limit?: number | undefined;
|
|
814
977
|
filters?: {
|
|
978
|
+
type?: "query" | "user" | "global" | undefined;
|
|
815
979
|
query?: string | undefined;
|
|
816
980
|
category?: string | undefined;
|
|
817
|
-
createdBy?:
|
|
981
|
+
createdBy?: string | undefined;
|
|
818
982
|
tags?: string[] | undefined;
|
|
819
983
|
} | undefined;
|
|
820
|
-
createdBy?:
|
|
821
|
-
updatedBy?:
|
|
984
|
+
createdBy?: string | undefined;
|
|
985
|
+
updatedBy?: string | undefined;
|
|
986
|
+
offset?: number | undefined;
|
|
822
987
|
tags?: string[] | undefined;
|
|
823
988
|
content?: string | undefined;
|
|
824
|
-
offset?: number | undefined;
|
|
825
989
|
}, {
|
|
826
990
|
id?: number | undefined;
|
|
991
|
+
type?: "query" | "user" | "global" | undefined;
|
|
827
992
|
query?: string | undefined;
|
|
828
993
|
title?: string | undefined;
|
|
829
994
|
category?: string | undefined;
|
|
830
|
-
userId?:
|
|
995
|
+
userId?: string | undefined;
|
|
831
996
|
limit?: number | undefined;
|
|
832
997
|
filters?: {
|
|
998
|
+
type?: "query" | "user" | "global" | undefined;
|
|
833
999
|
query?: string | undefined;
|
|
834
1000
|
category?: string | undefined;
|
|
835
|
-
createdBy?:
|
|
1001
|
+
createdBy?: string | undefined;
|
|
836
1002
|
tags?: string[] | undefined;
|
|
837
1003
|
} | undefined;
|
|
838
|
-
createdBy?:
|
|
839
|
-
updatedBy?:
|
|
1004
|
+
createdBy?: string | undefined;
|
|
1005
|
+
updatedBy?: string | undefined;
|
|
1006
|
+
offset?: number | undefined;
|
|
840
1007
|
tags?: string[] | undefined;
|
|
841
1008
|
content?: string | undefined;
|
|
842
|
-
offset?: number | undefined;
|
|
843
1009
|
}>>;
|
|
844
1010
|
}, "strip", z.ZodTypeAny, {
|
|
845
1011
|
operation: "create" | "getOne" | "update" | "delete" | "getAll" | "search" | "getByCategory" | "getByUser" | "getCategories" | "getTags";
|
|
846
1012
|
data?: {
|
|
847
1013
|
id?: number | undefined;
|
|
1014
|
+
type?: "query" | "user" | "global" | undefined;
|
|
848
1015
|
query?: string | undefined;
|
|
849
1016
|
title?: string | undefined;
|
|
850
1017
|
category?: string | undefined;
|
|
851
|
-
userId?:
|
|
1018
|
+
userId?: string | undefined;
|
|
852
1019
|
limit?: number | undefined;
|
|
853
1020
|
filters?: {
|
|
1021
|
+
type?: "query" | "user" | "global" | undefined;
|
|
854
1022
|
query?: string | undefined;
|
|
855
1023
|
category?: string | undefined;
|
|
856
|
-
createdBy?:
|
|
1024
|
+
createdBy?: string | undefined;
|
|
857
1025
|
tags?: string[] | undefined;
|
|
858
1026
|
} | undefined;
|
|
859
|
-
createdBy?:
|
|
860
|
-
updatedBy?:
|
|
1027
|
+
createdBy?: string | undefined;
|
|
1028
|
+
updatedBy?: string | undefined;
|
|
1029
|
+
offset?: number | undefined;
|
|
861
1030
|
tags?: string[] | undefined;
|
|
862
1031
|
content?: string | undefined;
|
|
863
|
-
offset?: number | undefined;
|
|
864
1032
|
} | undefined;
|
|
865
1033
|
}, {
|
|
866
1034
|
operation: "create" | "getOne" | "update" | "delete" | "getAll" | "search" | "getByCategory" | "getByUser" | "getCategories" | "getTags";
|
|
867
1035
|
data?: {
|
|
868
1036
|
id?: number | undefined;
|
|
1037
|
+
type?: "query" | "user" | "global" | undefined;
|
|
869
1038
|
query?: string | undefined;
|
|
870
1039
|
title?: string | undefined;
|
|
871
1040
|
category?: string | undefined;
|
|
872
|
-
userId?:
|
|
1041
|
+
userId?: string | undefined;
|
|
873
1042
|
limit?: number | undefined;
|
|
874
1043
|
filters?: {
|
|
1044
|
+
type?: "query" | "user" | "global" | undefined;
|
|
875
1045
|
query?: string | undefined;
|
|
876
1046
|
category?: string | undefined;
|
|
877
|
-
createdBy?:
|
|
1047
|
+
createdBy?: string | undefined;
|
|
878
1048
|
tags?: string[] | undefined;
|
|
879
1049
|
} | undefined;
|
|
880
|
-
createdBy?:
|
|
881
|
-
updatedBy?:
|
|
1050
|
+
createdBy?: string | undefined;
|
|
1051
|
+
updatedBy?: string | undefined;
|
|
1052
|
+
offset?: number | undefined;
|
|
882
1053
|
tags?: string[] | undefined;
|
|
883
1054
|
content?: string | undefined;
|
|
884
|
-
offset?: number | undefined;
|
|
885
1055
|
} | undefined;
|
|
886
1056
|
}>;
|
|
887
1057
|
type KbNodesRequestPayload = z.infer<typeof KbNodesRequestPayloadSchema>;
|
|
@@ -1150,6 +1320,360 @@ declare class ReportManager {
|
|
|
1150
1320
|
getReportCount(): number;
|
|
1151
1321
|
}
|
|
1152
1322
|
|
|
1323
|
+
/**
|
|
1324
|
+
* StreamBuffer - Buffered streaming utility for smoother text delivery
|
|
1325
|
+
* Batches small chunks together and flushes at regular intervals
|
|
1326
|
+
*/
|
|
1327
|
+
type StreamCallback = (chunk: string) => void;
|
|
1328
|
+
/**
|
|
1329
|
+
* StreamBuffer class for managing buffered streaming output
|
|
1330
|
+
* Provides smooth text delivery by batching small chunks
|
|
1331
|
+
*/
|
|
1332
|
+
declare class StreamBuffer {
|
|
1333
|
+
private buffer;
|
|
1334
|
+
private flushTimer;
|
|
1335
|
+
private callback;
|
|
1336
|
+
private fullText;
|
|
1337
|
+
constructor(callback?: StreamCallback);
|
|
1338
|
+
/**
|
|
1339
|
+
* Check if the buffer has a callback configured
|
|
1340
|
+
*/
|
|
1341
|
+
hasCallback(): boolean;
|
|
1342
|
+
/**
|
|
1343
|
+
* Get all text that has been written (including already flushed)
|
|
1344
|
+
*/
|
|
1345
|
+
getFullText(): string;
|
|
1346
|
+
/**
|
|
1347
|
+
* Write a chunk to the buffer
|
|
1348
|
+
* Large chunks or chunks with newlines are flushed immediately
|
|
1349
|
+
* Small chunks are batched and flushed after a short interval
|
|
1350
|
+
*
|
|
1351
|
+
* @param chunk - Text chunk to write
|
|
1352
|
+
*/
|
|
1353
|
+
write(chunk: string): void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Flush the buffer immediately
|
|
1356
|
+
* Call this before tool execution or other operations that need clean output
|
|
1357
|
+
*/
|
|
1358
|
+
flush(): void;
|
|
1359
|
+
/**
|
|
1360
|
+
* Internal flush implementation
|
|
1361
|
+
*/
|
|
1362
|
+
private flushNow;
|
|
1363
|
+
/**
|
|
1364
|
+
* Clean up resources
|
|
1365
|
+
* Call this when done with the buffer
|
|
1366
|
+
*/
|
|
1367
|
+
dispose(): void;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* ToolExecutorService - Handles execution of SQL queries and external tools
|
|
1372
|
+
* Extracted from BaseLLM.generateTextResponse for better separation of concerns
|
|
1373
|
+
*/
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* External tool definition
|
|
1377
|
+
*/
|
|
1378
|
+
interface ExternalTool {
|
|
1379
|
+
id: string;
|
|
1380
|
+
name: string;
|
|
1381
|
+
description?: string;
|
|
1382
|
+
/** Tool type: "source" = routed through SourceAgent, "direct" = called directly by MainAgent */
|
|
1383
|
+
toolType?: 'source' | 'direct';
|
|
1384
|
+
/** Full untruncated schema for source agent (all columns visible) */
|
|
1385
|
+
fullSchema?: string;
|
|
1386
|
+
/** Schema size tier: small (≤50 tables), medium (51-200), large (201-500), very_large (500+) */
|
|
1387
|
+
schemaTier?: string;
|
|
1388
|
+
/** Schema search function for very_large tier — keyword search over entities */
|
|
1389
|
+
schemaSearchFn?: (keywords: string[]) => string;
|
|
1390
|
+
fn: (input: any) => Promise<any>;
|
|
1391
|
+
limit?: number;
|
|
1392
|
+
outputSchema?: any;
|
|
1393
|
+
executionType?: 'immediate' | 'deferred';
|
|
1394
|
+
userProvidedData?: any;
|
|
1395
|
+
params?: Record<string, any>;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Executed tool tracking info
|
|
1399
|
+
*/
|
|
1400
|
+
interface ExecutedToolInfo {
|
|
1401
|
+
id: string;
|
|
1402
|
+
name: string;
|
|
1403
|
+
params: any;
|
|
1404
|
+
result: {
|
|
1405
|
+
_totalRecords: number;
|
|
1406
|
+
_recordsShown: number;
|
|
1407
|
+
_metadata?: any;
|
|
1408
|
+
_sampleData: any[];
|
|
1409
|
+
};
|
|
1410
|
+
outputSchema?: any;
|
|
1411
|
+
sourceSchema?: string;
|
|
1412
|
+
sourceType?: string;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* Multi-Agent Architecture Types
|
|
1417
|
+
*
|
|
1418
|
+
* Defines interfaces for the hierarchical agent system:
|
|
1419
|
+
* - Main Agent: ONE LLM.streamWithTools() call with source agent tools
|
|
1420
|
+
* - Source Agents: independent agents that query individual data sources
|
|
1421
|
+
*
|
|
1422
|
+
* The main agent sees only source summaries. When it calls a source tool,
|
|
1423
|
+
* the SourceAgent runs independently (own LLM, own retries) and returns clean data.
|
|
1424
|
+
*/
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Per-entity detail: name, row count, and column names.
|
|
1428
|
+
* Gives the main agent enough context to route to the right source.
|
|
1429
|
+
*/
|
|
1430
|
+
interface EntityDetail {
|
|
1431
|
+
/** Entity name (table, sheet, endpoint) */
|
|
1432
|
+
name: string;
|
|
1433
|
+
/** Approximate row count */
|
|
1434
|
+
rowCount?: number;
|
|
1435
|
+
/** Column/field names */
|
|
1436
|
+
columns: string[];
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Representation of a data source for the main agent.
|
|
1440
|
+
* Contains entity names WITH column names so the LLM can route accurately.
|
|
1441
|
+
*/
|
|
1442
|
+
interface SourceSummary {
|
|
1443
|
+
/** Source ID (matches tool ID prefix) */
|
|
1444
|
+
id: string;
|
|
1445
|
+
/** Human-readable source name */
|
|
1446
|
+
name: string;
|
|
1447
|
+
/** Source type: postgres, excel, rest_api, etc. */
|
|
1448
|
+
type: string;
|
|
1449
|
+
/** Brief description of what data this source contains */
|
|
1450
|
+
description: string;
|
|
1451
|
+
/** Detailed entity info with column names for routing */
|
|
1452
|
+
entityDetails: EntityDetail[];
|
|
1453
|
+
/** The tool ID associated with this source */
|
|
1454
|
+
toolId: string;
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* What a source agent returns after querying its data source.
|
|
1458
|
+
* The main agent uses this to analyze and compose the final response.
|
|
1459
|
+
*/
|
|
1460
|
+
interface SourceAgentResult {
|
|
1461
|
+
/** Source ID */
|
|
1462
|
+
sourceId: string;
|
|
1463
|
+
/** Source name */
|
|
1464
|
+
sourceName: string;
|
|
1465
|
+
/** Whether the query succeeded */
|
|
1466
|
+
success: boolean;
|
|
1467
|
+
/** Result data rows */
|
|
1468
|
+
data: any[];
|
|
1469
|
+
/** Metadata about the query execution */
|
|
1470
|
+
metadata: SourceAgentMetadata;
|
|
1471
|
+
/** Tool execution info for the last successful query (backward compat) */
|
|
1472
|
+
executedTool: ExecutedToolInfo;
|
|
1473
|
+
/** All successful tool executions (primary + follow-up queries) */
|
|
1474
|
+
allExecutedTools?: ExecutedToolInfo[];
|
|
1475
|
+
/** Error message if failed */
|
|
1476
|
+
error?: string;
|
|
1477
|
+
}
|
|
1478
|
+
interface SourceAgentMetadata {
|
|
1479
|
+
/** Total rows that matched the query (before limit) */
|
|
1480
|
+
totalRowsMatched: number;
|
|
1481
|
+
/** Rows actually returned (after limit) */
|
|
1482
|
+
rowsReturned: number;
|
|
1483
|
+
/** Whether the result was truncated by the row limit */
|
|
1484
|
+
isLimited: boolean;
|
|
1485
|
+
/** The query/params that were executed */
|
|
1486
|
+
queryExecuted?: string;
|
|
1487
|
+
/** Execution time in milliseconds */
|
|
1488
|
+
executionTimeMs: number;
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* A pre-built, multi-step UI flow registered with the SDK.
|
|
1492
|
+
*
|
|
1493
|
+
* When the main agent decides a user's question matches a workflow's whenToUse
|
|
1494
|
+
* trigger, it picks the workflow instead of running source agents / generating
|
|
1495
|
+
* dashboard components. The LLM extracts the workflow's required props from the
|
|
1496
|
+
* prompt (using `propsSchema` as the tool input_schema) and the SDK returns the
|
|
1497
|
+
* workflow component directly — no analysis text, no chart generation. The
|
|
1498
|
+
* frontend renders the registered workflow component with the LLM-extracted
|
|
1499
|
+
* props.
|
|
1500
|
+
*/
|
|
1501
|
+
interface WorkflowDescriptor {
|
|
1502
|
+
/** Unique workflow id (used as the LLM tool name) */
|
|
1503
|
+
id: string;
|
|
1504
|
+
/** Component name on the frontend (matches the registered React component) */
|
|
1505
|
+
name: string;
|
|
1506
|
+
/** Short human-readable description of what this workflow does */
|
|
1507
|
+
description: string;
|
|
1508
|
+
/**
|
|
1509
|
+
* 1–2 sentence trigger condition. The LLM uses this to decide if the
|
|
1510
|
+
* user's prompt matches this workflow. Be specific — e.g.
|
|
1511
|
+
* "User wants to *initiate* an inventory transfer (review + submit POs),
|
|
1512
|
+
* not just see analysis or charts."
|
|
1513
|
+
*/
|
|
1514
|
+
whenToUse: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* JSON-schema-style description of the props the workflow needs. Becomes
|
|
1517
|
+
* the LLM tool's input_schema, so the model fills these from the prompt.
|
|
1518
|
+
* Use the same shape as `params` on direct tools — string descriptors with
|
|
1519
|
+
* an optional "(optional)" suffix.
|
|
1520
|
+
*
|
|
1521
|
+
* Example:
|
|
1522
|
+
* ```
|
|
1523
|
+
* {
|
|
1524
|
+
* selectedStore: 'object — { id, name } of the source branch',
|
|
1525
|
+
* minROI: 'number (optional) — only show transfers with ROI ≥ this',
|
|
1526
|
+
* }
|
|
1527
|
+
* ```
|
|
1528
|
+
*/
|
|
1529
|
+
propsSchema: Record<string, string>;
|
|
1530
|
+
/**
|
|
1531
|
+
* Optional: static prop defaults merged with LLM-extracted props before
|
|
1532
|
+
* the component is returned. Useful for things like the embedded
|
|
1533
|
+
* `externalTool` config that the workflow uses to fetch its own data.
|
|
1534
|
+
*/
|
|
1535
|
+
defaultProps?: Record<string, any>;
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* The workflow selection captured during a routing call.
|
|
1539
|
+
* Set on AgentResponse when the LLM picks a workflow tool.
|
|
1540
|
+
*/
|
|
1541
|
+
interface SelectedWorkflow {
|
|
1542
|
+
/** Component name (matches WorkflowDescriptor.name) */
|
|
1543
|
+
name: string;
|
|
1544
|
+
/** Props extracted from the prompt + merged with workflow.defaultProps */
|
|
1545
|
+
props: Record<string, any>;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* The complete response from the multi-agent system.
|
|
1549
|
+
* Contains everything needed for text display + component generation.
|
|
1550
|
+
*/
|
|
1551
|
+
interface AgentResponse {
|
|
1552
|
+
/** Generated text response (analysis of the data) */
|
|
1553
|
+
text: string;
|
|
1554
|
+
/** All executed tools across all source agents (for component generation) */
|
|
1555
|
+
executedTools: ExecutedToolInfo[];
|
|
1556
|
+
/** Individual results from each source agent */
|
|
1557
|
+
sourceResults: SourceAgentResult[];
|
|
1558
|
+
/**
|
|
1559
|
+
* Set when the LLM routed the question to a registered workflow component.
|
|
1560
|
+
* When present, the upstream caller should skip component generation and
|
|
1561
|
+
* return this workflow as the response.
|
|
1562
|
+
*/
|
|
1563
|
+
workflow?: SelectedWorkflow;
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Configuration for the multi-agent system.
|
|
1567
|
+
* Controls limits, models, and behavior.
|
|
1568
|
+
*/
|
|
1569
|
+
interface AgentConfig {
|
|
1570
|
+
/** Max rows a source agent can return (default: 50) */
|
|
1571
|
+
maxRowsPerSource: number;
|
|
1572
|
+
/** Model for the main agent (routing + analysis in one LLM call) */
|
|
1573
|
+
mainAgentModel: string;
|
|
1574
|
+
/** Model for source agent query generation */
|
|
1575
|
+
sourceAgentModel: string;
|
|
1576
|
+
/** API key for LLM calls */
|
|
1577
|
+
apiKey?: string;
|
|
1578
|
+
/** Max retry attempts per source agent */
|
|
1579
|
+
maxRetries: number;
|
|
1580
|
+
/** Max tool calling iterations for the main agent loop */
|
|
1581
|
+
maxIterations: number;
|
|
1582
|
+
/** Global knowledge base context (static, same for all users/questions — cached in system prompt) */
|
|
1583
|
+
globalKnowledgeBase?: string;
|
|
1584
|
+
/** Per-request knowledge base context (user-specific + query-matched — dynamic, not cached) */
|
|
1585
|
+
knowledgeBaseContext?: string;
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Default agent configuration
|
|
1589
|
+
*/
|
|
1590
|
+
declare const DEFAULT_AGENT_CONFIG: AgentConfig;
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Main Agent (Orchestrator)
|
|
1594
|
+
*
|
|
1595
|
+
* A single LLM.streamWithTools() call that handles everything:
|
|
1596
|
+
* - Routing: decides which source(s) to query based on summaries
|
|
1597
|
+
* - Querying: calls source tools (each wraps an independent SourceAgent)
|
|
1598
|
+
* - Direct tools: calls pre-built function tools directly with LLM-provided params
|
|
1599
|
+
* - Re-querying: if data is wrong/incomplete, calls tools again with modified intent
|
|
1600
|
+
* - Analysis: generates final text response from the data
|
|
1601
|
+
*
|
|
1602
|
+
* Two tool types:
|
|
1603
|
+
* - "source" tools: main agent sees summaries, SourceAgent handles SQL generation independently
|
|
1604
|
+
* - "direct" tools: main agent calls fn() directly with structured params (no SourceAgent)
|
|
1605
|
+
*/
|
|
1606
|
+
|
|
1607
|
+
declare class MainAgent {
|
|
1608
|
+
private externalTools;
|
|
1609
|
+
private workflows;
|
|
1610
|
+
private config;
|
|
1611
|
+
private streamBuffer;
|
|
1612
|
+
constructor(externalTools: ExternalTool[], config: AgentConfig, streamBuffer?: StreamBuffer, workflows?: WorkflowDescriptor[]);
|
|
1613
|
+
/**
|
|
1614
|
+
* Handle a user question using the multi-agent system.
|
|
1615
|
+
*
|
|
1616
|
+
* This is ONE LLM.streamWithTools() call. The LLM:
|
|
1617
|
+
* 1. Sees source summaries + direct tool descriptions in system prompt
|
|
1618
|
+
* 2. Decides which tool(s) to call (routing)
|
|
1619
|
+
* 3. Source tools → SourceAgent runs independently → returns data
|
|
1620
|
+
* 4. Direct tools → fn() called directly with LLM params → returns data
|
|
1621
|
+
* 5. Generates final analysis text
|
|
1622
|
+
*/
|
|
1623
|
+
handleQuestion(userPrompt: string, apiKey?: string, conversationHistory?: string, streamCallback?: (chunk: string) => void): Promise<AgentResponse>;
|
|
1624
|
+
/**
|
|
1625
|
+
* Execute a direct tool — call fn() with LLM-provided params, no SourceAgent.
|
|
1626
|
+
*/
|
|
1627
|
+
private handleDirectTool;
|
|
1628
|
+
/**
|
|
1629
|
+
* Build the main agent's system prompt with source summaries, direct tool descriptions,
|
|
1630
|
+
* and workflow component descriptions.
|
|
1631
|
+
*/
|
|
1632
|
+
private buildSystemPrompt;
|
|
1633
|
+
/**
|
|
1634
|
+
* Build tool definitions for source tools — summary-only descriptions.
|
|
1635
|
+
* The full schema is inside the SourceAgent which runs independently.
|
|
1636
|
+
*/
|
|
1637
|
+
private buildSourceToolDefinitions;
|
|
1638
|
+
/**
|
|
1639
|
+
* Build tool definitions for direct tools — expose their actual params.
|
|
1640
|
+
* These are called directly by the main agent LLM, no SourceAgent.
|
|
1641
|
+
*/
|
|
1642
|
+
private buildDirectToolDefinitions;
|
|
1643
|
+
/**
|
|
1644
|
+
* Capture a workflow selection. We do NOT execute anything — the LLM has
|
|
1645
|
+
* already extracted the props it wants the workflow rendered with. We
|
|
1646
|
+
* record the selection (via the capture callback) and return a short
|
|
1647
|
+
* acknowledgement so the LLM ends its turn cleanly without writing
|
|
1648
|
+
* analysis text or calling more tools.
|
|
1649
|
+
*/
|
|
1650
|
+
private handleWorkflow;
|
|
1651
|
+
/**
|
|
1652
|
+
* Build LLM tool definitions for workflow components. The workflow's
|
|
1653
|
+
* propsSchema becomes the tool's input_schema so the LLM extracts props
|
|
1654
|
+
* directly from the prompt — same mechanic as direct tools.
|
|
1655
|
+
*/
|
|
1656
|
+
private buildWorkflowToolDefinitions;
|
|
1657
|
+
/**
|
|
1658
|
+
* Format a source agent's result as a clean string for the main agent LLM.
|
|
1659
|
+
*/
|
|
1660
|
+
private formatResultForMainAgent;
|
|
1661
|
+
/**
|
|
1662
|
+
* Get source summaries (for external inspection/debugging).
|
|
1663
|
+
*/
|
|
1664
|
+
getSourceSummaries(): SourceSummary[];
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* Represents an action that can be performed on a UIBlock
|
|
1669
|
+
*/
|
|
1670
|
+
interface Action {
|
|
1671
|
+
id: string;
|
|
1672
|
+
name: string;
|
|
1673
|
+
type: string;
|
|
1674
|
+
[key: string]: any;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1153
1677
|
type SystemPrompt = string | Anthropic.Messages.TextBlockParam[];
|
|
1154
1678
|
interface LLMMessages {
|
|
1155
1679
|
sys: SystemPrompt;
|
|
@@ -1162,6 +1686,7 @@ interface LLMOptions {
|
|
|
1162
1686
|
temperature?: number;
|
|
1163
1687
|
topP?: number;
|
|
1164
1688
|
apiKey?: string;
|
|
1689
|
+
baseURL?: string;
|
|
1165
1690
|
partial?: (chunk: string) => void;
|
|
1166
1691
|
}
|
|
1167
1692
|
interface Tool {
|
|
@@ -1184,6 +1709,16 @@ declare class LLM {
|
|
|
1184
1709
|
* @returns Normalized system prompt for Anthropic API
|
|
1185
1710
|
*/
|
|
1186
1711
|
private static _normalizeSystemPrompt;
|
|
1712
|
+
/**
|
|
1713
|
+
* Strip unpaired UTF-16 surrogates from every text field of a message set.
|
|
1714
|
+
*
|
|
1715
|
+
* A lone surrogate (from mid-pair string slicing or corrupt source data)
|
|
1716
|
+
* serializes to a bare `\udXXX` escape that strict JSON parsers — including
|
|
1717
|
+
* the one on Anthropic's API — reject with "no low surrogate in string",
|
|
1718
|
+
* failing the whole request. Sanitizing here, at the single boundary every
|
|
1719
|
+
* provider call flows through, guarantees no request can carry one.
|
|
1720
|
+
*/
|
|
1721
|
+
private static _sanitizeMessages;
|
|
1187
1722
|
/**
|
|
1188
1723
|
* Log cache usage metrics from Anthropic API response
|
|
1189
1724
|
* Shows cache hits, costs, and savings
|
|
@@ -1200,6 +1735,15 @@ declare class LLM {
|
|
|
1200
1735
|
* "claude-sonnet-4-5" → ["anthropic", "claude-sonnet-4-5"] (default)
|
|
1201
1736
|
*/
|
|
1202
1737
|
private static _parseModel;
|
|
1738
|
+
/**
|
|
1739
|
+
* Map an Anthropic model id (e.g. "claude-sonnet-4-5-20250929") to the OpenRouter slug
|
|
1740
|
+
* (e.g. "claude-sonnet-4.5"). OpenRouter slugs drop the date suffix and use dotted versions.
|
|
1741
|
+
*/
|
|
1742
|
+
private static _toOpenRouterSlug;
|
|
1743
|
+
private static _openrouterOptions;
|
|
1744
|
+
private static _openrouterText;
|
|
1745
|
+
private static _openrouterStream;
|
|
1746
|
+
private static _openrouterStreamWithTools;
|
|
1203
1747
|
private static _anthropicText;
|
|
1204
1748
|
private static _anthropicStream;
|
|
1205
1749
|
private static _anthropicStreamWithTools;
|
|
@@ -1207,6 +1751,11 @@ declare class LLM {
|
|
|
1207
1751
|
private static _groqStream;
|
|
1208
1752
|
private static _geminiText;
|
|
1209
1753
|
private static _geminiStream;
|
|
1754
|
+
/**
|
|
1755
|
+
* Recursively strip unsupported JSON Schema properties for Gemini
|
|
1756
|
+
* Gemini doesn't support: additionalProperties, $schema, etc.
|
|
1757
|
+
*/
|
|
1758
|
+
private static _cleanSchemaForGemini;
|
|
1210
1759
|
private static _geminiStreamWithTools;
|
|
1211
1760
|
private static _openaiText;
|
|
1212
1761
|
private static _openaiStream;
|
|
@@ -1299,16 +1848,6 @@ declare class UILogCollector {
|
|
|
1299
1848
|
setUIBlockId(uiBlockId: string): void;
|
|
1300
1849
|
}
|
|
1301
1850
|
|
|
1302
|
-
/**
|
|
1303
|
-
* Represents an action that can be performed on a UIBlock
|
|
1304
|
-
*/
|
|
1305
|
-
interface Action {
|
|
1306
|
-
id: string;
|
|
1307
|
-
name: string;
|
|
1308
|
-
type: string;
|
|
1309
|
-
[key: string]: any;
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
1851
|
/**
|
|
1313
1852
|
* UIBlock represents a single user and assistant message block in a thread
|
|
1314
1853
|
* Contains user question, component metadata, component data, text response, and available actions
|
|
@@ -1491,12 +2030,20 @@ declare class Thread {
|
|
|
1491
2030
|
|
|
1492
2031
|
/**
|
|
1493
2032
|
* ThreadManager manages all threads globally
|
|
1494
|
-
* Provides methods to create, retrieve, and delete threads
|
|
2033
|
+
* Provides methods to create, retrieve, and delete threads.
|
|
2034
|
+
* Includes automatic cleanup to prevent unbounded memory growth.
|
|
1495
2035
|
*/
|
|
1496
2036
|
declare class ThreadManager {
|
|
1497
2037
|
private static instance;
|
|
1498
2038
|
private threads;
|
|
2039
|
+
private cleanupInterval;
|
|
2040
|
+
private readonly threadTtlMs;
|
|
1499
2041
|
private constructor();
|
|
2042
|
+
/**
|
|
2043
|
+
* Periodically remove threads older than 7 days.
|
|
2044
|
+
* Runs every hour to avoid frequent iteration over the map.
|
|
2045
|
+
*/
|
|
2046
|
+
private startCleanup;
|
|
1500
2047
|
/**
|
|
1501
2048
|
* Get singleton instance of ThreadManager
|
|
1502
2049
|
*/
|
|
@@ -1895,6 +2442,92 @@ declare function rerankConversationResults<T extends {
|
|
|
1895
2442
|
bm25Score: number;
|
|
1896
2443
|
}>;
|
|
1897
2444
|
|
|
2445
|
+
/**
|
|
2446
|
+
* QueryExecutionService - Handles all query execution, validation, and retry logic
|
|
2447
|
+
* Extracted from BaseLLM for better separation of concerns
|
|
2448
|
+
*/
|
|
2449
|
+
|
|
2450
|
+
/**
|
|
2451
|
+
* Context for component when requesting query fix
|
|
2452
|
+
*/
|
|
2453
|
+
interface ComponentContext {
|
|
2454
|
+
name: string;
|
|
2455
|
+
type: string;
|
|
2456
|
+
title?: string;
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Result of query validation
|
|
2460
|
+
*/
|
|
2461
|
+
interface QueryValidationResult {
|
|
2462
|
+
component: Component | null;
|
|
2463
|
+
queryKey: string;
|
|
2464
|
+
result: any;
|
|
2465
|
+
validated: boolean;
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* Result of batch query validation
|
|
2469
|
+
*/
|
|
2470
|
+
interface BatchValidationResult {
|
|
2471
|
+
components: Component[];
|
|
2472
|
+
queryResults: Map<string, any>;
|
|
2473
|
+
}
|
|
2474
|
+
/**
|
|
2475
|
+
* Configuration for QueryExecutionService
|
|
2476
|
+
*/
|
|
2477
|
+
interface QueryExecutionServiceConfig {
|
|
2478
|
+
defaultLimit: number;
|
|
2479
|
+
getModelForTask: (taskType: 'simple' | 'complex') => string;
|
|
2480
|
+
getApiKey: (apiKey?: string) => string | undefined;
|
|
2481
|
+
providerName: string;
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* QueryExecutionService handles all query-related operations
|
|
2485
|
+
*/
|
|
2486
|
+
declare class QueryExecutionService {
|
|
2487
|
+
private config;
|
|
2488
|
+
constructor(config: QueryExecutionServiceConfig);
|
|
2489
|
+
/**
|
|
2490
|
+
* Get the cache key for a query
|
|
2491
|
+
* This ensures the cache key matches what the frontend will send
|
|
2492
|
+
*/
|
|
2493
|
+
getQueryCacheKey(query: any): string;
|
|
2494
|
+
/**
|
|
2495
|
+
* Execute a query against the database
|
|
2496
|
+
* @param query - The SQL query to execute (string or object with sql/values)
|
|
2497
|
+
* @param collections - Collections object containing database execute function
|
|
2498
|
+
* @returns Object with result data and cache key
|
|
2499
|
+
*/
|
|
2500
|
+
executeQuery(query: any, collections: any): Promise<{
|
|
2501
|
+
result: any;
|
|
2502
|
+
cacheKey: string;
|
|
2503
|
+
}>;
|
|
2504
|
+
/**
|
|
2505
|
+
* Request the LLM to fix a failed SQL query
|
|
2506
|
+
* @param failedQuery - The query that failed execution
|
|
2507
|
+
* @param errorMessage - The error message from the failed execution
|
|
2508
|
+
* @param componentContext - Context about the component
|
|
2509
|
+
* @param apiKey - Optional API key
|
|
2510
|
+
* @returns Fixed query string
|
|
2511
|
+
*/
|
|
2512
|
+
requestQueryFix(failedQuery: string, errorMessage: string, componentContext: ComponentContext, apiKey?: string): Promise<string>;
|
|
2513
|
+
/**
|
|
2514
|
+
* Validate a single component's query with retry logic
|
|
2515
|
+
* @param component - The component to validate
|
|
2516
|
+
* @param collections - Collections object containing database execute function
|
|
2517
|
+
* @param apiKey - Optional API key for LLM calls
|
|
2518
|
+
* @returns Validation result with component, query key, and result
|
|
2519
|
+
*/
|
|
2520
|
+
validateSingleQuery(component: Component, collections: any, apiKey?: string): Promise<QueryValidationResult>;
|
|
2521
|
+
/**
|
|
2522
|
+
* Validate multiple component queries in parallel
|
|
2523
|
+
* @param components - Array of components with potential queries
|
|
2524
|
+
* @param collections - Collections object containing database execute function
|
|
2525
|
+
* @param apiKey - Optional API key for LLM calls
|
|
2526
|
+
* @returns Object with validated components and query results map
|
|
2527
|
+
*/
|
|
2528
|
+
validateComponentQueries(components: Component[], collections: any, apiKey?: string): Promise<BatchValidationResult>;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
1898
2531
|
/**
|
|
1899
2532
|
* Task types for model selection
|
|
1900
2533
|
* - 'complex': Text generation, component matching, parameter adaptation (uses best model in balanced mode)
|
|
@@ -1913,6 +2546,7 @@ interface BaseLLMConfig {
|
|
|
1913
2546
|
* - 'balanced': Use best model for complex tasks, fast model for simple tasks (default)
|
|
1914
2547
|
*/
|
|
1915
2548
|
modelStrategy?: ModelStrategy;
|
|
2549
|
+
conversationSimilarityThreshold?: number;
|
|
1916
2550
|
}
|
|
1917
2551
|
/**
|
|
1918
2552
|
* BaseLLM abstract class for AI-powered component generation and matching
|
|
@@ -1924,6 +2558,8 @@ declare abstract class BaseLLM {
|
|
|
1924
2558
|
protected defaultLimit: number;
|
|
1925
2559
|
protected apiKey?: string;
|
|
1926
2560
|
protected modelStrategy: ModelStrategy;
|
|
2561
|
+
protected conversationSimilarityThreshold: number;
|
|
2562
|
+
protected queryService: QueryExecutionService;
|
|
1927
2563
|
constructor(config?: BaseLLMConfig);
|
|
1928
2564
|
/**
|
|
1929
2565
|
* Get the appropriate model based on task type and model strategy
|
|
@@ -1941,6 +2577,16 @@ declare abstract class BaseLLM {
|
|
|
1941
2577
|
* @returns The current model strategy
|
|
1942
2578
|
*/
|
|
1943
2579
|
getModelStrategy(): ModelStrategy;
|
|
2580
|
+
/**
|
|
2581
|
+
* Set the conversation similarity threshold at runtime
|
|
2582
|
+
* @param threshold - Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
2583
|
+
*/
|
|
2584
|
+
setConversationSimilarityThreshold(threshold: number): void;
|
|
2585
|
+
/**
|
|
2586
|
+
* Get the current conversation similarity threshold
|
|
2587
|
+
* @returns The current threshold value
|
|
2588
|
+
*/
|
|
2589
|
+
getConversationSimilarityThreshold(): number;
|
|
1944
2590
|
/**
|
|
1945
2591
|
* Get the default model for this provider (used for complex tasks like text generation)
|
|
1946
2592
|
*/
|
|
@@ -1976,11 +2622,10 @@ declare abstract class BaseLLM {
|
|
|
1976
2622
|
* @param analysisContent - The text response containing component suggestions
|
|
1977
2623
|
* @param components - List of available components
|
|
1978
2624
|
* @param apiKey - Optional API key
|
|
1979
|
-
* @param logCollector - Optional log collector
|
|
1980
2625
|
* @param componentStreamCallback - Optional callback to stream primary KPI component as soon as it's identified
|
|
1981
2626
|
* @returns Object containing matched components, layout title/description, and follow-up actions
|
|
1982
2627
|
*/
|
|
1983
|
-
matchComponentsFromAnalysis(analysisContent: string, components: Component[],
|
|
2628
|
+
matchComponentsFromAnalysis(analysisContent: string, components: Component[], userPrompt: string, apiKey?: string, componentStreamCallback?: (component: Component) => void, deferredTools?: any[], executedTools?: any[], collections?: any, userId?: string): Promise<{
|
|
1984
2629
|
components: Component[];
|
|
1985
2630
|
layoutTitle: string;
|
|
1986
2631
|
layoutDescription: string;
|
|
@@ -1990,7 +2635,7 @@ declare abstract class BaseLLM {
|
|
|
1990
2635
|
* Classify user question into category and detect external tools needed
|
|
1991
2636
|
* Determines if question is for data analysis, requires external tools, or needs text response
|
|
1992
2637
|
*/
|
|
1993
|
-
classifyQuestionCategory(userPrompt: string, apiKey?: string,
|
|
2638
|
+
classifyQuestionCategory(userPrompt: string, apiKey?: string, conversationHistory?: string, externalTools?: any[]): Promise<{
|
|
1994
2639
|
category: 'data_analysis' | 'data_modification' | 'general';
|
|
1995
2640
|
externalTools: Array<{
|
|
1996
2641
|
type: string;
|
|
@@ -2007,7 +2652,7 @@ declare abstract class BaseLLM {
|
|
|
2007
2652
|
* Takes a matched UI block from semantic search and modifies its props to answer the new question
|
|
2008
2653
|
* Also adapts the cached text response to match the new question
|
|
2009
2654
|
*/
|
|
2010
|
-
adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string,
|
|
2655
|
+
adaptUIBlockParameters(currentUserPrompt: string, originalUserPrompt: string, matchedUIBlock: any, apiKey?: string, cachedTextResponse?: string): Promise<{
|
|
2011
2656
|
success: boolean;
|
|
2012
2657
|
adaptedComponent?: Component;
|
|
2013
2658
|
adaptedTextResponse?: string;
|
|
@@ -2022,13 +2667,8 @@ declare abstract class BaseLLM {
|
|
|
2022
2667
|
* This provides conversational text responses instead of component generation
|
|
2023
2668
|
* Supports tool calling for query execution with automatic retry on errors (max 3 attempts)
|
|
2024
2669
|
* After generating text response, if components are provided, matches suggested components
|
|
2025
|
-
* @param streamCallback - Optional callback function to receive text chunks as they stream
|
|
2026
|
-
* @param collections - Collection registry for executing database queries via database.execute
|
|
2027
|
-
* @param components - Optional list of available components for matching suggestions
|
|
2028
|
-
* @param externalTools - Optional array of external tools (email, calendar, etc.) that can be called
|
|
2029
|
-
* @param category - Question category ('data_analysis' | 'data_modification' | 'general'). For data_modification, answer component streaming is skipped. For general, component generation is skipped entirely.
|
|
2030
2670
|
*/
|
|
2031
|
-
generateTextResponse(userPrompt: string, apiKey?: string,
|
|
2671
|
+
generateTextResponse(userPrompt: string, apiKey?: string, conversationHistory?: string, streamCallback?: (chunk: string) => void, collections?: any, components?: Component[], externalTools?: any[], category?: 'data_analysis' | 'data_modification' | 'general', userId?: string): Promise<T_RESPONSE>;
|
|
2032
2672
|
/**
|
|
2033
2673
|
* Main orchestration function with semantic search and multi-step classification
|
|
2034
2674
|
* NEW FLOW (Recommended):
|
|
@@ -2036,19 +2676,14 @@ declare abstract class BaseLLM {
|
|
|
2036
2676
|
* - If match found → Adapt UI block parameters and return
|
|
2037
2677
|
* 2. Category classification: Determine if data_analysis, requires_external_tools, or text_response
|
|
2038
2678
|
* 3. Route appropriately based on category and response mode
|
|
2039
|
-
*
|
|
2040
|
-
* @param responseMode - 'component' for component generation (default), 'text' for text responses
|
|
2041
|
-
* @param streamCallback - Optional callback function to receive text chunks as they stream (only for text mode)
|
|
2042
|
-
* @param collections - Collection registry for executing database queries (required for text mode)
|
|
2043
|
-
* @param externalTools - Optional array of external tools (email, calendar, etc.) that can be called (only for text mode)
|
|
2044
2679
|
*/
|
|
2045
|
-
handleUserRequest(userPrompt: string, components: Component[], apiKey?: string,
|
|
2680
|
+
handleUserRequest(userPrompt: string, components: Component[], apiKey?: string, conversationHistory?: string, responseMode?: 'component' | 'text', streamCallback?: (chunk: string) => void, collections?: any, externalTools?: any[], userId?: string): Promise<T_RESPONSE>;
|
|
2046
2681
|
/**
|
|
2047
2682
|
* Generate next questions that the user might ask based on the original prompt and generated component
|
|
2048
2683
|
* This helps provide intelligent suggestions for follow-up queries
|
|
2049
2684
|
* For general/conversational questions without components, pass textResponse instead
|
|
2050
2685
|
*/
|
|
2051
|
-
generateNextQuestions(originalUserPrompt: string, component?: Component | null, componentData?: Record<string, unknown>, apiKey?: string,
|
|
2686
|
+
generateNextQuestions(originalUserPrompt: string, component?: Component | null, componentData?: Record<string, unknown>, apiKey?: string, conversationHistory?: string, textResponse?: string): Promise<string[]>;
|
|
2052
2687
|
}
|
|
2053
2688
|
|
|
2054
2689
|
interface AnthropicLLMConfig extends BaseLLMConfig {
|
|
@@ -2107,7 +2742,153 @@ declare class OpenAILLM extends BaseLLM {
|
|
|
2107
2742
|
}
|
|
2108
2743
|
declare const openaiLLM: OpenAILLM;
|
|
2109
2744
|
|
|
2110
|
-
|
|
2745
|
+
/**
|
|
2746
|
+
* Query Cache — Two mechanisms:
|
|
2747
|
+
*
|
|
2748
|
+
* 1. `cache` (query string → result data) — TTL-based with max size, for avoiding re-execution
|
|
2749
|
+
* of recently validated queries. True LRU eviction: reads bubble entries to the back via
|
|
2750
|
+
* delete+re-set so the oldest *unused* entry is evicted, not the oldest *inserted*.
|
|
2751
|
+
*
|
|
2752
|
+
* 2. Encrypted queryId tokens — SQL is encrypted into the queryId itself (self-contained).
|
|
2753
|
+
* No server-side storage needed for SQL mappings. The token is decrypted on each request.
|
|
2754
|
+
* This eliminates the unbounded queryIdCache that previously grew forever and caused
|
|
2755
|
+
* memory bloat (hundreds of MBs after thousands of queries).
|
|
2756
|
+
*
|
|
2757
|
+
* Result data can still be cached temporarily via the data cache (mechanism 1).
|
|
2758
|
+
*/
|
|
2759
|
+
declare class QueryCache {
|
|
2760
|
+
private cache;
|
|
2761
|
+
private ttlMs;
|
|
2762
|
+
private maxCacheSize;
|
|
2763
|
+
private cleanupInterval;
|
|
2764
|
+
private readonly algorithm;
|
|
2765
|
+
private encryptionKey;
|
|
2766
|
+
constructor();
|
|
2767
|
+
/**
|
|
2768
|
+
* Set the cache TTL (Time To Live)
|
|
2769
|
+
* @param minutes - TTL in minutes (default: 10)
|
|
2770
|
+
*/
|
|
2771
|
+
setTTL(minutes: number): void;
|
|
2772
|
+
/**
|
|
2773
|
+
* Get the current TTL in minutes
|
|
2774
|
+
*/
|
|
2775
|
+
getTTL(): number;
|
|
2776
|
+
/**
|
|
2777
|
+
* Store query result in data cache.
|
|
2778
|
+
* If the key already exists, it's removed first so the re-insert places it
|
|
2779
|
+
* at the back of the iteration order (LRU). Eviction only fires when adding
|
|
2780
|
+
* a genuinely new key past the size limit.
|
|
2781
|
+
*/
|
|
2782
|
+
set(query: string, data: any): void;
|
|
2783
|
+
/**
|
|
2784
|
+
* Get cached result if exists and not expired.
|
|
2785
|
+
* On hit, re-inserts the entry so it moves to the back of the Map's
|
|
2786
|
+
* iteration order — turning FIFO eviction into true LRU.
|
|
2787
|
+
*/
|
|
2788
|
+
get(query: string): any | null;
|
|
2789
|
+
/**
|
|
2790
|
+
* Check if query exists in cache (not expired)
|
|
2791
|
+
*/
|
|
2792
|
+
has(query: string): boolean;
|
|
2793
|
+
/**
|
|
2794
|
+
* Remove a specific query from cache
|
|
2795
|
+
*/
|
|
2796
|
+
delete(query: string): void;
|
|
2797
|
+
/**
|
|
2798
|
+
* Clear all cached entries
|
|
2799
|
+
*/
|
|
2800
|
+
clear(): void;
|
|
2801
|
+
/**
|
|
2802
|
+
* Get cache statistics
|
|
2803
|
+
*/
|
|
2804
|
+
getStats(): {
|
|
2805
|
+
size: number;
|
|
2806
|
+
queryIdCount: number;
|
|
2807
|
+
oldestEntryAge: number | null;
|
|
2808
|
+
};
|
|
2809
|
+
/**
|
|
2810
|
+
* Start periodic cleanup of expired data cache entries.
|
|
2811
|
+
*/
|
|
2812
|
+
private startCleanup;
|
|
2813
|
+
/**
|
|
2814
|
+
* Encrypt a payload into a self-contained token.
|
|
2815
|
+
*/
|
|
2816
|
+
private encrypt;
|
|
2817
|
+
/**
|
|
2818
|
+
* Decrypt a token back to the original payload.
|
|
2819
|
+
*/
|
|
2820
|
+
private decrypt;
|
|
2821
|
+
/**
|
|
2822
|
+
* Store a query by generating an encrypted token as queryId.
|
|
2823
|
+
* The SQL is encrypted INTO the token — nothing stored in memory.
|
|
2824
|
+
* If data is provided, it's cached temporarily in the data cache.
|
|
2825
|
+
*/
|
|
2826
|
+
storeQuery(query: any, data?: any): string;
|
|
2827
|
+
/**
|
|
2828
|
+
* Get a stored query by decrypting its token.
|
|
2829
|
+
* Returns the SQL + any cached result data.
|
|
2830
|
+
*/
|
|
2831
|
+
getQuery(queryId: string): {
|
|
2832
|
+
query: any;
|
|
2833
|
+
data: any;
|
|
2834
|
+
} | null;
|
|
2835
|
+
/**
|
|
2836
|
+
* Update cached data for a queryId token
|
|
2837
|
+
*/
|
|
2838
|
+
setQueryData(queryId: string, data: any): void;
|
|
2839
|
+
/**
|
|
2840
|
+
* Stop cleanup interval (for graceful shutdown)
|
|
2841
|
+
*/
|
|
2842
|
+
destroy(): void;
|
|
2843
|
+
}
|
|
2844
|
+
declare const queryCache: QueryCache;
|
|
2845
|
+
|
|
2846
|
+
/**
|
|
2847
|
+
* Manages conversation history scoped per user + dashboard.
|
|
2848
|
+
* Each user-dashboard pair has its own isolated history that expires after a configurable TTL.
|
|
2849
|
+
*/
|
|
2850
|
+
declare class DashboardConversationHistory {
|
|
2851
|
+
private histories;
|
|
2852
|
+
private ttlMs;
|
|
2853
|
+
private maxEntries;
|
|
2854
|
+
private cleanupInterval;
|
|
2855
|
+
constructor();
|
|
2856
|
+
/**
|
|
2857
|
+
* Set the TTL for dashboard histories
|
|
2858
|
+
* @param minutes - TTL in minutes
|
|
2859
|
+
*/
|
|
2860
|
+
setTTL(minutes: number): void;
|
|
2861
|
+
/**
|
|
2862
|
+
* Set max entries per dashboard
|
|
2863
|
+
*/
|
|
2864
|
+
setMaxEntries(max: number): void;
|
|
2865
|
+
/**
|
|
2866
|
+
* Add a conversation entry for a user's dashboard
|
|
2867
|
+
*/
|
|
2868
|
+
addEntry(dashboardId: string, userPrompt: string, componentSummary: string, userId?: string): void;
|
|
2869
|
+
/**
|
|
2870
|
+
* Get formatted conversation history for a user's dashboard
|
|
2871
|
+
*/
|
|
2872
|
+
getHistory(dashboardId: string, userId?: string): string;
|
|
2873
|
+
/**
|
|
2874
|
+
* Clear history for a specific user's dashboard
|
|
2875
|
+
*/
|
|
2876
|
+
clearDashboard(dashboardId: string, userId?: string): void;
|
|
2877
|
+
/**
|
|
2878
|
+
* Clear all dashboard histories
|
|
2879
|
+
*/
|
|
2880
|
+
clearAll(): void;
|
|
2881
|
+
/**
|
|
2882
|
+
* Start periodic cleanup of expired histories
|
|
2883
|
+
*/
|
|
2884
|
+
private startCleanup;
|
|
2885
|
+
/**
|
|
2886
|
+
* Stop cleanup interval (for graceful shutdown)
|
|
2887
|
+
*/
|
|
2888
|
+
destroy(): void;
|
|
2889
|
+
}
|
|
2890
|
+
declare const dashboardConversationHistory: DashboardConversationHistory;
|
|
2891
|
+
|
|
2111
2892
|
type MessageTypeHandler = (message: IncomingMessage) => void | Promise<void>;
|
|
2112
2893
|
declare class SuperatomSDK {
|
|
2113
2894
|
private ws;
|
|
@@ -2124,6 +2905,7 @@ declare class SuperatomSDK {
|
|
|
2124
2905
|
private collections;
|
|
2125
2906
|
private components;
|
|
2126
2907
|
private tools;
|
|
2908
|
+
private workflows;
|
|
2127
2909
|
private anthropicApiKey;
|
|
2128
2910
|
private groqApiKey;
|
|
2129
2911
|
private geminiApiKey;
|
|
@@ -2131,6 +2913,10 @@ declare class SuperatomSDK {
|
|
|
2131
2913
|
private llmProviders;
|
|
2132
2914
|
private databaseType;
|
|
2133
2915
|
private modelStrategy;
|
|
2916
|
+
private mainAgentModel;
|
|
2917
|
+
private sourceAgentModel;
|
|
2918
|
+
private dashCompModels?;
|
|
2919
|
+
private conversationSimilarityThreshold;
|
|
2134
2920
|
private userManager;
|
|
2135
2921
|
private dashboardManager;
|
|
2136
2922
|
private reportManager;
|
|
@@ -2177,9 +2963,11 @@ declare class SuperatomSDK {
|
|
|
2177
2963
|
*/
|
|
2178
2964
|
private handleMessage;
|
|
2179
2965
|
/**
|
|
2180
|
-
* Send a message to the Superatom service
|
|
2966
|
+
* Send a message to the Superatom service.
|
|
2967
|
+
* Returns true if the message was sent, false if the WebSocket is not connected.
|
|
2968
|
+
* Does NOT throw on closed connections — callers can check the return value if needed.
|
|
2181
2969
|
*/
|
|
2182
|
-
send(message: Message):
|
|
2970
|
+
send(message: Message): boolean;
|
|
2183
2971
|
/**
|
|
2184
2972
|
* Register a message handler to receive all messages
|
|
2185
2973
|
*/
|
|
@@ -2227,6 +3015,19 @@ declare class SuperatomSDK {
|
|
|
2227
3015
|
* Get the stored tools
|
|
2228
3016
|
*/
|
|
2229
3017
|
getTools(): Tool$1[];
|
|
3018
|
+
/**
|
|
3019
|
+
* Register workflow components for the SDK instance.
|
|
3020
|
+
*
|
|
3021
|
+
* Workflows are pre-built multi-step UI flows the main agent can pick when
|
|
3022
|
+
* the user's prompt matches a workflow's `whenToUse` trigger. Picking a
|
|
3023
|
+
* workflow short-circuits analysis text + dashboard component generation —
|
|
3024
|
+
* the workflow component is returned directly, with the LLM-extracted props.
|
|
3025
|
+
*/
|
|
3026
|
+
setWorkflows(workflows: WorkflowDescriptor[]): void;
|
|
3027
|
+
/**
|
|
3028
|
+
* Get the registered workflow components.
|
|
3029
|
+
*/
|
|
3030
|
+
getWorkflows(): WorkflowDescriptor[];
|
|
2230
3031
|
/**
|
|
2231
3032
|
* Apply model strategy to all LLM provider singletons
|
|
2232
3033
|
* @param strategy - 'best', 'fast', or 'balanced'
|
|
@@ -2241,6 +3042,20 @@ declare class SuperatomSDK {
|
|
|
2241
3042
|
* Get current model strategy
|
|
2242
3043
|
*/
|
|
2243
3044
|
getModelStrategy(): ModelStrategy;
|
|
3045
|
+
/**
|
|
3046
|
+
* Apply conversation similarity threshold to all LLM provider singletons
|
|
3047
|
+
* @param threshold - Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
3048
|
+
*/
|
|
3049
|
+
private applyConversationSimilarityThreshold;
|
|
3050
|
+
/**
|
|
3051
|
+
* Set conversation similarity threshold at runtime
|
|
3052
|
+
* @param threshold - Value between 0 and 1 (e.g., 0.8 = 80% similarity required)
|
|
3053
|
+
*/
|
|
3054
|
+
setConversationSimilarityThreshold(threshold: number): void;
|
|
3055
|
+
/**
|
|
3056
|
+
* Get current conversation similarity threshold
|
|
3057
|
+
*/
|
|
3058
|
+
getConversationSimilarityThreshold(): number;
|
|
2244
3059
|
}
|
|
2245
3060
|
|
|
2246
|
-
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type
|
|
3061
|
+
export { type Action, type AgentConfig, type AgentResponse, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, DEFAULT_AGENT_CONFIG, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, MainAgent, type Message, type ModelStrategy, type OutputField, type RerankedResult, STORAGE_CONFIG, type SelectedWorkflow, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, UIBlock, UILogCollector, type User, UserManager, type UsersData, type WorkflowDescriptor, anthropicLLM, dashboardConversationHistory, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, queryCache, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|