@mcp-b/react-components 0.35.0 → 0.37.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.
Files changed (184) hide show
  1. package/dist/{AgentChat-mpacmRU1.d.ts → AgentChat-CVO7xyLC.d.ts} +1 -1
  2. package/dist/{CodeBlock-DzGhYyNe.d.ts → CodeBlock-C380GD5t.d.ts} +2 -5
  3. package/dist/{CodeBlock-CM5gfmdq.js → CodeBlock-DO4Hdu1R.js} +4 -3
  4. package/dist/{Dialog-DeOSJ0Oy.d.ts → Dialog-B_FhRWaz.d.ts} +22 -37
  5. package/dist/{FileTree-4WP4Uc_m.js → FileTree-DbQMpvxV.js} +1 -1
  6. package/dist/{Menu-DVmjBIuM.d.ts → Menu-yb6QXWA3.d.ts} +64 -75
  7. package/dist/{PromptInput-DOyee1kM.d.ts → PromptInput-BRX7FhjH.d.ts} +7 -272
  8. package/dist/ResponsiveSidebarShell-DWjULskY.d.ts +68 -0
  9. package/dist/{Select-D96d09ww.d.ts → Select-RrceeEIe.d.ts} +17 -52
  10. package/dist/{ThinkChat-DbzqSTBt.js → ThinkChat-DQh59CeC.js} +6 -8
  11. package/dist/{ThinkChatActivity-BZyN5MBg.d.ts → ThinkChatActivity-Dkmm2pIj.d.ts} +1 -1
  12. package/dist/{ToggleGroup-CSBWfPXo.d.ts → ToggleGroup-_pQMyHGM.d.ts} +5 -7
  13. package/dist/{WorkspaceFile-CVAzjTt6.d.ts → WorkspaceFile-BLaFmMrt.d.ts} +1 -1
  14. package/dist/{WorkspaceFileView-BmxSbhRu.js → WorkspaceFileView-Cu_ZG6HJ.js} +11 -17
  15. package/dist/components/agents-sdk/AgentActivity.js +1 -1
  16. package/dist/components/agents-sdk/AgentActivityPreview.js +4 -4
  17. package/dist/components/agents-sdk/AgentChat.d.ts +1 -1
  18. package/dist/components/agents-sdk/AgentChat.js +36 -30
  19. package/dist/components/agents-sdk/BrowserLiveView.d.ts +47 -1
  20. package/dist/components/agents-sdk/BrowserLiveView.js +2 -2
  21. package/dist/components/agents-sdk/BrowserReplay.d.ts +40 -1
  22. package/dist/components/agents-sdk/BrowserReplay.js +1 -1
  23. package/dist/components/agents-sdk/BrowserRunPanel.js +2 -2
  24. package/dist/components/agents-sdk/McpConnectionRequest.js +15 -16
  25. package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
  26. package/dist/components/agents-sdk/McpPluginCatalog.d.ts +1 -1
  27. package/dist/components/agents-sdk/McpPluginCatalog.js +19 -26
  28. package/dist/components/agents-sdk/McpServerPicker.d.ts +2 -2
  29. package/dist/components/agents-sdk/McpServerPicker.js +20 -18
  30. package/dist/components/agents-sdk/ModelSelector.d.ts +9 -9
  31. package/dist/components/agents-sdk/ModelSelector.js +504 -1
  32. package/dist/components/agents-sdk/PromptInputApproval.js +1 -1
  33. package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
  34. package/dist/components/agents-sdk/PromptInputCommands.js +1 -1
  35. package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
  36. package/dist/components/agents-sdk/SubagentRunSelector.js +2 -2
  37. package/dist/components/agents-sdk/ThinkChat.d.ts +17 -107
  38. package/dist/components/agents-sdk/ThinkChat.js +2 -12
  39. package/dist/components/agents-sdk/ThinkChatActivity.d.ts +2 -4
  40. package/dist/components/agents-sdk/ThinkChatActivity.js +2 -2
  41. package/dist/components/agents-sdk/ThinkChatToolPanels.js +2 -2
  42. package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
  43. package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
  44. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
  45. package/dist/components/agents-sdk/ThinkFullApp.d.ts +4 -4
  46. package/dist/components/agents-sdk/ThinkFullApp.js +10 -14
  47. package/dist/components/agents-sdk/ThinkFullAppViewSwitch.d.ts +1 -1
  48. package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +1 -1
  49. package/dist/components/agents-sdk/ThinkRecoveryNotice.js +1 -1
  50. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +2 -2
  51. package/dist/components/agents-sdk/ThinkRoutineDetail.js +1 -1
  52. package/dist/components/agents-sdk/ThinkRoutineForm.js +3 -3
  53. package/dist/components/agents-sdk/ThinkRoutineLibrary.d.ts +2 -3
  54. package/dist/components/agents-sdk/ThinkRoutineLibrary.js +4 -4
  55. package/dist/components/agents-sdk/ThinkRoutineRuns.js +2 -2
  56. package/dist/components/agents-sdk/ThinkThreadPicker.js +6 -7
  57. package/dist/components/agents-sdk/ThinkThreadShell.d.ts +1 -1
  58. package/dist/components/agents-sdk/Workspace.d.ts +140 -2
  59. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
  60. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  61. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +32 -5
  62. package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -5
  63. package/dist/components/agents-sdk/WorkspaceFile.d.ts +1 -1
  64. package/dist/components/agents-sdk/WorkspaceFileView.d.ts +1 -1
  65. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  66. package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
  67. package/dist/components/agents-sdk/WorkspaceMountManager.js +2 -2
  68. package/dist/components/ai-sdk/Activity.d.ts +5 -0
  69. package/dist/components/ai-sdk/Activity.js +34 -14
  70. package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
  71. package/dist/components/ai-sdk/Approval.js +2 -2
  72. package/dist/components/ai-sdk/Artifact.js +1 -1
  73. package/dist/components/ai-sdk/ChainOfThought.js +1 -1
  74. package/dist/components/ai-sdk/Checkpoint.js +1 -1
  75. package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
  76. package/dist/components/ai-sdk/CodeBlock.js +1 -1
  77. package/dist/components/ai-sdk/Conversation.js +1 -1
  78. package/dist/components/ai-sdk/Goal.js +1 -1
  79. package/dist/components/ai-sdk/InlineCitation.js +1 -1
  80. package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
  81. package/dist/components/ai-sdk/Message.js +2 -6
  82. package/dist/components/ai-sdk/MessageScroller.d.ts +5 -0
  83. package/dist/components/ai-sdk/MessageScroller.js +19 -13
  84. package/dist/components/ai-sdk/MessageScrollerVirtual.js +19 -11
  85. package/dist/components/ai-sdk/Plan.js +1 -1
  86. package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
  87. package/dist/components/ai-sdk/PromptInput.js +126 -129
  88. package/dist/components/ai-sdk/Queue.js +2 -2
  89. package/dist/components/ai-sdk/Reasoning.d.ts +3 -4
  90. package/dist/components/ai-sdk/Reasoning.js +30 -14
  91. package/dist/components/ai-sdk/Sources.js +1 -1
  92. package/dist/components/ai-sdk/Task.js +1 -1
  93. package/dist/components/ai-sdk/ToolInvocation.d.ts +3 -5
  94. package/dist/components/extension/ChatGptSignInScreen.js +3 -3
  95. package/dist/components/extension/CodexModelSelector.d.ts +1 -1
  96. package/dist/components/extension/CodexModelSelector.js +2 -2
  97. package/dist/components/extension/ConversationTabPicker.js +3 -3
  98. package/dist/components/foundations/Accordion.d.ts +1 -3
  99. package/dist/components/foundations/Accordion.js +1 -3
  100. package/dist/components/foundations/AlertDialog.d.ts +16 -36
  101. package/dist/components/foundations/Autocomplete.d.ts +12 -33
  102. package/dist/components/foundations/Autocomplete.js +2 -1
  103. package/dist/components/foundations/Card.d.ts +3 -3
  104. package/dist/components/foundations/Card.js +3 -3
  105. package/dist/components/foundations/Checkbox.js +1 -1
  106. package/dist/components/foundations/Collapsible.js +1 -1
  107. package/dist/components/foundations/Combobox.d.ts +119 -2
  108. package/dist/components/foundations/Combobox.js +6 -23
  109. package/dist/components/foundations/ContextMenu.d.ts +50 -57
  110. package/dist/components/foundations/ContextMenu.js +5 -29
  111. package/dist/components/foundations/DescriptionList.d.ts +34 -2
  112. package/dist/components/foundations/DescriptionList.js +33 -2
  113. package/dist/components/foundations/Dialog.d.ts +1 -1
  114. package/dist/components/foundations/Dialog.js +2 -1
  115. package/dist/components/foundations/Menu.d.ts +1 -1
  116. package/dist/components/foundations/Menu.js +3 -21
  117. package/dist/components/foundations/Menubar.d.ts +35 -64
  118. package/dist/components/foundations/Menubar.js +4 -23
  119. package/dist/components/foundations/Popover.d.ts +8 -21
  120. package/dist/components/foundations/Popover.js +3 -48
  121. package/dist/components/foundations/PreviewCard.d.ts +44 -29
  122. package/dist/components/foundations/PreviewCard.js +3 -6
  123. package/dist/components/foundations/RadioGroup.d.ts +4 -6
  124. package/dist/components/foundations/SearchField.js +1 -1
  125. package/dist/components/foundations/Select.d.ts +1 -1
  126. package/dist/components/foundations/Select.js +8 -22
  127. package/dist/components/foundations/Slider.d.ts +31 -44
  128. package/dist/components/foundations/Slider.js +26 -25
  129. package/dist/components/foundations/Stepper.d.ts +3 -3
  130. package/dist/components/foundations/Stepper.js +6 -7
  131. package/dist/components/foundations/Toast.js +1 -1
  132. package/dist/components/foundations/ToggleGroup.d.ts +1 -1
  133. package/dist/components/foundations/ToggleGroup.js +1 -1
  134. package/dist/components/foundations/Tooltip.d.ts +6 -8
  135. package/dist/components/foundations/Tooltip.js +4 -3
  136. package/dist/components/foundations/icons.js +1 -1
  137. package/dist/components/general-purpose/Commit.js +3 -3
  138. package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
  139. package/dist/components/general-purpose/FileTree.js +1 -1
  140. package/dist/components/general-purpose/PricingBillingToggle.d.ts +2 -3
  141. package/dist/components/general-purpose/PricingBillingToggle.js +5 -23
  142. package/dist/components/general-purpose/PricingPage.d.ts +3 -4
  143. package/dist/components/general-purpose/PricingPlanCard.js +2 -2
  144. package/dist/components/general-purpose/PricingUsageCalculator.js +2 -2
  145. package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +1 -67
  146. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  147. package/dist/components/general-purpose/SettingsFormDialog.d.ts +7 -2
  148. package/dist/components/general-purpose/SettingsFormDialog.js +19 -4
  149. package/dist/components/general-purpose/SetupChecklist.js +1 -1
  150. package/dist/components/general-purpose/Terminal.js +4 -4
  151. package/dist/components/general-purpose/TestResults.js +1 -1
  152. package/dist/components/general-purpose/ThemeModeControl.js +2 -2
  153. package/dist/components/general-purpose/WebPreview.js +5 -5
  154. package/dist/components/nanites/AgentConnection.js +17 -12
  155. package/dist/components/nanites/AgentToolDetail.js +4 -4
  156. package/dist/{copy-button-CsNSSKYG.js → copy-button-4YvddK4e.js} +1 -1
  157. package/dist/{mcp-server-U71zhxFF.js → mcp-server-SD_S-IpB.js} +18 -2
  158. package/dist/message-scroller-C8cplcQO.js +32 -0
  159. package/dist/provider-logos-zjZycgV6.js +74 -0
  160. package/dist/styles/agent-chat.css +9 -0
  161. package/dist/styles/agent-connection.css +4 -31
  162. package/dist/styles/alert-dialog.css +0 -2
  163. package/dist/styles/base-ui-motion.css +7 -5
  164. package/dist/styles/chatgpt-sign-in-screen.css +5 -3
  165. package/dist/styles/dialog.css +0 -2
  166. package/dist/styles/model-selector.css +30 -12
  167. package/dist/styles/popover.css +0 -1
  168. package/dist/styles/preview-card.css +0 -4
  169. package/dist/styles/pricing-page.css +1 -13
  170. package/dist/styles/prompt-input.css +12 -10
  171. package/dist/styles/recipes.css +22 -14
  172. package/dist/styles/slider.css +2 -2
  173. package/dist/styles/tooltip.css +0 -1
  174. package/dist/utils/structured-code.d.ts +1 -1
  175. package/package.json +18 -8
  176. package/dist/BrowserLiveView-tJTWkoyu.d.ts +0 -48
  177. package/dist/BrowserReplay-B0BQZr-N.d.ts +0 -41
  178. package/dist/Combobox-WrrDDaEv.d.ts +0 -154
  179. package/dist/ModelSelector-DtBxWqRn.js +0 -504
  180. package/dist/Workspace-GTlqvcIn.d.ts +0 -278
  181. package/dist/WorkspaceExplorer-Cu044amt.d.ts +0 -32
  182. package/dist/components/foundations/DescriptionListParts.d.ts +0 -37
  183. package/dist/components/foundations/DescriptionListParts.js +0 -35
  184. package/dist/{icons-B1Qw05te.js → icons-B4mGvCvc.js} +1 -1
