@dbx-tools/ui-mastra 0.6.87 → 0.6.89
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/package.json
CHANGED
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"typescript": "^5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@dbx-tools/shared-core": "0.6.
|
|
28
|
-
"@dbx-tools/shared-genie": "0.6.
|
|
29
|
-
"@dbx-tools/shared-mastra": "0.6.
|
|
30
|
-
"@dbx-tools/shared-model": "0.6.
|
|
31
|
-
"@dbx-tools/ui-appkit": "0.6.
|
|
32
|
-
"@dbx-tools/ui-branding": "0.6.
|
|
27
|
+
"@dbx-tools/shared-core": "0.6.89",
|
|
28
|
+
"@dbx-tools/shared-genie": "0.6.89",
|
|
29
|
+
"@dbx-tools/shared-mastra": "0.6.89",
|
|
30
|
+
"@dbx-tools/shared-model": "0.6.89",
|
|
31
|
+
"@dbx-tools/ui-appkit": "0.6.89",
|
|
32
|
+
"@dbx-tools/ui-branding": "0.6.89",
|
|
33
33
|
"@mastra/client-js": "^1.28.0",
|
|
34
34
|
"@tanstack/react-table": "^8.21.3",
|
|
35
35
|
"ai": "^5.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"version": "0.6.
|
|
50
|
+
"version": "0.6.89",
|
|
51
51
|
"type": "module",
|
|
52
52
|
"exports": {
|
|
53
53
|
"./react": "./src/react/index.ts",
|
package/src/react/chat-view.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { error as
|
|
1
|
+
import { error as sharedError } from "@dbx-tools/shared-core";
|
|
2
2
|
import {
|
|
3
3
|
Alert,
|
|
4
4
|
AlertDescription,
|
|
@@ -724,7 +724,7 @@ export const ChatView = ({
|
|
|
724
724
|
<AlertTitle>Something went wrong</AlertTitle>
|
|
725
725
|
<AlertDescription>
|
|
726
726
|
{error
|
|
727
|
-
?
|
|
727
|
+
? sharedError.errorMessage(error)
|
|
728
728
|
: "The assistant ran into an error. Please try again."}
|
|
729
729
|
</AlertDescription>
|
|
730
730
|
</Alert>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { marker as
|
|
1
|
+
import { marker as sharedMarkers, type ParsedMarker } from "@dbx-tools/shared-mastra";
|
|
2
2
|
import { Spinner } from "@dbx-tools/ui-appkit/react";
|
|
3
3
|
import { ClockIcon } from "lucide-react";
|
|
4
4
|
import { lazy, Suspense, useMemo, useRef } from "react";
|
|
@@ -189,7 +189,7 @@ type RenderSegment =
|
|
|
189
189
|
* resolves to a slot.
|
|
190
190
|
*/
|
|
191
191
|
const markerSegment = (marker: ParsedMarker): RenderSegment => {
|
|
192
|
-
if (!
|
|
192
|
+
if (!sharedMarkers.isUuid(marker.id)) return { kind: "text", text: "" };
|
|
193
193
|
switch (marker.type) {
|
|
194
194
|
case "chart":
|
|
195
195
|
return { kind: "chart", chartId: marker.id };
|
|
@@ -206,7 +206,7 @@ const splitTextWithEmbeds = (text: string): RenderSegment[] => {
|
|
|
206
206
|
// `parseMarkers` yields hits in source order with no overlaps (one
|
|
207
207
|
// regex pass), so the spans splice in directly - no sort or
|
|
208
208
|
// overlap guard needed.
|
|
209
|
-
for (const marker of
|
|
209
|
+
for (const marker of sharedMarkers.parseMarkers(text)) {
|
|
210
210
|
if (marker.start > lastIdx) {
|
|
211
211
|
segments.push({ kind: "text", text: text.slice(lastIdx, marker.start) });
|
|
212
212
|
}
|
|
@@ -250,7 +250,7 @@ export const MarkdownWithEmbeds = ({
|
|
|
250
250
|
text: string;
|
|
251
251
|
streaming?: boolean;
|
|
252
252
|
}) => {
|
|
253
|
-
const segments = splitTextWithEmbeds(
|
|
253
|
+
const segments = splitTextWithEmbeds(sharedMarkers.stripIncompleteMarkerTail(text));
|
|
254
254
|
return (
|
|
255
255
|
<>
|
|
256
256
|
{segments.map((seg, i) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { error as
|
|
1
|
+
import { error as sharedError, hash, log } from "@dbx-tools/shared-core";
|
|
2
2
|
import { feedback, type MastraThread } from "@dbx-tools/shared-mastra";
|
|
3
3
|
import { useBrand } from "@dbx-tools/ui-branding/react";
|
|
4
4
|
import type { UIMessage } from "ai";
|
|
@@ -764,11 +764,11 @@ export const useMastraChat = (
|
|
|
764
764
|
} catch (caught) {
|
|
765
765
|
if (getSession(threadId).runToken !== token) return;
|
|
766
766
|
logger.error("stream error", {
|
|
767
|
-
error:
|
|
767
|
+
error: sharedError.errorMessage(caught),
|
|
768
768
|
});
|
|
769
769
|
updateSession(threadId, (session) => ({
|
|
770
770
|
...session,
|
|
771
|
-
error:
|
|
771
|
+
error: sharedError.toError(caught),
|
|
772
772
|
status: "error",
|
|
773
773
|
abortController: session.abortController === controller ? null : session.abortController,
|
|
774
774
|
runId: runIdRef.current,
|
|
@@ -1022,7 +1022,7 @@ export const useMastraChat = (
|
|
|
1022
1022
|
logger.info("history cleared", { cleared: result.cleared });
|
|
1023
1023
|
} catch (error) {
|
|
1024
1024
|
logger.error("history clear error", {
|
|
1025
|
-
error:
|
|
1025
|
+
error: sharedError.errorMessage(error),
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
1028
|
const session = getSession(threadId);
|
|
@@ -1077,7 +1077,7 @@ export const useMastraChat = (
|
|
|
1077
1077
|
} catch (error) {
|
|
1078
1078
|
logger.error("thread delete error", {
|
|
1079
1079
|
threadId,
|
|
1080
|
-
error:
|
|
1080
|
+
error: sharedError.errorMessage(error),
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
1083
1083
|
const session = sessionsRef.current.get(threadId);
|
|
@@ -1126,7 +1126,7 @@ export const useMastraChat = (
|
|
|
1126
1126
|
} catch (error) {
|
|
1127
1127
|
logger.error("thread rename error", {
|
|
1128
1128
|
threadId,
|
|
1129
|
-
error:
|
|
1129
|
+
error: sharedError.errorMessage(error),
|
|
1130
1130
|
});
|
|
1131
1131
|
setRenamedThreads((prev) => {
|
|
1132
1132
|
if (!(threadId in prev)) return prev;
|
|
@@ -1204,7 +1204,7 @@ export const useMastraChat = (
|
|
|
1204
1204
|
.catch((error: unknown) => {
|
|
1205
1205
|
if (cancelled || (error as { name?: string }).name === "AbortError") return;
|
|
1206
1206
|
logger.error("history load error", {
|
|
1207
|
-
error:
|
|
1207
|
+
error: sharedError.errorMessage(error),
|
|
1208
1208
|
});
|
|
1209
1209
|
updateSession(threadId, (current) => ({
|
|
1210
1210
|
...current,
|
|
@@ -1246,7 +1246,7 @@ export const useMastraChat = (
|
|
|
1246
1246
|
.catch((error: unknown) => {
|
|
1247
1247
|
logger.error("history load-more error", {
|
|
1248
1248
|
page,
|
|
1249
|
-
error:
|
|
1249
|
+
error: sharedError.errorMessage(error),
|
|
1250
1250
|
});
|
|
1251
1251
|
updateSession(threadId, (current) => ({
|
|
1252
1252
|
...current,
|
|
@@ -1316,7 +1316,7 @@ export const useMastraChat = (
|
|
|
1316
1316
|
} catch (error) {
|
|
1317
1317
|
logger.error("conversation export error", {
|
|
1318
1318
|
format,
|
|
1319
|
-
error:
|
|
1319
|
+
error: sharedError.errorMessage(error),
|
|
1320
1320
|
});
|
|
1321
1321
|
}
|
|
1322
1322
|
},
|
|
@@ -1338,7 +1338,7 @@ export const useMastraChat = (
|
|
|
1338
1338
|
} catch (error) {
|
|
1339
1339
|
logger.error("message export error", {
|
|
1340
1340
|
format,
|
|
1341
|
-
error:
|
|
1341
|
+
error: sharedError.errorMessage(error),
|
|
1342
1342
|
});
|
|
1343
1343
|
}
|
|
1344
1344
|
},
|
|
@@ -1379,7 +1379,7 @@ export const useMastraChat = (
|
|
|
1379
1379
|
} catch (error) {
|
|
1380
1380
|
logger.error("feedback error", {
|
|
1381
1381
|
traceId,
|
|
1382
|
-
error:
|
|
1382
|
+
error: sharedError.errorMessage(error),
|
|
1383
1383
|
});
|
|
1384
1384
|
}
|
|
1385
1385
|
},
|
package/src/support/export.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { string } from "@dbx-tools/shared-core";
|
|
27
|
-
import { marker as
|
|
27
|
+
import { marker as sharedMarkers, type Chart, type StatementData } from "@dbx-tools/shared-mastra";
|
|
28
28
|
import type { UIMessage } from "ai";
|
|
29
29
|
import type { EChartsCoreOption } from "echarts";
|
|
30
30
|
import { normalizeChartOption } from "./chart-option.ts";
|
|
@@ -197,11 +197,11 @@ type Segment =
|
|
|
197
197
|
function splitSegments(text: string): Segment[] {
|
|
198
198
|
const segments: Segment[] = [];
|
|
199
199
|
let last = 0;
|
|
200
|
-
for (const marker of
|
|
200
|
+
for (const marker of sharedMarkers.parseMarkers(text)) {
|
|
201
201
|
if (marker.start > last) {
|
|
202
202
|
segments.push({ kind: "text", text: text.slice(last, marker.start) });
|
|
203
203
|
}
|
|
204
|
-
if (
|
|
204
|
+
if (sharedMarkers.isUuid(marker.id) && (marker.type === "chart" || marker.type === "data")) {
|
|
205
205
|
segments.push({ kind: marker.type, id: marker.id });
|
|
206
206
|
}
|
|
207
207
|
last = marker.end;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { error as
|
|
1
|
+
import { error as sharedError } from "@dbx-tools/shared-core";
|
|
2
2
|
import {
|
|
3
3
|
feedback,
|
|
4
4
|
override,
|
|
@@ -563,7 +563,7 @@ export const useMastraModels = (
|
|
|
563
563
|
})
|
|
564
564
|
.catch((e: unknown) => {
|
|
565
565
|
if (controller.signal.aborted) return;
|
|
566
|
-
setError(
|
|
566
|
+
setError(sharedError.toError(e));
|
|
567
567
|
})
|
|
568
568
|
.finally(() => {
|
|
569
569
|
if (!controller.signal.aborted) setLoading(false);
|
|
@@ -715,7 +715,7 @@ export const useMastraThreads = (
|
|
|
715
715
|
})
|
|
716
716
|
.catch((e: unknown) => {
|
|
717
717
|
if (controller.signal.aborted || (e as { name?: string }).name === "AbortError") return;
|
|
718
|
-
setError(
|
|
718
|
+
setError(sharedError.toError(e));
|
|
719
719
|
setThreads([]);
|
|
720
720
|
})
|
|
721
721
|
.finally(() => {
|
|
@@ -880,7 +880,7 @@ function useByIdFetch<T>(
|
|
|
880
880
|
})
|
|
881
881
|
.catch((e: unknown) => {
|
|
882
882
|
if (cancelled) return;
|
|
883
|
-
setError(
|
|
883
|
+
setError(sharedError.toError(e));
|
|
884
884
|
setLoading(false);
|
|
885
885
|
});
|
|
886
886
|
|