@magemetrics/core 0.13.0 → 0.14.1

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.
Files changed (4) hide show
  1. package/README.md +220 -0
  2. package/dist/index.d.ts +830 -128
  3. package/dist/index.js +1014 -340
  4. package/package.json +8 -8
package/dist/index.d.ts CHANGED
@@ -9,8 +9,17 @@ import type { NodeBase } from '@xyflow/system';
9
9
  import type { Simplify } from 'type-fest';
10
10
  import type { Tool } from 'ai';
11
11
  import type { UIMessage } from 'ai';
12
+ import type { UIMessagePart } from 'ai';
12
13
  import { z } from 'zod';
13
14
 
15
+ export declare const ASK_USER_QUESTION: "askUserQuestion";
16
+
17
+ export declare type AskUserQuestionInput = z.infer<typeof inputSchema_9>;
18
+
19
+ export declare type AskUserQuestionPart = Extract<MMChatUIMessagePart, {
20
+ type: `tool-${typeof ASK_USER_QUESTION}`;
21
+ }>;
22
+
14
23
  /**
15
24
  * Universal storage adapter interface for cross-platform compatibility.
16
25
  * All operations are async to accommodate different storage mechanisms.
@@ -111,6 +120,11 @@ export declare interface AuthProvider {
111
120
  * @param listener the listener to remove
112
121
  */
113
122
  removeEventListener<T extends MageMetricsEvent>(type: T["type"], listener: MageMetricsEventListener<T>): void;
123
+ /**
124
+ * Clean up resources held by the auth provider.
125
+ * Called when the provider is no longer needed (e.g., client is being replaced).
126
+ */
127
+ destroy(): void;
114
128
  }
115
129
 
116
130
  /**
@@ -128,6 +142,40 @@ export declare class BrowserStorageAdapter implements AsyncStorage {
128
142
  removeItem(key: string): Promise<void>;
129
143
  }
130
144
 
145
+ export declare type CanonicalDataType = z.infer<typeof CanonicalDataTypeSchema>;
146
+
147
+ declare const CanonicalDataTypeSchema: z.ZodEnum<{
148
+ boolean: "boolean";
149
+ date: "date";
150
+ array: "array";
151
+ text: "text";
152
+ json: "json";
153
+ other: "other";
154
+ datetime: "datetime";
155
+ numeric: "numeric";
156
+ }>;
157
+
158
+ /** Allowed media types for chat file attachments. */
159
+ export declare const CHAT_ALLOWED_FILE_MEDIA_TYPES: Set<string>;
160
+
161
+ /**
162
+ * Value for the HTML `<input accept>` attribute, derived from
163
+ * {@link CHAT_ALLOWED_FILE_MEDIA_TYPES} so it stays in sync automatically.
164
+ */
165
+ export declare const CHAT_FILE_ACCEPT: string;
166
+
167
+ /**
168
+ * Maximum combined size of all chat file attachments in a single message.
169
+ * Intentional semantic alias of the conversation-level budget.
170
+ */
171
+ export declare const CHAT_MAX_COMBINED_FILE_SIZE: number;
172
+
173
+ /** Maximum number of file attachments per message. */
174
+ export declare const CHAT_MAX_FILE_COUNT = 10;
175
+
176
+ /** Maximum size of a single chat file attachment in bytes (10 MB). */
177
+ export declare const CHAT_MAX_FILE_SIZE: number;
178
+
131
179
  export declare const CHECK_KEY = "mm-ai-check-key";
132
180
 
