@mcp-b/react-components 0.45.0 → 0.46.1
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-Bibfj7u1.d.ts → AgentChat-BLmQghkt.d.ts} +2 -2
- package/dist/{CodeBlock-8K1p1BDU.js → CodeBlock-BpooTofO.js} +1 -1
- package/dist/{FileTree-QTP57Qz4.js → FileTree-CAXWXH63.js} +1 -1
- package/dist/{McpConnectorForm-MRm1r59e.d.ts → McpConnectorForm-BETdVBRk.d.ts} +1 -1
- package/dist/{McpPluginCatalog-mbGw8FTu.d.ts → McpPluginCatalog-C6ip9IvL.d.ts} +2 -2
- package/dist/{PromptInput-BRX7FhjH.d.ts → PromptInput-DtJHyp0S.d.ts} +27 -22
- package/dist/{SetupChecklist-CZeToAbu.js → SetupChecklist-DyPZWzK2.js} +2 -2
- package/dist/{ThinkChat-CWMcl79Q.js → ThinkChat-CV0xWmL4.js} +5 -2
- package/dist/{ThinkChatActivity-CgvmTXXB.d.ts → ThinkChatActivity-B3lGVS-6.d.ts} +1 -1
- package/dist/{WorkspaceFileView-DJ8Oxz57.js → WorkspaceFileView-BvDbKM2c.js} +2 -2
- package/dist/components/agents-sdk/AgentActivity.js +1 -1
- package/dist/components/agents-sdk/AgentChat.d.ts +1 -1
- package/dist/components/agents-sdk/AgentChat.js +30 -31
- package/dist/components/agents-sdk/BrowserLiveScreen.js +1 -1
- package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
- package/dist/components/agents-sdk/BrowserReplay.js +2 -2
- package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
- package/dist/components/agents-sdk/ManagerOffice.d.ts +2 -1
- package/dist/components/agents-sdk/ManagerOffice.js +30 -12
- package/dist/components/agents-sdk/McpConnectionRequest.d.ts +1 -1
- package/dist/components/agents-sdk/McpConnectionRequest.js +10 -4
- package/dist/components/agents-sdk/McpConnectorForm.d.ts +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.d.ts +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +9 -5
- package/dist/components/agents-sdk/McpServerPicker.d.ts +2 -2
- package/dist/components/agents-sdk/McpServerPicker.js +2 -2
- package/dist/components/agents-sdk/ModelSelector.js +2 -2
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +5 -2
- package/dist/components/agents-sdk/PromptInputCommands.js +81 -3
- package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
- package/dist/components/agents-sdk/ThinkChat.d.ts +3 -3
- package/dist/components/agents-sdk/ThinkChat.js +1 -1
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +2 -2
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkFullApp.js +2 -2
- package/dist/components/agents-sdk/ThinkFullAppViewSwitch.js +1 -1
- package/dist/components/agents-sdk/ThinkRoutineBrowser.js +2 -2
- package/dist/components/agents-sdk/ThinkRoutineForm.js +3 -3
- package/dist/components/agents-sdk/ThinkRoutineLibrary.js +3 -3
- package/dist/components/agents-sdk/ThinkSidepanel.js +26 -13
- package/dist/components/agents-sdk/ThinkThreadPicker.js +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
- package/dist/components/agents-sdk/WorkspaceExplorer.js +1 -1
- package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
- package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
- package/dist/components/agents-sdk/WorkspaceMountManager.js +2 -2
- package/dist/components/ai-sdk/Activity.js +1 -1
- package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
- package/dist/components/ai-sdk/Approval.js +1 -1
- package/dist/components/ai-sdk/Artifact.js +1 -1
- package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
- package/dist/components/ai-sdk/ChainOfThought.js +1 -1
- package/dist/components/ai-sdk/Checkpoint.js +1 -1
- package/dist/components/ai-sdk/CodeBlock.js +1 -1
- package/dist/components/ai-sdk/ComposerLink.d.ts +27 -0
- package/dist/components/ai-sdk/ComposerLink.js +111 -0
- package/dist/components/ai-sdk/ConnectedAppCards.js +1 -1
- package/dist/components/ai-sdk/Conversation.js +1 -1
- package/dist/components/ai-sdk/Goal.js +1 -1
- package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
- package/dist/components/ai-sdk/Message.js +18 -2
- package/dist/components/ai-sdk/MessageScroller.js +1 -1
- package/dist/components/ai-sdk/MessageScrollerVirtual.js +1 -1
- 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 +78 -59
- package/dist/components/ai-sdk/PromptInputComposerEditor.d.ts +31 -0
- package/dist/components/ai-sdk/PromptInputComposerEditor.js +198 -0
- package/dist/components/ai-sdk/Queue.js +1 -1
- package/dist/components/ai-sdk/Reasoning.js +1 -1
- package/dist/components/ai-sdk/Sources.js +1 -1
- package/dist/components/ai-sdk/Task.js +1 -1
- package/dist/components/extension/ChatGptSignInScreen.js +2 -2
- package/dist/components/extension/CodexModelSelector.js +1 -1
- package/dist/components/extension/ConversationTabPicker.js +1 -1
- package/dist/components/foundations/AppIcon.js +1 -1
- package/dist/components/foundations/Checkbox.js +1 -1
- package/dist/components/foundations/ContextMenu.js +1 -1
- package/dist/components/foundations/Menubar.js +1 -1
- package/dist/components/foundations/SearchField.js +1 -1
- package/dist/components/foundations/Select.js +1 -1
- package/dist/components/foundations/Stepper.js +1 -1
- package/dist/components/foundations/Toast.js +1 -1
- package/dist/components/foundations/ToggleGroup.d.ts +1 -1
- package/dist/components/foundations/ToggleGroup.js +1 -1
- package/dist/components/foundations/icons.d.ts +1 -1
- package/dist/components/foundations/icons.js +1 -1
- package/dist/components/general-purpose/Commit.js +2 -2
- package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
- package/dist/components/general-purpose/FileTree.js +1 -1
- package/dist/components/general-purpose/PricingConfirmationDialog.js +1 -1
- package/dist/components/general-purpose/PricingPlanCard.js +1 -1
- package/dist/components/general-purpose/PricingUsageCalculator.js +1 -1
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
- package/dist/components/general-purpose/SetupChecklist.js +1 -1
- package/dist/components/general-purpose/Terminal.js +2 -2
- package/dist/components/general-purpose/TestResults.js +1 -1
- package/dist/components/general-purpose/ThemeModeControl.js +1 -1
- package/dist/components/general-purpose/WebPreview.js +1 -1
- package/dist/components/nanites/AgentConnection.js +2 -2
- package/dist/components/nanites/AgentToolDetail.js +3 -3
- package/dist/{copy-button-BpA7wQva.js → copy-button-D7ySsRRo.js} +1 -1
- package/dist/{icons-DbrksZyY.js → icons-BNEY4gO5.js} +44 -4
- package/dist/{icons-6ZnyZJiR.d.ts → icons-D0Pd2P9v.d.ts} +9 -4
- package/dist/{mcp-server-SD_S-IpB.js → mcp-server-7NR24ASj.js} +31 -4
- package/dist/{mcp-server-catalog-CCj2ItkV.d.ts → mcp-server-catalog-Cbu483Zb.d.ts} +9 -9
- package/dist/{provider-logos-zjZycgV6.js → provider-logos-DWYY8wNz.js} +31 -6
- package/dist/styles/action-guide.css +4 -0
- package/dist/styles/agent-attention.css +5 -1
- package/dist/styles/agent-chat.css +21 -18
- package/dist/styles/app-icon.css +21 -0
- package/dist/styles/brand-marks.css +22 -0
- package/dist/styles/composer-link.css +99 -0
- package/dist/styles/connected-app-card.css +9 -0
- package/dist/styles/github-motion-mark.css +8 -1
- package/dist/styles/index.css +2 -0
- package/dist/styles/manager-office.css +10 -3
- package/dist/styles/mcp-plugin-catalog.css +4 -0
- package/dist/styles/mcp-server-picker.css +2 -0
- package/dist/styles/prompt-input.css +14 -53
- package/dist/styles/think-sidepanel.css +9 -0
- package/dist/utils/composer-link.d.ts +59 -0
- package/dist/utils/composer-link.js +203 -0
- package/dist/utils/mcp-server-catalog.d.ts +1 -1
- package/dist/utils/mcp-server-catalog.js +9 -9
- package/package.json +2 -2
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { brandHexFromIconSrc, parseComposerHref, sampleImageAccent } from "../../utils/composer-link.js";
|
|
2
|
+
import { getMcpServerIconSrc } from "../../utils/mcp-server-catalog.js";
|
|
3
|
+
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
4
|
+
import { c as BoxIcon } from "../../icons-BNEY4gO5.js";
|
|
5
|
+
import { n as findCatalogMcpServerCard } from "../../mcp-server-7NR24ASj.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ai-sdk/ComposerLink.tsx
|
|
9
|
+
function composerLinkIconSrc(parts) {
|
|
10
|
+
if (!parts) return void 0;
|
|
11
|
+
if (parts.iconSrc) return parts.iconSrc;
|
|
12
|
+
if (parts.kind !== "mcp") return void 0;
|
|
13
|
+
const card = findCatalogMcpServerCard({
|
|
14
|
+
id: parts.value,
|
|
15
|
+
name: parts.value
|
|
16
|
+
});
|
|
17
|
+
return card ? getMcpServerIconSrc(card) : void 0;
|
|
18
|
+
}
|
|
19
|
+
function composerLinkUsesCube(parts) {
|
|
20
|
+
if (!parts) return false;
|
|
21
|
+
if (parts.chromeIcon === "box") return true;
|
|
22
|
+
return !composerLinkIconSrc(parts) && (parts.kind === "command" || parts.kind === "skill");
|
|
23
|
+
}
|
|
24
|
+
function composerLinkAccent(parts) {
|
|
25
|
+
const fromHref = brandHexFromIconSrc(parts?.iconSrc);
|
|
26
|
+
if (fromHref) return fromHref;
|
|
27
|
+
const fromSrc = brandHexFromIconSrc(composerLinkIconSrc(parts));
|
|
28
|
+
if (fromSrc) return fromSrc;
|
|
29
|
+
if (parts?.kind !== "mcp") return void 0;
|
|
30
|
+
const card = findCatalogMcpServerCard({
|
|
31
|
+
id: parts.value,
|
|
32
|
+
name: parts.value
|
|
33
|
+
});
|
|
34
|
+
return card ? brandHexFromIconSrc(getMcpServerIconSrc(card)) : void 0;
|
|
35
|
+
}
|
|
36
|
+
function applyComposerLinkColor(element, color) {
|
|
37
|
+
if (color) element.style.setProperty("--composer-link-color", color);
|
|
38
|
+
}
|
|
39
|
+
function bindSampledIconColor(link, known) {
|
|
40
|
+
if (known) {
|
|
41
|
+
applyComposerLinkColor(link, known);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const image = link.querySelector("img");
|
|
45
|
+
if (!(image instanceof HTMLImageElement)) return;
|
|
46
|
+
const apply = () => {
|
|
47
|
+
const sampled = sampleImageAccent(image);
|
|
48
|
+
if (sampled) applyComposerLinkColor(link, sampled);
|
|
49
|
+
};
|
|
50
|
+
if (image.complete) apply();
|
|
51
|
+
else image.addEventListener("load", apply, { once: true });
|
|
52
|
+
}
|
|
53
|
+
function ComposerLinkIcon({ icon, parts }) {
|
|
54
|
+
if (icon) return /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: "composer-link__icon",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
children: icon
|
|
58
|
+
});
|
|
59
|
+
const src = composerLinkIconSrc(parts);
|
|
60
|
+
if (src) return /* @__PURE__ */ jsx("img", {
|
|
61
|
+
alt: "",
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
className: "composer-link__icon",
|
|
64
|
+
decoding: "async",
|
|
65
|
+
draggable: false,
|
|
66
|
+
referrerPolicy: "no-referrer",
|
|
67
|
+
src
|
|
68
|
+
});
|
|
69
|
+
if (composerLinkUsesCube(parts)) return /* @__PURE__ */ jsx(BoxIcon, { className: "composer-link__icon" });
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Inline identity link for composer entities: slash commands, MCP mentions,
|
|
74
|
+
* skills, tabs, and files. The href is the source of truth; the visible node
|
|
75
|
+
* is text plus an optional brand mark, not a button chip.
|
|
76
|
+
*/
|
|
77
|
+
function ComposerLink({ href, icon, className, children, onClick, style, ...props }) {
|
|
78
|
+
const parts = parseComposerHref(href);
|
|
79
|
+
const kind = parts?.kind;
|
|
80
|
+
const accent = composerLinkAccent(parts);
|
|
81
|
+
const linkRef = React.useRef(null);
|
|
82
|
+
React.useLayoutEffect(() => {
|
|
83
|
+
const link = linkRef.current;
|
|
84
|
+
if (link) bindSampledIconColor(link, accent);
|
|
85
|
+
}, [accent, href]);
|
|
86
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
87
|
+
ref: linkRef,
|
|
88
|
+
className: cx("composer-link", className),
|
|
89
|
+
"data-composer-link": kind,
|
|
90
|
+
href,
|
|
91
|
+
rel: "nofollow",
|
|
92
|
+
style: accent ? {
|
|
93
|
+
"--composer-link-color": accent,
|
|
94
|
+
...style
|
|
95
|
+
} : style,
|
|
96
|
+
onClick: (event) => {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
onClick?.(event);
|
|
99
|
+
},
|
|
100
|
+
...props,
|
|
101
|
+
children: [/* @__PURE__ */ jsx(ComposerLinkIcon, {
|
|
102
|
+
icon,
|
|
103
|
+
parts
|
|
104
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
105
|
+
className: "composer-link__label",
|
|
106
|
+
children
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { ComposerLink, composerLinkAccent, composerLinkIconSrc, composerLinkUsesCube };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { K as SlackIcon, O as MailIcon, _ as DotIcon, d as CheckIcon, nt as XIcon, u as CalendarIcon } from "../../icons-
|
|
2
|
+
import { K as SlackIcon, O as MailIcon, _ as DotIcon, d as CheckIcon, nt as XIcon, u as CalendarIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
4
|
import { Field } from "../foundations/Field.js";
|
|
5
5
|
import { Textarea } from "../foundations/Textarea.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { n as ArrowDownIcon, v as DownloadIcon } from "../../icons-
|
|
2
|
+
import { n as ArrowDownIcon, v as DownloadIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { IconButton } from "../foundations/IconButton.js";
|
|
4
4
|
import { t as assignRef } from "../../merge-refs-DF_7w2x_.js";
|
|
5
5
|
import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport } from "./MessageScroller.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { $ as TrashIcon, B as PlayIcon, R as PauseIcon, Z as TargetIcon } from "../../icons-
|
|
2
|
+
import { $ as TrashIcon, B as PlayIcon, R as PauseIcon, Z as TargetIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { IconButton } from "../foundations/IconButton.js";
|
|
4
4
|
import { a as formatErrorMessage } from "../../format-COCyV98Z.js";
|
|
5
5
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { B as PlayIcon } from "../../icons-
|
|
2
|
+
import { B as PlayIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
|
|
4
4
|
import { Card } from "../foundations/Card.js";
|
|
5
5
|
import * as React from "react";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { parseComposerHref } from "../../utils/composer-link.js";
|
|
1
2
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { S as FileIcon, i as ArrowRightIcon, r as ArrowLeftIcon } from "../../icons-
|
|
3
|
+
import { S as FileIcon, i as ArrowRightIcon, r as ArrowLeftIcon } from "../../icons-BNEY4gO5.js";
|
|
3
4
|
import { Button } from "../foundations/Button.js";
|
|
4
5
|
import { IconButton } from "../foundations/IconButton.js";
|
|
5
6
|
import { t as AttachmentPreview } from "../../attachment-preview-1CXJvrmb.js";
|
|
6
7
|
import { n as clamp } from "../../format-COCyV98Z.js";
|
|
8
|
+
import { ComposerLink } from "./ComposerLink.js";
|
|
7
9
|
import * as React from "react";
|
|
8
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
11
|
import { cjk } from "@streamdown/cjk";
|
|
@@ -78,7 +80,21 @@ const streamdownPlugins = {
|
|
|
78
80
|
cjk,
|
|
79
81
|
code
|
|
80
82
|
};
|
|
81
|
-
|
|
83
|
+
function MessageResponseLink({ href, children, ...props }) {
|
|
84
|
+
return href && parseComposerHref(href) ? /* @__PURE__ */ jsx(ComposerLink, {
|
|
85
|
+
href,
|
|
86
|
+
children
|
|
87
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
88
|
+
href,
|
|
89
|
+
"data-streamdown": "link",
|
|
90
|
+
...props,
|
|
91
|
+
children
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const messageResponseComponents = {
|
|
95
|
+
img: "img",
|
|
96
|
+
a: MessageResponseLink
|
|
97
|
+
};
|
|
82
98
|
const MessageResponse = React.memo(function MessageResponse({ className, components, ...props }) {
|
|
83
99
|
return /* @__PURE__ */ jsx(Streamdown, {
|
|
84
100
|
className: cx("message__response", "sigvelo-reader-text", className),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { n as ArrowDownIcon } from "../../icons-
|
|
2
|
+
import { n as ArrowDownIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
4
|
import { t as messageScrollerContract } from "../../message-scroller-C8cplcQO.js";
|
|
5
5
|
import "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { n as ArrowDownIcon } from "../../icons-
|
|
2
|
+
import { n as ArrowDownIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { Button } from "../foundations/Button.js";
|
|
4
4
|
import { t as messageScrollerContract } from "../../message-scroller-C8cplcQO.js";
|
|
5
5
|
import * as React from "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { _ as DotIcon, d as CheckIcon, i as ArrowRightIcon } from "../../icons-
|
|
2
|
+
import { _ as DotIcon, d as CheckIcon, i as ArrowRightIcon } from "../../icons-BNEY4gO5.js";
|
|
3
3
|
import { Popover } from "../foundations/Popover.js";
|
|
4
4
|
import { t as ProgressRing } from "../../progress-ring-Cgii90dC.js";
|
|
5
5
|
import * as React from "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AttachmentsContext, PermissionMode, PromptInput, PromptInputActionAddAttachments, PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuContentProps, PromptInputActionMenuItem, PromptInputActionMenuItemProps, PromptInputActionMenuProps, PromptInputActionMenuTrigger, PromptInputActionMenuTriggerProps, PromptInputAttachment, PromptInputAttachmentProps, PromptInputAttachments, PromptInputAttachmentsProps, PromptInputBody, PromptInputBodyProps, PromptInputButton, PromptInputButtonProps, PromptInputButtonTooltip, PromptInputCommandComposer, PromptInputCommandComposerProps, PromptInputCommandDefinition, PromptInputCommandTrigger, PromptInputContextAction, PromptInputContextItem, PromptInputContextSelector, PromptInputContextSelectorProps, PromptInputControllerProps, PromptInputDictation, PromptInputDictationProps, PromptInputFooter, PromptInputFooterProps, PromptInputHeader, PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardContentProps, PromptInputHoverCardProps, PromptInputHoverCardTrigger, PromptInputHoverCardTriggerProps, PromptInputMessage, PromptInputPermissionSelector, PromptInputPermissionSelectorProps, PromptInputProps, PromptInputProvider, PromptInputProviderProps, PromptInputReference,
|
|
1
|
+
import { $ as PromptInputSubmit, A as PromptInputContextItem, B as PromptInputHoverCard, C as PromptInputButtonProps, Ct as usePromptInputController, D as PromptInputCommandDefinition, E as PromptInputCommandComposerProps, F as PromptInputDictationProps, G as PromptInputHoverCardTriggerProps, H as PromptInputHoverCardContentProps, I as PromptInputFooter, J as PromptInputPermissionSelectorProps, K as PromptInputMessage, L as PromptInputFooterProps, M as PromptInputContextSelectorProps, N as PromptInputControllerProps, O as PromptInputCommandTrigger, P as PromptInputDictation, Q as PromptInputReference, R as PromptInputHeader, S as PromptInputButton, St as usePromptInputAttachments, T as PromptInputCommandComposer, U as PromptInputHoverCardProps, V as PromptInputHoverCardContent, W as PromptInputHoverCardTrigger, X as PromptInputProvider, Y as PromptInputProps, Z as PromptInputProviderProps, _ as PromptInputAttachmentProps, _t as PromptInputTrayProps, a as PromptInputActionAddAttachmentsProps, at as PromptInputTabItemProps, b as PromptInputBody, bt as TooltipSide, c as PromptInputActionMenu, ct as PromptInputTabProps, d as PromptInputActionMenuItem, dt as PromptInputTextarea, et as PromptInputSubmitProps, f as PromptInputActionMenuItemProps, ft as PromptInputTextareaProps, g as PromptInputAttachment, gt as PromptInputTray, h as PromptInputActionMenuTriggerProps, ht as PromptInputTooltipConfig, i as PromptInputActionAddAttachments, it as PromptInputTabItem, j as PromptInputContextSelector, k as PromptInputContextAction, l as PromptInputActionMenuContent, lt as PromptInputTabsList, m as PromptInputActionMenuTrigger, mt as PromptInputToolsProps, n as PermissionMode, nt as PromptInputTabBody, o as PromptInputActionAddScreenshot, ot as PromptInputTabLabel, p as PromptInputActionMenuProps, pt as PromptInputTools, q as PromptInputPermissionSelector, r as PromptInput, rt as PromptInputTabBodyProps, s as PromptInputActionAddScreenshotProps, st as PromptInputTabLabelProps, t as AttachmentsContext, tt as PromptInputTab, u as PromptInputActionMenuContentProps, ut as PromptInputTabsListProps, v as PromptInputAttachments, vt as PromptInputVoiceInput, w as PromptInputButtonTooltip, wt as useProviderAttachments, x as PromptInputBodyProps, xt as composerLinksToReferences, y as PromptInputAttachmentsProps, yt as TextInputContext, z as PromptInputHeaderProps } from "../../PromptInput-DtJHyp0S.js";
|
|
2
|
+
export { AttachmentsContext, PermissionMode, PromptInput, PromptInputActionAddAttachments, PromptInputActionAddAttachmentsProps, PromptInputActionAddScreenshot, PromptInputActionAddScreenshotProps, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuContentProps, PromptInputActionMenuItem, PromptInputActionMenuItemProps, PromptInputActionMenuProps, PromptInputActionMenuTrigger, PromptInputActionMenuTriggerProps, PromptInputAttachment, PromptInputAttachmentProps, PromptInputAttachments, PromptInputAttachmentsProps, PromptInputBody, PromptInputBodyProps, PromptInputButton, PromptInputButtonProps, PromptInputButtonTooltip, PromptInputCommandComposer, PromptInputCommandComposerProps, PromptInputCommandDefinition, PromptInputCommandTrigger, PromptInputContextAction, PromptInputContextItem, PromptInputContextSelector, PromptInputContextSelectorProps, PromptInputControllerProps, PromptInputDictation, PromptInputDictationProps, PromptInputFooter, PromptInputFooterProps, PromptInputHeader, PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardContentProps, PromptInputHoverCardProps, PromptInputHoverCardTrigger, PromptInputHoverCardTriggerProps, PromptInputMessage, PromptInputPermissionSelector, PromptInputPermissionSelectorProps, PromptInputProps, PromptInputProvider, PromptInputProviderProps, PromptInputReference, PromptInputSubmit, PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, PromptInputTabBodyProps, PromptInputTabItem, PromptInputTabItemProps, PromptInputTabLabel, PromptInputTabLabelProps, PromptInputTabProps, PromptInputTabsList, PromptInputTabsListProps, PromptInputTextarea, PromptInputTextareaProps, PromptInputTools, PromptInputToolsProps, PromptInputTooltipConfig, PromptInputTray, PromptInputTrayProps, PromptInputVoiceInput, TextInputContext, TooltipSide, composerLinksToReferences, usePromptInputAttachments, usePromptInputController, useProviderAttachments };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { composerTriggerMatch, parseComposerLinks, replaceComposerTrigger } from "../../utils/composer-link.js";
|
|
1
2
|
import { n as mergeBaseClassName, t as cx } from "../../class-names-BiMDVpUo.js";
|
|
2
|
-
import { C as FolderIcon, J as SquareIcon, L as PaperclipIcon, M as MicrophoneIcon, P as MonitorIcon, S as FileIcon, V as PlusIcon, Y as StopIcon, a as ArrowUpIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon, nt as XIcon, q as SpinnerIcon, tt as WrenchIcon } from "../../icons-
|
|
3
|
+
import { C as FolderIcon, J as SquareIcon, L as PaperclipIcon, M as MicrophoneIcon, P as MonitorIcon, S as FileIcon, V as PlusIcon, Y as StopIcon, a as ArrowUpIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon, nt as XIcon, q as SpinnerIcon, tt as WrenchIcon } from "../../icons-BNEY4gO5.js";
|
|
3
4
|
import { Button } from "../foundations/Button.js";
|
|
4
5
|
import { Tooltip } from "../foundations/Tooltip.js";
|
|
5
6
|
import { IconButton } from "../foundations/IconButton.js";
|
|
@@ -11,6 +12,8 @@ import { Tabs } from "../foundations/Tabs.js";
|
|
|
11
12
|
import { t as AttachmentPreview } from "../../attachment-preview-1CXJvrmb.js";
|
|
12
13
|
import { a as formatErrorMessage, i as formatClock, n as clamp } from "../../format-COCyV98Z.js";
|
|
13
14
|
import { n as mergeRefs } from "../../merge-refs-DF_7w2x_.js";
|
|
15
|
+
import { ComposerLink } from "./ComposerLink.js";
|
|
16
|
+
import { PromptInputComposerEditor, readComposerDom, writeComposerDom } from "./PromptInputComposerEditor.js";
|
|
14
17
|
import * as React from "react";
|
|
15
18
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
16
19
|
//#region src/components/ai-sdk/PromptInput.tsx
|
|
@@ -235,17 +238,21 @@ function PromptInput({ className, accept, multiple, globalDrop, syncHiddenInput,
|
|
|
235
238
|
]);
|
|
236
239
|
const handleSubmit = React.useCallback(async (event) => {
|
|
237
240
|
event.preventDefault();
|
|
238
|
-
const
|
|
239
|
-
const
|
|
241
|
+
const field = event.currentTarget.querySelector("[data-prompt-input-textarea=\"true\"]");
|
|
242
|
+
const fieldText = field instanceof HTMLTextAreaElement ? field.value : field?.isContentEditable ? readComposerDom(field) : "";
|
|
243
|
+
const text = (controller?.textInput.value ?? fieldText).trim();
|
|
240
244
|
const submittedFiles = await Promise.all(files.map(resolveSubmittedFile));
|
|
241
245
|
try {
|
|
242
246
|
const submission = onSubmit?.({
|
|
243
247
|
text,
|
|
244
248
|
files: submittedFiles
|
|
245
249
|
}, event);
|
|
246
|
-
if (!controller &&
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
if (!controller && field instanceof HTMLTextAreaElement) {
|
|
251
|
+
field.value = "";
|
|
252
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
253
|
+
} else if (!controller && field?.isContentEditable) {
|
|
254
|
+
field.replaceChildren();
|
|
255
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
249
256
|
}
|
|
250
257
|
controller?.textInput.clear();
|
|
251
258
|
clearAttachments();
|
|
@@ -525,10 +532,11 @@ function PromptInputDictation({ voice, beforeStart, className, disabled, ref, ..
|
|
|
525
532
|
voice.clear();
|
|
526
533
|
return;
|
|
527
534
|
}
|
|
528
|
-
const
|
|
529
|
-
if (!
|
|
530
|
-
Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set?.call(
|
|
531
|
-
|
|
535
|
+
const field = buttonRef.current?.form?.querySelector("[data-prompt-input-textarea=\"true\"]");
|
|
536
|
+
if (!field) return;
|
|
537
|
+
if (field instanceof HTMLTextAreaElement) Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set?.call(field, appendDictationTranscript(field.value, addition));
|
|
538
|
+
else if (field.isContentEditable) writeComposerDom(field, appendDictationTranscript(readComposerDom(field), addition));
|
|
539
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
532
540
|
voice.clear();
|
|
533
541
|
}, [
|
|
534
542
|
controller,
|
|
@@ -988,25 +996,43 @@ function PromptInputTabLabel({ className, ref, ...props }) {
|
|
|
988
996
|
...props
|
|
989
997
|
});
|
|
990
998
|
}
|
|
991
|
-
function PromptInputTabItem({ className, ref, ...props }) {
|
|
992
|
-
return /* @__PURE__ */ jsx(
|
|
999
|
+
function PromptInputTabItem({ className, href, icon, children, ref, ...props }) {
|
|
1000
|
+
if (href) return /* @__PURE__ */ jsx(ComposerLink, {
|
|
1001
|
+
href,
|
|
1002
|
+
icon,
|
|
1003
|
+
className: cx("prompt-input__tab-item", className),
|
|
1004
|
+
children
|
|
1005
|
+
});
|
|
1006
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
993
1007
|
ref,
|
|
994
1008
|
className: cx("prompt-input__tab-item", className),
|
|
995
|
-
...props
|
|
1009
|
+
...props,
|
|
1010
|
+
children: [icon, children]
|
|
996
1011
|
});
|
|
997
1012
|
}
|
|
1013
|
+
function composerLinksToReferences(text) {
|
|
1014
|
+
return parseComposerLinks(text).map((link) => ({
|
|
1015
|
+
id: `${link.kind}:${link.value}`,
|
|
1016
|
+
value: link.value,
|
|
1017
|
+
label: link.label,
|
|
1018
|
+
href: link.href,
|
|
1019
|
+
iconSrc: link.iconSrc,
|
|
1020
|
+
trigger: link.kind === "mcp" || link.kind === "tab" ? "@" : "/"
|
|
1021
|
+
}));
|
|
1022
|
+
}
|
|
998
1023
|
/**
|
|
999
|
-
* Controlled
|
|
1000
|
-
*
|
|
1024
|
+
* Controlled composer field with slash-command and mention discovery.
|
|
1025
|
+
* Selection inserts a special href into the draft — not a chip button.
|
|
1001
1026
|
*/
|
|
1002
|
-
function PromptInputCommandComposer({ commands, mentionCommands, value, onValueChange, onCommandSelect, emptyMessage = "No commands found.", mentionEmptyMessage = "No MCP servers found.", onKeyDown, ref,
|
|
1027
|
+
function PromptInputCommandComposer({ commands, mentionCommands, value, onValueChange, onCommandSelect, emptyMessage = "No commands found.", mentionEmptyMessage = "No MCP servers found.", onKeyDown, ref, placeholder, disabled, className, minHeight, maxHeight, "aria-label": ariaLabel }) {
|
|
1003
1028
|
const inputRef = React.useRef(null);
|
|
1029
|
+
const highlightedCommandRef = React.useRef(void 0);
|
|
1004
1030
|
const [dismissedValue, setDismissedValue] = React.useState(null);
|
|
1005
1031
|
React.useImperativeHandle(ref, () => inputRef.current, []);
|
|
1006
|
-
const match =
|
|
1007
|
-
const trigger = match?.
|
|
1032
|
+
const match = composerTriggerMatch(value);
|
|
1033
|
+
const trigger = match?.trigger;
|
|
1008
1034
|
const sourceCommands = trigger === "@" ? mentionCommands ?? [] : commands;
|
|
1009
|
-
const normalizedQuery = (match?.
|
|
1035
|
+
const normalizedQuery = (match?.query.trim() ?? "").toLocaleLowerCase();
|
|
1010
1036
|
const filtered = sourceCommands.filter((command) => {
|
|
1011
1037
|
if (!normalizedQuery) return true;
|
|
1012
1038
|
return [
|
|
@@ -1022,6 +1048,12 @@ function PromptInputCommandComposer({ commands, mentionCommands, value, onValueC
|
|
|
1022
1048
|
label,
|
|
1023
1049
|
items: filtered.filter((command) => (command.group ?? "") === label)
|
|
1024
1050
|
}));
|
|
1051
|
+
const selectCommand = (command) => {
|
|
1052
|
+
const nextTrigger = trigger ?? "/";
|
|
1053
|
+
onValueChange(replaceComposerTrigger(value, command, nextTrigger));
|
|
1054
|
+
setDismissedValue(null);
|
|
1055
|
+
onCommandSelect(command, nextTrigger);
|
|
1056
|
+
};
|
|
1025
1057
|
return /* @__PURE__ */ jsxs(Autocomplete.Root, {
|
|
1026
1058
|
items: groups,
|
|
1027
1059
|
filteredItems: groups,
|
|
@@ -1030,6 +1062,9 @@ function PromptInputCommandComposer({ commands, mentionCommands, value, onValueC
|
|
|
1030
1062
|
open,
|
|
1031
1063
|
autoHighlight: true,
|
|
1032
1064
|
itemToStringValue: (command) => command.value,
|
|
1065
|
+
onItemHighlighted: (command) => {
|
|
1066
|
+
highlightedCommandRef.current = command;
|
|
1067
|
+
},
|
|
1033
1068
|
onValueChange: (next, { reason }) => {
|
|
1034
1069
|
if (reason !== "input-change") return;
|
|
1035
1070
|
setDismissedValue(null);
|
|
@@ -1038,11 +1073,29 @@ function PromptInputCommandComposer({ commands, mentionCommands, value, onValueC
|
|
|
1038
1073
|
onOpenChange: (nextOpen) => {
|
|
1039
1074
|
if (!nextOpen) setDismissedValue(value);
|
|
1040
1075
|
},
|
|
1041
|
-
children: [/* @__PURE__ */ jsx(Autocomplete.Input, { render: /* @__PURE__ */ jsx(
|
|
1042
|
-
...textareaProps,
|
|
1076
|
+
children: [/* @__PURE__ */ jsx(Autocomplete.Input, { render: /* @__PURE__ */ jsx(PromptInputComposerEditor, {
|
|
1043
1077
|
ref: inputRef,
|
|
1044
|
-
value,
|
|
1045
|
-
|
|
1078
|
+
draft: value,
|
|
1079
|
+
onDraftChange: (next) => {
|
|
1080
|
+
setDismissedValue(null);
|
|
1081
|
+
onValueChange(next);
|
|
1082
|
+
},
|
|
1083
|
+
onKeyDown: (event) => {
|
|
1084
|
+
onKeyDown?.(event);
|
|
1085
|
+
if (event.defaultPrevented || event.key !== "Enter" || !open) return;
|
|
1086
|
+
const highlightedCommand = highlightedCommandRef.current;
|
|
1087
|
+
if (highlightedCommand && !highlightedCommand.disabled && filtered.includes(highlightedCommand)) return;
|
|
1088
|
+
const command = filtered.find((candidate) => !candidate.disabled);
|
|
1089
|
+
if (!command) return;
|
|
1090
|
+
event.preventDefault();
|
|
1091
|
+
selectCommand(command);
|
|
1092
|
+
},
|
|
1093
|
+
placeholder,
|
|
1094
|
+
disabled,
|
|
1095
|
+
className,
|
|
1096
|
+
minHeight,
|
|
1097
|
+
maxHeight,
|
|
1098
|
+
"aria-label": ariaLabel
|
|
1046
1099
|
}) }), /* @__PURE__ */ jsx(Autocomplete.Portal, { children: /* @__PURE__ */ jsx(Autocomplete.Positioner, {
|
|
1047
1100
|
anchor: () => inputRef.current?.closest(".prompt-input__body") ?? null,
|
|
1048
1101
|
side: "top",
|
|
@@ -1061,7 +1114,7 @@ function PromptInputCommandComposer({ commands, mentionCommands, value, onValueC
|
|
|
1061
1114
|
value: command,
|
|
1062
1115
|
disabled: command.disabled,
|
|
1063
1116
|
className: "prompt-input__command-item",
|
|
1064
|
-
onClick: () =>
|
|
1117
|
+
onClick: () => selectCommand(command),
|
|
1065
1118
|
children: [command.icon ? /* @__PURE__ */ jsx("span", {
|
|
1066
1119
|
className: "prompt-input__command-icon",
|
|
1067
1120
|
children: command.icon
|
|
@@ -1089,40 +1142,6 @@ function PromptInputCommandComposer({ commands, mentionCommands, value, onValueC
|
|
|
1089
1142
|
}) })]
|
|
1090
1143
|
});
|
|
1091
1144
|
}
|
|
1092
|
-
/** Removable inline context selected from slash-command or mention pickers. */
|
|
1093
|
-
function PromptInputReferences({ references, onRemove, className, ref, ...props }) {
|
|
1094
|
-
if (!references.length) return null;
|
|
1095
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1096
|
-
ref,
|
|
1097
|
-
className: cx("prompt-input__references", className),
|
|
1098
|
-
role: "group",
|
|
1099
|
-
"aria-label": "Selected context",
|
|
1100
|
-
...props,
|
|
1101
|
-
children: references.map((reference) => /* @__PURE__ */ jsxs(Button, {
|
|
1102
|
-
type: "button",
|
|
1103
|
-
variant: "ghost",
|
|
1104
|
-
color: "primary",
|
|
1105
|
-
size: "xs",
|
|
1106
|
-
className: "prompt-input__reference",
|
|
1107
|
-
"aria-label": `Remove ${reference.label}`,
|
|
1108
|
-
onClick: () => onRemove(reference),
|
|
1109
|
-
children: [
|
|
1110
|
-
reference.icon ? /* @__PURE__ */ jsx("span", {
|
|
1111
|
-
className: "prompt-input__reference-icon",
|
|
1112
|
-
children: reference.icon
|
|
1113
|
-
}) : null,
|
|
1114
|
-
/* @__PURE__ */ jsx("span", {
|
|
1115
|
-
className: "prompt-input__reference-label sigvelo-truncate",
|
|
1116
|
-
children: reference.label
|
|
1117
|
-
}),
|
|
1118
|
-
/* @__PURE__ */ jsx(XIcon, {
|
|
1119
|
-
className: "prompt-input__reference-remove",
|
|
1120
|
-
size: 14
|
|
1121
|
-
})
|
|
1122
|
-
]
|
|
1123
|
-
}, `${reference.trigger ?? "reference"}:${reference.id}`))
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
1145
|
/** Controlled composer-footer picker for a host-owned folder or working context. */
|
|
1127
1146
|
function PromptInputContextSelector({ items, value, onValueChange, categoryLabel = "Folder", unavailableLabel = "Folder unavailable", action }) {
|
|
1128
1147
|
const selected = items.find((item) => item.value === value);
|
|
@@ -1290,4 +1309,4 @@ function createId() {
|
|
|
1290
1309
|
return globalThis.crypto?.randomUUID?.() ?? `prompt-input-${Date.now()}-${Math.random()}`;
|
|
1291
1310
|
}
|
|
1292
1311
|
//#endregion
|
|
1293
|
-
export { PromptInput, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputActionMenuTrigger, PromptInputAttachment, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputCommandComposer, PromptInputContextSelector, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardTrigger, PromptInputPermissionSelector, PromptInputProvider,
|
|
1312
|
+
export { PromptInput, PromptInputActionAddAttachments, PromptInputActionAddScreenshot, PromptInputActionMenu, PromptInputActionMenuContent, PromptInputActionMenuItem, PromptInputActionMenuTrigger, PromptInputAttachment, PromptInputAttachments, PromptInputBody, PromptInputButton, PromptInputCommandComposer, PromptInputContextSelector, PromptInputDictation, PromptInputFooter, PromptInputHeader, PromptInputHoverCard, PromptInputHoverCardContent, PromptInputHoverCardTrigger, PromptInputPermissionSelector, PromptInputProvider, PromptInputSubmit, PromptInputTab, PromptInputTabBody, PromptInputTabItem, PromptInputTabLabel, PromptInputTabsList, PromptInputTextarea, PromptInputTools, PromptInputTray, composerLinksToReferences, usePromptInputAttachments, usePromptInputController, useProviderAttachments };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ai-sdk/PromptInputComposerEditor.d.ts
|
|
4
|
+
declare function writeComposerDom(element: HTMLElement, markdown: string): void;
|
|
5
|
+
declare function readComposerDom(element: HTMLElement): string;
|
|
6
|
+
interface PromptInputComposerEditorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "value"> {
|
|
7
|
+
/** Markdown draft. Named apart from Autocomplete's `value` so the two cannot collide. */
|
|
8
|
+
draft: string;
|
|
9
|
+
onDraftChange: (value: string) => void;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
minHeight?: number;
|
|
12
|
+
maxHeight?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare function PromptInputComposerEditor({
|
|
16
|
+
className,
|
|
17
|
+
placeholder,
|
|
18
|
+
minHeight,
|
|
19
|
+
maxHeight,
|
|
20
|
+
draft,
|
|
21
|
+
onDraftChange,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
onPaste,
|
|
24
|
+
disabled,
|
|
25
|
+
ref,
|
|
26
|
+
...props
|
|
27
|
+
}: PromptInputComposerEditorProps & {
|
|
28
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
29
|
+
}): React.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { PromptInputComposerEditor, PromptInputComposerEditorProps, readComposerDom, writeComposerDom };
|