@magemetrics/ai 0.11.0 → 0.11.3

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.
@@ -94,6 +94,46 @@ export declare interface ChatContextValue {
94
94
  enableSpeechToText?: boolean;
95
95
  }
96
96
 
97
+ /**
98
+ * Optional provider that allows the host application to pass dynamic runtime hints
99
+ * to the chat. The hints are sent with every message and injected ephemerally into
100
+ * the LLM prompt — they are not persisted or shown in the UI.
101
+ * Place this anywhere inside `MageMetricsContextProvider` and around the `Chat` component.
102
+ * When the `value` prop changes, the next message sent will carry the updated hints.
103
+ * If this provider is not used, no hints are sent — everything works as before.
104
+ * @param props - The provider props
105
+ * @param props.value - The chat hints value to provide
106
+ * @param props.children - The child components
107
+ * @returns The provider component wrapping children
108
+ */
109
+ export declare const ChatHintsProvider: default_2.FC<ChatHintsProviderProps>;
110
+
111
+ declare interface ChatHintsProviderProps {
112
+ /**
113
+ * Arbitrary key-value hints from the host application.
114
+ * These are sent alongside every chat message and injected into the LLM prompt.
115
+ * @example
116
+ * ```tsx
117
+ * <ChatHintsProvider value={{
118
+ * selectedLocation: { lat: 48.8566, lng: 2.3522, name: "Paris" },
119
+ * activeFilters: ["revenue > 1M"],
120
+ * }}>
121
+ * <Chat flowId="..." />
122
+ * </ChatHintsProvider>
123
+ * ```
124
+ */
125
+ value: ChatHintsValue;
126
+ children: default_2.ReactNode;
127
+ }
128
+
129
+ /**
130
+ * The value type for chat hints — a free-form key-value object
131
+ * that the host application can use to pass runtime information to the LLM.
132
+ * These hints are injected ephemerally into each chat message (not persisted)
133
+ * so the LLM is aware of the host application's current state.
134
+ */
135
+ export declare type ChatHintsValue = Record<string, unknown>;
136
+
97
137
  export declare interface ChatInputContextValue {
98
138
  flowId: string | undefined;
99
139
  isLoading: boolean;
@@ -293,8 +333,8 @@ declare const FrontendReportSchema: z.ZodObject<{
293
333
  avg_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
294
334
  }, z.core.$loose>>;
295
335
  }, z.core.$loose>;
296
- is_removed: z.ZodBoolean;
297
336
  flow_id: z.ZodString;
337
+ is_removed: z.ZodBoolean;
298
338
  is_materialized: z.ZodNullable<z.ZodBoolean>;
299
339
  last_materialized_at: z.ZodNullable<z.ZodString>;
300
340
  materialized_error_message: z.ZodNullable<z.ZodString>;
@@ -350,7 +390,6 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
350
390
  type: z.ZodLiteral<"pie">;
351
391
  }, z.core.$strip>], "type">;
352
392
  created_at: z.ZodString;
353
- flow_data_id: z.ZodNumber;
354
393
  flow_data: z.ZodOptional<z.ZodObject<{
355
394
  is_materialized: z.ZodNullable<z.ZodBoolean>;
356
395
  last_materialized_at: z.ZodNullable<z.ZodString>;
@@ -361,6 +400,7 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
361
400
  running: "running";
362
401
  }>>;
363
402
  }, z.core.$strip>>;
403
+ flow_data_id: z.ZodNumber;
364
404
  }, z.core.$strip>;
365
405
 
