@copilotkit/react-core 2.0.0-rc.37 → 2.0.0-rc.39
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/MarkdownRendererContext-BL8ct_3U.d.mts +34 -0
- package/dist/MarkdownRendererContext-BL8ct_3U.d.mts.map +1 -0
- package/dist/MarkdownRendererContext-C2J_lgqF.d.cts +34 -0
- package/dist/MarkdownRendererContext-C2J_lgqF.d.cts.map +1 -0
- package/dist/MarkdownSurfaces-Byz821bg.mjs +324 -0
- package/dist/MarkdownSurfaces-Byz821bg.mjs.map +1 -0
- package/dist/MarkdownSurfaces-D2Ck-cbb.cjs +378 -0
- package/dist/MarkdownSurfaces-D2Ck-cbb.cjs.map +1 -0
- package/dist/{MarkdownSurfaces-BQ1HGCzB.mjs → chat-Bf0vVdo7.mjs} +642 -484
- package/dist/chat-Bf0vVdo7.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-BFoO6wSB.cjs → chat-D3fxo6Ah.cjs} +663 -529
- package/dist/chat-D3fxo6Ah.cjs.map +1 -0
- package/dist/{MarkdownRendererContext-CPfNVyde.d.mts → chat-DgP2N7bD.d.mts} +31 -39
- package/dist/chat-DgP2N7bD.d.mts.map +1 -0
- package/dist/{MarkdownRendererContext-iOl2pj9l.d.cts → chat-DtHs4alO.d.cts} +31 -39
- package/dist/chat-DtHs4alO.d.cts.map +1 -0
- package/dist/generative-ui/native.cjs +66 -0
- package/dist/generative-ui/native.cjs.map +1 -0
- package/dist/generative-ui/native.d.cts +155 -0
- package/dist/generative-ui/native.d.cts.map +1 -0
- package/dist/generative-ui/native.d.mts +155 -0
- package/dist/generative-ui/native.d.mts.map +1 -0
- package/dist/generative-ui/native.mjs +24 -0
- package/dist/generative-ui/native.mjs.map +1 -0
- package/dist/generative-ui.cjs +45 -70
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +72 -144
- package/dist/generative-ui.d.cts.map +1 -1
- package/dist/generative-ui.d.mts +72 -144
- package/dist/generative-ui.d.mts.map +1 -1
- package/dist/generative-ui.mjs +4 -29
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.d.cts +58 -153
- package/dist/headless.d.cts.map +1 -1
- package/dist/hooks-2Ur8NQhj.d.cts +84 -0
- package/dist/hooks-2Ur8NQhj.d.cts.map +1 -0
- package/dist/hooks-BRYonCVu.d.mts +84 -0
- package/dist/hooks-BRYonCVu.d.mts.map +1 -0
- package/dist/index.cjs +82 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -353
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +645 -140
- package/dist/index.umd.js.map +1 -1
- package/dist/refs-BIUfn1wb.cjs +43 -0
- package/dist/refs-BIUfn1wb.cjs.map +1 -0
- package/dist/refs-CMrRm3ta.mjs +31 -0
- package/dist/refs-CMrRm3ta.mjs.map +1 -0
- package/dist/use-generative-ui-root-C12htqbK.cjs +390 -0
- package/dist/use-generative-ui-root-C12htqbK.cjs.map +1 -0
- package/dist/use-generative-ui-root-CVgsDy1f.mjs +385 -0
- package/dist/use-generative-ui-root-CVgsDy1f.mjs.map +1 -0
- package/package.json +14 -10
- package/dist/MarkdownRendererContext-CPfNVyde.d.mts.map +0 -1
- package/dist/MarkdownRendererContext-iOl2pj9l.d.cts.map +0 -1
- package/dist/MarkdownSurfaces-BFoO6wSB.cjs.map +0 -1
- package/dist/MarkdownSurfaces-BQ1HGCzB.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const
|
|
4
|
+
const require_chat = require('./chat-D3fxo6Ah.cjs');
|
|
5
|
+
const require_MarkdownSurfaces = require('./MarkdownSurfaces-D2Ck-cbb.cjs');
|
|
6
|
+
const require_use_generative_ui_root = require('./use-generative-ui-root-C12htqbK.cjs');
|
|
5
7
|
let _copilotkit_core = require("@copilotkit/core");
|
|
6
8
|
let react = require("react");
|
|
7
|
-
react =
|
|
9
|
+
react = require_chat.__toESM(react);
|
|
8
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
11
|
let _copilotkit_react_core_context = require("@copilotkit/react-core/context");
|
|
10
12
|
let _radix_ui_react_tooltip = require("@radix-ui/react-tooltip");
|
|
11
|
-
_radix_ui_react_tooltip =
|
|
13
|
+
_radix_ui_react_tooltip = require_chat.__toESM(_radix_ui_react_tooltip);
|
|
12
14
|
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
13
|
-
_radix_ui_react_dropdown_menu =
|
|
15
|
+
_radix_ui_react_dropdown_menu = require_chat.__toESM(_radix_ui_react_dropdown_menu);
|
|
14
16
|
let _copilotkit_shared = require("@copilotkit/shared");
|
|
15
17
|
let _copilotkit_web_inspector_mount = require("@copilotkit/web-inspector/mount");
|
|
16
18
|
let _copilotkit_mcp_apps_renderer_activity = require("@copilotkit/mcp-apps-renderer/activity");
|
|
17
19
|
let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
|
|
18
20
|
let _copilotkit_a2ui_renderer_engine_core = require("@copilotkit/a2ui-renderer/engine-core");
|
|
19
21
|
let zod = require("zod");
|
|
20
|
-
zod =
|
|
21
|
-
let _copilotkit_core_generative_ui = require("@copilotkit/core/generative-ui");
|
|
22
|
-
let _copilotkit_shared_generative_ui = require("@copilotkit/shared/generative-ui");
|
|
22
|
+
zod = require_chat.__toESM(zod);
|
|
23
23
|
let _copilotkit_a2ui_renderer_catalog_schema = require("@copilotkit/a2ui-renderer/catalog-schema");
|
|
24
24
|
let _copilotkit_core_styles = require("@copilotkit/core/styles");
|
|
25
25
|
let _radix_ui_react_popover = require("@radix-ui/react-popover");
|
|
26
|
-
_radix_ui_react_popover =
|
|
26
|
+
_radix_ui_react_popover = require_chat.__toESM(_radix_ui_react_popover);
|
|
27
27
|
let react_dom = require("react-dom");
|
|
28
28
|
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
29
29
|
let use_stick_to_bottom = require("use-stick-to-bottom");
|
|
@@ -247,7 +247,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
247
247
|
const actionsContainerRef = (0, react.useRef)(null);
|
|
248
248
|
const audioRecorderRef = (0, react.useRef)(null);
|
|
249
249
|
const slashMenuRef = (0, react.useRef)(null);
|
|
250
|
-
const config =
|
|
250
|
+
const config = require_chat.useCopilotChatConfiguration();
|
|
251
251
|
const labels = config?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
252
252
|
const [autosize] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateComposerAutosize)({ getElements: () => ({
|
|
253
253
|
textarea: inputRef.current,
|
|
@@ -507,7 +507,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
507
507
|
}
|
|
508
508
|
(function(_CopilotChatInput) {
|
|
509
509
|
_CopilotChatInput.SendButton = ({ className, children, ...props }) => {
|
|
510
|
-
const labels =
|
|
510
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
511
511
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
512
512
|
className: "cpk-chat-input-send",
|
|
513
513
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -526,7 +526,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
526
526
|
});
|
|
527
527
|
};
|
|
528
528
|
const ToolbarButton = _CopilotChatInput.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
|
|
529
|
-
const labels =
|
|
529
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
530
530
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
|
|
531
531
|
asChild: true,
|
|
532
532
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -574,7 +574,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
574
574
|
...props
|
|
575
575
|
});
|
|
576
576
|
_CopilotChatInput.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
|
|
577
|
-
const labels =
|
|
577
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
578
578
|
const [mounted, setMounted] = (0, react.useState)(false);
|
|
579
579
|
(0, react.useEffect)(() => setMounted(true), []);
|
|
580
580
|
const menuItems = (0, react.useMemo)(() => (0, _copilotkit_core.ɵnormalizeToolsMenu)(toolsMenu, onAddFile ? {
|
|
@@ -633,7 +633,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
633
633
|
};
|
|
634
634
|
_CopilotChatInput.TextArea = (0, react.forwardRef)(function TextArea({ style, className, autoFocus, placeholder, ...props }, ref) {
|
|
635
635
|
const internalTextareaRef = (0, react.useRef)(null);
|
|
636
|
-
const labels =
|
|
636
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
637
637
|
(0, react.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
638
638
|
(0, react.useEffect)(() => {
|
|
639
639
|
if (autoFocus) internalTextareaRef.current?.focus({ preventScroll: true });
|
|
@@ -654,7 +654,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
654
654
|
});
|
|
655
655
|
_CopilotChatInput.AudioRecorder = CopilotChatAudioRecorder;
|
|
656
656
|
_CopilotChatInput.Disclaimer = ({ className, ...props }) => {
|
|
657
|
-
const labels =
|
|
657
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
658
658
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
659
659
|
className: (0, _copilotkit_core.ɵcn)("cpk-chat-input-disclaimer", className),
|
|
660
660
|
...props,
|
|
@@ -738,7 +738,7 @@ function useToolCallRendererNames() {
|
|
|
738
738
|
*/
|
|
739
739
|
function useRenderToolCall() {
|
|
740
740
|
const { copilotkit, executingToolCallIds } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
741
|
-
const agentId = (0, _copilotkit_core.ɵresolveToolCallAgentId)(
|
|
741
|
+
const agentId = (0, _copilotkit_core.ɵresolveToolCallAgentId)(require_chat.useCopilotChatConfiguration()?.agentId, void 0);
|
|
742
742
|
const unrenderedToolNames = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
743
743
|
const warnedToolNames = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
744
744
|
const renderToolCalls = useToolCallRenderers();
|
|
@@ -824,7 +824,7 @@ function ɵuseOwnedCore(ref, create) {
|
|
|
824
824
|
|
|
825
825
|
//#endregion
|
|
826
826
|
//#region package.json
|
|
827
|
-
var version$1 = "2.0.0-rc.
|
|
827
|
+
var version$1 = "2.0.0-rc.39";
|
|
828
828
|
|
|
829
829
|
//#endregion
|
|
830
830
|
//#region src/components/CopilotKitInspector.tsx
|
|
@@ -881,7 +881,7 @@ function useCopilotKitInspector() {
|
|
|
881
881
|
//#region src/components/license-warning-banner.tsx
|
|
882
882
|
/** The chat labels in effect, or the default ones outside a chat. */
|
|
883
883
|
function useLabels$2() {
|
|
884
|
-
return
|
|
884
|
+
return require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
885
885
|
}
|
|
886
886
|
/**
|
|
887
887
|
* The fixed license banner. Core's `ɵgetLicenseBannerSpec` picks its text,
|
|
@@ -1461,7 +1461,7 @@ function SurfaceMessageProcessor({ operations, onRendered }) {
|
|
|
1461
1461
|
function A2UIBuiltInToolCallRenderer() {
|
|
1462
1462
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
1463
1463
|
(0, react.useEffect)(() => {
|
|
1464
|
-
const renderer =
|
|
1464
|
+
const renderer = require_chat.defineToolCallRenderer({
|
|
1465
1465
|
name: _copilotkit_core.ɵRENDER_A2UI_TOOL_NAME,
|
|
1466
1466
|
args: zod.any(),
|
|
1467
1467
|
render: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {})
|
|
@@ -1471,354 +1471,6 @@ function A2UIBuiltInToolCallRenderer() {
|
|
|
1471
1471
|
return null;
|
|
1472
1472
|
}
|
|
1473
1473
|
|
|
1474
|
-
//#endregion
|
|
1475
|
-
//#region src/generative-ui/markdown/context.ts
|
|
1476
|
-
/**
|
|
1477
|
-
* Registers the two context entries of the markdown transport: the compact
|
|
1478
|
-
* component schema and the fence guideline. Both go only to `agentIds`.
|
|
1479
|
-
*
|
|
1480
|
-
* The schema is built again at each run start and when a
|
|
1481
|
-
* `<GenerativeUISurface>` mounts, unmounts, or changes its description or
|
|
1482
|
-
* its components, so its targets, functions, and surfaces stay current. The surfaces are those of the running thread.
|
|
1483
|
-
*
|
|
1484
|
-
* @param copilotkit - The CopilotKit core of the provider.
|
|
1485
|
-
* @param runtime - The generative UI runtime parts, or null without one.
|
|
1486
|
-
* @param options - `enabled` and `agentIds`.
|
|
1487
|
-
*
|
|
1488
|
-
* @example
|
|
1489
|
-
* ```ts
|
|
1490
|
-
* useGenerativeUIMarkdownContext(copilotkit, core, {
|
|
1491
|
-
* enabled: config?.transport === "markdown" && config.sendContext !== false,
|
|
1492
|
-
* agentIds: config?.agentIds,
|
|
1493
|
-
* });
|
|
1494
|
-
* ```
|
|
1495
|
-
*/
|
|
1496
|
-
function useGenerativeUIMarkdownContext(copilotkit, runtime, options) {
|
|
1497
|
-
const { enabled, agentIds } = options;
|
|
1498
|
-
const agentIdsKey = agentIds === void 0 ? "" : JSON.stringify(agentIds);
|
|
1499
|
-
(0, react.useEffect)(() => {
|
|
1500
|
-
if (!runtime || !enabled) return;
|
|
1501
|
-
const scopedAgentIds = agentIdsKey ? JSON.parse(agentIdsKey) : void 0;
|
|
1502
|
-
const scope = scopedAgentIds ? { agentIds: scopedAgentIds } : {};
|
|
1503
|
-
let guidelineId;
|
|
1504
|
-
let guidelineValue;
|
|
1505
|
-
let schemaId;
|
|
1506
|
-
let schemaValue;
|
|
1507
|
-
const refreshSchema = (threadId) => {
|
|
1508
|
-
const manifest = (0, _copilotkit_core_generative_ui.buildGenerativeUIManifest)(runtime, threadId);
|
|
1509
|
-
const guideline = (0, _copilotkit_shared.buildGenerativeUIMarkdownGuidelines)((0, _copilotkit_shared.generativeUIGuideFeatures)(manifest));
|
|
1510
|
-
if (guideline !== guidelineValue) {
|
|
1511
|
-
if (guidelineId !== void 0) copilotkit.removeContext(guidelineId);
|
|
1512
|
-
guidelineValue = guideline;
|
|
1513
|
-
guidelineId = copilotkit.addContext({
|
|
1514
|
-
description: _copilotkit_shared.GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION,
|
|
1515
|
-
value: guideline,
|
|
1516
|
-
...scope
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
const value = (0, _copilotkit_shared.renderGenerativeUISchema)(manifest, (0, _copilotkit_shared.defaultGenerativeUIPromptSpec)().schema.markdown);
|
|
1520
|
-
if (value === schemaValue) return;
|
|
1521
|
-
if (schemaId !== void 0) copilotkit.removeContext(schemaId);
|
|
1522
|
-
schemaValue = value;
|
|
1523
|
-
schemaId = copilotkit.addContext({
|
|
1524
|
-
description: _copilotkit_shared.GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION,
|
|
1525
|
-
value,
|
|
1526
|
-
...scope
|
|
1527
|
-
});
|
|
1528
|
-
};
|
|
1529
|
-
refreshSchema(runtime.manager.getActiveThread());
|
|
1530
|
-
let targetsKey = JSON.stringify(runtime.manager.getMountedTargets());
|
|
1531
|
-
const unsubscribeManager = runtime.manager.subscribe(() => {
|
|
1532
|
-
const nextKey = JSON.stringify(runtime.manager.getMountedTargets());
|
|
1533
|
-
if (nextKey === targetsKey) return;
|
|
1534
|
-
targetsKey = nextKey;
|
|
1535
|
-
refreshSchema(runtime.manager.getActiveThread());
|
|
1536
|
-
});
|
|
1537
|
-
const subscription = copilotkit.subscribe({ onAgentRunStarted: ({ agent }) => refreshSchema(agent.threadId) });
|
|
1538
|
-
return () => {
|
|
1539
|
-
subscription.unsubscribe();
|
|
1540
|
-
unsubscribeManager();
|
|
1541
|
-
if (guidelineId !== void 0) copilotkit.removeContext(guidelineId);
|
|
1542
|
-
if (schemaId !== void 0) copilotkit.removeContext(schemaId);
|
|
1543
|
-
};
|
|
1544
|
-
}, [
|
|
1545
|
-
copilotkit,
|
|
1546
|
-
runtime,
|
|
1547
|
-
enabled,
|
|
1548
|
-
agentIdsKey
|
|
1549
|
-
]);
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
//#endregion
|
|
1553
|
-
//#region src/generative-ui/use-generative-ui-root.ts
|
|
1554
|
-
const isDevelopment = () => process.env.NODE_ENV !== "production";
|
|
1555
|
-
function ingestMessages(manager, agent, messages) {
|
|
1556
|
-
if (!agent.threadId) return;
|
|
1557
|
-
for (const message of messages) if (message.role === "activity" && message.activityType === _copilotkit_shared.GENERATIVE_UI_ACTIVITY_TYPE) manager.ingest(agent.threadId, agent.agentId, message.content);
|
|
1558
|
-
}
|
|
1559
|
-
/** Provider-side wiring: manager, dispatcher, agent subscriptions, envelope. */
|
|
1560
|
-
function useGenerativeUIRoot(copilotkit, config) {
|
|
1561
|
-
const configRef = (0, react.useRef)(config);
|
|
1562
|
-
configRef.current = config;
|
|
1563
|
-
const ui = config?.ui;
|
|
1564
|
-
const transport = config?.transport ?? "tool";
|
|
1565
|
-
const theme = require_MarkdownSurfaces.useShallowStableRef(config?.theme);
|
|
1566
|
-
const core = (0, react.useMemo)(() => {
|
|
1567
|
-
if (!ui) return null;
|
|
1568
|
-
const reportError = (info) => {
|
|
1569
|
-
try {
|
|
1570
|
-
configRef.current?.errorBoundary?.onError?.(info);
|
|
1571
|
-
} catch (hostError) {
|
|
1572
|
-
if (isDevelopment()) console.error("[generativeUI] errorBoundary.onError threw:", hostError);
|
|
1573
|
-
}
|
|
1574
|
-
if (isDevelopment()) console.warn(`[generativeUI] ${info.kind} error in ${info.surfaceId}${info.componentId ? `/${info.componentId}` : ""}: ${info.error?.message}`);
|
|
1575
|
-
};
|
|
1576
|
-
const manager = new _copilotkit_core_generative_ui.GenerativeUISurfaceManager(ui, { onOperationRejected: ({ surfaceId, index, reason }) => reportError({
|
|
1577
|
-
kind: "operation",
|
|
1578
|
-
surfaceId,
|
|
1579
|
-
error: /* @__PURE__ */ new Error(`operation ${index} rejected: ${reason}`)
|
|
1580
|
-
}) });
|
|
1581
|
-
const dispatcher = (0, _copilotkit_core_generative_ui.createGenerativeUIDispatcher)({
|
|
1582
|
-
getDeclared: () => ui.functions,
|
|
1583
|
-
onError: ({ name, origin, error }) => {
|
|
1584
|
-
if ("functionCallId" in origin) {
|
|
1585
|
-
if (isDevelopment()) console.warn(`[generativeUI] function call ${origin.functionCallId} to "${name}" failed: ${error.message}`);
|
|
1586
|
-
return;
|
|
1587
|
-
}
|
|
1588
|
-
reportError({
|
|
1589
|
-
kind: "function",
|
|
1590
|
-
...origin,
|
|
1591
|
-
error
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
});
|
|
1595
|
-
const functionCalls = (0, _copilotkit_core_generative_ui.createFunctionCallRunner)({
|
|
1596
|
-
core: copilotkit,
|
|
1597
|
-
dispatcher,
|
|
1598
|
-
manifest: {
|
|
1599
|
-
catalogId: ui.id,
|
|
1600
|
-
catalogIds: (0, _copilotkit_shared_generative_ui.catalogIdsOf)(ui),
|
|
1601
|
-
components: ui.manifestComponents
|
|
1602
|
-
},
|
|
1603
|
-
settle: () => copilotkit.waitForPendingFrameworkUpdates(),
|
|
1604
|
-
warn: (message, error) => {
|
|
1605
|
-
if (isDevelopment()) console.warn(message, error);
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
const forwardingAgents = /* @__PURE__ */ new Set();
|
|
1609
|
-
/**
|
|
1610
|
-
* The action of a user event, as an envelope entry scoped to the agent
|
|
1611
|
-
* the user acted on, for the run that the event starts: the structured
|
|
1612
|
-
* form of the user message. It is set before the run starts and dropped
|
|
1613
|
-
* when the run is over, so a suggestion request or a follow-up run
|
|
1614
|
-
* (both read the properties with no run start) does not carry the same
|
|
1615
|
-
* action again, and another agent never gets a click meant for this one.
|
|
1616
|
-
* The entry comes after the shared envelope, so it wins for its agent;
|
|
1617
|
-
* `refreshActions` keeps it last when the shared envelope is set again.
|
|
1618
|
-
*/
|
|
1619
|
-
const actions = /* @__PURE__ */ new Map();
|
|
1620
|
-
const dropAction = (agent) => {
|
|
1621
|
-
const entry = actions.get(agent);
|
|
1622
|
-
if (!entry) return;
|
|
1623
|
-
entry.subscription.unsubscribe();
|
|
1624
|
-
copilotkit.removeScopedProperties(entry.id);
|
|
1625
|
-
actions.delete(agent);
|
|
1626
|
-
};
|
|
1627
|
-
const setAction = (agent, action) => {
|
|
1628
|
-
const previous = actions.get(agent);
|
|
1629
|
-
previous?.subscription.unsubscribe();
|
|
1630
|
-
if (previous) copilotkit.removeScopedProperties(previous.id);
|
|
1631
|
-
actions.delete(agent);
|
|
1632
|
-
const latest = configRef.current;
|
|
1633
|
-
if (!latest) return;
|
|
1634
|
-
const envelope = (0, _copilotkit_core_generative_ui.buildGenerativeUIEnvelope)({
|
|
1635
|
-
ui,
|
|
1636
|
-
manager,
|
|
1637
|
-
dispatcher
|
|
1638
|
-
}, agent.threadId, {
|
|
1639
|
-
...(0, _copilotkit_core_generative_ui.envelopeOptionsFor)(latest),
|
|
1640
|
-
action
|
|
1641
|
-
});
|
|
1642
|
-
const id = copilotkit.addScopedProperties({
|
|
1643
|
-
properties: { [_copilotkit_shared.COPILOTKIT_FORWARDED_PROPS_KEY]: { ui: envelope } },
|
|
1644
|
-
agentIds: agent.agentId === void 0 ? latest.agentIds : [agent.agentId]
|
|
1645
|
-
});
|
|
1646
|
-
const subscription = agent.subscribe({
|
|
1647
|
-
onRunFinalized: () => dropAction(agent),
|
|
1648
|
-
onRunFailed: () => dropAction(agent)
|
|
1649
|
-
});
|
|
1650
|
-
actions.set(agent, {
|
|
1651
|
-
id,
|
|
1652
|
-
action,
|
|
1653
|
-
subscription
|
|
1654
|
-
});
|
|
1655
|
-
};
|
|
1656
|
-
const refreshActions = () => {
|
|
1657
|
-
for (const [agent, { action }] of [...actions]) setAction(agent, action);
|
|
1658
|
-
};
|
|
1659
|
-
const dropAllActions = () => {
|
|
1660
|
-
for (const agent of [...actions.keys()]) dropAction(agent);
|
|
1661
|
-
};
|
|
1662
|
-
const forwardEvent = async (event, agentId) => {
|
|
1663
|
-
const fail = (message) => {
|
|
1664
|
-
const error = new _copilotkit_shared_generative_ui.GenerativeUIError("event_forward_failed", message);
|
|
1665
|
-
reportError({
|
|
1666
|
-
kind: "event",
|
|
1667
|
-
surfaceId: event.surfaceId,
|
|
1668
|
-
componentId: event.componentId,
|
|
1669
|
-
error
|
|
1670
|
-
});
|
|
1671
|
-
return {
|
|
1672
|
-
ok: false,
|
|
1673
|
-
error
|
|
1674
|
-
};
|
|
1675
|
-
};
|
|
1676
|
-
const agent = copilotkit.getAgent(agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID);
|
|
1677
|
-
if (!agent) return fail(`No agent "${agentId}" to receive "${event.name}"`);
|
|
1678
|
-
if (agent.isRunning || forwardingAgents.has(agent)) return {
|
|
1679
|
-
ok: false,
|
|
1680
|
-
error: new _copilotkit_shared_generative_ui.GenerativeUIError("agent_busy", `"${event.name}" was not sent: the agent is running`)
|
|
1681
|
-
};
|
|
1682
|
-
forwardingAgents.add(agent);
|
|
1683
|
-
try {
|
|
1684
|
-
const surface = agent.threadId ? manager.getSurface(agent.threadId, event.surfaceId) : void 0;
|
|
1685
|
-
const resolveLabel = surface ? (0, _copilotkit_core_generative_ui.surfaceLabelResolver)(surface) : void 0;
|
|
1686
|
-
agent.addMessage({
|
|
1687
|
-
id: (0, _copilotkit_shared.randomUUID)(),
|
|
1688
|
-
role: "user",
|
|
1689
|
-
content: (0, _copilotkit_core_generative_ui.buildActionMessageText)(event, resolveLabel)
|
|
1690
|
-
});
|
|
1691
|
-
setAction(agent, (0, _copilotkit_shared.toA2UIActionMessage)(event));
|
|
1692
|
-
await copilotkit.runAgent({ agent });
|
|
1693
|
-
return {
|
|
1694
|
-
ok: true,
|
|
1695
|
-
result: void 0
|
|
1696
|
-
};
|
|
1697
|
-
} catch (cause) {
|
|
1698
|
-
return fail(`Forwarding "${event.name}" failed: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
1699
|
-
} finally {
|
|
1700
|
-
forwardingAgents.delete(agent);
|
|
1701
|
-
dropAction(agent);
|
|
1702
|
-
}
|
|
1703
|
-
};
|
|
1704
|
-
return {
|
|
1705
|
-
manager,
|
|
1706
|
-
dispatcher,
|
|
1707
|
-
ui,
|
|
1708
|
-
forwardEvent,
|
|
1709
|
-
reportError,
|
|
1710
|
-
functionCalls,
|
|
1711
|
-
refreshActions,
|
|
1712
|
-
dropAllActions
|
|
1713
|
-
};
|
|
1714
|
-
}, [ui, copilotkit]);
|
|
1715
|
-
const runtime = (0, react.useMemo)(() => {
|
|
1716
|
-
if (!core) return null;
|
|
1717
|
-
const { manager, dispatcher, forwardEvent, reportError } = core;
|
|
1718
|
-
return {
|
|
1719
|
-
manager,
|
|
1720
|
-
dispatcher,
|
|
1721
|
-
ui: core.ui,
|
|
1722
|
-
forwardEvent,
|
|
1723
|
-
reportError,
|
|
1724
|
-
transport,
|
|
1725
|
-
theme,
|
|
1726
|
-
get config() {
|
|
1727
|
-
return configRef.current ?? { ui: core.ui };
|
|
1728
|
-
},
|
|
1729
|
-
get errorFallback() {
|
|
1730
|
-
return configRef.current?.errorBoundary?.fallback;
|
|
1731
|
-
}
|
|
1732
|
-
};
|
|
1733
|
-
}, [
|
|
1734
|
-
core,
|
|
1735
|
-
transport,
|
|
1736
|
-
theme
|
|
1737
|
-
]);
|
|
1738
|
-
(0, react.useEffect)(() => {
|
|
1739
|
-
if (!core) return;
|
|
1740
|
-
const watched = /* @__PURE__ */ new WeakSet();
|
|
1741
|
-
const agentSubscriptions = [];
|
|
1742
|
-
let envelopeId;
|
|
1743
|
-
const debug = (0, _copilotkit_core_generative_ui.createGenerativeUIDebugSource)(core, () => {
|
|
1744
|
-
const latest = configRef.current ?? { ui: core.ui };
|
|
1745
|
-
return {
|
|
1746
|
-
options: (0, _copilotkit_core_generative_ui.envelopeOptionsFor)(latest),
|
|
1747
|
-
agentIds: latest.agentIds
|
|
1748
|
-
};
|
|
1749
|
-
});
|
|
1750
|
-
copilotkit.ɵsetGenerativeUIDebugSource(debug.source);
|
|
1751
|
-
const removeEnvelope = () => {
|
|
1752
|
-
if (envelopeId === void 0) return;
|
|
1753
|
-
copilotkit.removeScopedProperties(envelopeId);
|
|
1754
|
-
envelopeId = void 0;
|
|
1755
|
-
};
|
|
1756
|
-
/**
|
|
1757
|
-
* Sets the shared envelope of the run. The action entries of the agents
|
|
1758
|
-
* with a user event under way (see `forwardEvent`) are set again after
|
|
1759
|
-
* it, so they stay the last entries and win for their agents.
|
|
1760
|
-
*/
|
|
1761
|
-
const setEnvelope = (agent, latest) => {
|
|
1762
|
-
removeEnvelope();
|
|
1763
|
-
const run = (0, _copilotkit_core_generative_ui.describeGenerativeUIRun)(core, agent.threadId, (0, _copilotkit_core_generative_ui.envelopeOptionsFor)(latest));
|
|
1764
|
-
envelopeId = copilotkit.addScopedProperties({
|
|
1765
|
-
properties: { [_copilotkit_shared.COPILOTKIT_FORWARDED_PROPS_KEY]: { ui: run.envelope } },
|
|
1766
|
-
agentIds: latest.agentIds
|
|
1767
|
-
});
|
|
1768
|
-
core.refreshActions();
|
|
1769
|
-
if (!latest.agentIds || latest.agentIds.includes(agent.agentId ?? "")) debug.recordRun({
|
|
1770
|
-
...run,
|
|
1771
|
-
agentId: agent.agentId,
|
|
1772
|
-
threadId: agent.threadId,
|
|
1773
|
-
startedAt: Date.now()
|
|
1774
|
-
});
|
|
1775
|
-
};
|
|
1776
|
-
/**
|
|
1777
|
-
* The tool transport reads the surface activity messages. The markdown
|
|
1778
|
-
* transport reads the ```a2ui fences of the assistant messages, and
|
|
1779
|
-
* builds the surfaces of the thread from them again on each change.
|
|
1780
|
-
* Both give their function calls to the one runner.
|
|
1781
|
-
*/
|
|
1782
|
-
const readMessages = (agent, messages, running) => {
|
|
1783
|
-
const requests = (0, _copilotkit_core_generative_ui.activityFunctionCalls)(messages);
|
|
1784
|
-
const { threadId } = agent;
|
|
1785
|
-
if (configRef.current?.transport !== "markdown") ingestMessages(core.manager, agent, messages);
|
|
1786
|
-
else if (threadId) {
|
|
1787
|
-
core.manager.setActiveThread(threadId);
|
|
1788
|
-
const calls = (0, _copilotkit_core_generative_ui.getMarkdownSurfaceSource)(core).sync(threadId, agent.agentId, messages, { running });
|
|
1789
|
-
requests.push(...(0, _copilotkit_core_generative_ui.markdownFunctionCalls)(calls));
|
|
1790
|
-
}
|
|
1791
|
-
core.functionCalls.run(agent, requests, messages, running);
|
|
1792
|
-
};
|
|
1793
|
-
const subscription = copilotkit.subscribe({ onAgentRunStarted: ({ agent }) => {
|
|
1794
|
-
core.manager.setActiveThread(agent.threadId);
|
|
1795
|
-
const latest = configRef.current;
|
|
1796
|
-
if (latest) setEnvelope(agent, latest);
|
|
1797
|
-
if (!watched.has(agent)) {
|
|
1798
|
-
watched.add(agent);
|
|
1799
|
-
agentSubscriptions.push(agent.subscribe({
|
|
1800
|
-
onMessagesChanged: ({ messages }) => readMessages(agent, messages, agent.isRunning),
|
|
1801
|
-
onRunFinalized: () => readMessages(agent, agent.messages, false),
|
|
1802
|
-
onRunFailed: () => readMessages(agent, agent.messages, false)
|
|
1803
|
-
}));
|
|
1804
|
-
}
|
|
1805
|
-
readMessages(agent, agent.messages, true);
|
|
1806
|
-
} });
|
|
1807
|
-
return () => {
|
|
1808
|
-
subscription.unsubscribe();
|
|
1809
|
-
for (const s of agentSubscriptions) s.unsubscribe();
|
|
1810
|
-
core.dropAllActions();
|
|
1811
|
-
removeEnvelope();
|
|
1812
|
-
if (copilotkit.ɵgenerativeUIDebugSource === debug.source) copilotkit.ɵsetGenerativeUIDebugSource(void 0);
|
|
1813
|
-
};
|
|
1814
|
-
}, [core, copilotkit]);
|
|
1815
|
-
useGenerativeUIMarkdownContext(copilotkit, core, {
|
|
1816
|
-
enabled: config?.transport === "markdown" && config.sendContext !== false,
|
|
1817
|
-
agentIds: config?.agentIds
|
|
1818
|
-
});
|
|
1819
|
-
return runtime;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
1474
|
//#endregion
|
|
1823
1475
|
//#region src/lib/react-core.ts
|
|
1824
1476
|
/**
|
|
@@ -2059,8 +1711,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
2059
1711
|
content: OpenGenerativeUIContentSchema,
|
|
2060
1712
|
render: OpenGenerativeUIActivityRenderer
|
|
2061
1713
|
},
|
|
2062
|
-
generativeUIActive &&
|
|
2063
|
-
generativeUIActive &&
|
|
1714
|
+
generativeUIActive && require_chat.createGenerativeUIActivityRenderer(),
|
|
1715
|
+
generativeUIActive && require_chat.createGenerativeUIFunctionCallActivityRenderer()
|
|
2064
1716
|
]
|
|
2065
1717
|
}), [
|
|
2066
1718
|
renderActivityMessagesList,
|
|
@@ -2158,7 +1810,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
2158
1810
|
onError,
|
|
2159
1811
|
learning: learningConfig
|
|
2160
1812
|
}));
|
|
2161
|
-
const generativeUIRuntime = useGenerativeUIRoot(copilotkit, generativeUI);
|
|
1813
|
+
const generativeUIRuntime = require_use_generative_ui_root.useGenerativeUIRoot(copilotkit, generativeUI);
|
|
2162
1814
|
const [a2uiCatalogController] = (0, react.useState)(() => new _copilotkit_a2ui_renderer_catalog_schema.A2UICatalogController(copilotkit, _copilotkit_a2ui_renderer.basicCatalog));
|
|
2163
1815
|
(0, react.useEffect)(() => a2uiCatalogController.subscribe(() => setCatalogToggleVersion((v) => v + 1)), [a2uiCatalogController]);
|
|
2164
1816
|
(0, react.useEffect)(() => {
|
|
@@ -2296,14 +1948,14 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
2296
1948
|
value: licenseState.context,
|
|
2297
1949
|
children: [
|
|
2298
1950
|
a2uiActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIBuiltInToolCallRenderer, {}),
|
|
2299
|
-
generativeUIActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1951
|
+
generativeUIActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.GenerativeUIToolCallRenderer, {}),
|
|
2300
1952
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.MarkdownRendererProvider, {
|
|
2301
1953
|
renderer: markdownRenderer,
|
|
2302
1954
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CopilotKitInspectorContextProvider, {
|
|
2303
1955
|
value: inspectorContextValue,
|
|
2304
1956
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_copilotkit_react_core_context.CopilotKitAgentIdContext.Provider, {
|
|
2305
1957
|
value: agentId,
|
|
2306
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1958
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.GenerativeUIRuntimeContext.Provider, {
|
|
2307
1959
|
value: generativeUIRuntime,
|
|
2308
1960
|
children
|
|
2309
1961
|
})
|
|
@@ -2326,7 +1978,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
2326
1978
|
//#region src/hooks/use-render-custom-messages.tsx
|
|
2327
1979
|
function useRenderCustomMessages() {
|
|
2328
1980
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
2329
|
-
const config =
|
|
1981
|
+
const config = require_chat.useCopilotChatConfiguration();
|
|
2330
1982
|
if (!config) return null;
|
|
2331
1983
|
const { threadId } = config;
|
|
2332
1984
|
const { agentId, renderers: customMessageRenderers } = (0, _copilotkit_core.ɵresolveCustomMessageRenderContext)(copilotkit.renderCustomMessages, config.agentId);
|
|
@@ -2358,7 +2010,7 @@ function useRenderCustomMessages() {
|
|
|
2358
2010
|
function useRenderActivityMessage() {
|
|
2359
2011
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
2360
2012
|
const agentId = (0, _copilotkit_core.ɵresolveAgentId)({
|
|
2361
|
-
chatAgentId:
|
|
2013
|
+
chatAgentId: require_chat.useCopilotChatConfiguration()?.agentId,
|
|
2362
2014
|
providerAgentId: (0, _copilotkit_react_core_context.useDefaultAgentId)()
|
|
2363
2015
|
});
|
|
2364
2016
|
const renderers = copilotkit.renderActivityMessages;
|
|
@@ -2699,7 +2351,7 @@ function useRenderTool(config, deps) {
|
|
|
2699
2351
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
2700
2352
|
const depsVersion = useDepsVersion(deps);
|
|
2701
2353
|
(0, react.useEffect)(() => {
|
|
2702
|
-
const renderer = config.name === "*" && !config.parameters ?
|
|
2354
|
+
const renderer = config.name === "*" && !config.parameters ? require_chat.defineToolCallRenderer({
|
|
2703
2355
|
name: "*",
|
|
2704
2356
|
render: (props) => config.render({
|
|
2705
2357
|
...props,
|
|
@@ -2707,7 +2359,7 @@ function useRenderTool(config, deps) {
|
|
|
2707
2359
|
}),
|
|
2708
2360
|
...config.agentId ? { agentId: config.agentId } : {},
|
|
2709
2361
|
group: config.group
|
|
2710
|
-
}) :
|
|
2362
|
+
}) : require_chat.defineToolCallRenderer({
|
|
2711
2363
|
name: config.name,
|
|
2712
2364
|
args: config.parameters,
|
|
2713
2365
|
render: (props) => {
|
|
@@ -2746,7 +2398,7 @@ function useRenderTool(config, deps) {
|
|
|
2746
2398
|
const ToolCallGroupContext = (0, react.createContext)(null);
|
|
2747
2399
|
/** The chat labels from the nearest chat configuration, or the defaults. */
|
|
2748
2400
|
function useLabels$1() {
|
|
2749
|
-
return
|
|
2401
|
+
return require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
2750
2402
|
}
|
|
2751
2403
|
/**
|
|
2752
2404
|
* Height transition between closed and its content's height. Closed content
|
|
@@ -3146,7 +2798,7 @@ function useDefaultRenderTool(config, deps) {
|
|
|
3146
2798
|
}
|
|
3147
2799
|
function DefaultToolCallRenderer({ name, toolCallId, parameters, status, result }) {
|
|
3148
2800
|
const group = (0, react.useContext)(ToolCallGroupContext);
|
|
3149
|
-
const labels =
|
|
2801
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
3150
2802
|
const [isExpanded, setIsExpanded] = (0, react.useState)(false);
|
|
3151
2803
|
const cardStatus = (0, _copilotkit_core.ɵnormalizeToolCallStatus)(status);
|
|
3152
2804
|
if (group) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallRow, {
|
|
@@ -3273,7 +2925,7 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
|
|
|
3273
2925
|
threadId,
|
|
3274
2926
|
runtimeAgentId
|
|
3275
2927
|
});
|
|
3276
|
-
const chatConfig =
|
|
2928
|
+
const chatConfig = require_chat.useCopilotChatConfiguration();
|
|
3277
2929
|
const providerAgentId = (0, _copilotkit_react_core_context.useDefaultAgentId)();
|
|
3278
2930
|
const resolvedAgentId = (0, _copilotkit_core.ɵresolveAgentId)({
|
|
3279
2931
|
agentId,
|
|
@@ -3394,7 +3046,7 @@ function useAgentContext(context) {
|
|
|
3394
3046
|
//#region src/hooks/use-suggestions.tsx
|
|
3395
3047
|
function useSuggestions({ agentId } = {}) {
|
|
3396
3048
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
3397
|
-
const config =
|
|
3049
|
+
const config = require_chat.useCopilotChatConfiguration();
|
|
3398
3050
|
const providerAgentId = (0, _copilotkit_react_core_context.useDefaultAgentId)();
|
|
3399
3051
|
const resolvedAgentId = (0, react.useMemo)(() => (0, _copilotkit_core.ɵresolveAgentId)({
|
|
3400
3052
|
agentId,
|
|
@@ -3441,7 +3093,7 @@ function useSuggestions({ agentId } = {}) {
|
|
|
3441
3093
|
*/
|
|
3442
3094
|
function useConfigureSuggestions(config, deps) {
|
|
3443
3095
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
3444
|
-
const chatConfig =
|
|
3096
|
+
const chatConfig = require_chat.useCopilotChatConfiguration();
|
|
3445
3097
|
const providerAgentId = (0, _copilotkit_react_core_context.useDefaultAgentId)();
|
|
3446
3098
|
const chatAgentId = (0, _copilotkit_core.ɵresolveAgentId)({
|
|
3447
3099
|
chatAgentId: chatConfig?.agentId,
|
|
@@ -3808,7 +3460,7 @@ function useLearnFromUserAction() {
|
|
|
3808
3460
|
* ```
|
|
3809
3461
|
*/
|
|
3810
3462
|
function useLearnFromUserActionInCurrentThread() {
|
|
3811
|
-
const config =
|
|
3463
|
+
const config = require_chat.useCopilotChatConfiguration();
|
|
3812
3464
|
const learnFromUserAction = useLearnFromUserAction();
|
|
3813
3465
|
return (0, react.useCallback)(async (input) => {
|
|
3814
3466
|
const threadId = config?.threadId;
|
|
@@ -4028,7 +3680,7 @@ function InspectorKiteIcon({ className, ...props }) {
|
|
|
4028
3680
|
});
|
|
4029
3681
|
}
|
|
4030
3682
|
function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
|
|
4031
|
-
const labels =
|
|
3683
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4032
3684
|
const { isInspectorEnabled } = useCopilotKitInspector();
|
|
4033
3685
|
const hidden = useInspectorShortcutsHidden();
|
|
4034
3686
|
const [menu] = (0, react.useState)(() => new _copilotkit_core.ɵHoverMenuController());
|
|
@@ -4316,7 +3968,7 @@ function WorkText({ messageId, children }) {
|
|
|
4316
3968
|
* assistant message subscribe to chat configuration changes.
|
|
4317
3969
|
*/
|
|
4318
3970
|
function BoundInspectorButton({ inspectorButton, messageId, openInspector, ...props }) {
|
|
4319
|
-
const chatConfiguration =
|
|
3971
|
+
const chatConfiguration = require_chat.useCopilotChatConfiguration();
|
|
4320
3972
|
return require_MarkdownSurfaces.renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, {
|
|
4321
3973
|
...props,
|
|
4322
3974
|
onClick: () => openInspector({
|
|
@@ -4335,7 +3987,7 @@ function BoundInspectorButton({ inspectorButton, messageId, openInspector, ...pr
|
|
|
4335
3987
|
* control after the thumb, and Enter or Escape inside it returns to the thumb.
|
|
4336
3988
|
*/
|
|
4337
3989
|
function FeedbackCommentPopover({ feedbackComment, comment, savedComment, rating, messageId }) {
|
|
4338
|
-
const labels =
|
|
3990
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4339
3991
|
const contentRef = (0, react.useRef)(null);
|
|
4340
3992
|
const anchor = (0, react.useMemo)(() => ({ current: comment.anchor }), [comment.anchor]);
|
|
4341
3993
|
const { focusRequest, focusField } = comment;
|
|
@@ -4380,7 +4032,7 @@ function FeedbackCommentPopover({ feedbackComment, comment, savedComment, rating
|
|
|
4380
4032
|
});
|
|
4381
4033
|
}
|
|
4382
4034
|
function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, feedbackComment: feedbackCommentSlot, toolCallsView, children, className, ...props }) {
|
|
4383
|
-
const providerRenderer =
|
|
4035
|
+
const providerRenderer = require_chat.useShallowStableRef(require_MarkdownSurfaces.useMarkdownRenderer());
|
|
4384
4036
|
const DefaultMarkdownRenderer = (0, react.useMemo)(() => resolveMarkdownRenderer(providerRenderer), [providerRenderer]);
|
|
4385
4037
|
const hasContent = (0, _copilotkit_core.ɵhasAssistantMessageText)(message.content);
|
|
4386
4038
|
const isLatestAssistantMessage = message.role === "assistant" && (isLatest ?? messages?.[messages.length - 1]?.id === message.id);
|
|
@@ -4531,7 +4183,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4531
4183
|
}
|
|
4532
4184
|
(function(_CopilotChatAssistantMessage) {
|
|
4533
4185
|
_CopilotChatAssistantMessage.MarkdownRenderer = ({ content, isStreaming, className, messageId, ...config }) => {
|
|
4534
|
-
if (
|
|
4186
|
+
if (require_chat.useGenerativeUIRuntime()?.transport === "markdown" && messageId !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.MarkdownSurfaces, {
|
|
4535
4187
|
content: content ?? "",
|
|
4536
4188
|
messageId,
|
|
4537
4189
|
isStreaming,
|
|
@@ -4574,7 +4226,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4574
4226
|
});
|
|
4575
4227
|
};
|
|
4576
4228
|
_CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
4577
|
-
const labels =
|
|
4229
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4578
4230
|
const { copied, markCopied } = useCopyFeedback();
|
|
4579
4231
|
const handleClick = async (event) => {
|
|
4580
4232
|
if (!onClick) return;
|
|
@@ -4599,7 +4251,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4599
4251
|
};
|
|
4600
4252
|
_CopilotChatAssistantMessage.InspectorButton = CopilotChatInspectorButton;
|
|
4601
4253
|
_CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
|
|
4602
|
-
const labels =
|
|
4254
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4603
4255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
4604
4256
|
"data-testid": "copilot-thumbs-up-button",
|
|
4605
4257
|
title: title || labels.assistantMessageToolbarThumbsUpLabel,
|
|
@@ -4612,7 +4264,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4612
4264
|
});
|
|
4613
4265
|
};
|
|
4614
4266
|
_CopilotChatAssistantMessage.ThumbsDownButton = ({ title, ...props }) => {
|
|
4615
|
-
const labels =
|
|
4267
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4616
4268
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
4617
4269
|
"data-testid": "copilot-thumbs-down-button",
|
|
4618
4270
|
title: title || labels.assistantMessageToolbarThumbsDownLabel,
|
|
@@ -4625,7 +4277,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4625
4277
|
});
|
|
4626
4278
|
};
|
|
4627
4279
|
_CopilotChatAssistantMessage.FeedbackComment = ({ value, savedComment, inputRef, onChange, onSubmit, onEditingChange, onLeave, className }) => {
|
|
4628
|
-
const labels =
|
|
4280
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4629
4281
|
const changed = value.trim() !== savedComment;
|
|
4630
4282
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
4631
4283
|
"data-testid": "copilot-feedback-comment",
|
|
@@ -4663,7 +4315,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4663
4315
|
});
|
|
4664
4316
|
};
|
|
4665
4317
|
_CopilotChatAssistantMessage.ReadAloudButton = ({ title, ...props }) => {
|
|
4666
|
-
const labels =
|
|
4318
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4667
4319
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
4668
4320
|
"data-testid": "copilot-read-aloud-button",
|
|
4669
4321
|
title: title || labels.assistantMessageToolbarReadAloudLabel,
|
|
@@ -4675,7 +4327,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
4675
4327
|
});
|
|
4676
4328
|
};
|
|
4677
4329
|
_CopilotChatAssistantMessage.RegenerateButton = ({ title, ...props }) => {
|
|
4678
|
-
const labels =
|
|
4330
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4679
4331
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
4680
4332
|
"data-testid": "copilot-regenerate-button",
|
|
4681
4333
|
title: title || labels.assistantMessageToolbarRegenerateLabel,
|
|
@@ -4710,7 +4362,7 @@ var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
|
|
|
4710
4362
|
* element that opened it when it closes.
|
|
4711
4363
|
*/
|
|
4712
4364
|
function Lightbox({ onClose, label, children }) {
|
|
4713
|
-
const labels =
|
|
4365
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4714
4366
|
const rootRef = (0, react.useRef)(null);
|
|
4715
4367
|
(0, react.useEffect)(() => {
|
|
4716
4368
|
const handleKey = (e) => {
|
|
@@ -4777,7 +4429,7 @@ function useLightbox() {
|
|
|
4777
4429
|
//#region src/components/chat/CopilotChatAttachmentRenderer.tsx
|
|
4778
4430
|
/** The chat labels from the nearest chat configuration, or the defaults. */
|
|
4779
4431
|
function useLabels() {
|
|
4780
|
-
return
|
|
4432
|
+
return require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4781
4433
|
}
|
|
4782
4434
|
const ImageAttachment = (0, react.memo)(function ImageAttachment({ src, className }) {
|
|
4783
4435
|
const labels = useLabels();
|
|
@@ -4969,7 +4621,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
4969
4621
|
})] });
|
|
4970
4622
|
};
|
|
4971
4623
|
_CopilotChatUserMessage.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
4972
|
-
const labels =
|
|
4624
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4973
4625
|
const { copied, markCopied } = useCopyFeedback();
|
|
4974
4626
|
const handleClick = async (event) => {
|
|
4975
4627
|
if (!onClick) return;
|
|
@@ -4993,7 +4645,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
4993
4645
|
});
|
|
4994
4646
|
};
|
|
4995
4647
|
_CopilotChatUserMessage.EditButton = ({ className, title, ...props }) => {
|
|
4996
|
-
const labels =
|
|
4648
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
4997
4649
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
4998
4650
|
"data-testid": "copilot-edit-button",
|
|
4999
4651
|
title: title || labels.userMessageToolbarEditMessageLabel,
|
|
@@ -5006,7 +4658,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
5006
4658
|
});
|
|
5007
4659
|
};
|
|
5008
4660
|
_CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
|
|
5009
|
-
const labels =
|
|
4661
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
5010
4662
|
const { show, canGoPrev, canGoNext } = (0, _copilotkit_core.ɵgetBranchNavState)({
|
|
5011
4663
|
branchIndex: currentBranch,
|
|
5012
4664
|
numberOfBranches,
|
|
@@ -5081,7 +4733,7 @@ var CopilotChatUserMessage_default = CopilotChatUserMessage;
|
|
|
5081
4733
|
* `header` slot also receives `elapsedSeconds`.
|
|
5082
4734
|
*/
|
|
5083
4735
|
function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: isLatestProp, header, contentView, toggle, children, className, ...props }) {
|
|
5084
|
-
const labels =
|
|
4736
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
5085
4737
|
const isLatest = isLatestProp ?? messages?.[messages.length - 1]?.id === message.id;
|
|
5086
4738
|
const isStreaming = !!(isRunning && isLatest);
|
|
5087
4739
|
const hasContent = !!(message.content && message.content.length > 0);
|
|
@@ -5343,7 +4995,7 @@ function useNow(active) {
|
|
|
5343
4995
|
* from the `workSummary...` and `toolCall...` chat labels.
|
|
5344
4996
|
*/
|
|
5345
4997
|
function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSince, className, ...props }) {
|
|
5346
|
-
const labels =
|
|
4998
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
5347
4999
|
const text = (0, _copilotkit_core.ɵgetWorkSummaryText)({
|
|
5348
5000
|
isWorking,
|
|
5349
5001
|
calls,
|
|
@@ -5617,7 +5269,7 @@ const isToolCallLikeMessage = (m) => {
|
|
|
5617
5269
|
function IntelligenceIndicator(props) {
|
|
5618
5270
|
const { message, agentId, label = "CopilotKit Intelligence", intelligenceIndicator } = props;
|
|
5619
5271
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
5620
|
-
const config =
|
|
5272
|
+
const config = require_chat.useCopilotChatConfiguration();
|
|
5621
5273
|
const { agent } = useAgent({
|
|
5622
5274
|
agentId,
|
|
5623
5275
|
updates: [UseAgentUpdate.OnRunStatusChanged, UseAgentUpdate.OnMessagesChanged]
|
|
@@ -5811,7 +5463,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
5811
5463
|
const renderCustomMessage = useRenderCustomMessages();
|
|
5812
5464
|
const { renderActivityMessage } = useRenderActivityMessage();
|
|
5813
5465
|
const { copilotkit, showIntelligenceIndicator = true } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
5814
|
-
const config =
|
|
5466
|
+
const config = require_chat.useCopilotChatConfiguration();
|
|
5815
5467
|
const providerAgentId = (0, _copilotkit_react_core_context.useDefaultAgentId)();
|
|
5816
5468
|
const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
|
|
5817
5469
|
(0, react.useEffect)(() => {
|
|
@@ -6442,7 +6094,7 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
|
|
|
6442
6094
|
* button named by `labels.attachmentRemoveButtonLabel`.
|
|
6443
6095
|
*/
|
|
6444
6096
|
const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className }) => {
|
|
6445
|
-
const labels =
|
|
6097
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
6446
6098
|
if (attachments.length === 0) return null;
|
|
6447
6099
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6448
6100
|
"data-testid": "copilot-attachment-queue",
|
|
@@ -6519,7 +6171,7 @@ function AudioPreview({ attachment }) {
|
|
|
6519
6171
|
* lightbox.
|
|
6520
6172
|
*/
|
|
6521
6173
|
function VideoPreview({ attachment }) {
|
|
6522
|
-
const labels =
|
|
6174
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
6523
6175
|
const src = (0, _copilotkit_shared.getSourceUrl)(attachment.source);
|
|
6524
6176
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
6525
6177
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -6582,7 +6234,7 @@ function useBlobUrl(attachment) {
|
|
|
6582
6234
|
return url;
|
|
6583
6235
|
}
|
|
6584
6236
|
function DocumentLightboxContent({ attachment, vtName }) {
|
|
6585
|
-
const labels =
|
|
6237
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
6586
6238
|
const mimeType = attachment.source.mimeType;
|
|
6587
6239
|
const blobUrl = useBlobUrl(attachment);
|
|
6588
6240
|
const preview = (0, _copilotkit_core.ɵcanPreviewDocument)(mimeType);
|
|
@@ -6639,7 +6291,7 @@ function DocumentLightboxContent({ attachment, vtName }) {
|
|
|
6639
6291
|
});
|
|
6640
6292
|
}
|
|
6641
6293
|
function DocumentPreview({ attachment }) {
|
|
6642
|
-
const labels =
|
|
6294
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
6643
6295
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
6644
6296
|
const mimeType = attachment.source.mimeType;
|
|
6645
6297
|
const previewable = (0, _copilotkit_core.ɵcanPreviewDocument)(mimeType) !== null;
|
|
@@ -6734,7 +6386,7 @@ function usePinToSend({ scrollRef, contentRef, spacerRef, topOffset = 16 }) {
|
|
|
6734
6386
|
//#region src/components/chat/CopilotChatView.tsx
|
|
6735
6387
|
const SCROLL_BUTTON_OFFSET = 16;
|
|
6736
6388
|
function DropOverlay() {
|
|
6737
|
-
const labels =
|
|
6389
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
6738
6390
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6739
6391
|
className: "cpk-chat-view-drop-overlay",
|
|
6740
6392
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -6750,7 +6402,7 @@ function DropOverlay() {
|
|
|
6750
6402
|
});
|
|
6751
6403
|
}
|
|
6752
6404
|
function CopilotChatView({ messageView, input, scrollView, suggestionView, welcomeScreen, messages = [], autoScroll = true, isRunning = false, suggestions, suggestionLoadingIndexes, onSelectSuggestion, onSubmitMessage, onStop, inputMode, inputValue, onInputChange, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, attachments, onRemoveAttachment, onAddFile, dragOver, onDragOver, onDragLeave, onDrop, isConnecting = false, connectingIndicator, hasExplicitThreadId = false, intelligenceIndicator, children, className, ...props }) {
|
|
6753
|
-
const configuredThreadId =
|
|
6405
|
+
const configuredThreadId = require_chat.useCopilotChatConfiguration()?.threadId;
|
|
6754
6406
|
const [fallbackThreadId, setFallbackThreadId] = (0, react.useState)(messages[0]?.id);
|
|
6755
6407
|
const previousMessageIds = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
6756
6408
|
(0, react.useEffect)(() => {
|
|
@@ -7186,7 +6838,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
7186
6838
|
});
|
|
7187
6839
|
};
|
|
7188
6840
|
_CopilotChatView.ScrollToBottomButton = ({ className, ...props }) => {
|
|
7189
|
-
const labels =
|
|
6841
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
7190
6842
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
7191
6843
|
"data-testid": "copilot-scroll-to-bottom",
|
|
7192
6844
|
variant: "outline",
|
|
@@ -7205,7 +6857,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
7205
6857
|
...props
|
|
7206
6858
|
});
|
|
7207
6859
|
_CopilotChatView.ConnectingIndicator = ({ className, ...props }) => {
|
|
7208
|
-
const labels =
|
|
6860
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
7209
6861
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
7210
6862
|
"data-testid": "copilot-connecting-indicator",
|
|
7211
6863
|
role: "status",
|
|
@@ -7221,7 +6873,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
7221
6873
|
});
|
|
7222
6874
|
};
|
|
7223
6875
|
_CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
|
|
7224
|
-
const labels =
|
|
6876
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
7225
6877
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
7226
6878
|
className: (0, _copilotkit_core.ɵcn)("cpk-chat-view-welcome-message", className),
|
|
7227
6879
|
...props,
|
|
@@ -7298,7 +6950,7 @@ function useInspectorThreadOverride(args) {
|
|
|
7298
6950
|
//#endregion
|
|
7299
6951
|
//#region src/components/chat/CopilotChat.tsx
|
|
7300
6952
|
function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, generativeUISurface, ...props }) {
|
|
7301
|
-
const existingConfig =
|
|
6953
|
+
const existingConfig = require_chat.useCopilotChatConfiguration();
|
|
7302
6954
|
const inspector = useCopilotKitInspector();
|
|
7303
6955
|
const inspectorContextValue = (0, react.useMemo)(() => ({
|
|
7304
6956
|
...inspector,
|
|
@@ -7635,8 +7287,8 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
7635
7287
|
setTranscribeMode("input");
|
|
7636
7288
|
}, []);
|
|
7637
7289
|
const handleFinishTranscribeWithAudio = (0, react.useCallback)((audioBlob) => submitter.transcribe(audioBlob), [submitter]);
|
|
7638
|
-
const stableMessageView =
|
|
7639
|
-
const stableSuggestionView =
|
|
7290
|
+
const stableMessageView = require_chat.useShallowStableRef(typeof providedMessageView === "string" ? { className: providedMessageView } : providedMessageView);
|
|
7291
|
+
const stableSuggestionView = require_chat.useShallowStableRef(providedSuggestionView);
|
|
7640
7292
|
const handleAddFile = (0, react.useCallback)(() => {
|
|
7641
7293
|
setTimeout(() => {
|
|
7642
7294
|
fileInputRef.current?.click();
|
|
@@ -7679,7 +7331,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
7679
7331
|
isConnecting,
|
|
7680
7332
|
hasExplicitThreadId
|
|
7681
7333
|
});
|
|
7682
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
7334
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.CopilotChatConfigurationProvider, {
|
|
7683
7335
|
agentId: resolvedAgentId,
|
|
7684
7336
|
threadId: resolvedThreadId,
|
|
7685
7337
|
hasExplicitThreadId,
|
|
@@ -7722,7 +7374,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
7722
7374
|
value: lastUserMessageState,
|
|
7723
7375
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspectorContextProvider, {
|
|
7724
7376
|
value: inspectorContextValue,
|
|
7725
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
7377
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.GenerativeUIChatSlotContext.Provider, {
|
|
7726
7378
|
value: generativeUISurface,
|
|
7727
7379
|
children: RenderedChatView
|
|
7728
7380
|
})
|
|
@@ -7758,7 +7410,7 @@ const ICON_TRANSITION_STYLE = Object.freeze({ transition: "opacity 120ms ease-ou
|
|
|
7758
7410
|
const ICON_WRAPPER_CLASS = "cpk-chat-toggle-button-icon-wrapper";
|
|
7759
7411
|
const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {
|
|
7760
7412
|
const { onClick, type, disabled, ...restProps } = buttonProps;
|
|
7761
|
-
const configuration =
|
|
7413
|
+
const configuration = require_chat.useCopilotChatConfiguration();
|
|
7762
7414
|
const labels = configuration?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
7763
7415
|
const [fallbackOpen, setFallbackOpen] = (0, react.useState)(false);
|
|
7764
7416
|
const isOpen = configuration?.isModalOpen ?? fallbackOpen;
|
|
@@ -7868,7 +7520,7 @@ function useIsMobileViewport() {
|
|
|
7868
7520
|
return isMobile;
|
|
7869
7521
|
}
|
|
7870
7522
|
function CopilotModalHeader({ title, titleContent, closeButton, drawerLauncher, children, className, ...rest }) {
|
|
7871
|
-
const configuration =
|
|
7523
|
+
const configuration = require_chat.useCopilotChatConfiguration();
|
|
7872
7524
|
const fallbackTitle = configuration?.labels.modalHeaderTitle ?? _copilotkit_core.CopilotChatDefaultLabels.modalHeaderTitle;
|
|
7873
7525
|
const resolvedTitle = title ?? fallbackTitle;
|
|
7874
7526
|
const isMobile = useIsMobileViewport();
|
|
@@ -7925,7 +7577,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
|
7925
7577
|
children
|
|
7926
7578
|
});
|
|
7927
7579
|
_CopilotModalHeader.CloseButton = ({ className, ...props }) => {
|
|
7928
|
-
const labels =
|
|
7580
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
7929
7581
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
7930
7582
|
type: "button",
|
|
7931
7583
|
"data-testid": "copilot-close-button",
|
|
@@ -7940,7 +7592,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
|
7940
7592
|
});
|
|
7941
7593
|
};
|
|
7942
7594
|
_CopilotModalHeader.DrawerLauncher = ({ className, ...props }) => {
|
|
7943
|
-
const labels =
|
|
7595
|
+
const labels = require_chat.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
7944
7596
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
7945
7597
|
type: "button",
|
|
7946
7598
|
"data-testid": "copilot-threads-drawer-launcher",
|
|
@@ -7975,9 +7627,9 @@ function CopilotSidebarView({ header, toggleButton, width, defaultOpen = true, p
|
|
|
7975
7627
|
position,
|
|
7976
7628
|
...props
|
|
7977
7629
|
});
|
|
7978
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
7630
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.CopilotChatConfigurationProvider, {
|
|
7979
7631
|
isModalDefaultOpen: open ?? defaultOpen,
|
|
7980
|
-
children: hasOpenControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
7632
|
+
children: hasOpenControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.ControlledModalOpenScope, {
|
|
7981
7633
|
open,
|
|
7982
7634
|
onOpenChange,
|
|
7983
7635
|
children: internal
|
|
@@ -7985,7 +7637,7 @@ function CopilotSidebarView({ header, toggleButton, width, defaultOpen = true, p
|
|
|
7985
7637
|
});
|
|
7986
7638
|
}
|
|
7987
7639
|
function CopilotSidebarViewInternal({ header, toggleButton, width, position = "right", ...props }) {
|
|
7988
|
-
const configuration =
|
|
7640
|
+
const configuration = require_chat.useCopilotChatConfiguration();
|
|
7989
7641
|
const isSidebarOpen = configuration?.isModalOpen ?? false;
|
|
7990
7642
|
const sidebarRef = (0, react.useRef)(null);
|
|
7991
7643
|
const [measuredWidth, setMeasuredWidth] = (0, react.useState)(width ?? _copilotkit_core.ɵSIDEBAR_DEFAULT_WIDTH);
|
|
@@ -8092,9 +7744,9 @@ function CopilotPopupView({ header, toggleButton, width, height, clickOutsideToC
|
|
|
8092
7744
|
className,
|
|
8093
7745
|
...restProps
|
|
8094
7746
|
});
|
|
8095
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
7747
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.CopilotChatConfigurationProvider, {
|
|
8096
7748
|
isModalDefaultOpen: open ?? defaultOpen,
|
|
8097
|
-
children: hasOpenControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
7749
|
+
children: hasOpenControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_chat.ControlledModalOpenScope, {
|
|
8098
7750
|
open,
|
|
8099
7751
|
onOpenChange,
|
|
8100
7752
|
children: internal
|
|
@@ -8102,7 +7754,7 @@ function CopilotPopupView({ header, toggleButton, width, height, clickOutsideToC
|
|
|
8102
7754
|
});
|
|
8103
7755
|
}
|
|
8104
7756
|
function CopilotPopupViewInternal({ header, toggleButton, width, height, clickOutsideToClose, className, ...restProps }) {
|
|
8105
|
-
const configuration =
|
|
7757
|
+
const configuration = require_chat.useCopilotChatConfiguration();
|
|
8106
7758
|
const isPopupOpen = configuration?.isModalOpen ?? false;
|
|
8107
7759
|
const setModalOpen = configuration?.setModalOpen;
|
|
8108
7760
|
const labels = configuration?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
@@ -8325,7 +7977,7 @@ CopilotPopup.displayName = "CopilotPopup";
|
|
|
8325
7977
|
* ```
|
|
8326
7978
|
*/
|
|
8327
7979
|
function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed, licenseUrl, renderRow, label, recentLabel, collapsible, onCollapseChange, limit, "data-testid": dataTestId = "copilot-threads-drawer" }) {
|
|
8328
|
-
const configuration =
|
|
7980
|
+
const configuration = require_chat.useCopilotChatConfiguration();
|
|
8329
7981
|
const { licensed, licensePending } = (0, _copilotkit_core.ɵresolveThreadsLicense)((0, _copilotkit_react_core_context.useLicenseContext)());
|
|
8330
7982
|
const providerAgentId = (0, _copilotkit_react_core_context.useDefaultAgentId)();
|
|
8331
7983
|
const resolvedAgentId = (0, _copilotkit_core.ɵresolveAgentId)({
|
|
@@ -8579,7 +8231,7 @@ CopilotThreadsDrawer.displayName = "CopilotThreadsDrawer";
|
|
|
8579
8231
|
* Catch-all (`"*"`) tool-call renderer that shows CopilotKit's default
|
|
8580
8232
|
* tool-call card for any tool without a dedicated renderer.
|
|
8581
8233
|
*/
|
|
8582
|
-
const WildcardToolCallRender =
|
|
8234
|
+
const WildcardToolCallRender = require_chat.defineToolCallRenderer({
|
|
8583
8235
|
name: "*",
|
|
8584
8236
|
group: true,
|
|
8585
8237
|
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultToolCallRenderer, { ...adaptRendererProps(props) })
|
|
@@ -8770,7 +8422,7 @@ exports.CopilotChatAssistantMessage = CopilotChatAssistantMessage_default;
|
|
|
8770
8422
|
exports.CopilotChatAttachmentQueue = CopilotChatAttachmentQueue;
|
|
8771
8423
|
exports.CopilotChatAttachmentRenderer = CopilotChatAttachmentRenderer;
|
|
8772
8424
|
exports.CopilotChatAudioRecorder = CopilotChatAudioRecorder;
|
|
8773
|
-
exports.CopilotChatConfigurationProvider =
|
|
8425
|
+
exports.CopilotChatConfigurationProvider = require_chat.CopilotChatConfigurationProvider;
|
|
8774
8426
|
Object.defineProperty(exports, 'CopilotChatDefaultLabels', {
|
|
8775
8427
|
enumerable: true,
|
|
8776
8428
|
get: function () {
|
|
@@ -9712,7 +9364,7 @@ Object.defineProperty(exports, 'defaultApplyEvents', {
|
|
|
9712
9364
|
return _ag_ui_client.defaultApplyEvents;
|
|
9713
9365
|
}
|
|
9714
9366
|
});
|
|
9715
|
-
exports.defineToolCallRenderer =
|
|
9367
|
+
exports.defineToolCallRenderer = require_chat.defineToolCallRenderer;
|
|
9716
9368
|
Object.defineProperty(exports, 'emitInspectorActiveThread', {
|
|
9717
9369
|
enumerable: true,
|
|
9718
9370
|
get: function () {
|
|
@@ -9992,7 +9644,7 @@ exports.useAttachments = useAttachments;
|
|
|
9992
9644
|
exports.useCapabilities = useCapabilities;
|
|
9993
9645
|
exports.useComponent = useComponent;
|
|
9994
9646
|
exports.useConfigureSuggestions = useConfigureSuggestions;
|
|
9995
|
-
exports.useCopilotChatConfiguration =
|
|
9647
|
+
exports.useCopilotChatConfiguration = require_chat.useCopilotChatConfiguration;
|
|
9996
9648
|
Object.defineProperty(exports, 'useCopilotKit', {
|
|
9997
9649
|
enumerable: true,
|
|
9998
9650
|
get: function () {
|