@@ -1,2 +1,505 @@
1
- import { _ as getCloudflareModelProvider, a as ModelSelectorEmpty, b as normalizeCloudflareModelSelectorModels, c as ModelSelectorItem, d as ModelSelectorLogoGroup, f as ModelSelectorName, g as formatCloudflareModelProvider, h as ModelSelectorTrigger, i as ModelSelectorDialog, l as ModelSelectorList, m as ModelSelectorSource, n as ModelSelector, o as ModelSelectorGroup, p as ModelSelectorSeparator, r as ModelSelectorContent, s as ModelSelectorInput, t as CloudflareModelSelector, u as ModelSelectorLogo, v as isCloudflareRunnableModelId, x as readCloudflareModelId, y as listCloudflareModelSelectorOptions } from "../../ModelSelector-DtBxWqRn.js";
1
+ import { t as cx } from "../../class-names-BiMDVpUo.js";
2
+ import { G as SearchIcon, f as ChevronDownIcon } from "../../icons-B4mGvCvc.js";
3
+ import { Button } from "../foundations/Button.js";
4
+ import { Autocomplete } from "../foundations/Autocomplete.js";
5
+ import { Dialog } from "../foundations/Dialog.js";
6
+ import { o as titleCase } from "../../format-DB2mX9DA.js";
7
+ import { Separator } from "../foundations/Separator.js";
8
+ import { ScrollArea } from "../foundations/ScrollArea.js";
9
+ import { t as ProviderLogo } from "../../provider-logos-zjZycgV6.js";
10
+ import { EmptyState } from "../foundations/EmptyState.js";
11
+ import * as React from "react";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ import { createPortal } from "react-dom";
14
+ //#region src/components/agents-sdk/ModelSelector.tsx
15
+ const ModelSelectorContext = React.createContext(null);
16
+ const ModelSelectorEmptyContainerContext = React.createContext(void 0);
17
+ function modelSelectorItemSearchValue({ keywords, value }) {
18
+ return `${value} ${keywords ?? ""}`.trim();
19
+ }
20
+ function modelSelectorFilter(item, query) {
21
+ return item.toLowerCase().includes(query.trim().toLowerCase());
22
+ }
23
+ function equalItems(left, right) {
24
+ return left?.length === right.length && left.every((item, index) => item === right[index]);
25
+ }
26
+ const cloudflareModelProviderLabels = {
27
+ ai4bharat: "AI4Bharat",
28
+ aisingapore: "AI Singapore",
29
+ alibaba: "Alibaba",
30
+ anthropic: "Anthropic",
31
+ baai: "BAAI",
32
+ cohere: "Cohere",
33
+ deepseek: "DeepSeek",
34
+ "deepseek-ai": "DeepSeek",
35
+ google: "Google",
36
+ "google-vertex": "Google Vertex",
37
+ groq: "Groq",
38
+ ibm: "IBM",
39
+ "ibm-granite": "IBM",
40
+ meta: "Meta",
41
+ "meta-llama": "Meta",
42
+ microsoft: "Microsoft",
43
+ mistral: "Mistral AI",
44
+ mistralai: "Mistral AI",
45
+ minimax: "MiniMax",
46
+ moonshotai: "Moonshot AI",
47
+ nvidia: "NVIDIA",
48
+ openai: "OpenAI",
49
+ openrouter: "OpenRouter",
50
+ perplexity: "Perplexity",
51
+ qwen: "Qwen",
52
+ replicate: "Replicate",
53
+ together: "Together AI",
54
+ xai: "xAI",
55
+ "zai-org": "Zhipu AI"
56
+ };
57
+ function isCloudflareRunnableModelId(value) {
58
+ const modelId = value.trim();
59
+ return /^@(?:cf|hf)\/[^/\s]+\/\S+$/.test(modelId) || /^[a-z0-9][a-z0-9._-]*\/\S+$/i.test(modelId);
60
+ }
61
+ function readCatalogString(value) {
62
+ if (typeof value !== "string") return null;
63
+ const trimmed = value.trim();
64
+ return trimmed.length > 0 ? trimmed : null;
65
+ }
66
+ function readCatalogField(entry, field) {
67
+ if (typeof entry !== "object" || entry === null || !Object.hasOwn(entry, field)) return null;
68
+ return readCatalogString(entry[field]);
69
+ }
70
+ function readCatalogEntries(entry) {
71
+ if (Array.isArray(entry)) return entry;
72
+ if (typeof entry !== "object" || entry === null || !Object.hasOwn(entry, "data")) return null;
73
+ const data = entry.data;
74
+ return Array.isArray(data) ? data : null;
75
+ }
76
+ function readCloudflareModelId(entry) {
77
+ if (typeof entry === "string") {
78
+ const modelId = readCatalogString(entry);
79
+ return modelId && isCloudflareRunnableModelId(modelId) ? modelId : null;
80
+ }
81
+ for (const field of [
82
+ "model_id",
83
+ "name",
84
+ "id"
85
+ ]) {
86
+ const modelId = readCatalogField(entry, field);
87
+ if (modelId && isCloudflareRunnableModelId(modelId)) return modelId;
88
+ }
89
+ return null;
90
+ }
91
+ function getCloudflareModelProvider(modelId) {
92
+ const [, hostedProvider] = /^@(?:cf|hf)\/([^/]+)/.exec(modelId) ?? [];
93
+ if (hostedProvider) return hostedProvider;
94
+ return modelId.split("/", 1)[0] || "other";
95
+ }
96
+ function formatCloudflareModelProvider(provider) {
97
+ const normalized = provider.trim().toLowerCase();
98
+ if (cloudflareModelProviderLabels[normalized]) return cloudflareModelProviderLabels[normalized];
99
+ return titleCase(normalized);
100
+ }
101
+ function normalizeCloudflareModelSelectorModels(models) {
102
+ const seen = /* @__PURE__ */ new Set();
103
+ const options = [];
104
+ const appendOption = (entry) => {
105
+ const entries = readCatalogEntries(entry);
106
+ if (entries) {
107
+ for (const nestedEntry of entries) appendOption(nestedEntry);
108
+ return;
109
+ }
110
+ const id = readCloudflareModelId(entry);
111
+ if (!id || seen.has(id)) return;
112
+ seen.add(id);
113
+ const provider = getCloudflareModelProvider(id);
114
+ options.push({
115
+ id,
116
+ provider,
117
+ providerLabel: formatCloudflareModelProvider(provider),
118
+ source: id.startsWith("@") ? "workers-ai" : "ai-gateway",
119
+ description: readCatalogField(entry, "description")
120
+ });
121
+ };
122
+ for (const entry of models) appendOption(entry);
123
+ return options;
124
+ }
125
+ async function listCloudflareModelSelectorOptions(client, params) {
126
+ const { account_id, task, per_page = 100 } = params;
127
+ const models = [];
128
+ for (let page = 1;; page += 1) {
129
+ const response = await client.get(`/accounts/${account_id}/ai/catalog/models`, { query: {
130
+ page,
131
+ per_page
132
+ } });
133
+ const pageModels = response.result.filter((model) => !model.private && (!task || model.task === task));
134
+ models.push(...pageModels);
135
+ if (response.result.length < per_page) break;
136
+ }
137
+ return normalizeCloudflareModelSelectorModels(models);
138
+ }
139
+ function groupCloudflareModelOptions(options) {
140
+ const groups = [];
141
+ const groupsByLabel = /* @__PURE__ */ new Map();
142
+ for (const option of options) {
143
+ const group = groupsByLabel.get(option.providerLabel);
144
+ if (group) {
145
+ group.push(option);
146
+ continue;
147
+ }
148
+ const nextGroup = [option];
149
+ groupsByLabel.set(option.providerLabel, nextGroup);
150
+ groups.push({
151
+ providerLabel: option.providerLabel,
152
+ options: nextGroup
153
+ });
154
+ }
155
+ return groups;
156
+ }
157
+ function useModelSelectorContext() {
158
+ const ctx = React.useContext(ModelSelectorContext);
159
+ if (!ctx) throw new Error("ModelSelector subcomponents must be used inside <ModelSelector>.");
160
+ return ctx;
161
+ }
162
+ /**
163
+ * A searchable model picker. Click the trigger to open a dialog containing a
164
+ * search input and a grouped list of available models.
165
+ *
166
+ * Built internally for AI model selection. Use it when users choose one model
167
+ * from a grouped provider list. Do not use it as a general command palette or
168
+ * multiselect; use Combobox or a dedicated component for that.
169
+ *
170
+ * Sigvelo changes: composes the design-system Dialog, Autocomplete, ScrollArea,
171
+ * and Button, and maps provider logos plus option styling to Sigvelo CSS tokens.
172
+ *
173
+ * Dialog owns modal focus and dismissal. Autocomplete owns listbox semantics,
174
+ * active-descendant focus, and keyboard navigation. Styling consumes surface,
175
+ * border, spacing, radius, focus, and typography tokens. Add provider/item
176
+ * affordances here when they need to be shared.
177
+ *
178
+ * @example
179
+ * ```tsx
180
+ * <ModelSelector>
181
+ * <ModelSelectorTrigger>
182
+ * <ModelSelectorLogo provider="anthropic" />
183
+ * <ModelSelectorName>Claude Opus 4.6</ModelSelectorName>
184
+ * </ModelSelectorTrigger>
185
+ * <ModelSelectorContent>
186
+ * <ModelSelectorDialog>
187
+ * <ModelSelectorInput placeholder="Search models…" />
188
+ * <ModelSelectorList>
189
+ * <ModelSelectorGroup label="Anthropic">
190
+ * <ModelSelectorItem value="claude-opus-4-6" onSelect={…}>
191
+ * <ModelSelectorLogo provider="anthropic" />
192
+ * <ModelSelectorName>Claude Opus 4.6</ModelSelectorName>
193
+ * </ModelSelectorItem>
194
+ * </ModelSelectorGroup>
195
+ * </ModelSelectorList>
196
+ * </ModelSelectorDialog>
197
+ * </ModelSelectorContent>
198
+ * </ModelSelector>
199
+ * ```
200
+ */
201
+ function ModelSelector({ open, defaultOpen = false, onOpenChange, children, className, ref, ...props }) {
202
+ const [query, setQuery] = React.useState("");
203
+ const [registeredGroups, setRegisteredGroups] = React.useState(() => /* @__PURE__ */ new Map());
204
+ const handleOpenChange = React.useCallback((...args) => {
205
+ const [next, eventDetails] = args;
206
+ onOpenChange?.(...args);
207
+ if (!eventDetails.isCanceled && !next) setQuery("");
208
+ }, [onOpenChange]);
209
+ const registerGroup = React.useCallback((id, items) => {
210
+ setRegisteredGroups((current) => {
211
+ if (equalItems(current.get(id), items)) return current;
212
+ const next = new Map(current);
213
+ next.set(id, items);
214
+ return next;
215
+ });
216
+ return () => {
217
+ setRegisteredGroups((current) => {
218
+ if (!current.has(id)) return current;
219
+ const next = new Map(current);
220
+ next.delete(id);
221
+ return next;
222
+ });
223
+ };
224
+ }, []);
225
+ const autocompleteItems = React.useMemo(() => Array.from(registeredGroups.values()).flat(), [registeredGroups]);
226
+ const ctxValue = React.useMemo(() => ({
227
+ query,
228
+ registerGroup,
229
+ setQuery
230
+ }), [query, registerGroup]);
231
+ return /* @__PURE__ */ jsx(ModelSelectorContext.Provider, {
232
+ value: ctxValue,
233
+ children: /* @__PURE__ */ jsx(Autocomplete.Root, {
234
+ open: true,
235
+ inline: true,
236
+ items: autocompleteItems,
237
+ filter: modelSelectorFilter,
238
+ value: query,
239
+ onValueChange: setQuery,
240
+ autoHighlight: "always",
241
+ keepHighlight: true,
242
+ children: /* @__PURE__ */ jsx("div", {
243
+ ref,
244
+ className: cx("model-selector", className),
245
+ ...props,
246
+ children: /* @__PURE__ */ jsx(Dialog.Root, {
247
+ open,
248
+ defaultOpen,
249
+ onOpenChange: handleOpenChange,
250
+ children
251
+ })
252
+ })
253
+ })
254
+ });
255
+ }
256
+ function CloudflareModelSelector({ models, selectedModelId = null, onSelectModel, disabled = false, placeholder = "Search or paste an AI Gateway model id...", triggerLabel = "Select a model", emptyLabel = "No models found", allowTypedModel = true, onOpenChange, ...props }) {
257
+ const options = React.useMemo(() => normalizeCloudflareModelSelectorModels(models), [models]);
258
+ const groups = React.useMemo(() => groupCloudflareModelOptions(options), [options]);
259
+ const selectedOption = selectedModelId ? options.find((option) => option.id === selectedModelId) ?? {
260
+ id: selectedModelId,
261
+ provider: getCloudflareModelProvider(selectedModelId),
262
+ providerLabel: formatCloudflareModelProvider(getCloudflareModelProvider(selectedModelId)),
263
+ source: selectedModelId.startsWith("@") ? "workers-ai" : "ai-gateway",
264
+ description: null
265
+ } : null;
266
+ return /* @__PURE__ */ jsxs(ModelSelector, {
267
+ onOpenChange,
268
+ ...props,
269
+ children: [/* @__PURE__ */ jsx(ModelSelectorTrigger, {
270
+ disabled,
271
+ children: selectedOption ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ModelSelectorLogo, { provider: selectedOption.provider }), /* @__PURE__ */ jsx(ModelSelectorName, { children: selectedOption.id })] }) : /* @__PURE__ */ jsx(ModelSelectorName, { children: triggerLabel })
272
+ }), /* @__PURE__ */ jsx(ModelSelectorContent, {
273
+ title: "Cloudflare model selector",
274
+ children: /* @__PURE__ */ jsxs(ModelSelectorDialog, { children: [/* @__PURE__ */ jsx(ModelSelectorInput, {
275
+ "aria-label": "Search Cloudflare AI models",
276
+ placeholder
277
+ }), /* @__PURE__ */ jsxs(ModelSelectorList, { children: [
278
+ /* @__PURE__ */ jsx(CloudflareTypedModelOption, {
279
+ allowTypedModel,
280
+ onSelectModel,
281
+ options,
282
+ selectedModelId
283
+ }),
284
+ groups.map((group) => /* @__PURE__ */ jsx(ModelSelectorGroup, {
285
+ label: group.providerLabel,
286
+ children: group.options.map((option) => /* @__PURE__ */ jsxs(ModelSelectorItem, {
287
+ value: option.id,
288
+ keywords: `${option.provider} ${option.providerLabel} ${option.source} ${option.description ?? ""}`,
289
+ selected: option.id === selectedModelId,
290
+ onSelect: onSelectModel,
291
+ children: [
292
+ /* @__PURE__ */ jsx(ModelSelectorLogo, { provider: option.provider }),
293
+ /* @__PURE__ */ jsx(ModelSelectorName, { children: option.id }),
294
+ /* @__PURE__ */ jsx(ModelSelectorSource, { children: option.source === "workers-ai" ? "Workers AI" : "Gateway" })
295
+ ]
296
+ }, option.id))
297
+ }, group.providerLabel)),
298
+ /* @__PURE__ */ jsx(ModelSelectorEmpty, { children: emptyLabel })
299
+ ] })] })
300
+ })]
301
+ });
302
+ }
303
+ function CloudflareTypedModelOption({ allowTypedModel, onSelectModel, options, selectedModelId }) {
304
+ const { query } = useModelSelectorContext();
305
+ const typedModelId = query.trim();
306
+ if (!allowTypedModel || !isCloudflareRunnableModelId(typedModelId) || typedModelId === selectedModelId || options.some((option) => option.id === typedModelId)) return null;
307
+ return /* @__PURE__ */ jsx(ModelSelectorGroup, {
308
+ label: "AI Gateway",
309
+ children: /* @__PURE__ */ jsxs(ModelSelectorItem, {
310
+ value: typedModelId,
311
+ onSelect: onSelectModel,
312
+ children: [
313
+ /* @__PURE__ */ jsx(ModelSelectorLogo, { provider: getCloudflareModelProvider(typedModelId) }),
314
+ /* @__PURE__ */ jsx(ModelSelectorName, { children: typedModelId }),
315
+ /* @__PURE__ */ jsx(ModelSelectorSource, { children: "Use" })
316
+ ]
317
+ })
318
+ });
319
+ }
320
+ function ModelSelectorTrigger({ className, children, ...props }) {
321
+ return /* @__PURE__ */ jsx(Dialog.Trigger, { render: /* @__PURE__ */ jsxs(Button, {
322
+ variant: "outline",
323
+ color: "neutral",
324
+ className: cx("model-selector__trigger", className),
325
+ ...props,
326
+ children: [children, /* @__PURE__ */ jsx("span", {
327
+ className: "model-selector__trigger-chevron",
328
+ "aria-hidden": "true",
329
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
330
+ })]
331
+ }) });
332
+ }
333
+ function ModelSelectorContent({ children, title = "Model Selector", ...props }) {
334
+ return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Backdrop, {}), /* @__PURE__ */ jsx(Dialog.Viewport, { children: /* @__PURE__ */ jsxs(Dialog.Popup, {
335
+ ...props,
336
+ children: [/* @__PURE__ */ jsx(Dialog.Title, {
337
+ className: "model-selector__title sigvelo-visually-hidden",
338
+ children: title
339
+ }), children]
340
+ }) })] });
341
+ }
342
+ function ModelSelectorDialog({ className, children, ref, ...props }) {
343
+ return /* @__PURE__ */ jsx("div", {
344
+ ref,
345
+ className: cx("model-selector__dialog", className),
346
+ ...props,
347
+ children
348
+ });
349
+ }
350
+ function ModelSelectorInput({ className, placeholder = "Search models…", ref, ...props }) {
351
+ return /* @__PURE__ */ jsxs("div", {
352
+ className: "model-selector__search",
353
+ children: [/* @__PURE__ */ jsx("span", {
354
+ className: "model-selector__search-icon",
355
+ "aria-hidden": "true",
356
+ children: /* @__PURE__ */ jsx(SearchIcon, {})
357
+ }), /* @__PURE__ */ jsx(Autocomplete.Input, {
358
+ ref,
359
+ type: "search",
360
+ placeholder,
361
+ className: cx("model-selector__input", className),
362
+ autoFocus: true,
363
+ "aria-expanded": "true",
364
+ ...props
365
+ })]
366
+ });
367
+ }
368
+ function ModelSelectorList({ className, children, ref, ...props }) {
369
+ const [contentElement, setContentElement] = React.useState(null);
370
+ return /* @__PURE__ */ jsxs(ScrollArea.Root, {
371
+ className: "model-selector__list",
372
+ children: [/* @__PURE__ */ jsx(ScrollArea.Viewport, {
373
+ ref,
374
+ className: cx("model-selector__list-viewport", className),
375
+ ...props,
376
+ children: /* @__PURE__ */ jsx(ScrollArea.Content, {
377
+ ref: setContentElement,
378
+ className: "model-selector__list-content",
379
+ children: /* @__PURE__ */ jsx(ModelSelectorEmptyContainerContext.Provider, {
380
+ value: contentElement,
381
+ children: /* @__PURE__ */ jsx(Autocomplete.List, {
382
+ className: "model-selector__options",
383
+ children
384
+ })
385
+ })
386
+ })
387
+ }), /* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
388
+ orientation: "vertical",
389
+ children: /* @__PURE__ */ jsx(ScrollArea.Thumb, {})
390
+ })]
391
+ });
392
+ }
393
+ function ModelSelectorGroup({ className, label, children, ref, ...props }) {
394
+ const { query, registerGroup } = useModelSelectorContext();
395
+ const groupId = React.useId();
396
+ const childArray = React.useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child)), [children]);
397
+ const items = React.useMemo(() => childArray.map((child) => modelSelectorItemSearchValue(child.props)), [childArray]);
398
+ React.useEffect(() => registerGroup(groupId, items), [
399
+ groupId,
400
+ items,
401
+ registerGroup
402
+ ]);
403
+ const q = query.trim().toLowerCase();
404
+ const filtered = q ? childArray.filter((child) => {
405
+ const value = String(child.props.value ?? "").toLowerCase();
406
+ const keywords = String(child.props.keywords ?? "").toLowerCase();
407
+ return value.includes(q) || keywords.includes(q);
408
+ }) : childArray;
409
+ if (filtered.length === 0) return null;
410
+ return /* @__PURE__ */ jsxs(Autocomplete.Group, {
411
+ ref,
412
+ className: cx("model-selector__group", className),
413
+ ...props,
414
+ children: [/* @__PURE__ */ jsx(Autocomplete.GroupLabel, {
415
+ className: "model-selector__group-label",
416
+ children: label
417
+ }), filtered]
418
+ });
419
+ }
420
+ function ModelSelectorItem({ className, value, keywords, selected, onSelect, children, onClick, ref, disabled, ...props }) {
421
+ return /* @__PURE__ */ jsx(Autocomplete.Item, {
422
+ value: modelSelectorItemSearchValue({
423
+ keywords,
424
+ value
425
+ }),
426
+ disabled,
427
+ nativeButton: true,
428
+ "aria-selected": selected ? "true" : "false",
429
+ "data-selected": selected ? "" : void 0,
430
+ tabIndex: -1,
431
+ onClick: () => onSelect?.(value),
432
+ render: /* @__PURE__ */ jsx(Dialog.Close, {
433
+ disabled,
434
+ render: /* @__PURE__ */ jsx(Button, {
435
+ ref,
436
+ variant: "ghost",
437
+ color: "neutral",
438
+ disabled,
439
+ className: cx("model-selector__item", className),
440
+ onClick,
441
+ ...props,
442
+ children
443
+ })
444
+ })
445
+ });
446
+ }
447
+ function ModelSelectorEmpty({ className, children = "No models found", ref, ...props }) {
448
+ const container = React.useContext(ModelSelectorEmptyContainerContext);
449
+ const empty = /* @__PURE__ */ jsx(Autocomplete.Empty, { children: /* @__PURE__ */ jsx(EmptyState, {
450
+ ref,
451
+ className: cx("model-selector__empty", className),
452
+ ...props,
453
+ children
454
+ }) });
455
+ if (container === null) return null;
456
+ return container ? createPortal(empty, container) : empty;
457
+ }
458
+ function ModelSelectorSeparator({ className, ref, ...props }) {
459
+ return /* @__PURE__ */ jsx(Separator, {
460
+ ref,
461
+ className: cx("model-selector__separator", className),
462
+ ...props
463
+ });
464
+ }
465
+ function ModelSelectorLogo({ className, provider, ...props }) {
466
+ return /* @__PURE__ */ jsx("span", {
467
+ className: cx("model-selector__logo", className),
468
+ children: /* @__PURE__ */ jsx(ProviderLogo, {
469
+ provider,
470
+ ...props
471
+ })
472
+ });
473
+ }
474
+ function ModelSelectorLogoGroup({ className, children, ref, ...props }) {
475
+ return /* @__PURE__ */ jsx("div", {
476
+ ref,
477
+ className: cx("model-selector__logo-group", className),
478
+ ...props,
479
+ children
480
+ });
481
+ }
482
+ function ModelSelectorName({ className, children, ref, ...props }) {
483
+ return /* @__PURE__ */ jsx("span", {
484
+ ref,
485
+ className: cx("model-selector__name", "sigvelo-truncate", "sigvelo-truncate-grow", className),
486
+ ...props,
487
+ children
488
+ });
489
+ }
490
+ /**
491
+ * Where a model comes from — "Workers AI", "Gateway" — shown at the end of its
492
+ * row. This was a `<kbd>` named `ModelSelectorSource`, which announced
493
+ * "Workers AI" to a screen reader as keyboard input and offered a shortcut
494
+ * that does not exist.
495
+ */
496
+ function ModelSelectorSource({ className, children, ref, ...props }) {
497
+ return /* @__PURE__ */ jsx("span", {
498
+ ref,
499
+ className: cx("model-selector__source", className),
500
+ ...props,
501
+ children
502
+ });
503
+ }
504
+ //#endregion
2
505
  export { CloudflareModelSelector, ModelSelector, ModelSelectorContent, ModelSelectorDialog, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorInput, ModelSelectorItem, ModelSelectorList, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorName, ModelSelectorSeparator, ModelSelectorSource, ModelSelectorTrigger, formatCloudflareModelProvider, getCloudflareModelProvider, isCloudflareRunnableModelId, listCloudflareModelSelectorOptions, normalizeCloudflareModelSelectorModels, readCloudflareModelId };