133
181
  export declare interface ColumnSort {
@@ -137,6 +185,8 @@ export declare interface ColumnSort {
137
185
 
138
186
  declare interface components {
139
187
  schemas: {
188
+ /** Format: uuid */
189
+ CanvasId: string;
140
190
  ReportColumns: {
141
191
  name: string;
142
192
  data_type: string;
@@ -144,10 +194,12 @@ declare interface components {
144
194
  renderType?: string;
145
195
  unit?: string;
146
196
  /** @enum {string} */
147
- canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
197
+ canonicalDataType?: "numeric" | "boolean" | "datetime" | "date" | "text" | "array" | "json" | "other";
198
+ formatHint?: {
199
+ isNumeric?: boolean;
200
+ isLikelyYear?: boolean;
201
+ };
148
202
  }[];
149
- /** Format: uuid */
150
- CanvasId: string;
151
203
  ReportData: {
152
204
  [key: string]: unknown;
153
205
  }[];
@@ -315,9 +367,6 @@ declare interface components {
315
367
  sampledCount: number;
316
368
  };
317
369
  };
318
- VisualizationData: {
319
- [key: string]: string | (number | null) | unknown | null;
320
- }[];
321
370
  /** @description Prompt starter template */
322
371
  PromptStarter: {
323
372
  id: number;
@@ -378,6 +427,12 @@ declare interface components {
378
427
  /** Format: uuid */
379
428
  agent_version_id?: string | null;
380
429
  cached?: boolean;
430
+ /** Format: uuid */
431
+ cached_from?: string | null;
432
+ /** @default 0 */
433
+ report_count: number;
434
+ /** @default 0 */
435
+ visualization_count: number;
381
436
  };
382
437
  StartAgentRunRequest: {
383
438
  /** Format: uuid */
@@ -388,36 +443,11 @@ declare interface components {
388
443
  };
389
444
  execution_context?: components["schemas"]["ExecutionContextInput"];
390
445
  };
391
- ExecutionContextInput: components["schemas"]["ImpersonateContext"] | components["schemas"]["CustomMetadataContext"];
392
- ImpersonateContext: {
393
- /**
394
- * @description discriminator enum property added by openapi-typescript
395
- * @enum {string}
396
- */
397
- mode: "impersonate";
398
- /** @description The user ID in the customer's system */
399
- external_user_id: string;
400
- };
401
- CustomMetadataContext: {
402
- /**
403
- * @description discriminator enum property added by openapi-typescript
404
- * @enum {string}
405
- */
406
- mode: "custom";
407
- /** @description Raw metadata key-value pairs for data access rules */
408
- metadata: {
409
- [key: string]: unknown;
410
- };
411
- };
412
- AgentRunCountsResponse: {
413
- [key: string]: number;
414
- };
415
446
  Agent: {
416
447
  /** Format: uuid */
417
448
  id: string;
418
449
  created_at: string;
419
450
  name: string;
420
- objective: string | null;
421
451
  generated_objective_fragment: string | null;
422
452
  active_tools: string[] | null;
423
453
  input_schema: ({
@@ -479,13 +509,13 @@ declare interface components {
479
509
  /** @enum {string} */
480
510
  execution_platform: "native" | "sandbox" | "sandbox_public";
481
511
  updated_at: string;
512
+ version_count: number;
482
513
  };
483
514
  AgentVersion: {
484
515
  /** Format: uuid */
485
516
  id: string;
486
517
  version: number;
487
518
  name: string;
488
- objective: string | null;
489
519
  generated_objective_fragment: string | null;
490
520
  active_tools: string[] | null;
491
521
  input_schema: ({
@@ -549,70 +579,36 @@ declare interface components {
549
579
  restored_from_version?: number | null;
550
580
  created_at: string;
551
581
  };
552
- CreateGlobalKnowledgeItem: {
553
- content: string;
554
- /** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
555
- client_reference_id?: string;
556
- /** @default true */
557
- is_active: boolean;
558
- tags?: string[];
559
- /** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
560
- application_ids?: number[];
561
- /** @enum {string} */
562
- type: "global";
563
- };
564
- CreateSchemaKnowledgeItem: {
565
- content: string;
566
- /** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
567
- client_reference_id?: string;
568
- /** @default true */
569
- is_active: boolean;
570
- tags?: string[];
571
- /** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
572
- application_ids?: number[];
573
- /** @enum {string} */
574
- type: "schema";
575
- path: components["schemas"]["SchemaPath"];
576
- };
577
- SchemaPath: {
578
- /** @description Schema or dataset name in the source database */
579
- dataset: string;
580
- /** @description Table name in the source database */
581
- table_name: string;
582
- /** @description Column name (optional). Omit for table-level items, include for column-level items. */
583
- column_name?: string;
584
- };
585
- UpsertGlobalKnowledgeItem: {
586
- content: string;
587
- /** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
588
- client_reference_id: string;
589
- /** @default true */
590
- is_active: boolean;
591
- tags?: string[];
592
- /** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
593
- application_ids?: number[];
594
- /** @enum {string} */
595
- type: "global";
596
- };
597
- UpsertSchemaKnowledgeItem: {
598
- content: string;
599
- /** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
600
- client_reference_id: string;
601
- /** @default true */
602
- is_active: boolean;
603
- tags?: string[];
604
- /** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
605
- application_ids?: number[];
606
- /** @enum {string} */
607
- type: "schema";
608
- path: components["schemas"]["SchemaPath"];
609
- };
582
+ ExecutionContextInput: components["schemas"]["ImpersonateContext"] | components["schemas"]["CustomMetadataContext"];
610
583
  StatisticsResponse: {
611
584
  /** @description The time period in days for these statistics */
612
585
  period_days: number;
613
586
  user_generated: components["schemas"]["UserGeneratedStatistics"];
614
587
  agent_generated: components["schemas"]["AgentGeneratedStatistics"];
615
588
  };
589
+ VisualizationData: {
590
+ [key: string]: string | (number | null) | unknown | null;
591
+ }[];
592
+ ImpersonateContext: {
593
+ /**
594
+ * @description discriminator enum property added by openapi-typescript
595
+ * @enum {string}
596
+ */
597
+ mode: "impersonate";
598
+ /** @description The user ID in the customer's system */
599
+ external_user_id: string;
600
+ };
601
+ CustomMetadataContext: {
602
+ /**
603
+ * @description discriminator enum property added by openapi-typescript
604
+ * @enum {string}
605
+ */
606
+ mode: "custom";
607
+ /** @description Raw metadata key-value pairs for data access rules */
608
+ metadata: {
609
+ [key: string]: unknown;
610
+ };
611
+ };
616
612
  /** @description Statistics for user-generated content (conversations, reports, visualizations) */
617
613
  UserGeneratedStatistics: {
618
614
  /** @description Number of user-created conversations */
@@ -709,6 +705,7 @@ export declare class DirectAuthProvider implements AuthProvider {
709
705
  signal?: AbortSignal;
710
706
  }): void;
711
707
  removeEventListener<T extends MageMetricsEvent>(type: T["type"], listener: MageMetricsEventListener<T>): void;
708
+ destroy(): void;
712
709
  private setState;
713
710
  }
714
711
 
@@ -732,6 +729,7 @@ export declare class ExternalAuthProvider implements AuthProvider {
732
729
  private processedJwt;
733
730
  private userId;
734
731
  private events;
732
+ private authSubscription;
735
733
  constructor(config: ExternalAuthProviderConfig);
736
734
  initialize(): Promise<void>;
737
735
  getHeaders(): Promise<Record<string, string>>;
@@ -745,6 +743,7 @@ export declare class ExternalAuthProvider implements AuthProvider {
745
743
  removeEventListener<T extends MageMetricsEvent>(type: T["type"], listener: MageMetricsEventListener<T>): void;
746
744
  startAutoRefresh(): Promise<void> | undefined;
747
745
  stopAutoRefresh(): Promise<void> | undefined;
746
+ destroy(): void;
748
747
  private getApiInformation;
749
748
  private initializeSupabaseClient;
750
749
  private handleAuthentication;
@@ -767,7 +766,18 @@ export declare interface ExternalAuthProviderConfig {
767
766
  authOptions?: Pick<GoTrueClientOptions, "fetch">;
768
767
  }
769
768
 
770
- declare type FrontendRecentFlows = z.infer<typeof FrontendRecentFlowsSchema>;
769
+ export declare type FrontendFlow = z.infer<typeof FrontendFlowSchema>;
770
+
771
+ declare const FrontendFlowSchema: z.ZodObject<{
772
+ title: z.ZodNullable<z.ZodString>;
773
+ id: z.ZodString;
774
+ request: z.ZodString;
775
+ created_at: z.ZodString;
776
+ application_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
777
+ user_id: z.ZodNullable<z.ZodString>;
778
+ }, z.core.$strip>;
779
+
780
+ export declare type FrontendRecentFlows = z.infer<typeof FrontendRecentFlowsSchema>;
771
781
 
772
782
  declare const FrontendRecentFlowsSchema: z.ZodObject<{
773
783
  title: z.ZodNullable<z.ZodString>;
@@ -776,13 +786,311 @@ declare const FrontendRecentFlowsSchema: z.ZodObject<{
776
786
  created_at: z.ZodString;
777
787
  application_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
778
788
  user_id: z.ZodNullable<z.ZodString>;
779
- context_tokens: z.ZodOptional<z.ZodNumber>;
780
- acc_input_tokens: z.ZodOptional<z.ZodNumber>;
781
- acc_output_tokens: z.ZodOptional<z.ZodNumber>;
782
789
  }, z.core.$strip>;
783
790
 
791
+ export declare type FrontendRecommendations = z.infer<typeof FrontendRecommendationsSchema>;
792
+
793
+ declare const FrontendRecommendationsSchema: z.ZodObject<{
794
+ starter: z.ZodString;
795
+ explanation: z.ZodString;
796
+ type: z.ZodString;
797
+ }, z.core.$strip>;
798
+
799
+ export declare type FrontendReport = z.infer<typeof FrontendReportSchema>;
800
+
801
+ export declare type FrontendReportColumns = z.infer<typeof FrontendReportColumnsSchema>;
802
+
803
+ declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
804
+ dataType: z.ZodString;
805
+ renderType: z.ZodOptional<z.ZodString>;
806
+ unit: z.ZodOptional<z.ZodString>;
807
+ canonicalDataType: z.ZodOptional<z.ZodEnum<{
808
+ boolean: "boolean";
809
+ date: "date";
810
+ array: "array";
811
+ text: "text";
812
+ json: "json";
813
+ other: "other";
814
+ datetime: "datetime";
815
+ numeric: "numeric";
816
+ }>>;
817
+ formatHint: z.ZodOptional<z.ZodObject<{
818
+ isNumeric: z.ZodOptional<z.ZodBoolean>;
819
+ isLikelyYear: z.ZodOptional<z.ZodBoolean>;
820
+ }, z.core.$strip>>;
821
+ name: z.ZodString;
822
+ data_type: z.ZodString;
823
+ }, z.core.$strip>>;
824
+
825
+ export declare type FrontendReportExplainability = z.infer<typeof FrontendReportExplainabilitySchema>;
826
+
827
+ declare const FrontendReportExplainabilitySchema: z.ZodObject<{
828
+ columns_lineage: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
829
+ nodes: z.ZodArray<z.ZodObject<{
830
+ id: z.ZodString;
831
+ type: z.ZodEnum<{
832
+ result: "result";
833
+ filter: "filter";
834
+ entity: "entity";
835
+ attribute: "attribute";
836
+ process: "process";
837
+ combine: "combine";
838
+ }>;
839
+ explanation: z.ZodString;
840
+ }, z.core.$strip>>;
841
+ edges: z.ZodArray<z.ZodObject<{
842
+ source: z.ZodString;
843
+ target: z.ZodString;
844
+ }, z.core.$strip>>;
845
+ }, z.core.$strip>>>>;
846
+ report_id: z.ZodUUID;
847
+ sql_explanation: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
848
+ chunk_title: z.ZodString;
849
+ chunk_explanation: z.ZodString;
850
+ lines: z.ZodArray<z.ZodObject<{
851
+ sql: z.ZodString;
852
+ explanation: z.ZodString;
853
+ }, z.core.$strip>>;
854
+ }, z.core.$strip>>>>;
855
+ business_explanation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
856
+ summary: z.ZodString;
857
+ implementation: z.ZodArray<z.ZodString>;
858
+ assumptions: z.ZodArray<z.ZodObject<{
859
+ type: z.ZodEnum<{
860
+ grain: "grain";
861
+ completeness: "completeness";
862
+ transformation: "transformation";
863
+ relationship: "relationship";
864
+ other: "other";
865
+ }>;
866
+ details: z.ZodString;
867
+ explanation: z.ZodString;
868
+ }, z.core.$strip>>;
869
+ }, z.core.$strip>>>;
870
+ flow_data_id: z.ZodNumber;
871
+ confidence_score: z.ZodOptional<z.ZodNumber>;
872
+ confidence_score_reason: z.ZodOptional<z.ZodString>;
873
+ assumptions_score: z.ZodOptional<z.ZodNumber>;
874
+ assumptions_score_reason: z.ZodOptional<z.ZodString>;
875
+ friendliness_score: z.ZodOptional<z.ZodNumber>;
876
+ friendliness_score_reason: z.ZodOptional<z.ZodString>;
877
+ output_dataset: z.ZodOptional<z.ZodString>;
878
+ sql: z.ZodOptional<z.ZodString>;
879
+ }, z.core.$strip>;
880
+
881
+ declare const FrontendReportSchema: z.ZodObject<{
882
+ status: z.ZodNullable<z.ZodString>;
883
+ title: z.ZodString;
884
+ id: z.ZodNumber;
885
+ uuid: z.ZodString;
886
+ request: z.ZodNullable<z.ZodString>;
887
+ created_at: z.ZodString;
888
+ data_summary: z.ZodObject<{
889
+ columns: z.ZodRecord<z.ZodString, z.ZodObject<{
890
+ position: z.ZodOptional<z.ZodNumber>;
891
+ data_type: z.ZodString;
892
+ null_count: z.ZodNullable<z.ZodNumber>;
893
+ unique_count: z.ZodNullable<z.ZodNumber>;
894
+ unique_percentage: z.ZodNullable<z.ZodNumber>;
895
+ min_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
896
+ max_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
897
+ avg_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
898
+ median_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
899
+ std_value: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
900
+ min_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
901
+ max_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
902
+ min_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
903
+ max_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
904
+ avg_length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
905
+ }, z.core.$loose>>;
906
+ }, z.core.$loose>;
907
+ is_removed: z.ZodBoolean;
908
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
909
+ last_materialized_at: z.ZodNullable<z.ZodString>;
910
+ materialized_error_message: z.ZodNullable<z.ZodString>;
911
+ materialized_status: z.ZodNullable<z.ZodEnum<{
912
+ completed: "completed";
913
+ failed: "failed";
914
+ running: "running";
915
+ }>>;
916
+ }, z.core.$strip>;
917
+
918
+ export declare type FrontendVisualization = z.output<typeof FrontendVisualizationSchema>;
919
+
920
+ declare const FrontendVisualizationSchema: z.ZodObject<{
921
+ id: z.ZodNumber;
922
+ uuid: z.ZodString;
923
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
924
+ config_version: z.ZodLiteral<2>;
925
+ xAxisLabel: z.ZodString;
926
+ yAxisLabel: z.ZodString;
927
+ categoryColumn: z.ZodString;
928
+ secondaryCategoryColumn: z.ZodOptional<z.ZodString>;
929
+ valueColumn: z.ZodString;
930
+ title: z.ZodString;
931
+ type: z.ZodLiteral<"bar">;
932
+ }, z.core.$strip>, z.ZodObject<{
933
+ xAxisColumn: z.ZodString;
934
+ valueColumns: z.ZodArray<z.ZodString>;
935
+ yAxisLabels: z.ZodArray<z.ZodString>;
936
+ title: z.ZodString;
937
+ type: z.ZodLiteral<"line/area">;
938
+ config_version: z.ZodLiteral<2>;
939
+ }, z.core.$strip>, z.ZodObject<{
940
+ config_version: z.ZodLiteral<2>;
941
+ valueColumn: z.ZodString;
942
+ xAxisColumn: z.ZodString;
943
+ xAxisLabel: z.ZodString;
944
+ yAxisLabel: z.ZodString;
945
+ categoryColumn: z.ZodString;
946
+ title: z.ZodString;
947
+ type: z.ZodLiteral<"line/area-categorical">;
948
+ }, z.core.$strip>, z.ZodObject<{
949
+ config_version: z.ZodLiteral<2>;
950
+ xAxisLabel: z.ZodString;
951
+ yAxisLabel: z.ZodString;
952
+ xAxisValueColumn: z.ZodString;
953
+ yAxisValueColumn: z.ZodString;
954
+ title: z.ZodString;
955
+ type: z.ZodLiteral<"scatter">;
956
+ }, z.core.$strip>, z.ZodObject<{
957
+ config_version: z.ZodLiteral<2>;
958
+ categoryColumn: z.ZodString;
959
+ valueColumn: z.ZodString;
960
+ title: z.ZodString;
961
+ type: z.ZodLiteral<"pie">;
962
+ }, z.core.$strip>], "type">;
963
+ created_at: z.ZodString;
964
+ flow_data_id: z.ZodNumber;
965
+ report_uuid: z.ZodString;
966
+ flow_data: z.ZodOptional<z.ZodObject<{
967
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
968
+ last_materialized_at: z.ZodNullable<z.ZodString>;
969
+ materialized_error_message: z.ZodNullable<z.ZodString>;
970
+ materialized_status: z.ZodNullable<z.ZodEnum<{
971
+ completed: "completed";
972
+ failed: "failed";
973
+ running: "running";
974
+ }>>;
975
+ }, z.core.$strip>>;
976
+ materialization: z.ZodOptional<z.ZodObject<{
977
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
978
+ last_materialized_at: z.ZodNullable<z.ZodString>;
979
+ materialized_error_message: z.ZodNullable<z.ZodString>;
980
+ materialized_status: z.ZodNullable<z.ZodEnum<{
981
+ completed: "completed";
982
+ failed: "failed";
983
+ running: "running";
984
+ }>>;
985
+ }, z.core.$strip>>;
986
+ }, z.core.$strip>;
987
+
988
+ export declare type FrontendVisualizationWithData = z.output<typeof FrontendVisualizationWithDataSchema>;
989
+
990
+ declare const FrontendVisualizationWithDataSchema: z.ZodObject<{
991
+ id: z.ZodNumber;
992
+ uuid: z.ZodString;
993
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
994
+ config_version: z.ZodLiteral<2>;
995
+ xAxisLabel: z.ZodString;
996
+ yAxisLabel: z.ZodString;
997
+ categoryColumn: z.ZodString;
998
+ secondaryCategoryColumn: z.ZodOptional<z.ZodString>;
999
+ valueColumn: z.ZodString;
1000
+ title: z.ZodString;
1001
+ type: z.ZodLiteral<"bar">;
1002
+ }, z.core.$strip>, z.ZodObject<{
1003
+ xAxisColumn: z.ZodString;
1004
+ valueColumns: z.ZodArray<z.ZodString>;
1005
+ yAxisLabels: z.ZodArray<z.ZodString>;
1006
+ title: z.ZodString;
1007
+ type: z.ZodLiteral<"line/area">;
1008
+ config_version: z.ZodLiteral<2>;
1009
+ }, z.core.$strip>, z.ZodObject<{
1010
+ config_version: z.ZodLiteral<2>;
1011
+ valueColumn: z.ZodString;
1012
+ xAxisColumn: z.ZodString;
1013
+ xAxisLabel: z.ZodString;
1014
+ yAxisLabel: z.ZodString;
1015
+ categoryColumn: z.ZodString;
1016
+ title: z.ZodString;
1017
+ type: z.ZodLiteral<"line/area-categorical">;
1018
+ }, z.core.$strip>, z.ZodObject<{
1019
+ config_version: z.ZodLiteral<2>;
1020
+ xAxisLabel: z.ZodString;
1021
+ yAxisLabel: z.ZodString;
1022
+ xAxisValueColumn: z.ZodString;
1023
+ yAxisValueColumn: z.ZodString;
1024
+ title: z.ZodString;
1025
+ type: z.ZodLiteral<"scatter">;
1026
+ }, z.core.$strip>, z.ZodObject<{
1027
+ config_version: z.ZodLiteral<2>;
1028
+ categoryColumn: z.ZodString;
1029
+ valueColumn: z.ZodString;
1030
+ title: z.ZodString;
1031
+ type: z.ZodLiteral<"pie">;
1032
+ }, z.core.$strip>], "type">;
1033
+ created_at: z.ZodString;
1034
+ flow_data_id: z.ZodNumber;
1035
+ report_uuid: z.ZodString;
1036
+ flow_data: z.ZodOptional<z.ZodObject<{
1037
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
1038
+ last_materialized_at: z.ZodNullable<z.ZodString>;
1039
+ materialized_error_message: z.ZodNullable<z.ZodString>;
1040
+ materialized_status: z.ZodNullable<z.ZodEnum<{
1041
+ completed: "completed";
1042
+ failed: "failed";
1043
+ running: "running";
1044
+ }>>;
1045
+ }, z.core.$strip>>;
1046
+ materialization: z.ZodOptional<z.ZodObject<{
1047
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
1048
+ last_materialized_at: z.ZodNullable<z.ZodString>;
1049
+ materialized_error_message: z.ZodNullable<z.ZodString>;
1050
+ materialized_status: z.ZodNullable<z.ZodEnum<{
1051
+ completed: "completed";
1052
+ failed: "failed";
1053
+ running: "running";
1054
+ }>>;
1055
+ }, z.core.$strip>>;
1056
+ data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodDate, z.ZodCoercedNumber<unknown>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<"empty" | (string & {}) | null, unknown>>]>>>;
1057
+ _metadata: z.ZodOptional<z.ZodObject<{
1058
+ wasSampled: z.ZodBoolean;
1059
+ originalCount: z.ZodNumber;
1060
+ sampledCount: z.ZodNumber;
1061
+ }, z.core.$strip>>;
1062
+ }, z.core.$strip>;
1063
+
1064
+ export declare const GENERATE_DATA_REPORT: "generateDataReport";
1065
+
1066
+ export declare const GENERATE_VISUALIZATION: "generateVisualization";
1067
+
1068
+ export declare const GET_AVAILABLE_COLUMNS_FOR_TABLE: "getAvailableColumnsForTable";
1069
+
1070
+ export declare const GET_AVAILABLE_TABLES: "getAvailableTables";
1071
+
1072
+ export declare const getMessageTextContent: (message: MMChatUIMessage) => string | undefined;
1073
+
784
1074
  export declare const getPublicApiClient: (apiUrl: string, apiKey: string) => Client<PublicPaths>;
785
1075
 
1076
+ /**
1077
+ * Extracts an uploaded file id from a `uploaded-file:{id}` reference.
1078
+ * @param url the url of the file
1079
+ * @returns file id
1080
+ */
1081
+ export declare const getUploadedFileIdFromUrl: (url: string) => string | null;
1082
+
1083
+ /**
1084
+ * Returns true when a flow contains only the initial user message created via
1085
+ * `createFlow(...)` and no assistant response yet.
1086
+ *
1087
+ * In headless AI SDK integrations, this is the state where the frontend should
1088
+ * trigger a one-time `regenerate()` to start the first assistant turn.
1089
+ * @param messages - Chat messages for the flow.
1090
+ * @returns Whether the flow still has only its initial user message.
1091
+ */
1092
+ export declare const hasOnlyInitialUserMessage: (messages: MMChatUIMessage[]) => boolean;
1093
+
786
1094
  declare const HEADER_SP_TOKEN: "sp-access-token";
787
1095
 
788
1096
  declare const inputSchema: z.ZodObject<{
@@ -824,6 +1132,11 @@ declare const inputSchema_5: z.ZodObject<{}, z.core.$strip>;
824
1132
  declare const inputSchema_6: z.ZodObject<{
825
1133
  dataset: z.ZodString;
826
1134
  table_name: z.ZodString;
1135
+ includeDescriptions: z.ZodDefault<z.ZodBoolean>;
1136
+ includeDataTypes: z.ZodDefault<z.ZodBoolean>;
1137
+ includeSampleValues: z.ZodDefault<z.ZodBoolean>;
1138
+ includeStatistics: z.ZodDefault<z.ZodBoolean>;
1139
+ includeFreshness: z.ZodDefault<z.ZodBoolean>;
827
1140
  }, z.core.$strip>;
828
1141
 
829
1142
  declare const inputSchema_7: z.ZodObject<{
@@ -851,11 +1164,21 @@ declare const inputSchema_9: z.ZodObject<{
851
1164
  }, z.core.$strip>>;
852
1165
  }, z.core.$strip>;
853
1166
 
1167
+ export declare const isAskUserQuestionPart: (part: MMChatUIMessagePart) => part is AskUserQuestionPart;
1168
+
1169
+ export declare const isFrontendV1Visualization: (visualization: FrontendVisualization | V1FrontendVisualization) => visualization is V1FrontendVisualization;
1170
+
1171
+ export declare const isFrontendV1VisualizationWithData: (visualization: FrontendVisualizationWithData | V1FrontendVisualizationWithData) => visualization is V1FrontendVisualizationWithData;
1172
+
1173
+ export declare const isFrontendV2Visualization: (visualization: FrontendVisualization | V1FrontendVisualization) => visualization is FrontendVisualization;
1174
+
1175
+ export declare const isFrontendV2VisualizationWithData: (visualization: FrontendVisualizationWithData | V1FrontendVisualizationWithData) => visualization is FrontendVisualizationWithData;
1176
+
854
1177
  export declare class MageMetricsChatTransport extends DefaultChatTransport<MMChatUIMessage> {
855
1178
  constructor(apiUrl: string, flowId: string, options: MageMetricsChatTransportOptions);
856
1179
  }
857
1180
 
858
- declare type MageMetricsChatTransportOptions = Omit<HttpChatTransportInitOptions<MMChatUIMessage>, "api" | "prepareSendMessagesRequest">;
1181
+ export declare type MageMetricsChatTransportOptions = Omit<HttpChatTransportInitOptions<MMChatUIMessage>, "api" | "prepareSendMessagesRequest">;
859
1182
 
860
1183
  /**
861
1184
  * Core MageMetrics client that handles authentication lifecycle and provides
@@ -898,6 +1221,14 @@ export declare class MageMetricsClient {
898
1221
  get state(): AuthState;
899
1222
  getHeaders(): Promise<Record<string, string>>;
900
1223
  logout(): Promise<void>;
1224
+ /**
1225
+ * Clean up all resources held by this client.
1226
+ * Unsubscribes auth state listeners, stops auto-refresh timers,
1227
+ * and removes global event listeners (e.g. visibilitychange).
1228
+ *
1229
+ * Call this before discarding a client instance to prevent leaks.
1230
+ */
1231
+ destroy(): void;
901
1232
  auth: {
902
1233
  startAutoRefresh: () => Promise<void> | undefined;
903
1234
  stopAuthRefresh: () => Promise<void> | undefined;
@@ -1103,9 +1434,6 @@ export declare class MageMetricsClient {
1103
1434
  title: string | null;
1104
1435
  user_id: string | null;
1105
1436
  application_id?: number | null | undefined;
1106
- context_tokens?: number | undefined;
1107
- acc_input_tokens?: number | undefined;
1108
- acc_output_tokens?: number | undefined;
1109
1437
  }>;
1110
1438
  getRecentFlows: (params?: {
1111
1439
  limit?: number;
@@ -1134,9 +1462,6 @@ export declare class MageMetricsClient {
1134
1462
  title: string | null;
1135
1463
  user_id: string | null;
1136
1464
  application_id?: number | null | undefined;
1137
- context_tokens?: number | undefined;
1138
- acc_input_tokens?: number | undefined;
1139
- acc_output_tokens?: number | undefined;
1140
1465
  }[];
1141
1466
  }[]>;
1142
1467
  get: (canvasId: string) => Promise<{
@@ -1181,7 +1506,11 @@ export declare class MageMetricsClient {
1181
1506
  dataType: string;
1182
1507
  renderType?: string | undefined;
1183
1508
  unit?: string | undefined;
1184
- canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other" | undefined;
1509
+ canonicalDataType?: "numeric" | "boolean" | "datetime" | "date" | "text" | "array" | "json" | "other" | undefined;
1510
+ formatHint?: {
1511
+ isNumeric?: boolean | undefined;
1512
+ isLikelyYear?: boolean | undefined;
1513
+ } | undefined;
1185
1514
  }[];
1186
1515
  rowCount: {
1187
1516
  count: number;
@@ -1195,6 +1524,7 @@ export declare class MageMetricsClient {
1195
1524
  explanation: string;
1196
1525
  type: string;
1197
1526
  }[]>;
1527
+ getPromptStarters: (input?: string) => Promise<PromptStarter[]>;
1198
1528
  };
1199
1529
  client(): PublicApiClient;
1200
1530
  private createSupabaseHeaderMiddleware;
@@ -1255,7 +1585,9 @@ export declare class MemoryStorageAdapter implements AsyncStorage {
1255
1585
 
1256
1586
  export declare type MMChatUIMessage = UIMessage<unknown, CustomDataParts, MMUiTools>;
1257
1587
 
1258
- declare type MMUiTools = {
1588
+ export declare type MMChatUIMessagePart = UIMessagePart<CustomDataParts, MMUiTools>;
1589
+
1590
+ export declare type MMUiTools = {
1259
1591
  generateDataReport: UiTool;
1260
1592
  generateVisualization: UiTool_2;
1261
1593
  think: UiTool_3;
@@ -1471,6 +1803,8 @@ declare interface operations {
1471
1803
  content: {
1472
1804
  "application/json": {
1473
1805
  error: string;
1806
+ /** @enum {string} */
1807
+ code: "QUERY_LIMIT_EXCEEDED" | "QUERY_TIMEOUT" | "QUERY_EXECUTION_FAILED";
1474
1808
  };
1475
1809
  };
1476
1810
  };
@@ -1531,6 +1865,8 @@ declare interface operations {
1531
1865
  content: {
1532
1866
  "application/json": {
1533
1867
  error: string;
1868
+ /** @enum {string} */
1869
+ code: "QUERY_LIMIT_EXCEEDED" | "QUERY_TIMEOUT" | "QUERY_EXECUTION_FAILED";
1534
1870
  };
1535
1871
  };
1536
1872
  };
@@ -1592,6 +1928,7 @@ declare interface operations {
1592
1928
  query?: never;
1593
1929
  header?: never;
1594
1930
  path: {
1931
+ /** @description Numeric legacy ID or UUID */
1595
1932
  visualization_id: string;
1596
1933
  canvas_id: components["schemas"]["CanvasId"];
1597
1934
  };
@@ -1669,9 +2006,6 @@ declare interface operations {
1669
2006
  title: string | null;
1670
2007
  user_id: string | null;
1671
2008
  application_id?: number | null;
1672
- context_tokens?: number;
1673
- acc_input_tokens?: number;
1674
- acc_output_tokens?: number;
1675
2009
  };
1676
2010
  };
1677
2011
  };
@@ -1725,9 +2059,6 @@ declare interface operations {
1725
2059
  title: string | null;
1726
2060
  user_id: string | null;
1727
2061
  application_id?: number | null;
1728
- context_tokens?: number;
1729
- acc_input_tokens?: number;
1730
- acc_output_tokens?: number;
1731
2062
  }[];
1732
2063
  };
1733
2064
  };
@@ -1982,6 +2313,7 @@ declare interface operations {
1982
2313
  query?: never;
1983
2314
  header?: {
1984
2315
  "sp-access-token"?: string;
2316
+ "X-Application-Name"?: string;
1985
2317
  };
1986
2318
  path?: never;
1987
2319
  cookie?: never;
@@ -2247,6 +2579,8 @@ declare interface operations {
2247
2579
  content: {
2248
2580
  "application/json": {
2249
2581
  error: string;
2582
+ /** @enum {string} */
2583
+ code: "QUERY_LIMIT_EXCEEDED" | "QUERY_TIMEOUT" | "QUERY_EXECUTION_FAILED";
2250
2584
  };
2251
2585
  };
2252
2586
  };
@@ -2297,6 +2631,8 @@ declare interface operations {
2297
2631
  content: {
2298
2632
  "application/json": {
2299
2633
  error: string;
2634
+ /** @enum {string} */
2635
+ code: "QUERY_LIMIT_EXCEEDED" | "QUERY_TIMEOUT" | "QUERY_EXECUTION_FAILED";
2300
2636
  };
2301
2637
  };
2302
2638
  };
@@ -2405,13 +2741,6 @@ declare interface operations {
2405
2741
  "application/json": {
2406
2742
  userQuery: string;
2407
2743
  applicationName?: string;
2408
- files?: {
2409
- /** @enum {string} */
2410
- type: "file";
2411
- mediaType: string;
2412
- filename?: string;
2413
- url: string;
2414
- }[];
2415
2744
  uploadedFileIds?: string[];
2416
2745
  };
2417
2746
  };
@@ -2626,6 +2955,7 @@ declare interface operations {
2626
2955
  "sp-access-token"?: string;
2627
2956
  };
2628
2957
  path: {
2958
+ /** @description Numeric legacy ID or UUID */
2629
2959
  visualization_id: string;
2630
2960
  };
2631
2961
  cookie?: never;
@@ -3131,9 +3461,6 @@ declare interface operations {
3131
3461
  title: string | null;
3132
3462
  user_id: string | null;
3133
3463
  application_id?: number | null;
3134
- context_tokens?: number;
3135
- acc_input_tokens?: number;
3136
- acc_output_tokens?: number;
3137
3464
  }[];
3138
3465
  }[];
3139
3466
  };
@@ -3609,7 +3936,6 @@ declare interface operations {
3609
3936
  content: {
3610
3937
  "application/json": {
3611
3938
  name: string;
3612
- objective?: string;
3613
3939
  generated_objective_fragment?: string;
3614
3940
  /** @default [] */
3615
3941
  active_tools?: string[];
@@ -3772,7 +4098,6 @@ declare interface operations {
3772
4098
  content: {
3773
4099
  "application/json": {
3774
4100
  name?: string;
3775
- objective?: string | null;
3776
4101
  generated_objective_fragment?: string | null;
3777
4102
  active_tools?: string[];
3778
4103
  input_schema?: ({
@@ -5949,6 +6274,8 @@ declare interface operations {
5949
6274
  };
5950
6275
  }
5951
6276
 
6277
+ export declare const PAGINATE_DATA_REPORT: "paginateDataReport";
6278
+
5952
6279
  declare type PatchParam<T, Config extends RemoveParamsConfig, P extends keyof Config> = Simplify<T extends {
5953
6280
  [key in P]: infer H;
5954
6281
  } ? H extends Partial<Record<string, unknown>> ? Config[P] extends string ? Omit<H, Config[P]> : H : never : never>;
@@ -6793,13 +7120,36 @@ declare interface paths {
6793
7120
  };
6794
7121
  }
6795
7122
 
6796
- declare type PublicApiClient = Simplify<Client<PublicPaths, `${string}/${string}`>>;
7123
+ export declare type PromptStarter = z.infer<typeof PromptStarterSchema>;
7124
+
7125
+ declare const PromptStarterSchema: z.ZodObject<{
7126
+ id: z.ZodNumber;
7127
+ title: z.ZodString;
7128
+ template: z.ZodString;
7129
+ is_default: z.ZodBoolean;
7130
+ }, z.core.$strip>;
7131
+
7132
+ export declare type PublicApiClient = Simplify<Client<PublicPaths, `${string}/${string}`>>;
6797
7133
 
6798
7134
  declare type PublicPaths = Simplify<{
6799
7135
  [Path in keyof paths]: RemoveAuthHeader<paths[Path]>;
6800
7136
  }>;
6801
7137
 
6802
- declare type QuickActions = z.infer<typeof QuickActionsSchema>;
7138
+ export declare type QuestionInput = z.infer<typeof questionSchema>;
7139
+
7140
+ declare const questionSchema: z.ZodObject<{
7141
+ question: z.ZodString;
7142
+ header: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
7143
+ multiSelect: z.ZodBoolean;
7144
+ options: z.ZodArray<z.ZodObject<{
7145
+ label: z.ZodString;
7146
+ description: z.ZodString;
7147
+ }, z.core.$strip>>;
7148
+ }, z.core.$strip>;
7149
+
7150
+ export declare type QuickAction = QuickActions[number];
7151
+
7152
+ export declare type QuickActions = z.infer<typeof QuickActionsSchema>;
6803
7153
 
6804
7154
  declare const QuickActionsSchema: z.ZodArray<z.ZodObject<{
6805
7155
  label: z.ZodString;
@@ -6817,6 +7167,91 @@ declare const RedactedAskUserQuestionResponse: z.ZodObject<{
6817
7167
  }, z.core.$strip>], "status">;
6818
7168
  }, z.core.$strip>;
6819
7169
 
7170
+ export declare type RedactedAskUserQuestionResponseType = z.output<typeof RedactedAskUserQuestionResponse>;
7171
+
7172
+ declare const RedactedGenerateDataReportResponse: z.ZodObject<{
7173
+ tool: z.ZodDefault<z.ZodLiteral<"generateDataReport">>;
7174
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7175
+ status: z.ZodLiteral<"success">;
7176
+ public: z.ZodObject<{
7177
+ flowDataId: z.ZodNumber;
7178
+ reportId: z.ZodString;
7179
+ answer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7180
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7181
+ }, z.core.$strip>;
7182
+ }, z.core.$strip>, z.ZodObject<{
7183
+ status: z.ZodLiteral<"error">;
7184
+ category: z.ZodOptional<z.ZodEnum<{
7185
+ unknown: "unknown";
7186
+ timeout: "timeout";
7187
+ connection_error: "connection_error";
7188
+ auth_error: "auth_error";
7189
+ resource_exhausted: "resource_exhausted";
7190
+ table_not_found: "table_not_found";
7191
+ column_not_found: "column_not_found";
7192
+ schema_not_found: "schema_not_found";
7193
+ view_not_found: "view_not_found";
7194
+ function_not_found: "function_not_found";
7195
+ syntax_error: "syntax_error";
7196
+ ambiguous_column: "ambiguous_column";
7197
+ type_mismatch: "type_mismatch";
7198
+ invalid_cast: "invalid_cast";
7199
+ invalid_argument: "invalid_argument";
7200
+ division_by_zero: "division_by_zero";
7201
+ constraint_violation: "constraint_violation";
7202
+ permission_denied: "permission_denied";
7203
+ }>>;
7204
+ }, z.core.$strip>], "status">>;
7205
+ }, z.core.$strip>;
7206
+
7207
+ export declare type RedactedGenerateDataReportResponseType = z.infer<typeof RedactedGenerateDataReportResponse>;
7208
+
7209
+ declare const RedactedGenerateVisualizationResponse: z.ZodObject<{
7210
+ tool: z.ZodDefault<z.ZodLiteral<"generateVisualization">>;
7211
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7212
+ status: z.ZodLiteral<"success">;
7213
+ public: z.ZodObject<{
7214
+ flowDataId: z.ZodNumber;
7215
+ reportId: z.ZodString;
7216
+ flowDataVisualizationId: z.ZodNumber;
7217
+ visualizationId: z.ZodString;
7218
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7219
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7220
+ }, z.core.$strip>;
7221
+ }, z.core.$strip>, z.ZodObject<{
7222
+ status: z.ZodLiteral<"error">;
7223
+ message: z.ZodString;
7224
+ }, z.core.$strip>], "status">>;
7225
+ }, z.core.$strip>;
7226
+
7227
+ export declare type RedactedGenerateVisualizationResponseType = z.infer<typeof RedactedGenerateVisualizationResponse>;
7228
+
7229
+ declare const RedactedGetAvailableColumnsForTableResponse: z.ZodObject<{
7230
+ tool: z.ZodDefault<z.ZodLiteral<"getAvailableColumnsForTable">>;
7231
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7232
+ status: z.ZodLiteral<"success">;
7233
+ public: z.ZodObject<{}, z.core.$loose>;
7234
+ }, z.core.$strip>, z.ZodObject<{
7235
+ status: z.ZodLiteral<"error">;
7236
+ message: z.ZodString;
7237
+ }, z.core.$strip>], "status">>;
7238
+ }, z.core.$strip>;
7239
+
7240
+ export declare type RedactedGetAvailableColumnsForTableResponseType = z.infer<typeof RedactedGetAvailableColumnsForTableResponse>;
7241
+
7242
+ declare const RedactedGetAvailableTablesResponse: z.ZodObject<{
7243
+ tool: z.ZodDefault<z.ZodLiteral<"getAvailableTables">>;
7244
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7245
+ status: z.ZodLiteral<"success">;
7246
+ public: z.ZodObject<{}, z.core.$loose>;
7247
+ }, z.core.$strip>, z.ZodObject<{
7248
+ status: z.ZodLiteral<"error">;
7249
+ message: z.ZodString;
7250
+ }, z.core.$strip>], "status">>;
7251
+ }, z.core.$strip>;
7252
+
7253
+ export declare type RedactedGetAvailableTablesResponseType = z.output<typeof RedactedGetAvailableTablesResponse>;
7254
+
6820
7255
  declare const redactedOutputSchema: z.ZodObject<{
6821
7256
  tool: z.ZodLiteral<"generateDataReport">;
6822
7257
  result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -6948,6 +7383,24 @@ declare const redactedOutputSchema_8: z.ZodObject<{
6948
7383
  }, z.core.$strip>], "status">>;
6949
7384
  }, z.core.$strip>;
6950
7385
 
7386
+ declare const RedactedPaginateDataReportResponse: z.ZodObject<{
7387
+ tool: z.ZodDefault<z.ZodLiteral<"paginateDataReport">>;
7388
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7389
+ status: z.ZodLiteral<"success">;
7390
+ public: z.ZodObject<{
7391
+ totalRows: z.ZodNumber;
7392
+ fetchedRows: z.ZodNumber;
7393
+ offset: z.ZodNumber;
7394
+ hasMore: z.ZodBoolean;
7395
+ }, z.core.$strip>;
7396
+ }, z.core.$strip>, z.ZodObject<{
7397
+ status: z.ZodLiteral<"error">;
7398
+ message: z.ZodString;
7399
+ }, z.core.$strip>], "status">>;
7400
+ }, z.core.$strip>;
7401
+
7402
+ export declare type RedactedPaginateDataReportResponseType = z.output<typeof RedactedPaginateDataReportResponse>;
7403
+
6951
7404
  declare const RedactedThinkResponse: z.ZodObject<{
6952
7405
  tool: z.ZodDefault<z.ZodLiteral<"think">>;
6953
7406
  result: z.ZodOptional<z.ZodObject<{
@@ -6956,6 +7409,41 @@ declare const RedactedThinkResponse: z.ZodObject<{
6956
7409
  }, z.core.$strip>>;
6957
7410
  }, z.core.$strip>;
6958
7411
 
7412
+ export declare type RedactedThinkResponseType = z.output<typeof RedactedThinkResponse>;
7413
+
7414
+ declare const RedactedValueBasedColumnSearchResponse: z.ZodObject<{
7415
+ tool: z.ZodDefault<z.ZodLiteral<"valueBasedColumnSearch">>;
7416
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7417
+ status: z.ZodLiteral<"success">;
7418
+ public: z.ZodObject<{}, z.core.$loose>;
7419
+ }, z.core.$strip>, z.ZodObject<{
7420
+ status: z.ZodLiteral<"error">;
7421
+ message: z.ZodString;
7422
+ }, z.core.$strip>], "status">>;
7423
+ }, z.core.$strip>;
7424
+
7425
+ export declare type RedactedValueBasedColumnSearchResponseType = z.infer<typeof RedactedValueBasedColumnSearchResponse>;
7426
+
7427
+ declare const RedactedWebSearchToolResponse: z.ZodObject<{
7428
+ tool: z.ZodDefault<z.ZodLiteral<"search">>;
7429
+ result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
7430
+ status: z.ZodLiteral<"success">;
7431
+ public: z.ZodObject<{
7432
+ sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
7433
+ sourceType: z.ZodLiteral<"url">;
7434
+ id: z.ZodString;
7435
+ url: z.ZodString;
7436
+ title: z.ZodString;
7437
+ }, z.core.$strip>>>;
7438
+ }, z.core.$strip>;
7439
+ }, z.core.$strip>, z.ZodObject<{
7440
+ status: z.ZodLiteral<"error">;
7441
+ message: z.ZodString;
7442
+ }, z.core.$strip>], "status">>;
7443
+ }, z.core.$strip>;
7444
+
7445
+ export declare type RedactedWebSearchToolResponseType = z.infer<typeof RedactedWebSearchToolResponse>;
7446
+
6959
7447
  declare type RemoveAuthHeader<PathSchema> = Simplify<{
6960
7448
  [Method in keyof PathSchema]: RemoveParams<PathSchema[Method], ToRemove>;
6961
7449
  }>;
