@dbx-tools/ui-mastra 0.9.181 → 0.9.182
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/index.react.ts +2 -1
- package/index.ts +1 -1
- package/package.json +8 -7
- package/src/react/_assistant-response-status.tsx +2 -2
- package/src/react/bubbles.tsx +2 -2
- package/src/react/chat-composer.tsx +11 -16
- package/src/react/chat-feedback.ts +20 -3
- package/src/react/chat-thread-layout.tsx +4 -1
- package/src/react/chat-transcript.tsx +362 -149
- package/src/react/chat-view.tsx +13 -4
- package/src/react/feedback-controls.tsx +36 -3
- package/src/react/mastra-chat.tsx +3 -3
- package/src/react/suggestion-pills.tsx +20 -8
- package/src/react/types.ts +3 -1
- package/src/react/use-composer-viewport-lock.ts +209 -0
- package/src/styles.css +15 -0
- package/src/support/mastra-client.ts +12 -4
package/index.react.ts
CHANGED
|
@@ -35,7 +35,7 @@ export { useChatSessions } from "./src/react/chat-sessions.ts";
|
|
|
35
35
|
export type { ThreadSessionReader, ThreadSessionUpdater, ThreadMessageWriter } from "./src/react/chat-sessions.ts";
|
|
36
36
|
export { readMlflowTracePart, readThreadTitlePart, chatStatusForChunk, closeOnTerminalChunk, waitForTerminalChunk, useChatStream } from "./src/react/chat-stream.ts";
|
|
37
37
|
export { ChatThreadLayout } from "./src/react/chat-thread-layout.tsx";
|
|
38
|
-
export { useChatTranscriptController, ChatTranscript } from "./src/react/chat-transcript.tsx";
|
|
38
|
+
export { latestVisibleAssistantIndexInTurn, useChatTranscriptController, ChatTranscript } from "./src/react/chat-transcript.tsx";
|
|
39
39
|
export type { ChatTranscriptController } from "./src/react/chat-transcript.tsx";
|
|
40
40
|
export { ChatView } from "./src/react/chat-view.tsx";
|
|
41
41
|
export { colorizeDelta, renderDataCell, humanizeLabel, TABLE_WRAPPER_CLASSES, DataGrid } from "./src/react/data-grid.tsx";
|
|
@@ -60,3 +60,4 @@ export type { ToolInputPresentation, WebSearchProgressGroup } from "./src/react/
|
|
|
60
60
|
export { isActiveChatStatus, isRespondingChatStatus } from "./src/react/types.ts";
|
|
61
61
|
export type { ChatStatus, ToolEvent, ToolProgress, ChatModelOption, ChatInputMessage, QueuedSteer, FeedbackValue, FeedbackSubmission, MessageFeedback, ThreadSummary, ThreadPlacement, ChatViewProps, ApprovalDecision, PendingApproval } from "./src/react/types.ts";
|
|
62
62
|
export { useChatThreadQuery } from "./src/react/use-chat-thread-query.ts";
|
|
63
|
+
export { CANCEL_TRANSCRIPT_KINETIC_SCROLL_EVENT, useComposerViewportLock } from "./src/react/use-composer-viewport-lock.ts";
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@databricks/appkit-ui": "0.81.0",
|
|
35
|
-
"@dbx-tools/shared-auth": "^0.9.
|
|
36
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
37
|
-
"@dbx-tools/shared-genie": "^0.9.
|
|
38
|
-
"@dbx-tools/shared-mastra": "^0.9.
|
|
39
|
-
"@dbx-tools/shared-model": "^0.9.
|
|
40
|
-
"@dbx-tools/ui": "^0.9.
|
|
35
|
+
"@dbx-tools/shared-auth": "^0.9.182",
|
|
36
|
+
"@dbx-tools/shared-core": "^0.9.182",
|
|
37
|
+
"@dbx-tools/shared-genie": "^0.9.182",
|
|
38
|
+
"@dbx-tools/shared-mastra": "^0.9.182",
|
|
39
|
+
"@dbx-tools/shared-model": "^0.9.182",
|
|
40
|
+
"@dbx-tools/ui": "^0.9.182",
|
|
41
41
|
"@mastra/client-js": "1.50.0",
|
|
42
42
|
"@mastra/core": "1.71.0",
|
|
43
43
|
"@tanstack/react-table": "^8.21.3",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"echarts-for-react": "^3.0.2",
|
|
47
47
|
"lucide-react": "^0.554.0",
|
|
48
48
|
"marked": "^18.0.5",
|
|
49
|
+
"scrollbooster": "4.0.0",
|
|
49
50
|
"sql-formatter": "^15.6.9",
|
|
50
51
|
"streamdown": "^2.5.0",
|
|
51
52
|
"zod": "4.3.6"
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"access": "public"
|
|
57
58
|
},
|
|
58
|
-
"version": "0.9.
|
|
59
|
+
"version": "0.9.182",
|
|
59
60
|
"types": "index.ts",
|
|
60
61
|
"dbxToolsConfig": {
|
|
61
62
|
"tags": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Spinner } from "@databricks/appkit-ui/react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { isActiveChatStatus, type ChatStatus } from "./types.ts";
|
|
4
4
|
|
|
5
5
|
/** Whether an assistant bubble should show its active-response status. */
|
|
6
6
|
export const shouldShowAssistantResponseStatus = (
|
|
7
7
|
isLast: boolean,
|
|
8
8
|
status: ChatStatus,
|
|
9
9
|
hasVisibleResponse: boolean,
|
|
10
|
-
): boolean => isLast && hasVisibleResponse &&
|
|
10
|
+
): boolean => isLast && hasVisibleResponse && isActiveChatStatus(status);
|
|
11
11
|
|
|
12
12
|
/** Compact progress affordance for an active assistant response. */
|
|
13
13
|
export const AssistantResponseSpinner = () => (
|
package/src/react/bubbles.tsx
CHANGED
|
@@ -339,7 +339,7 @@ type AssistantBubbleProps = {
|
|
|
339
339
|
feedbackRequest?: string;
|
|
340
340
|
/** Last thumbs the user left on this message, for highlighting. */
|
|
341
341
|
feedbackValue?: FeedbackValue;
|
|
342
|
-
/** MLflow trace link shown only to viewers with `
|
|
342
|
+
/** MLflow trace link shown only to viewers with `CAN_READ` or higher. */
|
|
343
343
|
mlflowTraceUrl?: string;
|
|
344
344
|
};
|
|
345
345
|
|
|
@@ -453,7 +453,7 @@ export const AssistantBubble = ({
|
|
|
453
453
|
/>
|
|
454
454
|
))}
|
|
455
455
|
{showFooter && (
|
|
456
|
-
<div className="flex min-h-7 items-center gap-1">
|
|
456
|
+
<div className="flex min-h-7 flex-nowrap items-center gap-1">
|
|
457
457
|
{hasText && isLast && regenerate && (
|
|
458
458
|
<Tooltip>
|
|
459
459
|
<TooltipTrigger asChild>
|
|
@@ -33,7 +33,6 @@ import { autosizeComposerTextarea, observeComposerWidth } from "./_composer-auto
|
|
|
33
33
|
import { imageFileToUIPart, MAX_COMPOSER_IMAGES } from "./_image-attachments.ts";
|
|
34
34
|
import { ModelSelector } from "./_model-selector.tsx";
|
|
35
35
|
import { ExportMenu } from "./export-menu.tsx";
|
|
36
|
-
import { SuggestionPills } from "./suggestion-pills.tsx";
|
|
37
36
|
import { isActiveChatStatus, isRespondingChatStatus, type ChatViewProps } from "./types.ts";
|
|
38
37
|
|
|
39
38
|
type QueuedSteerListProps = {
|
|
@@ -236,7 +235,7 @@ const ClearConversationAction = ({ onClear, isLoadingHistory }: ClearConversatio
|
|
|
236
235
|
};
|
|
237
236
|
|
|
238
237
|
type ChatComposerProps = {
|
|
239
|
-
|
|
238
|
+
focusRequest: number;
|
|
240
239
|
status: ChatViewProps["status"];
|
|
241
240
|
sendMessage: ChatViewProps["sendMessage"];
|
|
242
241
|
queuedSteers: NonNullable<ChatViewProps["queuedSteers"]>;
|
|
@@ -244,7 +243,6 @@ type ChatComposerProps = {
|
|
|
244
243
|
onRemoveSteer: ChatViewProps["onRemoveSteer"];
|
|
245
244
|
onReorderSteers: ChatViewProps["onReorderSteers"];
|
|
246
245
|
onStop: ChatViewProps["onStop"];
|
|
247
|
-
suggestions: NonNullable<ChatViewProps["suggestions"]>;
|
|
248
246
|
models: ChatViewProps["models"];
|
|
249
247
|
model: ChatViewProps["model"];
|
|
250
248
|
onModelChange: ChatViewProps["onModelChange"];
|
|
@@ -265,7 +263,7 @@ type ChatComposerProps = {
|
|
|
265
263
|
|
|
266
264
|
/** Internal message composer with queued steers and conversation actions. */
|
|
267
265
|
export const ChatComposer = ({
|
|
268
|
-
|
|
266
|
+
focusRequest,
|
|
269
267
|
status,
|
|
270
268
|
sendMessage,
|
|
271
269
|
queuedSteers,
|
|
@@ -273,7 +271,6 @@ export const ChatComposer = ({
|
|
|
273
271
|
onRemoveSteer,
|
|
274
272
|
onReorderSteers,
|
|
275
273
|
onStop,
|
|
276
|
-
suggestions,
|
|
277
274
|
models,
|
|
278
275
|
model,
|
|
279
276
|
onModelChange,
|
|
@@ -316,6 +313,11 @@ export const ChatComposer = ({
|
|
|
316
313
|
return observeComposerWidth(group, resizeTextarea);
|
|
317
314
|
}, [resizeTextarea]);
|
|
318
315
|
|
|
316
|
+
useLayoutEffect(() => {
|
|
317
|
+
if (focusRequest === 0 || isLoadingHistory) return;
|
|
318
|
+
textareaRef.current?.focus({ preventScroll: true });
|
|
319
|
+
}, [focusRequest, isLoadingHistory]);
|
|
320
|
+
|
|
319
321
|
const isRunning = isActiveChatStatus(status);
|
|
320
322
|
const canStop = isRespondingChatStatus(status);
|
|
321
323
|
const hasDraft = Boolean(input.trim() || files.length > 0);
|
|
@@ -364,20 +366,13 @@ export const ChatComposer = ({
|
|
|
364
366
|
|
|
365
367
|
const modelChangeable = Boolean(models && models.length > 0);
|
|
366
368
|
return (
|
|
367
|
-
|
|
368
|
-
{isEmpty && !isLoadingHistory && (
|
|
369
|
-
<SuggestionPills
|
|
370
|
-
questions={suggestions}
|
|
371
|
-
onSelect={(text) => sendMessage({ text })}
|
|
372
|
-
className="mx-auto w-full max-w-4xl px-4 pb-2 md:px-6"
|
|
373
|
-
/>
|
|
374
|
-
)}
|
|
369
|
+
<div data-slot="aui_composer-dock" className="shrink-0 bg-background">
|
|
375
370
|
<form
|
|
376
371
|
onSubmit={(event) => {
|
|
377
372
|
event.preventDefault();
|
|
378
373
|
submit();
|
|
379
374
|
}}
|
|
380
|
-
className="mx-auto w-full max-w-4xl px-3 pt-2 pb-[max(1rem,env(safe-area-inset-bottom))] md:px-6"
|
|
375
|
+
className="mx-auto w-full max-w-4xl shrink-0 px-3 pt-2 pb-[max(1rem,env(safe-area-inset-bottom))] md:px-6"
|
|
381
376
|
>
|
|
382
377
|
<QueuedSteerList
|
|
383
378
|
queuedSteers={queuedSteers}
|
|
@@ -473,7 +468,7 @@ export const ChatComposer = ({
|
|
|
473
468
|
}}
|
|
474
469
|
placeholder="Send a message..."
|
|
475
470
|
rows={1}
|
|
476
|
-
className="field-sizing-fixed min-h-10 max-h-64 w-full flex-none overflow-y-auto px-4 pb-2 pt-4 text-sm"
|
|
471
|
+
className="aui-composer-input field-sizing-fixed min-h-10 max-h-64 w-full flex-none overflow-y-auto px-4 pb-2 pt-4 text-base sm:text-sm"
|
|
477
472
|
/>
|
|
478
473
|
{allowAttachments && fileError && (
|
|
479
474
|
<div className="px-4 text-xs text-destructive" role="alert">
|
|
@@ -588,6 +583,6 @@ export const ChatComposer = ({
|
|
|
588
583
|
</InputGroupAddon>
|
|
589
584
|
</InputGroup>
|
|
590
585
|
</form>
|
|
591
|
-
|
|
586
|
+
</div>
|
|
592
587
|
);
|
|
593
588
|
};
|
|
@@ -65,13 +65,30 @@ export function messageFeedbackDestination(
|
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
/** Build the Databricks MLflow detail URL for one captured trace. */
|
|
69
|
-
export function mlflowTraceUrl(
|
|
68
|
+
/** Build the Databricks MLflow detail URL for one captured UC trace. */
|
|
69
|
+
export function mlflowTraceUrl(
|
|
70
|
+
experimentUrl: string,
|
|
71
|
+
traceId?: string,
|
|
72
|
+
tracePrefix?: string,
|
|
73
|
+
): string | undefined {
|
|
70
74
|
const resolvedTraceId = traceId?.trim();
|
|
71
75
|
if (!resolvedTraceId) return undefined;
|
|
72
76
|
const url = new URL(experimentUrl);
|
|
73
|
-
|
|
77
|
+
const organizationId = url.searchParams.get("o");
|
|
78
|
+
url.pathname = `${url.pathname.replace(/\/+$/, "")}/traces`;
|
|
74
79
|
url.search = "";
|
|
80
|
+
if (organizationId) url.searchParams.set("o", organizationId);
|
|
81
|
+
url.searchParams.set("selectedEvaluationId", resolvedTraceId);
|
|
82
|
+
const resolvedTracePrefix = tracePrefix
|
|
83
|
+
?.trim()
|
|
84
|
+
.replace(/^trace:\/+/, "")
|
|
85
|
+
.replace(/^\/+|\/+$/g, "");
|
|
86
|
+
if (resolvedTracePrefix) {
|
|
87
|
+
url.searchParams.set(
|
|
88
|
+
"traceId",
|
|
89
|
+
`trace:/${resolvedTracePrefix}/${resolvedTraceId.replace(/^tr-/, "")}`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
75
92
|
url.hash = "";
|
|
76
93
|
return url.toString();
|
|
77
94
|
}
|
|
@@ -11,6 +11,7 @@ import React, { useEffect, useRef, useState } from "react";
|
|
|
11
11
|
import { ThreadSidebar, type ThreadSidebarProps } from "./thread-sidebar.tsx";
|
|
12
12
|
import { ThreadTabs } from "./thread-tabs.tsx";
|
|
13
13
|
import type { ChatViewProps } from "./types.ts";
|
|
14
|
+
import { useComposerViewportLock } from "./use-composer-viewport-lock.ts";
|
|
14
15
|
import { closeThreadTab, nextActiveThreadTab, syncThreadTabs } from "../support/thread-tabs.ts";
|
|
15
16
|
|
|
16
17
|
const SIDE_PANEL_MIN_WIDTH_PX = 768;
|
|
@@ -111,6 +112,7 @@ export const ChatThreadLayout = ({
|
|
|
111
112
|
onToggleSidebar,
|
|
112
113
|
}: ChatThreadLayoutProps) => {
|
|
113
114
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
115
|
+
useComposerViewportLock(rootRef);
|
|
114
116
|
const isNarrow = useIsNarrow(rootRef);
|
|
115
117
|
const showThreads = Boolean(threads && onSelectThread) && threadPlacement !== "disabled";
|
|
116
118
|
const placement = threadPlacement === "auto" ? (isNarrow ? "top" : "left") : threadPlacement;
|
|
@@ -187,6 +189,7 @@ export const ChatThreadLayout = ({
|
|
|
187
189
|
<TooltipProvider delayDuration={200}>
|
|
188
190
|
<div
|
|
189
191
|
ref={rootRef}
|
|
192
|
+
data-slot="aui_thread-frame"
|
|
190
193
|
className={cn(
|
|
191
194
|
"flex h-full min-h-0",
|
|
192
195
|
dockedThreads && dockedSide === "right" && "flex-row-reverse",
|
|
@@ -208,7 +211,7 @@ export const ChatThreadLayout = ({
|
|
|
208
211
|
: inlineSidebarOpen && (
|
|
209
212
|
<ThreadSidebar {...threadListProps} onHide={toggleSidebar} side={dockedSide} />
|
|
210
213
|
))}
|
|
211
|
-
<div className="flex h-full min-w-0 flex-1 flex-col">
|
|
214
|
+
<div className="flex h-full min-h-0 min-w-0 flex-1 flex-col">
|
|
212
215
|
{tabbedThreads && (
|
|
213
216
|
<ThreadTabs
|
|
214
217
|
{...threadTabListProps}
|