@mcp-b/react-components 0.28.0 → 0.29.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.
@@ -76,6 +76,13 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
76
76
  showComposer?: boolean;
77
77
  /** Called when the user hits stop while `status` is streaming/submitted. */
78
78
  onStop?: () => void;
79
+ /**
80
+ * Called when a submission lands in the pending queue instead of going out
81
+ * (the composer was busy). Hosts with an autonomous continuation mode (goal
82
+ * mode) pause it here: a user who queues a message expects it to run next,
83
+ * not to race the loop's own next turn.
84
+ */
85
+ onPromptQueued?: () => void;
79
86
  placeholder?: string;
80
87
  disabled?: boolean;
81
88
  /** Rendered in place of the transcript while `messages` is empty. */
@@ -254,6 +261,7 @@ declare function AgentChat<MessageT extends UIMessage = UIMessage>({
254
261
  onSubmit,
255
262
  showComposer,
256
263
  onStop,
264
+ onPromptQueued,
257
265
  placeholder,
258
266
  disabled,
259
267
  emptyState,
@@ -1,5 +1,5 @@
1
1
  import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-CyD2UB3V.js";
2
- import { r as AgentChatProps } from "./AgentChat-CHEz8ts_.js";
2
+ import { r as AgentChatProps } from "./AgentChat-Dy3cKCd-.js";
3
3
  import { l as ThinkChatPart } from "./ThinkChatToolParts-BfroXQ4F.js";
4
4
  import { t as ThinkChatActivityDescription } from "./ThinkChatActivitySummary-F062wneC.js";
5
5
  import * as React from "react";
@@ -1,2 +1,2 @@
1
- import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, r as AgentChatProps, t as AgentChat } from "../AgentChat-CHEz8ts_.js";
1
+ import { a as PermissionModeControl, i as AgentChatRenderMessageContext, n as AgentChatComposerDraft, r as AgentChatProps, t as AgentChat } from "../AgentChat-Dy3cKCd-.js";
2
2
  export { AgentChat, AgentChatComposerDraft, AgentChatProps, AgentChatRenderMessageContext, PermissionModeControl };
@@ -210,11 +210,12 @@ const AgentChatTranscriptRowBody = React.memo(AgentChatTranscriptRowBodyImpl);
210
210
  * announce re-inserted old rows as new); announce new messages from a
211
211
  * host-owned live region if that matters.
212
212
  */
213
- function AgentChat({ className, messages, status = "ready", onSubmit, showComposer = onSubmit !== void 0, onStop, placeholder = "Ask anything...", disabled, emptyState, startScreen, composerHeader, composerTray, composerTools, slashCommands, onCompact, mentionCommands, contextSelector, composerEndTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, approvalsEnabled = true, permissionModeControl, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, showAssistantActions, ref }) {
213
+ function AgentChat({ className, messages, status = "ready", onSubmit, showComposer = onSubmit !== void 0, onStop, onPromptQueued, placeholder = "Ask anything...", disabled, emptyState, startScreen, composerHeader, composerTray, composerTools, slashCommands, onCompact, mentionCommands, contextSelector, composerEndTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, approvalsEnabled = true, permissionModeControl, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, showAssistantActions, ref }) {
214
214
  const [copyAnnouncement, setCopyAnnouncement] = React.useState("");
215
215
  const [composerDraft, setComposerDraft] = React.useState("");
216
216
  const [composerReferences, setComposerReferences] = React.useState([]);
217
217
  const [pendingPrompts, setPendingPrompts] = React.useState([]);
218
+ const [queueHeld, setQueueHeld] = React.useState(false);
218
219
  const busy = status === "submitted" || status === "streaming";
219
220
  const wasBusy = React.useRef(busy);
220
221
  const addComposerReference = React.useCallback((reference) => {
@@ -240,30 +241,42 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
240
241
  ...message,
241
242
  ...composerReferences.length ? { references: composerReferences } : {}
242
243
  };
243
- const submission = busy || pendingPrompts.length ? setPendingPrompts((current) => [...current, {
244
- id: crypto.randomUUID(),
245
- message: prompt
246
- }]) : onSubmit?.(prompt);
244
+ setQueueHeld(false);
247
245
  setComposerDraft("");
248
246
  setComposerReferences([]);
249
- return submission;
247
+ if (busy || pendingPrompts.length && !queueHeld) {
248
+ setPendingPrompts((current) => [...current, {
249
+ id: crypto.randomUUID(),
250
+ message: prompt
251
+ }]);
252
+ onPromptQueued?.();
253
+ return;
254
+ }
255
+ return onSubmit?.(prompt);
250
256
  }, [
251
257
  busy,
252
258
  composerReferences,
259
+ onPromptQueued,
253
260
  onSubmit,
254
- pendingPrompts.length
261
+ pendingPrompts.length,
262
+ queueHeld
255
263
  ]);
264
+ const handleStop = React.useMemo(() => onStop ? () => {
265
+ setQueueHeld(true);
266
+ onStop();
267
+ } : void 0, [onStop]);
256
268
  React.useEffect(() => {
257
269
  const becameReady = wasBusy.current && !busy;
258
270
  wasBusy.current = busy;
259
271
  const next = pendingPrompts[0];
260
- if (!becameReady || !next || !onSubmit) return;
272
+ if (!becameReady || queueHeld || !next || !onSubmit) return;
261
273
  setPendingPrompts((current) => current.slice(1));
262
274
  onSubmit(next.message);
263
275
  }, [
264
276
  busy,
265
277
  onSubmit,
266
- pendingPrompts
278
+ pendingPrompts,
279
+ queueHeld
267
280
  ]);
268
281
  const [compactionNotice, setCompactionNotice] = React.useState(null);
269
282
  const compactionInFlight = React.useRef(false);
@@ -558,7 +571,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, showCompos
558
571
  }) : null,
