@copilotkit/react-core 2.0.0-rc.7 → 2.0.0-rc.8
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-B4Us6mwL.d.cts → MarkdownRendererContext-DAuVISwv.d.cts} +14 -30
- package/dist/MarkdownRendererContext-DAuVISwv.d.cts.map +1 -0
- package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-XWC2OXD5.d.mts} +15 -31
- package/dist/MarkdownRendererContext-XWC2OXD5.d.mts.map +1 -0
- package/dist/{MarkdownSurfaces-Bd--93O1.mjs → MarkdownSurfaces-BXaxgpm_.mjs} +91 -74
- package/dist/MarkdownSurfaces-BXaxgpm_.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-S4wfUl3J.cjs → MarkdownSurfaces-DQZM4lSI.cjs} +96 -73
- package/dist/MarkdownSurfaces-DQZM4lSI.cjs.map +1 -0
- package/dist/context.cjs +20 -17
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +38 -98
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +38 -98
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +20 -17
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +35 -15
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +9 -9
- package/dist/generative-ui.d.mts +9 -9
- package/dist/generative-ui.mjs +35 -15
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +50 -76
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +78 -253
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +56 -202
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +43 -74
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +664 -958
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -472
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +168 -472
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +443 -949
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +754 -1029
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -10
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
- package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
- package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_MarkdownSurfaces = require('./MarkdownSurfaces-
|
|
4
|
+
const require_MarkdownSurfaces = require('./MarkdownSurfaces-DQZM4lSI.cjs');
|
|
5
5
|
let _copilotkit_core = require("@copilotkit/core");
|
|
6
6
|
let _ag_ui_client = require("@ag-ui/client");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_MarkdownSurfaces.__toESM(react);
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
-
let lucide_react = require("lucide-react");
|
|
11
10
|
let _copilotkit_shared = require("@copilotkit/shared");
|
|
12
11
|
let _copilotkit_react_core_context = require("@copilotkit/react-core/context");
|
|
13
|
-
let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
14
12
|
let _radix_ui_react_tooltip = require("@radix-ui/react-tooltip");
|
|
15
13
|
_radix_ui_react_tooltip = require_MarkdownSurfaces.__toESM(_radix_ui_react_tooltip);
|
|
16
14
|
let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
17
15
|
_radix_ui_react_dropdown_menu = require_MarkdownSurfaces.__toESM(_radix_ui_react_dropdown_menu);
|
|
18
16
|
let _ag_ui_core = require("@ag-ui/core");
|
|
19
|
-
let zod = require("zod");
|
|
20
17
|
let _copilotkit_mcp_apps_renderer_activity = require("@copilotkit/mcp-apps-renderer/activity");
|
|
18
|
+
let zod = require("zod");
|
|
21
19
|
let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
|
|
22
20
|
let zod_to_json_schema = require("zod-to-json-schema");
|
|
23
21
|
let _a2ui_web_core_v0_9 = require("@a2ui/web_core/v0_9");
|
|
@@ -30,111 +28,6 @@ let use_stick_to_bottom = require("use-stick-to-bottom");
|
|
|
30
28
|
let _copilotkit_web_components_threads_drawer = require("@copilotkit/web-components/threads-drawer");
|
|
31
29
|
let _ag_ui_core_schemas = require("@ag-ui/core/schemas");
|
|
32
30
|
|
|
33
|
-
//#region src/components/chat/BasicMarkdownRenderer.tsx
|
|
34
|
-
const SAFE_HREF = /^(https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i;
|
|
35
|
-
const SAFE_IMG_SRC = /^(https?:|data:image\/(?!svg)|\/|\.\/|\.\.\/)/i;
|
|
36
|
-
function sanitizeHref(href) {
|
|
37
|
-
if (!href) return void 0;
|
|
38
|
-
return SAFE_HREF.test(href.trim()) ? href : void 0;
|
|
39
|
-
}
|
|
40
|
-
function sanitizeImgSrc(src) {
|
|
41
|
-
if (!src) return void 0;
|
|
42
|
-
return SAFE_IMG_SRC.test(src.trim()) ? src : void 0;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Dependency-light built-in markdown renderer (basic GFM). Walks the
|
|
46
|
-
* framework-agnostic token tree from `@copilotkit/core` into React elements.
|
|
47
|
-
* No syntax highlighting, no math, no table/image action buttons — plug in a
|
|
48
|
-
* custom renderer via `CopilotKitProvider markdownRenderer={...}` for those.
|
|
49
|
-
*/
|
|
50
|
-
function BasicMarkdownRenderer({ content, className }) {
|
|
51
|
-
const tokens = react.default.useMemo(() => (0, _copilotkit_core.parseMarkdown)(content ?? ""), [content]);
|
|
52
|
-
if (!tokens.length) return null;
|
|
53
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
54
|
-
className,
|
|
55
|
-
children: tokens.map((t, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockToken, { token: t }, i))
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function renderInline(tokens) {
|
|
59
|
-
if (!tokens) return null;
|
|
60
|
-
return tokens.map((token, i) => {
|
|
61
|
-
switch (token.type) {
|
|
62
|
-
case "text": return "tokens" in token && token.tokens ? renderInline(token.tokens) : token.text;
|
|
63
|
-
case "strong": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: renderInline(token.tokens) }, i);
|
|
64
|
-
case "em": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("em", { children: renderInline(token.tokens) }, i);
|
|
65
|
-
case "del": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("del", { children: renderInline(token.tokens) }, i);
|
|
66
|
-
case "codespan": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
67
|
-
className: "cpk-markdown-inline-code",
|
|
68
|
-
children: token.text
|
|
69
|
-
}, i);
|
|
70
|
-
case "br": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}, i);
|
|
71
|
-
case "link": {
|
|
72
|
-
const l = token;
|
|
73
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
74
|
-
href: sanitizeHref(l.href),
|
|
75
|
-
target: "_blank",
|
|
76
|
-
rel: "noopener noreferrer",
|
|
77
|
-
children: l.tokens ? renderInline(l.tokens) : l.text
|
|
78
|
-
}, i);
|
|
79
|
-
}
|
|
80
|
-
case "image": {
|
|
81
|
-
const img = token;
|
|
82
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
83
|
-
src: sanitizeImgSrc(img.href),
|
|
84
|
-
alt: img.text,
|
|
85
|
-
className: "cpk-markdown-image"
|
|
86
|
-
}, i);
|
|
87
|
-
}
|
|
88
|
-
case "escape": return token.text;
|
|
89
|
-
default: return "text" in token ? token.text : null;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function BlockToken({ token }) {
|
|
94
|
-
switch (token.type) {
|
|
95
|
-
case "space": return null;
|
|
96
|
-
case "heading": {
|
|
97
|
-
const h = token;
|
|
98
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(`h${Math.min(Math.max(h.depth, 1), 6)}`, { children: renderInline(h.tokens) });
|
|
99
|
-
}
|
|
100
|
-
case "paragraph": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: renderInline(token.tokens ?? []) });
|
|
101
|
-
case "blockquote": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("blockquote", { children: (token.tokens ?? []).map((t, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockToken, { token: t }, i)) });
|
|
102
|
-
case "code": {
|
|
103
|
-
const c = token;
|
|
104
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
105
|
-
className: "cpk-markdown-code-block",
|
|
106
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
107
|
-
"data-language": c.lang || void 0,
|
|
108
|
-
children: c.text
|
|
109
|
-
})
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
case "hr": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {});
|
|
113
|
-
case "list": {
|
|
114
|
-
const list = token;
|
|
115
|
-
const items = list.items.map((item, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: (item.tokens ?? []).map((t, j) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BlockToken, { token: t }, j)) }, i));
|
|
116
|
-
return list.ordered ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
117
|
-
start: typeof list.start === "number" ? list.start : void 0,
|
|
118
|
-
children: items
|
|
119
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", { children: items });
|
|
120
|
-
}
|
|
121
|
-
case "table": {
|
|
122
|
-
const tbl = token;
|
|
123
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
124
|
-
className: "cpk-markdown-table-container",
|
|
125
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: tbl.header.map((cell, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: renderInline(cell.tokens) }, i)) }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: tbl.rows.map((row, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: row.map((cell, j) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: renderInline(cell.tokens) }, j)) }, i)) })] })
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
case "text": {
|
|
129
|
-
const t = token;
|
|
130
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t.tokens ? renderInline(t.tokens) : t.text });
|
|
131
|
-
}
|
|
132
|
-
default: return "text" in token ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: token.text }) : null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
BasicMarkdownRenderer.displayName = "BasicMarkdownRenderer";
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
31
|
//#region src/components/ui/button.tsx
|
|
139
32
|
const variantClasses = {
|
|
140
33
|
default: "cpk-button-default",
|
|
@@ -162,8 +55,8 @@ const sizeClasses = {
|
|
|
162
55
|
function buttonVariants({ variant, size, className, class: classProp } = {}) {
|
|
163
56
|
return require_MarkdownSurfaces.cn("cpk-button", variant !== null && variantClasses[variant ?? "default"], size !== null && sizeClasses[size ?? "default"], classProp, className);
|
|
164
57
|
}
|
|
165
|
-
const Button = react.forwardRef(function Button({ className, variant, size,
|
|
166
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
58
|
+
const Button = react.forwardRef(function Button({ className, variant, size, ...props }, ref) {
|
|
59
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
167
60
|
ref,
|
|
168
61
|
"data-slot": "button",
|
|
169
62
|
className: buttonVariants({
|
|
@@ -268,7 +161,10 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
268
161
|
"data-inset": inset,
|
|
269
162
|
className: require_MarkdownSurfaces.cn("cpk-dropdown-menu-sub-trigger", className),
|
|
270
163
|
...props,
|
|
271
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
164
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
165
|
+
name: "ChevronRight",
|
|
166
|
+
className: "cpk-dropdown-menu-sub-trigger-icon"
|
|
167
|
+
})]
|
|
272
168
|
});
|
|
273
169
|
}
|
|
274
170
|
function DropdownMenuSubContent({ className, ...props }) {
|
|
@@ -508,7 +404,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
508
404
|
const audioRecorderRef = (0, react.useRef)(null);
|
|
509
405
|
const slashMenuRef = (0, react.useRef)(null);
|
|
510
406
|
const config = require_MarkdownSurfaces.useCopilotChatConfiguration();
|
|
511
|
-
const labels = config?.labels ??
|
|
407
|
+
const labels = config?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
512
408
|
const previousModalStateRef = (0, react.useRef)(void 0);
|
|
513
409
|
const measurementCanvasRef = (0, react.useRef)(null);
|
|
514
410
|
const measurementsRef = (0, react.useRef)({
|
|
@@ -629,6 +525,14 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
629
525
|
inputRef.current?.focus();
|
|
630
526
|
});
|
|
631
527
|
}, [clearInputValue]);
|
|
528
|
+
const composerInput = {
|
|
529
|
+
mode,
|
|
530
|
+
isRunning,
|
|
531
|
+
value: resolvedValue,
|
|
532
|
+
canSubmit: !!onSubmitMessage,
|
|
533
|
+
canStop: !!onStop
|
|
534
|
+
};
|
|
535
|
+
const { isProcessing, action: buttonAction, disabled: buttonDisabled } = (0, _copilotkit_core.ɵcomposerButtonState)(composerInput);
|
|
632
536
|
const handleKeyDown = (e) => {
|
|
633
537
|
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
634
538
|
if (commandQuery !== null && mode === "input") {
|
|
@@ -667,11 +571,15 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
667
571
|
return;
|
|
668
572
|
}
|
|
669
573
|
}
|
|
670
|
-
if (e.key === "Enter" && !e.shiftKey)
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
574
|
+
if (e.key === "Enter" && !e.shiftKey) e.preventDefault();
|
|
575
|
+
const action = (0, _copilotkit_core.ɵresolveComposerKey)({
|
|
576
|
+
key: e.key,
|
|
577
|
+
shiftKey: e.shiftKey,
|
|
578
|
+
isComposing: e.nativeEvent.isComposing,
|
|
579
|
+
keyCode: e.keyCode
|
|
580
|
+
}, composerInput);
|
|
581
|
+
if (action === "stop") onStop?.();
|
|
582
|
+
else if (action === "send") send();
|
|
675
583
|
};
|
|
676
584
|
const send = () => {
|
|
677
585
|
if (!onSubmitMessage) return;
|
|
@@ -696,9 +604,6 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
696
604
|
autoFocus,
|
|
697
605
|
className: isExpanded ? "cpk-chat-input-textarea-expanded" : "cpk-chat-input-textarea-compact"
|
|
698
606
|
});
|
|
699
|
-
const isProcessing = mode !== "transcribe" && isRunning;
|
|
700
|
-
const canSend = resolvedValue.trim().length > 0 && !!onSubmitMessage;
|
|
701
|
-
const canStop = !!onStop;
|
|
702
607
|
const handleSendButtonClick = () => {
|
|
703
608
|
if (isProcessing) {
|
|
704
609
|
onStop?.();
|
|
@@ -707,12 +612,15 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
707
612
|
send();
|
|
708
613
|
};
|
|
709
614
|
const BoundAudioRecorder = require_MarkdownSurfaces.renderSlot(audioRecorder, CopilotChatAudioRecorder, { ref: audioRecorderRef });
|
|
710
|
-
const showsStop =
|
|
615
|
+
const showsStop = buttonAction === "stop";
|
|
711
616
|
const BoundSendButton = require_MarkdownSurfaces.renderSlot(sendButton, CopilotChatInput.SendButton, {
|
|
712
617
|
onClick: handleSendButtonClick,
|
|
713
|
-
disabled:
|
|
618
|
+
disabled: buttonDisabled,
|
|
714
619
|
"aria-label": showsStop ? labels.chatInputToolbarStopButtonLabel : labels.chatInputToolbarSendButtonLabel,
|
|
715
|
-
children: showsStop ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
620
|
+
children: showsStop ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
621
|
+
name: "Square",
|
|
622
|
+
className: "cpk-chat-input-stop-icon"
|
|
623
|
+
}) : void 0
|
|
716
624
|
});
|
|
717
625
|
const BoundStartTranscribeButton = require_MarkdownSurfaces.renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, { onClick: onStartTranscribe });
|
|
718
626
|
const BoundCancelTranscribeButton = require_MarkdownSurfaces.renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, { onClick: onCancelTranscribe });
|
|
@@ -969,7 +877,10 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
969
877
|
className: "cpk-chat-input-field",
|
|
970
878
|
children: mode === "transcribe" ? BoundAudioRecorder : mode === "processing" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
971
879
|
className: "cpk-chat-input-processing",
|
|
972
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
880
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
881
|
+
name: "Loader2",
|
|
882
|
+
className: "cpk-chat-input-processing-spinner"
|
|
883
|
+
})
|
|
973
884
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [BoundTextArea, slashMenu] })
|
|
974
885
|
}),
|
|
975
886
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -1029,7 +940,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1029
940
|
}
|
|
1030
941
|
(function(_CopilotChatInput) {
|
|
1031
942
|
_CopilotChatInput.SendButton = ({ className, children, ...props }) => {
|
|
1032
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
943
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
1033
944
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1034
945
|
className: "cpk-chat-input-send",
|
|
1035
946
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -1040,12 +951,15 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1040
951
|
className: require_MarkdownSurfaces.cn("cpk-chat-input-send-button", className),
|
|
1041
952
|
"aria-label": labels.chatInputToolbarSendButtonLabel,
|
|
1042
953
|
...props,
|
|
1043
|
-
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
954
|
+
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
955
|
+
name: "ArrowUp",
|
|
956
|
+
className: "cpk-chat-input-send-icon"
|
|
957
|
+
})
|
|
1044
958
|
})
|
|
1045
959
|
});
|
|
1046
960
|
};
|
|
1047
961
|
const ToolbarButton = _CopilotChatInput.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
|
|
1048
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
962
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
1049
963
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
|
|
1050
964
|
asChild: true,
|
|
1051
965
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -1064,27 +978,36 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1064
978
|
};
|
|
1065
979
|
_CopilotChatInput.StartTranscribeButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
1066
980
|
"data-testid": "copilot-start-transcribe-button",
|
|
1067
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
981
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
982
|
+
name: "Mic",
|
|
983
|
+
className: "cpk-chat-input-toolbar-icon"
|
|
984
|
+
}),
|
|
1068
985
|
labelKey: "chatInputToolbarStartTranscribeButtonLabel",
|
|
1069
986
|
defaultClassName: "cpk-chat-input-start-transcribe-button",
|
|
1070
987
|
...props
|
|
1071
988
|
});
|
|
1072
989
|
_CopilotChatInput.CancelTranscribeButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
1073
990
|
"data-testid": "copilot-cancel-transcribe-button",
|
|
1074
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
991
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
992
|
+
name: "X",
|
|
993
|
+
className: "cpk-chat-input-toolbar-icon"
|
|
994
|
+
}),
|
|
1075
995
|
labelKey: "chatInputToolbarCancelTranscribeButtonLabel",
|
|
1076
996
|
defaultClassName: "cpk-chat-input-cancel-transcribe-button",
|
|
1077
997
|
...props
|
|
1078
998
|
});
|
|
1079
999
|
_CopilotChatInput.FinishTranscribeButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
1080
1000
|
"data-testid": "copilot-finish-transcribe-button",
|
|
1081
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1001
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
1002
|
+
name: "Check",
|
|
1003
|
+
className: "cpk-chat-input-toolbar-icon"
|
|
1004
|
+
}),
|
|
1082
1005
|
labelKey: "chatInputToolbarFinishTranscribeButtonLabel",
|
|
1083
1006
|
defaultClassName: "cpk-chat-input-finish-transcribe-button",
|
|
1084
1007
|
...props
|
|
1085
1008
|
});
|
|
1086
1009
|
_CopilotChatInput.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
|
|
1087
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
1010
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
1088
1011
|
const [mounted, setMounted] = (0, react.useState)(false);
|
|
1089
1012
|
(0, react.useEffect)(() => setMounted(true), []);
|
|
1090
1013
|
const menuItems = (0, react.useMemo)(() => {
|
|
@@ -1126,7 +1049,10 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1126
1049
|
disabled: isDisabled,
|
|
1127
1050
|
"aria-label": labels.chatInputToolbarAddButtonLabel,
|
|
1128
1051
|
...props,
|
|
1129
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1052
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
1053
|
+
name: "Plus",
|
|
1054
|
+
className: "cpk-chat-input-add-menu-icon"
|
|
1055
|
+
})
|
|
1130
1056
|
});
|
|
1131
1057
|
if (!mounted) return button;
|
|
1132
1058
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenu, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
|
|
@@ -1152,7 +1078,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1152
1078
|
};
|
|
1153
1079
|
_CopilotChatInput.TextArea = (0, react.forwardRef)(function TextArea({ style, className, autoFocus, placeholder, ...props }, ref) {
|
|
1154
1080
|
const internalTextareaRef = (0, react.useRef)(null);
|
|
1155
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
1081
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
1156
1082
|
(0, react.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
1157
1083
|
(0, react.useEffect)(() => {
|
|
1158
1084
|
if (autoFocus) internalTextareaRef.current?.focus({ preventScroll: true });
|
|
@@ -1173,7 +1099,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
|
|
|
1173
1099
|
});
|
|
1174
1100
|
_CopilotChatInput.AudioRecorder = CopilotChatAudioRecorder;
|
|
1175
1101
|
_CopilotChatInput.Disclaimer = ({ className, ...props }) => {
|
|
1176
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
1102
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
1177
1103
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1178
1104
|
className: require_MarkdownSurfaces.cn("cpk-chat-input-disclaimer", className),
|
|
1179
1105
|
...props,
|
|
@@ -1269,16 +1195,7 @@ function useToolCallRenderers() {
|
|
|
1269
1195
|
*/
|
|
1270
1196
|
function useToolCallRendererNames() {
|
|
1271
1197
|
const renderers = useToolCallRenderers();
|
|
1272
|
-
return (0, react.useMemo)(() =>
|
|
1273
|
-
const named = renderers.filter((rc) => rc.name !== "*");
|
|
1274
|
-
const wildcards = renderers.filter((rc) => rc.name === "*");
|
|
1275
|
-
return {
|
|
1276
|
-
named: new Set(named.map((rc) => rc.name)),
|
|
1277
|
-
groupedNames: new Set(named.filter((rc) => rc.group).map((rc) => rc.name)),
|
|
1278
|
-
wildcard: wildcards.length > 0,
|
|
1279
|
-
wildcardGroups: wildcards.some((rc) => rc.group)
|
|
1280
|
-
};
|
|
1281
|
-
}, [renderers]);
|
|
1198
|
+
return (0, react.useMemo)(() => (0, _copilotkit_core.ɵgetToolCallRendererNames)(renderers), [renderers]);
|
|
1282
1199
|
}
|
|
1283
1200
|
/**
|
|
1284
1201
|
* Hook that returns a function to render tool calls based on the render functions
|
|
@@ -1293,18 +1210,17 @@ function useRenderToolCall() {
|
|
|
1293
1210
|
const warnedToolNames = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
1294
1211
|
const renderToolCalls = useToolCallRenderers();
|
|
1295
1212
|
const renderToolCall = (0, react.useCallback)(({ toolCall, toolMessage }) => {
|
|
1296
|
-
const
|
|
1297
|
-
const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
|
|
1213
|
+
const renderConfig = (0, _copilotkit_core.ɵresolveToolCallRenderer)(renderToolCalls, toolCall.function.name, agentId);
|
|
1298
1214
|
if (!renderConfig) {
|
|
1299
1215
|
if (IS_DEVELOPMENT$1) unrenderedToolNames.current.add(toolCall.function.name);
|
|
1300
1216
|
return null;
|
|
1301
1217
|
}
|
|
1302
|
-
const
|
|
1218
|
+
const isExecuting = executingToolCallIds.has(toolCall.id);
|
|
1303
1219
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallRenderer, {
|
|
1304
1220
|
toolCall,
|
|
1305
1221
|
toolMessage,
|
|
1306
|
-
RenderComponent,
|
|
1307
|
-
isExecuting
|
|
1222
|
+
RenderComponent: renderConfig.render,
|
|
1223
|
+
isExecuting
|
|
1308
1224
|
}, toolCall.id);
|
|
1309
1225
|
}, [
|
|
1310
1226
|
renderToolCalls,
|
|
@@ -1326,7 +1242,7 @@ function useRenderToolCall() {
|
|
|
1326
1242
|
|
|
1327
1243
|
//#endregion
|
|
1328
1244
|
//#region package.json
|
|
1329
|
-
var version$1 = "2.0.0-rc.
|
|
1245
|
+
var version$1 = "2.0.0-rc.8";
|
|
1330
1246
|
|
|
1331
1247
|
//#endregion
|
|
1332
1248
|
//#region src/components/CopilotKitInspector.tsx
|
|
@@ -1397,6 +1313,15 @@ function useCopilotKitInspector() {
|
|
|
1397
1313
|
|
|
1398
1314
|
//#endregion
|
|
1399
1315
|
//#region src/components/license-warning-banner.tsx
|
|
1316
|
+
const labels = _copilotkit_core.CopilotChatDefaultLabels;
|
|
1317
|
+
/**
|
|
1318
|
+
* The "expires soon" banner text. Without a day count it says "soon", never
|
|
1319
|
+
* "in undefined days".
|
|
1320
|
+
*/
|
|
1321
|
+
function expiringMessage(graceRemaining) {
|
|
1322
|
+
if (graceRemaining === void 0) return labels.licenseExpiringText;
|
|
1323
|
+
return (0, _copilotkit_core.ɵformatLabel)(graceRemaining === 1 ? labels.licenseExpiringInDaysOne : labels.licenseExpiringInDaysOther, { days: graceRemaining });
|
|
1324
|
+
}
|
|
1400
1325
|
const LICENSE_BANNER_OFFSET_PX = 52;
|
|
1401
1326
|
const LICENSE_BANNER_OFFSET_VAR = "--copilotkit-license-banner-offset";
|
|
1402
1327
|
const BANNER_STYLES = {
|
|
@@ -1487,36 +1412,36 @@ function LicenseWarningBanner({ type, featureName, expiryDate, graceRemaining, o
|
|
|
1487
1412
|
switch (type) {
|
|
1488
1413
|
case "no_license": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
1489
1414
|
severity: "info",
|
|
1490
|
-
message:
|
|
1491
|
-
actionLabel:
|
|
1415
|
+
message: labels.licensePoweredByText,
|
|
1416
|
+
actionLabel: labels.licenseGetLicenseLabel,
|
|
1492
1417
|
actionUrl: "https://copilotkit.ai/pricing",
|
|
1493
1418
|
onDismiss
|
|
1494
1419
|
});
|
|
1495
1420
|
case "feature_unlicensed": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
1496
1421
|
severity: "warning",
|
|
1497
|
-
message:
|
|
1498
|
-
actionLabel:
|
|
1422
|
+
message: (0, _copilotkit_core.ɵformatLabel)(labels.licenseFeatureUnlicensedText, { feature: featureName ?? "" }),
|
|
1423
|
+
actionLabel: labels.licenseGetLicenseLabel,
|
|
1499
1424
|
actionUrl: "https://copilotkit.ai/pricing",
|
|
1500
1425
|
onDismiss
|
|
1501
1426
|
});
|
|
1502
1427
|
case "expiring": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
1503
1428
|
severity: "warning",
|
|
1504
|
-
message:
|
|
1505
|
-
actionLabel:
|
|
1429
|
+
message: expiringMessage(graceRemaining),
|
|
1430
|
+
actionLabel: labels.licenseRenewLabel,
|
|
1506
1431
|
actionUrl: "https://dashboard.operations.copilotkit.ai",
|
|
1507
1432
|
onDismiss
|
|
1508
1433
|
});
|
|
1509
1434
|
case "expired": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
1510
1435
|
severity: "critical",
|
|
1511
|
-
message:
|
|
1512
|
-
actionLabel:
|
|
1436
|
+
message: expiryDate ? (0, _copilotkit_core.ɵformatLabel)(labels.licenseExpiredOnDateText, { date: expiryDate }) : labels.licenseExpiredText,
|
|
1437
|
+
actionLabel: labels.licenseRenewNowLabel,
|
|
1513
1438
|
actionUrl: "https://copilotkit.ai/pricing",
|
|
1514
1439
|
onDismiss
|
|
1515
1440
|
});
|
|
1516
1441
|
case "invalid": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerShell, {
|
|
1517
1442
|
severity: "critical",
|
|
1518
|
-
message:
|
|
1519
|
-
actionLabel:
|
|
1443
|
+
message: labels.licenseInvalidText,
|
|
1444
|
+
actionLabel: labels.licenseGetLicenseLabel,
|
|
1520
1445
|
actionUrl: "https://copilotkit.ai/pricing",
|
|
1521
1446
|
onDismiss
|
|
1522
1447
|
});
|
|
@@ -1535,9 +1460,7 @@ function InlineFeatureWarning({ featureName }) {
|
|
|
1535
1460
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif"
|
|
1536
1461
|
},
|
|
1537
1462
|
children: [
|
|
1538
|
-
|
|
1539
|
-
featureName,
|
|
1540
|
-
"\" feature requires a CopilotKit license.",
|
|
1463
|
+
(0, _copilotkit_core.ɵformatLabel)(labels.licenseFeatureUnlicensedText, { feature: featureName }),
|
|
1541
1464
|
" ",
|
|
1542
1465
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
1543
1466
|
href: "https://copilotkit.ai/pricing",
|
|
@@ -4768,9 +4691,28 @@ function useGenerativeUIRoot(copilotkit, config) {
|
|
|
4768
4691
|
|
|
4769
4692
|
//#endregion
|
|
4770
4693
|
//#region src/lib/react-core.ts
|
|
4694
|
+
/**
|
|
4695
|
+
* Wait for pending React state updates before the follow-up agent run.
|
|
4696
|
+
*
|
|
4697
|
+
* When a frontend tool handler calls setState(), React 18 batches the update
|
|
4698
|
+
* and schedules a commit via its internal scheduler (MessageChannel). The
|
|
4699
|
+
* useAgentContext hook registers context via useLayoutEffect, which runs
|
|
4700
|
+
* synchronously after React commits that batch.
|
|
4701
|
+
*
|
|
4702
|
+
* Awaiting a zero-delay timeout yields to the macrotask queue. React's
|
|
4703
|
+
* MessageChannel task runs first, committing the pending state and running
|
|
4704
|
+
* useLayoutEffect (which updates the context store). The follow-up runAgent
|
|
4705
|
+
* call then reads fresh context.
|
|
4706
|
+
*/
|
|
4707
|
+
function waitForReactCommit() {
|
|
4708
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
4709
|
+
}
|
|
4771
4710
|
var CopilotKitCoreReact = class extends _copilotkit_core.CopilotKitCore {
|
|
4772
4711
|
constructor(config) {
|
|
4773
|
-
super(
|
|
4712
|
+
super({
|
|
4713
|
+
...config,
|
|
4714
|
+
ɵwaitForFrameworkUpdates: waitForReactCommit
|
|
4715
|
+
});
|
|
4774
4716
|
this._renderToolCalls = [];
|
|
4775
4717
|
this._hookRenderToolCalls = /* @__PURE__ */ new Map();
|
|
4776
4718
|
this._cachedMergedRenderToolCalls = null;
|
|
@@ -4844,22 +4786,6 @@ var CopilotKitCoreReact = class extends _copilotkit_core.CopilotKitCore {
|
|
|
4844
4786
|
subscribe(subscriber) {
|
|
4845
4787
|
return super.subscribe(subscriber);
|
|
4846
4788
|
}
|
|
4847
|
-
/**
|
|
4848
|
-
* Wait for pending React state updates before the follow-up agent run.
|
|
4849
|
-
*
|
|
4850
|
-
* When a frontend tool handler calls setState(), React 18 batches the update
|
|
4851
|
-
* and schedules a commit via its internal scheduler (MessageChannel). The
|
|
4852
|
-
* useAgentContext hook registers context via useLayoutEffect, which runs
|
|
4853
|
-
* synchronously after React commits that batch.
|
|
4854
|
-
*
|
|
4855
|
-
* Awaiting a zero-delay timeout yields to the macrotask queue. React's
|
|
4856
|
-
* MessageChannel task runs first, committing the pending state and running
|
|
4857
|
-
* useLayoutEffect (which updates the context store). The follow-up runAgent
|
|
4858
|
-
* call then reads fresh context.
|
|
4859
|
-
*/
|
|
4860
|
-
async waitForPendingFrameworkUpdates() {
|
|
4861
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
4862
|
-
}
|
|
4863
4789
|
};
|
|
4864
4790
|
|
|
4865
4791
|
//#endregion
|
|
@@ -5157,7 +5083,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
5157
5083
|
const combined = [...renderToolCallsList];
|
|
5158
5084
|
[...frontendToolsList, ...builtInFrontendTools].forEach((tool) => {
|
|
5159
5085
|
if (tool.render) {
|
|
5160
|
-
const args = tool.parameters || (tool.name === "*" ?
|
|
5086
|
+
const args = tool.parameters || (tool.name === "*" ? _copilotkit_shared.ɵanySchema : void 0);
|
|
5161
5087
|
if (args) combined.push({
|
|
5162
5088
|
name: tool.name,
|
|
5163
5089
|
args,
|
|
@@ -5404,26 +5330,17 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
5404
5330
|
executingToolCallIds,
|
|
5405
5331
|
showIntelligenceIndicator
|
|
5406
5332
|
]);
|
|
5407
|
-
const
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
if (!terminalRuntimeEntitlementFailure) return runtimeLicenseContext;
|
|
5415
|
-
return {
|
|
5416
|
-
...runtimeLicenseContext,
|
|
5417
|
-
checkFeature: () => false,
|
|
5418
|
-
getLimit: () => null
|
|
5419
|
-
};
|
|
5420
|
-
}, [
|
|
5421
|
-
terminalRuntimeEntitlementFailure,
|
|
5422
|
-
runtimeEntitlementRetryInProgress,
|
|
5333
|
+
const licenseState = (0, react.useMemo)(() => (0, _copilotkit_core.ɵresolveLicenseState)({
|
|
5334
|
+
status: runtimeLicenseStatus,
|
|
5335
|
+
entitlements: runtimeEntitlements,
|
|
5336
|
+
retryPending: runtimeEntitlementRetryPending,
|
|
5337
|
+
publicKey: resolvedPublicKey
|
|
5338
|
+
}), [
|
|
5339
|
+
runtimeLicenseStatus,
|
|
5423
5340
|
runtimeEntitlements,
|
|
5424
|
-
|
|
5341
|
+
runtimeEntitlementRetryPending,
|
|
5342
|
+
resolvedPublicKey
|
|
5425
5343
|
]);
|
|
5426
|
-
const runtimeLicenseWarningStatus = runtimeEntitlementRetryInProgress ? void 0 : licenseContextValue.status ?? void 0;
|
|
5427
5344
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotStyleOptionsProvider, {
|
|
5428
5345
|
value: (0, react.useMemo)(() => ({
|
|
5429
5346
|
nonce,
|
|
@@ -5434,7 +5351,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
5434
5351
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_copilotkit_react_core_context.CopilotKitContext.Provider, {
|
|
5435
5352
|
value: contextValue,
|
|
5436
5353
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_copilotkit_react_core_context.LicenseContext.Provider, {
|
|
5437
|
-
value:
|
|
5354
|
+
value: licenseState.context,
|
|
5438
5355
|
children: [
|
|
5439
5356
|
a2uiActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(A2UIBuiltInToolCallRenderer, {}),
|
|
5440
5357
|
generativeUIActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.GenerativeUIToolCallRenderer, {}),
|
|
@@ -5459,10 +5376,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
|
|
|
5459
5376
|
}) : null]
|
|
5460
5377
|
})
|
|
5461
5378
|
}),
|
|
5462
|
-
|
|
5463
|
-
runtimeLicenseWarningStatus === "expired" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "expired" }),
|
|
5464
|
-
runtimeLicenseWarningStatus === "invalid" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "invalid" }),
|
|
5465
|
-
runtimeLicenseWarningStatus === "expiring" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "expiring" })
|
|
5379
|
+
licenseState.bannerType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: licenseState.bannerType })
|
|
5466
5380
|
]
|
|
5467
5381
|
})
|
|
5468
5382
|
})
|
|
@@ -5477,11 +5391,7 @@ function useRenderCustomMessages() {
|
|
|
5477
5391
|
const config = require_MarkdownSurfaces.useCopilotChatConfiguration();
|
|
5478
5392
|
if (!config) return null;
|
|
5479
5393
|
const { agentId, threadId } = config;
|
|
5480
|
-
const customMessageRenderers =
|
|
5481
|
-
const aHasAgent = a.agentId !== void 0;
|
|
5482
|
-
if (aHasAgent === (b.agentId !== void 0)) return 0;
|
|
5483
|
-
return aHasAgent ? -1 : 1;
|
|
5484
|
-
});
|
|
5394
|
+
const customMessageRenderers = (0, _copilotkit_core.ɵresolveCustomMessageRenderers)(copilotkit.renderCustomMessages, agentId);
|
|
5485
5395
|
if (!customMessageRenderers.length) return null;
|
|
5486
5396
|
return function(params) {
|
|
5487
5397
|
const { message, position } = params;
|
|
@@ -5517,6 +5427,18 @@ function useRenderCustomMessages() {
|
|
|
5517
5427
|
|
|
5518
5428
|
//#endregion
|
|
5519
5429
|
//#region src/hooks/use-render-activity-message.tsx
|
|
5430
|
+
/**
|
|
5431
|
+
* Explain why an activity message that has a renderer drew nothing: its
|
|
5432
|
+
* content validates asynchronously, or it fails the renderer's schema.
|
|
5433
|
+
*/
|
|
5434
|
+
function warnAboutRejectedContent(renderer, message) {
|
|
5435
|
+
const result = renderer.content["~standard"].validate(message.content);
|
|
5436
|
+
if (result instanceof Promise) {
|
|
5437
|
+
console.warn(`Async content validation is not supported for activity message '${message.activityType}'`);
|
|
5438
|
+
return;
|
|
5439
|
+
}
|
|
5440
|
+
if (result.issues) console.warn(`Failed to parse content for activity message '${message.activityType}':`, result.issues);
|
|
5441
|
+
}
|
|
5520
5442
|
function useRenderActivityMessage() {
|
|
5521
5443
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
5522
5444
|
const agentId = require_MarkdownSurfaces.useCopilotChatConfiguration()?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
|
|
@@ -5527,29 +5449,29 @@ function useRenderActivityMessage() {
|
|
|
5527
5449
|
return matches.find((candidate) => candidate.agentId === agentId) ?? matches.find((candidate) => candidate.agentId === void 0) ?? renderers.find((candidate) => candidate.activityType === "*") ?? null;
|
|
5528
5450
|
}, [agentId, renderers]);
|
|
5529
5451
|
const renderActivityMessage = (0, react.useCallback)((message) => {
|
|
5530
|
-
const
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
console.warn(`Failed to parse content for activity message '${message.activityType}':`, parseResult.issues);
|
|
5452
|
+
const match = (0, _copilotkit_core.ɵresolveActivityRenderer)(renderers, {
|
|
5453
|
+
activityType: message.activityType,
|
|
5454
|
+
agentId,
|
|
5455
|
+
content: message.content
|
|
5456
|
+
});
|
|
5457
|
+
if (!match) {
|
|
5458
|
+
const renderer = findRenderer(message.activityType);
|
|
5459
|
+
if (renderer) warnAboutRejectedContent(renderer, message);
|
|
5539
5460
|
return null;
|
|
5540
5461
|
}
|
|
5541
|
-
const Component = renderer.render;
|
|
5462
|
+
const Component = match.renderer.render;
|
|
5542
5463
|
const agent = copilotkit.getAgent(agentId);
|
|
5543
5464
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
5544
5465
|
activityType: message.activityType,
|
|
5545
|
-
content:
|
|
5466
|
+
content: match.content,
|
|
5546
5467
|
message,
|
|
5547
5468
|
agent
|
|
5548
5469
|
}, message.id);
|
|
5549
5470
|
}, [
|
|
5550
5471
|
agentId,
|
|
5551
5472
|
copilotkit,
|
|
5552
|
-
findRenderer
|
|
5473
|
+
findRenderer,
|
|
5474
|
+
renderers
|
|
5553
5475
|
]);
|
|
5554
5476
|
return (0, react.useMemo)(() => ({
|
|
5555
5477
|
renderActivityMessage,
|
|
@@ -5634,6 +5556,30 @@ function useDepsVersion(deps) {
|
|
|
5634
5556
|
|
|
5635
5557
|
//#endregion
|
|
5636
5558
|
//#region src/hooks/use-frontend-tool.tsx
|
|
5559
|
+
/**
|
|
5560
|
+
* Register a frontend tool while the component is mounted. The agent can
|
|
5561
|
+
* call it, and its `render` component draws the call in the chat.
|
|
5562
|
+
*
|
|
5563
|
+
* A tool with the same name and agentId as a tool that is already registered
|
|
5564
|
+
* (for example one from the provider's `tools`) overrides it while this
|
|
5565
|
+
* component is mounted. When the component unmounts, the overridden tool is
|
|
5566
|
+
* active again. The renderer stays registered after unmount, so past tool
|
|
5567
|
+
* calls still render in the chat history.
|
|
5568
|
+
*
|
|
5569
|
+
* @param tool - The tool to register.
|
|
5570
|
+
* @param deps - Extra values that re-register the tool when they change. Use
|
|
5571
|
+
* it when the handler closes over a value that is not part of the tool.
|
|
5572
|
+
*
|
|
5573
|
+
* @example
|
|
5574
|
+
* ```tsx
|
|
5575
|
+
* useFrontendTool({
|
|
5576
|
+
* name: "showWeather",
|
|
5577
|
+
* description: "Show the weather for a city",
|
|
5578
|
+
* parameters: z.object({ city: z.string() }),
|
|
5579
|
+
* handler: async ({ city }) => `Sunny in ${city}`,
|
|
5580
|
+
* });
|
|
5581
|
+
* ```
|
|
5582
|
+
*/
|
|
5637
5583
|
function useFrontendTool(tool, deps) {
|
|
5638
5584
|
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
5639
5585
|
const depsVersion = useDepsVersion(deps);
|
|
@@ -5642,11 +5588,8 @@ function useFrontendTool(tool, deps) {
|
|
|
5642
5588
|
if (copilotkit.getTool({
|
|
5643
5589
|
toolName: name,
|
|
5644
5590
|
agentId: tool.agentId
|
|
5645
|
-
})) {
|
|
5646
|
-
|
|
5647
|
-
copilotkit.removeTool(name, tool.agentId);
|
|
5648
|
-
}
|
|
5649
|
-
copilotkit.addTool(tool);
|
|
5591
|
+
})) console.warn(`Tool '${name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
|
|
5592
|
+
const unregister = copilotkit.addTool(tool);
|
|
5650
5593
|
if (tool.render) copilotkit.addHookRenderToolCall({
|
|
5651
5594
|
name,
|
|
5652
5595
|
args: tool.parameters,
|
|
@@ -5654,7 +5597,7 @@ function useFrontendTool(tool, deps) {
|
|
|
5654
5597
|
render: tool.render
|
|
5655
5598
|
});
|
|
5656
5599
|
return () => {
|
|
5657
|
-
|
|
5600
|
+
unregister();
|
|
5658
5601
|
};
|
|
5659
5602
|
}, [
|
|
5660
5603
|
tool.name,
|
|
@@ -5679,8 +5622,10 @@ const EMPTY_TOOLS = [];
|
|
|
5679
5622
|
*
|
|
5680
5623
|
* Tools are keyed by `name` plus `agentId`, the same as `useFrontendTool`. A
|
|
5681
5624
|
* tool that disappears from the array is unregistered on the next render, and
|
|
5682
|
-
* every tool is unregistered on unmount.
|
|
5683
|
-
*
|
|
5625
|
+
* every tool is unregistered on unmount. A listed tool hides a tool with the
|
|
5626
|
+
* same name and agentId (for example one from the provider's `tools`) until it
|
|
5627
|
+
* is unregistered, and then the hidden tool is active again. Renderers stay
|
|
5628
|
+
* registered after unmount so past tool calls still render in the chat history.
|
|
5684
5629
|
*
|
|
5685
5630
|
* @param tools - The tools to register. May be empty and may change length.
|
|
5686
5631
|
* @param deps - Extra dependencies that force re-registration, compared by
|
|
@@ -5730,15 +5675,13 @@ function useFrontendTools(tools, deps) {
|
|
|
5730
5675
|
deduped.set(key, tool);
|
|
5731
5676
|
}
|
|
5732
5677
|
const registered = [...deduped.values()];
|
|
5678
|
+
const unregisters = [];
|
|
5733
5679
|
for (const tool of registered) {
|
|
5734
5680
|
if (copilotkit.getTool({
|
|
5735
5681
|
toolName: tool.name,
|
|
5736
5682
|
agentId: tool.agentId
|
|
5737
|
-
})) {
|
|
5738
|
-
|
|
5739
|
-
copilotkit.removeTool(tool.name, tool.agentId);
|
|
5740
|
-
}
|
|
5741
|
-
copilotkit.addTool(tool);
|
|
5683
|
+
})) console.warn(`Tool '${tool.name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
|
|
5684
|
+
unregisters.push(copilotkit.addTool(tool));
|
|
5742
5685
|
if (tool.render) copilotkit.addHookRenderToolCall({
|
|
5743
5686
|
name: tool.name,
|
|
5744
5687
|
args: tool.parameters,
|
|
@@ -5747,7 +5690,7 @@ function useFrontendTools(tools, deps) {
|
|
|
5747
5690
|
});
|
|
5748
5691
|
}
|
|
5749
5692
|
return () => {
|
|
5750
|
-
for (const
|
|
5693
|
+
for (const unregister of unregisters) unregister();
|
|
5751
5694
|
};
|
|
5752
5695
|
}, [
|
|
5753
5696
|
JSON.stringify(toolList.map((tool) => [
|
|
@@ -5922,34 +5865,24 @@ function useRenderTool(config, deps) {
|
|
|
5922
5865
|
* @internal
|
|
5923
5866
|
*/
|
|
5924
5867
|
const ToolCallGroupContext = (0, react.createContext)(null);
|
|
5925
|
-
/**
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
const statusLabels = {
|
|
5932
|
-
running: "Running",
|
|
5933
|
-
done: "Done",
|
|
5934
|
-
failed: "Failed",
|
|
5935
|
-
stopped: "Stopped"
|
|
5868
|
+
/** The label key for each call status. */
|
|
5869
|
+
const STATUS_LABEL_KEYS = {
|
|
5870
|
+
running: "toolCallStatusRunningLabel",
|
|
5871
|
+
done: "toolCallStatusDoneLabel",
|
|
5872
|
+
failed: "toolCallStatusFailedLabel",
|
|
5873
|
+
stopped: "toolCallStatusStoppedLabel"
|
|
5936
5874
|
};
|
|
5937
|
-
/** The
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
const name = toolCall.function.name;
|
|
5948
|
-
counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
5949
|
-
}
|
|
5950
|
-
return [...counts].map(([name, count]) => count > 1 ? `${name} ×${count}` : name).join(", ");
|
|
5875
|
+
/** The icon for each call status. */
|
|
5876
|
+
const STATUS_ICONS = {
|
|
5877
|
+
running: "Loader2",
|
|
5878
|
+
done: "Check",
|
|
5879
|
+
failed: "X",
|
|
5880
|
+
stopped: "Circle"
|
|
5881
|
+
};
|
|
5882
|
+
/** The chat labels from the nearest chat configuration, or the defaults. */
|
|
5883
|
+
function useLabels$1() {
|
|
5884
|
+
return require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
5951
5885
|
}
|
|
5952
|
-
const pluralize = (count, noun) => `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
5953
5886
|
/**
|
|
5954
5887
|
* Height transition between closed and its content's height. Closed content
|
|
5955
5888
|
* stays mounted (so its state survives) but is inert.
|
|
@@ -5972,55 +5905,35 @@ function Collapsible({ open, id, className, children }) {
|
|
|
5972
5905
|
});
|
|
5973
5906
|
}
|
|
5974
5907
|
function StatusIcon({ status, className }) {
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
done: lucide_react.Check,
|
|
5978
|
-
failed: lucide_react.X,
|
|
5979
|
-
stopped: lucide_react.Circle
|
|
5980
|
-
}[status];
|
|
5981
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
5908
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
5909
|
+
name: STATUS_ICONS[status],
|
|
5982
5910
|
"aria-hidden": "true",
|
|
5983
5911
|
className: require_MarkdownSurfaces.cn("cpk-tool-call-status-icon", status === "running" && "cpk-tool-call-status-icon-running", status === "failed" && "cpk-tool-call-status-icon-failed", className)
|
|
5984
5912
|
});
|
|
5985
5913
|
}
|
|
5986
5914
|
function Chevron({ open, className }) {
|
|
5987
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5915
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
5916
|
+
name: "ChevronRight",
|
|
5988
5917
|
"aria-hidden": "true",
|
|
5989
5918
|
className: require_MarkdownSurfaces.cn("cpk-tool-call-chevron", open && "cpk-tool-call-chevron-open", className)
|
|
5990
5919
|
});
|
|
5991
5920
|
}
|
|
5992
5921
|
function FailedCount({ calls }) {
|
|
5993
|
-
const
|
|
5922
|
+
const labels = useLabels$1();
|
|
5923
|
+
const failed = (0, _copilotkit_core.ɵcountFailedToolCalls)(calls);
|
|
5994
5924
|
if (!failed) return null;
|
|
5995
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
5925
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5996
5926
|
className: "cpk-tool-call-failed-count",
|
|
5997
|
-
children:
|
|
5927
|
+
children: (0, _copilotkit_core.ɵformatLabel)(labels.toolCallFailedCountLabel, { count: failed })
|
|
5998
5928
|
});
|
|
5999
5929
|
}
|
|
6000
|
-
/**
|
|
6001
|
-
* Guarded JSON.stringify for the payload blocks. A circular reference would
|
|
6002
|
-
* otherwise crash the entire React tree on render.
|
|
6003
|
-
*/
|
|
6004
|
-
function stringifyPayload(value) {
|
|
6005
|
-
if (typeof value === "string") return value;
|
|
6006
|
-
try {
|
|
6007
|
-
return JSON.stringify(value, null, 2);
|
|
6008
|
-
} catch (err) {
|
|
6009
|
-
console.warn("[CopilotKit] Failed to JSON.stringify tool-call payload; falling back to String():", err);
|
|
6010
|
-
try {
|
|
6011
|
-
return String(value);
|
|
6012
|
-
} catch {
|
|
6013
|
-
return "[unserializable]";
|
|
6014
|
-
}
|
|
6015
|
-
}
|
|
6016
|
-
}
|
|
6017
5930
|
function Payload({ label, value }) {
|
|
6018
5931
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6019
5932
|
className: "cpk-tool-call-payload-label",
|
|
6020
5933
|
children: label
|
|
6021
5934
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
6022
5935
|
className: "cpk-tool-call-payload-code",
|
|
6023
|
-
children:
|
|
5936
|
+
children: (0, _copilotkit_core.ɵstringifyToolCallPayload)(value)
|
|
6024
5937
|
})] });
|
|
6025
5938
|
}
|
|
6026
5939
|
/**
|
|
@@ -6028,13 +5941,14 @@ function Payload({ label, value }) {
|
|
|
6028
5941
|
* @internal
|
|
6029
5942
|
*/
|
|
6030
5943
|
function ToolCallPayloads({ parameters, result, className }) {
|
|
5944
|
+
const labels = useLabels$1();
|
|
6031
5945
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6032
5946
|
className: require_MarkdownSurfaces.cn("cpk-tool-call-payloads", className),
|
|
6033
5947
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Payload, {
|
|
6034
|
-
label:
|
|
5948
|
+
label: labels.toolCallArgumentsLabel,
|
|
6035
5949
|
value: parameters ?? {}
|
|
6036
5950
|
}), result !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Payload, {
|
|
6037
|
-
label:
|
|
5951
|
+
label: labels.toolCallResultLabel,
|
|
6038
5952
|
value: result
|
|
6039
5953
|
})]
|
|
6040
5954
|
});
|
|
@@ -6045,9 +5959,10 @@ function ToolCallPayloads({ parameters, result, className }) {
|
|
|
6045
5959
|
* @internal
|
|
6046
5960
|
*/
|
|
6047
5961
|
function ToolCallRow({ name, parameters, result, status, appearance, className, ...props }) {
|
|
5962
|
+
const labels = useLabels$1();
|
|
6048
5963
|
const [open, setOpen] = (0, react.useState)(false);
|
|
6049
5964
|
const detailsId = (0, react.useId)();
|
|
6050
|
-
const preview =
|
|
5965
|
+
const preview = (0, _copilotkit_core.ɵgetArgumentPreview)(parameters);
|
|
6051
5966
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6052
5967
|
"data-copilotkit": true,
|
|
6053
5968
|
className: require_MarkdownSurfaces.cn("cpk-tool-call-row", `cpk-tool-call-row-${appearance}`, className),
|
|
@@ -6072,7 +5987,7 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
|
|
|
6072
5987
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6073
5988
|
"data-testid": "copilot-tool-render-status",
|
|
6074
5989
|
className: "cpk-tool-call-row-status",
|
|
6075
|
-
children:
|
|
5990
|
+
children: labels[STATUS_LABEL_KEYS[status]]
|
|
6076
5991
|
}),
|
|
6077
5992
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
|
|
6078
5993
|
open,
|
|
@@ -6101,14 +6016,15 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
|
|
|
6101
6016
|
* draws.
|
|
6102
6017
|
*/
|
|
6103
6018
|
function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isActive = false, className, ...props }) {
|
|
6019
|
+
const labels = useLabels$1();
|
|
6104
6020
|
const [open, setOpen] = (0, react.useState)(false);
|
|
6105
6021
|
const bodyId = (0, react.useId)();
|
|
6106
6022
|
const latest = calls[calls.length - 1];
|
|
6107
6023
|
if (!latest) return null;
|
|
6108
6024
|
const current = isActive ? calls.find((call) => !call.toolMessage) ?? latest : void 0;
|
|
6109
|
-
const preview = current ?
|
|
6025
|
+
const preview = current ? (0, _copilotkit_core.ɵgetToolCallPreview)(current) : void 0;
|
|
6110
6026
|
const done = calls.filter((call) => call.toolMessage).length;
|
|
6111
|
-
const statuses = calls.map((call) =>
|
|
6027
|
+
const statuses = calls.map((call) => (0, _copilotkit_core.ɵgetToolCallRowStatus)(call, isActive));
|
|
6112
6028
|
const failedIds = new Set(calls.filter((_, index) => statuses[index] === "failed").map((call) => call.toolCall.id));
|
|
6113
6029
|
const status = current ? "running" : failedIds.size > 0 ? "failed" : statuses.includes("stopped") ? "stopped" : "done";
|
|
6114
6030
|
const rows = (rowAppearance) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallGroupContext.Provider, {
|
|
@@ -6126,9 +6042,9 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6126
6042
|
"data-state": status,
|
|
6127
6043
|
...props
|
|
6128
6044
|
};
|
|
6129
|
-
const runningLabel = current && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
6045
|
+
const runningLabel = current && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6130
6046
|
className: "cpk-tool-call-group-running cpk-shimmer",
|
|
6131
|
-
children:
|
|
6047
|
+
children: (0, _copilotkit_core.ɵformatLabel)(labels.toolCallRunningLabel, { name: current.toolCall.function.name })
|
|
6132
6048
|
}), preview && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6133
6049
|
className: "cpk-tool-call-group-preview",
|
|
6134
6050
|
children: preview
|
|
@@ -6156,13 +6072,16 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6156
6072
|
onClick: () => setOpen((value) => !value),
|
|
6157
6073
|
className: "cpk-tool-call-group-line-toggle",
|
|
6158
6074
|
children: [runningLabel || /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
6159
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
6075
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6160
6076
|
className: "cpk-tool-call-group-line-summary",
|
|
6161
|
-
children:
|
|
6077
|
+
children: (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
|
|
6078
|
+
one: labels.toolCallUsedToolsOne,
|
|
6079
|
+
other: labels.toolCallUsedToolsOther
|
|
6080
|
+
})
|
|
6162
6081
|
}),
|
|
6163
6082
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6164
6083
|
className: "cpk-tool-call-group-line-names",
|
|
6165
|
-
children:
|
|
6084
|
+
children: (0, _copilotkit_core.ɵformatToolNames)(calls)
|
|
6166
6085
|
}),
|
|
6167
6086
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls })
|
|
6168
6087
|
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, { open })]
|
|
@@ -6179,8 +6098,8 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6179
6098
|
if (appearance === "stack") {
|
|
6180
6099
|
const behind = open ? 0 : Math.min(calls.length - 1, 2);
|
|
6181
6100
|
const layer = "cpk-tool-call-group-stack-layer";
|
|
6182
|
-
const latestStatus =
|
|
6183
|
-
const latestPreview =
|
|
6101
|
+
const latestStatus = (0, _copilotkit_core.ɵgetToolCallRowStatus)(latest, isActive);
|
|
6102
|
+
const latestPreview = (0, _copilotkit_core.ɵgetToolCallPreview)(latest);
|
|
6184
6103
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6185
6104
|
...groupProps,
|
|
6186
6105
|
className: require_MarkdownSurfaces.cn("cpk-tool-call-group cpk-tool-call-group-stack", className),
|
|
@@ -6207,11 +6126,14 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6207
6126
|
onClick: () => setOpen((value) => !value),
|
|
6208
6127
|
className: require_MarkdownSurfaces.cn("cpk-tool-call-group-stack-toggle", open ? "cpk-tool-call-group-stack-toggle-open" : [layer, "cpk-tool-call-group-stack-toggle-closed"]),
|
|
6209
6128
|
children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
6210
|
-
|
|
6129
|
+
(0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
|
|
6130
|
+
one: labels.toolCallToolCallCountOne,
|
|
6131
|
+
other: labels.toolCallToolCallCountOther
|
|
6132
|
+
}),
|
|
6211
6133
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
|
|
6212
6134
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
6213
6135
|
className: "cpk-tool-call-group-stack-collapse",
|
|
6214
|
-
children: [
|
|
6136
|
+
children: [labels.toolCallCollapseLabel, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
|
|
6215
6137
|
open: true,
|
|
6216
6138
|
className: "cpk-tool-call-group-stack-collapse-icon"
|
|
6217
6139
|
})]
|
|
@@ -6230,7 +6152,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6230
6152
|
}),
|
|
6231
6153
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6232
6154
|
className: "cpk-tool-call-group-stack-status",
|
|
6233
|
-
children:
|
|
6155
|
+
children: labels[STATUS_LABEL_KEYS[latestStatus]]
|
|
6234
6156
|
})
|
|
6235
6157
|
]
|
|
6236
6158
|
}, latest.toolCall.id), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -6239,7 +6161,10 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6239
6161
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }),
|
|
6240
6162
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6241
6163
|
className: "cpk-tool-call-group-stack-count",
|
|
6242
|
-
children:
|
|
6164
|
+
children: (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
|
|
6165
|
+
one: labels.toolCallCallCountOne,
|
|
6166
|
+
other: labels.toolCallCallCountOther
|
|
6167
|
+
})
|
|
6243
6168
|
}),
|
|
6244
6169
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
|
|
6245
6170
|
open: false,
|
|
@@ -6251,7 +6176,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6251
6176
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6252
6177
|
"aria-live": "polite",
|
|
6253
6178
|
className: "cpk-tool-call-group-stack-live",
|
|
6254
|
-
children: open ? "" : `${latest.toolCall.function.name}: ${
|
|
6179
|
+
children: open ? "" : `${latest.toolCall.function.name}: ${labels[STATUS_LABEL_KEYS[latestStatus]]}`
|
|
6255
6180
|
})
|
|
6256
6181
|
]
|
|
6257
6182
|
}), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -6283,18 +6208,21 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
|
|
|
6283
6208
|
className: "cpk-tool-call-group-card-toggle",
|
|
6284
6209
|
children: [
|
|
6285
6210
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
|
|
6286
|
-
runningLabel || /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
6211
|
+
runningLabel || /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6287
6212
|
className: "cpk-tool-call-group-card-summary",
|
|
6288
|
-
children:
|
|
6213
|
+
children: (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
|
|
6214
|
+
one: labels.toolCallUsedToolsOne,
|
|
6215
|
+
other: labels.toolCallUsedToolsOther
|
|
6216
|
+
})
|
|
6289
6217
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6290
6218
|
className: "cpk-tool-call-group-card-names",
|
|
6291
|
-
children:
|
|
6219
|
+
children: (0, _copilotkit_core.ɵformatToolNames)(calls)
|
|
6292
6220
|
})] }),
|
|
6293
6221
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
6294
6222
|
className: "cpk-tool-call-group-card-meta",
|
|
6295
6223
|
children: [status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailedCount, { calls }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6296
6224
|
className: "cpk-tool-call-group-card-status",
|
|
6297
|
-
children: status !== "running" ?
|
|
6225
|
+
children: status !== "running" ? labels[STATUS_LABEL_KEYS[status]] : done > 0 && (0, _copilotkit_core.ɵformatLabel)(labels.toolCallDoneCountLabel, { count: done })
|
|
6298
6226
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, { open })]
|
|
6299
6227
|
})
|
|
6300
6228
|
]
|
|
@@ -7061,11 +6989,6 @@ function normalizeStaticSuggestions(suggestions) {
|
|
|
7061
6989
|
}));
|
|
7062
6990
|
}
|
|
7063
6991
|
|
|
7064
|
-
//#endregion
|
|
7065
|
-
//#region src/types/interrupt.ts
|
|
7066
|
-
/** Name of the legacy custom event agents emit to signal an interrupt. */
|
|
7067
|
-
const INTERRUPT_EVENT_NAME = "on_interrupt";
|
|
7068
|
-
|
|
7069
6992
|
//#endregion
|
|
7070
6993
|
//#region src/hooks/use-interrupt.tsx
|
|
7071
6994
|
/** Recognize thenables returned by interrupt preprocessing handlers. */
|
|
@@ -7076,7 +6999,7 @@ function isPromiseLike(value) {
|
|
|
7076
6999
|
function toLegacyEvent(pending) {
|
|
7077
7000
|
if (pending.kind === "legacy") return pending.event;
|
|
7078
7001
|
return {
|
|
7079
|
-
name: INTERRUPT_EVENT_NAME,
|
|
7002
|
+
name: _copilotkit_core.INTERRUPT_EVENT_NAME,
|
|
7080
7003
|
value: pending.interrupts[0]
|
|
7081
7004
|
};
|
|
7082
7005
|
}
|
|
@@ -7123,7 +7046,7 @@ function useInterrupt(config) {
|
|
|
7123
7046
|
let localStandard = null;
|
|
7124
7047
|
const subscription = agent.subscribe({
|
|
7125
7048
|
onCustomEvent: ({ event }) => {
|
|
7126
|
-
if (event.name === INTERRUPT_EVENT_NAME) localLegacy = {
|
|
7049
|
+
if (event.name === _copilotkit_core.INTERRUPT_EVENT_NAME) localLegacy = {
|
|
7127
7050
|
name: event.name,
|
|
7128
7051
|
value: event.value
|
|
7129
7052
|
};
|
|
@@ -7982,297 +7905,11 @@ function useAttachments({ config }) {
|
|
|
7982
7905
|
};
|
|
7983
7906
|
}
|
|
7984
7907
|
|
|
7985
|
-
//#endregion
|
|
7986
|
-
//#region src/hooks/use-learning-containers.tsx
|
|
7987
|
-
/** The default learning containers value. Matches the backend default. */
|
|
7988
|
-
const DEFAULT_CONTAINERS = ["project"];
|
|
7989
|
-
/**
|
|
7990
|
-
* Legacy compatibility hook that keeps a thread's plural learning-container
|
|
7991
|
-
* annotation in sync by emitting
|
|
7992
|
-
* `set_learning_containers` annotations via the CopilotKit runtime annotate
|
|
7993
|
-
* endpoint (`POST ${runtimeUrl}/annotate`).
|
|
7994
|
-
*
|
|
7995
|
-
* **Emit rules:**
|
|
7996
|
-
* - On mount with `["project"]` (the backend default) → does NOT emit.
|
|
7997
|
-
* Absence of an annotation equals the default, so the round-trip is skipped.
|
|
7998
|
-
* - On mount with any other value → emits immediately.
|
|
7999
|
-
* - On any subsequent content change (including a switch back to
|
|
8000
|
-
* `["project"]`) → emits (a deliberate switch is always recorded).
|
|
8001
|
-
* - On unmount or threadId change → emits a reset to `["project"]`
|
|
8002
|
-
* so the backend is left in a clean state for the next consumer.
|
|
8003
|
-
* Changing `learningContainers` within the same thread does NOT reset the
|
|
8004
|
-
* thread; only the new value is emitted.
|
|
8005
|
-
*
|
|
8006
|
-
* Content-equality is evaluated via `JSON.stringify` so a fresh array literal
|
|
8007
|
-
* with the same items does NOT trigger a redundant emit.
|
|
8008
|
-
*
|
|
8009
|
-
* If `runtimeUrl` is absent, all emits are silently skipped.
|
|
8010
|
-
*
|
|
8011
|
-
* @example
|
|
8012
|
-
* ```tsx
|
|
8013
|
-
* function ThreadPane({ threadId, userScope }: Props) {
|
|
8014
|
-
* useLearningContainers({
|
|
8015
|
-
* threadId,
|
|
8016
|
-
* learningContainers: [userScope],
|
|
8017
|
-
* });
|
|
8018
|
-
* // ...
|
|
8019
|
-
* }
|
|
8020
|
-
* ```
|
|
8021
|
-
*
|
|
8022
|
-
* @deprecated This hook supports only the legacy plural-container annotation.
|
|
8023
|
-
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
8024
|
-
* Intelligence runtimes.
|
|
8025
|
-
*/
|
|
8026
|
-
function useLearningContainers({ threadId, learningContainers }) {
|
|
8027
|
-
const { copilotkit } = (0, _copilotkit_react_core_context.useCopilotKit)();
|
|
8028
|
-
/**
|
|
8029
|
-
* Tracks the last-synced container list so content-identical rerenders
|
|
8030
|
-
* (fresh array, same values) do not fire a redundant emit.
|
|
8031
|
-
* `null` = nothing synced yet (initial state or after a threadId reset).
|
|
8032
|
-
*/
|
|
8033
|
-
const lastSyncedRef = (0, react.useRef)(null);
|
|
8034
|
-
/** Guards the missing-runtimeUrl warning so it fires at most once per hook instance. */
|
|
8035
|
-
const warnedMissingUrlRef = (0, react.useRef)(false);
|
|
8036
|
-
const runtimeUrlRef = (0, react.useRef)(copilotkit.runtimeUrl);
|
|
8037
|
-
const runtimeFetchRef = (0, react.useRef)(copilotkit.ɵruntimeFetch);
|
|
8038
|
-
runtimeUrlRef.current = copilotkit.runtimeUrl;
|
|
8039
|
-
runtimeFetchRef.current = copilotkit.ɵruntimeFetch;
|
|
8040
|
-
const key = JSON.stringify(learningContainers);
|
|
8041
|
-
const defaultKey = JSON.stringify(DEFAULT_CONTAINERS);
|
|
8042
|
-
(0, react.useEffect)(() => {
|
|
8043
|
-
const runtimeUrl = copilotkit.runtimeUrl;
|
|
8044
|
-
/**
|
|
8045
|
-
* Fire-and-forget emit; errors must not surface in render.
|
|
8046
|
-
* Failures are logged as warnings so they are diagnosable without
|
|
8047
|
-
* propagating into the React render cycle.
|
|
8048
|
-
*/
|
|
8049
|
-
const emit = (containers) => {
|
|
8050
|
-
if (!runtimeUrl) {
|
|
8051
|
-
if (!warnedMissingUrlRef.current) {
|
|
8052
|
-
warnedMissingUrlRef.current = true;
|
|
8053
|
-
console.warn("useLearningContainers: runtimeUrl not configured; learning-container sync disabled");
|
|
8054
|
-
}
|
|
8055
|
-
return;
|
|
8056
|
-
}
|
|
8057
|
-
recordAnnotation({
|
|
8058
|
-
fetch: copilotkit.ɵruntimeFetch,
|
|
8059
|
-
runtimeUrl,
|
|
8060
|
-
headers: {},
|
|
8061
|
-
type: "set_learning_containers",
|
|
8062
|
-
payload: { containers },
|
|
8063
|
-
threadId
|
|
8064
|
-
}).catch((err) => {
|
|
8065
|
-
console.warn("useLearningContainers: failed to record set_learning_containers", err);
|
|
8066
|
-
});
|
|
8067
|
-
};
|
|
8068
|
-
if (lastSyncedRef.current === null) {
|
|
8069
|
-
if (key === defaultKey) {
|
|
8070
|
-
lastSyncedRef.current = learningContainers;
|
|
8071
|
-
return;
|
|
8072
|
-
}
|
|
8073
|
-
emit(learningContainers);
|
|
8074
|
-
lastSyncedRef.current = learningContainers;
|
|
8075
|
-
} else if (key !== JSON.stringify(lastSyncedRef.current)) {
|
|
8076
|
-
emit(learningContainers);
|
|
8077
|
-
lastSyncedRef.current = learningContainers;
|
|
8078
|
-
}
|
|
8079
|
-
}, [threadId, key]);
|
|
8080
|
-
(0, react.useEffect)(() => {
|
|
8081
|
-
const capturedThreadId = threadId;
|
|
8082
|
-
return () => {
|
|
8083
|
-
const capturedRuntimeUrl = runtimeUrlRef.current;
|
|
8084
|
-
if (capturedRuntimeUrl) recordAnnotation({
|
|
8085
|
-
fetch: runtimeFetchRef.current,
|
|
8086
|
-
runtimeUrl: capturedRuntimeUrl,
|
|
8087
|
-
headers: {},
|
|
8088
|
-
type: "set_learning_containers",
|
|
8089
|
-
payload: { containers: DEFAULT_CONTAINERS },
|
|
8090
|
-
threadId: capturedThreadId
|
|
8091
|
-
}).catch((err) => {
|
|
8092
|
-
console.warn("useLearningContainers: failed to record set_learning_containers", err);
|
|
8093
|
-
});
|
|
8094
|
-
lastSyncedRef.current = null;
|
|
8095
|
-
};
|
|
8096
|
-
}, [threadId]);
|
|
8097
|
-
}
|
|
8098
|
-
|
|
8099
|
-
//#endregion
|
|
8100
|
-
//#region src/hooks/use-learning-containers-in-current-thread.tsx
|
|
8101
|
-
/**
|
|
8102
|
-
* Legacy compatibility hook that keeps the **current chat thread's** plural
|
|
8103
|
-
* learning-container annotation in sync. The `threadId` is sourced from the surrounding
|
|
8104
|
-
* `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
|
|
8105
|
-
* `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
|
|
8106
|
-
* subtree don't need to thread an id through manually.
|
|
8107
|
-
*
|
|
8108
|
-
* **Throws on render** when there is no chat-config provider in scope or
|
|
8109
|
-
* when the provider does not yet have an active `threadId`. Mount the hook
|
|
8110
|
-
* inside a subtree that is guaranteed to have a thread context.
|
|
8111
|
-
*
|
|
8112
|
-
* If you need to manage an explicit thread, use {@link useLearningContainers}
|
|
8113
|
-
* directly — two hooks, two crisp contracts, no mode confusion.
|
|
8114
|
-
*
|
|
8115
|
-
* @throws When no `CopilotChatConfigurationProvider` is in scope or when the
|
|
8116
|
-
* active `threadId` is absent/empty.
|
|
8117
|
-
*
|
|
8118
|
-
* @example
|
|
8119
|
-
* ```tsx
|
|
8120
|
-
* function ThreadPanel({ scope }: Props) {
|
|
8121
|
-
* useLearningContainersInCurrentThread({
|
|
8122
|
-
* learningContainers: [scope],
|
|
8123
|
-
* });
|
|
8124
|
-
* // ...
|
|
8125
|
-
* }
|
|
8126
|
-
* ```
|
|
8127
|
-
*
|
|
8128
|
-
* @deprecated This hook supports only the legacy plural-container annotation.
|
|
8129
|
-
* Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
|
|
8130
|
-
* Intelligence runtimes.
|
|
8131
|
-
*/
|
|
8132
|
-
function useLearningContainersInCurrentThread({ learningContainers }) {
|
|
8133
|
-
const threadId = require_MarkdownSurfaces.useCopilotChatConfiguration()?.threadId;
|
|
8134
|
-
if (!threadId) throw new Error("useLearningContainersInCurrentThread must be used within a thread context (no active threadId). Wrap the component in <CopilotChat>, <CopilotSidebar>, or <CopilotChatConfigurationProvider>, or use `useLearningContainers()` and pass `threadId` explicitly.");
|
|
8135
|
-
useLearningContainers({
|
|
8136
|
-
threadId,
|
|
8137
|
-
learningContainers
|
|
8138
|
-
});
|
|
8139
|
-
}
|
|
8140
|
-
|
|
8141
7908
|
//#endregion
|
|
8142
7909
|
//#region src/components/chat/tool-call-display-context.ts
|
|
8143
7910
|
/** @internal */
|
|
8144
7911
|
const ToolCallDisplayContext = (0, react.createContext)(null);
|
|
8145
7912
|
|
|
8146
|
-
//#endregion
|
|
8147
|
-
//#region src/components/chat/tool-call-layout.ts
|
|
8148
|
-
function contentLength(content) {
|
|
8149
|
-
return typeof content === "string" ? content.length : JSON.stringify(content ?? "").length;
|
|
8150
|
-
}
|
|
8151
|
-
const entrySignature = ({ toolCall, toolMessage }) => [
|
|
8152
|
-
toolCall.id,
|
|
8153
|
-
toolCall.function.name,
|
|
8154
|
-
toolCall.function.arguments.length,
|
|
8155
|
-
toolMessage ? `${contentLength(toolMessage.content)}${toolMessage.error ? "!" : ""}` : "-"
|
|
8156
|
-
].join(":");
|
|
8157
|
-
function signatureOf(segments) {
|
|
8158
|
-
return segments.map((segment) => segment.kind === "call" ? `c(${entrySignature(segment.call)})` : `g${segment.trailing ? "*" : ""}(${segment.calls.map(entrySignature).join(",")})`).join("|");
|
|
8159
|
-
}
|
|
8160
|
-
/** Index of tool results by the call they answer. */
|
|
8161
|
-
function getToolResults(messages) {
|
|
8162
|
-
const results = /* @__PURE__ */ new Map();
|
|
8163
|
-
for (const message of messages) if (message.role === "tool") results.set(message.toolCallId, message);
|
|
8164
|
-
return results;
|
|
8165
|
-
}
|
|
8166
|
-
/**
|
|
8167
|
-
* Lays out the tool calls of every assistant message in `rendered`.
|
|
8168
|
-
*
|
|
8169
|
-
* Calls drawn by a renderer that opted into grouping join the group that's
|
|
8170
|
-
* open; anything else that shows between them closes it: assistant text, a
|
|
8171
|
-
* user, reasoning or activity message, or a call drawn by any other renderer. A group belongs to
|
|
8172
|
-
* the message where it starts, so later messages whose calls joined it render
|
|
8173
|
-
* no tool calls themselves.
|
|
8174
|
-
*
|
|
8175
|
-
* @param rendered - The messages as the chat renders them, in order.
|
|
8176
|
-
* @param all - Every message, for finding tool results (a transform may hide them).
|
|
8177
|
-
* @param renderers - The registered renderers.
|
|
8178
|
-
*/
|
|
8179
|
-
function getToolCallLayouts(rendered, all, renderers) {
|
|
8180
|
-
const results = getToolResults(all);
|
|
8181
|
-
const layouts = /* @__PURE__ */ new Map();
|
|
8182
|
-
let open;
|
|
8183
|
-
for (const message of rendered) {
|
|
8184
|
-
if (message.role === "tool") continue;
|
|
8185
|
-
if (message.role !== "assistant") {
|
|
8186
|
-
open = void 0;
|
|
8187
|
-
continue;
|
|
8188
|
-
}
|
|
8189
|
-
if (typeof message.content === "string" && message.content.trim()) open = void 0;
|
|
8190
|
-
const segments = [];
|
|
8191
|
-
layouts.set(message.id, segments);
|
|
8192
|
-
const toolCalls = /* @__PURE__ */ new Map();
|
|
8193
|
-
for (const toolCall of message.toolCalls ?? []) toolCalls.set(toolCall.id, toolCall);
|
|
8194
|
-
for (const toolCall of toolCalls.values()) {
|
|
8195
|
-
const entry = {
|
|
8196
|
-
toolCall,
|
|
8197
|
-
toolMessage: results.get(toolCall.id)
|
|
8198
|
-
};
|
|
8199
|
-
const name = toolCall.function.name;
|
|
8200
|
-
const named = renderers.named.has(name);
|
|
8201
|
-
const rendered = named || renderers.wildcard;
|
|
8202
|
-
const groups = named ? renderers.groupedNames.has(name) : renderers.wildcardGroups;
|
|
8203
|
-
if (!rendered || !groups) {
|
|
8204
|
-
if (rendered) open = void 0;
|
|
8205
|
-
segments.push({
|
|
8206
|
-
kind: "call",
|
|
8207
|
-
id: toolCall.id,
|
|
8208
|
-
call: entry,
|
|
8209
|
-
rendered
|
|
8210
|
-
});
|
|
8211
|
-
} else if (open) open.calls.push(entry);
|
|
8212
|
-
else {
|
|
8213
|
-
open = {
|
|
8214
|
-
kind: "group",
|
|
8215
|
-
id: toolCall.id,
|
|
8216
|
-
calls: [entry],
|
|
8217
|
-
trailing: false
|
|
8218
|
-
};
|
|
8219
|
-
segments.push(open);
|
|
8220
|
-
}
|
|
8221
|
-
}
|
|
8222
|
-
}
|
|
8223
|
-
if (open) open.trailing = true;
|
|
8224
|
-
const layout = /* @__PURE__ */ new Map();
|
|
8225
|
-
for (const [id, segments] of layouts) layout.set(id, {
|
|
8226
|
-
segments,
|
|
8227
|
-
signature: signatureOf(segments)
|
|
8228
|
-
});
|
|
8229
|
-
return layout;
|
|
8230
|
-
}
|
|
8231
|
-
/**
|
|
8232
|
-
* Finds the working phase of every reply in `rendered`: its messages up to the
|
|
8233
|
-
* last one that calls a tool. Text in there was narration; what follows is the
|
|
8234
|
-
* reply itself. Replies that called no tools are omitted, except the latest,
|
|
8235
|
-
* which may be about to.
|
|
8236
|
-
*/
|
|
8237
|
-
function getTurnWork(rendered, layouts) {
|
|
8238
|
-
const turns = /* @__PURE__ */ new Map();
|
|
8239
|
-
let start = 0;
|
|
8240
|
-
while (start < rendered.length) {
|
|
8241
|
-
let end = start;
|
|
8242
|
-
while (end < rendered.length && rendered[end].role !== "user") end++;
|
|
8243
|
-
const key = start > 0 ? rendered[start - 1].id : "start";
|
|
8244
|
-
const visible = rendered.slice(start, end).filter((message) => message.role !== "tool");
|
|
8245
|
-
const isLatest = end === rendered.length;
|
|
8246
|
-
const calls = [];
|
|
8247
|
-
for (const message of visible) for (const segment of layouts.get(message.id)?.segments ?? []) if (segment.kind === "group") calls.push(...segment.calls);
|
|
8248
|
-
else if (segment.rendered) calls.push(segment.call);
|
|
8249
|
-
const shown = new Set(calls.map((entry) => entry.toolCall.id));
|
|
8250
|
-
let lastWork = -1;
|
|
8251
|
-
visible.forEach((message, index) => {
|
|
8252
|
-
if (message.role === "assistant" && message.toolCalls?.some((call) => shown.has(call.id))) lastWork = index;
|
|
8253
|
-
});
|
|
8254
|
-
const first = visible[0];
|
|
8255
|
-
if (first && (calls.length > 0 || isLatest)) {
|
|
8256
|
-
let lastAssistant = -1;
|
|
8257
|
-
visible.forEach((message, index) => {
|
|
8258
|
-
if (message.role === "assistant") lastAssistant = index;
|
|
8259
|
-
});
|
|
8260
|
-
const replyText = visible[lastAssistant]?.content;
|
|
8261
|
-
const endsWithWork = lastAssistant >= 0 && lastAssistant <= lastWork && typeof replyText === "string" && replyText.trim().length > 0;
|
|
8262
|
-
turns.set(key, {
|
|
8263
|
-
key,
|
|
8264
|
-
firstMessageId: first.id,
|
|
8265
|
-
workMessageIds: new Set(visible.slice(0, lastWork + 1).map((message) => message.id)),
|
|
8266
|
-
replyTextMessageId: endsWithWork ? visible[lastAssistant].id : void 0,
|
|
8267
|
-
calls,
|
|
8268
|
-
isLatest
|
|
8269
|
-
});
|
|
8270
|
-
}
|
|
8271
|
-
start = end + 1;
|
|
8272
|
-
}
|
|
8273
|
-
return turns;
|
|
8274
|
-
}
|
|
8275
|
-
|
|
8276
7913
|
//#endregion
|
|
8277
7914
|
//#region src/components/chat/CopilotChatToolCallsView.tsx
|
|
8278
7915
|
const appearances = {
|
|
@@ -8292,7 +7929,7 @@ function CopilotChatToolCallsView({ message, messages = [], display: displayProp
|
|
|
8292
7929
|
const viewLayout = context?.layouts.get(message.id);
|
|
8293
7930
|
const layout = (0, react.useMemo)(() => {
|
|
8294
7931
|
if (display === "separate") return void 0;
|
|
8295
|
-
return viewLayout ?? getToolCallLayouts([message], messages, rendererNames).get(message.id);
|
|
7932
|
+
return viewLayout ?? (0, _copilotkit_core.ɵgetToolCallLayouts)([message], messages, rendererNames).get(message.id);
|
|
8296
7933
|
}, [
|
|
8297
7934
|
display,
|
|
8298
7935
|
viewLayout,
|
|
@@ -8482,7 +8119,7 @@ function InspectorKiteIcon({ className, ...props }) {
|
|
|
8482
8119
|
});
|
|
8483
8120
|
}
|
|
8484
8121
|
function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
|
|
8485
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
8122
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
8486
8123
|
const { isInspectorEnabled } = useCopilotKitInspector();
|
|
8487
8124
|
const hidden = useInspectorShortcutsHidden();
|
|
8488
8125
|
const [open, setOpen] = (0, react.useState)(false);
|
|
@@ -8551,7 +8188,8 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
|
|
|
8551
8188
|
event.currentTarget.click();
|
|
8552
8189
|
}
|
|
8553
8190
|
},
|
|
8554
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
8191
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
8192
|
+
name: "Wrench",
|
|
8555
8193
|
"aria-hidden": "true",
|
|
8556
8194
|
className: "cpk-inspector-button-icon",
|
|
8557
8195
|
"data-testid": "copilot-inspector-icon"
|
|
@@ -8618,7 +8256,8 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
|
|
|
8618
8256
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuItem, {
|
|
8619
8257
|
onSelect: hideShortcuts,
|
|
8620
8258
|
className: "cpk-inspector-button-menu-item cpk-inspector-button-hide-item",
|
|
8621
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
8259
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
8260
|
+
name: "EyeOff",
|
|
8622
8261
|
"aria-hidden": "true",
|
|
8623
8262
|
className: "cpk-inspector-button-menu-item-icon"
|
|
8624
8263
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -9012,7 +8651,7 @@ function nextFocusable(element, skip) {
|
|
|
9012
8651
|
* control after the thumb, and Enter or Escape inside it returns to the thumb.
|
|
9013
8652
|
*/
|
|
9014
8653
|
function FeedbackCommentPopover({ feedbackComment, comment, savedComment, rating, anchor, messageId }) {
|
|
9015
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
8654
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9016
8655
|
const contentRef = (0, react.useRef)(null);
|
|
9017
8656
|
const focusInside = () => contentRef.current?.contains(document.activeElement) ?? false;
|
|
9018
8657
|
const { focusRequest, takeFocusRequest, inputRef } = comment;
|
|
@@ -9316,7 +8955,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
9316
8955
|
});
|
|
9317
8956
|
};
|
|
9318
8957
|
_CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
9319
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
8958
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9320
8959
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
9321
8960
|
const timerRef = (0, react.useRef)(null);
|
|
9322
8961
|
(0, react.useEffect)(() => {
|
|
@@ -9342,36 +8981,44 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
9342
8981
|
onClick: handleClick,
|
|
9343
8982
|
className,
|
|
9344
8983
|
...props,
|
|
9345
|
-
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
8984
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
8985
|
+
name: "Check",
|
|
8986
|
+
className: "cpk-assistant-message-toolbar-icon"
|
|
8987
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
8988
|
+
name: "Copy",
|
|
8989
|
+
className: "cpk-assistant-message-toolbar-icon"
|
|
8990
|
+
})
|
|
9346
8991
|
});
|
|
9347
8992
|
};
|
|
9348
8993
|
_CopilotChatAssistantMessage.InspectorButton = CopilotChatInspectorButton;
|
|
9349
8994
|
_CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
|
|
9350
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
8995
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9351
8996
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
9352
8997
|
"data-testid": "copilot-thumbs-up-button",
|
|
9353
8998
|
title: title || labels.assistantMessageToolbarThumbsUpLabel,
|
|
9354
8999
|
...props,
|
|
9355
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9000
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9001
|
+
name: "ThumbsUp",
|
|
9356
9002
|
className: "cpk-assistant-message-toolbar-icon",
|
|
9357
9003
|
fill: props["aria-pressed"] === true ? "currentColor" : "none"
|
|
9358
9004
|
})
|
|
9359
9005
|
});
|
|
9360
9006
|
};
|
|
9361
9007
|
_CopilotChatAssistantMessage.ThumbsDownButton = ({ title, ...props }) => {
|
|
9362
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9008
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9363
9009
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
9364
9010
|
"data-testid": "copilot-thumbs-down-button",
|
|
9365
9011
|
title: title || labels.assistantMessageToolbarThumbsDownLabel,
|
|
9366
9012
|
...props,
|
|
9367
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9013
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9014
|
+
name: "ThumbsDown",
|
|
9368
9015
|
className: "cpk-assistant-message-toolbar-icon",
|
|
9369
9016
|
fill: props["aria-pressed"] === true ? "currentColor" : "none"
|
|
9370
9017
|
})
|
|
9371
9018
|
});
|
|
9372
9019
|
};
|
|
9373
9020
|
_CopilotChatAssistantMessage.FeedbackComment = ({ value, savedComment, inputRef, onChange, onSubmit, onEditingChange, onLeave, className }) => {
|
|
9374
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9021
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9375
9022
|
const changed = value.trim() !== savedComment;
|
|
9376
9023
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
9377
9024
|
"data-testid": "copilot-feedback-comment",
|
|
@@ -9401,26 +9048,35 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
|
|
|
9401
9048
|
variant: "assistantMessageToolbarButton",
|
|
9402
9049
|
"aria-label": labels.assistantMessageFeedbackCommentSubmitLabel,
|
|
9403
9050
|
title: labels.assistantMessageFeedbackCommentSubmitLabel,
|
|
9404
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9051
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9052
|
+
name: "ArrowUp",
|
|
9053
|
+
className: "cpk-assistant-message-feedback-comment-submit-icon"
|
|
9054
|
+
})
|
|
9405
9055
|
})]
|
|
9406
9056
|
});
|
|
9407
9057
|
};
|
|
9408
9058
|
_CopilotChatAssistantMessage.ReadAloudButton = ({ title, ...props }) => {
|
|
9409
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9059
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9410
9060
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
9411
9061
|
"data-testid": "copilot-read-aloud-button",
|
|
9412
9062
|
title: title || labels.assistantMessageToolbarReadAloudLabel,
|
|
9413
9063
|
...props,
|
|
9414
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9064
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9065
|
+
name: "Volume2",
|
|
9066
|
+
className: "cpk-assistant-message-read-aloud-icon"
|
|
9067
|
+
})
|
|
9415
9068
|
});
|
|
9416
9069
|
};
|
|
9417
9070
|
_CopilotChatAssistantMessage.RegenerateButton = ({ title, ...props }) => {
|
|
9418
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9071
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9419
9072
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
9420
9073
|
"data-testid": "copilot-regenerate-button",
|
|
9421
9074
|
title: title || labels.assistantMessageToolbarRegenerateLabel,
|
|
9422
9075
|
...props,
|
|
9423
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9076
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9077
|
+
name: "RefreshCw",
|
|
9078
|
+
className: "cpk-assistant-message-toolbar-icon"
|
|
9079
|
+
})
|
|
9424
9080
|
});
|
|
9425
9081
|
};
|
|
9426
9082
|
})(CopilotChatAssistantMessage || (CopilotChatAssistantMessage = {}));
|
|
@@ -9443,7 +9099,7 @@ var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
|
|
|
9443
9099
|
* `labels.attachmentPreviewCloseButtonLabel`.
|
|
9444
9100
|
*/
|
|
9445
9101
|
function Lightbox({ onClose, children }) {
|
|
9446
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9102
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9447
9103
|
(0, react.useEffect)(() => {
|
|
9448
9104
|
const handleKey = (e) => {
|
|
9449
9105
|
if (e.key === "Escape") onClose();
|
|
@@ -9459,7 +9115,10 @@ function Lightbox({ onClose, children }) {
|
|
|
9459
9115
|
onClick: onClose,
|
|
9460
9116
|
className: "cpk-attachment-lightbox-close-button",
|
|
9461
9117
|
"aria-label": labels.attachmentPreviewCloseButtonLabel,
|
|
9462
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9118
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9119
|
+
name: "X",
|
|
9120
|
+
className: "cpk-attachment-lightbox-close-icon"
|
|
9121
|
+
})
|
|
9463
9122
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9464
9123
|
onClick: (e) => e.stopPropagation(),
|
|
9465
9124
|
children
|
|
@@ -9513,17 +9172,22 @@ function useLightbox() {
|
|
|
9513
9172
|
|
|
9514
9173
|
//#endregion
|
|
9515
9174
|
//#region src/components/chat/CopilotChatAttachmentRenderer.tsx
|
|
9175
|
+
/** The chat labels from the nearest chat configuration, or the defaults. */
|
|
9176
|
+
function useLabels() {
|
|
9177
|
+
return require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9178
|
+
}
|
|
9516
9179
|
const ImageAttachment = (0, react.memo)(function ImageAttachment({ src, className }) {
|
|
9180
|
+
const labels = useLabels();
|
|
9517
9181
|
const [error, setError] = (0, react.useState)(false);
|
|
9518
9182
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
9519
9183
|
if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9520
9184
|
className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-image-error", className),
|
|
9521
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children:
|
|
9185
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: labels.attachmentImageLoadErrorText })
|
|
9522
9186
|
});
|
|
9523
9187
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
9524
9188
|
ref: thumbnailRef,
|
|
9525
9189
|
src,
|
|
9526
|
-
alt:
|
|
9190
|
+
alt: labels.attachmentImageAltText,
|
|
9527
9191
|
className: require_MarkdownSurfaces.cn("cpk-attachment-renderer cpk-attachment-renderer-image", className),
|
|
9528
9192
|
onClick: openLightbox,
|
|
9529
9193
|
onError: () => setError(true)
|
|
@@ -9532,7 +9196,7 @@ const ImageAttachment = (0, react.memo)(function ImageAttachment({ src, classNam
|
|
|
9532
9196
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
9533
9197
|
style: { viewTransitionName: vtName },
|
|
9534
9198
|
src,
|
|
9535
|
-
alt:
|
|
9199
|
+
alt: labels.attachmentImageAltText,
|
|
9536
9200
|
className: "cpk-attachment-renderer-lightbox-image"
|
|
9537
9201
|
})
|
|
9538
9202
|
})] });
|
|
@@ -9560,7 +9224,8 @@ const VideoAttachment = (0, react.memo)(function VideoAttachment({ src, classNam
|
|
|
9560
9224
|
});
|
|
9561
9225
|
});
|
|
9562
9226
|
const DocumentAttachment = (0, react.memo)(function DocumentAttachment({ src, source, filename, className }) {
|
|
9563
|
-
const
|
|
9227
|
+
const labels = useLabels();
|
|
9228
|
+
const label = filename || source.mimeType || labels.attachmentDocumentAltText;
|
|
9564
9229
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
9565
9230
|
href: src,
|
|
9566
9231
|
download: filename ?? "",
|
|
@@ -9573,7 +9238,7 @@ const DocumentAttachment = (0, react.memo)(function DocumentAttachment({ src, so
|
|
|
9573
9238
|
children: (0, _copilotkit_shared.getDocumentIcon)(source.mimeType ?? "")
|
|
9574
9239
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9575
9240
|
className: "cpk-attachment-renderer-document-name",
|
|
9576
|
-
children: filename || source.mimeType ||
|
|
9241
|
+
children: filename || source.mimeType || labels.attachmentUnknownTypeText
|
|
9577
9242
|
})]
|
|
9578
9243
|
});
|
|
9579
9244
|
});
|
|
@@ -9712,7 +9377,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
9712
9377
|
})] });
|
|
9713
9378
|
};
|
|
9714
9379
|
_CopilotChatUserMessage.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
9715
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9380
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9716
9381
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
9717
9382
|
const handleClick = async (event) => {
|
|
9718
9383
|
let success = false;
|
|
@@ -9728,21 +9393,30 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
9728
9393
|
onClick: handleClick,
|
|
9729
9394
|
className,
|
|
9730
9395
|
...props,
|
|
9731
|
-
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9396
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9397
|
+
name: "Check",
|
|
9398
|
+
className: "cpk-user-message-toolbar-icon"
|
|
9399
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9400
|
+
name: "Copy",
|
|
9401
|
+
className: "cpk-user-message-toolbar-icon"
|
|
9402
|
+
})
|
|
9732
9403
|
});
|
|
9733
9404
|
};
|
|
9734
9405
|
_CopilotChatUserMessage.EditButton = ({ className, title, ...props }) => {
|
|
9735
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9406
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9736
9407
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
|
|
9737
9408
|
"data-testid": "copilot-edit-button",
|
|
9738
9409
|
title: title || labels.userMessageToolbarEditMessageLabel,
|
|
9739
9410
|
className,
|
|
9740
9411
|
...props,
|
|
9741
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9412
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9413
|
+
name: "Edit",
|
|
9414
|
+
className: "cpk-user-message-toolbar-icon"
|
|
9415
|
+
})
|
|
9742
9416
|
});
|
|
9743
9417
|
};
|
|
9744
9418
|
_CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
|
|
9745
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9419
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9746
9420
|
if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) return null;
|
|
9747
9421
|
const canGoPrev = currentBranch > 0;
|
|
9748
9422
|
const canGoNext = currentBranch < numberOfBranches - 1;
|
|
@@ -9762,7 +9436,10 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
9762
9436
|
disabled: !canGoPrev,
|
|
9763
9437
|
className: "cpk-user-message-branch-button",
|
|
9764
9438
|
"aria-label": labels.userMessageToolbarPreviousBranchLabel,
|
|
9765
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9439
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9440
|
+
name: "ChevronLeft",
|
|
9441
|
+
className: "cpk-user-message-branch-icon"
|
|
9442
|
+
})
|
|
9766
9443
|
}),
|
|
9767
9444
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
9768
9445
|
className: "cpk-user-message-branch-counter",
|
|
@@ -9783,7 +9460,10 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
|
|
|
9783
9460
|
disabled: !canGoNext,
|
|
9784
9461
|
className: "cpk-user-message-branch-button",
|
|
9785
9462
|
"aria-label": labels.userMessageToolbarNextBranchLabel,
|
|
9786
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9463
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9464
|
+
name: "ChevronRight",
|
|
9465
|
+
className: "cpk-user-message-branch-icon"
|
|
9466
|
+
})
|
|
9787
9467
|
})
|
|
9788
9468
|
]
|
|
9789
9469
|
});
|
|
@@ -9801,24 +9481,35 @@ var CopilotChatUserMessage_default = CopilotChatUserMessage;
|
|
|
9801
9481
|
//#endregion
|
|
9802
9482
|
//#region src/components/chat/CopilotChatReasoningMessage.tsx
|
|
9803
9483
|
/**
|
|
9804
|
-
*
|
|
9484
|
+
* The reasoning time as label text, such as "4 seconds" or "1m 5s".
|
|
9485
|
+
*
|
|
9486
|
+
* @param seconds - The elapsed time in seconds. It may have a fraction.
|
|
9487
|
+
* @param labels - The chat labels that hold the duration texts.
|
|
9805
9488
|
*/
|
|
9806
|
-
function formatDuration
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9489
|
+
function formatDuration(seconds, labels) {
|
|
9490
|
+
const duration = (0, _copilotkit_core.ɵformatReasoningDuration)(seconds);
|
|
9491
|
+
switch (duration.unit) {
|
|
9492
|
+
case "fewSeconds": return labels.reasoningMessageDurationFewSeconds;
|
|
9493
|
+
case "seconds": return (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageDurationSeconds, { count: duration.seconds });
|
|
9494
|
+
case "minutes": return (0, _copilotkit_core.ɵformatCountLabel)(duration.minutes, {
|
|
9495
|
+
one: labels.reasoningMessageDurationMinutesOne,
|
|
9496
|
+
other: labels.reasoningMessageDurationMinutesOther
|
|
9497
|
+
});
|
|
9498
|
+
case "minutesSeconds": return (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageDurationMinutesSeconds, {
|
|
9499
|
+
minutes: duration.minutes,
|
|
9500
|
+
seconds: duration.seconds
|
|
9501
|
+
});
|
|
9502
|
+
}
|
|
9813
9503
|
}
|
|
9814
9504
|
/**
|
|
9815
9505
|
* A reasoning message as a collapsible block. While the model reasons it is
|
|
9816
9506
|
* open and the header shows `labels.reasoningMessageThinkingLabel`; when
|
|
9817
|
-
* streaming ends it collapses and the header reads
|
|
9507
|
+
* streaming ends it collapses and the header reads
|
|
9508
|
+
* `labels.reasoningMessageThoughtForLabel` ("Thought for 4 seconds"). The
|
|
9818
9509
|
* `header` slot also receives `elapsedSeconds`.
|
|
9819
9510
|
*/
|
|
9820
9511
|
function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: isLatestProp, header, contentView, toggle, children, className, ...props }) {
|
|
9821
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
9512
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
9822
9513
|
const isLatest = isLatestProp ?? messages?.[messages.length - 1]?.id === message.id;
|
|
9823
9514
|
const isStreaming = !!(isRunning && isLatest);
|
|
9824
9515
|
const hasContent = !!(message.content && message.content.length > 0);
|
|
@@ -9848,7 +9539,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
|
|
|
9848
9539
|
userToggledRef.current = true;
|
|
9849
9540
|
setIsOpen((prev) => !prev);
|
|
9850
9541
|
} : void 0;
|
|
9851
|
-
const label = isStreaming ? labels.reasoningMessageThinkingLabel :
|
|
9542
|
+
const label = isStreaming ? labels.reasoningMessageThinkingLabel : (0, _copilotkit_core.ɵformatLabel)(labels.reasoningMessageThoughtForLabel, { duration: formatDuration(elapsed, labels) });
|
|
9852
9543
|
const boundHeader = require_MarkdownSurfaces.renderSlot(header, CopilotChatReasoningMessage.Header, {
|
|
9853
9544
|
isOpen,
|
|
9854
9545
|
label,
|
|
@@ -9903,7 +9594,10 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
|
|
|
9903
9594
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "cpk-reasoning-message-indicator-dot" })
|
|
9904
9595
|
}),
|
|
9905
9596
|
headerChildren,
|
|
9906
|
-
isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9597
|
+
isExpandable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9598
|
+
name: "ChevronRight",
|
|
9599
|
+
className: require_MarkdownSurfaces.cn("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open")
|
|
9600
|
+
})
|
|
9907
9601
|
]
|
|
9908
9602
|
});
|
|
9909
9603
|
};
|
|
@@ -9957,7 +9651,8 @@ const CopilotChatSuggestionPill = react.default.forwardRef(function CopilotChatS
|
|
|
9957
9651
|
...props,
|
|
9958
9652
|
children: [isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
9959
9653
|
className: "cpk-suggestion-pill-icon",
|
|
9960
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9654
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9655
|
+
name: "Loader2",
|
|
9961
9656
|
className: "cpk-suggestion-pill-spinner",
|
|
9962
9657
|
"aria-hidden": "true"
|
|
9963
9658
|
})
|
|
@@ -10074,14 +9769,6 @@ const ScrollPinnedContext = react.default.createContext(false);
|
|
|
10074
9769
|
|
|
10075
9770
|
//#endregion
|
|
10076
9771
|
//#region src/components/chat/CopilotChatWorkSummary.tsx
|
|
10077
|
-
/** "45s", "1m 5s", "2m". Used for the live timer and the final duration. */
|
|
10078
|
-
function formatDuration(ms) {
|
|
10079
|
-
const seconds = Math.max(0, Math.floor(ms / 1e3));
|
|
10080
|
-
if (seconds < 60) return `${seconds}s`;
|
|
10081
|
-
const minutes = Math.floor(seconds / 60);
|
|
10082
|
-
const rest = seconds % 60;
|
|
10083
|
-
return rest ? `${minutes}m ${rest}s` : `${minutes}m`;
|
|
10084
|
-
}
|
|
10085
9772
|
/** Re-renders every second while `active`, returning the current time. */
|
|
10086
9773
|
function useNow(active) {
|
|
10087
9774
|
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
@@ -10095,14 +9782,20 @@ function useNow(active) {
|
|
|
10095
9782
|
}
|
|
10096
9783
|
/**
|
|
10097
9784
|
* The line at the top of a reply in the `"turn"` tool-call display. While the
|
|
10098
|
-
* agent works it reads "Working 4s"
|
|
10099
|
-
* for 9s
|
|
9785
|
+
* agent works it reads "Working 4s". Once the reply is done it reads "Worked
|
|
9786
|
+
* for 9s" and "7 tools", and toggles the work it folded away. The text comes
|
|
9787
|
+
* from the `workSummary...` and `toolCall...` chat labels.
|
|
10100
9788
|
*/
|
|
10101
9789
|
function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSince, className, ...props }) {
|
|
9790
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
10102
9791
|
const now = useNow(isWorking);
|
|
10103
|
-
const failed =
|
|
9792
|
+
const failed = (0, _copilotkit_core.ɵcountFailedToolCalls)(calls);
|
|
9793
|
+
const toolCount = (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
|
|
9794
|
+
one: labels.toolCallToolCountOne,
|
|
9795
|
+
other: labels.toolCallToolCountOther
|
|
9796
|
+
});
|
|
10104
9797
|
const liveMs = elapsedMs !== void 0 && workingSince !== void 0 ? elapsedMs + Math.max(0, now - workingSince) : void 0;
|
|
10105
|
-
const duration = elapsedMs !== void 0 ?
|
|
9798
|
+
const duration = elapsedMs !== void 0 ? (0, _copilotkit_core.ɵformatWorkDuration)(Math.max(1e3, elapsedMs)) : void 0;
|
|
10106
9799
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
10107
9800
|
type: "button",
|
|
10108
9801
|
"data-copilotkit": true,
|
|
@@ -10113,24 +9806,28 @@ function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSi
|
|
|
10113
9806
|
...props,
|
|
10114
9807
|
children: [isWorking ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10115
9808
|
className: "cpk-work-summary-label cpk-shimmer",
|
|
10116
|
-
children:
|
|
9809
|
+
children: labels.workSummaryWorkingLabel
|
|
10117
9810
|
}), liveMs !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10118
9811
|
className: "cpk-work-summary-detail cpk-work-summary-timer",
|
|
10119
|
-
children:
|
|
9812
|
+
children: (0, _copilotkit_core.ɵformatWorkDuration)(liveMs)
|
|
10120
9813
|
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
10121
9814
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10122
9815
|
className: "cpk-work-summary-label",
|
|
10123
|
-
children: duration ?
|
|
9816
|
+
children: duration ? (0, _copilotkit_core.ɵformatLabel)(labels.workSummaryWorkedForLabel, { duration }) : (0, _copilotkit_core.ɵformatCountLabel)(calls.length, {
|
|
9817
|
+
one: labels.toolCallUsedToolsOne,
|
|
9818
|
+
other: labels.toolCallUsedToolsOther
|
|
9819
|
+
})
|
|
10124
9820
|
}),
|
|
10125
9821
|
duration && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10126
9822
|
className: "cpk-work-summary-detail",
|
|
10127
|
-
children:
|
|
9823
|
+
children: toolCount
|
|
10128
9824
|
}),
|
|
10129
|
-
failed > 0 && /* @__PURE__ */ (0, react_jsx_runtime.
|
|
9825
|
+
failed > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10130
9826
|
className: "cpk-work-summary-failed",
|
|
10131
|
-
children:
|
|
9827
|
+
children: (0, _copilotkit_core.ɵformatLabel)(labels.toolCallFailedCountLabel, { count: failed })
|
|
10132
9828
|
})
|
|
10133
|
-
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
9829
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
9830
|
+
name: "ChevronRight",
|
|
10134
9831
|
"aria-hidden": "true",
|
|
10135
9832
|
className: require_MarkdownSurfaces.cn("cpk-work-summary-chevron", isOpen && "cpk-work-summary-chevron-open")
|
|
10136
9833
|
})]
|
|
@@ -10545,68 +10242,6 @@ const MemoizedCustomMessage = react.default.memo(function MemoizedCustomMessage(
|
|
|
10545
10242
|
if (JSON.stringify(prevProps.stateSnapshot) !== JSON.stringify(nextProps.stateSnapshot)) return false;
|
|
10546
10243
|
return true;
|
|
10547
10244
|
});
|
|
10548
|
-
/**
|
|
10549
|
-
* Deduplicates messages by ID. For assistant messages, merges occurrences:
|
|
10550
|
-
* recovers non-empty content from any earlier occurrence if the latest wiped it
|
|
10551
|
-
* (empty string means the streaming update cleared the field, not blank text),
|
|
10552
|
-
* and similarly recovers toolCalls from earlier occurrences if the latest is
|
|
10553
|
-
* undefined (an empty array [] is treated as intentional and kept as-is).
|
|
10554
|
-
* For all other roles, keeps the last entry.
|
|
10555
|
-
*
|
|
10556
|
-
* @internal Exported for unit testing only — not part of the public API.
|
|
10557
|
-
*/
|
|
10558
|
-
/**
|
|
10559
|
-
* Collapse tool calls that share an id, keeping first-seen order.
|
|
10560
|
-
*
|
|
10561
|
-
* AG-UI's TOOL_CALL_START handler appends to the parent message's `toolCalls`
|
|
10562
|
-
* without checking whether that id is already present. So whenever a start
|
|
10563
|
-
* event is applied twice — which the human-in-the-loop flow triggers when the
|
|
10564
|
-
* run syncs after `respond()` — the message ends up carrying the same call
|
|
10565
|
-
* twice. The second copy has EMPTY `arguments`, because a start event carries
|
|
10566
|
-
* none; the args arrive later as TOOL_CALL_ARGS deltas addressed to the first
|
|
10567
|
-
* copy.
|
|
10568
|
-
*
|
|
10569
|
-
* Left alone that renders the same tool call twice: once populated and once
|
|
10570
|
-
* blank (an approval card with no transaction id, offering live buttons for an
|
|
10571
|
-
* action already taken), and React warns "Encountered two children with the
|
|
10572
|
-
* same key" because the call id is the render key.
|
|
10573
|
-
*
|
|
10574
|
-
* The empty copy is the redundant one, so prefer whichever entry actually
|
|
10575
|
-
* carries arguments rather than blindly taking the first.
|
|
10576
|
-
*/
|
|
10577
|
-
function dedupeToolCalls(toolCalls) {
|
|
10578
|
-
const byId = /* @__PURE__ */ new Map();
|
|
10579
|
-
for (const toolCall of toolCalls) {
|
|
10580
|
-
const existing = byId.get(toolCall.id);
|
|
10581
|
-
if (!existing) {
|
|
10582
|
-
byId.set(toolCall.id, toolCall);
|
|
10583
|
-
continue;
|
|
10584
|
-
}
|
|
10585
|
-
if (!existing.function?.arguments && toolCall.function?.arguments) byId.set(toolCall.id, toolCall);
|
|
10586
|
-
}
|
|
10587
|
-
return byId.size === toolCalls.length ? toolCalls : [...byId.values()];
|
|
10588
|
-
}
|
|
10589
|
-
function deduplicateMessages(messages) {
|
|
10590
|
-
const acc = /* @__PURE__ */ new Map();
|
|
10591
|
-
for (const message of messages) {
|
|
10592
|
-
const existing = acc.get(message.id);
|
|
10593
|
-
if (existing && message.role === "assistant" && existing.role === "assistant") {
|
|
10594
|
-
const content = message.content || existing.content;
|
|
10595
|
-
const toolCalls = message.toolCalls ?? existing.toolCalls;
|
|
10596
|
-
acc.set(message.id, {
|
|
10597
|
-
...existing,
|
|
10598
|
-
...message,
|
|
10599
|
-
content,
|
|
10600
|
-
toolCalls: toolCalls ? dedupeToolCalls(toolCalls) : toolCalls
|
|
10601
|
-
});
|
|
10602
|
-
} else if (message.role === "assistant" && message.toolCalls) acc.set(message.id, {
|
|
10603
|
-
...message,
|
|
10604
|
-
toolCalls: dedupeToolCalls(message.toolCalls)
|
|
10605
|
-
});
|
|
10606
|
-
else acc.set(message.id, message);
|
|
10607
|
-
}
|
|
10608
|
-
return [...acc.values()];
|
|
10609
|
-
}
|
|
10610
10245
|
/** A row holding a single message, rendered as it would be ungrouped. */
|
|
10611
10246
|
function messageRow(message) {
|
|
10612
10247
|
return {
|
|
@@ -10655,7 +10290,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10655
10290
|
if (!resolvedRunId) return void 0;
|
|
10656
10291
|
return copilotkit.getStateByRun(config.agentId, config.threadId, resolvedRunId);
|
|
10657
10292
|
};
|
|
10658
|
-
const deduplicatedMessages = (0, react.useMemo)(() => deduplicateMessages(messages), [messages]);
|
|
10293
|
+
const deduplicatedMessages = (0, react.useMemo)(() => (0, _copilotkit_core.ɵdeduplicateMessages)(messages), [messages]);
|
|
10659
10294
|
const transformedMessages = (0, react.useMemo)(() => transformMessages ? transformMessages(deduplicatedMessages) : deduplicatedMessages, [deduplicatedMessages, transformMessages]);
|
|
10660
10295
|
const rows = (0, react.useMemo)(() => groupMessages ? groupMessages(transformedMessages) : transformedMessages.map(messageRow), [transformedMessages, groupMessages]);
|
|
10661
10296
|
const renderedMessages = (0, react.useMemo)(() => groupMessages ? rows.flatMap((row) => row.type === "group" ? row.messages : [row.message]) : transformedMessages, [
|
|
@@ -10665,13 +10300,13 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10665
10300
|
]);
|
|
10666
10301
|
const latestRenderedId = renderedMessages[renderedMessages.length - 1]?.id;
|
|
10667
10302
|
const rendererNames = useToolCallRendererNames();
|
|
10668
|
-
const toolCallLayouts = (0, react.useMemo)(() => toolCallDisplay === "separate" ? /* @__PURE__ */ new Map() : getToolCallLayouts(renderedMessages, messages, rendererNames), [
|
|
10303
|
+
const toolCallLayouts = (0, react.useMemo)(() => toolCallDisplay === "separate" ? /* @__PURE__ */ new Map() : (0, _copilotkit_core.ɵgetToolCallLayouts)(renderedMessages, messages, rendererNames), [
|
|
10669
10304
|
toolCallDisplay,
|
|
10670
10305
|
renderedMessages,
|
|
10671
10306
|
messages,
|
|
10672
10307
|
rendererNames
|
|
10673
10308
|
]);
|
|
10674
|
-
const turnWork = (0, react.useMemo)(() => toolCallDisplay === "turn" ? getTurnWork(renderedMessages, toolCallLayouts) : void 0, [
|
|
10309
|
+
const turnWork = (0, react.useMemo)(() => toolCallDisplay === "turn" ? (0, _copilotkit_core.ɵgetTurnWork)(renderedMessages, toolCallLayouts) : void 0, [
|
|
10675
10310
|
toolCallDisplay,
|
|
10676
10311
|
renderedMessages,
|
|
10677
10312
|
toolCallLayouts
|
|
@@ -10681,46 +10316,25 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10681
10316
|
for (const turn of turnWork?.values() ?? []) byFirst.set(turn.firstMessageId, turn);
|
|
10682
10317
|
return byFirst;
|
|
10683
10318
|
}, [turnWork]);
|
|
10684
|
-
|
|
10685
|
-
for (let i = renderedMessages.length - 1; i >= 0; i--) if (renderedMessages[i].role === "user") {
|
|
10686
|
-
latestTurnKey = renderedMessages[i].id;
|
|
10687
|
-
break;
|
|
10688
|
-
}
|
|
10689
|
-
const isWorkingOn = (turnKey) => isRunning && turnKey === latestTurnKey;
|
|
10319
|
+
const latestTurnKey = (0, _copilotkit_core.ɵgetLatestTurnKey)(renderedMessages);
|
|
10690
10320
|
const [toggledTurns, setToggledTurns] = (0, react.useState)(() => /* @__PURE__ */ new Map());
|
|
10691
|
-
const
|
|
10321
|
+
const turnState = {
|
|
10322
|
+
toggledTurns,
|
|
10323
|
+
isRunning,
|
|
10324
|
+
latestTurnKey
|
|
10325
|
+
};
|
|
10692
10326
|
const workTimesRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
10693
|
-
if (toolCallDisplay === "turn") {
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
if (times.workingSince === void 0) continue;
|
|
10705
|
-
times.elapsedMs += now - times.workingSince;
|
|
10706
|
-
times.workingSince = void 0;
|
|
10707
|
-
}
|
|
10708
|
-
}
|
|
10709
|
-
const { workOpen, workTextOpen } = (0, react.useMemo)(() => {
|
|
10710
|
-
const open = /* @__PURE__ */ new Map();
|
|
10711
|
-
const textOpen = /* @__PURE__ */ new Map();
|
|
10712
|
-
for (const turn of turnWork?.values() ?? []) {
|
|
10713
|
-
const turnOpen = toggledTurns.get(turn.key) ?? (isRunning && turn.key === latestTurnKey);
|
|
10714
|
-
for (const id of turn.workMessageIds) {
|
|
10715
|
-
open.set(id, turnOpen);
|
|
10716
|
-
if (id !== turn.replyTextMessageId) textOpen.set(id, turnOpen);
|
|
10717
|
-
}
|
|
10718
|
-
}
|
|
10719
|
-
return {
|
|
10720
|
-
workOpen: open,
|
|
10721
|
-
workTextOpen: textOpen
|
|
10722
|
-
};
|
|
10723
|
-
}, [
|
|
10327
|
+
if (toolCallDisplay === "turn") (0, _copilotkit_core.ɵrecordWorkTime)(workTimesRef.current, {
|
|
10328
|
+
isRunning,
|
|
10329
|
+
latestTurnKey,
|
|
10330
|
+
lastMessageRole: renderedMessages[renderedMessages.length - 1]?.role,
|
|
10331
|
+
now: Date.now()
|
|
10332
|
+
});
|
|
10333
|
+
const { workOpen, workTextOpen } = (0, react.useMemo)(() => (0, _copilotkit_core.ɵgetWorkOpenState)(turnWork?.values() ?? [], {
|
|
10334
|
+
toggledTurns,
|
|
10335
|
+
isRunning,
|
|
10336
|
+
latestTurnKey
|
|
10337
|
+
}), [
|
|
10724
10338
|
turnWork,
|
|
10725
10339
|
toggledTurns,
|
|
10726
10340
|
isRunning,
|
|
@@ -10740,8 +10354,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10740
10354
|
workTextOpen
|
|
10741
10355
|
]);
|
|
10742
10356
|
const renderWorkSummary = (turnKey, calls) => {
|
|
10743
|
-
const working =
|
|
10744
|
-
const open =
|
|
10357
|
+
const working = (0, _copilotkit_core.ɵisTurnWorking)(turnKey, turnState);
|
|
10358
|
+
const open = (0, _copilotkit_core.ɵisTurnWorkOpen)(turnKey, turnState);
|
|
10745
10359
|
const times = workTimesRef.current.get(turnKey);
|
|
10746
10360
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collapsible, {
|
|
10747
10361
|
open: working || calls.length > 0,
|
|
@@ -11168,7 +10782,7 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
|
|
|
11168
10782
|
* button named by `labels.attachmentRemoveButtonLabel`.
|
|
11169
10783
|
*/
|
|
11170
10784
|
const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className }) => {
|
|
11171
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
10785
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11172
10786
|
if (attachments.length === 0) return null;
|
|
11173
10787
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11174
10788
|
"data-testid": "copilot-attachment-queue",
|
|
@@ -11244,7 +10858,7 @@ function AudioPreview({ attachment }) {
|
|
|
11244
10858
|
* lightbox.
|
|
11245
10859
|
*/
|
|
11246
10860
|
function VideoPreview({ attachment }) {
|
|
11247
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
10861
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11248
10862
|
const src = (0, _copilotkit_shared.getSourceUrl)(attachment.source);
|
|
11249
10863
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
11250
10864
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -11268,7 +10882,10 @@ function VideoPreview({ attachment }) {
|
|
|
11268
10882
|
"aria-label": labels.attachmentPlayVideoButtonLabel,
|
|
11269
10883
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11270
10884
|
className: "cpk-attachment-queue-video-play-badge",
|
|
11271
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
10885
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
10886
|
+
name: "Play",
|
|
10887
|
+
className: "cpk-attachment-queue-video-play-icon"
|
|
10888
|
+
})
|
|
11272
10889
|
})
|
|
11273
10890
|
}),
|
|
11274
10891
|
open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Lightbox, {
|
|
@@ -11321,6 +10938,7 @@ function useBlobUrl(attachment) {
|
|
|
11321
10938
|
return url;
|
|
11322
10939
|
}
|
|
11323
10940
|
function DocumentLightboxContent({ attachment, vtName }) {
|
|
10941
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11324
10942
|
const mimeType = attachment.source.mimeType;
|
|
11325
10943
|
const blobUrl = useBlobUrl(attachment);
|
|
11326
10944
|
if (isPdf(mimeType)) {
|
|
@@ -11368,20 +10986,21 @@ function DocumentLightboxContent({ attachment, vtName }) {
|
|
|
11368
10986
|
className: "cpk-attachment-queue-document-card-details",
|
|
11369
10987
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11370
10988
|
className: "cpk-attachment-queue-document-card-name",
|
|
11371
|
-
children: attachment.filename ||
|
|
10989
|
+
children: attachment.filename || labels.attachmentDocumentLabel
|
|
11372
10990
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11373
10991
|
className: "cpk-attachment-queue-document-card-meta",
|
|
11374
|
-
children: [mimeType ||
|
|
10992
|
+
children: [mimeType || labels.attachmentUnknownTypeText, attachment.size != null && ` · ${(0, _copilotkit_shared.formatFileSize)(attachment.size)}`]
|
|
11375
10993
|
})]
|
|
11376
10994
|
}),
|
|
11377
10995
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11378
10996
|
className: "cpk-attachment-queue-document-card-note",
|
|
11379
|
-
children:
|
|
10997
|
+
children: labels.attachmentNoPreviewText
|
|
11380
10998
|
})
|
|
11381
10999
|
]
|
|
11382
11000
|
});
|
|
11383
11001
|
}
|
|
11384
11002
|
function DocumentPreview({ attachment }) {
|
|
11003
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11385
11004
|
const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
|
|
11386
11005
|
const mimeType = attachment.source.mimeType;
|
|
11387
11006
|
const previewable = canPreviewInBrowser(mimeType);
|
|
@@ -11396,7 +11015,7 @@ function DocumentPreview({ attachment }) {
|
|
|
11396
11015
|
className: "cpk-attachment-queue-document-info",
|
|
11397
11016
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11398
11017
|
className: "cpk-attachment-queue-document-name",
|
|
11399
|
-
children: attachment.filename ||
|
|
11018
|
+
children: attachment.filename || labels.attachmentDocumentLabel
|
|
11400
11019
|
}), attachment.size != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11401
11020
|
className: "cpk-attachment-queue-document-size",
|
|
11402
11021
|
children: (0, _copilotkit_shared.formatFileSize)(attachment.size)
|
|
@@ -11533,13 +11152,17 @@ function computeOffsetTop(el, stopAt) {
|
|
|
11533
11152
|
//#region src/components/chat/CopilotChatView.tsx
|
|
11534
11153
|
const SCROLL_BUTTON_OFFSET = 16;
|
|
11535
11154
|
function DropOverlay() {
|
|
11155
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11536
11156
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11537
11157
|
className: "cpk-chat-view-drop-overlay",
|
|
11538
11158
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
11539
11159
|
className: "cpk-chat-view-drop-overlay-content",
|
|
11540
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
11160
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
11161
|
+
name: "Upload",
|
|
11162
|
+
className: "cpk-chat-view-drop-overlay-icon"
|
|
11163
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11541
11164
|
className: "cpk-chat-view-drop-overlay-label",
|
|
11542
|
-
children:
|
|
11165
|
+
children: labels.chatDropFilesLabel
|
|
11543
11166
|
})]
|
|
11544
11167
|
})
|
|
11545
11168
|
});
|
|
@@ -11979,7 +11602,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
11979
11602
|
});
|
|
11980
11603
|
};
|
|
11981
11604
|
_CopilotChatView.ScrollToBottomButton = ({ className, ...props }) => {
|
|
11982
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
11605
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11983
11606
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
11984
11607
|
"data-testid": "copilot-scroll-to-bottom",
|
|
11985
11608
|
variant: "outline",
|
|
@@ -11987,7 +11610,10 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
11987
11610
|
className: require_MarkdownSurfaces.cn("cpk-chat-view-scroll-to-bottom-button", className),
|
|
11988
11611
|
"aria-label": labels.chatScrollToBottomLabel,
|
|
11989
11612
|
...props,
|
|
11990
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
11613
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
11614
|
+
name: "ChevronDown",
|
|
11615
|
+
className: "cpk-chat-view-scroll-to-bottom-icon"
|
|
11616
|
+
})
|
|
11991
11617
|
});
|
|
11992
11618
|
};
|
|
11993
11619
|
_CopilotChatView.Feather = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -11995,7 +11621,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
11995
11621
|
...props
|
|
11996
11622
|
});
|
|
11997
11623
|
_CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
|
|
11998
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
11624
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
11999
11625
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
12000
11626
|
className: require_MarkdownSurfaces.cn("cpk-chat-view-welcome-message", className),
|
|
12001
11627
|
...props,
|
|
@@ -12041,119 +11667,6 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
|
|
|
12041
11667
|
})(CopilotChatView || (CopilotChatView = {}));
|
|
12042
11668
|
var CopilotChatView_default = CopilotChatView;
|
|
12043
11669
|
|
|
12044
|
-
//#endregion
|
|
12045
|
-
//#region src/lib/transcription-client.ts
|
|
12046
|
-
/**
|
|
12047
|
-
* Convert a Blob to a base64 string
|
|
12048
|
-
*/
|
|
12049
|
-
async function blobToBase64(blob) {
|
|
12050
|
-
return new Promise((resolve, reject) => {
|
|
12051
|
-
const reader = new FileReader();
|
|
12052
|
-
reader.onloadend = () => {
|
|
12053
|
-
const base64 = reader.result.split(",")[1];
|
|
12054
|
-
resolve(base64 ?? "");
|
|
12055
|
-
};
|
|
12056
|
-
reader.onerror = () => reject(/* @__PURE__ */ new Error("Failed to read audio data"));
|
|
12057
|
-
reader.readAsDataURL(blob);
|
|
12058
|
-
});
|
|
12059
|
-
}
|
|
12060
|
-
/**
|
|
12061
|
-
* Check if an error response matches our expected format
|
|
12062
|
-
*/
|
|
12063
|
-
function isTranscriptionErrorResponse(data) {
|
|
12064
|
-
return typeof data === "object" && data !== null && "error" in data && "message" in data && typeof data.error === "string" && typeof data.message === "string";
|
|
12065
|
-
}
|
|
12066
|
-
/**
|
|
12067
|
-
* Parse error info from a transcription error response
|
|
12068
|
-
*/
|
|
12069
|
-
function parseTranscriptionError(response) {
|
|
12070
|
-
return {
|
|
12071
|
-
code: response.error,
|
|
12072
|
-
message: response.message,
|
|
12073
|
-
retryable: response.retryable ?? false
|
|
12074
|
-
};
|
|
12075
|
-
}
|
|
12076
|
-
/**
|
|
12077
|
-
* Custom error type for transcription failures.
|
|
12078
|
-
* Extends Error with transcription-specific info for contextual error handling.
|
|
12079
|
-
*/
|
|
12080
|
-
var TranscriptionError = class extends Error {
|
|
12081
|
-
constructor(info) {
|
|
12082
|
-
super(info.message);
|
|
12083
|
-
this.name = "TranscriptionError";
|
|
12084
|
-
this.info = info;
|
|
12085
|
-
}
|
|
12086
|
-
};
|
|
12087
|
-
/**
|
|
12088
|
-
* Transcribe an audio blob using the CopilotKit runtime
|
|
12089
|
-
*
|
|
12090
|
-
* Supports both REST mode (multipart/form-data) and single-endpoint mode (base64 JSON)
|
|
12091
|
-
*
|
|
12092
|
-
* @throws {TranscriptionError} When transcription fails with typed error information
|
|
12093
|
-
*/
|
|
12094
|
-
async function transcribeAudio(core, audioBlob, filename = "recording.webm") {
|
|
12095
|
-
const runtimeUrl = core.runtimeUrl;
|
|
12096
|
-
if (!runtimeUrl) throw new TranscriptionError({
|
|
12097
|
-
code: _copilotkit_shared.TranscriptionErrorCode.INVALID_REQUEST,
|
|
12098
|
-
message: "Runtime URL is not configured",
|
|
12099
|
-
retryable: false
|
|
12100
|
-
});
|
|
12101
|
-
const headers = { ...await core.resolveHeaders() };
|
|
12102
|
-
let response;
|
|
12103
|
-
try {
|
|
12104
|
-
if (core.runtimeTransport === "single") {
|
|
12105
|
-
const base64Audio = await blobToBase64(audioBlob);
|
|
12106
|
-
headers["Content-Type"] = "application/json";
|
|
12107
|
-
response = await fetch(runtimeUrl, {
|
|
12108
|
-
method: "POST",
|
|
12109
|
-
headers,
|
|
12110
|
-
body: JSON.stringify({
|
|
12111
|
-
method: "transcribe",
|
|
12112
|
-
body: {
|
|
12113
|
-
audio: base64Audio,
|
|
12114
|
-
mimeType: audioBlob.type || "audio/webm",
|
|
12115
|
-
filename
|
|
12116
|
-
}
|
|
12117
|
-
})
|
|
12118
|
-
});
|
|
12119
|
-
} else {
|
|
12120
|
-
delete headers["Content-Type"];
|
|
12121
|
-
const formData = new FormData();
|
|
12122
|
-
formData.append("audio", audioBlob, filename);
|
|
12123
|
-
response = await fetch(`${runtimeUrl}/transcribe`, {
|
|
12124
|
-
method: "POST",
|
|
12125
|
-
headers,
|
|
12126
|
-
body: formData
|
|
12127
|
-
});
|
|
12128
|
-
}
|
|
12129
|
-
} catch (error) {
|
|
12130
|
-
throw new TranscriptionError({
|
|
12131
|
-
code: _copilotkit_shared.TranscriptionErrorCode.NETWORK_ERROR,
|
|
12132
|
-
message: error instanceof Error ? error.message : "Network request failed",
|
|
12133
|
-
retryable: true
|
|
12134
|
-
});
|
|
12135
|
-
}
|
|
12136
|
-
if (!response.ok) {
|
|
12137
|
-
let errorData;
|
|
12138
|
-
try {
|
|
12139
|
-
errorData = await response.json();
|
|
12140
|
-
} catch {
|
|
12141
|
-
throw new TranscriptionError({
|
|
12142
|
-
code: _copilotkit_shared.TranscriptionErrorCode.PROVIDER_ERROR,
|
|
12143
|
-
message: `HTTP ${response.status}: ${response.statusText}`,
|
|
12144
|
-
retryable: response.status >= 500
|
|
12145
|
-
});
|
|
12146
|
-
}
|
|
12147
|
-
if (isTranscriptionErrorResponse(errorData)) throw new TranscriptionError(parseTranscriptionError(errorData));
|
|
12148
|
-
throw new TranscriptionError({
|
|
12149
|
-
code: _copilotkit_shared.TranscriptionErrorCode.PROVIDER_ERROR,
|
|
12150
|
-
message: typeof errorData === "object" && errorData !== null && "message" in errorData ? String(errorData.message) : "Transcription failed",
|
|
12151
|
-
retryable: response.status >= 500
|
|
12152
|
-
});
|
|
12153
|
-
}
|
|
12154
|
-
return await response.json();
|
|
12155
|
-
}
|
|
12156
|
-
|
|
12157
11670
|
//#endregion
|
|
12158
11671
|
//#region src/providers/use-inspector-thread-override.ts
|
|
12159
11672
|
function useInspectorThreadOverride(args) {
|
|
@@ -12635,7 +12148,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12635
12148
|
}
|
|
12636
12149
|
if (!isCurrentSelection()) return false;
|
|
12637
12150
|
if (failedConnectionsRef.current.has(agent)) {
|
|
12638
|
-
setTranscriptionError(
|
|
12151
|
+
setTranscriptionError({ labelKey: "threadLoadErrorText" });
|
|
12639
12152
|
return "failed";
|
|
12640
12153
|
}
|
|
12641
12154
|
const maybeAware = agent;
|
|
@@ -12660,7 +12173,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12660
12173
|
const onSubmitInput = (0, react.useCallback)(async (value) => {
|
|
12661
12174
|
if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
|
|
12662
12175
|
console.error("[CopilotKit] Cannot send while attachments are uploading (pre-await guard)");
|
|
12663
|
-
setTranscriptionError(
|
|
12176
|
+
setTranscriptionError({ labelKey: "chatAttachmentsUploadingText" });
|
|
12664
12177
|
return;
|
|
12665
12178
|
}
|
|
12666
12179
|
setInputValue("");
|
|
@@ -12672,7 +12185,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12672
12185
|
}
|
|
12673
12186
|
if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
|
|
12674
12187
|
console.error("[CopilotKit] Cannot send while attachments are uploading (post-await re-check)");
|
|
12675
|
-
setTranscriptionError(
|
|
12188
|
+
setTranscriptionError({ labelKey: "chatAttachmentsUploadingText" });
|
|
12676
12189
|
setInputValue(value);
|
|
12677
12190
|
return;
|
|
12678
12191
|
}
|
|
@@ -12790,7 +12303,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12790
12303
|
setIsTranscribing(true);
|
|
12791
12304
|
try {
|
|
12792
12305
|
setTranscriptionError(null);
|
|
12793
|
-
const result = await transcribeAudio(copilotkit, audioBlob);
|
|
12306
|
+
const result = await (0, _copilotkit_core.ɵtranscribeAudio)(copilotkit, audioBlob);
|
|
12794
12307
|
setInputValue((prev) => {
|
|
12795
12308
|
const trimmedPrev = prev.trim();
|
|
12796
12309
|
if (trimmedPrev) return `${trimmedPrev} ${result.text}`;
|
|
@@ -12798,33 +12311,10 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12798
12311
|
});
|
|
12799
12312
|
} catch (error) {
|
|
12800
12313
|
console.error("CopilotChat: Transcription failed", error);
|
|
12801
|
-
if (error instanceof TranscriptionError) {
|
|
12802
|
-
const
|
|
12803
|
-
|
|
12804
|
-
|
|
12805
|
-
setTranscriptionError("Too many requests. Please wait a moment.");
|
|
12806
|
-
break;
|
|
12807
|
-
case _copilotkit_shared.TranscriptionErrorCode.AUTH_FAILED:
|
|
12808
|
-
setTranscriptionError("Authentication error. Please check your configuration.");
|
|
12809
|
-
break;
|
|
12810
|
-
case _copilotkit_shared.TranscriptionErrorCode.AUDIO_TOO_LONG:
|
|
12811
|
-
setTranscriptionError("Recording is too long. Please try a shorter recording.");
|
|
12812
|
-
break;
|
|
12813
|
-
case _copilotkit_shared.TranscriptionErrorCode.AUDIO_TOO_SHORT:
|
|
12814
|
-
setTranscriptionError("Recording is too short. Please try again.");
|
|
12815
|
-
break;
|
|
12816
|
-
case _copilotkit_shared.TranscriptionErrorCode.INVALID_AUDIO_FORMAT:
|
|
12817
|
-
setTranscriptionError("Audio format not supported.");
|
|
12818
|
-
break;
|
|
12819
|
-
case _copilotkit_shared.TranscriptionErrorCode.SERVICE_NOT_CONFIGURED:
|
|
12820
|
-
setTranscriptionError("Transcription service is not available.");
|
|
12821
|
-
break;
|
|
12822
|
-
case _copilotkit_shared.TranscriptionErrorCode.NETWORK_ERROR:
|
|
12823
|
-
setTranscriptionError("Network error. Please check your connection.");
|
|
12824
|
-
break;
|
|
12825
|
-
default: setTranscriptionError(retryable ? "Transcription failed. Please try again." : message);
|
|
12826
|
-
}
|
|
12827
|
-
} else setTranscriptionError("Transcription failed. Please try again.");
|
|
12314
|
+
if (error instanceof _copilotkit_core.TranscriptionError) {
|
|
12315
|
+
const labelKey = (0, _copilotkit_core.ɵtranscriptionErrorMessageKey)(error.info);
|
|
12316
|
+
setTranscriptionError(labelKey ? { labelKey } : { text: error.info.message });
|
|
12317
|
+
} else setTranscriptionError({ labelKey: "transcriptionErrorGenericText" });
|
|
12828
12318
|
} finally {
|
|
12829
12319
|
setIsTranscribing(false);
|
|
12830
12320
|
}
|
|
@@ -12856,11 +12346,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12856
12346
|
const effectiveStopHandler = agent.isRunning && hasMessages ? providedStopHandler ?? stopCurrentRun : providedStopHandler;
|
|
12857
12347
|
const showTranscription = isTranscriptionEnabled && isMediaRecorderSupported;
|
|
12858
12348
|
const effectiveMode = isTranscribing ? "processing" : transcribeMode;
|
|
12859
|
-
const messages = (0, react.useMemo)(() => [...agent.messages], [agent.messages
|
|
12860
|
-
const contentKey = typeof m.content === "string" ? m.content.length : Array.isArray(m.content) ? m.content.length : m.content && typeof m.content === "object" ? JSON.stringify(m.content) : 0;
|
|
12861
|
-
const toolCallsKey = "toolCalls" in m && Array.isArray(m.toolCalls) ? m.toolCalls.map((tc) => `${tc.id}:${tc.function?.arguments?.length ?? 0}`).join(";") : "";
|
|
12862
|
-
return `${m.id}:${m.role}:${contentKey}:${toolCallsKey}`;
|
|
12863
|
-
}).join(",")]);
|
|
12349
|
+
const messages = (0, react.useMemo)(() => [...agent.messages], [(0, _copilotkit_core.ɵmessagesFingerprint)(agent.messages)]);
|
|
12864
12350
|
const lastUserMessageId = (0, react.useMemo)(() => {
|
|
12865
12351
|
for (let i = messages.length - 1; i >= 0; i--) if (messages[i].role === "user") return messages[i].id;
|
|
12866
12352
|
return null;
|
|
@@ -12932,7 +12418,11 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12932
12418
|
fontSize: "14px",
|
|
12933
12419
|
zIndex: 50
|
|
12934
12420
|
},
|
|
12935
|
-
children: transcriptionError
|
|
12421
|
+
children: "labelKey" in transcriptionError ? {
|
|
12422
|
+
..._copilotkit_core.CopilotChatDefaultLabels,
|
|
12423
|
+
...existingConfig?.labels,
|
|
12424
|
+
...labels
|
|
12425
|
+
}[transcriptionError.labelKey] : transcriptionError.text
|
|
12936
12426
|
}),
|
|
12937
12427
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LastUserMessageContext.Provider, {
|
|
12938
12428
|
value: lastUserMessageState,
|
|
@@ -12955,16 +12445,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
|
|
|
12955
12445
|
//#endregion
|
|
12956
12446
|
//#region src/components/chat/CopilotChatToggleButton.tsx
|
|
12957
12447
|
const ICON_CLASS = "cpk-chat-toggle-button-icon";
|
|
12958
|
-
const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
12448
|
+
const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
12959
12449
|
className: className ?? ICON_CLASS,
|
|
12960
12450
|
strokeWidth: 1.75,
|
|
12961
12451
|
fill: "currentColor",
|
|
12962
|
-
...props
|
|
12452
|
+
...props,
|
|
12453
|
+
name: "MessageCircle"
|
|
12963
12454
|
});
|
|
12964
|
-
const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
12455
|
+
const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
12965
12456
|
className: className ?? ICON_CLASS,
|
|
12966
12457
|
strokeWidth: 1.75,
|
|
12967
|
-
...props
|
|
12458
|
+
...props,
|
|
12459
|
+
name: "X"
|
|
12968
12460
|
});
|
|
12969
12461
|
DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
|
|
12970
12462
|
DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
|
|
@@ -12973,7 +12465,7 @@ const ICON_WRAPPER_CLASS = "cpk-chat-toggle-button-icon-wrapper";
|
|
|
12973
12465
|
const CopilotChatToggleButton = react.default.forwardRef(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {
|
|
12974
12466
|
const { onClick, type, disabled, ...restProps } = buttonProps;
|
|
12975
12467
|
const configuration = require_MarkdownSurfaces.useCopilotChatConfiguration();
|
|
12976
|
-
const labels = configuration?.labels ??
|
|
12468
|
+
const labels = configuration?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
12977
12469
|
const [fallbackOpen, setFallbackOpen] = (0, react.useState)(false);
|
|
12978
12470
|
const isOpen = configuration?.isModalOpen ?? fallbackOpen;
|
|
12979
12471
|
const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;
|
|
@@ -13090,7 +12582,7 @@ function useIsMobileViewport() {
|
|
|
13090
12582
|
}
|
|
13091
12583
|
function CopilotModalHeader({ title, titleContent, closeButton, drawerLauncher, children, className, ...rest }) {
|
|
13092
12584
|
const configuration = require_MarkdownSurfaces.useCopilotChatConfiguration();
|
|
13093
|
-
const fallbackTitle = configuration?.labels.modalHeaderTitle ??
|
|
12585
|
+
const fallbackTitle = configuration?.labels.modalHeaderTitle ?? _copilotkit_core.CopilotChatDefaultLabels.modalHeaderTitle;
|
|
13094
12586
|
const resolvedTitle = title ?? fallbackTitle;
|
|
13095
12587
|
const isMobile = useIsMobileViewport();
|
|
13096
12588
|
const drawerRegistered = (configuration?.drawerRegistered ?? false) && isMobile;
|
|
@@ -13146,28 +12638,30 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
|
13146
12638
|
children
|
|
13147
12639
|
});
|
|
13148
12640
|
_CopilotModalHeader.CloseButton = ({ className, ...props }) => {
|
|
13149
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
12641
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
13150
12642
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
13151
12643
|
type: "button",
|
|
13152
12644
|
"data-testid": "copilot-close-button",
|
|
13153
12645
|
className: require_MarkdownSurfaces.cn("cpk-modal-header-close-button", className),
|
|
13154
12646
|
"aria-label": labels.modalHeaderCloseButtonLabel,
|
|
13155
12647
|
...props,
|
|
13156
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
12648
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
12649
|
+
name: "X",
|
|
13157
12650
|
className: "cpk-modal-header-close-icon",
|
|
13158
12651
|
"aria-hidden": "true"
|
|
13159
12652
|
})
|
|
13160
12653
|
});
|
|
13161
12654
|
};
|
|
13162
12655
|
_CopilotModalHeader.DrawerLauncher = ({ className, ...props }) => {
|
|
13163
|
-
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ??
|
|
12656
|
+
const labels = require_MarkdownSurfaces.useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
13164
12657
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
13165
12658
|
type: "button",
|
|
13166
12659
|
"data-testid": "copilot-threads-drawer-launcher",
|
|
13167
12660
|
className: require_MarkdownSurfaces.cn("cpk-modal-header-drawer-launcher", className),
|
|
13168
12661
|
"aria-label": labels.modalHeaderThreadsButtonLabel,
|
|
13169
12662
|
...props,
|
|
13170
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
12663
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.CopilotIcon, {
|
|
12664
|
+
name: "PanelLeftOpen",
|
|
13171
12665
|
className: "cpk-modal-header-drawer-launcher-icon",
|
|
13172
12666
|
"aria-hidden": "true"
|
|
13173
12667
|
})
|
|
@@ -13272,7 +12766,7 @@ function CopilotSidebarViewInternal({ header, toggleButton, width, position = "r
|
|
|
13272
12766
|
paddingBottom: "env(safe-area-inset-bottom)"
|
|
13273
12767
|
},
|
|
13274
12768
|
"aria-hidden": !isSidebarOpen,
|
|
13275
|
-
"aria-label": configuration?.labels.sidebarLabel ??
|
|
12769
|
+
"aria-label": configuration?.labels.sidebarLabel ?? _copilotkit_core.CopilotChatDefaultLabels.sidebarLabel,
|
|
13276
12770
|
role: "complementary",
|
|
13277
12771
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
13278
12772
|
className: "cpk-sidebar-view-panel",
|
|
@@ -13353,7 +12847,7 @@ function CopilotPopupViewInternal({ header, toggleButton, width, height, clickOu
|
|
|
13353
12847
|
const configuration = require_MarkdownSurfaces.useCopilotChatConfiguration();
|
|
13354
12848
|
const isPopupOpen = configuration?.isModalOpen ?? false;
|
|
13355
12849
|
const setModalOpen = configuration?.setModalOpen;
|
|
13356
|
-
const labels = configuration?.labels ??
|
|
12850
|
+
const labels = configuration?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
13357
12851
|
const containerRef = (0, react.useRef)(null);
|
|
13358
12852
|
const [isRendered, setIsRendered] = (0, react.useState)(isPopupOpen);
|
|
13359
12853
|
const [isAnimatingOut, setIsAnimatingOut] = (0, react.useState)(false);
|
|
@@ -14060,7 +13554,6 @@ Object.defineProperty(exports, 'BaseMessageSchema', {
|
|
|
14060
13554
|
return _ag_ui_core_schemas.BaseMessageSchema;
|
|
14061
13555
|
}
|
|
14062
13556
|
});
|
|
14063
|
-
exports.BasicMarkdownRenderer = BasicMarkdownRenderer;
|
|
14064
13557
|
Object.defineProperty(exports, 'CompatibilityBoundary', {
|
|
14065
13558
|
enumerable: true,
|
|
14066
13559
|
get: function () {
|
|
@@ -14096,6 +13589,12 @@ exports.CopilotChatAttachmentQueue = CopilotChatAttachmentQueue;
|
|
|
14096
13589
|
exports.CopilotChatAttachmentRenderer = CopilotChatAttachmentRenderer;
|
|
14097
13590
|
exports.CopilotChatAudioRecorder = CopilotChatAudioRecorder;
|
|
14098
13591
|
exports.CopilotChatConfigurationProvider = require_MarkdownSurfaces.CopilotChatConfigurationProvider;
|
|
13592
|
+
Object.defineProperty(exports, 'CopilotChatDefaultLabels', {
|
|
13593
|
+
enumerable: true,
|
|
13594
|
+
get: function () {
|
|
13595
|
+
return _copilotkit_core.CopilotChatDefaultLabels;
|
|
13596
|
+
}
|
|
13597
|
+
});
|
|
14099
13598
|
exports.CopilotChatInput = CopilotChatInput_default;
|
|
14100
13599
|
exports.CopilotChatMessageView = CopilotChatMessageView;
|
|
14101
13600
|
exports.CopilotChatReasoningMessage = CopilotChatReasoningMessage_default;
|
|
@@ -14280,7 +13779,12 @@ Object.defineProperty(exports, 'INSPECTOR_THREAD_BRIDGE_PLUGIN_ID', {
|
|
|
14280
13779
|
}
|
|
14281
13780
|
});
|
|
14282
13781
|
exports.INTELLIGENCE_TURN_HEAD = INTELLIGENCE_TURN_HEAD;
|
|
14283
|
-
exports
|
|
13782
|
+
Object.defineProperty(exports, 'INTERRUPT_EVENT_NAME', {
|
|
13783
|
+
enumerable: true,
|
|
13784
|
+
get: function () {
|
|
13785
|
+
return _copilotkit_core.INTERRUPT_EVENT_NAME;
|
|
13786
|
+
}
|
|
13787
|
+
});
|
|
14284
13788
|
Object.defineProperty(exports, 'IdentityCapabilitiesSchema', {
|
|
14285
13789
|
enumerable: true,
|
|
14286
13790
|
get: function () {
|
|
@@ -14837,6 +14341,18 @@ Object.defineProperty(exports, 'ToolsCapabilitiesSchema', {
|
|
|
14837
14341
|
return _ag_ui_core_schemas.ToolsCapabilitiesSchema;
|
|
14838
14342
|
}
|
|
14839
14343
|
});
|
|
14344
|
+
Object.defineProperty(exports, 'TranscriptionError', {
|
|
14345
|
+
enumerable: true,
|
|
14346
|
+
get: function () {
|
|
14347
|
+
return _copilotkit_core.TranscriptionError;
|
|
14348
|
+
}
|
|
14349
|
+
});
|
|
14350
|
+
Object.defineProperty(exports, 'TranscriptionErrorCode', {
|
|
14351
|
+
enumerable: true,
|
|
14352
|
+
get: function () {
|
|
14353
|
+
return _copilotkit_core.TranscriptionErrorCode;
|
|
14354
|
+
}
|
|
14355
|
+
});
|
|
14840
14356
|
Object.defineProperty(exports, 'TransportCapabilitiesSchema', {
|
|
14841
14357
|
enumerable: true,
|
|
14842
14358
|
get: function () {
|
|
@@ -15162,12 +14678,6 @@ Object.defineProperty(exports, 'onInspectorViewThreadResult', {
|
|
|
15162
14678
|
return _copilotkit_core.onInspectorViewThreadResult;
|
|
15163
14679
|
}
|
|
15164
14680
|
});
|
|
15165
|
-
Object.defineProperty(exports, 'parseMarkdown', {
|
|
15166
|
-
enumerable: true,
|
|
15167
|
-
get: function () {
|
|
15168
|
-
return _copilotkit_core.parseMarkdown;
|
|
15169
|
-
}
|
|
15170
|
-
});
|
|
15171
14681
|
Object.defineProperty(exports, 'parseProtoStream', {
|
|
15172
14682
|
enumerable: true,
|
|
15173
14683
|
get: function () {
|
|
@@ -15290,8 +14800,6 @@ exports.useHumanInTheLoop = useHumanInTheLoop;
|
|
|
15290
14800
|
exports.useInterrupt = useInterrupt;
|
|
15291
14801
|
exports.useLearnFromUserAction = useLearnFromUserAction;
|
|
15292
14802
|
exports.useLearnFromUserActionInCurrentThread = useLearnFromUserActionInCurrentThread;
|
|
15293
|
-
exports.useLearningContainers = useLearningContainers;
|
|
15294
|
-
exports.useLearningContainersInCurrentThread = useLearningContainersInCurrentThread;
|
|
15295
14803
|
Object.defineProperty(exports, 'useLicenseContext', {
|
|
15296
14804
|
enumerable: true,
|
|
15297
14805
|
get: function () {
|
|
@@ -15355,6 +14863,30 @@ Object.defineProperty(exports, 'ɵclearAgentInterruptState', {
|
|
|
15355
14863
|
return _copilotkit_core.ɵclearAgentInterruptState;
|
|
15356
14864
|
}
|
|
15357
14865
|
});
|
|
14866
|
+
Object.defineProperty(exports, 'ɵcomposerButtonState', {
|
|
14867
|
+
enumerable: true,
|
|
14868
|
+
get: function () {
|
|
14869
|
+
return _copilotkit_core.ɵcomposerButtonState;
|
|
14870
|
+
}
|
|
14871
|
+
});
|
|
14872
|
+
Object.defineProperty(exports, 'ɵcopilotIconSvgAttributes', {
|
|
14873
|
+
enumerable: true,
|
|
14874
|
+
get: function () {
|
|
14875
|
+
return _copilotkit_core.ɵcopilotIconSvgAttributes;
|
|
14876
|
+
}
|
|
14877
|
+
});
|
|
14878
|
+
Object.defineProperty(exports, 'ɵcopilotIcons', {
|
|
14879
|
+
enumerable: true,
|
|
14880
|
+
get: function () {
|
|
14881
|
+
return _copilotkit_core.ɵcopilotIcons;
|
|
14882
|
+
}
|
|
14883
|
+
});
|
|
14884
|
+
Object.defineProperty(exports, 'ɵcountFailedToolCalls', {
|
|
14885
|
+
enumerable: true,
|
|
14886
|
+
get: function () {
|
|
14887
|
+
return _copilotkit_core.ɵcountFailedToolCalls;
|
|
14888
|
+
}
|
|
14889
|
+
});
|
|
15358
14890
|
Object.defineProperty(exports, 'ɵcreateMemoryStore', {
|
|
15359
14891
|
enumerable: true,
|
|
15360
14892
|
get: function () {
|
|
@@ -15373,12 +14905,102 @@ Object.defineProperty(exports, 'ɵcreateThreadStore', {
|
|
|
15373
14905
|
return _copilotkit_core.ɵcreateThreadStore;
|
|
15374
14906
|
}
|
|
15375
14907
|
});
|
|
14908
|
+
Object.defineProperty(exports, 'ɵdeduplicateMessages', {
|
|
14909
|
+
enumerable: true,
|
|
14910
|
+
get: function () {
|
|
14911
|
+
return _copilotkit_core.ɵdeduplicateMessages;
|
|
14912
|
+
}
|
|
14913
|
+
});
|
|
14914
|
+
Object.defineProperty(exports, 'ɵformatCountLabel', {
|
|
14915
|
+
enumerable: true,
|
|
14916
|
+
get: function () {
|
|
14917
|
+
return _copilotkit_core.ɵformatCountLabel;
|
|
14918
|
+
}
|
|
14919
|
+
});
|
|
14920
|
+
Object.defineProperty(exports, 'ɵformatLabel', {
|
|
14921
|
+
enumerable: true,
|
|
14922
|
+
get: function () {
|
|
14923
|
+
return _copilotkit_core.ɵformatLabel;
|
|
14924
|
+
}
|
|
14925
|
+
});
|
|
14926
|
+
Object.defineProperty(exports, 'ɵformatReasoningDuration', {
|
|
14927
|
+
enumerable: true,
|
|
14928
|
+
get: function () {
|
|
14929
|
+
return _copilotkit_core.ɵformatReasoningDuration;
|
|
14930
|
+
}
|
|
14931
|
+
});
|
|
14932
|
+
Object.defineProperty(exports, 'ɵformatToolNames', {
|
|
14933
|
+
enumerable: true,
|
|
14934
|
+
get: function () {
|
|
14935
|
+
return _copilotkit_core.ɵformatToolNames;
|
|
14936
|
+
}
|
|
14937
|
+
});
|
|
14938
|
+
Object.defineProperty(exports, 'ɵformatWorkDuration', {
|
|
14939
|
+
enumerable: true,
|
|
14940
|
+
get: function () {
|
|
14941
|
+
return _copilotkit_core.ɵformatWorkDuration;
|
|
14942
|
+
}
|
|
14943
|
+
});
|
|
15376
14944
|
Object.defineProperty(exports, 'ɵgetAgentInterruptState', {
|
|
15377
14945
|
enumerable: true,
|
|
15378
14946
|
get: function () {
|
|
15379
14947
|
return _copilotkit_core.ɵgetAgentInterruptState;
|
|
15380
14948
|
}
|
|
15381
14949
|
});
|
|
14950
|
+
Object.defineProperty(exports, 'ɵgetArgumentPreview', {
|
|
14951
|
+
enumerable: true,
|
|
14952
|
+
get: function () {
|
|
14953
|
+
return _copilotkit_core.ɵgetArgumentPreview;
|
|
14954
|
+
}
|
|
14955
|
+
});
|
|
14956
|
+
Object.defineProperty(exports, 'ɵgetLatestTurnKey', {
|
|
14957
|
+
enumerable: true,
|
|
14958
|
+
get: function () {
|
|
14959
|
+
return _copilotkit_core.ɵgetLatestTurnKey;
|
|
14960
|
+
}
|
|
14961
|
+
});
|
|
14962
|
+
Object.defineProperty(exports, 'ɵgetToolCallLayouts', {
|
|
14963
|
+
enumerable: true,
|
|
14964
|
+
get: function () {
|
|
14965
|
+
return _copilotkit_core.ɵgetToolCallLayouts;
|
|
14966
|
+
}
|
|
14967
|
+
});
|
|
14968
|
+
Object.defineProperty(exports, 'ɵgetToolCallPreview', {
|
|
14969
|
+
enumerable: true,
|
|
14970
|
+
get: function () {
|
|
14971
|
+
return _copilotkit_core.ɵgetToolCallPreview;
|
|
14972
|
+
}
|
|
14973
|
+
});
|
|
14974
|
+
Object.defineProperty(exports, 'ɵgetToolCallRendererNames', {
|
|
14975
|
+
enumerable: true,
|
|
14976
|
+
get: function () {
|
|
14977
|
+
return _copilotkit_core.ɵgetToolCallRendererNames;
|
|
14978
|
+
}
|
|
14979
|
+
});
|
|
14980
|
+
Object.defineProperty(exports, 'ɵgetToolCallRowStatus', {
|
|
14981
|
+
enumerable: true,
|
|
14982
|
+
get: function () {
|
|
14983
|
+
return _copilotkit_core.ɵgetToolCallRowStatus;
|
|
14984
|
+
}
|
|
14985
|
+
});
|
|
14986
|
+
Object.defineProperty(exports, 'ɵgetToolResults', {
|
|
14987
|
+
enumerable: true,
|
|
14988
|
+
get: function () {
|
|
14989
|
+
return _copilotkit_core.ɵgetToolResults;
|
|
14990
|
+
}
|
|
14991
|
+
});
|
|
14992
|
+
Object.defineProperty(exports, 'ɵgetTurnWork', {
|
|
14993
|
+
enumerable: true,
|
|
14994
|
+
get: function () {
|
|
14995
|
+
return _copilotkit_core.ɵgetTurnWork;
|
|
14996
|
+
}
|
|
14997
|
+
});
|
|
14998
|
+
Object.defineProperty(exports, 'ɵgetWorkOpenState', {
|
|
14999
|
+
enumerable: true,
|
|
15000
|
+
get: function () {
|
|
15001
|
+
return _copilotkit_core.ɵgetWorkOpenState;
|
|
15002
|
+
}
|
|
15003
|
+
});
|
|
15382
15004
|
Object.defineProperty(exports, 'ɵisCopilotKitFeature', {
|
|
15383
15005
|
enumerable: true,
|
|
15384
15006
|
get: function () {
|
|
@@ -15397,6 +15019,18 @@ Object.defineProperty(exports, 'ɵisRetryableMemoryStatus', {
|
|
|
15397
15019
|
return _copilotkit_core.ɵisRetryableMemoryStatus;
|
|
15398
15020
|
}
|
|
15399
15021
|
});
|
|
15022
|
+
Object.defineProperty(exports, 'ɵisTurnWorkOpen', {
|
|
15023
|
+
enumerable: true,
|
|
15024
|
+
get: function () {
|
|
15025
|
+
return _copilotkit_core.ɵisTurnWorkOpen;
|
|
15026
|
+
}
|
|
15027
|
+
});
|
|
15028
|
+
Object.defineProperty(exports, 'ɵisTurnWorking', {
|
|
15029
|
+
enumerable: true,
|
|
15030
|
+
get: function () {
|
|
15031
|
+
return _copilotkit_core.ɵisTurnWorking;
|
|
15032
|
+
}
|
|
15033
|
+
});
|
|
15400
15034
|
Object.defineProperty(exports, 'ɵjoinPhoenixChannel$', {
|
|
15401
15035
|
enumerable: true,
|
|
15402
15036
|
get: function () {
|
|
@@ -15433,6 +15067,12 @@ Object.defineProperty(exports, 'ɵmemoryRestEvents', {
|
|
|
15433
15067
|
return _copilotkit_core.ɵmemoryRestEvents;
|
|
15434
15068
|
}
|
|
15435
15069
|
});
|
|
15070
|
+
Object.defineProperty(exports, 'ɵmessagesFingerprint', {
|
|
15071
|
+
enumerable: true,
|
|
15072
|
+
get: function () {
|
|
15073
|
+
return _copilotkit_core.ɵmessagesFingerprint;
|
|
15074
|
+
}
|
|
15075
|
+
});
|
|
15436
15076
|
Object.defineProperty(exports, 'ɵobservePhoenixEvent$', {
|
|
15437
15077
|
enumerable: true,
|
|
15438
15078
|
get: function () {
|
|
@@ -15469,6 +15109,54 @@ Object.defineProperty(exports, 'ɵphoenixSocket$', {
|
|
|
15469
15109
|
return _copilotkit_core.ɵphoenixSocket$;
|
|
15470
15110
|
}
|
|
15471
15111
|
});
|
|
15112
|
+
Object.defineProperty(exports, 'ɵpluralize', {
|
|
15113
|
+
enumerable: true,
|
|
15114
|
+
get: function () {
|
|
15115
|
+
return _copilotkit_core.ɵpluralize;
|
|
15116
|
+
}
|
|
15117
|
+
});
|
|
15118
|
+
Object.defineProperty(exports, 'ɵrecordWorkTime', {
|
|
15119
|
+
enumerable: true,
|
|
15120
|
+
get: function () {
|
|
15121
|
+
return _copilotkit_core.ɵrecordWorkTime;
|
|
15122
|
+
}
|
|
15123
|
+
});
|
|
15124
|
+
Object.defineProperty(exports, 'ɵresolveActivityRenderer', {
|
|
15125
|
+
enumerable: true,
|
|
15126
|
+
get: function () {
|
|
15127
|
+
return _copilotkit_core.ɵresolveActivityRenderer;
|
|
15128
|
+
}
|
|
15129
|
+
});
|
|
15130
|
+
Object.defineProperty(exports, 'ɵresolveComposerKey', {
|
|
15131
|
+
enumerable: true,
|
|
15132
|
+
get: function () {
|
|
15133
|
+
return _copilotkit_core.ɵresolveComposerKey;
|
|
15134
|
+
}
|
|
15135
|
+
});
|
|
15136
|
+
Object.defineProperty(exports, 'ɵresolveCustomMessageRenderers', {
|
|
15137
|
+
enumerable: true,
|
|
15138
|
+
get: function () {
|
|
15139
|
+
return _copilotkit_core.ɵresolveCustomMessageRenderers;
|
|
15140
|
+
}
|
|
15141
|
+
});
|
|
15142
|
+
Object.defineProperty(exports, 'ɵresolveLicenseState', {
|
|
15143
|
+
enumerable: true,
|
|
15144
|
+
get: function () {
|
|
15145
|
+
return _copilotkit_core.ɵresolveLicenseState;
|
|
15146
|
+
}
|
|
15147
|
+
});
|
|
15148
|
+
Object.defineProperty(exports, 'ɵresolveThreadsLicense', {
|
|
15149
|
+
enumerable: true,
|
|
15150
|
+
get: function () {
|
|
15151
|
+
return _copilotkit_core.ɵresolveThreadsLicense;
|
|
15152
|
+
}
|
|
15153
|
+
});
|
|
15154
|
+
Object.defineProperty(exports, 'ɵresolveToolCallRenderer', {
|
|
15155
|
+
enumerable: true,
|
|
15156
|
+
get: function () {
|
|
15157
|
+
return _copilotkit_core.ɵresolveToolCallRenderer;
|
|
15158
|
+
}
|
|
15159
|
+
});
|
|
15472
15160
|
Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
|
|
15473
15161
|
enumerable: true,
|
|
15474
15162
|
get: function () {
|
|
@@ -15553,12 +15241,30 @@ Object.defineProperty(exports, 'ɵselectThreadsIsLoading', {
|
|
|
15553
15241
|
return _copilotkit_core.ɵselectThreadsIsLoading;
|
|
15554
15242
|
}
|
|
15555
15243
|
});
|
|
15244
|
+
Object.defineProperty(exports, 'ɵstringifyToolCallPayload', {
|
|
15245
|
+
enumerable: true,
|
|
15246
|
+
get: function () {
|
|
15247
|
+
return _copilotkit_core.ɵstringifyToolCallPayload;
|
|
15248
|
+
}
|
|
15249
|
+
});
|
|
15556
15250
|
Object.defineProperty(exports, 'ɵthreadAdapterEvents', {
|
|
15557
15251
|
enumerable: true,
|
|
15558
15252
|
get: function () {
|
|
15559
15253
|
return _copilotkit_core.ɵthreadAdapterEvents;
|
|
15560
15254
|
}
|
|
15561
15255
|
});
|
|
15256
|
+
Object.defineProperty(exports, 'ɵtranscribeAudio', {
|
|
15257
|
+
enumerable: true,
|
|
15258
|
+
get: function () {
|
|
15259
|
+
return _copilotkit_core.ɵtranscribeAudio;
|
|
15260
|
+
}
|
|
15261
|
+
});
|
|
15262
|
+
Object.defineProperty(exports, 'ɵtranscriptionErrorMessageKey', {
|
|
15263
|
+
enumerable: true,
|
|
15264
|
+
get: function () {
|
|
15265
|
+
return _copilotkit_core.ɵtranscriptionErrorMessageKey;
|
|
15266
|
+
}
|
|
15267
|
+
});
|
|
15562
15268
|
Object.defineProperty(exports, 'ɵwithHeaderDefaults', {
|
|
15563
15269
|
enumerable: true,
|
|
15564
15270
|
get: function () {
|