@copilotkit/react-ui 1.9.2-next.2 → 1.9.2-next.21

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/dist/{chunk-RT4HE74K.mjs → chunk-4RAYX7ZX.mjs} +7 -5
  3. package/dist/chunk-4RAYX7ZX.mjs.map +1 -0
  4. package/dist/{chunk-UKCPOBQM.mjs → chunk-53CVDVS5.mjs} +5 -2
  5. package/dist/chunk-53CVDVS5.mjs.map +1 -0
  6. package/dist/{chunk-6HXS43LW.mjs → chunk-BP3RN6OE.mjs} +2 -2
  7. package/dist/{chunk-725PPN77.mjs → chunk-EQUUN7ZM.mjs} +8 -6
  8. package/dist/chunk-EQUUN7ZM.mjs.map +1 -0
  9. package/dist/{chunk-6JX4WIAX.mjs → chunk-TSDSBNOS.mjs} +2 -2
  10. package/dist/{chunk-EMIYIMQ6.mjs → chunk-X3LV7OXQ.mjs} +21 -11
  11. package/dist/chunk-X3LV7OXQ.mjs.map +1 -0
  12. package/dist/components/chat/Chat.d.ts +2 -1
  13. package/dist/components/chat/Chat.js +27 -12
  14. package/dist/components/chat/Chat.js.map +1 -1
  15. package/dist/components/chat/Chat.mjs +4 -4
  16. package/dist/components/chat/Input.d.ts +1 -1
  17. package/dist/components/chat/Input.js +19 -9
  18. package/dist/components/chat/Input.js.map +1 -1
  19. package/dist/components/chat/Input.mjs +1 -1
  20. package/dist/components/chat/Modal.js +31 -14
  21. package/dist/components/chat/Modal.js.map +1 -1
  22. package/dist/components/chat/Modal.mjs +5 -5
  23. package/dist/components/chat/Popup.js +31 -14
  24. package/dist/components/chat/Popup.js.map +1 -1
  25. package/dist/components/chat/Popup.mjs +6 -6
  26. package/dist/components/chat/Sidebar.js +31 -14
  27. package/dist/components/chat/Sidebar.js.map +1 -1
  28. package/dist/components/chat/Sidebar.mjs +6 -6
  29. package/dist/components/chat/index.js +31 -14
  30. package/dist/components/chat/index.js.map +1 -1
  31. package/dist/components/chat/index.mjs +9 -9
  32. package/dist/components/chat/messages/AssistantMessage.mjs +1 -1
  33. package/dist/components/chat/messages/RenderActionExecutionMessage.js +4 -1
  34. package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
  35. package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +2 -2
  36. package/dist/components/chat/messages/RenderAgentStateMessage.mjs +1 -1
  37. package/dist/components/chat/messages/RenderImageMessage.mjs +1 -1
  38. package/dist/components/chat/messages/RenderResultMessage.mjs +1 -1
  39. package/dist/components/chat/messages/RenderTextMessage.mjs +1 -1
  40. package/dist/components/chat/props.d.ts +1 -0
  41. package/dist/components/chat/props.js.map +1 -1
  42. package/dist/components/index.js +31 -14
  43. package/dist/components/index.js.map +1 -1
  44. package/dist/components/index.mjs +9 -9
  45. package/dist/index.js +31 -14
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +9 -9
  48. package/package.json +4 -4
  49. package/src/components/chat/Chat.tsx +4 -0
  50. package/src/components/chat/Input.tsx +21 -11
  51. package/src/components/chat/Modal.tsx +6 -3
  52. package/src/components/chat/messages/RenderActionExecutionMessage.tsx +4 -2
  53. package/src/components/chat/props.ts +1 -0
  54. package/tsup.config.ts +1 -6
  55. package/dist/chunk-725PPN77.mjs.map +0 -1
  56. package/dist/chunk-EMIYIMQ6.mjs.map +0 -1
  57. package/dist/chunk-RT4HE74K.mjs.map +0 -1
  58. package/dist/chunk-UKCPOBQM.mjs.map +0 -1
  59. package/dist/lib/utils.test.d.ts +0 -2
  60. package/dist/lib/utils.test.js +0 -9
  61. package/dist/lib/utils.test.js.map +0 -1
  62. package/dist/lib/utils.test.mjs +0 -7
  63. package/dist/lib/utils.test.mjs.map +0 -1
  64. /package/dist/{chunk-6HXS43LW.mjs.map → chunk-BP3RN6OE.mjs.map} +0 -0
  65. /package/dist/{chunk-6JX4WIAX.mjs.map → chunk-TSDSBNOS.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CopilotPopup
3
- } from "../../chunk-6HXS43LW.mjs";
4
- import "../../chunk-725PPN77.mjs";
3
+ } from "../../chunk-BP3RN6OE.mjs";
4
+ import "../../chunk-EQUUN7ZM.mjs";
5
5
  import "../../chunk-C3GSYRC3.mjs";
