@dbx-tools/ui-mastra 0.6.213 → 0.6.214

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/README.md CHANGED
@@ -101,6 +101,8 @@ Useful options:
101
101
 
102
102
  - `agentId` selects a registered agent; defaults to the plugin default agent.
103
103
  - `showModelPicker` fetches `/models` and sends `X-Mastra-Model` overrides.
104
+ - `composerActions` places host-owned per-turn controls beside the model
105
+ selector without replacing the built-in composer.
104
106
  - `suggestions` overrides Genie starter questions; omit it to auto-fetch
105
107
  `/suggestions`, or pass `[]` to hide suggestions.
106
108
  - `threadPlacement` chooses where conversation management renders, or turns it
package/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/ui-mastra";
6
- export const PACKAGE_VERSION = "0.6.213";
6
+ export const PACKAGE_VERSION = "0.6.214";
7
7
  export * as reactBubbles from "./src/react/bubbles.tsx";
8
8
  export * as reactChatApprovals from "./src/react/chat-approvals.ts";
9
9
  export * as reactChatComposer from "./src/react/chat-composer.tsx";
package/package.json CHANGED
@@ -31,12 +31,12 @@
31
31
  "react-dom": "~19.2.4"
32
32
  },
33
33
  "dependencies": {
34
- "@dbx-tools/shared-core": "0.6.213",
35
- "@dbx-tools/shared-genie": "0.6.213",
36
- "@dbx-tools/shared-mastra": "0.6.213",
37
- "@dbx-tools/shared-model": "0.6.213",
38
- "@dbx-tools/ui-appkit": "0.6.213",
39
- "@dbx-tools/ui-branding": "0.6.213",
34
+ "@dbx-tools/shared-core": "0.6.214",
35
+ "@dbx-tools/shared-genie": "0.6.214",
36
+ "@dbx-tools/shared-mastra": "0.6.214",
37
+ "@dbx-tools/shared-model": "0.6.214",
38
+ "@dbx-tools/ui-appkit": "0.6.214",
39
+ "@dbx-tools/ui-branding": "0.6.214",
40
40
  "@mastra/client-js": "1.28.0",
41
41
  "@tanstack/react-table": "^8.21.3",
42
42
  "ai": "^5.0.0",
@@ -52,7 +52,7 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "version": "0.6.213",
55
+ "version": "0.6.214",
56
56
  "type": "module",
57
57
  "exports": {
58
58
  "./react": "./src/react/index.ts",
@@ -249,6 +249,7 @@ type ChatComposerProps = {
249
249
  model: ChatViewProps["model"];
250
250
  onModelChange: ChatViewProps["onModelChange"];
251
251
  defaultModelName: ChatViewProps["defaultModelName"];
252
+ composerActions: ChatViewProps["composerActions"];
252
253
  isLoadingHistory: NonNullable<ChatViewProps["isLoadingHistory"]>;
253
254
  onClear: ChatViewProps["onClear"];
254
255
  onExportConversation: ChatViewProps["onExportConversation"];
@@ -270,6 +271,7 @@ export const ChatComposer = ({
270
271
  model,
271
272
  onModelChange,
272
273
  defaultModelName,
274
+ composerActions,
273
275
  isLoadingHistory,
274
276
  onClear,
275
277
  onExportConversation,
@@ -305,7 +307,11 @@ export const ChatComposer = ({
305
307
  sensitivity: "base",
306
308
  }),
307
309
  );
308
- const showToolbar = showModelDisplay || Boolean(onExportConversation) || Boolean(onClear);
310
+ const showToolbar =
311
+ showModelDisplay ||
312
+ Boolean(composerActions) ||
313
+ Boolean(onExportConversation) ||
314
+ Boolean(onClear);
309
315
 
310
316
  return (
311
317
  <>
@@ -401,6 +407,7 @@ export const ChatComposer = ({
401
407
  {currentModelLabel}
402
408
  </span>
403
409
  ))}
410
+ {composerActions}
404
411
  {onExportConversation && (
405
412
  <ExportMenu
406
413
  onExport={(format) => void onExportConversation(format)}
@@ -1,3 +1,4 @@
1
+ import { error as sharedError } from "@dbx-tools/shared-core";
1
2
  import { GenieWriterEventSchema, type MastraStreamChunk } from "@dbx-tools/shared-mastra";
2
3
  import type { UIMessage } from "ai";
3
4
  import type { PendingApproval, ToolEvent } from "./types.ts";
@@ -228,8 +229,9 @@ export function reduceChatStreamChunk(
228
229
  const detail = chunk.payload?.error ?? chunk.payload?.message;
229
230
  return reduction(state, {
230
231
  runIdChanged: run.changed,
231
- error:
232
- typeof detail === "string" && detail ? detail : "The assistant stream reported an error.",
232
+ error: detail
233
+ ? sharedError.errorMessage(detail)
234
+ : "The assistant stream reported an error.",
233
235
  });
234
236
  }
235
237
 
@@ -28,6 +28,7 @@ export const ChatView = ({
28
28
  model,
29
29
  onModelChange,
30
30
  defaultModelName,
31
+ composerActions,
31
32
  onLoadMore,
32
33
  isLoadingMore = false,
33
34
  hasMore = false,
@@ -108,6 +109,7 @@ export const ChatView = ({
108
109
  model={model}
109
110
  onModelChange={onModelChange}
110
111
  defaultModelName={defaultModelName}
112
+ composerActions={composerActions}
111
113
  isLoadingHistory={isLoadingHistory}
112
114
  onClear={onClear}
113
115
  onExportConversation={onExportConversation}
@@ -2,7 +2,7 @@ import { error as sharedError, hash, log } from "@dbx-tools/shared-core";
2
2
  import type { MastraThread } from "@dbx-tools/shared-mastra";
3
3
  import { useBrand } from "@dbx-tools/ui-branding/react";
4
4
  import type { UIMessage } from "ai";
5
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
+ import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { useChatApprovals } from "./chat-approvals.ts";
7
7
  import { ChatView } from "./chat-view.tsx";
8
8
  import { useChatFeedback } from "./chat-feedback.ts";
@@ -985,6 +985,8 @@ export const useMastraChat = (
985
985
  export interface MastraChatProps extends UseMastraChatOptions {
986
986
  /** Extra classes merged onto the chat's root layout container. */
987
987
  className?: string;
988
+ /** Host controls placed beside the model picker in the composer toolbar. */
989
+ composerActions?: ReactNode;
988
990
  }
989
991
 
990
992
  /**
@@ -1000,7 +1002,7 @@ export interface MastraChatProps extends UseMastraChatOptions {
1000
1002
  * `threadPlacement` (`auto` docks it left and falls back to a tab strip on a
1001
1003
  * narrow chat) and turned off with `threadPlacement: "disabled"`.
1002
1004
  */
1003
- export const MastraChat = ({ className, ...options }: MastraChatProps) => {
1005
+ export const MastraChat = ({ className, composerActions, ...options }: MastraChatProps) => {
1004
1006
  const chat = useMastraChat(options);
1005
- return <ChatView {...chat} className={className} />;
1007
+ return <ChatView {...chat} className={className} composerActions={composerActions} />;
1006
1008
  };
@@ -1,5 +1,6 @@
1
1
  import type { GenieWriterEvent } from "@dbx-tools/shared-mastra";
2
2
  import type { UIMessage } from "ai";
3
+ import type { ReactNode } from "react";
3
4
  import type { ExportFormat } from "../support/export.ts";
4
5
 
5
6
  export type { ExportFormat } from "../support/export.ts";
@@ -170,6 +171,12 @@ export type ChatViewProps = {
170
171
  * a neutral "Default". Never a raw endpoint id.
171
172
  */
172
173
  defaultModelName?: string;
174
+ /**
175
+ * Host-owned controls rendered in the composer toolbar immediately after the
176
+ * model selector. Use this for per-turn options that belong beside model
177
+ * routing without forking the chat surface.
178
+ */
179
+ composerActions?: ReactNode;
173
180
  /**
174
181
  * Optional infinite-scroll-up handler. Fired when the user scrolls
175
182
  * within `TOP_LOAD_MORE_THRESHOLD_PX` of the top of the