@@ -6978,6 +7466,8 @@ declare type RemoveParamsConfig = Simplify<{
6978
7466
  cookie?: string;
6979
7467
  }>;
6980
7468
 
7469
+ export declare type ReportData = z.infer<typeof ReportDataSchema>;
7470
+
6981
7471
  declare type ReportDataFilters = {
6982
7472
  columns?: string[];
6983
7473
  limit: number;
@@ -6986,7 +7476,18 @@ declare type ReportDataFilters = {
6986
7476
  cursor?: number;
6987
7477
  };
6988
7478
 
6989
- declare type SignalWithReportId = z.infer<typeof SignalWithReportIdSchema>;
7479
+ declare const ReportDataSchema: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
7480
+
7481
+ export declare type Signal = z.infer<typeof SignalSchema>;
7482
+
7483
+ declare const SignalSchema: z.ZodObject<{
7484
+ rule: z.ZodString;
7485
+ metric: z.ZodString;
7486
+ trigger: z.ZodString;
7487
+ implementation: z.ZodString;
7488
+ }, z.core.$strip>;
7489
+
7490
+ export declare type SignalWithReportId = z.infer<typeof SignalWithReportIdSchema>;
6990
7491
 
6991
7492
  declare const SignalWithReportIdSchema: z.ZodObject<{
6992
7493
  rule: z.ZodString;
@@ -6996,11 +7497,34 @@ declare const SignalWithReportIdSchema: z.ZodObject<{
6996
7497
  reportId: z.ZodNumber;
6997
7498
  }, z.core.$strip>;
6998
7499
 
6999
- declare type SortingState = ColumnSort[];
7500
+ export declare type SortingState = ColumnSort[];
7000
7501
 
7001
- declare type TableFilters = Record<string, TableFilterValue>;
7502
+ export declare const SqlErrorCategory: z.ZodEnum<{
7503
+ unknown: "unknown";
7504
+ timeout: "timeout";
7505
+ connection_error: "connection_error";
7506
+ auth_error: "auth_error";
7507
+ resource_exhausted: "resource_exhausted";
7508
+ table_not_found: "table_not_found";
7509
+ column_not_found: "column_not_found";
7510
+ schema_not_found: "schema_not_found";
7511
+ view_not_found: "view_not_found";
7512
+ function_not_found: "function_not_found";
7513
+ syntax_error: "syntax_error";
7514
+ ambiguous_column: "ambiguous_column";
7515
+ type_mismatch: "type_mismatch";
7516
+ invalid_cast: "invalid_cast";
7517
+ invalid_argument: "invalid_argument";
7518
+ division_by_zero: "division_by_zero";
7519
+ constraint_violation: "constraint_violation";
7520
+ permission_denied: "permission_denied";
7521
+ }>;
7522
+
7523
+ export declare type SqlErrorCategory = z.infer<typeof SqlErrorCategory>;
7524
+
7525
+ export declare type TableFilters = Record<string, TableFilterValue>;
7002
7526
 
7003
- declare type TableFilterValue = z.infer<typeof TableFilterValueSchema>;
7527
+ export declare type TableFilterValue = z.infer<typeof TableFilterValueSchema>;
7004
7528
 
7005
7529
  declare const TableFilterValueSchema: z.ZodObject<{
7006
7530
  operator: z.ZodEnum<{
@@ -7019,6 +7543,8 @@ declare const TableFilterValueSchema: z.ZodObject<{
7019
7543
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
7020
7544
  }, z.core.$strip>;
7021
7545
 
7546
+ export declare const THINK: "think";
7547
+
7022
7548
  /**
7023
7549
  * Token storage keys
7024
7550
  */
@@ -7028,6 +7554,25 @@ declare type ToRemove = {
7028
7554
  header: typeof HEADER_SP_TOKEN;
7029
7555
  };
7030
7556
 
7557
+ export declare const toSearchParams: ({ cursor, filters, sorting, limit, }: {
7558
+ cursor?: number;
7559
+ filters?: TableFilters;
7560
+ sorting?: SortingState;
7561
+ limit?: number;
7562
+ }) => {
7563
+ limit?: number;
7564
+ cursor?: number;
7565
+ order?: string;
7566
+ filter?: string;
7567
+ };
7568
+
7569
+ /**
7570
+ * Builds a `uploaded-file:{id}` reference string.
7571
+ * @param uploadedFileId the id of the file
7572
+ * @returns a prefixed handler
7573
+ */
7574
+ export declare const toUploadedFileRefUrl: (uploadedFileId: string) => string;
7575
+
7031
7576
  declare type UiTool = InferUITool<Tool<z.infer<typeof inputSchema>, z.infer<typeof redactedOutputSchema>>>;
7032
7577
 
7033
7578
  declare type UiTool_10 = InferUITool<Tool<z.infer<typeof inputSchema_10>, z.infer<typeof redactedOutputSchema_8>>>;
@@ -7056,9 +7601,166 @@ declare const UpdateCanvasSchema: z.ZodObject<{
7056
7601
  is_public: z.ZodOptional<z.ZodBoolean>;
7057
7602
  }, z.core.$strip>;
7058
7603
 
7604
+ /** Prefix used by new clients to reference a file uploaded separately from chat JSON. */
7605
+ export declare const UPLOADED_FILE_REF_PREFIX = "uploaded-file:";
7606
+
7607
+ /** Response payload returned when a file is uploaded successfully. */
7608
+ export declare type UploadedFile = {
7609
+ uploadedFileId: string;
7610
+ filename: string;
7611
+ mediaType: string;
7612
+ sizeBytes: number;
7613
+ };
7614
+
7059
7615
  /** A previously uploaded file identifier to attach to the first message of a flow. */
7060
- declare type UploadedFileId = default_2.infer<typeof UploadedFileIdSchema>;
7616
+ export declare type UploadedFileId = default_2.infer<typeof UploadedFileIdSchema>;
7061
7617
 
7062
7618
  declare const UploadedFileIdSchema: z.ZodUUID;
7063
7619
 
7620
+ export declare type V1FrontendVisualization = z.output<typeof V1FrontendVisualizationSchema>;
7621
+
7622
+ declare const V1FrontendVisualizationSchema: z.ZodObject<{
7623
+ id: z.ZodNumber;
7624
+ uuid: z.ZodString;
7625
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
7626
+ xAxisLabel: z.ZodString;
7627
+ yAxisLabel: z.ZodString;
7628
+ xAxisDataKey: z.ZodOptional<z.ZodString>;
7629
+ yAxisDataKey: z.ZodOptional<z.ZodString>;
7630
+ dimensionDataKey: z.ZodOptional<z.ZodString>;
7631
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
7632
+ title: z.ZodString;
7633
+ type: z.ZodLiteral<"bar">;
7634
+ }, z.core.$strip>, z.ZodObject<{
7635
+ xAxisLabel: z.ZodString;
7636
+ yAxisLabel: z.ZodString;
7637
+ xAxisDataKey: z.ZodOptional<z.ZodString>;
7638
+ yAxisDataKey: z.ZodOptional<z.ZodString>;
7639
+ dimensionDataKey: z.ZodOptional<z.ZodString>;
7640
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
7641
+ title: z.ZodString;
7642
+ type: z.ZodLiteral<"line/area">;
7643
+ }, z.core.$strip>, z.ZodObject<{
7644
+ xAxisLabel: z.ZodString;
7645
+ yAxisLabel: z.ZodString;
7646
+ xAxisDataKey: z.ZodOptional<z.ZodString>;
7647
+ yAxisDataKey: z.ZodOptional<z.ZodString>;
7648
+ dimensionDataKey: z.ZodOptional<z.ZodString>;
7649
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
7650
+ title: z.ZodString;
7651
+ type: z.ZodLiteral<"scatter">;
7652
+ }, z.core.$strip>, z.ZodObject<{
7653
+ nameKey: z.ZodString;
7654
+ dataKey: z.ZodString;
7655
+ title: z.ZodString;
7656
+ type: z.ZodLiteral<"pie">;
7657
+ }, z.core.$strip>], "type">;
7658
+ created_at: z.ZodString;
7659
+ flow_data_id: z.ZodNumber;
7660
+ report_uuid: z.ZodString;
7661
+ flow_data: z.ZodOptional<z.ZodObject<{
7662
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
7663
+ last_materialized_at: z.ZodNullable<z.ZodString>;
7664
+ materialized_error_message: z.ZodNullable<z.ZodString>;
7665
+ materialized_status: z.ZodNullable<z.ZodEnum<{
7666
+ completed: "completed";
7667
+ failed: "failed";
7668
+ running: "running";
7669
+ }>>;
7670
+ }, z.core.$strip>>;
7671
+ materialization: z.ZodOptional<z.ZodObject<{
7672
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
7673
+ last_materialized_at: z.ZodNullable<z.ZodString>;
7674
+ materialized_error_message: z.ZodNullable<z.ZodString>;
7675
+ materialized_status: z.ZodNullable<z.ZodEnum<{
7676
+ completed: "completed";
7677
+ failed: "failed";
7678
+ running: "running";
7679
+ }>>;
7680
+ }, z.core.$strip>>;
7681
+ }, z.core.$strip>;
7682
+
7683
+ export declare type V1FrontendVisualizationWithData = z.output<typeof V1FrontendVisualizationWithDataSchema>;
7684
+
7685
+ declare const V1FrontendVisualizationWithDataSchema: z.ZodObject<{
7686
+ id: z.ZodNumber;
7687
+ uuid: z.ZodString;
7688
+ configuration: z.ZodDiscriminatedUnion<[z.ZodObject<{
7689
+ xAxisLabel: z.ZodString;
7690
+ yAxisLabel: z.ZodString;
7691
+ xAxisDataKey: z.ZodOptional<z.ZodString>;
7692
+ yAxisDataKey: z.ZodOptional<z.ZodString>;
7693
+ dimensionDataKey: z.ZodOptional<z.ZodString>;
7694
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
7695
+ title: z.ZodString;
7696
+ type: z.ZodLiteral<"bar">;
7697
+ }, z.core.$strip>, z.ZodObject<{
7698
+ xAxisLabel: z.ZodString;
7699
+ yAxisLabel: z.ZodString;
7700
+ xAxisDataKey: z.ZodOptional<z.ZodString>;
7701
+ yAxisDataKey: z.ZodOptional<z.ZodString>;
7702
+ dimensionDataKey: z.ZodOptional<z.ZodString>;
7703
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
7704
+ title: z.ZodString;
7705
+ type: z.ZodLiteral<"line/area">;
7706
+ }, z.core.$strip>, z.ZodObject<{
7707
+ xAxisLabel: z.ZodString;
7708
+ yAxisLabel: z.ZodString;
7709
+ xAxisDataKey: z.ZodOptional<z.ZodString>;
7710
+ yAxisDataKey: z.ZodOptional<z.ZodString>;
7711
+ dimensionDataKey: z.ZodOptional<z.ZodString>;
7712
+ valueColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
7713
+ title: z.ZodString;
7714
+ type: z.ZodLiteral<"scatter">;
7715
+ }, z.core.$strip>, z.ZodObject<{
7716
+ nameKey: z.ZodString;
7717
+ dataKey: z.ZodString;
7718
+ title: z.ZodString;
7719
+ type: z.ZodLiteral<"pie">;
7720
+ }, z.core.$strip>], "type">;
7721
+ created_at: z.ZodString;
7722
+ flow_data_id: z.ZodNumber;
7723
+ report_uuid: z.ZodString;
7724
+ flow_data: z.ZodOptional<z.ZodObject<{
7725
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
7726
+ last_materialized_at: z.ZodNullable<z.ZodString>;
7727
+ materialized_error_message: z.ZodNullable<z.ZodString>;
7728
+ materialized_status: z.ZodNullable<z.ZodEnum<{
7729
+ completed: "completed";
7730
+ failed: "failed";
7731
+ running: "running";
7732
+ }>>;
7733
+ }, z.core.$strip>>;
7734
+ materialization: z.ZodOptional<z.ZodObject<{
7735
+ is_materialized: z.ZodNullable<z.ZodBoolean>;
7736
+ last_materialized_at: z.ZodNullable<z.ZodString>;
7737
+ materialized_error_message: z.ZodNullable<z.ZodString>;
7738
+ materialized_status: z.ZodNullable<z.ZodEnum<{
7739
+ completed: "completed";
7740
+ failed: "failed";
7741
+ running: "running";
7742
+ }>>;
7743
+ }, z.core.$strip>>;
7744
+ data: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodDate, z.ZodCoercedNumber<unknown>, z.ZodPipe<z.ZodUnknown, z.ZodTransform<"empty" | (string & {}) | null, unknown>>]>>>;
7745
+ _metadata: z.ZodOptional<z.ZodObject<{
7746
+ wasSampled: z.ZodBoolean;
7747
+ originalCount: z.ZodNumber;
7748
+ sampledCount: z.ZodNumber;
7749
+ }, z.core.$strip>>;
7750
+ }, z.core.$strip>;
7751
+
7752
+ /**
7753
+ * Validates that an array of uploaded files does not exceed the count or
7754
+ * combined-size limits. The function accepts any object with `size_bytes` so
7755
+ * callers don't need to import Supabase-specific row types.
7756
+ * @param uploadedFiles - The files to validate.
7757
+ */
7758
+ export declare const validateUploadedFiles: (uploadedFiles: ReadonlyArray<{
7759
+ size_bytes: number;
7760
+ }>) => void;
7761
+
7762
+ export declare const VALUE_BASED_COLUMN_SEARCH: "valueBasedColumnSearch";
7763
+
7764
+ export declare const WEB_SEARCH: "webSearch";
7765
+
7064
7766
  export { }