366
406
  declare const InputContainer: default_2.FC<{
@@ -625,6 +665,12 @@ is_public: boolean;
625
665
 
626
666
  export declare const useChatContext: () => ChatContextValue;
627
667
 
668
+ /**
669
+ * Returns the current chat hints value, or `null` if no `ChatHintsProvider` is present.
670
+ * @returns The current chat hints value or null
671
+ */
672
+ export declare const useChatHints: () => ChatHintsValue | null;
673
+
628
674
  export declare const useChatInputContext: () => ChatInputContextValue;
629
675
 
630
676
  export declare const useCreateFlow: (options?: UseMutationOptions<{
@@ -746,7 +792,7 @@ export declare const useCreateFlow: (options?: UseMutationOptions<{
746
792
  };
747
793
 
748
794
  export declare const useDataReportColumnValue: (reportId: number, filters: ReportDataFilters) => UseQueryResult< {
749
- [key: string]: unknown;
795
+ [x: string]: unknown;
750
796
  }[], Error>;
751
797
 
752
798
  export declare const useDataTableContext: () => {
@@ -777,26 +823,26 @@ export declare const useDataTableContext: () => {
777
823
  avg_length?: number | null | undefined;
778
824
  }>;
779
825
  };
780
- is_removed: boolean;
781
826
  flow_id: string;
827
+ is_removed: boolean;
782
828
  is_materialized: boolean | null;
783
829
  last_materialized_at: string | null;
784
830
  materialized_error_message: string | null;
785
831
  materialized_status: "completed" | "running" | "failed" | null;
786
832
  };
787
833
  fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData< {
788
- [key: string]: unknown;
834
+ [x: string]: unknown;
789
835
  }[], unknown>, Error>>;
790
836
  pages: {
791
- [key: string]: unknown;
837
+ [x: string]: unknown;
792
838
  }[][] | undefined;
793
839
  columns: {
794
840
  name: string;
795
841
  data_type: string;
796
842
  dataType: string;
797
- renderType?: string;
798
- unit?: string;
799
- canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
843
+ renderType?: string | undefined;
844
+ unit?: string | undefined;
845
+ canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other" | undefined;
800
846
  }[] | undefined;
801
847
  isPendingColumns: boolean;
802
848
  hasMoreData: boolean;
@@ -905,29 +951,27 @@ export declare const useReport: (reportId: number) => {
905
951
  title: string;
906
952
  request: string | null;
907
953
  data_summary: {
954
+ [x: string]: unknown;
908
955
  columns: {
909
- [key: string]: {
910
- position?: number;
956
+ [x: string]: {
957
+ [x: string]: unknown;
958
+ position?: number | undefined;
911
959
  data_type: string;
912
960
  null_count: number | null;
913
961
  unique_count: number | null;
914
962
  unique_percentage: number | null;
915
- min_value?: number | null;
916
- max_value?: number | null;
917
- avg_value?: number | null;
918
- median_value?: number | null;
919
- std_value?: number | null;
920
- min_date?: string | null;
921
- max_date?: string | null;
922
- min_length?: number | null;
923
- max_length?: number | null;
924
- avg_length?: number | null;
925
- } & {
926
- [key: string]: unknown;
963
+ min_value?: number | null | undefined;
964
+ max_value?: number | null | undefined;
965
+ avg_value?: number | null | undefined;
966
+ median_value?: number | null | undefined;
967
+ std_value?: number | null | undefined;
968
+ min_date?: string | null | undefined;
969
+ max_date?: string | null | undefined;
970
+ min_length?: number | null | undefined;
971
+ max_length?: number | null | undefined;
972
+ avg_length?: number | null | undefined;
927
973
  };
928
974
  };
929
- } & {
930
- [key: string]: unknown;
931
975
  };
932
976
  status: string | null;
933
977
  is_removed: boolean;
@@ -947,29 +991,27 @@ export declare const useReport: (reportId: number) => {
947
991
  title: string;
948
992
  request: string | null;
949
993
  data_summary: {
994
+ [x: string]: unknown;
950
995
  columns: {
951
- [key: string]: {
952
- position?: number;
996
+ [x: string]: {
997
+ [x: string]: unknown;
998
+ position?: number | undefined;
953
999
  data_type: string;
954
1000
  null_count: number | null;
955
1001
  unique_count: number | null;
956
1002
  unique_percentage: number | null;
957
- min_value?: number | null;
958
- max_value?: number | null;
959
- avg_value?: number | null;
960
- median_value?: number | null;
961
- std_value?: number | null;
962
- min_date?: string | null;
963
- max_date?: string | null;
964
- min_length?: number | null;
965
- max_length?: number | null;
966
- avg_length?: number | null;
967
- } & {
968
- [key: string]: unknown;
1003
+ min_value?: number | null | undefined;
1004
+ max_value?: number | null | undefined;
1005
+ avg_value?: number | null | undefined;
1006
+ median_value?: number | null | undefined;
1007
+ std_value?: number | null | undefined;
1008
+ min_date?: string | null | undefined;
1009
+ max_date?: string | null | undefined;
1010
+ min_length?: number | null | undefined;
1011
+ max_length?: number | null | undefined;
1012
+ avg_length?: number | null | undefined;
969
1013
  };
970
1014
  };
971
- } & {
972
- [key: string]: unknown;
973
1015
  };
974
1016
  status: string | null;
975
1017
  is_removed: boolean;
@@ -1022,7 +1064,6 @@ declare const V1FrontendVisualizationSchema: z.ZodObject<{
1022
1064
  type: z.ZodLiteral<"pie">;
1023
1065
  }, z.core.$strip>], "type">;
1024
1066
  created_at: z.ZodString;
1025
- flow_data_id: z.ZodNumber;
1026
1067
  flow_data: z.ZodOptional<z.ZodObject<{
1027
1068
  is_materialized: z.ZodNullable<z.ZodBoolean>;
1028
1069
  last_materialized_at: z.ZodNullable<z.ZodString>;
@@ -1033,6 +1074,7 @@ declare const V1FrontendVisualizationSchema: z.ZodObject<{
1033
1074
  running: "running";
1034
1075
  }>>;
1035
1076
  }, z.core.$strip>>;
1077
+ flow_data_id: z.ZodNumber;
1036
1078
  }, z.core.$strip>;
1037
1079
 
1038
1080
  export declare const Visualization: ForwardRefExoticComponent< {
@@ -94,6 +94,46 @@ export declare interface ChatContextValue {
94
94
  enableSpeechToText?: boolean;
95
95
  }
96
96
 
97
+ /**
98
+ * Optional provider that allows the host application to pass dynamic runtime hints
99
+ * to the chat. The hints are sent with every message and injected ephemerally into
100
+ * the LLM prompt — they are not persisted or shown in the UI.
101
+ * Place this anywhere inside `MageMetricsContextProvider` and around the `Chat` component.
102
+ * When the `value` prop changes, the next message sent will carry the updated hints.
103
+ * If this provider is not used, no hints are sent — everything works as before.
104
+ * @param props - The provider props
105
+ * @param props.value - The chat hints value to provide
106
+ * @param props.children - The child components
107
+ * @returns The provider component wrapping children
108
+ */
109
+ export declare const ChatHintsProvider: default_2.FC<ChatHintsProviderProps>;
110
+
111
+ declare interface ChatHintsProviderProps {
112
+ /**
113
+ * Arbitrary key-value hints from the host application.
114
+ * These are sent alongside every chat message and injected into the LLM prompt.
115
+ * @example
116
+ * ```tsx
117
+ * <ChatHintsProvider value={{
118
+ * selectedLocation: { lat: 48.8566, lng: 2.3522, name: "Paris" },
119
+ * activeFilters: ["revenue > 1M"],
120
+ * }}>
121
+ * <Chat flowId="..." />
122
+ * </ChatHintsProvider>
123
+ * ```
124
+ */
125
+ value: ChatHintsValue;
126
+ children: default_2.ReactNode;
127
+ }
128
+
129
+ /**
130
+ * The value type for chat hints — a free-form key-value object
131
+ * that the host application can use to pass runtime information to the LLM.
132
+ * These hints are injected ephemerally into each chat message (not persisted)
133
+ * so the LLM is aware of the host application's current state.
134
+ */
135
+ export declare type ChatHintsValue = Record<string, unknown>;
136
+
97
137
  export declare interface ChatInputContextValue {
98
138
  flowId: string | undefined;
99
139
  isLoading: boolean;
@@ -293,8 +333,8 @@ declare const FrontendReportSchema: z.ZodObject<{
293
333
  avg_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
294
334
  }, z.core.$loose>>;
295
335
  }, z.core.$loose>;
296
- is_removed: z.ZodBoolean;
297
336
  flow_id: z.ZodString;
337
+ is_removed: z.ZodBoolean;
298
338
  is_materialized: z.ZodNullable<z.ZodBoolean>;
299
339
  last_materialized_at: z.ZodNullable<z.ZodString>;
300
340
  materialized_error_message: z.ZodNullable<z.ZodString>;
@@ -350,7 +390,6 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
350
390
  type: z.ZodLiteral<"pie">;
351
391
  }, z.core.$strip>], "type">;
352
392
  created_at: z.ZodString;
353
- flow_data_id: z.ZodNumber;
354
393
  flow_data: z.ZodOptional<z.ZodObject<{
355
394
  is_materialized: z.ZodNullable<z.ZodBoolean>;
356
395
  last_materialized_at: z.ZodNullable<z.ZodString>;
@@ -361,6 +400,7 @@ declare const FrontendVisualizationSchema: z.ZodObject<{
361
400
  running: "running";
362
401
  }>>;
363
402
  }, z.core.$strip>>;
403
+ flow_data_id: z.ZodNumber;
364
404
  }, z.core.$strip>;
365
405
 
366
406
  declare const InputContainer: default_2.FC<{
@@ -625,6 +665,12 @@ export declare const useCanvas: (canvasId: string | undefined | null, options?:
625
665
 
626
666
  export declare const useChatContext: () => ChatContextValue;
627
667
 
668
+ /**
669
+ * Returns the current chat hints value, or `null` if no `ChatHintsProvider` is present.
670
+ * @returns The current chat hints value or null
671
+ */
672
+ export declare const useChatHints: () => ChatHintsValue | null;
673
+
628
674
  export declare const useChatInputContext: () => ChatInputContextValue;
629
675
 
630
676
  export declare const useCreateFlow: (options?: UseMutationOptions<{
@@ -746,7 +792,7 @@ export declare const useCreateFlow: (options?: UseMutationOptions<{
746
792
  };
747
793
 
748
794
  export declare const useDataReportColumnValue: (reportId: number, filters: ReportDataFilters) => UseQueryResult< {
749
- [key: string]: unknown;
795
+ [x: string]: unknown;
750
796
  }[], Error>;
751
797
 
752
798
  export declare const useDataTableContext: () => {
@@ -777,26 +823,26 @@ export declare const useDataTableContext: () => {
777
823
  avg_length?: number | null | undefined;
778
824
  }>;
779
825
  };
780
- is_removed: boolean;
781
826
  flow_id: string;
827
+ is_removed: boolean;
782
828
  is_materialized: boolean | null;
783
829
  last_materialized_at: string | null;
784
830
  materialized_error_message: string | null;
785
831
  materialized_status: "completed" | "running" | "failed" | null;
786
832
  };
787
833
  fetchNextPage: (options?: FetchNextPageOptions) => Promise<InfiniteQueryObserverResult<InfiniteData< {
788
- [key: string]: unknown;
834
+ [x: string]: unknown;
789
835
  }[], unknown>, Error>>;
790
836
  pages: {
791
- [key: string]: unknown;
837
+ [x: string]: unknown;
792
838
  }[][] | undefined;
793
839
  columns: {
794
840
  name: string;
795
841
  data_type: string;
796
842
  dataType: string;
797
- renderType?: string;
798
- unit?: string;
799
- canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
843
+ renderType?: string | undefined;
844
+ unit?: string | undefined;
845
+ canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other" | undefined;
800
846
  }[] | undefined;
801
847
  isPendingColumns: boolean;
802
848
  hasMoreData: boolean;
@@ -905,29 +951,27 @@ export declare const useReport: (reportId: number) => {
905
951
  title: string;
906
952
  request: string | null;
907
953
  data_summary: {
954
+ [x: string]: unknown;
908
955
  columns: {
909
- [key: string]: {
910
- position?: number;
956
+ [x: string]: {
957
+ [x: string]: unknown;
958
+ position?: number | undefined;
911
959
  data_type: string;
912
960
  null_count: number | null;
913
961
  unique_count: number | null;
914
962
  unique_percentage: number | null;
915
- min_value?: number | null;
916
- max_value?: number | null;
917
- avg_value?: number | null;
918
- median_value?: number | null;
919
- std_value?: number | null;
920
- min_date?: string | null;
921
- max_date?: string | null;
922
- min_length?: number | null;
923
- max_length?: number | null;
924
- avg_length?: number | null;
925
- } & {
926
- [key: string]: unknown;
963
+ min_value?: number | null | undefined;
964
+ max_value?: number | null | undefined;
965
+ avg_value?: number | null | undefined;
966
+ median_value?: number | null | undefined;
967
+ std_value?: number | null | undefined;
968
+ min_date?: string | null | undefined;
969
+ max_date?: string | null | undefined;
970
+ min_length?: number | null | undefined;
971
+ max_length?: number | null | undefined;
972
+ avg_length?: number | null | undefined;
927
973
  };
928
974
  };
929
- } & {
930
- [key: string]: unknown;
931
975
  };
932
976
  status: string | null;
933
977
  is_removed: boolean;
@@ -947,29 +991,27 @@ export declare const useReport: (reportId: number) => {
947
991
  title: string;
948
992
  request: string | null;
949
993
  data_summary: {
994
+ [x: string]: unknown;
950
995
  columns: {
951
- [key: string]: {
952
- position?: number;
996
+ [x: string]: {
997
+ [x: string]: unknown;
998
+ position?: number | undefined;
953
999
  data_type: string;
954
1000
  null_count: number | null;
955
1001
  unique_count: number | null;
956
1002
  unique_percentage: number | null;
957
- min_value?: number | null;
958
- max_value?: number | null;
959
- avg_value?: number | null;
960
- median_value?: number | null;
961
- std_value?: number | null;
962
- min_date?: string | null;
963
- max_date?: string | null;
964
- min_length?: number | null;
965
- max_length?: number | null;
966
- avg_length?: number | null;
967
- } & {
968
- [key: string]: unknown;
1003
+ min_value?: number | null | undefined;
1004
+ max_value?: number | null | undefined;
1005
+ avg_value?: number | null | undefined;
1006
+ median_value?: number | null | undefined;
1007
+ std_value?: number | null | undefined;
1008
+ min_date?: string | null | undefined;
1009
+ max_date?: string | null | undefined;
1010
+ min_length?: number | null | undefined;
1011
+ max_length?: number | null | undefined;
1012
+ avg_length?: number | null | undefined;
969
1013
  };
970
1014
  };
971
- } & {
972
- [key: string]: unknown;
973
1015
  };
974
1016
  status: string | null;
975
1017
  is_removed: boolean;
@@ -1022,7 +1064,6 @@ declare const V1FrontendVisualizationSchema: z.ZodObject<{
1022
1064
  type: z.ZodLiteral<"pie">;
1023
1065
  }, z.core.$strip>], "type">;
1024
1066
  created_at: z.ZodString;
1025
- flow_data_id: z.ZodNumber;
1026
1067
  flow_data: z.ZodOptional<z.ZodObject<{
1027
1068
  is_materialized: z.ZodNullable<z.ZodBoolean>;
1028
1069
  last_materialized_at: z.ZodNullable<z.ZodString>;
@@ -1033,6 +1074,7 @@ declare const V1FrontendVisualizationSchema: z.ZodObject<{
1033
1074
  running: "running";
1034
1075
  }>>;
1035
1076
  }, z.core.$strip>>;
1077
+ flow_data_id: z.ZodNumber;
1036
1078
  }, z.core.$strip>;
1037
1079
 
1038
1080
  export declare const Visualization: ForwardRefExoticComponent< {