@copilotkitnext/react 1.53.1-next.1 → 1.54.0-next.3
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-component.cjs +4 -4
- package/dist/hooks/use-component.cjs.map +1 -1
- package/dist/hooks/use-component.d.cts +7 -7
- package/dist/hooks/use-component.d.cts.map +1 -1
- package/dist/hooks/use-component.d.mts +7 -7
- package/dist/hooks/use-component.d.mts.map +1 -1
- package/dist/hooks/use-component.mjs +4 -4
- package/dist/hooks/use-component.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/use-render-tool.cjs +1 -1
- package/dist/hooks/use-render-tool.cjs.map +1 -1
- package/dist/hooks/use-render-tool.d.cts +13 -12
- package/dist/hooks/use-render-tool.d.cts.map +1 -1
- package/dist/hooks/use-render-tool.d.mts +13 -12
- package/dist/hooks/use-render-tool.d.mts.map +1 -1
- package/dist/hooks/use-render-tool.mjs +1 -1
- package/dist/hooks/use-render-tool.mjs.map +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 +175 -15
- 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/dist/types/defineToolCallRenderer.cjs.map +1 -1
- package/dist/types/defineToolCallRenderer.d.cts +5 -5
- package/dist/types/defineToolCallRenderer.d.cts.map +1 -1
- package/dist/types/defineToolCallRenderer.d.mts +5 -5
- package/dist/types/defineToolCallRenderer.d.mts.map +1 -1
- package/dist/types/defineToolCallRenderer.mjs.map +1 -1
- package/dist/types/react-activity-message-renderer.d.cts +2 -2
- package/dist/types/react-activity-message-renderer.d.cts.map +1 -1
- package/dist/types/react-activity-message-renderer.d.mts +2 -2
- package/dist/types/react-activity-message-renderer.d.mts.map +1 -1
- package/dist/types/react-tool-call-renderer.d.cts +2 -2
- package/dist/types/react-tool-call-renderer.d.cts.map +1 -1
- package/dist/types/react-tool-call-renderer.d.mts +2 -2
- package/dist/types/react-tool-call-renderer.d.mts.map +1 -1
- package/package.json +10 -7
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: () => {
|
|
@@ -2311,16 +2469,16 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2311
2469
|
*
|
|
2312
2470
|
* This hook is a convenience wrapper around `useFrontendTool` that:
|
|
2313
2471
|
* - builds a model-facing tool description,
|
|
2314
|
-
* - forwards optional
|
|
2472
|
+
* - forwards optional schema parameters (any Standard Schema V1 compatible library),
|
|
2315
2473
|
* - renders your component with tool call parameters.
|
|
2316
2474
|
*
|
|
2317
2475
|
* Use this when you want to display a typed visual component for a tool call
|
|
2318
2476
|
* without manually wiring a full frontend tool object.
|
|
2319
2477
|
*
|
|
2320
|
-
* When `parameters` is provided, render props are inferred from the schema
|
|
2321
|
-
*
|
|
2478
|
+
* When `parameters` is provided, render props are inferred from the schema.
|
|
2479
|
+
* When omitted, the render component may accept any props.
|
|
2322
2480
|
*
|
|
2323
|
-
* @typeParam TSchema -
|
|
2481
|
+
* @typeParam TSchema - Schema describing tool parameters, or `undefined` when no schema is given.
|
|
2324
2482
|
* @param config - Tool registration config.
|
|
2325
2483
|
* @param deps - Optional dependencies to refresh registration (same semantics as `useEffect`).
|
|
2326
2484
|
*
|
|
@@ -2394,7 +2552,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
|
|
|
2394
2552
|
* - keeps renderer entries on cleanup so historical chat tool calls can still render,
|
|
2395
2553
|
* - refreshes registration when `deps` change.
|
|
2396
2554
|
*
|
|
2397
|
-
* @typeParam S -
|
|
2555
|
+
* @typeParam S - Schema type describing tool call parameters.
|
|
2398
2556
|
* @param config - Renderer config for wildcard or named tools.
|
|
2399
2557
|
* @param deps - Optional dependencies to refresh registration.
|
|
2400
2558
|
*
|
|
@@ -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;
|