@@ -1,6 +1,6 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { ThinkExecutionApproval, ThinkPendingApproval, getPausedExecution } from "./ThinkPendingApproval.js";
3
2
  import { ToolApproval } from "../ai-sdk/ToolApproval.js";
3
+ import { ThinkExecutionApproval, ThinkPendingApproval, getPausedExecution } from "./ThinkPendingApproval.js";
4
4
  import "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { isToolUIPart } from "ai";
@@ -1,4 +1,4 @@
1
- import { O as PromptInputCommandDefinition } from "../../PromptInput-DOyee1kM.js";
1
+ import { D as PromptInputCommandDefinition } from "../../PromptInput-BRX7FhjH.js";
2
2
  import { MCPServersState } from "agents";
3
3
  import { SkillDescriptor } from "agents/skills";
4
4
 
@@ -1,4 +1,4 @@
1
- import { c as BoxIcon, j as McpIcon } from "../../icons-B1Qw05te.js";
1
+ import { c as BoxIcon, j as McpIcon } from "../../icons-B4mGvCvc.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/agents-sdk/PromptInputCommands.tsx
4
4
  /** Project whole upstream Agents MCP state into composer mention commands. */
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { J as SpinnerIcon, X as StopIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-B1Qw05te.js";
2
+ import { J as SpinnerIcon, X as StopIcon, d as CheckIcon, tt as WarningIcon } from "../../icons-B4mGvCvc.js";
3
3
  import "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/components/agents-sdk/SubagentRunIndicator.tsx
@@ -1,8 +1,8 @@
1
1
  import { t as cx } from "../../class-names-BiMDVpUo.js";
2
- import { l as BrainIcon } from "../../icons-B1Qw05te.js";
3
- import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
2
+ import { l as BrainIcon } from "../../icons-B4mGvCvc.js";
4
3
  import { buttonVariants } from "../foundations/Button.js";
5
4
  import { Tooltip } from "../foundations/Tooltip.js";
5
+ import { t as NavigationLink } from "../../navigation-link-kqMa81v5.js";
6
6
  import { SubagentRunIndicator, getSubagentRunName, getSubagentRunTooltip } from "./SubagentRunIndicator.js";
7
7
  import "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";