@mcp-b/react-components 0.34.1 → 0.36.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.
- package/dist/{AgentChat-CV-GuYA6.d.ts → AgentChat-CVO7xyLC.d.ts} +22 -3
- package/dist/{CodeBlock-CM5gfmdq.js → CodeBlock-Bk4nn7l-.js} +4 -3
- package/dist/{CodeBlock-DzGhYyNe.d.ts → CodeBlock-C380GD5t.d.ts} +2 -5
- package/dist/{Dialog-DeOSJ0Oy.d.ts → Dialog-B_FhRWaz.d.ts} +22 -37
- package/dist/{Menu-DVmjBIuM.d.ts → Menu-yb6QXWA3.d.ts} +64 -75
- package/dist/{PromptInput-DOyee1kM.d.ts → PromptInput-BRX7FhjH.d.ts} +7 -272
- package/dist/ResponsiveSidebarShell-DWjULskY.d.ts +68 -0
- package/dist/{Select-D96d09ww.d.ts → Select-RrceeEIe.d.ts} +17 -52
- package/dist/{ThinkChat-en0UbkVv.js → ThinkChat-ByR-QT_D.js} +19 -12
- package/dist/{ThinkChatActivity-CgqpROz_.d.ts → ThinkChatActivity-Dkmm2pIj.d.ts} +1 -1
- package/dist/{ToggleGroup-CSBWfPXo.d.ts → ToggleGroup-BrQZOQn_.d.ts} +4 -6
- package/dist/{WorkspaceFile-C8Riev9j.d.ts → WorkspaceFile-BLaFmMrt.d.ts} +18 -2
- package/dist/{WorkspaceFileView-BtzVKAed.js → WorkspaceFileView-DTHJLKW_.js} +11 -17
- package/dist/components/agents-sdk/AgentChat.d.ts +2 -2
- package/dist/components/agents-sdk/AgentChat.js +47 -26
- package/dist/components/agents-sdk/BrowserLiveView.d.ts +47 -1
- package/dist/components/agents-sdk/BrowserReplay.d.ts +40 -1
- package/dist/components/agents-sdk/BrowserReplay.js +1 -1
- package/dist/components/agents-sdk/McpConnectionRequest.js +14 -15
- package/dist/components/agents-sdk/McpConnectorForm.js +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +17 -24
- package/dist/components/agents-sdk/McpServerPicker.d.ts +2 -2
- package/dist/components/agents-sdk/McpServerPicker.js +19 -17
- package/dist/components/agents-sdk/ModelSelector.d.ts +9 -9
- package/dist/components/agents-sdk/ModelSelector.js +504 -1
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +1 -1
- package/dist/components/agents-sdk/SubagentRunDetails.js +1 -1
- package/dist/components/agents-sdk/ThinkChat.d.ts +18 -95
- package/dist/components/agents-sdk/ThinkChat.js +2 -12
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +2 -4
- package/dist/components/agents-sdk/ThinkChatActivity.js +1 -1
- package/dist/components/agents-sdk/ThinkChatActivitySummary.js +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +3 -8
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +5 -3
- package/dist/components/agents-sdk/ThinkExecutionRun.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +2 -2
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +4 -4
- package/dist/components/agents-sdk/ThinkFullApp.js +12 -14
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkPendingApproval.js +3 -3
- package/dist/components/agents-sdk/ThinkRoutineBrowser.js +5 -4
- package/dist/components/agents-sdk/ThinkRoutineForm.js +1 -1
- package/dist/components/agents-sdk/ThinkRoutineLibrary.d.ts +2 -3
- package/dist/components/agents-sdk/ThinkRoutineLibrary.js +11 -15
- package/dist/components/agents-sdk/ThinkThreadPicker.js +3 -4
- package/dist/components/agents-sdk/ThinkThreadShell.d.ts +1 -1
- package/dist/components/agents-sdk/Workspace.d.ts +140 -2
- package/dist/components/agents-sdk/Workspace.js +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +32 -5
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -5
- package/dist/components/agents-sdk/WorkspaceFile.d.ts +2 -2
- package/dist/components/agents-sdk/WorkspaceFile.js +41 -4
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/ai-sdk/Activity.d.ts +5 -0
- package/dist/components/ai-sdk/Activity.js +33 -13
- package/dist/components/ai-sdk/Approval.d.ts +1 -2
- package/dist/components/ai-sdk/Approval.js +4 -7
- package/dist/components/ai-sdk/CodeBlock.d.ts +1 -1
- package/dist/components/ai-sdk/CodeBlock.js +1 -1
- package/dist/components/ai-sdk/Context.js +1 -1
- package/dist/components/ai-sdk/Goal.js +1 -1
- package/dist/components/ai-sdk/Message.js +2 -6
- package/dist/components/ai-sdk/MessageScroller.d.ts +5 -0
- package/dist/components/ai-sdk/MessageScroller.js +18 -12
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +18 -10
- package/dist/components/ai-sdk/Plan.js +1 -1
- package/dist/components/ai-sdk/PromptInput.d.ts +2 -2
- package/dist/components/ai-sdk/PromptInput.js +124 -127
- package/dist/components/ai-sdk/Queue.js +1 -1
- package/dist/components/ai-sdk/Reasoning.d.ts +3 -4
- package/dist/components/ai-sdk/Reasoning.js +29 -13
- package/dist/components/ai-sdk/ToolInvocation.d.ts +3 -5
- package/dist/components/ai-sdk/ToolInvocation.js +2 -2
- package/dist/components/extension/ChatGptSignInScreen.js +2 -2
- package/dist/components/extension/CodexModelSelector.d.ts +1 -1
- package/dist/components/extension/CodexModelSelector.js +1 -1
- package/dist/components/extension/ConversationTabPicker.js +1 -1
- package/dist/components/foundations/Accordion.d.ts +1 -3
- package/dist/components/foundations/Accordion.js +1 -3
- package/dist/components/foundations/AlertDialog.d.ts +16 -36
- package/dist/components/foundations/Autocomplete.d.ts +12 -33
- package/dist/components/foundations/Autocomplete.js +2 -1
- package/dist/components/foundations/Combobox.d.ts +119 -2
- package/dist/components/foundations/Combobox.js +6 -23
- package/dist/components/foundations/ContextMenu.d.ts +50 -57
- package/dist/components/foundations/ContextMenu.js +4 -28
- package/dist/components/foundations/DescriptionList.d.ts +34 -2
- package/dist/components/foundations/DescriptionList.js +33 -2
- package/dist/components/foundations/Dialog.d.ts +1 -1
- package/dist/components/foundations/Dialog.js +2 -1
- package/dist/components/foundations/EmptyState.d.ts +5 -2
- package/dist/components/foundations/EmptyState.js +11 -7
- package/dist/components/foundations/Menu.d.ts +1 -1
- package/dist/components/foundations/Menu.js +3 -21
- package/dist/components/foundations/Menubar.d.ts +35 -64
- package/dist/components/foundations/Menubar.js +3 -22
- package/dist/components/foundations/Popover.d.ts +8 -21
- package/dist/components/foundations/Popover.js +3 -48
- package/dist/components/foundations/PreviewCard.d.ts +44 -29
- package/dist/components/foundations/PreviewCard.js +3 -6
- package/dist/components/foundations/RadioGroup.d.ts +4 -6
- package/dist/components/foundations/Select.d.ts +1 -1
- package/dist/components/foundations/Select.js +7 -21
- package/dist/components/foundations/Slider.d.ts +31 -44
- package/dist/components/foundations/Slider.js +26 -25
- package/dist/components/foundations/Stepper.d.ts +3 -3
- package/dist/components/foundations/Stepper.js +5 -6
- package/dist/components/foundations/ToggleGroup.d.ts +1 -1
- package/dist/components/foundations/Tooltip.d.ts +6 -8
- package/dist/components/foundations/Tooltip.js +4 -3
- package/dist/components/general-purpose/Commit.js +1 -1
- package/dist/components/general-purpose/EnvironmentVariables.js +1 -1
- package/dist/components/general-purpose/PricingBillingToggle.d.ts +2 -3
- package/dist/components/general-purpose/PricingBillingToggle.js +4 -22
- package/dist/components/general-purpose/PricingPage.d.ts +3 -4
- package/dist/components/general-purpose/ResizableSidePanel.js +1 -1
- package/dist/components/general-purpose/ResponsiveSidebarShell.d.ts +1 -67
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
- package/dist/components/general-purpose/SettingsFormDialog.d.ts +7 -2
- package/dist/components/general-purpose/SettingsFormDialog.js +18 -3
- package/dist/components/general-purpose/Terminal.js +3 -3
- package/dist/components/general-purpose/ThemeModeControl.js +1 -1
- package/dist/components/general-purpose/WebPreview.js +4 -4
- package/dist/components/nanites/AgentConnection.js +16 -11
- package/dist/components/nanites/AgentToolDetail.js +6 -7
- package/dist/{format-CmopcfqJ.js → format-DB2mX9DA.js} +16 -1
- package/dist/{mcp-server-U71zhxFF.js → mcp-server-SD_S-IpB.js} +18 -2
- package/dist/message-scroller-C8cplcQO.js +32 -0
- package/dist/{progress-ring-Dz_ztrW2.js → progress-ring-BEocM1e3.js} +1 -1
- package/dist/provider-logos-zjZycgV6.js +74 -0
- package/dist/styles/agent-chat.css +25 -0
- package/dist/styles/agent-connection.css +4 -31
- package/dist/styles/agent-tool-detail.css +0 -7
- package/dist/styles/alert-dialog.css +0 -2
- package/dist/styles/base-ui-motion.css +7 -5
- package/dist/styles/chatgpt-sign-in-screen.css +5 -3
- package/dist/styles/dialog.css +0 -2
- package/dist/styles/field.css +2 -2
- package/dist/styles/model-selector.css +30 -12
- package/dist/styles/popover.css +0 -1
- package/dist/styles/preview-card.css +0 -4
- package/dist/styles/pricing-page.css +1 -13
- package/dist/styles/prompt-input.css +12 -10
- package/dist/styles/recipes.css +22 -14
- package/dist/styles/slider.css +2 -2
- package/dist/styles/think-execution-workbench.css +9 -13
- package/dist/styles/think-routine-library.css +2 -30
- package/dist/styles/tooltip.css +0 -1
- package/dist/utils/structured-code.d.ts +1 -1
- package/package.json +17 -7
- package/dist/BrowserLiveView-tJTWkoyu.d.ts +0 -48
- package/dist/BrowserReplay-B0BQZr-N.d.ts +0 -41
- package/dist/Combobox-WrrDDaEv.d.ts +0 -154
- package/dist/ModelSelector-DzdEs2fX.js +0 -504
- package/dist/Workspace-EhvvlHOB.d.ts +0 -278
- package/dist/WorkspaceExplorer-DygQnEyi.d.ts +0 -32
- package/dist/components/foundations/DescriptionListParts.d.ts +0 -37
- package/dist/components/foundations/DescriptionListParts.js +0 -35
|
@@ -1,2 +1,505 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
+
import { G as SearchIcon, f as ChevronDownIcon } from "../../icons-B1Qw05te.js";
|
|
3
|
+
import { Button } from "../foundations/Button.js";
|
|
4
|
+
import { Dialog } from "../foundations/Dialog.js";
|
|
5
|
+
import { o as titleCase } from "../../format-DB2mX9DA.js";
|
|
6
|
+
import { Separator } from "../foundations/Separator.js";
|
|
7
|
+
import { EmptyState } from "../foundations/EmptyState.js";
|
|
8
|
+
import { ScrollArea } from "../foundations/ScrollArea.js";
|
|
9
|
+
import { Autocomplete } from "../foundations/Autocomplete.js";
|
|
10
|
+
import { t as ProviderLogo } from "../../provider-logos-zjZycgV6.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,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { n as clamp } from "../../format-
|
|
2
|
+
import { n as clamp } from "../../format-DB2mX9DA.js";
|
|
3
3
|
import { Progress } from "../foundations/Progress.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
import { i as AgentMessageRenderPartContext } from "../../AgentMessageParts-C7L-Mv9U.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as AgentChatProps } from "../../AgentChat-
|
|
4
|
-
import {
|
|
5
|
-
import { n as BrowserLiveViewProps, t as BrowserLiveView } from "../../BrowserLiveView-tJTWkoyu.js";
|
|
6
|
-
import { n as BrowserReplayProps, t as BrowserReplay } from "../../BrowserReplay-B0BQZr-N.js";
|
|
2
|
+
import { K as PromptInputMessage } from "../../PromptInput-BRX7FhjH.js";
|
|
3
|
+
import { r as AgentChatProps } from "../../AgentChat-CVO7xyLC.js";
|
|
4
|
+
import { n as AgentToolEventsValue } from "../../AgentToolRunsContext-BCVqCtJ1.js";
|
|
7
5
|
import { o as UseSessionCompactionResult } from "../../SessionCompaction-CmTJFpzj.js";
|
|
8
|
-
import {
|
|
9
|
-
import { u as describeThinkChatActivityPart } from "../../ThinkChatActivitySummary-teRjrPxW.js";
|
|
10
|
-
import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-CgqpROz_.js";
|
|
6
|
+
import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-Dkmm2pIj.js";
|
|
11
7
|
import { i as ThinkChatValue } from "../../ThinkChatContext-COIgzkYp.js";
|
|
12
|
-
import {
|
|
13
|
-
import { d as inferWorkspaceLanguage, i as WorkspaceFileState } from "../../WorkspaceFile-C8Riev9j.js";
|
|
14
|
-
import { a as WorkspaceSource, c as workspaceBinaryFileQueryOptions, d as workspaceDirectoryQueryPrefix, f as workspaceFileAssetQueryOptions, g as workspaceTextFileQueryOptions, h as workspaceQueryKey, i as WorkspaceQueryKey, l as workspaceDirectoryQueryKey, m as workspaceInfoQueryOptions, n as WorkspaceFileReadTarget, o as WorkspaceState, p as workspaceFileStatQueryOptions, r as WorkspaceInfo, s as useWorkspace, t as UseWorkspaceOptions, u as workspaceDirectoryQueryOptions } from "../../Workspace-EhvvlHOB.js";
|
|
15
|
-
import { n as WorkspaceExplorerProps, t as WorkspaceExplorer } from "../../WorkspaceExplorer-DygQnEyi.js";
|
|
8
|
+
import { t as ThinkRecoveryNotice } from "../../ThinkRecoveryNotice-DGWr94rk.js";
|
|
16
9
|
import * as React from "react";
|
|
17
10
|
import { UIMessage } from "ai";
|
|
18
11
|
import { UseAgentOptions } from "agents/react";
|
|
19
12
|
import { DataTag, UndefinedInitialDataOptions } from "@tanstack/react-query";
|
|
20
13
|
import { PendingApproval, Think } from "@cloudflare/think";
|
|
21
14
|
import { AgentStub } from "agents/client";
|
|
22
|
-
import { UseVoiceInputReturn } from "@cloudflare/voice/react";
|
|
23
15
|
|
|
24
16
|
//#region src/components/agents-sdk/ThinkChat.d.ts
|
|
25
17
|
type ThinkPendingExecutionApprovalsQueryKey = readonly ["think", sourceKey: string, "pending-approvals"];
|
|
@@ -63,90 +55,20 @@ interface ThinkChatDraft<MessageT extends UIMessage = UIMessage> {
|
|
|
63
55
|
/** Set while the app is creating the conversation, so the composer reads busy. */
|
|
64
56
|
status?: AgentChatProps<MessageT>["status"];
|
|
65
57
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/** Disable the composer (e.g. while the agent is unreachable). */
|
|
74
|
-
disabled?: boolean;
|
|
75
|
-
/** Hide the composer while retaining the normal Think transcript rendering. */
|
|
76
|
-
showComposer?: AgentChatProps<MessageT>["showComposer"];
|
|
77
|
-
/** Shown in place of the list while there are no messages. */
|
|
78
|
-
emptyState?: React.ReactNode;
|
|
79
|
-
/** Welcoming first-turn layout with the live composer centered above starter actions. */
|
|
80
|
-
startScreen?: AgentChatProps<MessageT>["startScreen"];
|
|
81
|
-
/** Extra controls rendered inside the composer, next to the send button. */
|
|
82
|
-
composerTools?: React.ReactNode;
|
|
83
|
-
/** Host-owned slash-command catalog and selection policy. */
|
|
84
|
-
slashCommands?: AgentChatProps<MessageT>["slashCommands"];
|
|
85
|
-
/** App compaction callable behind the built-in `/compact` slash entry. */
|
|
86
|
-
onCompact?: AgentChatProps<MessageT>["onCompact"];
|
|
87
|
-
/** Controlled MCP catalog revealed by `@`; selections become composer references. */
|
|
88
|
-
mentionCommands?: AgentChatProps<MessageT>["mentionCommands"];
|
|
89
|
-
/** Controlled folder or working-context picker in the composer footer. */
|
|
90
|
-
contextSelector?: AgentChatProps<MessageT>["contextSelector"];
|
|
91
|
-
/** Extra controls rendered at the trailing edge, before dictation and submit. */
|
|
92
|
-
composerEndTools?: React.ReactNode;
|
|
93
|
-
/** Whole upstream `useVoiceInput` result for the built-in microphone recorder. */
|
|
94
|
-
voiceInput?: UseVoiceInputReturn;
|
|
95
|
-
/** Host prerequisite run before the built-in recorder calls `voiceInput.start()`. */
|
|
96
|
-
beforeVoiceStart?: AgentChatProps<MessageT>["beforeVoiceStart"];
|
|
97
|
-
/** Optional product state rendered in the PromptInput header, such as an Activity. */
|
|
98
|
-
composerHeader?: AgentChatProps<MessageT>["composerHeader"];
|
|
99
|
-
/** Persistent context (e.g. the Goal banner) in the tray above the composer. */
|
|
100
|
-
composerTray?: AgentChatProps<MessageT>["composerTray"];
|
|
101
|
-
/** Called when a submission is queued behind a busy turn; see AgentChat. */
|
|
102
|
-
onPromptQueued?: AgentChatProps<MessageT>["onPromptQueued"];
|
|
103
|
-
/** Extra rows rendered in the built-in plus menu after files. */
|
|
104
|
-
composerAddMenuItems?: AgentChatProps<MessageT>["composerAddMenuItems"];
|
|
105
|
-
/** Composer placeholder text. */
|
|
106
|
-
placeholder?: string;
|
|
107
|
-
/** Rendered after each message (e.g. per-message actions). */
|
|
108
|
-
renderMessageAfter?: AgentChatProps<MessageT>["renderMessageAfter"];
|
|
109
|
-
/** Per-message policy for AgentChat's built-in assistant copy/retry toolbar. */
|
|
110
|
-
showAssistantActions?: AgentChatProps<MessageT>["showAssistantActions"];
|
|
111
|
-
/**
|
|
112
|
-
* Durable backend edit/resend operation. Think does not synchronize
|
|
113
|
-
* `setMessages`, so wire this to an agent callable that creates the branch.
|
|
114
|
-
*/
|
|
115
|
-
onEditAndResend?: AgentChatProps<MessageT>["onEditAndResend"];
|
|
58
|
+
type ThinkChatManagedAgentChatProp = "messages" | "onApprovalResponse" | "onRegenerate" | "onStop" | "onSubmit" | "status";
|
|
59
|
+
/**
|
|
60
|
+
* The AgentChat composition surface, minus the live values ThinkChat supplies
|
|
61
|
+
* from `useAgentChat`. Think-specific activity and draft/session inputs extend
|
|
62
|
+
* that owner instead of mirroring every AgentChat prop here.
|
|
63
|
+
*/
|
|
64
|
+
type ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> = Omit<AgentChatProps<MessageT>, ThinkChatManagedAgentChatProp> & ThinkChatActivityRendererOptions<MessageT> & {
|
|
116
65
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
66
|
+
* Renders without a chat provider, for the first turn of a conversation
|
|
67
|
+
* that does not exist yet.
|
|
119
68
|
*/
|
|
120
|
-
|
|
121
|
-
/** Whole `useSessionCompaction` result for built-in progress and error notices. */
|
|
69
|
+
draft?: ThinkChatDraft<MessageT>; /** Whole `useSessionCompaction` result for built-in progress and error notices. */
|
|
122
70
|
sessionCompaction?: UseSessionCompactionResult;
|
|
123
|
-
|
|
124
|
-
* Extends the built-in Think activity renderer. Returning `undefined` keeps
|
|
125
|
-
* the built-in result; `defaultRender()` renders that same result on demand.
|
|
126
|
-
* Return `null` only when the part should be intentionally hidden.
|
|
127
|
-
*/
|
|
128
|
-
renderPart?: AgentChatProps<MessageT>["renderPart"];
|
|
129
|
-
/** Whole upstream Think stub. `ThinkChat.Root` wires `agent.stub` automatically. */
|
|
130
|
-
thinkStub?: AgentStub<Think>;
|
|
131
|
-
/**
|
|
132
|
-
* Disable transcript approval scanning, automatic responses, cards, and
|
|
133
|
-
* composer controls. Set the matching prop on `ThinkChat.Root` to also skip
|
|
134
|
-
* durable pending-approval discovery; `ThinkFullApp` wires both from here.
|
|
135
|
-
*/
|
|
136
|
-
approvalsEnabled?: AgentChatProps<MessageT>["approvalsEnabled"];
|
|
137
|
-
/** Parent-owned Ask/Bypass policy; omit to keep AgentChat's session-local mode. */
|
|
138
|
-
permissionModeControl?: AgentChatProps<MessageT>["permissionModeControl"];
|
|
139
|
-
/** Called after a Think approve/reject RPC settles. Root uses this to refresh approvals. */
|
|
140
|
-
onExecutionSettled?: AgentChatProps<MessageT>["onExecutionSettled"];
|
|
141
|
-
/** Think durable-pause approvals from `pendingApprovals()`. */
|
|
142
|
-
pendingApprovals?: AgentChatProps<MessageT>["pendingApprovals"];
|
|
143
|
-
/**
|
|
144
|
-
* Shows a Context ring in the composer footer — how much of the model's
|
|
145
|
-
* window the conversation occupies, from `metadata.usage` on the newest
|
|
146
|
-
* message that reports it.
|
|
147
|
-
*/
|
|
148
|
-
contextWindow?: AgentChatProps<MessageT>["contextWindow"];
|
|
149
|
-
}
|
|
71
|
+
};
|
|
150
72
|
/** Shared pending-approval options for components and TanStack Router loaders. */
|
|
151
73
|
declare function thinkPendingExecutionApprovalsQueryOptions(stub: AgentStub<Think>, sourceKey: string): ThinkPendingExecutionApprovalsQueryOptions;
|
|
152
74
|
declare function useThinkPendingExecutionApprovals(stub: AgentStub<Think>, sourceKey: string, refreshSignal?: unknown, enabled?: boolean): {
|
|
@@ -202,6 +124,7 @@ declare function ThinkChatRoot<State = unknown, MessageT extends UIMessage = UIM
|
|
|
202
124
|
declare function ThinkChatMessages<State = unknown, MessageT extends UIMessage = UIMessage>({
|
|
203
125
|
composerHeader,
|
|
204
126
|
draft,
|
|
127
|
+
loading,
|
|
205
128
|
renderPart,
|
|
206
129
|
excludeTools,
|
|
207
130
|
renderAgentToolRunLink,
|
|
@@ -253,4 +176,4 @@ declare const ThinkChat: {
|
|
|
253
176
|
createActivityRenderer: typeof createThinkChatActivityRenderer;
|
|
254
177
|
};
|
|
255
178
|
//#endregion
|
|
256
|
-
export {
|
|
179
|
+
export { ThinkChat, ThinkChatDraft, ThinkChatMessages, ThinkChatMessagesProps, ThinkChatProvider, ThinkChatProviderProps, ThinkChatRoot, ThinkChatRootProps, ThinkPendingExecutionApprovalsQueryKey, ThinkPendingExecutionApprovalsQueryOptions, thinkPendingExecutionApprovalsQueryOptions, useThinkChat, useThinkPendingExecutionApprovals };
|