@copilotkit/react-ui 1.8.5-next.1 → 1.8.5-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-Q2YY2NX3.mjs → chunk-COZFHP6Y.mjs} +2 -2
- package/dist/{chunk-MYUOPOIL.mjs → chunk-DRAM4KIH.mjs} +13 -13
- package/dist/{chunk-PCTCOQK2.mjs → chunk-DYUT4CVD.mjs} +4 -4
- package/dist/{chunk-4TWPMWD4.mjs → chunk-GULJZORG.mjs} +8 -8
- package/dist/chunk-JGMFJZMG.mjs +11 -0
- package/dist/chunk-JGMFJZMG.mjs.map +1 -0
- package/dist/{chunk-XNQO5AZZ.mjs → chunk-KSW7FVYG.mjs} +2 -2
- package/dist/{chunk-5M7ODWKH.mjs → chunk-N7ZQXCKF.mjs} +2 -2
- package/dist/{chunk-6QV7AIIG.mjs → chunk-P53JYD5X.mjs} +2 -2
- package/dist/{chunk-D5XIJNXQ.mjs → chunk-Q6XB5B2M.mjs} +7 -7
- package/dist/{chunk-2OTVZXDX.mjs → chunk-QDC2Q7XX.mjs} +2 -2
- package/dist/{chunk-NMNC4ROZ.mjs → chunk-QMW2LYI3.mjs} +2 -2
- package/dist/{chunk-P7S3E5UW.mjs → chunk-QSUC3MKT.mjs} +35 -7
- package/dist/chunk-QSUC3MKT.mjs.map +1 -0
- package/dist/{chunk-QJKMOGWN.mjs → chunk-RXBEZZ5I.mjs} +4 -4
- package/dist/{chunk-U6ISBBRF.mjs → chunk-TYAYVE3X.mjs} +2 -2
- package/dist/{chunk-62QMTKMJ.mjs → chunk-USR5CBYD.mjs} +4 -4
- package/dist/{chunk-WNC6OCIB.mjs → chunk-YIQTTJAT.mjs} +2 -2
- package/dist/components/chat/Chat.mjs +11 -11
- package/dist/components/chat/CodeBlock.mjs +2 -2
- package/dist/components/chat/Header.mjs +3 -3
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Markdown.mjs +3 -3
- package/dist/components/chat/Modal.js +66 -32
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +17 -16
- package/dist/components/chat/Popup.js +66 -32
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +18 -17
- package/dist/components/chat/Sidebar.js +66 -32
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +18 -17
- package/dist/components/chat/Window.js +39 -5
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +2 -1
- package/dist/components/chat/index.js +66 -32
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +22 -21
- package/dist/components/chat/messages/AssistantMessage.mjs +4 -4
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderResultMessage.mjs +5 -5
- package/dist/components/chat/messages/RenderTextMessage.mjs +5 -5
- package/dist/components/dev-console/console.mjs +2 -2
- package/dist/components/dev-console/index.mjs +2 -2
- package/dist/components/index.js +66 -32
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +22 -21
- package/dist/hooks/use-dark-mode.d.ts +3 -0
- package/dist/hooks/use-dark-mode.js +35 -0
- package/dist/hooks/use-dark-mode.js.map +1 -0
- package/dist/hooks/use-dark-mode.mjs +8 -0
- package/dist/hooks/use-dark-mode.mjs.map +1 -0
- package/dist/index.css +25 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +68 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -27
- package/package.json +4 -4
- package/src/components/chat/Window.tsx +26 -1
- package/src/css/input.css +1 -1
- package/src/css/window.css +27 -0
- package/src/hooks/use-dark-mode.ts +10 -0
- package/dist/chunk-P7S3E5UW.mjs.map +0 -1
- /package/dist/{chunk-Q2YY2NX3.mjs.map → chunk-COZFHP6Y.mjs.map} +0 -0
- /package/dist/{chunk-MYUOPOIL.mjs.map → chunk-DRAM4KIH.mjs.map} +0 -0
- /package/dist/{chunk-PCTCOQK2.mjs.map → chunk-DYUT4CVD.mjs.map} +0 -0
- /package/dist/{chunk-4TWPMWD4.mjs.map → chunk-GULJZORG.mjs.map} +0 -0
- /package/dist/{chunk-XNQO5AZZ.mjs.map → chunk-KSW7FVYG.mjs.map} +0 -0
- /package/dist/{chunk-5M7ODWKH.mjs.map → chunk-N7ZQXCKF.mjs.map} +0 -0
- /package/dist/{chunk-6QV7AIIG.mjs.map → chunk-P53JYD5X.mjs.map} +0 -0
- /package/dist/{chunk-D5XIJNXQ.mjs.map → chunk-Q6XB5B2M.mjs.map} +0 -0
- /package/dist/{chunk-2OTVZXDX.mjs.map → chunk-QDC2Q7XX.mjs.map} +0 -0
- /package/dist/{chunk-NMNC4ROZ.mjs.map → chunk-QMW2LYI3.mjs.map} +0 -0
- /package/dist/{chunk-QJKMOGWN.mjs.map → chunk-RXBEZZ5I.mjs.map} +0 -0
- /package/dist/{chunk-U6ISBBRF.mjs.map → chunk-TYAYVE3X.mjs.map} +0 -0
- /package/dist/{chunk-62QMTKMJ.mjs.map → chunk-USR5CBYD.mjs.map} +0 -0
- /package/dist/{chunk-WNC6OCIB.mjs.map → chunk-YIQTTJAT.mjs.map} +0 -0
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import "../../chunk-SQMEPWVT.mjs";
|
|
2
|
-
import "../../chunk-WB3YULQ4.mjs";
|
|
3
2
|
import {
|
|
4
3
|
CopilotPopup
|
|
5
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-P53JYD5X.mjs";
|
|
6
5
|
import {
|
|
7
6
|
CopilotSidebar
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-TYAYVE3X.mjs";
|
|
8
|
+
import "../../chunk-WB3YULQ4.mjs";
|
|
9
|
+
import "../../chunk-GULJZORG.mjs";
|
|
10
|
+
import "../../chunk-QSUC3MKT.mjs";
|
|
11
|
+
import "../../chunk-JGMFJZMG.mjs";
|
|
12
|
+
import "../../chunk-QDC2Q7XX.mjs";
|
|
12
13
|
import "../../chunk-V7W6IM2V.mjs";
|
|
13
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-Q6XB5B2M.mjs";
|
|
15
|
+
import "../../chunk-Q5V6S67N.mjs";
|
|
14
16
|
import "../../chunk-6TCUJ3B7.mjs";
|
|
15
17
|
import "../../chunk-KXE2JCUH.mjs";
|
|
16
18
|
import "../../chunk-NRA3CFEE.mjs";
|
|
17
19
|
import "../../chunk-BH6PCAAL.mjs";
|
|
18
|
-
import "../../chunk-Q5V6S67N.mjs";
|
|
19
20
|
import "../../chunk-YOEL33HG.mjs";
|
|
20
21
|
import {
|
|
21
22
|
CopilotChat
|
|
22
|
-
} from "../../chunk-
|
|
23
|
-
import "../../chunk-
|
|
24
|
-
import "../../chunk-
|
|
23
|
+
} from "../../chunk-DRAM4KIH.mjs";
|
|
24
|
+
import "../../chunk-QMW2LYI3.mjs";
|
|
25
|
+
import "../../chunk-COZFHP6Y.mjs";
|
|
26
|
+
import "../../chunk-YIQTTJAT.mjs";
|
|
27
|
+
import "../../chunk-USR5CBYD.mjs";
|
|
28
|
+
import {
|
|
29
|
+
AssistantMessage
|
|
30
|
+
} from "../../chunk-N7ZQXCKF.mjs";
|
|
25
31
|
import {
|
|
26
32
|
UserMessage
|
|
27
33
|
} from "../../chunk-HEIDCT7I.mjs";
|
|
28
|
-
import "../../chunk-NMNC4ROZ.mjs";
|
|
29
|
-
import "../../chunk-Q2YY2NX3.mjs";
|
|
30
|
-
import {
|
|
31
|
-
AssistantMessage
|
|
32
|
-
} from "../../chunk-5M7ODWKH.mjs";
|
|
33
34
|
import "../../chunk-TOQ7P4DO.mjs";
|
|
34
|
-
import "../../chunk-
|
|
35
|
+
import "../../chunk-RXBEZZ5I.mjs";
|
|
36
|
+
import "../../chunk-S5MBUNGN.mjs";
|
|
35
37
|
import "../../chunk-YQFVRDNC.mjs";
|
|
36
38
|
import {
|
|
37
39
|
Markdown
|
|
38
|
-
} from "../../chunk-
|
|
40
|
+
} from "../../chunk-KSW7FVYG.mjs";
|
|
41
|
+
import "../../chunk-DYUT4CVD.mjs";
|
|
42
|
+
import "../../chunk-54JAUBUJ.mjs";
|
|
39
43
|
import "../../chunk-ZY25LVYR.mjs";
|
|
40
44
|
import {
|
|
41
45
|
useChatContext
|
|
42
46
|
} from "../../chunk-UN2E3HCK.mjs";
|
|
43
|
-
import "../../chunk-PCTCOQK2.mjs";
|
|
44
47
|
import "../../chunk-ORSMX3SE.mjs";
|
|
45
|
-
import "../../chunk-54JAUBUJ.mjs";
|
|
46
|
-
import "../../chunk-S5MBUNGN.mjs";
|
|
47
48
|
import "../../chunk-MRXNTQOX.mjs";
|
|
48
49
|
export {
|
|
49
50
|
AssistantMessage,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AssistantMessage
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-N7ZQXCKF.mjs";
|
|
4
|
+
import "../../../chunk-KSW7FVYG.mjs";
|
|
5
|
+
import "../../../chunk-DYUT4CVD.mjs";
|
|
6
|
+
import "../../../chunk-54JAUBUJ.mjs";
|
|
5
7
|
import "../../../chunk-UN2E3HCK.mjs";
|
|
6
|
-
import "../../../chunk-PCTCOQK2.mjs";
|
|
7
8
|
import "../../../chunk-ORSMX3SE.mjs";
|
|
8
|
-
import "../../../chunk-54JAUBUJ.mjs";
|
|
9
9
|
import "../../../chunk-MRXNTQOX.mjs";
|
|
10
10
|
export {
|
|
11
11
|
AssistantMessage
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderActionExecutionMessage
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-QMW2LYI3.mjs";
|
|
4
|
+
import "../../../chunk-N7ZQXCKF.mjs";
|
|
5
|
+
import "../../../chunk-KSW7FVYG.mjs";
|
|
6
|
+
import "../../../chunk-DYUT4CVD.mjs";
|
|
7
|
+
import "../../../chunk-54JAUBUJ.mjs";
|
|
6
8
|
import "../../../chunk-UN2E3HCK.mjs";
|
|
7
|
-
import "../../../chunk-PCTCOQK2.mjs";
|
|
8
9
|
import "../../../chunk-ORSMX3SE.mjs";
|
|
9
|
-
import "../../../chunk-54JAUBUJ.mjs";
|
|
10
10
|
import "../../../chunk-MRXNTQOX.mjs";
|
|
11
11
|
export {
|
|
12
12
|
RenderActionExecutionMessage
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderAgentStateMessage
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-COZFHP6Y.mjs";
|
|
4
|
+
import "../../../chunk-N7ZQXCKF.mjs";
|
|
5
|
+
import "../../../chunk-KSW7FVYG.mjs";
|
|
6
|
+
import "../../../chunk-DYUT4CVD.mjs";
|
|
7
|
+
import "../../../chunk-54JAUBUJ.mjs";
|
|
6
8
|
import "../../../chunk-UN2E3HCK.mjs";
|
|
7
|
-
import "../../../chunk-PCTCOQK2.mjs";
|
|
8
9
|
import "../../../chunk-ORSMX3SE.mjs";
|
|
9
|
-
import "../../../chunk-54JAUBUJ.mjs";
|
|
10
10
|
import "../../../chunk-MRXNTQOX.mjs";
|
|
11
11
|
export {
|
|
12
12
|
RenderAgentStateMessage
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderResultMessage
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-YIQTTJAT.mjs";
|
|
4
|
+
import "../../../chunk-N7ZQXCKF.mjs";
|
|
5
|
+
import "../../../chunk-KSW7FVYG.mjs";
|
|
6
|
+
import "../../../chunk-DYUT4CVD.mjs";
|
|
7
|
+
import "../../../chunk-54JAUBUJ.mjs";
|
|
6
8
|
import "../../../chunk-UN2E3HCK.mjs";
|
|
7
|
-
import "../../../chunk-PCTCOQK2.mjs";
|
|
8
9
|
import "../../../chunk-ORSMX3SE.mjs";
|
|
9
|
-
import "../../../chunk-54JAUBUJ.mjs";
|
|
10
10
|
import "../../../chunk-MRXNTQOX.mjs";
|
|
11
11
|
export {
|
|
12
12
|
RenderResultMessage
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderTextMessage
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-USR5CBYD.mjs";
|
|
4
|
+
import "../../../chunk-N7ZQXCKF.mjs";
|
|
4
5
|
import "../../../chunk-HEIDCT7I.mjs";
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import "../../../chunk-
|
|
6
|
+
import "../../../chunk-KSW7FVYG.mjs";
|
|
7
|
+
import "../../../chunk-DYUT4CVD.mjs";
|
|
8
|
+
import "../../../chunk-54JAUBUJ.mjs";
|
|
7
9
|
import "../../../chunk-UN2E3HCK.mjs";
|
|
8
|
-
import "../../../chunk-PCTCOQK2.mjs";
|
|
9
10
|
import "../../../chunk-ORSMX3SE.mjs";
|
|
10
|
-
import "../../../chunk-54JAUBUJ.mjs";
|
|
11
11
|
import "../../../chunk-MRXNTQOX.mjs";
|
|
12
12
|
export {
|
|
13
13
|
RenderTextMessage
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CopilotDevConsole,
|
|
4
4
|
DebugMenuButton
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-Q6XB5B2M.mjs";
|
|
6
|
+
import "../../chunk-Q5V6S67N.mjs";
|
|
6
7
|
import "../../chunk-6TCUJ3B7.mjs";
|
|
7
8
|
import "../../chunk-KXE2JCUH.mjs";
|
|
8
9
|
import "../../chunk-NRA3CFEE.mjs";
|
|
9
10
|
import "../../chunk-BH6PCAAL.mjs";
|
|
10
|
-
import "../../chunk-Q5V6S67N.mjs";
|
|
11
11
|
import "../../chunk-ORSMX3SE.mjs";
|
|
12
12
|
import "../../chunk-MRXNTQOX.mjs";
|
|
13
13
|
export {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../../chunk-V7W6IM2V.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotDevConsole
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-Q6XB5B2M.mjs";
|
|
5
|
+
import "../../chunk-Q5V6S67N.mjs";
|
|
5
6
|
import {
|
|
6
7
|
shouldShowDevConsole
|
|
7
8
|
} from "../../chunk-6TCUJ3B7.mjs";
|
|
8
9
|
import "../../chunk-KXE2JCUH.mjs";
|
|
9
10
|
import "../../chunk-NRA3CFEE.mjs";
|
|
10
11
|
import "../../chunk-BH6PCAAL.mjs";
|
|
11
|
-
import "../../chunk-Q5V6S67N.mjs";
|
|
12
12
|
import "../../chunk-ORSMX3SE.mjs";
|
|
13
13
|
import "../../chunk-MRXNTQOX.mjs";
|
|
14
14
|
export {
|
package/dist/components/index.js
CHANGED
|
@@ -391,6 +391,16 @@ var ChatContextProvider = ({
|
|
|
391
391
|
|
|
392
392
|
// src/components/chat/Window.tsx
|
|
393
393
|
var import_react2 = __toESM(require("react"));
|
|
394
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
395
|
+
|
|
396
|
+
// src/hooks/use-dark-mode.ts
|
|
397
|
+
var useDarkMode = () => {
|
|
398
|
+
if (typeof window === "undefined")
|
|
399
|
+
return false;
|
|
400
|
+
return document.documentElement.classList.contains("dark") || document.body.classList.contains("dark") || document.documentElement.getAttribute("data-theme") === "dark" || document.body.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// src/components/chat/Window.tsx
|
|
394
404
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
395
405
|
var Window = ({
|
|
396
406
|
children,
|
|
@@ -398,15 +408,17 @@ var Window = ({
|
|
|
398
408
|
shortcut,
|
|
399
409
|
hitEscapeToClose
|
|
400
410
|
}) => {
|
|
411
|
+
var _a;
|
|
401
412
|
const windowRef = import_react2.default.useRef(null);
|
|
413
|
+
const context = (0, import_react_core.useCopilotContext)();
|
|
402
414
|
const { open, setOpen } = useChatContext();
|
|
403
415
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
404
416
|
(event) => {
|
|
405
|
-
var
|
|
417
|
+
var _a2;
|
|
406
418
|
if (!clickOutsideToClose) {
|
|
407
419
|
return;
|
|
408
420
|
}
|
|
409
|
-
const parentElement = (
|
|
421
|
+
const parentElement = (_a2 = windowRef.current) == null ? void 0 : _a2.parentElement;
|
|
410
422
|
let className = "";
|
|
411
423
|
if (event.target instanceof HTMLElement) {
|
|
412
424
|
className = event.target.className;
|
|
@@ -420,10 +432,10 @@ var Window = ({
|
|
|
420
432
|
);
|
|
421
433
|
const handleKeyDown = (0, import_react2.useCallback)(
|
|
422
434
|
(event) => {
|
|
423
|
-
var
|
|
435
|
+
var _a2;
|
|
424
436
|
const target = event.target;
|
|
425
437
|
const isInput = target.tagName === "INPUT" || target.tagName === "SELECT" || target.tagName === "TEXTAREA" || target.isContentEditable;
|
|
426
|
-
const isDescendantOfWrapper = (
|
|
438
|
+
const isDescendantOfWrapper = (_a2 = windowRef.current) == null ? void 0 : _a2.contains(target);
|
|
427
439
|
if (open && event.key === "Escape" && (!isInput || isDescendantOfWrapper) && hitEscapeToClose) {
|
|
428
440
|
setOpen(false);
|
|
429
441
|
} else if (event.key === shortcut && (isMacOS() && event.metaKey || !isMacOS() && event.ctrlKey) && (!isInput || isDescendantOfWrapper)) {
|
|
@@ -478,7 +490,29 @@ var Window = ({
|
|
|
478
490
|
}
|
|
479
491
|
};
|
|
480
492
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
481
|
-
|
|
493
|
+
const isDark = useDarkMode();
|
|
494
|
+
const showPoweredBy = !((_a = context.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
495
|
+
const poweredByStyle = {
|
|
496
|
+
visibility: "visible",
|
|
497
|
+
display: "block",
|
|
498
|
+
position: "static",
|
|
499
|
+
textAlign: "center",
|
|
500
|
+
fontSize: "12px",
|
|
501
|
+
padding: "3px 0",
|
|
502
|
+
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
503
|
+
};
|
|
504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
505
|
+
"div",
|
|
506
|
+
{
|
|
507
|
+
className: `copilotKitWindow ${showPoweredBy ? " poweredByContainer" : ""} ${open ? " open" : ""}`,
|
|
508
|
+
ref: windowRef,
|
|
509
|
+
children: [
|
|
510
|
+
children,
|
|
511
|
+
showPoweredBy && // @ts-expect-error -- expecting position not to be a string, but it can be.
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" })
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
);
|
|
482
516
|
};
|
|
483
517
|
var preventScroll = (event) => {
|
|
484
518
|
let targetElement = event.target;
|
|
@@ -517,7 +551,7 @@ var Button = ({}) => {
|
|
|
517
551
|
};
|
|
518
552
|
|
|
519
553
|
// src/components/dev-console/utils.ts
|
|
520
|
-
var
|
|
554
|
+
var import_react_core2 = require("@copilotkit/react-core");
|
|
521
555
|
function shouldShowDevConsole(showDevConsole) {
|
|
522
556
|
if (typeof showDevConsole === "boolean") {
|
|
523
557
|
return showDevConsole;
|
|
@@ -579,7 +613,7 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
579
613
|
}
|
|
580
614
|
function logReadables(context) {
|
|
581
615
|
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
582
|
-
const readables = context.getContextString([],
|
|
616
|
+
const readables = context.getContextString([], import_react_core2.defaultCopilotContextCategories).trim();
|
|
583
617
|
if (readables.length === 0) {
|
|
584
618
|
console.log("No readables found");
|
|
585
619
|
return;
|
|
@@ -649,7 +683,7 @@ function logMessages(context) {
|
|
|
649
683
|
}
|
|
650
684
|
|
|
651
685
|
// src/components/dev-console/console.tsx
|
|
652
|
-
var
|
|
686
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
653
687
|
var import_react4 = require("react");
|
|
654
688
|
|
|
655
689
|
// src/components/dev-console/icons.tsx
|
|
@@ -839,7 +873,7 @@ function CopilotKitHelpModal() {
|
|
|
839
873
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
840
874
|
function CopilotDevConsole() {
|
|
841
875
|
const currentVersion = import_shared.COPILOTKIT_VERSION;
|
|
842
|
-
const context = (0,
|
|
876
|
+
const context = (0, import_react_core3.useCopilotContext)();
|
|
843
877
|
const [showDevConsole, setShowDevConsole] = (0, import_react4.useState)(false);
|
|
844
878
|
(0, import_react4.useEffect)(() => {
|
|
845
879
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
@@ -970,8 +1004,8 @@ function DebugMenuButton({
|
|
|
970
1004
|
checkForUpdates,
|
|
971
1005
|
mode
|
|
972
1006
|
}) {
|
|
973
|
-
const context = (0,
|
|
974
|
-
const messagesContext = (0,
|
|
1007
|
+
const context = (0, import_react_core3.useCopilotContext)();
|
|
1008
|
+
const messagesContext = (0, import_react_core3.useCopilotMessagesContext)();
|
|
975
1009
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react5.Menu, { children: [
|
|
976
1010
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
977
1011
|
import_react5.MenuButton,
|
|
@@ -1034,7 +1068,7 @@ var Header = ({}) => {
|
|
|
1034
1068
|
// src/components/chat/Messages.tsx
|
|
1035
1069
|
var import_react6 = require("react");
|
|
1036
1070
|
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
1037
|
-
var
|
|
1071
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
1038
1072
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1039
1073
|
var Messages = ({
|
|
1040
1074
|
messages,
|
|
@@ -1070,7 +1104,7 @@ var Messages = ({
|
|
|
1070
1104
|
}
|
|
1071
1105
|
}
|
|
1072
1106
|
const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
|
|
1073
|
-
const interrupt = (0,
|
|
1107
|
+
const interrupt = (0, import_react_core4.useLangGraphInterruptRender)();
|
|
1074
1108
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
|
|
1075
1109
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "copilotKitMessagesContainer", children: [
|
|
1076
1110
|
messages.map((message, index) => {
|
|
@@ -1268,7 +1302,7 @@ var AutoResizingTextarea = (0, import_react7.forwardRef)(
|
|
|
1268
1302
|
var Textarea_default = AutoResizingTextarea;
|
|
1269
1303
|
|
|
1270
1304
|
// src/hooks/use-push-to-talk.tsx
|
|
1271
|
-
var
|
|
1305
|
+
var import_react_core5 = require("@copilotkit/react-core");
|
|
1272
1306
|
var import_react8 = require("react");
|
|
1273
1307
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
1274
1308
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
@@ -1323,8 +1357,8 @@ var usePushToTalk = ({
|
|
|
1323
1357
|
const audioContextRef = (0, import_react8.useRef)(null);
|
|
1324
1358
|
const mediaRecorderRef = (0, import_react8.useRef)(null);
|
|
1325
1359
|
const recordedChunks = (0, import_react8.useRef)([]);
|
|
1326
|
-
const generalContext = (0,
|
|
1327
|
-
const messagesContext = (0,
|
|
1360
|
+
const generalContext = (0, import_react_core5.useCopilotContext)();
|
|
1361
|
+
const messagesContext = (0, import_react_core5.useCopilotMessagesContext)();
|
|
1328
1362
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
1329
1363
|
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react8.useState)(null);
|
|
1330
1364
|
(0, import_react8.useEffect)(() => {
|
|
@@ -1372,11 +1406,11 @@ var usePushToTalk = ({
|
|
|
1372
1406
|
};
|
|
1373
1407
|
|
|
1374
1408
|
// src/components/chat/Input.tsx
|
|
1375
|
-
var
|
|
1409
|
+
var import_react_core6 = require("@copilotkit/react-core");
|
|
1376
1410
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1377
1411
|
var Input = ({ inProgress, onSend, isVisible = false, onStop }) => {
|
|
1378
1412
|
const context = useChatContext();
|
|
1379
|
-
const copilotContext = (0,
|
|
1413
|
+
const copilotContext = (0, import_react_core6.useCopilotContext)();
|
|
1380
1414
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
1381
1415
|
const textareaRef = (0, import_react9.useRef)(null);
|
|
1382
1416
|
const handleDivClick = (event) => {
|
|
@@ -2082,7 +2116,7 @@ function RenderTextMessage(_a) {
|
|
|
2082
2116
|
|
|
2083
2117
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
2084
2118
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
2085
|
-
var
|
|
2119
|
+
var import_react_core7 = require("@copilotkit/react-core");
|
|
2086
2120
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2087
2121
|
function RenderActionExecutionMessage(_a) {
|
|
2088
2122
|
var _b = _a, {
|
|
@@ -2090,7 +2124,7 @@ function RenderActionExecutionMessage(_a) {
|
|
|
2090
2124
|
} = _b, props = __objRest(_b, [
|
|
2091
2125
|
"AssistantMessage"
|
|
2092
2126
|
]);
|
|
2093
|
-
const { chatComponentsCache } = (0,
|
|
2127
|
+
const { chatComponentsCache } = (0, import_react_core7.useCopilotContext)();
|
|
2094
2128
|
const { message, inProgress, index, isCurrentMessage, actionResult } = props;
|
|
2095
2129
|
if (message.isActionExecutionMessage()) {
|
|
2096
2130
|
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
@@ -2219,7 +2253,7 @@ function RenderResultMessage(_a) {
|
|
|
2219
2253
|
}
|
|
2220
2254
|
|
|
2221
2255
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
2222
|
-
var
|
|
2256
|
+
var import_react_core8 = require("@copilotkit/react-core");
|
|
2223
2257
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2224
2258
|
function RenderAgentStateMessage(_a) {
|
|
2225
2259
|
var _b = _a, {
|
|
@@ -2227,7 +2261,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2227
2261
|
} = _b, props = __objRest(_b, [
|
|
2228
2262
|
"AssistantMessage"
|
|
2229
2263
|
]);
|
|
2230
|
-
const { chatComponentsCache } = (0,
|
|
2264
|
+
const { chatComponentsCache } = (0, import_react_core8.useCopilotContext)();
|
|
2231
2265
|
const { message, inProgress, index, isCurrentMessage } = props;
|
|
2232
2266
|
if (message.isAgentStateMessage()) {
|
|
2233
2267
|
let render;
|
|
@@ -2320,7 +2354,7 @@ function RenderAgentStateMessage(_a) {
|
|
|
2320
2354
|
}
|
|
2321
2355
|
|
|
2322
2356
|
// src/components/chat/Suggestion.tsx
|
|
2323
|
-
var
|
|
2357
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
2324
2358
|
var import_shared2 = require("@copilotkit/shared");
|
|
2325
2359
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
2326
2360
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -2352,7 +2386,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2352
2386
|
for (const config of Object.values(chatSuggestionConfiguration)) {
|
|
2353
2387
|
try {
|
|
2354
2388
|
const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
|
|
2355
|
-
const result = yield (0,
|
|
2389
|
+
const result = yield (0, import_react_core9.extract)({
|
|
2356
2390
|
context,
|
|
2357
2391
|
instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
|
|
2358
2392
|
data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
|
|
@@ -2411,10 +2445,10 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
2411
2445
|
|
|
2412
2446
|
// src/components/chat/Chat.tsx
|
|
2413
2447
|
var import_react13 = __toESM(require("react"));
|
|
2414
|
-
var
|
|
2448
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2415
2449
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
2416
2450
|
var import_shared3 = require("@copilotkit/shared");
|
|
2417
|
-
var
|
|
2451
|
+
var import_react_core11 = require("@copilotkit/react-core");
|
|
2418
2452
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2419
2453
|
function CopilotChat({
|
|
2420
2454
|
instructions,
|
|
@@ -2439,7 +2473,7 @@ function CopilotChat({
|
|
|
2439
2473
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2440
2474
|
UserMessage: UserMessage2 = UserMessage
|
|
2441
2475
|
}) {
|
|
2442
|
-
const { additionalInstructions, setChatInstructions } = (0,
|
|
2476
|
+
const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
|
|
2443
2477
|
(0, import_react13.useEffect)(() => {
|
|
2444
2478
|
if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
|
|
2445
2479
|
setChatInstructions(instructions || "");
|
|
@@ -2543,7 +2577,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2543
2577
|
stopGeneration: defaultStopGeneration,
|
|
2544
2578
|
runChatCompletion,
|
|
2545
2579
|
isLoading
|
|
2546
|
-
} = (0,
|
|
2580
|
+
} = (0, import_react_core10.useCopilotChat)({
|
|
2547
2581
|
id: (0, import_shared3.randomId)(),
|
|
2548
2582
|
makeSystemMessage
|
|
2549
2583
|
});
|
|
@@ -2555,8 +2589,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2555
2589
|
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2556
2590
|
suggestionsAbortControllerRef.current = null;
|
|
2557
2591
|
};
|
|
2558
|
-
const generalContext = (0,
|
|
2559
|
-
const messagesContext = (0,
|
|
2592
|
+
const generalContext = (0, import_react_core10.useCopilotContext)();
|
|
2593
|
+
const messagesContext = (0, import_react_core10.useCopilotMessagesContext)();
|
|
2560
2594
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2561
2595
|
(0, import_react13.useEffect)(() => {
|
|
2562
2596
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
@@ -2624,7 +2658,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2624
2658
|
});
|
|
2625
2659
|
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2626
2660
|
if (generalContext.agentSession) {
|
|
2627
|
-
yield (0,
|
|
2661
|
+
yield (0, import_react_core11.runAgent)(
|
|
2628
2662
|
generalContext.agentSession.agentName,
|
|
2629
2663
|
context,
|
|
2630
2664
|
appendMessage,
|
|
@@ -2635,7 +2669,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2635
2669
|
});
|
|
2636
2670
|
const stopCurrentAgent = () => {
|
|
2637
2671
|
if (generalContext.agentSession) {
|
|
2638
|
-
(0,
|
|
2672
|
+
(0, import_react_core11.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2639
2673
|
}
|
|
2640
2674
|
};
|
|
2641
2675
|
const setCurrentAgentState = (state) => {
|