@yourgpt/copilot-sdk 2.0.2-beta.2 → 2.1.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/README.md +0 -42
- package/dist/{chunk-UOWLKFXK.cjs → chunk-33JSFVGH.cjs} +23 -23
- package/dist/{chunk-UOWLKFXK.cjs.map → chunk-33JSFVGH.cjs.map} +1 -1
- package/dist/{chunk-IXFV6AW6.js → chunk-3SP6V22Y.js} +246 -219
- package/dist/chunk-3SP6V22Y.js.map +1 -0
- package/dist/{chunk-7XFFRV7D.js → chunk-7PJ4GAJR.js} +4 -4
- package/dist/{chunk-7XFFRV7D.js.map → chunk-7PJ4GAJR.js.map} +1 -1
- package/dist/{chunk-ZPYQDMUX.js → chunk-7YZVSG62.js} +3 -3
- package/dist/{chunk-ZPYQDMUX.js.map → chunk-7YZVSG62.js.map} +1 -1
- package/dist/{chunk-BKO7DSPU.js → chunk-BRUDSHCV.js} +2 -2
- package/dist/chunk-BRUDSHCV.js.map +1 -0
- package/dist/{chunk-BH7MNDWW.js → chunk-EWVQWTNV.js} +13 -3
- package/dist/chunk-EWVQWTNV.js.map +1 -0
- package/dist/{chunk-CEKAYA2Q.cjs → chunk-HNRFRNMY.cjs} +2 -2
- package/dist/chunk-HNRFRNMY.cjs.map +1 -0
- package/dist/{chunk-7K7HZMP4.cjs → chunk-JGPDQDY4.cjs} +13 -3
- package/dist/chunk-JGPDQDY4.cjs.map +1 -0
- package/dist/{chunk-H5XMKBBA.cjs → chunk-MUZ2RYS2.cjs} +268 -241
- package/dist/chunk-MUZ2RYS2.cjs.map +1 -0
- package/dist/{chunk-UIWFYMAO.cjs → chunk-O33I4HBL.cjs} +5 -5
- package/dist/{chunk-UIWFYMAO.cjs.map → chunk-O33I4HBL.cjs.map} +1 -1
- package/dist/core/index.cjs +80 -80
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/{index-pWEH7pUE.d.ts → index-25qIYJ21.d.ts} +1 -1
- package/dist/{index-2VtgKM8S.d.cts → index-C261xY-B.d.cts} +1 -1
- package/dist/mcp/index.cjs +47 -47
- package/dist/mcp/index.d.cts +13 -3
- package/dist/mcp/index.d.ts +13 -3
- package/dist/mcp/index.js +2 -2
- package/dist/react/index.cjs +50 -50
- package/dist/react/index.d.cts +18 -5
- package/dist/react/index.d.ts +18 -5
- package/dist/react/index.js +5 -5
- package/dist/tools/anthropic/index.d.cts +1 -1
- package/dist/tools/anthropic/index.d.ts +1 -1
- package/dist/tools/brave/index.cjs +2 -2
- package/dist/tools/brave/index.d.cts +1 -1
- package/dist/tools/brave/index.d.ts +1 -1
- package/dist/tools/brave/index.js +1 -1
- package/dist/tools/exa/index.cjs +2 -2
- package/dist/tools/exa/index.d.cts +1 -1
- package/dist/tools/exa/index.d.ts +1 -1
- package/dist/tools/exa/index.js +1 -1
- package/dist/tools/google/index.cjs +2 -2
- package/dist/tools/google/index.d.cts +1 -1
- package/dist/tools/google/index.d.ts +1 -1
- package/dist/tools/google/index.js +1 -1
- package/dist/tools/openai/index.cjs +2 -2
- package/dist/tools/openai/index.d.cts +1 -1
- package/dist/tools/openai/index.d.ts +1 -1
- package/dist/tools/openai/index.js +1 -1
- package/dist/tools/searxng/index.cjs +2 -2
- package/dist/tools/searxng/index.d.cts +1 -1
- package/dist/tools/searxng/index.d.ts +1 -1
- package/dist/tools/searxng/index.js +1 -1
- package/dist/tools/serper/index.cjs +2 -2
- package/dist/tools/serper/index.d.cts +1 -1
- package/dist/tools/serper/index.d.ts +1 -1
- package/dist/tools/serper/index.js +1 -1
- package/dist/tools/tavily/index.cjs +2 -2
- package/dist/tools/tavily/index.d.cts +1 -1
- package/dist/tools/tavily/index.d.ts +1 -1
- package/dist/tools/tavily/index.js +1 -1
- package/dist/tools/web-search/index.cjs +3 -3
- package/dist/tools/web-search/index.d.cts +2 -2
- package/dist/tools/web-search/index.d.ts +2 -2
- package/dist/tools/web-search/index.js +2 -2
- package/dist/{tools-DDWrco4h.d.cts → tools-Clyufshc.d.cts} +14 -1
- package/dist/{tools-DDWrco4h.d.ts → tools-Clyufshc.d.ts} +14 -1
- package/dist/{types-DjSfYNKj.d.cts → types-DM6M_pv_.d.cts} +43 -2
- package/dist/{types-Cizh9K_f.d.ts → types-wudOhedT.d.ts} +43 -2
- package/dist/ui/index.cjs +56 -26
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +37 -3
- package/dist/ui/index.d.ts +37 -3
- package/dist/ui/index.js +52 -22
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-7K7HZMP4.cjs.map +0 -1
- package/dist/chunk-BH7MNDWW.js.map +0 -1
- package/dist/chunk-BKO7DSPU.js.map +0 -1
- package/dist/chunk-CEKAYA2Q.cjs.map +0 -1
- package/dist/chunk-H5XMKBBA.cjs.map +0 -1
- package/dist/chunk-IXFV6AW6.js.map +0 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import { LinkSafetyConfig } from 'streamdown';
|
|
5
|
+
export { LinkSafetyConfig } from 'streamdown';
|
|
4
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
5
7
|
import { VariantProps } from 'class-variance-authority';
|
|
6
8
|
import * as use_stick_to_bottom from 'use-stick-to-bottom';
|
|
7
9
|
import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.cjs';
|
|
8
10
|
import { T as Thread, b as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-DG2ya08y.cjs';
|
|
9
|
-
import { T as ToolDefinition } from '../tools-
|
|
11
|
+
import { T as ToolDefinition } from '../tools-Clyufshc.cjs';
|
|
10
12
|
import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.cjs';
|
|
11
13
|
import { ClassValue } from 'clsx';
|
|
12
14
|
|
|
@@ -23,8 +25,10 @@ type MarkdownProps = {
|
|
|
23
25
|
id?: string;
|
|
24
26
|
className?: string;
|
|
25
27
|
isStreaming?: boolean;
|
|
28
|
+
/** Link safety modal configuration. Disabled by default. */
|
|
29
|
+
linkSafety?: LinkSafetyConfig;
|
|
26
30
|
};
|
|
27
|
-
declare function MarkdownComponent({ children, className, isStreaming, }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
declare function MarkdownComponent({ children, className, isStreaming, linkSafety, }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
28
32
|
declare const Markdown: React$1.MemoExoticComponent<typeof MarkdownComponent>;
|
|
29
33
|
|
|
30
34
|
type CodeBlockProps = {
|
|
@@ -1211,6 +1215,10 @@ type ToolExecutionStatus = "pending" | "executing" | "completed" | "error" | "fa
|
|
|
1211
1215
|
* Tool approval status (for human-in-the-loop)
|
|
1212
1216
|
*/
|
|
1213
1217
|
type ToolApprovalStatus = "none" | "required" | "approved" | "rejected";
|
|
1218
|
+
/**
|
|
1219
|
+
* Tool execution source - where the tool came from
|
|
1220
|
+
*/
|
|
1221
|
+
type ToolExecutionSource = "mcp" | "native" | "custom";
|
|
1214
1222
|
/**
|
|
1215
1223
|
* Tool execution data
|
|
1216
1224
|
*/
|
|
@@ -1219,6 +1227,13 @@ interface ToolExecutionData {
|
|
|
1219
1227
|
name: string;
|
|
1220
1228
|
args: Record<string, unknown>;
|
|
1221
1229
|
status: ToolExecutionStatus;
|
|
1230
|
+
/**
|
|
1231
|
+
* Source of the tool - helps distinguish MCP tools from native tools
|
|
1232
|
+
* - "mcp": Tool from an MCP server
|
|
1233
|
+
* - "native": Built-in SDK tool
|
|
1234
|
+
* - "custom": User-defined tool
|
|
1235
|
+
*/
|
|
1236
|
+
source?: ToolExecutionSource;
|
|
1222
1237
|
result?: {
|
|
1223
1238
|
success: boolean;
|
|
1224
1239
|
message?: string;
|
|
@@ -1377,6 +1392,8 @@ interface ToolRendererProps {
|
|
|
1377
1392
|
approvalStatus?: ToolApprovalStatus;
|
|
1378
1393
|
/** Data passed from user's approval action */
|
|
1379
1394
|
approvalData?: Record<string, unknown>;
|
|
1395
|
+
/** Tool source (mcp, native, custom) - useful for MCP tool identification */
|
|
1396
|
+
source?: "mcp" | "native" | "custom";
|
|
1380
1397
|
};
|
|
1381
1398
|
/**
|
|
1382
1399
|
* Approval callbacks - only provided when approvalStatus is 'required'.
|
|
@@ -1554,6 +1571,23 @@ type ChatProps = {
|
|
|
1554
1571
|
* ```
|
|
1555
1572
|
*/
|
|
1556
1573
|
toolRenderers?: ToolRenderers;
|
|
1574
|
+
/**
|
|
1575
|
+
* Catch-all renderer for MCP tools (tools with source: "mcp").
|
|
1576
|
+
* Applied to all MCP tools that don't have a specific renderer in `toolRenderers`.
|
|
1577
|
+
*
|
|
1578
|
+
* Priority: toolRenderers[name] > mcpToolRenderer > tool.render > default
|
|
1579
|
+
*
|
|
1580
|
+
* @example
|
|
1581
|
+
* ```tsx
|
|
1582
|
+
* <Chat
|
|
1583
|
+
* mcpToolRenderer={MCPToolCard} // Applies to all MCP tools
|
|
1584
|
+
* toolRenderers={{
|
|
1585
|
+
* "mcp360_special_tool": SpecialCard, // Override for specific tool
|
|
1586
|
+
* }}
|
|
1587
|
+
* />
|
|
1588
|
+
* ```
|
|
1589
|
+
*/
|
|
1590
|
+
mcpToolRenderer?: React__default.ComponentType<ToolRendererProps>;
|
|
1557
1591
|
/**
|
|
1558
1592
|
* Called when user approves a tool execution.
|
|
1559
1593
|
* @param executionId - The tool execution ID
|
|
@@ -1709,7 +1743,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1709
1743
|
*/
|
|
1710
1744
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1711
1745
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1712
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1746
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1713
1747
|
/**
|
|
1714
1748
|
* Chat component with compound component pattern.
|
|
1715
1749
|
*
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import { LinkSafetyConfig } from 'streamdown';
|
|
5
|
+
export { LinkSafetyConfig } from 'streamdown';
|
|
4
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
5
7
|
import { VariantProps } from 'class-variance-authority';
|
|
6
8
|
import * as use_stick_to_bottom from 'use-stick-to-bottom';
|
|
7
9
|
import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.js';
|
|
8
10
|
import { T as Thread, b as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-DG2ya08y.js';
|
|
9
|
-
import { T as ToolDefinition } from '../tools-
|
|
11
|
+
import { T as ToolDefinition } from '../tools-Clyufshc.js';
|
|
10
12
|
import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.js';
|
|
11
13
|
import { ClassValue } from 'clsx';
|
|
12
14
|
|
|
@@ -23,8 +25,10 @@ type MarkdownProps = {
|
|
|
23
25
|
id?: string;
|
|
24
26
|
className?: string;
|
|
25
27
|
isStreaming?: boolean;
|
|
28
|
+
/** Link safety modal configuration. Disabled by default. */
|
|
29
|
+
linkSafety?: LinkSafetyConfig;
|
|
26
30
|
};
|
|
27
|
-
declare function MarkdownComponent({ children, className, isStreaming, }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
declare function MarkdownComponent({ children, className, isStreaming, linkSafety, }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
28
32
|
declare const Markdown: React$1.MemoExoticComponent<typeof MarkdownComponent>;
|
|
29
33
|
|
|
30
34
|
type CodeBlockProps = {
|
|
@@ -1211,6 +1215,10 @@ type ToolExecutionStatus = "pending" | "executing" | "completed" | "error" | "fa
|
|
|
1211
1215
|
* Tool approval status (for human-in-the-loop)
|
|
1212
1216
|
*/
|
|
1213
1217
|
type ToolApprovalStatus = "none" | "required" | "approved" | "rejected";
|
|
1218
|
+
/**
|
|
1219
|
+
* Tool execution source - where the tool came from
|
|
1220
|
+
*/
|
|
1221
|
+
type ToolExecutionSource = "mcp" | "native" | "custom";
|
|
1214
1222
|
/**
|
|
1215
1223
|
* Tool execution data
|
|
1216
1224
|
*/
|
|
@@ -1219,6 +1227,13 @@ interface ToolExecutionData {
|
|
|
1219
1227
|
name: string;
|
|
1220
1228
|
args: Record<string, unknown>;
|
|
1221
1229
|
status: ToolExecutionStatus;
|
|
1230
|
+
/**
|
|
1231
|
+
* Source of the tool - helps distinguish MCP tools from native tools
|
|
1232
|
+
* - "mcp": Tool from an MCP server
|
|
1233
|
+
* - "native": Built-in SDK tool
|
|
1234
|
+
* - "custom": User-defined tool
|
|
1235
|
+
*/
|
|
1236
|
+
source?: ToolExecutionSource;
|
|
1222
1237
|
result?: {
|
|
1223
1238
|
success: boolean;
|
|
1224
1239
|
message?: string;
|
|
@@ -1377,6 +1392,8 @@ interface ToolRendererProps {
|
|
|
1377
1392
|
approvalStatus?: ToolApprovalStatus;
|
|
1378
1393
|
/** Data passed from user's approval action */
|
|
1379
1394
|
approvalData?: Record<string, unknown>;
|
|
1395
|
+
/** Tool source (mcp, native, custom) - useful for MCP tool identification */
|
|
1396
|
+
source?: "mcp" | "native" | "custom";
|
|
1380
1397
|
};
|
|
1381
1398
|
/**
|
|
1382
1399
|
* Approval callbacks - only provided when approvalStatus is 'required'.
|
|
@@ -1554,6 +1571,23 @@ type ChatProps = {
|
|
|
1554
1571
|
* ```
|
|
1555
1572
|
*/
|
|
1556
1573
|
toolRenderers?: ToolRenderers;
|
|
1574
|
+
/**
|
|
1575
|
+
* Catch-all renderer for MCP tools (tools with source: "mcp").
|
|
1576
|
+
* Applied to all MCP tools that don't have a specific renderer in `toolRenderers`.
|
|
1577
|
+
*
|
|
1578
|
+
* Priority: toolRenderers[name] > mcpToolRenderer > tool.render > default
|
|
1579
|
+
*
|
|
1580
|
+
* @example
|
|
1581
|
+
* ```tsx
|
|
1582
|
+
* <Chat
|
|
1583
|
+
* mcpToolRenderer={MCPToolCard} // Applies to all MCP tools
|
|
1584
|
+
* toolRenderers={{
|
|
1585
|
+
* "mcp360_special_tool": SpecialCard, // Override for specific tool
|
|
1586
|
+
* }}
|
|
1587
|
+
* />
|
|
1588
|
+
* ```
|
|
1589
|
+
*/
|
|
1590
|
+
mcpToolRenderer?: React__default.ComponentType<ToolRendererProps>;
|
|
1557
1591
|
/**
|
|
1558
1592
|
* Called when user approves a tool execution.
|
|
1559
1593
|
* @param executionId - The tool execution ID
|
|
@@ -1709,7 +1743,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1709
1743
|
*/
|
|
1710
1744
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1711
1745
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1712
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1746
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, renderMessage, renderInput, renderHeader, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1713
1747
|
/**
|
|
1714
1748
|
* Chat component with compound component pattern.
|
|
1715
1749
|
*
|
package/dist/ui/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useCopilot, useThreadManager } from '../chunk-
|
|
2
|
-
import { createServerAdapter } from '../chunk-
|
|
1
|
+
import { useCopilot, useThreadManager } from '../chunk-3SP6V22Y.js';
|
|
2
|
+
import { createServerAdapter } from '../chunk-7PJ4GAJR.js';
|
|
3
3
|
import { DEFAULT_MCP_UI_SANDBOX, parseMCPUIMessage } from '../chunk-G4SF2PNQ.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-EWVQWTNV.js';
|
|
5
|
+
import '../chunk-7YZVSG62.js';
|
|
6
|
+
import '../chunk-BRUDSHCV.js';
|
|
7
7
|
import '../chunk-XGITAEXU.js';
|
|
8
8
|
import '../chunk-7W7QLZNC.js';
|
|
9
9
|
import '../chunk-CEOMTQTP.js';
|
|
@@ -328,7 +328,8 @@ var headingComponents = {
|
|
|
328
328
|
function MarkdownComponent({
|
|
329
329
|
children,
|
|
330
330
|
className,
|
|
331
|
-
isStreaming = false
|
|
331
|
+
isStreaming = false,
|
|
332
|
+
linkSafety = { enabled: false }
|
|
332
333
|
}) {
|
|
333
334
|
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
334
335
|
Streamdown,
|
|
@@ -336,6 +337,7 @@ function MarkdownComponent({
|
|
|
336
337
|
plugins: { code },
|
|
337
338
|
isAnimating: isStreaming,
|
|
338
339
|
components: headingComponents,
|
|
340
|
+
linkSafety,
|
|
339
341
|
children
|
|
340
342
|
}
|
|
341
343
|
) });
|
|
@@ -1903,8 +1905,8 @@ function ToolStep({
|
|
|
1903
1905
|
"aria-hidden": "true"
|
|
1904
1906
|
}
|
|
1905
1907
|
),
|
|
1906
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-
|
|
1907
|
-
!isExecuting && /* @__PURE__ */ jsx(StatusIndicator, { status: step.status
|
|
1908
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1909
|
+
!isExecuting && /* @__PURE__ */ jsx(StatusIndicator, { status: step.status }),
|
|
1908
1910
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1909
1911
|
/* @__PURE__ */ jsxs(
|
|
1910
1912
|
"button",
|
|
@@ -4226,6 +4228,7 @@ function DefaultMessage({
|
|
|
4226
4228
|
loaderVariant = "typing",
|
|
4227
4229
|
registeredTools,
|
|
4228
4230
|
toolRenderers,
|
|
4231
|
+
mcpToolRenderer,
|
|
4229
4232
|
onApproveToolExecution,
|
|
4230
4233
|
onRejectToolExecution,
|
|
4231
4234
|
showFollowUps = true,
|
|
@@ -4347,17 +4350,19 @@ function DefaultMessage({
|
|
|
4347
4350
|
const completedTools = message.toolExecutions?.filter(
|
|
4348
4351
|
(exec) => exec.approvalStatus !== "required" && !isToolHidden(exec.name)
|
|
4349
4352
|
);
|
|
4350
|
-
const hasCustomRender = (toolName) => {
|
|
4353
|
+
const hasCustomRender = (toolName, execSource) => {
|
|
4351
4354
|
if (toolRenderers?.[toolName]) return true;
|
|
4352
4355
|
const toolDef = registeredTools?.find((t) => t.name === toolName);
|
|
4356
|
+
if (mcpToolRenderer && (execSource === "mcp" || toolDef?.source === "mcp"))
|
|
4357
|
+
return true;
|
|
4353
4358
|
if (toolDef?.render) return true;
|
|
4354
4359
|
return false;
|
|
4355
4360
|
};
|
|
4356
4361
|
const toolsWithCustomRender = completedTools?.filter(
|
|
4357
|
-
(exec) => hasCustomRender(exec.name)
|
|
4362
|
+
(exec) => hasCustomRender(exec.name, exec.source)
|
|
4358
4363
|
);
|
|
4359
4364
|
const toolsWithoutCustomRender = completedTools?.filter(
|
|
4360
|
-
(exec) => !hasCustomRender(exec.name)
|
|
4365
|
+
(exec) => !hasCustomRender(exec.name, exec.source)
|
|
4361
4366
|
);
|
|
4362
4367
|
const hasNativeCitations = !!message.metadata?.citations?.length;
|
|
4363
4368
|
const toolSteps = toolsWithoutCustomRender?.filter((exec) => !(exec.name === "web_search" && hasNativeCitations)).map((exec) => ({
|
|
@@ -4407,7 +4412,7 @@ function DefaultMessage({
|
|
|
4407
4412
|
children: cleanContent
|
|
4408
4413
|
}
|
|
4409
4414
|
),
|
|
4410
|
-
toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsx("div", { className: "
|
|
4415
|
+
toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("space-y-2", cleanContent?.trim() && "mt-2"), children: toolsWithCustomRender.map((exec) => {
|
|
4411
4416
|
const Renderer = toolRenderers?.[exec.name];
|
|
4412
4417
|
if (Renderer) {
|
|
4413
4418
|
return /* @__PURE__ */ jsx(
|
|
@@ -4420,7 +4425,8 @@ function DefaultMessage({
|
|
|
4420
4425
|
status: exec.status,
|
|
4421
4426
|
result: exec.result,
|
|
4422
4427
|
error: exec.error,
|
|
4423
|
-
approvalStatus: exec.approvalStatus
|
|
4428
|
+
approvalStatus: exec.approvalStatus,
|
|
4429
|
+
source: exec.source
|
|
4424
4430
|
}
|
|
4425
4431
|
},
|
|
4426
4432
|
exec.id
|
|
@@ -4429,7 +4435,26 @@ function DefaultMessage({
|
|
|
4429
4435
|
const toolDef = registeredTools?.find(
|
|
4430
4436
|
(t) => t.name === exec.name
|
|
4431
4437
|
);
|
|
4432
|
-
if (toolDef?.
|
|
4438
|
+
if (mcpToolRenderer && (exec.source === "mcp" || toolDef?.source === "mcp")) {
|
|
4439
|
+
const MCPRenderer = mcpToolRenderer;
|
|
4440
|
+
return /* @__PURE__ */ jsx(
|
|
4441
|
+
MCPRenderer,
|
|
4442
|
+
{
|
|
4443
|
+
execution: {
|
|
4444
|
+
id: exec.id,
|
|
4445
|
+
name: exec.name,
|
|
4446
|
+
args: exec.args,
|
|
4447
|
+
status: exec.status,
|
|
4448
|
+
result: exec.result,
|
|
4449
|
+
error: exec.error,
|
|
4450
|
+
source: exec.source || toolDef?.source
|
|
4451
|
+
}
|
|
4452
|
+
},
|
|
4453
|
+
exec.id
|
|
4454
|
+
);
|
|
4455
|
+
}
|
|
4456
|
+
const toolDefForRender = toolDef ?? registeredTools?.find((t) => t.name === exec.name);
|
|
4457
|
+
if (toolDefForRender?.render) {
|
|
4433
4458
|
let status = "pending";
|
|
4434
4459
|
if (exec.status === "executing") status = "executing";
|
|
4435
4460
|
else if (exec.status === "completed") status = "completed";
|
|
@@ -4443,14 +4468,23 @@ function DefaultMessage({
|
|
|
4443
4468
|
toolCallId: exec.id,
|
|
4444
4469
|
toolName: exec.name
|
|
4445
4470
|
};
|
|
4446
|
-
const output =
|
|
4471
|
+
const output = toolDefForRender.render(
|
|
4447
4472
|
renderProps
|
|
4448
4473
|
);
|
|
4449
4474
|
return /* @__PURE__ */ jsx(React20.Fragment, { children: output }, exec.id);
|
|
4450
4475
|
}
|
|
4451
4476
|
return null;
|
|
4452
4477
|
}) }),
|
|
4453
|
-
toolSteps && toolSteps.length > 0 && /* @__PURE__ */ jsx(
|
|
4478
|
+
toolSteps && toolSteps.length > 0 && /* @__PURE__ */ jsx(
|
|
4479
|
+
"div",
|
|
4480
|
+
{
|
|
4481
|
+
className: cn(
|
|
4482
|
+
"rounded-lg bg-muted/50 px-3 py-2",
|
|
4483
|
+
cleanContent?.trim() && "mt-2"
|
|
4484
|
+
),
|
|
4485
|
+
children: /* @__PURE__ */ jsx(ToolSteps, { steps: toolSteps })
|
|
4486
|
+
}
|
|
4487
|
+
),
|
|
4454
4488
|
message.toolExecutions?.filter((exec) => !isToolHidden(exec.name)).map((exec) => {
|
|
4455
4489
|
const uiResources = exec.result?._uiResources;
|
|
4456
4490
|
if (!uiResources || uiResources.length === 0) return null;
|
|
@@ -5229,6 +5263,7 @@ function ChatComponent({
|
|
|
5229
5263
|
isProcessing = false,
|
|
5230
5264
|
registeredTools,
|
|
5231
5265
|
toolRenderers,
|
|
5266
|
+
mcpToolRenderer,
|
|
5232
5267
|
onApproveToolExecution,
|
|
5233
5268
|
onRejectToolExecution,
|
|
5234
5269
|
// Follow-up Questions
|
|
@@ -5556,6 +5591,7 @@ function ChatComponent({
|
|
|
5556
5591
|
loaderVariant,
|
|
5557
5592
|
registeredTools,
|
|
5558
5593
|
toolRenderers,
|
|
5594
|
+
mcpToolRenderer,
|
|
5559
5595
|
onApproveToolExecution,
|
|
5560
5596
|
onRejectToolExecution,
|
|
5561
5597
|
showFollowUps,
|
|
@@ -5963,9 +5999,6 @@ function useInternalThreadManager(config = {}) {
|
|
|
5963
5999
|
});
|
|
5964
6000
|
}, [clearCurrentThread, setMessages, onThreadChange]);
|
|
5965
6001
|
useEffect(() => {
|
|
5966
|
-
if (!adapter) {
|
|
5967
|
-
return;
|
|
5968
|
-
}
|
|
5969
6002
|
if (hasInitializedRef.current || !currentThread) {
|
|
5970
6003
|
return;
|
|
5971
6004
|
}
|
|
@@ -5997,9 +6030,6 @@ function useInternalThreadManager(config = {}) {
|
|
|
5997
6030
|
});
|
|
5998
6031
|
}, [adapter, currentThread, setMessages, getMessageSnapshot, onThreadChange]);
|
|
5999
6032
|
useEffect(() => {
|
|
6000
|
-
if (!adapter) {
|
|
6001
|
-
return;
|
|
6002
|
-
}
|
|
6003
6033
|
if (isLoadingMessagesRef.current) {
|
|
6004
6034
|
return;
|
|
6005
6035
|
}
|