@magemetrics/core 0.6.1 → 0.7.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 +26 -0
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -491,6 +491,18 @@ declare const inputSchema_7: z.ZodObject<{
|
|
|
491
491
|
query: z.ZodString;
|
|
492
492
|
}, z.core.$strip>;
|
|
493
493
|
|
|
494
|
+
declare const inputSchema_8: z.ZodObject<{
|
|
495
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
496
|
+
question: z.ZodString;
|
|
497
|
+
header: z.ZodString;
|
|
498
|
+
multiSelect: z.ZodBoolean;
|
|
499
|
+
options: z.ZodArray<z.ZodObject<{
|
|
500
|
+
label: z.ZodString;
|
|
501
|
+
description: z.ZodString;
|
|
502
|
+
}, z.core.$strip>>;
|
|
503
|
+
}, z.core.$strip>>;
|
|
504
|
+
}, z.core.$strip>;
|
|
505
|
+
|
|
494
506
|
declare type InternalApiClient = Simplify<Client<NoAuthPaths, `${string}/${string}`>>;
|
|
495
507
|
|
|
496
508
|
export declare class MageMetricsChatTransport extends DefaultChatTransport<MMChatUIMessage> {
|
|
@@ -788,6 +800,7 @@ declare type MMUiTools = {
|
|
|
788
800
|
getAvailableTables: UiTool_5;
|
|
789
801
|
getAvailableColumnsForTable: UiTool_6;
|
|
790
802
|
webSearch: UiTool_7;
|
|
803
|
+
askUserQuestion: UiTool_8;
|
|
791
804
|
};
|
|
792
805
|
|
|
793
806
|
declare type NoAuthPaths = Simplify<{
|
|
@@ -4455,6 +4468,17 @@ declare const QuickActionsSchema: z.ZodArray<z.ZodObject<{
|
|
|
4455
4468
|
explanation: z.ZodString;
|
|
4456
4469
|
}, z.core.$strip>>;
|
|
4457
4470
|
|
|
4471
|
+
declare const RedactedAskUserQuestionResponse: z.ZodObject<{
|
|
4472
|
+
tool: z.ZodDefault<z.ZodLiteral<"askUserQuestion">>;
|
|
4473
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4474
|
+
status: z.ZodLiteral<"success">;
|
|
4475
|
+
answers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
4476
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4477
|
+
status: z.ZodLiteral<"error">;
|
|
4478
|
+
message: z.ZodString;
|
|
4479
|
+
}, z.core.$strip>], "status">;
|
|
4480
|
+
}, z.core.$strip>;
|
|
4481
|
+
|
|
4458
4482
|
declare const redactedOutputSchema: z.ZodObject<{
|
|
4459
4483
|
tool: z.ZodLiteral<"generateDataReport">;
|
|
4460
4484
|
result: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -4612,6 +4636,8 @@ declare type UiTool_6 = InferUITool<Tool<z.infer<typeof inputSchema_6>, z.infer<
|
|
|
4612
4636
|
|
|
4613
4637
|
declare type UiTool_7 = InferUITool<Tool<z.infer<typeof inputSchema_7>, z.infer<typeof redactedOutputSchema_6>>>;
|
|
4614
4638
|
|
|
4639
|
+
declare type UiTool_8 = InferUITool<Tool<z.infer<typeof inputSchema_8>, z.infer<typeof RedactedAskUserQuestionResponse>>>;
|
|
4640
|
+
|
|
4615
4641
|
declare const UpdateCanvasSchema: z.ZodObject<{
|
|
4616
4642
|
id: z.ZodUUID;
|
|
4617
4643
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ var addApiKeyHeader = (apiKey) => {
|
|
|
57
57
|
|
|
58
58
|
// package.json
|
|
59
59
|
var package_default = {
|
|
60
|
-
version: "0.
|
|
60
|
+
version: "0.7.0"};
|
|
61
61
|
|
|
62
62
|
// src/core/MageMetricsEventEmitter.ts
|
|
63
63
|
var MageMetricsEventEmitter = class {
|
|
@@ -151,7 +151,7 @@ var hashString = (value) => {
|
|
|
151
151
|
return Array.from(hash).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
-
// ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.1
|
|
154
|
+
// ../../node_modules/.pnpm/@asteasolutions+zod-to-openapi@8.1.0_zod@4.2.1/node_modules/@asteasolutions/zod-to-openapi/dist/index.mjs
|
|
155
155
|
function __rest(s, e) {
|
|
156
156
|
var t = {};
|
|
157
157
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -3130,13 +3130,28 @@ var toSearchParams = ({ cursor, filters, sorting, limit }) => {
|
|
|
3130
3130
|
}
|
|
3131
3131
|
return params;
|
|
3132
3132
|
};
|
|
3133
|
+
var isToolResultMessage = (message) => {
|
|
3134
|
+
if (message.role !== "assistant") {
|
|
3135
|
+
return false;
|
|
3136
|
+
}
|
|
3137
|
+
return message.parts.some(
|
|
3138
|
+
(part) => part.type.startsWith("tool-") && "state" in part && part.state === "output-available"
|
|
3139
|
+
);
|
|
3140
|
+
};
|
|
3133
3141
|
var MageMetricsChatTransport = class extends DefaultChatTransport {
|
|
3134
3142
|
constructor(apiUrl, flowId, options) {
|
|
3135
3143
|
super({
|
|
3136
3144
|
...options,
|
|
3137
3145
|
api: `${apiUrl}/api/v1/chat/${flowId}`,
|
|
3138
3146
|
prepareSendMessagesRequest({ messages, id: chatId }) {
|
|
3139
|
-
|
|
3147
|
+
const lastMessage = messages.at(-1);
|
|
3148
|
+
if (lastMessage && isToolResultMessage(lastMessage)) {
|
|
3149
|
+
lastMessage.metadata = {
|
|
3150
|
+
...typeof lastMessage.metadata === "object" ? lastMessage.metadata : void 0,
|
|
3151
|
+
isFrontendToolSubmission: true
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
return { body: { message: lastMessage, id: chatId } };
|
|
3140
3155
|
}
|
|
3141
3156
|
});
|
|
3142
3157
|
}
|