6
6
  import "../../chunk-GVKA7RQQ.mjs";
7
7
  import "../../chunk-V7W6IM2V.mjs";
@@ -12,8 +12,8 @@ import "../../chunk-KXE2JCUH.mjs";
12
12
  import "../../chunk-NRA3CFEE.mjs";
13
13
  import "../../chunk-BH6PCAAL.mjs";
14
14
  import "../../chunk-UFN2VWSR.mjs";
15
- import "../../chunk-RT4HE74K.mjs";
16
- import "../../chunk-UKCPOBQM.mjs";
15
+ import "../../chunk-4RAYX7ZX.mjs";
16
+ import "../../chunk-53CVDVS5.mjs";
17
17
  import "../../chunk-2II3Q27P.mjs";
18
18
  import "../../chunk-ULDQXCED.mjs";
19
19
  import "../../chunk-C7OB63U5.mjs";
@@ -23,13 +23,13 @@ import "../../chunk-HWMFMBJC.mjs";
23
23
  import "../../chunk-QGSPTXOV.mjs";
24
24
  import "../../chunk-IMBPSLL4.mjs";
25
25
  import "../../chunk-PLHTVHUW.mjs";
26
- import "../../chunk-EMIYIMQ6.mjs";
26
+ import "../../chunk-X3LV7OXQ.mjs";
27
27
  import "../../chunk-CGEAG65D.mjs";
28
28
  import "../../chunk-YQFVRDNC.mjs";
29
29
  import "../../chunk-YTXEWDNC.mjs";
30
- import "../../chunk-KENCH7RN.mjs";
31
30
  import "../../chunk-B3D7U7TJ.mjs";
32
31
  import "../../chunk-IEMQ2SQW.mjs";
32
+ import "../../chunk-KENCH7RN.mjs";
33
33
  import "../../chunk-XWG3L6QC.mjs";
34
34
  import "../../chunk-54JAUBUJ.mjs";
35
35
  import "../../chunk-JGMFJZMG.mjs";
@@ -1417,8 +1417,15 @@ function PoweredByTag({ showPoweredBy = true }) {
1417
1417
  // src/components/chat/Input.tsx
1418
1418
  var import_jsx_runtime13 = require("react/jsx-runtime");
1419
1419
  var MAX_NEWLINES = 6;
1420
- var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1421
- var _a;
1420
+ var Input = ({
1421
+ inProgress,
1422
+ onSend,
1423
+ isVisible = false,
1424
+ onStop,
1425
+ onUpload,
1426
+ hideStopButton = false
1427
+ }) => {
1428
+ var _a, _b;
1422
1429
  const context = useChatContext();
1423
1430
  const copilotContext = (0, import_react_core6.useCopilotContext)();
1424
1431
  const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
@@ -1447,15 +1454,18 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1447
1454
  inProgress
1448
1455
  });
1449
1456
  const isInProgress = inProgress || pushToTalkState === "transcribing";
1450
- const buttonIcon = isInProgress ? context.icons.stopIcon : context.icons.sendIcon;
1457
+ const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
1451
1458
  const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
