@copilotkitnext/react 1.53.1-next.0 → 1.53.1-next.2
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/a2ui/A2UIMessageRenderer.cjs +132 -0
- package/dist/a2ui/A2UIMessageRenderer.cjs.map +1 -0
- package/dist/a2ui/A2UIMessageRenderer.d.cts +11 -0
- package/dist/a2ui/A2UIMessageRenderer.d.cts.map +1 -0
- package/dist/a2ui/A2UIMessageRenderer.d.mts +11 -0
- package/dist/a2ui/A2UIMessageRenderer.d.mts.map +1 -0
- package/dist/a2ui/A2UIMessageRenderer.mjs +131 -0
- package/dist/a2ui/A2UIMessageRenderer.mjs.map +1 -0
- package/dist/components/chat/CopilotChatAssistantMessage.cjs +2 -1
- package/dist/components/chat/CopilotChatAssistantMessage.cjs.map +1 -1
- package/dist/components/chat/CopilotChatAssistantMessage.d.cts.map +1 -1
- package/dist/components/chat/CopilotChatAssistantMessage.d.mts +0 -1
- package/dist/components/chat/CopilotChatAssistantMessage.d.mts.map +1 -1
- package/dist/components/chat/CopilotChatAssistantMessage.mjs +2 -1
- package/dist/components/chat/CopilotChatAssistantMessage.mjs.map +1 -1
- package/dist/hooks/use-render-activity-message.cjs +1 -1
- package/dist/hooks/use-render-activity-message.mjs +1 -1
- package/dist/hooks/use-render-custom-messages.cjs +1 -1
- package/dist/hooks/use-render-custom-messages.mjs +1 -1
- package/dist/hooks/useKatexStyles.cjs +24 -0
- package/dist/hooks/useKatexStyles.cjs.map +1 -0
- package/dist/hooks/useKatexStyles.mjs +23 -0
- package/dist/hooks/useKatexStyles.mjs.map +1 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +3 -2
- package/dist/index.umd.js +170 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/providers/CopilotKitProvider.cjs +21 -6
- package/dist/providers/CopilotKitProvider.cjs.map +1 -1
- package/dist/providers/CopilotKitProvider.d.cts +21 -0
- package/dist/providers/CopilotKitProvider.d.cts.map +1 -1
- package/dist/providers/CopilotKitProvider.d.mts +21 -0
- package/dist/providers/CopilotKitProvider.d.mts.map +1 -1
- package/dist/providers/CopilotKitProvider.mjs +21 -6
- package/dist/providers/CopilotKitProvider.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/useKatexStyles.ts
|
|
6
|
+
let injected = false;
|
|
7
|
+
/**
|
|
8
|
+
* Dynamically injects KaTeX CSS at runtime to avoid the Next.js
|
|
9
|
+
* "Global CSS cannot be imported from within node_modules" build error.
|
|
10
|
+
*
|
|
11
|
+
* Uses a singleton flag so the stylesheet is only injected once.
|
|
12
|
+
*/
|
|
13
|
+
function useKatexStyles() {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (injected || typeof document === "undefined") return;
|
|
16
|
+
injected = true;
|
|
17
|
+
import("katex/dist/katex.min.css").catch(() => {});
|
|
18
|
+
}, []);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useKatexStyles };
|
|
23
|
+
//# sourceMappingURL=useKatexStyles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKatexStyles.mjs","names":[],"sources":["../../src/hooks/useKatexStyles.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\n\nlet injected = false;\n\n/**\n * Dynamically injects KaTeX CSS at runtime to avoid the Next.js\n * \"Global CSS cannot be imported from within node_modules\" build error.\n *\n * Uses a singleton flag so the stylesheet is only injected once.\n */\nexport function useKatexStyles(): void {\n useEffect(() => {\n if (injected || typeof document === \"undefined\") return;\n injected = true;\n\n // Dynamic import defers CSS loading to runtime, bypassing\n // Next.js static analysis that rejects global CSS from node_modules.\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n void import(\"katex/dist/katex.min.css\").catch(() => {\n // Silently ignore — consumers can import KaTeX CSS manually\n });\n }, []);\n}\n"],"mappings":";;;;;AAIA,IAAI,WAAW;;;;;;;AAQf,SAAgB,iBAAuB;AACrC,iBAAgB;AACd,MAAI,YAAY,OAAO,aAAa,YAAa;AACjD,aAAW;AAKX,EAAK,OAAO,4BAA4B,YAAY,GAElD;IACD,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -6,10 +6,11 @@ const require_CopilotChatAudioRecorder = require('./components/chat/CopilotChatA
|
|
|
6
6
|
const require_CopilotChatInput = require('./components/chat/CopilotChatInput.cjs');
|
|
7
7
|
const require_CopilotKitInspector = require('./components/CopilotKitInspector.cjs');
|
|
8
8
|
const require_MCPAppsActivityRenderer = require('./components/MCPAppsActivityRenderer.cjs');
|
|
9
|
+
require('./providers/index.cjs');
|
|
10
|
+
const require_A2UIMessageRenderer = require('./a2ui/A2UIMessageRenderer.cjs');
|
|
9
11
|
const require_react_core = require('./lib/react-core.cjs');
|
|
10
12
|
const require_CopilotKitProvider = require('./providers/CopilotKitProvider.cjs');
|
|
11
13
|
const require_use_render_tool_call = require('./hooks/use-render-tool-call.cjs');
|
|
12
|
-
require('./providers/index.cjs');
|
|
13
14
|
const require_use_render_custom_messages = require('./hooks/use-render-custom-messages.cjs');
|
|
14
15
|
const require_use_render_activity_message = require('./hooks/use-render-activity-message.cjs');
|
|
15
16
|
const require_use_frontend_tool = require('./hooks/use-frontend-tool.cjs');
|
|
@@ -92,6 +93,7 @@ exports.MCPAppsActivityRenderer = require_MCPAppsActivityRenderer.MCPAppsActivit
|
|
|
92
93
|
exports.MCPAppsActivityType = require_MCPAppsActivityRenderer.MCPAppsActivityType;
|
|
93
94
|
exports.UseAgentUpdate = require_use_agent.UseAgentUpdate;
|
|
94
95
|
exports.WildcardToolCallRender = require_WildcardToolCallRender.WildcardToolCallRender;
|
|
96
|
+
exports.createA2UIMessageRenderer = require_A2UIMessageRenderer.createA2UIMessageRenderer;
|
|
95
97
|
exports.defineToolCallRenderer = require_defineToolCallRenderer.defineToolCallRenderer;
|
|
96
98
|
exports.useAgent = require_use_agent.useAgent;
|
|
97
99
|
exports.useAgentContext = require_use_agent_context.useAgentContext;
|
package/dist/index.d.cts
CHANGED
|
@@ -45,5 +45,7 @@ import "./hooks/index.cjs";
|
|
|
45
45
|
import { CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber } from "./lib/react-core.cjs";
|
|
46
46
|
import { CopilotKitContextValue, CopilotKitProvider, CopilotKitProviderProps, useCopilotKit } from "./providers/CopilotKitProvider.cjs";
|
|
47
47
|
import "./providers/index.cjs";
|
|
48
|
+
import { A2UIMessageRendererOptions, createA2UIMessageRenderer } from "./a2ui/A2UIMessageRenderer.cjs";
|
|
49
|
+
import { Theme as A2UITheme } from "@copilotkit/a2ui-renderer";
|
|
48
50
|
export * from "@ag-ui/client";
|
|
49
|
-
export { AgentContextInput, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, ToolsMenuItem, UseAgentUpdate, UseInterruptConfig, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSuggestions };
|
|
51
|
+
export { type A2UIMessageRendererOptions, type A2UITheme, AgentContextInput, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, ToolsMenuItem, UseAgentUpdate, UseInterruptConfig, WildcardToolCallRender, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSuggestions };
|
package/dist/index.d.mts
CHANGED
|
@@ -45,5 +45,7 @@ import "./hooks/index.mjs";
|
|
|
45
45
|
import { CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber } from "./lib/react-core.mjs";
|
|
46
46
|
import { CopilotKitContextValue, CopilotKitProvider, CopilotKitProviderProps, useCopilotKit } from "./providers/CopilotKitProvider.mjs";
|
|
47
47
|
import "./providers/index.mjs";
|
|
48
|
+
import { A2UIMessageRendererOptions, createA2UIMessageRenderer } from "./a2ui/A2UIMessageRenderer.mjs";
|
|
49
|
+
import { Theme as A2UITheme } from "@copilotkit/a2ui-renderer";
|
|
48
50
|
export * from "@ag-ui/client";
|
|
49
|
-
export { AgentContextInput, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, ToolsMenuItem, UseAgentUpdate, UseInterruptConfig, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSuggestions };
|
|
51
|
+
export { type A2UIMessageRendererOptions, type A2UITheme, AgentContextInput, AudioRecorderError, AudioRecorderState, CopilotChat, CopilotChatAssistantMessage, CopilotChatAssistantMessageProps, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatConfigurationProviderProps, CopilotChatConfigurationValue, CopilotChatInput, CopilotChatInputProps, CopilotChatLabels, CopilotChatMessageView, CopilotChatMessageViewProps, CopilotChatProps, CopilotChatReasoningMessage, CopilotChatReasoningMessageProps, CopilotChatSuggestionPill, CopilotChatSuggestionPillProps, CopilotChatSuggestionView, CopilotChatSuggestionViewProps, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonProps, CopilotChatToolCallsView, CopilotChatToolCallsViewProps, CopilotChatUserMessage, CopilotChatUserMessageProps, CopilotChatView, CopilotChatViewProps, CopilotKitContextValue, CopilotKitCoreReact, CopilotKitCoreReactConfig, CopilotKitCoreReactSubscriber, CopilotKitInspector, CopilotKitInspectorProps, CopilotKitProvider, CopilotKitProviderProps, CopilotModalHeader, CopilotModalHeaderProps, CopilotPopup, CopilotPopupProps, CopilotPopupView, CopilotPopupViewProps, CopilotSidebar, CopilotSidebarProps, CopilotSidebarView, CopilotSidebarViewProps, InterruptEvent, InterruptHandlerProps, InterruptRenderProps, JsonSerializable, MCPAppsActivityContent, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, ReactActivityMessageRenderer, ReactCustomMessageRenderer, ReactCustomMessageRendererPosition, ReactFrontendTool, ReactHumanInTheLoop, ReactToolCallRenderer, ToolsMenuItem, UseAgentUpdate, UseInterruptConfig, WildcardToolCallRender, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSuggestions };
|
package/dist/index.mjs
CHANGED
|
@@ -5,10 +5,11 @@ import { AudioRecorderError, CopilotChatAudioRecorder } from "./components/chat/
|
|
|
5
5
|
import CopilotChatInput_default from "./components/chat/CopilotChatInput.mjs";
|
|
6
6
|
import { CopilotKitInspector } from "./components/CopilotKitInspector.mjs";
|
|
7
7
|
import { MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType } from "./components/MCPAppsActivityRenderer.mjs";
|
|
8
|
+
import "./providers/index.mjs";
|
|
9
|
+
import { createA2UIMessageRenderer } from "./a2ui/A2UIMessageRenderer.mjs";
|
|
8
10
|
import { CopilotKitCoreReact } from "./lib/react-core.mjs";
|
|
9
11
|
import { CopilotKitProvider, useCopilotKit } from "./providers/CopilotKitProvider.mjs";
|
|
10
12
|
import { useRenderToolCall } from "./hooks/use-render-tool-call.mjs";
|
|
11
|
-
import "./providers/index.mjs";
|
|
12
13
|
import { useRenderCustomMessages } from "./hooks/use-render-custom-messages.mjs";
|
|
13
14
|
import { useRenderActivityMessage } from "./hooks/use-render-activity-message.mjs";
|
|
14
15
|
import { useFrontendTool } from "./hooks/use-frontend-tool.mjs";
|
|
@@ -44,4 +45,4 @@ import "./types/index.mjs";
|
|
|
44
45
|
|
|
45
46
|
export * from "@ag-ui/client"
|
|
46
47
|
|
|
47
|
-
export { AudioRecorderError, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView, CopilotChatReasoningMessage_default as CopilotChatReasoningMessage, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotKitCoreReact, CopilotKitInspector, CopilotKitProvider, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, UseAgentUpdate, WildcardToolCallRender, defineToolCallRenderer, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSuggestions };
|
|
48
|
+
export { AudioRecorderError, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView, CopilotChatReasoningMessage_default as CopilotChatReasoningMessage, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotKitCoreReact, CopilotKitInspector, CopilotKitProvider, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, UseAgentUpdate, WildcardToolCallRender, createA2UIMessageRenderer, defineToolCallRenderer, useAgent, useAgentContext, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useHumanInTheLoop, useInterrupt, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSuggestions };
|
package/dist/index.umd.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
(function(global, factory) {
|
|
4
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ag-ui/client'), require('react'), require('tailwind-merge'), require('lucide-react'), require('@copilotkitnext/shared'), require('react/jsx-runtime'), require('@radix-ui/react-slot'), require('class-variance-authority'), require('clsx'), require('@radix-ui/react-tooltip'), require('@radix-ui/react-dropdown-menu'), require('
|
|
5
|
-
typeof define === 'function' && define.amd ? define(['exports', '@ag-ui/client', 'react', 'tailwind-merge', 'lucide-react', '@copilotkitnext/shared', 'react/jsx-runtime', '@radix-ui/react-slot', 'class-variance-authority', 'clsx', '@radix-ui/react-tooltip', '@radix-ui/react-dropdown-menu', '
|
|
6
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitNextReact = {}), global.AgUIClient,global.React,global.tailwindMerge,global.lucideReact,global.CopilotKitNextShared,global.ReactJsxRuntime,global.RadixReactSlot,global.classVarianceAuthority,global.clsx,global.RadixReactTooltip,global.RadixReactDropdownMenu,global.
|
|
7
|
-
})(this, function(exports, _ag_ui_client, react, tailwind_merge, lucide_react, _copilotkitnext_shared, react_jsx_runtime, _radix_ui_react_slot, class_variance_authority, clsx, _radix_ui_react_tooltip, _radix_ui_react_dropdown_menu,
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ag-ui/client'), require('react'), require('tailwind-merge'), require('lucide-react'), require('@copilotkitnext/shared'), require('react/jsx-runtime'), require('@radix-ui/react-slot'), require('class-variance-authority'), require('clsx'), require('@radix-ui/react-tooltip'), require('@radix-ui/react-dropdown-menu'), require('streamdown'), require('@copilotkitnext/core'), require('zod'), require('@lit-labs/react'), require('@copilotkit/a2ui-renderer'), require('use-stick-to-bottom'), require('ts-deepmerge')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', '@ag-ui/client', 'react', 'tailwind-merge', 'lucide-react', '@copilotkitnext/shared', 'react/jsx-runtime', '@radix-ui/react-slot', 'class-variance-authority', 'clsx', '@radix-ui/react-tooltip', '@radix-ui/react-dropdown-menu', 'streamdown', '@copilotkitnext/core', 'zod', '@lit-labs/react', '@copilotkit/a2ui-renderer', 'use-stick-to-bottom', 'ts-deepmerge'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitNextReact = {}), global.AgUIClient,global.React,global.tailwindMerge,global.lucideReact,global.CopilotKitNextShared,global.ReactJsxRuntime,global.RadixReactSlot,global.classVarianceAuthority,global.clsx,global.RadixReactTooltip,global.RadixReactDropdownMenu,global.streamdown,global.CopilotKitNextCore,global.Zod,global.LitLabsReact,global.CopilotKitA2UIRenderer,global.useStickToBottom,global.tsDeepmerge));
|
|
7
|
+
})(this, function(exports, _ag_ui_client, react, tailwind_merge, lucide_react, _copilotkitnext_shared, react_jsx_runtime, _radix_ui_react_slot, class_variance_authority, clsx, _radix_ui_react_tooltip, _radix_ui_react_dropdown_menu, streamdown, _copilotkitnext_core, zod, _lit_labs_react, _copilotkit_a2ui_renderer, use_stick_to_bottom, ts_deepmerge) {
|
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
10
|
var __create = Object.create;
|
|
@@ -1239,6 +1239,23 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
|
|
|
1239
1239
|
CopilotChatInput.Disclaimer.displayName = "CopilotChatInput.Disclaimer";
|
|
1240
1240
|
var CopilotChatInput_default = CopilotChatInput;
|
|
1241
1241
|
|
|
1242
|
+
//#endregion
|
|
1243
|
+
//#region src/hooks/useKatexStyles.ts
|
|
1244
|
+
let injected = false;
|
|
1245
|
+
/**
|
|
1246
|
+
* Dynamically injects KaTeX CSS at runtime to avoid the Next.js
|
|
1247
|
+
* "Global CSS cannot be imported from within node_modules" build error.
|
|
1248
|
+
*
|
|
1249
|
+
* Uses a singleton flag so the stylesheet is only injected once.
|
|
1250
|
+
*/
|
|
1251
|
+
function useKatexStyles() {
|
|
1252
|
+
(0, react.useEffect)(() => {
|
|
1253
|
+
if (injected || typeof document === "undefined") return;
|
|
1254
|
+
injected = true;
|
|
1255
|
+
import("katex/dist/katex.min.css").catch(() => {});
|
|
1256
|
+
}, []);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1242
1259
|
//#endregion
|
|
1243
1260
|
//#region src/components/CopilotKitInspector.tsx
|
|
1244
1261
|
const CopilotKitInspector = ({ core, ...rest }) => {
|
|
@@ -1794,6 +1811,131 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1794
1811
|
});
|
|
1795
1812
|
};
|
|
1796
1813
|
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region src/a2ui/A2UIMessageRenderer.tsx
|
|
1816
|
+
let initialized = false;
|
|
1817
|
+
function ensureInitialized() {
|
|
1818
|
+
if (!initialized) {
|
|
1819
|
+
(0, _copilotkit_a2ui_renderer.initializeDefaultCatalog)();
|
|
1820
|
+
(0, _copilotkit_a2ui_renderer.injectStyles)();
|
|
1821
|
+
initialized = true;
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
function createA2UIMessageRenderer(options) {
|
|
1825
|
+
const { theme } = options;
|
|
1826
|
+
return {
|
|
1827
|
+
activityType: "a2ui-surface",
|
|
1828
|
+
content: zod.z.any(),
|
|
1829
|
+
render: ({ content, agent }) => {
|
|
1830
|
+
ensureInitialized();
|
|
1831
|
+
const [operations, setOperations] = (0, react.useState)([]);
|
|
1832
|
+
const lastSignatureRef = (0, react.useRef)(null);
|
|
1833
|
+
const { copilotkit } = useCopilotKit();
|
|
1834
|
+
(0, react.useEffect)(() => {
|
|
1835
|
+
if (!content || !Array.isArray(content.operations)) {
|
|
1836
|
+
lastSignatureRef.current = null;
|
|
1837
|
+
setOperations([]);
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
const incoming = content.operations;
|
|
1841
|
+
const signature = stringifyOperations(incoming);
|
|
1842
|
+
if (signature && signature === lastSignatureRef.current) return;
|
|
1843
|
+
lastSignatureRef.current = signature;
|
|
1844
|
+
setOperations(incoming);
|
|
1845
|
+
}, [content]);
|
|
1846
|
+
const groupedOperations = (0, react.useMemo)(() => {
|
|
1847
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1848
|
+
for (const operation of operations) {
|
|
1849
|
+
var _getOperationSurfaceI;
|
|
1850
|
+
const surfaceId = (_getOperationSurfaceI = getOperationSurfaceId(operation)) !== null && _getOperationSurfaceI !== void 0 ? _getOperationSurfaceI : _copilotkit_a2ui_renderer.DEFAULT_SURFACE_ID;
|
|
1851
|
+
if (!groups.has(surfaceId)) groups.set(surfaceId, []);
|
|
1852
|
+
groups.get(surfaceId).push(operation);
|
|
1853
|
+
}
|
|
1854
|
+
return groups;
|
|
1855
|
+
}, [operations]);
|
|
1856
|
+
if (!groupedOperations.size) return null;
|
|
1857
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1858
|
+
className: "cpk:flex cpk:min-h-0 cpk:flex-1 cpk:flex-col cpk:gap-6 cpk:overflow-auto cpk:py-6",
|
|
1859
|
+
children: Array.from(groupedOperations.entries()).map(([surfaceId, ops]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReactSurfaceHost, {
|
|
1860
|
+
surfaceId,
|
|
1861
|
+
operations: ops,
|
|
1862
|
+
theme,
|
|
1863
|
+
agent,
|
|
1864
|
+
copilotkit
|
|
1865
|
+
}, surfaceId))
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
};
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Renders a single A2UI surface using the React renderer.
|
|
1872
|
+
* Wraps A2UIProvider + A2UIRenderer and bridges actions back to CopilotKit.
|
|
1873
|
+
*/
|
|
1874
|
+
function ReactSurfaceHost({ surfaceId, operations, theme, agent, copilotkit }) {
|
|
1875
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1876
|
+
className: "cpk:flex cpk:w-full cpk:flex-none cpk:overflow-hidden cpk:rounded-lg cpk:bg-white/5 cpk:p-4",
|
|
1877
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_copilotkit_a2ui_renderer.A2UIProvider, {
|
|
1878
|
+
onAction: (0, react.useCallback)(async (message) => {
|
|
1879
|
+
if (!agent) return;
|
|
1880
|
+
try {
|
|
1881
|
+
var _copilotkit$propertie;
|
|
1882
|
+
console.info("[A2UI] Action dispatched", message.userAction);
|
|
1883
|
+
copilotkit.setProperties({
|
|
1884
|
+
...(_copilotkit$propertie = copilotkit.properties) !== null && _copilotkit$propertie !== void 0 ? _copilotkit$propertie : {},
|
|
1885
|
+
a2uiAction: message
|
|
1886
|
+
});
|
|
1887
|
+
await copilotkit.runAgent({ agent });
|
|
1888
|
+
} finally {
|
|
1889
|
+
if (copilotkit.properties) {
|
|
1890
|
+
const { a2uiAction, ...rest } = copilotkit.properties;
|
|
1891
|
+
copilotkit.setProperties(rest);
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
}, [agent, copilotkit]),
|
|
1895
|
+
theme,
|
|
1896
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SurfaceMessageProcessor, {
|
|
1897
|
+
surfaceId,
|
|
1898
|
+
operations
|
|
1899
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_copilotkit_a2ui_renderer.A2UIRenderer, {
|
|
1900
|
+
surfaceId,
|
|
1901
|
+
className: "cpk:flex cpk:flex-1"
|
|
1902
|
+
})]
|
|
1903
|
+
})
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Processes A2UI operations into the provider's message processor.
|
|
1908
|
+
* Must be a child of A2UIProvider to access the actions context.
|
|
1909
|
+
*/
|
|
1910
|
+
function SurfaceMessageProcessor({ surfaceId, operations }) {
|
|
1911
|
+
const { processMessages } = (0, _copilotkit_a2ui_renderer.useA2UIActions)();
|
|
1912
|
+
const lastProcessedRef = (0, react.useRef)("");
|
|
1913
|
+
(0, react.useEffect)(() => {
|
|
1914
|
+
const key = `${surfaceId}-${JSON.stringify(operations)}`;
|
|
1915
|
+
if (key === lastProcessedRef.current) return;
|
|
1916
|
+
lastProcessedRef.current = key;
|
|
1917
|
+
processMessages(operations);
|
|
1918
|
+
}, [
|
|
1919
|
+
processMessages,
|
|
1920
|
+
surfaceId,
|
|
1921
|
+
operations
|
|
1922
|
+
]);
|
|
1923
|
+
return null;
|
|
1924
|
+
}
|
|
1925
|
+
function getOperationSurfaceId(operation) {
|
|
1926
|
+
var _ref, _ref2, _ref3, _operation$beginRende, _operation$beginRende2, _operation$surfaceUpd, _operation$dataModelU, _operation$deleteSurf;
|
|
1927
|
+
if (!operation || typeof operation !== "object") return null;
|
|
1928
|
+
if (typeof operation.surfaceId === "string") return operation.surfaceId;
|
|
1929
|
+
return (_ref = (_ref2 = (_ref3 = (_operation$beginRende = operation === null || operation === void 0 || (_operation$beginRende2 = operation.beginRendering) === null || _operation$beginRende2 === void 0 ? void 0 : _operation$beginRende2.surfaceId) !== null && _operation$beginRende !== void 0 ? _operation$beginRende : operation === null || operation === void 0 || (_operation$surfaceUpd = operation.surfaceUpdate) === null || _operation$surfaceUpd === void 0 ? void 0 : _operation$surfaceUpd.surfaceId) !== null && _ref3 !== void 0 ? _ref3 : operation === null || operation === void 0 || (_operation$dataModelU = operation.dataModelUpdate) === null || _operation$dataModelU === void 0 ? void 0 : _operation$dataModelU.surfaceId) !== null && _ref2 !== void 0 ? _ref2 : operation === null || operation === void 0 || (_operation$deleteSurf = operation.deleteSurface) === null || _operation$deleteSurf === void 0 ? void 0 : _operation$deleteSurf.surfaceId) !== null && _ref !== void 0 ? _ref : null;
|
|
1930
|
+
}
|
|
1931
|
+
function stringifyOperations(ops) {
|
|
1932
|
+
try {
|
|
1933
|
+
return JSON.stringify(ops);
|
|
1934
|
+
} catch (error) {
|
|
1935
|
+
return null;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1797
1939
|
//#endregion
|
|
1798
1940
|
//#region src/lib/react-core.ts
|
|
1799
1941
|
var CopilotKitCoreReact = class extends _copilotkitnext_core.CopilotKitCore {
|
|
@@ -1869,8 +2011,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1869
2011
|
}, [value, warningMessage]);
|
|
1870
2012
|
return value;
|
|
1871
2013
|
}
|
|
1872
|
-
const CopilotKitProvider = ({ children, runtimeUrl, headers = {}, credentials, publicApiKey, publicLicenseKey, properties = {}, agents__unsafe_dev_only: agents = {}, selfManagedAgents = {}, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, showDevConsole = false, useSingleEndpoint = false, onError }) => {
|
|
2014
|
+
const CopilotKitProvider = ({ children, runtimeUrl, headers = {}, credentials, publicApiKey, publicLicenseKey, properties = {}, agents__unsafe_dev_only: agents = {}, selfManagedAgents = {}, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, showDevConsole = false, useSingleEndpoint = false, onError, a2ui }) => {
|
|
1873
2015
|
const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
|
|
2016
|
+
const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
|
|
1874
2017
|
(0, react.useEffect)(() => {
|
|
1875
2018
|
if (typeof window === "undefined") return;
|
|
1876
2019
|
if (showDevConsole === true) setShouldRenderInspector(true);
|
|
@@ -1892,11 +2035,18 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1892
2035
|
});
|
|
1893
2036
|
const renderCustomMessagesList = useStableArrayProp(renderCustomMessages, "renderCustomMessages must be a stable array.");
|
|
1894
2037
|
const renderActivityMessagesList = useStableArrayProp(renderActivityMessages, "renderActivityMessages must be a stable array.");
|
|
1895
|
-
const builtInActivityRenderers = (0, react.useMemo)(() =>
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
2038
|
+
const builtInActivityRenderers = (0, react.useMemo)(() => {
|
|
2039
|
+
const renderers = [{
|
|
2040
|
+
activityType: MCPAppsActivityType,
|
|
2041
|
+
content: MCPAppsActivityContentSchema,
|
|
2042
|
+
render: MCPAppsActivityRenderer
|
|
2043
|
+
}];
|
|
2044
|
+
if (runtimeA2UIEnabled) {
|
|
2045
|
+
var _a2ui$theme;
|
|
2046
|
+
renderers.unshift(createA2UIMessageRenderer({ theme: (_a2ui$theme = a2ui === null || a2ui === void 0 ? void 0 : a2ui.theme) !== null && _a2ui$theme !== void 0 ? _a2ui$theme : _copilotkit_a2ui_renderer.viewerTheme }));
|
|
2047
|
+
}
|
|
2048
|
+
return renderers;
|
|
2049
|
+
}, [runtimeA2UIEnabled, a2ui]);
|
|
1900
2050
|
const allActivityRenderers = (0, react.useMemo)(() => {
|
|
1901
2051
|
return [...renderActivityMessagesList, ...builtInActivityRenderers];
|
|
1902
2052
|
}, [renderActivityMessagesList, builtInActivityRenderers]);
|
|
@@ -1991,6 +2141,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
1991
2141
|
renderCustomMessages: renderCustomMessagesList
|
|
1992
2142
|
});
|
|
1993
2143
|
const copilotkit = copilotkitRef.current;
|
|
2144
|
+
(0, react.useEffect)(() => {
|
|
2145
|
+
const subscription = copilotkit.subscribe({ onRuntimeConnectionStatusChanged: () => {
|
|
2146
|
+
setRuntimeA2UIEnabled(copilotkit.a2uiEnabled);
|
|
2147
|
+
} });
|
|
2148
|
+
return () => {
|
|
2149
|
+
subscription.unsubscribe();
|
|
2150
|
+
};
|
|
2151
|
+
}, [copilotkit]);
|
|
1994
2152
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
1995
2153
|
(0, react.useEffect)(() => {
|
|
1996
2154
|
const subscription = copilotkit.subscribe({ onRenderToolCallsChanged: () => {
|
|
@@ -3220,6 +3378,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
3220
3378
|
//#region src/components/chat/CopilotChatAssistantMessage.tsx
|
|
3221
3379
|
function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
|
|
3222
3380
|
var _messages;
|
|
3381
|
+
useKatexStyles();
|
|
3223
3382
|
const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
|
|
3224
3383
|
const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
|
|
3225
3384
|
if (message.content) try {
|
|
@@ -5261,6 +5420,7 @@ exports.MCPAppsActivityRenderer = MCPAppsActivityRenderer;
|
|
|
5261
5420
|
exports.MCPAppsActivityType = MCPAppsActivityType;
|
|
5262
5421
|
exports.UseAgentUpdate = UseAgentUpdate;
|
|
5263
5422
|
exports.WildcardToolCallRender = WildcardToolCallRender;
|
|
5423
|
+
exports.createA2UIMessageRenderer = createA2UIMessageRenderer;
|
|
5264
5424
|
exports.defineToolCallRenderer = defineToolCallRenderer;
|
|
5265
5425
|
exports.useAgent = useAgent;
|
|
5266
5426
|
exports.useAgentContext = useAgentContext;
|