@yourgpt/copilot-sdk 2.0.2-beta.1 → 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-DUPNYVBP.cjs → chunk-33JSFVGH.cjs} +23 -23
- package/dist/{chunk-DUPNYVBP.cjs.map → chunk-33JSFVGH.cjs.map} +1 -1
- package/dist/{chunk-3YKHVLNP.js → chunk-3SP6V22Y.js} +246 -219
- package/dist/chunk-3SP6V22Y.js.map +1 -0
- package/dist/{chunk-Z7PHGSJT.js → chunk-7PJ4GAJR.js} +4 -4
- package/dist/{chunk-Z7PHGSJT.js.map → chunk-7PJ4GAJR.js.map} +1 -1
- package/dist/{chunk-6BXQFCK3.js → chunk-7YZVSG62.js} +3 -3
- package/dist/{chunk-6BXQFCK3.js.map → chunk-7YZVSG62.js.map} +1 -1
- package/dist/{chunk-J4OMGO5O.js → chunk-BRUDSHCV.js} +3 -2
- package/dist/chunk-BRUDSHCV.js.map +1 -0
- package/dist/{chunk-4WWWMNUA.js → chunk-EWVQWTNV.js} +26 -6
- package/dist/chunk-EWVQWTNV.js.map +1 -0
- package/dist/{chunk-W74OTXXX.cjs → chunk-HNRFRNMY.cjs} +3 -2
- package/dist/chunk-HNRFRNMY.cjs.map +1 -0
- package/dist/{chunk-DVC63PGD.cjs → chunk-JGPDQDY4.cjs} +26 -6
- package/dist/chunk-JGPDQDY4.cjs.map +1 -0
- package/dist/{chunk-RBZXLBGI.cjs → chunk-MUZ2RYS2.cjs} +268 -241
- package/dist/chunk-MUZ2RYS2.cjs.map +1 -0
- package/dist/{chunk-TX7CGITI.cjs → chunk-O33I4HBL.cjs} +5 -5
- package/dist/{chunk-TX7CGITI.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-DBNh0jhE.d.ts → index-25qIYJ21.d.ts} +1 -1
- package/dist/{index-DOlhSb79.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-EiPWA9Ay.d.ts → tools-Clyufshc.d.cts} +23 -1
- package/dist/{tools-EiPWA9Ay.d.cts → tools-Clyufshc.d.ts} +23 -1
- package/dist/{types-CKA6U74u.d.cts → types-DM6M_pv_.d.cts} +43 -2
- package/dist/{types-iBkPICvQ.d.ts → types-wudOhedT.d.ts} +43 -2
- package/dist/ui/index.cjs +63 -29
- 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 +59 -25
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3YKHVLNP.js.map +0 -1
- package/dist/chunk-4WWWMNUA.js.map +0 -1
- package/dist/chunk-DVC63PGD.cjs.map +0 -1
- package/dist/chunk-J4OMGO5O.js.map +0 -1
- package/dist/chunk-RBZXLBGI.cjs.map +0 -1
- package/dist/chunk-W74OTXXX.cjs.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,
|
|
@@ -4337,23 +4340,29 @@ function DefaultMessage({
|
|
|
4337
4340
|
}
|
|
4338
4341
|
);
|
|
4339
4342
|
}
|
|
4343
|
+
const isToolHidden = (toolName) => {
|
|
4344
|
+
const toolDef = registeredTools?.find((t) => t.name === toolName);
|
|
4345
|
+
return toolDef?.hidden === true;
|
|
4346
|
+
};
|
|
4340
4347
|
const pendingApprovalTools = message.toolExecutions?.filter(
|
|
4341
|
-
(exec) => exec.approvalStatus === "required"
|
|
4348
|
+
(exec) => exec.approvalStatus === "required" && !isToolHidden(exec.name)
|
|
4342
4349
|
);
|
|
4343
4350
|
const completedTools = message.toolExecutions?.filter(
|
|
4344
|
-
(exec) => exec.approvalStatus !== "required"
|
|
4351
|
+
(exec) => exec.approvalStatus !== "required" && !isToolHidden(exec.name)
|
|
4345
4352
|
);
|
|
4346
|
-
const hasCustomRender = (toolName) => {
|
|
4353
|
+
const hasCustomRender = (toolName, execSource) => {
|
|
4347
4354
|
if (toolRenderers?.[toolName]) return true;
|
|
4348
4355
|
const toolDef = registeredTools?.find((t) => t.name === toolName);
|
|
4356
|
+
if (mcpToolRenderer && (execSource === "mcp" || toolDef?.source === "mcp"))
|
|
4357
|
+
return true;
|
|
4349
4358
|
if (toolDef?.render) return true;
|
|
4350
4359
|
return false;
|
|
4351
4360
|
};
|
|
4352
4361
|
const toolsWithCustomRender = completedTools?.filter(
|
|
4353
|
-
(exec) => hasCustomRender(exec.name)
|
|
4362
|
+
(exec) => hasCustomRender(exec.name, exec.source)
|
|
4354
4363
|
);
|
|
4355
4364
|
const toolsWithoutCustomRender = completedTools?.filter(
|
|
4356
|
-
(exec) => !hasCustomRender(exec.name)
|
|
4365
|
+
(exec) => !hasCustomRender(exec.name, exec.source)
|
|
4357
4366
|
);
|
|
4358
4367
|
const hasNativeCitations = !!message.metadata?.citations?.length;
|
|
4359
4368
|
const toolSteps = toolsWithoutCustomRender?.filter((exec) => !(exec.name === "web_search" && hasNativeCitations)).map((exec) => ({
|
|
@@ -4403,7 +4412,7 @@ function DefaultMessage({
|
|
|
4403
4412
|
children: cleanContent
|
|
4404
4413
|
}
|
|
4405
4414
|
),
|
|
4406
|
-
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) => {
|
|
4407
4416
|
const Renderer = toolRenderers?.[exec.name];
|
|
4408
4417
|
if (Renderer) {
|
|
4409
4418
|
return /* @__PURE__ */ jsx(
|
|
@@ -4416,7 +4425,8 @@ function DefaultMessage({
|
|
|
4416
4425
|
status: exec.status,
|
|
4417
4426
|
result: exec.result,
|
|
4418
4427
|
error: exec.error,
|
|
4419
|
-
approvalStatus: exec.approvalStatus
|
|
4428
|
+
approvalStatus: exec.approvalStatus,
|
|
4429
|
+
source: exec.source
|
|
4420
4430
|
}
|
|
4421
4431
|
},
|
|
4422
4432
|
exec.id
|
|
@@ -4425,7 +4435,26 @@ function DefaultMessage({
|
|
|
4425
4435
|
const toolDef = registeredTools?.find(
|
|
4426
4436
|
(t) => t.name === exec.name
|
|
4427
4437
|
);
|
|
4428
|
-
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) {
|
|
4429
4458
|
let status = "pending";
|
|
4430
4459
|
if (exec.status === "executing") status = "executing";
|
|
4431
4460
|
else if (exec.status === "completed") status = "completed";
|
|
@@ -4439,15 +4468,24 @@ function DefaultMessage({
|
|
|
4439
4468
|
toolCallId: exec.id,
|
|
4440
4469
|
toolName: exec.name
|
|
4441
4470
|
};
|
|
4442
|
-
const output =
|
|
4471
|
+
const output = toolDefForRender.render(
|
|
4443
4472
|
renderProps
|
|
4444
4473
|
);
|
|
4445
4474
|
return /* @__PURE__ */ jsx(React20.Fragment, { children: output }, exec.id);
|
|
4446
4475
|
}
|
|
4447
4476
|
return null;
|
|
4448
4477
|
}) }),
|
|
4449
|
-
toolSteps && toolSteps.length > 0 && /* @__PURE__ */ jsx(
|
|
4450
|
-
|
|
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
|
+
),
|
|
4488
|
+
message.toolExecutions?.filter((exec) => !isToolHidden(exec.name)).map((exec) => {
|
|
4451
4489
|
const uiResources = exec.result?._uiResources;
|
|
4452
4490
|
if (!uiResources || uiResources.length === 0) return null;
|
|
4453
4491
|
return /* @__PURE__ */ jsx(
|
|
@@ -5225,6 +5263,7 @@ function ChatComponent({
|
|
|
5225
5263
|
isProcessing = false,
|
|
5226
5264
|
registeredTools,
|
|
5227
5265
|
toolRenderers,
|
|
5266
|
+
mcpToolRenderer,
|
|
5228
5267
|
onApproveToolExecution,
|
|
5229
5268
|
onRejectToolExecution,
|
|
5230
5269
|
// Follow-up Questions
|
|
@@ -5552,6 +5591,7 @@ function ChatComponent({
|
|
|
5552
5591
|
loaderVariant,
|
|
5553
5592
|
registeredTools,
|
|
5554
5593
|
toolRenderers,
|
|
5594
|
+
mcpToolRenderer,
|
|
5555
5595
|
onApproveToolExecution,
|
|
5556
5596
|
onRejectToolExecution,
|
|
5557
5597
|
showFollowUps,
|
|
@@ -5959,9 +5999,6 @@ function useInternalThreadManager(config = {}) {
|
|
|
5959
5999
|
});
|
|
5960
6000
|
}, [clearCurrentThread, setMessages, onThreadChange]);
|
|
5961
6001
|
useEffect(() => {
|
|
5962
|
-
if (!adapter) {
|
|
5963
|
-
return;
|
|
5964
|
-
}
|
|
5965
6002
|
if (hasInitializedRef.current || !currentThread) {
|
|
5966
6003
|
return;
|
|
5967
6004
|
}
|
|
@@ -5993,9 +6030,6 @@ function useInternalThreadManager(config = {}) {
|
|
|
5993
6030
|
});
|
|
5994
6031
|
}, [adapter, currentThread, setMessages, getMessageSnapshot, onThreadChange]);
|
|
5995
6032
|
useEffect(() => {
|
|
5996
|
-
if (!adapter) {
|
|
5997
|
-
return;
|
|
5998
|
-
}
|
|
5999
6033
|
if (isLoadingMessagesRef.current) {
|
|
6000
6034
|
return;
|
|
6001
6035
|
}
|