@magemetrics/core 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +58 -256
- package/dist/index.js +88 -218
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { z } from 'zod';
|
|
|
14
14
|
|
|
15
15
|
export declare const ASK_USER_QUESTION: "askUserQuestion";
|
|
16
16
|
|
|
17
|
-
export declare type AskUserQuestionInput = z.infer<typeof
|
|
17
|
+
export declare type AskUserQuestionInput = z.infer<typeof inputSchema_5>;
|
|
18
18
|
|
|
19
19
|
export declare type AskUserQuestionPart = Extract<MMChatUIMessagePart, {
|
|
20
20
|
type: `tool-${typeof ASK_USER_QUESTION}`;
|
|
@@ -146,6 +146,7 @@ export declare type CanonicalDataType = z.infer<typeof CanonicalDataTypeSchema>;
|
|
|
146
146
|
|
|
147
147
|
declare const CanonicalDataTypeSchema: z.ZodEnum<{
|
|
148
148
|
boolean: "boolean";
|
|
149
|
+
date: "date";
|
|
149
150
|
array: "array";
|
|
150
151
|
text: "text";
|
|
151
152
|
json: "json";
|
|
@@ -184,6 +185,8 @@ export declare interface ColumnSort {
|
|
|
184
185
|
|
|
185
186
|
declare interface components {
|
|
186
187
|
schemas: {
|
|
188
|
+
/** Format: uuid */
|
|
189
|
+
CanvasId: string;
|
|
187
190
|
ReportColumns: {
|
|
188
191
|
name: string;
|
|
189
192
|
data_type: string;
|
|
@@ -191,14 +194,12 @@ declare interface components {
|
|
|
191
194
|
renderType?: string;
|
|
192
195
|
unit?: string;
|
|
193
196
|
/** @enum {string} */
|
|
194
|
-
canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other";
|
|
197
|
+
canonicalDataType?: "numeric" | "boolean" | "datetime" | "date" | "text" | "array" | "json" | "other";
|
|
195
198
|
formatHint?: {
|
|
196
199
|
isNumeric?: boolean;
|
|
197
200
|
isLikelyYear?: boolean;
|
|
198
201
|
};
|
|
199
202
|
}[];
|
|
200
|
-
/** Format: uuid */
|
|
201
|
-
CanvasId: string;
|
|
202
203
|
ReportData: {
|
|
203
204
|
[key: string]: unknown;
|
|
204
205
|
}[];
|
|
@@ -366,9 +367,6 @@ declare interface components {
|
|
|
366
367
|
sampledCount: number;
|
|
367
368
|
};
|
|
368
369
|
};
|
|
369
|
-
VisualizationData: {
|
|
370
|
-
[key: string]: string | (number | null) | unknown | null;
|
|
371
|
-
}[];
|
|
372
370
|
/** @description Prompt starter template */
|
|
373
371
|
PromptStarter: {
|
|
374
372
|
id: number;
|
|
@@ -445,36 +443,11 @@ declare interface components {
|
|
|
445
443
|
};
|
|
446
444
|
execution_context?: components["schemas"]["ExecutionContextInput"];
|
|
447
445
|
};
|
|
448
|
-
ExecutionContextInput: components["schemas"]["ImpersonateContext"] | components["schemas"]["CustomMetadataContext"];
|
|
449
|
-
ImpersonateContext: {
|
|
450
|
-
/**
|
|
451
|
-
* @description discriminator enum property added by openapi-typescript
|
|
452
|
-
* @enum {string}
|
|
453
|
-
*/
|
|
454
|
-
mode: "impersonate";
|
|
455
|
-
/** @description The user ID in the customer's system */
|
|
456
|
-
external_user_id: string;
|
|
457
|
-
};
|
|
458
|
-
CustomMetadataContext: {
|
|
459
|
-
/**
|
|
460
|
-
* @description discriminator enum property added by openapi-typescript
|
|
461
|
-
* @enum {string}
|
|
462
|
-
*/
|
|
463
|
-
mode: "custom";
|
|
464
|
-
/** @description Raw metadata key-value pairs for data access rules */
|
|
465
|
-
metadata: {
|
|
466
|
-
[key: string]: unknown;
|
|
467
|
-
};
|
|
468
|
-
};
|
|
469
|
-
AgentRunCountsResponse: {
|
|
470
|
-
[key: string]: number;
|
|
471
|
-
};
|
|
472
446
|
Agent: {
|
|
473
447
|
/** Format: uuid */
|
|
474
448
|
id: string;
|
|
475
449
|
created_at: string;
|
|
476
450
|
name: string;
|
|
477
|
-
objective: string | null;
|
|
478
451
|
generated_objective_fragment: string | null;
|
|
479
452
|
active_tools: string[] | null;
|
|
480
453
|
input_schema: ({
|
|
@@ -536,13 +509,13 @@ declare interface components {
|
|
|
536
509
|
/** @enum {string} */
|
|
537
510
|
execution_platform: "native" | "sandbox" | "sandbox_public";
|
|
538
511
|
updated_at: string;
|
|
512
|
+
version_count: number;
|
|
539
513
|
};
|
|
540
514
|
AgentVersion: {
|
|
541
515
|
/** Format: uuid */
|
|
542
516
|
id: string;
|
|
543
517
|
version: number;
|
|
544
518
|
name: string;
|
|
545
|
-
objective: string | null;
|
|
546
519
|
generated_objective_fragment: string | null;
|
|
547
520
|
active_tools: string[] | null;
|
|
548
521
|
input_schema: ({
|
|
@@ -606,70 +579,36 @@ declare interface components {
|
|
|
606
579
|
restored_from_version?: number | null;
|
|
607
580
|
created_at: string;
|
|
608
581
|
};
|
|
609
|
-
|
|
610
|
-
content: string;
|
|
611
|
-
/** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
|
|
612
|
-
client_reference_id?: string;
|
|
613
|
-
/** @default true */
|
|
614
|
-
is_active: boolean;
|
|
615
|
-
tags?: string[];
|
|
616
|
-
/** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
|
|
617
|
-
application_ids?: number[];
|
|
618
|
-
/** @enum {string} */
|
|
619
|
-
type: "global";
|
|
620
|
-
};
|
|
621
|
-
CreateSchemaKnowledgeItem: {
|
|
622
|
-
content: string;
|
|
623
|
-
/** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
|
|
624
|
-
client_reference_id?: string;
|
|
625
|
-
/** @default true */
|
|
626
|
-
is_active: boolean;
|
|
627
|
-
tags?: string[];
|
|
628
|
-
/** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
|
|
629
|
-
application_ids?: number[];
|
|
630
|
-
/** @enum {string} */
|
|
631
|
-
type: "schema";
|
|
632
|
-
path: components["schemas"]["SchemaPath"];
|
|
633
|
-
};
|
|
634
|
-
SchemaPath: {
|
|
635
|
-
/** @description Schema or dataset name in the source database */
|
|
636
|
-
dataset: string;
|
|
637
|
-
/** @description Table name in the source database */
|
|
638
|
-
table_name: string;
|
|
639
|
-
/** @description Column name (optional). Omit for table-level items, include for column-level items. */
|
|
640
|
-
column_name?: string;
|
|
641
|
-
};
|
|
642
|
-
UpsertGlobalKnowledgeItem: {
|
|
643
|
-
content: string;
|
|
644
|
-
/** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
|
|
645
|
-
client_reference_id: string;
|
|
646
|
-
/** @default true */
|
|
647
|
-
is_active: boolean;
|
|
648
|
-
tags?: string[];
|
|
649
|
-
/** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
|
|
650
|
-
application_ids?: number[];
|
|
651
|
-
/** @enum {string} */
|
|
652
|
-
type: "global";
|
|
653
|
-
};
|
|
654
|
-
UpsertSchemaKnowledgeItem: {
|
|
655
|
-
content: string;
|
|
656
|
-
/** @description Stable, client-defined identifier from your system.Use it to look up, update, or upsert the item without tracking Magemetrics internal IDs. */
|
|
657
|
-
client_reference_id: string;
|
|
658
|
-
/** @default true */
|
|
659
|
-
is_active: boolean;
|
|
660
|
-
tags?: string[];
|
|
661
|
-
/** @description IDs of applications this item is scoped to. Empty or omitted means all applications. */
|
|
662
|
-
application_ids?: number[];
|
|
663
|
-
/** @enum {string} */
|
|
664
|
-
type: "schema";
|
|
665
|
-
path: components["schemas"]["SchemaPath"];
|
|
666
|
-
};
|
|
582
|
+
ExecutionContextInput: components["schemas"]["ImpersonateContext"] | components["schemas"]["CustomMetadataContext"];
|
|
667
583
|
StatisticsResponse: {
|
|
668
584
|
/** @description The time period in days for these statistics */
|
|
669
585
|
period_days: number;
|
|
670
586
|
user_generated: components["schemas"]["UserGeneratedStatistics"];
|
|
671
587
|
agent_generated: components["schemas"]["AgentGeneratedStatistics"];
|
|
672
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
|
+
};
|
|
673
612
|
/** @description Statistics for user-generated content (conversations, reports, visualizations) */
|
|
674
613
|
UserGeneratedStatistics: {
|
|
675
614
|
/** @description Number of user-created conversations */
|
|
@@ -770,6 +709,8 @@ export declare class DirectAuthProvider implements AuthProvider {
|
|
|
770
709
|
private setState;
|
|
771
710
|
}
|
|
772
711
|
|
|
712
|
+
export declare const EXPLORE_SCHEMA: "exploreSchema";
|
|
713
|
+
|
|
773
714
|
/**
|
|
774
715
|
* External authentication provider that handles the full token exchange flow.
|
|
775
716
|
*
|
|
@@ -867,6 +808,7 @@ declare const FrontendReportColumnsSchema: z.ZodArray<z.ZodObject<{
|
|
|
867
808
|
unit: z.ZodOptional<z.ZodString>;
|
|
868
809
|
canonicalDataType: z.ZodOptional<z.ZodEnum<{
|
|
869
810
|
boolean: "boolean";
|
|
811
|
+
date: "date";
|
|
870
812
|
array: "array";
|
|
871
813
|
text: "text";
|
|
872
814
|
json: "json";
|
|
@@ -1125,10 +1067,6 @@ export declare const GENERATE_DATA_REPORT: "generateDataReport";
|
|
|
1125
1067
|
|
|
1126
1068
|
export declare const GENERATE_VISUALIZATION: "generateVisualization";
|
|
1127
1069
|
|
|
1128
|
-
export declare const GET_AVAILABLE_COLUMNS_FOR_TABLE: "getAvailableColumnsForTable";
|
|
1129
|
-
|
|
1130
|
-
export declare const GET_AVAILABLE_TABLES: "getAvailableTables";
|
|
1131
|
-
|
|
1132
1070
|
export declare const getMessageTextContent: (message: MMChatUIMessage) => string | undefined;
|
|
1133
1071
|
|
|
1134
1072
|
export declare const getPublicApiClient: (apiUrl: string, apiKey: string) => Client<PublicPaths>;
|
|
@@ -1164,10 +1102,6 @@ declare const inputSchema: z.ZodObject<{
|
|
|
1164
1102
|
}>;
|
|
1165
1103
|
}, z.core.$strip>;
|
|
1166
1104
|
|
|
1167
|
-
declare const inputSchema_10: z.ZodObject<{
|
|
1168
|
-
question: z.ZodString;
|
|
1169
|
-
}, z.core.$strip>;
|
|
1170
|
-
|
|
1171
1105
|
declare const inputSchema_2: z.ZodObject<{
|
|
1172
1106
|
reportId: z.ZodUnion<[z.ZodNumber, z.ZodUUID]>;
|
|
1173
1107
|
chartType: z.ZodEnum<{
|
|
@@ -1184,30 +1118,12 @@ declare const inputSchema_3: z.ZodObject<{
|
|
|
1184
1118
|
}, z.core.$strip>;
|
|
1185
1119
|
|
|
1186
1120
|
declare const inputSchema_4: z.ZodObject<{
|
|
1187
|
-
value: z.ZodString;
|
|
1188
|
-
}, z.core.$strip>;
|
|
1189
|
-
|
|
1190
|
-
declare const inputSchema_5: z.ZodObject<{}, z.core.$strip>;
|
|
1191
|
-
|
|
1192
|
-
declare const inputSchema_6: z.ZodObject<{
|
|
1193
|
-
dataset: z.ZodString;
|
|
1194
|
-
table_name: z.ZodString;
|
|
1195
|
-
}, z.core.$strip>;
|
|
1196
|
-
|
|
1197
|
-
declare const inputSchema_7: z.ZodObject<{
|
|
1198
|
-
reportId: z.ZodNumber;
|
|
1199
|
-
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
1200
|
-
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
1201
|
-
skipSampleRows: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1202
|
-
}, z.core.$strip>;
|
|
1203
|
-
|
|
1204
|
-
declare const inputSchema_8: z.ZodObject<{
|
|
1205
1121
|
query: z.ZodString;
|
|
1206
1122
|
fromDate: z.ZodOptional<z.ZodISODate>;
|
|
1207
1123
|
toDate: z.ZodOptional<z.ZodISODate>;
|
|
1208
1124
|
}, z.core.$strip>;
|
|
1209
1125
|
|
|
1210
|
-
declare const
|
|
1126
|
+
declare const inputSchema_5: z.ZodObject<{
|
|
1211
1127
|
questions: z.ZodArray<z.ZodObject<{
|
|
1212
1128
|
question: z.ZodString;
|
|
1213
1129
|
header: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -1219,6 +1135,10 @@ declare const inputSchema_9: z.ZodObject<{
|
|
|
1219
1135
|
}, z.core.$strip>>;
|
|
1220
1136
|
}, z.core.$strip>;
|
|
1221
1137
|
|
|
1138
|
+
declare const inputSchema_6: z.ZodObject<{
|
|
1139
|
+
question: z.ZodString;
|
|
1140
|
+
}, z.core.$strip>;
|
|
1141
|
+
|
|
1222
1142
|
export declare const isAskUserQuestionPart: (part: MMChatUIMessagePart) => part is AskUserQuestionPart;
|
|
1223
1143
|
|
|
1224
1144
|
export declare const isFrontendV1Visualization: (visualization: FrontendVisualization | V1FrontendVisualization) => visualization is V1FrontendVisualization;
|
|
@@ -1561,7 +1481,7 @@ export declare class MageMetricsClient {
|
|
|
1561
1481
|
dataType: string;
|
|
1562
1482
|
renderType?: string | undefined;
|
|
1563
1483
|
unit?: string | undefined;
|
|
1564
|
-
canonicalDataType?: "numeric" | "boolean" | "datetime" | "text" | "array" | "json" | "other" | undefined;
|
|
1484
|
+
canonicalDataType?: "numeric" | "boolean" | "datetime" | "date" | "text" | "array" | "json" | "other" | undefined;
|
|
1565
1485
|
formatHint?: {
|
|
1566
1486
|
isNumeric?: boolean | undefined;
|
|
1567
1487
|
isLikelyYear?: boolean | undefined;
|
|
@@ -1646,13 +1566,9 @@ export declare type MMUiTools = {
|
|
|
1646
1566
|
generateDataReport: UiTool;
|
|
1647
1567
|
generateVisualization: UiTool_2;
|
|
1648
1568
|
think: UiTool_3;
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
paginateDataReport: UiTool_7;
|
|
1653
|
-
webSearch: UiTool_8;
|
|
1654
|
-
askUserQuestion: UiTool_9;
|
|
1655
|
-
exploreSchema: UiTool_10;
|
|
1569
|
+
webSearch: UiTool_4;
|
|
1570
|
+
askUserQuestion: UiTool_5;
|
|
1571
|
+
exploreSchema: UiTool_6;
|
|
1656
1572
|
};
|
|
1657
1573
|
|
|
1658
1574
|
declare interface operations {
|
|
@@ -2796,13 +2712,6 @@ declare interface operations {
|
|
|
2796
2712
|
"application/json": {
|
|
2797
2713
|
userQuery: string;
|
|
2798
2714
|
applicationName?: string;
|
|
2799
|
-
files?: {
|
|
2800
|
-
/** @enum {string} */
|
|
2801
|
-
type: "file";
|
|
2802
|
-
mediaType: string;
|
|
2803
|
-
filename?: string;
|
|
2804
|
-
url: string;
|
|
2805
|
-
}[];
|
|
2806
2715
|
uploadedFileIds?: string[];
|
|
2807
2716
|
};
|
|
2808
2717
|
};
|
|
@@ -3998,7 +3907,6 @@ declare interface operations {
|
|
|
3998
3907
|
content: {
|
|
3999
3908
|
"application/json": {
|
|
4000
3909
|
name: string;
|
|
4001
|
-
objective?: string;
|
|
4002
3910
|
generated_objective_fragment?: string;
|
|
4003
3911
|
/** @default [] */
|
|
4004
3912
|
active_tools?: string[];
|
|
@@ -4161,7 +4069,6 @@ declare interface operations {
|
|
|
4161
4069
|
content: {
|
|
4162
4070
|
"application/json": {
|
|
4163
4071
|
name?: string;
|
|
4164
|
-
objective?: string | null;
|
|
4165
4072
|
generated_objective_fragment?: string | null;
|
|
4166
4073
|
active_tools?: string[];
|
|
4167
4074
|
input_schema?: ({
|
|
@@ -6338,8 +6245,6 @@ declare interface operations {
|
|
|
6338
6245
|
};
|
|
6339
6246
|
}
|
|
6340
6247
|
|
|
6341
|
-
export declare const PAGINATE_DATA_REPORT: "paginateDataReport";
|
|
6342
|
-
|
|
6343
6248
|
declare type PatchParam<T, Config extends RemoveParamsConfig, P extends keyof Config> = Simplify<T extends {
|
|
6344
6249
|
[key in P]: infer H;
|
|
6345
6250
|
} ? H extends Partial<Record<string, unknown>> ? Config[P] extends string ? Omit<H, Config[P]> : H : never : never>;
|
|
@@ -7233,6 +7138,19 @@ declare const RedactedAskUserQuestionResponse: z.ZodObject<{
|
|
|
7233
7138
|
|
|
7234
7139
|
export declare type RedactedAskUserQuestionResponseType = z.output<typeof RedactedAskUserQuestionResponse>;
|
|
7235
7140
|
|
|
7141
|
+
declare const RedactedExploreSchemaResponse: z.ZodObject<{
|
|
7142
|
+
tool: z.ZodDefault<z.ZodLiteral<"exploreSchema">>;
|
|
7143
|
+
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7144
|
+
status: z.ZodLiteral<"success">;
|
|
7145
|
+
public: z.ZodObject<{}, z.core.$loose>;
|
|
7146
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
7147
|
+
status: z.ZodLiteral<"error">;
|
|
7148
|
+
message: z.ZodString;
|
|
7149
|
+
}, z.core.$strip>], "status">>;
|
|
7150
|
+
}, z.core.$strip>;
|
|
7151
|
+
|
|
7152
|
+
export declare type RedactedExploreSchemaResponseType = z.output<typeof RedactedExploreSchemaResponse>;
|
|
7153
|
+
|
|
7236
7154
|
declare const RedactedGenerateDataReportResponse: z.ZodObject<{
|
|
7237
7155
|
tool: z.ZodDefault<z.ZodLiteral<"generateDataReport">>;
|
|
7238
7156
|
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7290,32 +7208,6 @@ declare const RedactedGenerateVisualizationResponse: z.ZodObject<{
|
|
|
7290
7208
|
|
|
7291
7209
|
export declare type RedactedGenerateVisualizationResponseType = z.infer<typeof RedactedGenerateVisualizationResponse>;
|
|
7292
7210
|
|
|
7293
|
-
declare const RedactedGetAvailableColumnsForTableResponse: z.ZodObject<{
|
|
7294
|
-
tool: z.ZodDefault<z.ZodLiteral<"getAvailableColumnsForTable">>;
|
|
7295
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7296
|
-
status: z.ZodLiteral<"success">;
|
|
7297
|
-
public: z.ZodObject<{}, z.core.$loose>;
|
|
7298
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7299
|
-
status: z.ZodLiteral<"error">;
|
|
7300
|
-
message: z.ZodString;
|
|
7301
|
-
}, z.core.$strip>], "status">>;
|
|
7302
|
-
}, z.core.$strip>;
|
|
7303
|
-
|
|
7304
|
-
export declare type RedactedGetAvailableColumnsForTableResponseType = z.infer<typeof RedactedGetAvailableColumnsForTableResponse>;
|
|
7305
|
-
|
|
7306
|
-
declare const RedactedGetAvailableTablesResponse: z.ZodObject<{
|
|
7307
|
-
tool: z.ZodDefault<z.ZodLiteral<"getAvailableTables">>;
|
|
7308
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7309
|
-
status: z.ZodLiteral<"success">;
|
|
7310
|
-
public: z.ZodObject<{}, z.core.$loose>;
|
|
7311
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7312
|
-
status: z.ZodLiteral<"error">;
|
|
7313
|
-
message: z.ZodString;
|
|
7314
|
-
}, z.core.$strip>], "status">>;
|
|
7315
|
-
}, z.core.$strip>;
|
|
7316
|
-
|
|
7317
|
-
export declare type RedactedGetAvailableTablesResponseType = z.output<typeof RedactedGetAvailableTablesResponse>;
|
|
7318
|
-
|
|
7319
7211
|
declare const redactedOutputSchema: z.ZodObject<{
|
|
7320
7212
|
tool: z.ZodLiteral<"generateDataReport">;
|
|
7321
7213
|
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7370,55 +7262,6 @@ declare const redactedOutputSchema_2: z.ZodObject<{
|
|
|
7370
7262
|
}, z.core.$strip>;
|
|
7371
7263
|
|
|
7372
7264
|
declare const redactedOutputSchema_3: z.ZodObject<{
|
|
7373
|
-
tool: z.ZodLiteral<"valueBasedColumnSearch">;
|
|
7374
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7375
|
-
status: z.ZodLiteral<"success">;
|
|
7376
|
-
public: z.ZodObject<{}, z.core.$loose>;
|
|
7377
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7378
|
-
status: z.ZodLiteral<"error">;
|
|
7379
|
-
message: z.ZodString;
|
|
7380
|
-
}, z.core.$strip>], "status">>;
|
|
7381
|
-
}, z.core.$strip>;
|
|
7382
|
-
|
|
7383
|
-
declare const redactedOutputSchema_4: z.ZodObject<{
|
|
7384
|
-
tool: z.ZodLiteral<"getAvailableTables">;
|
|
7385
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7386
|
-
status: z.ZodLiteral<"success">;
|
|
7387
|
-
public: z.ZodObject<{}, z.core.$loose>;
|
|
7388
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7389
|
-
status: z.ZodLiteral<"error">;
|
|
7390
|
-
message: z.ZodString;
|
|
7391
|
-
}, z.core.$strip>], "status">>;
|
|
7392
|
-
}, z.core.$strip>;
|
|
7393
|
-
|
|
7394
|
-
declare const redactedOutputSchema_5: z.ZodObject<{
|
|
7395
|
-
tool: z.ZodLiteral<"getAvailableColumnsForTable">;
|
|
7396
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7397
|
-
status: z.ZodLiteral<"success">;
|
|
7398
|
-
public: z.ZodObject<{}, z.core.$loose>;
|
|
7399
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7400
|
-
status: z.ZodLiteral<"error">;
|
|
7401
|
-
message: z.ZodString;
|
|
7402
|
-
}, z.core.$strip>], "status">>;
|
|
7403
|
-
}, z.core.$strip>;
|
|
7404
|
-
|
|
7405
|
-
declare const redactedOutputSchema_6: z.ZodObject<{
|
|
7406
|
-
tool: z.ZodLiteral<"paginateDataReport">;
|
|
7407
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7408
|
-
status: z.ZodLiteral<"success">;
|
|
7409
|
-
public: z.ZodObject<{
|
|
7410
|
-
totalRows: z.ZodNumber;
|
|
7411
|
-
fetchedRows: z.ZodNumber;
|
|
7412
|
-
offset: z.ZodNumber;
|
|
7413
|
-
hasMore: z.ZodBoolean;
|
|
7414
|
-
}, z.core.$strip>;
|
|
7415
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7416
|
-
status: z.ZodLiteral<"error">;
|
|
7417
|
-
message: z.ZodString;
|
|
7418
|
-
}, z.core.$strip>], "status">>;
|
|
7419
|
-
}, z.core.$strip>;
|
|
7420
|
-
|
|
7421
|
-
declare const redactedOutputSchema_7: z.ZodObject<{
|
|
7422
7265
|
tool: z.ZodLiteral<"search">;
|
|
7423
7266
|
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7424
7267
|
status: z.ZodLiteral<"success">;
|
|
@@ -7436,7 +7279,7 @@ declare const redactedOutputSchema_7: z.ZodObject<{
|
|
|
7436
7279
|
}, z.core.$strip>], "status">>;
|
|
7437
7280
|
}, z.core.$strip>;
|
|
7438
7281
|
|
|
7439
|
-
declare const
|
|
7282
|
+
declare const redactedOutputSchema_4: z.ZodObject<{
|
|
7440
7283
|
tool: z.ZodLiteral<"exploreSchema">;
|
|
7441
7284
|
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7442
7285
|
status: z.ZodLiteral<"success">;
|
|
@@ -7447,24 +7290,6 @@ declare const redactedOutputSchema_8: z.ZodObject<{
|
|
|
7447
7290
|
}, z.core.$strip>], "status">>;
|
|
7448
7291
|
}, z.core.$strip>;
|
|
7449
7292
|
|
|
7450
|
-
declare const RedactedPaginateDataReportResponse: z.ZodObject<{
|
|
7451
|
-
tool: z.ZodDefault<z.ZodLiteral<"paginateDataReport">>;
|
|
7452
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7453
|
-
status: z.ZodLiteral<"success">;
|
|
7454
|
-
public: z.ZodObject<{
|
|
7455
|
-
totalRows: z.ZodNumber;
|
|
7456
|
-
fetchedRows: z.ZodNumber;
|
|
7457
|
-
offset: z.ZodNumber;
|
|
7458
|
-
hasMore: z.ZodBoolean;
|
|
7459
|
-
}, z.core.$strip>;
|
|
7460
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7461
|
-
status: z.ZodLiteral<"error">;
|
|
7462
|
-
message: z.ZodString;
|
|
7463
|
-
}, z.core.$strip>], "status">>;
|
|
7464
|
-
}, z.core.$strip>;
|
|
7465
|
-
|
|
7466
|
-
export declare type RedactedPaginateDataReportResponseType = z.output<typeof RedactedPaginateDataReportResponse>;
|
|
7467
|
-
|
|
7468
7293
|
declare const RedactedThinkResponse: z.ZodObject<{
|
|
7469
7294
|
tool: z.ZodDefault<z.ZodLiteral<"think">>;
|
|
7470
7295
|
result: z.ZodOptional<z.ZodObject<{
|
|
@@ -7475,19 +7300,6 @@ declare const RedactedThinkResponse: z.ZodObject<{
|
|
|
7475
7300
|
|
|
7476
7301
|
export declare type RedactedThinkResponseType = z.output<typeof RedactedThinkResponse>;
|
|
7477
7302
|
|
|
7478
|
-
declare const RedactedValueBasedColumnSearchResponse: z.ZodObject<{
|
|
7479
|
-
tool: z.ZodDefault<z.ZodLiteral<"valueBasedColumnSearch">>;
|
|
7480
|
-
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7481
|
-
status: z.ZodLiteral<"success">;
|
|
7482
|
-
public: z.ZodObject<{}, z.core.$loose>;
|
|
7483
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
7484
|
-
status: z.ZodLiteral<"error">;
|
|
7485
|
-
message: z.ZodString;
|
|
7486
|
-
}, z.core.$strip>], "status">>;
|
|
7487
|
-
}, z.core.$strip>;
|
|
7488
|
-
|
|
7489
|
-
export declare type RedactedValueBasedColumnSearchResponseType = z.infer<typeof RedactedValueBasedColumnSearchResponse>;
|
|
7490
|
-
|
|
7491
7303
|
declare const RedactedWebSearchToolResponse: z.ZodObject<{
|
|
7492
7304
|
tool: z.ZodDefault<z.ZodLiteral<"search">>;
|
|
7493
7305
|
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7639,23 +7451,15 @@ export declare const toUploadedFileRefUrl: (uploadedFileId: string) => string;
|
|
|
7639
7451
|
|
|
7640
7452
|
declare type UiTool = InferUITool<Tool<z.infer<typeof inputSchema>, z.infer<typeof redactedOutputSchema>>>;
|
|
7641
7453
|
|
|
7642
|
-
declare type UiTool_10 = InferUITool<Tool<z.infer<typeof inputSchema_10>, z.infer<typeof redactedOutputSchema_8>>>;
|
|
7643
|
-
|
|
7644
7454
|
declare type UiTool_2 = InferUITool<Tool<z.infer<typeof inputSchema_2>, z.infer<typeof redactedOutputSchema_2>>>;
|
|
7645
7455
|
|
|
7646
7456
|
declare type UiTool_3 = InferUITool<Tool<z.infer<typeof inputSchema_3>, z.infer<typeof RedactedThinkResponse>>>;
|
|
7647
7457
|
|
|
7648
7458
|
declare type UiTool_4 = InferUITool<Tool<z.infer<typeof inputSchema_4>, z.infer<typeof redactedOutputSchema_3>>>;
|
|
7649
7459
|
|
|
7650
|
-
declare type UiTool_5 = InferUITool<Tool<z.infer<typeof inputSchema_5>, z.infer<typeof
|
|
7651
|
-
|
|
7652
|
-
declare type UiTool_6 = InferUITool<Tool<z.infer<typeof inputSchema_6>, z.infer<typeof redactedOutputSchema_5>>>;
|
|
7653
|
-
|
|
7654
|
-
declare type UiTool_7 = InferUITool<Tool<z.infer<typeof inputSchema_7>, z.infer<typeof redactedOutputSchema_6>>>;
|
|
7460
|
+
declare type UiTool_5 = InferUITool<Tool<z.infer<typeof inputSchema_5>, z.infer<typeof RedactedAskUserQuestionResponse>>>;
|
|
7655
7461
|
|
|
7656
|
-
declare type
|
|
7657
|
-
|
|
7658
|
-
declare type UiTool_9 = InferUITool<Tool<z.infer<typeof inputSchema_9>, z.infer<typeof RedactedAskUserQuestionResponse>>>;
|
|
7462
|
+
declare type UiTool_6 = InferUITool<Tool<z.infer<typeof inputSchema_6>, z.infer<typeof redactedOutputSchema_4>>>;
|
|
7659
7463
|
|
|
7660
7464
|
declare const UpdateCanvasSchema: z.ZodObject<{
|
|
7661
7465
|
id: z.ZodUUID;
|
|
@@ -7823,8 +7627,6 @@ export declare const validateUploadedFiles: (uploadedFiles: ReadonlyArray<{
|
|
|
7823
7627
|
size_bytes: number;
|
|
7824
7628
|
}>) => void;
|
|
7825
7629
|
|
|
7826
|
-
export declare const VALUE_BASED_COLUMN_SEARCH: "valueBasedColumnSearch";
|
|
7827
|
-
|
|
7828
7630
|
export declare const WEB_SEARCH: "webSearch";
|
|
7829
7631
|
|
|
7830
7632
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -58,7 +58,7 @@ var addApiKeyHeader = (apiKey) => {
|
|
|
58
58
|
|
|
59
59
|
// package.json
|
|
60
60
|
var package_default = {
|
|
61
|
-
version: "0.
|
|
61
|
+
version: "0.15.0"};
|
|
62
62
|
|
|
63
63
|
// src/core/MageMetricsEventEmitter.ts
|
|
64
64
|
var MageMetricsEventEmitter = class {
|
|
@@ -483,7 +483,7 @@ function getOpenApiConfiguration(refOrOpenapi, metadataOrOptions, options) {
|
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
486
|
+
// ../../node_modules/.pnpm/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
487
487
|
new Set(".\\+*[^]$()");
|
|
488
488
|
var createRoute = (routeConfig) => {
|
|
489
489
|
const route = {
|
|
@@ -1089,10 +1089,30 @@ var BusinessExplanationSchema = z.object({
|
|
|
1089
1089
|
explanation: z.string()
|
|
1090
1090
|
}))
|
|
1091
1091
|
});
|
|
1092
|
+
var MONTH_ABBREVIATION_LOCALE = "en-month-abbreviation";
|
|
1092
1093
|
dayjs.extend(relativeTime);
|
|
1093
1094
|
dayjs.extend(customParseFormat);
|
|
1094
1095
|
dayjs.extend(utc);
|
|
1095
1096
|
dayjs.extend(timezone);
|
|
1097
|
+
dayjs.locale({
|
|
1098
|
+
name: MONTH_ABBREVIATION_LOCALE,
|
|
1099
|
+
monthsShort: [
|
|
1100
|
+
"Jan.",
|
|
1101
|
+
"Feb.",
|
|
1102
|
+
"Mar.",
|
|
1103
|
+
"Apr.",
|
|
1104
|
+
"May",
|
|
1105
|
+
"Jun.",
|
|
1106
|
+
"Jul.",
|
|
1107
|
+
"Aug.",
|
|
1108
|
+
"Sep.",
|
|
1109
|
+
"Oct.",
|
|
1110
|
+
"Nov.",
|
|
1111
|
+
"Dec."
|
|
1112
|
+
],
|
|
1113
|
+
formats: {},
|
|
1114
|
+
relativeTime: {}
|
|
1115
|
+
}, void 0, true);
|
|
1096
1116
|
var daysjs_default = dayjs;
|
|
1097
1117
|
|
|
1098
1118
|
// ../shared/dist/src/data/FormattedData.js
|
|
@@ -1392,6 +1412,7 @@ var CanonicalDataTypeSchema = z.enum([
|
|
|
1392
1412
|
"numeric",
|
|
1393
1413
|
"boolean",
|
|
1394
1414
|
"datetime",
|
|
1415
|
+
"date",
|
|
1395
1416
|
"text",
|
|
1396
1417
|
"array",
|
|
1397
1418
|
"json",
|
|
@@ -1661,12 +1682,6 @@ var parseReportId = (val, ctx) => {
|
|
|
1661
1682
|
var ReportId = z.string().transform((val, ctx) => parseReportId(val, ctx)).openapi({ type: "string", description: "Numeric legacy ID or UUID" });
|
|
1662
1683
|
var ReportIdFromBody = z.union([z.string(), z.number()]).transform((val, ctx) => parseReportId(String(val), ctx));
|
|
1663
1684
|
var ReportIdParam = z.object({ report_id: ReportId }).openapi("ReportId", { type: "integer" });
|
|
1664
|
-
var CreateFlowFileSchema = z.object({
|
|
1665
|
-
type: z.literal("file"),
|
|
1666
|
-
mediaType: z.string(),
|
|
1667
|
-
filename: z.string().optional(),
|
|
1668
|
-
url: z.string()
|
|
1669
|
-
});
|
|
1670
1685
|
var RetrieveFlowDataReports = createRoute({
|
|
1671
1686
|
method: "get",
|
|
1672
1687
|
path: "/api/v1/flows/{flowId}/data-reports",
|
|
@@ -2390,7 +2405,6 @@ var CreateFlow = createRoute({
|
|
|
2390
2405
|
schema: z.object({
|
|
2391
2406
|
userQuery: z.string(),
|
|
2392
2407
|
applicationName: z.string().optional(),
|
|
2393
|
-
files: z.array(CreateFlowFileSchema).max(CHAT_MAX_FILE_COUNT).optional(),
|
|
2394
2408
|
uploadedFileIds: z.array(UploadedFileIdSchema).max(CHAT_MAX_FILE_COUNT).optional()
|
|
2395
2409
|
})
|
|
2396
2410
|
}
|
|
@@ -3295,7 +3309,6 @@ var BaseAgentSchema = z.object({
|
|
|
3295
3309
|
});
|
|
3296
3310
|
var AgentBehaviorSchema = z.object({
|
|
3297
3311
|
name: z.string(),
|
|
3298
|
-
objective: z.string().nullable(),
|
|
3299
3312
|
generated_objective_fragment: z.string().nullable(),
|
|
3300
3313
|
active_tools: z.array(z.string()).nullable(),
|
|
3301
3314
|
input_schema: AgentInputSchemaSchema.nullable(),
|
|
@@ -3308,11 +3321,11 @@ var AgentSchema = z.object({
|
|
|
3308
3321
|
...BaseAgentSchema.shape,
|
|
3309
3322
|
...AgentBehaviorSchema.shape,
|
|
3310
3323
|
updated_at: z.string(),
|
|
3311
|
-
current_version_id: z.uuid()
|
|
3324
|
+
current_version_id: z.uuid(),
|
|
3325
|
+
version_count: z.number().int().positive()
|
|
3312
3326
|
});
|
|
3313
3327
|
z.object({
|
|
3314
3328
|
name: z.string().min(1, "Name is required"),
|
|
3315
|
-
objective: z.string().optional(),
|
|
3316
3329
|
generated_objective_fragment: z.string().optional(),
|
|
3317
3330
|
active_tools: z.array(z.string()).default([]),
|
|
3318
3331
|
input_schema: AgentInputSchemaSchema.optional(),
|
|
@@ -3323,7 +3336,6 @@ z.object({
|
|
|
3323
3336
|
});
|
|
3324
3337
|
var DbUpdateAgentSchema = z.object({
|
|
3325
3338
|
name: z.string().min(1).optional(),
|
|
3326
|
-
objective: z.string().nullable().optional(),
|
|
3327
3339
|
generated_objective_fragment: z.string().nullable().optional(),
|
|
3328
3340
|
active_tools: z.array(z.string()).optional(),
|
|
3329
3341
|
input_schema: AgentInputSchemaSchema.nullable().optional(),
|
|
@@ -4713,6 +4725,40 @@ var getMessageTextContent = (message) => {
|
|
|
4713
4725
|
}
|
|
4714
4726
|
return content;
|
|
4715
4727
|
};
|
|
4728
|
+
var EXPLORE_SCHEMA = "exploreSchema";
|
|
4729
|
+
var SuccessVersion2 = z.object({
|
|
4730
|
+
status: z.literal("success"),
|
|
4731
|
+
public: z.looseObject({}),
|
|
4732
|
+
private: z.object({
|
|
4733
|
+
answer: z.string()
|
|
4734
|
+
})
|
|
4735
|
+
});
|
|
4736
|
+
var RedactedSuccessVersion = SuccessVersion2.omit({
|
|
4737
|
+
private: true
|
|
4738
|
+
});
|
|
4739
|
+
var ErrorVersion2 = z.object({
|
|
4740
|
+
status: z.literal("error"),
|
|
4741
|
+
message: z.string()
|
|
4742
|
+
});
|
|
4743
|
+
var ExploreSchemaResponse = z.object({
|
|
4744
|
+
tool: z.literal(EXPLORE_SCHEMA).default(EXPLORE_SCHEMA),
|
|
4745
|
+
result: z.discriminatedUnion("status", [SuccessVersion2, ErrorVersion2]).optional()
|
|
4746
|
+
});
|
|
4747
|
+
ExploreSchemaResponse.extend({
|
|
4748
|
+
result: z.discriminatedUnion("status", [RedactedSuccessVersion, ErrorVersion2]).optional()
|
|
4749
|
+
});
|
|
4750
|
+
z.object({
|
|
4751
|
+
question: z.string().describe("A natural language question about the available data schema, tables, columns, data structure, or specific data values.")
|
|
4752
|
+
});
|
|
4753
|
+
var outputResultSchema = z.discriminatedUnion("status", [SuccessVersion2, ErrorVersion2]).optional();
|
|
4754
|
+
z.object({
|
|
4755
|
+
tool: z.literal(EXPLORE_SCHEMA),
|
|
4756
|
+
result: outputResultSchema
|
|
4757
|
+
});
|
|
4758
|
+
z.object({
|
|
4759
|
+
tool: z.literal(EXPLORE_SCHEMA),
|
|
4760
|
+
result: z.discriminatedUnion("status", [RedactedSuccessVersion, ErrorVersion2]).optional()
|
|
4761
|
+
});
|
|
4716
4762
|
var GENERATE_DATA_REPORT = "generateDataReport";
|
|
4717
4763
|
var SqlErrorCategory = z.enum([
|
|
4718
4764
|
// Infrastructure errors (retriable - SQL might still be valid)
|
|
@@ -4749,7 +4795,7 @@ var SqlGenerationErrorInfo = z.object({
|
|
|
4749
4795
|
line_num: z.number().nullish(),
|
|
4750
4796
|
col_num: z.number().nullish()
|
|
4751
4797
|
});
|
|
4752
|
-
var
|
|
4798
|
+
var SuccessVersion3 = z.object({
|
|
4753
4799
|
status: z.literal("success"),
|
|
4754
4800
|
public: z.object({
|
|
4755
4801
|
flowDataId: z.number(),
|
|
@@ -4762,10 +4808,10 @@ var SuccessVersion2 = z.object({
|
|
|
4762
4808
|
dataReportSummary: z.string()
|
|
4763
4809
|
})
|
|
4764
4810
|
});
|
|
4765
|
-
var
|
|
4811
|
+
var RedactedSuccessVersion2 = SuccessVersion3.omit({
|
|
4766
4812
|
private: true
|
|
4767
4813
|
});
|
|
4768
|
-
var
|
|
4814
|
+
var ErrorVersion3 = z.object({
|
|
4769
4815
|
status: z.literal("error"),
|
|
4770
4816
|
message: z.string(),
|
|
4771
4817
|
errorInfo: SqlGenerationErrorInfo.optional(),
|
|
@@ -4777,11 +4823,11 @@ var RedactedErrorVersion = z.object({
|
|
|
4777
4823
|
});
|
|
4778
4824
|
var GenerateDataReportResponse = z.object({
|
|
4779
4825
|
tool: z.literal(GENERATE_DATA_REPORT).default(GENERATE_DATA_REPORT),
|
|
4780
|
-
result: z.discriminatedUnion("status", [
|
|
4826
|
+
result: z.discriminatedUnion("status", [SuccessVersion3, ErrorVersion3]).optional()
|
|
4781
4827
|
});
|
|
4782
4828
|
GenerateDataReportResponse.extend({
|
|
4783
4829
|
result: z.discriminatedUnion("status", [
|
|
4784
|
-
|
|
4830
|
+
SuccessVersion3.omit({ private: true }),
|
|
4785
4831
|
RedactedErrorVersion
|
|
4786
4832
|
]).optional()
|
|
4787
4833
|
});
|
|
@@ -4791,20 +4837,20 @@ z.object({
|
|
|
4791
4837
|
isNewAnalysisGoal: z.boolean().describe("Indicates whether this request represents a new analysis goal very different from the current conversation flow (true), or continues/modifies the existing analysis (false)."),
|
|
4792
4838
|
difficultyLevel: z.enum(["simple", "moderate", "complex"]).describe("Complexity level of the SQL query based on the user request.")
|
|
4793
4839
|
});
|
|
4794
|
-
var
|
|
4840
|
+
var outputResultSchema2 = z.discriminatedUnion("status", [SuccessVersion3, ErrorVersion3]).optional();
|
|
4795
4841
|
z.object({
|
|
4796
4842
|
tool: z.literal(GENERATE_DATA_REPORT),
|
|
4797
|
-
result:
|
|
4843
|
+
result: outputResultSchema2
|
|
4798
4844
|
});
|
|
4799
4845
|
z.object({
|
|
4800
4846
|
tool: z.literal(GENERATE_DATA_REPORT),
|
|
4801
4847
|
result: z.discriminatedUnion("status", [
|
|
4802
|
-
|
|
4848
|
+
RedactedSuccessVersion2,
|
|
4803
4849
|
RedactedErrorVersion
|
|
4804
4850
|
]).optional()
|
|
4805
4851
|
});
|
|
4806
4852
|
var GENERATE_VISUALIZATION = "generateVisualization";
|
|
4807
|
-
var
|
|
4853
|
+
var SuccessVersion4 = z.object({
|
|
4808
4854
|
status: z.literal("success"),
|
|
4809
4855
|
public: z.object({
|
|
4810
4856
|
flowDataId: z.number(),
|
|
@@ -4819,21 +4865,21 @@ var SuccessVersion3 = z.object({
|
|
|
4819
4865
|
dataReportSummary: z.string().optional()
|
|
4820
4866
|
})
|
|
4821
4867
|
});
|
|
4822
|
-
var
|
|
4868
|
+
var RedactedSuccessVersion3 = SuccessVersion4.omit({
|
|
4823
4869
|
private: true
|
|
4824
4870
|
});
|
|
4825
|
-
var
|
|
4871
|
+
var ErrorVersion4 = z.object({
|
|
4826
4872
|
status: z.literal("error"),
|
|
4827
4873
|
message: z.string()
|
|
4828
4874
|
});
|
|
4829
4875
|
var GenerateVisualizationResponse = z.object({
|
|
4830
4876
|
tool: z.literal(GENERATE_VISUALIZATION).default(GENERATE_VISUALIZATION),
|
|
4831
|
-
result: z.discriminatedUnion("status", [
|
|
4877
|
+
result: z.discriminatedUnion("status", [SuccessVersion4, ErrorVersion4]).optional()
|
|
4832
4878
|
});
|
|
4833
4879
|
GenerateVisualizationResponse.extend({
|
|
4834
4880
|
result: z.discriminatedUnion("status", [
|
|
4835
|
-
|
|
4836
|
-
|
|
4881
|
+
SuccessVersion4.omit({ private: true }),
|
|
4882
|
+
ErrorVersion4
|
|
4837
4883
|
]).optional()
|
|
4838
4884
|
});
|
|
4839
4885
|
z.object({
|
|
@@ -4841,207 +4887,31 @@ z.object({
|
|
|
4841
4887
|
chartType: z.enum(["bar", "line/area", "scatter", "pie"]).describe("Type of visualization to generate"),
|
|
4842
4888
|
explanations: z.string().describe("Mandatory instructions for the visualization engine. This must include: 1) Aggregation logic (e.g., 'Sum revenue', 'Count IDs'), 2) Grouping details, 3) Limits for high-cardinality data (e.g., 'Sort descending and keep only the Top 10 results'), and 4) The specific columns to display on the plot (identifying metrics, axis, and dimensions).")
|
|
4843
4889
|
});
|
|
4844
|
-
var outputResultSchema2 = z.discriminatedUnion("status", [SuccessVersion3, ErrorVersion3]).optional();
|
|
4845
|
-
z.object({
|
|
4846
|
-
tool: z.literal(GENERATE_VISUALIZATION),
|
|
4847
|
-
result: outputResultSchema2
|
|
4848
|
-
});
|
|
4849
|
-
z.object({
|
|
4850
|
-
tool: z.literal(GENERATE_VISUALIZATION),
|
|
4851
|
-
result: z.discriminatedUnion("status", [RedactedSuccessVersion2, ErrorVersion3]).optional()
|
|
4852
|
-
});
|
|
4853
|
-
var GET_AVAILABLE_COLUMNS_FOR_TABLE = "getAvailableColumnsForTable";
|
|
4854
|
-
var SuccessVersion4 = z.object({
|
|
4855
|
-
status: z.literal("success"),
|
|
4856
|
-
public: z.looseObject({}),
|
|
4857
|
-
private: z.object({
|
|
4858
|
-
message: z.string().optional(),
|
|
4859
|
-
columns: z.object({
|
|
4860
|
-
name: z.string(),
|
|
4861
|
-
data_type: z.string().nullable(),
|
|
4862
|
-
description: z.string().nullable(),
|
|
4863
|
-
null_percentage: z.number().nullable(),
|
|
4864
|
-
unique_values: z.number().nullable(),
|
|
4865
|
-
sample_values: z.array(z.any()).nullable()
|
|
4866
|
-
}).array()
|
|
4867
|
-
})
|
|
4868
|
-
});
|
|
4869
|
-
var RedactedSuccessVersion3 = SuccessVersion4.omit({
|
|
4870
|
-
private: true
|
|
4871
|
-
});
|
|
4872
|
-
var ErrorVersion4 = z.object({
|
|
4873
|
-
status: z.literal("error"),
|
|
4874
|
-
message: z.string()
|
|
4875
|
-
});
|
|
4876
|
-
var GetAvailableColumnsForTableResponse = z.object({
|
|
4877
|
-
tool: z.literal(GET_AVAILABLE_COLUMNS_FOR_TABLE).default(GET_AVAILABLE_COLUMNS_FOR_TABLE),
|
|
4878
|
-
result: z.discriminatedUnion("status", [SuccessVersion4, ErrorVersion4]).optional()
|
|
4879
|
-
});
|
|
4880
|
-
GetAvailableColumnsForTableResponse.extend({
|
|
4881
|
-
result: z.discriminatedUnion("status", [
|
|
4882
|
-
SuccessVersion4.omit({ private: true }),
|
|
4883
|
-
ErrorVersion4
|
|
4884
|
-
]).optional()
|
|
4885
|
-
});
|
|
4886
|
-
z.object({
|
|
4887
|
-
dataset: z.string().describe("The dataset (schema) the table belongs to."),
|
|
4888
|
-
table_name: z.string().describe("A table name of the database for which to retrieve all column names and information.")
|
|
4889
|
-
});
|
|
4890
4890
|
var outputResultSchema3 = z.discriminatedUnion("status", [SuccessVersion4, ErrorVersion4]).optional();
|
|
4891
4891
|
z.object({
|
|
4892
|
-
tool: z.literal(
|
|
4892
|
+
tool: z.literal(GENERATE_VISUALIZATION),
|
|
4893
4893
|
result: outputResultSchema3
|
|
4894
4894
|
});
|
|
4895
4895
|
z.object({
|
|
4896
|
-
tool: z.literal(
|
|
4896
|
+
tool: z.literal(GENERATE_VISUALIZATION),
|
|
4897
4897
|
result: z.discriminatedUnion("status", [RedactedSuccessVersion3, ErrorVersion4]).optional()
|
|
4898
4898
|
});
|
|
4899
|
-
var GET_AVAILABLE_TABLES = "getAvailableTables";
|
|
4900
|
-
var SuccessVersion5 = z.object({
|
|
4901
|
-
status: z.literal("success"),
|
|
4902
|
-
public: z.looseObject({}),
|
|
4903
|
-
private: z.object({
|
|
4904
|
-
tables: z.array(z.object({
|
|
4905
|
-
dataset: z.string(),
|
|
4906
|
-
table_name: z.string(),
|
|
4907
|
-
description: z.string().nullable()
|
|
4908
|
-
}))
|
|
4909
|
-
})
|
|
4910
|
-
});
|
|
4911
|
-
var RedactedSuccessVersion4 = SuccessVersion5.omit({
|
|
4912
|
-
private: true
|
|
4913
|
-
});
|
|
4914
|
-
var ErrorVersion5 = z.object({
|
|
4915
|
-
status: z.literal("error"),
|
|
4916
|
-
message: z.string()
|
|
4917
|
-
});
|
|
4918
|
-
var GetAvailableTablesResponse = z.object({
|
|
4919
|
-
tool: z.literal(GET_AVAILABLE_TABLES).default(GET_AVAILABLE_TABLES),
|
|
4920
|
-
result: z.discriminatedUnion("status", [SuccessVersion5, ErrorVersion5]).optional()
|
|
4921
|
-
});
|
|
4922
|
-
GetAvailableTablesResponse.extend({
|
|
4923
|
-
result: z.discriminatedUnion("status", [
|
|
4924
|
-
SuccessVersion5.omit({ private: true }),
|
|
4925
|
-
ErrorVersion5
|
|
4926
|
-
]).optional()
|
|
4927
|
-
});
|
|
4928
|
-
z.object({}).describe("This tool requires no parameters and returns all table names available in the database.");
|
|
4929
|
-
var outputResultSchema4 = z.discriminatedUnion("status", [SuccessVersion5, ErrorVersion5]).optional();
|
|
4930
|
-
z.object({
|
|
4931
|
-
tool: z.literal(GET_AVAILABLE_TABLES),
|
|
4932
|
-
result: outputResultSchema4
|
|
4933
|
-
});
|
|
4934
|
-
z.object({
|
|
4935
|
-
tool: z.literal(GET_AVAILABLE_TABLES),
|
|
4936
|
-
result: z.discriminatedUnion("status", [RedactedSuccessVersion4, ErrorVersion5]).optional()
|
|
4937
|
-
});
|
|
4938
|
-
var PAGINATE_DATA_REPORT = "paginateDataReport";
|
|
4939
|
-
z.object({
|
|
4940
|
-
reportId: z.number().describe("The ID of the report to fetch data from"),
|
|
4941
|
-
limit: z.number().optional().default(50).describe("Number of rows to fetch (default 50)"),
|
|
4942
|
-
offset: z.number().optional().default(0).describe("Row offset - skip this many rows from the start (default 0)"),
|
|
4943
|
-
skipSampleRows: z.boolean().optional().default(true).describe("Skip rows already shown in the data_sample from generateDataReport (default true). Set to false only if you need to re-fetch from the beginning.")
|
|
4944
|
-
});
|
|
4945
|
-
var SuccessVersion6 = z.object({
|
|
4946
|
-
status: z.literal("success"),
|
|
4947
|
-
public: z.object({
|
|
4948
|
-
totalRows: z.number(),
|
|
4949
|
-
fetchedRows: z.number(),
|
|
4950
|
-
offset: z.number(),
|
|
4951
|
-
hasMore: z.boolean()
|
|
4952
|
-
}),
|
|
4953
|
-
/* the data is in the private field to avoid sending it to the frontend
|
|
4954
|
-
* this is not a security feature as the user has access to the report anyway */
|
|
4955
|
-
private: z.object({
|
|
4956
|
-
data: z.array(z.record(z.string(), z.unknown()))
|
|
4957
|
-
})
|
|
4958
|
-
});
|
|
4959
|
-
var RedactedSuccessVersion5 = SuccessVersion6.omit({
|
|
4960
|
-
private: true
|
|
4961
|
-
});
|
|
4962
|
-
var ErrorVersion6 = z.object({
|
|
4963
|
-
status: z.literal("error"),
|
|
4964
|
-
message: z.string()
|
|
4965
|
-
});
|
|
4966
|
-
var PaginateDataReportResponse = z.object({
|
|
4967
|
-
tool: z.literal(PAGINATE_DATA_REPORT).default(PAGINATE_DATA_REPORT),
|
|
4968
|
-
result: z.discriminatedUnion("status", [SuccessVersion6, ErrorVersion6]).optional()
|
|
4969
|
-
});
|
|
4970
|
-
PaginateDataReportResponse.extend({
|
|
4971
|
-
result: z.discriminatedUnion("status", [RedactedSuccessVersion5, ErrorVersion6]).optional()
|
|
4972
|
-
});
|
|
4973
|
-
var outputResultSchema5 = z.discriminatedUnion("status", [SuccessVersion6, ErrorVersion6]).optional();
|
|
4974
|
-
z.object({
|
|
4975
|
-
tool: z.literal(PAGINATE_DATA_REPORT),
|
|
4976
|
-
result: outputResultSchema5
|
|
4977
|
-
});
|
|
4978
|
-
z.object({
|
|
4979
|
-
tool: z.literal(PAGINATE_DATA_REPORT),
|
|
4980
|
-
result: z.discriminatedUnion("status", [RedactedSuccessVersion5, ErrorVersion6]).optional()
|
|
4981
|
-
});
|
|
4982
4899
|
var THINK = "think";
|
|
4983
|
-
var
|
|
4900
|
+
var outputResultSchema4 = z.object({
|
|
4984
4901
|
status: z.literal("success"),
|
|
4985
4902
|
public: z.looseObject({}),
|
|
4986
4903
|
private: z.looseObject({})
|
|
4987
4904
|
});
|
|
4988
4905
|
var ThinkResponse = z.object({
|
|
4989
4906
|
tool: z.literal(THINK).default(THINK),
|
|
4990
|
-
result:
|
|
4907
|
+
result: outputResultSchema4.optional()
|
|
4991
4908
|
});
|
|
4992
4909
|
ThinkResponse.extend({
|
|
4993
|
-
result:
|
|
4910
|
+
result: outputResultSchema4.omit({ private: true }).optional()
|
|
4994
4911
|
});
|
|
4995
4912
|
z.object({
|
|
4996
4913
|
thought: z.string().describe("A thought to think about.")
|
|
4997
4914
|
});
|
|
4998
|
-
var VALUE_BASED_COLUMN_SEARCH = "valueBasedColumnSearch";
|
|
4999
|
-
var SuccessVersion7 = z.object({
|
|
5000
|
-
status: z.literal("success"),
|
|
5001
|
-
public: z.looseObject({}),
|
|
5002
|
-
private: z.object({
|
|
5003
|
-
message: z.string().optional(),
|
|
5004
|
-
columns: z.object({
|
|
5005
|
-
name: z.string(),
|
|
5006
|
-
data_type: z.string().nullable(),
|
|
5007
|
-
description: z.string().nullable(),
|
|
5008
|
-
table: z.object({
|
|
5009
|
-
table_name: z.string(),
|
|
5010
|
-
description: z.string().nullable()
|
|
5011
|
-
}),
|
|
5012
|
-
matched_values: z.string().array()
|
|
5013
|
-
}).array()
|
|
5014
|
-
})
|
|
5015
|
-
});
|
|
5016
|
-
var RedactedSuccessVersion6 = SuccessVersion7.omit({
|
|
5017
|
-
private: true
|
|
5018
|
-
});
|
|
5019
|
-
var ErrorVersion7 = z.object({
|
|
5020
|
-
status: z.literal("error"),
|
|
5021
|
-
message: z.string()
|
|
5022
|
-
});
|
|
5023
|
-
var ValueBasedColumnSearchResponse = z.object({
|
|
5024
|
-
tool: z.literal(VALUE_BASED_COLUMN_SEARCH).default(VALUE_BASED_COLUMN_SEARCH),
|
|
5025
|
-
result: z.discriminatedUnion("status", [SuccessVersion7, ErrorVersion7]).optional()
|
|
5026
|
-
});
|
|
5027
|
-
ValueBasedColumnSearchResponse.extend({
|
|
5028
|
-
result: z.discriminatedUnion("status", [
|
|
5029
|
-
SuccessVersion7.omit({ private: true }),
|
|
5030
|
-
ErrorVersion7
|
|
5031
|
-
]).optional()
|
|
5032
|
-
});
|
|
5033
|
-
z.object({
|
|
5034
|
-
value: z.string().describe("A literal data value as it would appear in a cell (e.g. 'France', 'PRD-00123', 'Apple iPhone'). Must NOT be a column name or concept.")
|
|
5035
|
-
});
|
|
5036
|
-
var outputResultSchema7 = z.discriminatedUnion("status", [SuccessVersion7, ErrorVersion7]).optional();
|
|
5037
|
-
z.object({
|
|
5038
|
-
tool: z.literal(VALUE_BASED_COLUMN_SEARCH),
|
|
5039
|
-
result: outputResultSchema7
|
|
5040
|
-
});
|
|
5041
|
-
z.object({
|
|
5042
|
-
tool: z.literal(VALUE_BASED_COLUMN_SEARCH),
|
|
5043
|
-
result: z.discriminatedUnion("status", [RedactedSuccessVersion6, ErrorVersion7]).optional()
|
|
5044
|
-
});
|
|
5045
4915
|
var WEB_SEARCH = "webSearch";
|
|
5046
4916
|
var Source = z.object({
|
|
5047
4917
|
sourceType: z.literal("url"),
|
|
@@ -5049,7 +4919,7 @@ var Source = z.object({
|
|
|
5049
4919
|
url: z.string(),
|
|
5050
4920
|
title: z.string()
|
|
5051
4921
|
});
|
|
5052
|
-
var
|
|
4922
|
+
var SuccessVersion5 = z.object({
|
|
5053
4923
|
status: z.literal("success"),
|
|
5054
4924
|
public: z.object({
|
|
5055
4925
|
sources: z.array(Source).optional().describe("Array of source objects.")
|
|
@@ -5058,21 +4928,21 @@ var SuccessVersion8 = z.object({
|
|
|
5058
4928
|
answer: z.string().optional().describe("The answer from the search results, if successful.")
|
|
5059
4929
|
})
|
|
5060
4930
|
});
|
|
5061
|
-
var
|
|
4931
|
+
var RedactedSuccessVersion4 = SuccessVersion5.omit({
|
|
5062
4932
|
private: true
|
|
5063
4933
|
});
|
|
5064
|
-
var
|
|
4934
|
+
var ErrorVersion5 = z.object({
|
|
5065
4935
|
status: z.literal("error"),
|
|
5066
4936
|
message: z.string()
|
|
5067
4937
|
});
|
|
5068
4938
|
var WebSearchToolResponse = z.object({
|
|
5069
4939
|
tool: z.literal("search").default("search"),
|
|
5070
|
-
result: z.discriminatedUnion("status", [
|
|
4940
|
+
result: z.discriminatedUnion("status", [SuccessVersion5, ErrorVersion5]).optional()
|
|
5071
4941
|
});
|
|
5072
4942
|
WebSearchToolResponse.extend({
|
|
5073
4943
|
result: z.discriminatedUnion("status", [
|
|
5074
|
-
|
|
5075
|
-
|
|
4944
|
+
SuccessVersion5.omit({ private: true }),
|
|
4945
|
+
ErrorVersion5
|
|
5076
4946
|
]).optional()
|
|
5077
4947
|
});
|
|
5078
4948
|
z.object({
|
|
@@ -5080,13 +4950,13 @@ z.object({
|
|
|
5080
4950
|
fromDate: z.iso.date().optional().describe("Only include content published after this date (YYYY-MM-DD). Useful for recent news or time-specific analysis."),
|
|
5081
4951
|
toDate: z.iso.date().optional().describe("Only include content published before this date (YYYY-MM-DD). Combine with fromDate for a date range.")
|
|
5082
4952
|
});
|
|
5083
|
-
var
|
|
4953
|
+
var outputResultSchema5 = z.discriminatedUnion("status", [SuccessVersion5, ErrorVersion5]).optional();
|
|
5084
4954
|
z.object({
|
|
5085
|
-
result:
|
|
4955
|
+
result: outputResultSchema5
|
|
5086
4956
|
});
|
|
5087
4957
|
z.object({
|
|
5088
4958
|
tool: z.literal("search"),
|
|
5089
|
-
result: z.discriminatedUnion("status", [
|
|
4959
|
+
result: z.discriminatedUnion("status", [RedactedSuccessVersion4, ErrorVersion5]).optional()
|
|
5090
4960
|
});
|
|
5091
4961
|
|
|
5092
|
-
export { ASK_USER_QUESTION, BrowserStorageAdapter, CHAT_ALLOWED_FILE_MEDIA_TYPES, CHAT_FILE_ACCEPT, CHAT_MAX_COMBINED_FILE_SIZE, CHAT_MAX_FILE_COUNT, CHAT_MAX_FILE_SIZE, CHECK_KEY, DirectAuthProvider, ExternalAuthProvider, GENERATE_DATA_REPORT, GENERATE_VISUALIZATION,
|
|
4962
|
+
export { ASK_USER_QUESTION, BrowserStorageAdapter, CHAT_ALLOWED_FILE_MEDIA_TYPES, CHAT_FILE_ACCEPT, CHAT_MAX_COMBINED_FILE_SIZE, CHAT_MAX_FILE_COUNT, CHAT_MAX_FILE_SIZE, CHECK_KEY, DirectAuthProvider, EXPLORE_SCHEMA, ExternalAuthProvider, GENERATE_DATA_REPORT, GENERATE_VISUALIZATION, MageMetricsChatTransport, MageMetricsClient, MageMetricsEventEmitter, MemoryStorageAdapter, THINK, TOKEN_STORAGE_KEY, UPLOADED_FILE_REF_PREFIX, WEB_SEARCH, getMessageTextContent, getPublicApiClient, getUploadedFileIdFromUrl, hasOnlyInitialUserMessage, isAskUserQuestionPart, isFrontendV1Visualization, isFrontendV1VisualizationWithData, isFrontendV2Visualization, isFrontendV2VisualizationWithData, toSearchParams, toUploadedFileRefUrl, validateUploadedFiles };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magemetrics/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "MageMetrics client library",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/"
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@noble/hashes": "^2.2.0",
|
|
37
|
-
"@supabase/auth-js": "^2.
|
|
38
|
-
"@xyflow/system": "^0.0.
|
|
39
|
-
"ai": "6.0.
|
|
40
|
-
"dayjs": "^1.11.
|
|
37
|
+
"@supabase/auth-js": "^2.108.1",
|
|
38
|
+
"@xyflow/system": "^0.0.77",
|
|
39
|
+
"ai": "6.0.200",
|
|
40
|
+
"dayjs": "^1.11.21",
|
|
41
41
|
"openapi-fetch": "^0.17.0",
|
|
42
|
-
"type-fest": "^5.
|
|
42
|
+
"type-fest": "^5.7.0",
|
|
43
43
|
"zod": "^4.4.3"
|
|
44
44
|
}
|
|
45
45
|
}
|