559
572
  /* @__PURE__ */ jsx(AgentChatSubmitAction, {
560
573
  status,
561
- onStop,
574
+ onStop: handleStop,
562
575
  disabled,
563
576
  hasDraft: Boolean(composerDraft.trim() || composerReferences.length)
564
577
  })
@@ -1,9 +1,9 @@
1
1
  import { i as AgentMessageRenderPartContext } from "../AgentMessageParts-CyD2UB3V.js";
2
- import { r as AgentChatProps } from "../AgentChat-CHEz8ts_.js";
2
+ import { r as AgentChatProps } from "../AgentChat-Dy3cKCd-.js";
3
3
  import { i as useOptionalAgentToolRuns, n as AgentToolRunsProvider, r as AgentToolRunsProviderProps, t as AgentToolEventsValue } from "../AgentToolRunsContext-BVe4stgw.js";
4
4
  import { S as isThinkChatActivityPart } from "../ThinkChatToolParts-BfroXQ4F.js";
5
5
  import { u as describeThinkChatActivityPart } from "../ThinkChatActivitySummary-F062wneC.js";
6
- import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-C2uaL3el.js";
6
+ import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-Dq0lOAgw.js";
7
7
  import { i as ThinkChatValue } from "../ThinkChatContext-B-Nk84Wi.js";
8
8
  import { n as ThinkRecoveryNoticeProps, t as ThinkRecoveryNotice } from "../ThinkRecoveryNotice-D6gYcBbr.js";
9
9
  import { a as UseSessionCompactionResult } from "../SessionCompaction-DMa1vv6Y.js";
@@ -76,6 +76,8 @@ interface ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> extends
76
76
  composerHeader?: AgentChatProps<MessageT>["composerHeader"];
77
77
  /** Persistent context (e.g. the Goal banner) in the tray above the composer. */
78
78
  composerTray?: AgentChatProps<MessageT>["composerTray"];
79
+ /** Called when a submission is queued behind a busy turn; see AgentChat. */
80
+ onPromptQueued?: AgentChatProps<MessageT>["onPromptQueued"];
79
81
  /** Extra rows rendered in the built-in plus menu after files. */
80
82
  composerAddMenuItems?: AgentChatProps<MessageT>["composerAddMenuItems"];
81
83
  /** Composer placeholder text. */
@@ -1,4 +1,4 @@
1
1
  import { S as isThinkChatActivityPart } from "../ThinkChatToolParts-BfroXQ4F.js";
2
2
  import { u as describeThinkChatActivityPart } from "../ThinkChatActivitySummary-F062wneC.js";
3
- import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-C2uaL3el.js";
3
+ import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../ThinkChatActivity-Dq0lOAgw.js";
4
4
  export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, describeThinkChatActivityPart, isThinkChatActivityPart, renderThinkChatActivityPart };
@@ -75,7 +75,7 @@ declare const CHECKED_IN_CODEX_MODELS: readonly [{
75
75
  readonly upgradeInfo: null;
76
76
  readonly availabilityNux: null;
77
77
  readonly hidden: boolean;
78
- readonly inputModalities: ("image" | "text")[];
78
+ readonly inputModalities: ("text" | "image")[];
79
79
  readonly supportsPersonality: boolean;
80
80
  readonly additionalSpeedTiers: never[];
81
81
  readonly serviceTiers: never[];
@@ -92,7 +92,7 @@ declare const CHECKED_IN_CODEX_MODELS: readonly [{
92
92
  readonly upgradeInfo: null;
93
93
  readonly availabilityNux: null;
94
94
  readonly hidden: boolean;
95
- readonly inputModalities: ("image" | "text")[];
95
+ readonly inputModalities: ("text" | "image")[];
96
96
  readonly supportsPersonality: boolean;
97
97
  readonly additionalSpeedTiers: never[];
98
98
  readonly serviceTiers: never[];
@@ -109,7 +109,7 @@ declare const CHECKED_IN_CODEX_MODELS: readonly [{
109
109
  readonly upgradeInfo: null;
110
110
  readonly availabilityNux: null;
111
111
  readonly hidden: boolean;
112
- readonly inputModalities: ("image" | "text")[];
112
+ readonly inputModalities: ("text" | "image")[];
113
113
  readonly supportsPersonality: boolean;
114
114
  readonly additionalSpeedTiers: never[];
115
115
  readonly serviceTiers: never[];
@@ -126,7 +126,7 @@ declare const CHECKED_IN_CODEX_MODELS: readonly [{
126
126
  readonly upgradeInfo: null;
127
127
  readonly availabilityNux: null;
128
128
  readonly hidden: boolean;
129
- readonly inputModalities: ("image" | "text")[];
129
+ readonly inputModalities: ("text" | "image")[];
130
130
  readonly supportsPersonality: boolean;
131
131
  readonly additionalSpeedTiers: never[];
132
132
  readonly serviceTiers: never[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/react-components",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "MCP-B React components built on Base UI and shared design tokens, including Cloudflare Think chat primitives.",
5
5
  "homepage": "https://design-system.sigvelo.com",
6
6
  "bugs": {
@@ -58,7 +58,7 @@
58
58
  "streamdown": "^2.5.0",
59
59
  "unist-util-visit": "^5.1.0",
60
60
  "yet-another-react-lightbox": "^3.32.1",
61
- "@mcp-b/design-tokens": "0.28.0"
61
+ "@mcp-b/design-tokens": "0.29.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@ai-sdk/react": "^3.0.230",