1452
- const canSend = () => {
1459
+ const canSend = (0, import_react9.useMemo)(() => {
1453
1460
  var _a2;
1454
1461
  const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
1455
1462
  const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
1456
- return (isInProgress || !isInProgress && text.trim().length > 0) && pushToTalkState === "idle" && !interruptInProgress;
1457
- };
1458
- const sendDisabled = !canSend();
1463
+ return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
1464
+ }, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
1465
+ const canStop = (0, import_react9.useMemo)(() => {
1466
+ return isInProgress && !hideStopButton;
1467
+ }, [isInProgress, hideStopButton]);
1468
+ const sendDisabled = !canSend && !canStop;
1459
1469
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `copilotKitInputContainer ${showPoweredBy ? "poweredByContainer" : ""}`, children: [
1460
1470
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "copilotKitInput", onClick: handleDivClick, children: [
1461
1471
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -1470,7 +1480,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1470
1480
  onKeyDown: (event) => {
1471
1481
  if (event.key === "Enter" && !event.shiftKey) {
1472
1482
  event.preventDefault();
1473
- if (canSend()) {
1483
+ if (canSend) {
1474
1484
  send();
1475
1485
  }
1476
1486
  }
@@ -1492,7 +1502,7 @@ var Input = ({ inProgress, onSend, isVisible = false, onStop, onUpload }) => {
1492
1502
  "button",
1493
1503
  {
1494
1504
  disabled: sendDisabled,
1495
- onClick: isInProgress ? onStop : send,
1505
+ onClick: isInProgress && !hideStopButton ? onStop : send,
1496
1506
  "data-copilotkit-in-progress": inProgress,
1497
1507
  "data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
1498
1508
  className: "copilotKitInputControlButton",
@@ -2216,9 +2226,12 @@ function RenderActionExecutionMessage(_a) {
2216
2226
  try {
2217
2227
  const toRender = render({
2218
2228
  status,
2229
+ // Cast to any as RenderFunctionStatus is a union that can be complex to narrow here
2219
2230
  args,
2220
2231
  result: actionResult,
2221
- name: message.name
2232
+ name: message.name,
2233
+ messageId: message.id
2234
+ // Pass messageId for HITL action correlation
2222
2235
  });
2223
2236
  if (!toRender && status === "complete") {
2224
2237
  return null;
@@ -2698,7 +2711,8 @@ function CopilotChat({
2698
2711
  AssistantMessage: AssistantMessage2 = AssistantMessage,
2699
2712
  UserMessage: UserMessage2 = UserMessage,
2700
2713
  imageUploadsEnabled,
2701
- inputFileAccept = "image/*"
2714
+ inputFileAccept = "image/*",
2715
+ hideStopButton
2702
2716
  }) {
2703
2717
  const { additionalInstructions, setChatInstructions } = (0, import_react_core10.useCopilotContext)();
2704
2718
  const [selectedImages, setSelectedImages] = (0, import_react13.useState)([]);
@@ -2881,7 +2895,8 @@ function CopilotChat({
2881
2895
  onUpload: imageUploadsEnabled ? () => {
2882
2896
  var _a;
2883
2897
  return (_a = fileInputRef.current) == null ? void 0 : _a.click();
2884
- } : void 0
2898
+ } : void 0,
2899
+ hideStopButton
2885
2900
  }
2886
2901
  )
2887
2902
  ] });
@@ -3146,8 +3161,10 @@ var CopilotModal = (_a) => {
3146
3161
  onSetOpen == null ? void 0 : onSetOpen(open);
3147
3162
  setOpenState(open);
3148
3163
  };
3164
+ const memoizedHeader = (0, import_react14.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}), [Header2]);
3165
+ const memoizedChildren = (0, import_react14.useMemo)(() => children, [children]);
3149
3166
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
3150
- children,
3167
+ memoizedChildren,
3151
3168
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className, children: [
3152
3169
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button2, {}),
3153
3170
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
@@ -3157,7 +3174,7 @@ var CopilotModal = (_a) => {
3157
3174
  shortcut,
3158
3175
  hitEscapeToClose,
3159
3176
  children: [
3160
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Header2, {}),
3177
+ memoizedHeader,
3161
3178
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3162
3179
  CopilotChat,
3163
3180
  __spreadProps(__spreadValues({}, props), {