@copilotkit/react-core 1.51.3-next.6 → 1.51.3-next.7

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 (97) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunk-77IVITG3.mjs +158 -0
  3. package/dist/chunk-77IVITG3.mjs.map +1 -0
  4. package/dist/chunk-BKMJ4LC7.mjs +119 -0
  5. package/dist/chunk-BKMJ4LC7.mjs.map +1 -0
  6. package/dist/chunk-C3YJYDK4.mjs +189 -0
  7. package/dist/chunk-C3YJYDK4.mjs.map +1 -0
  8. package/dist/{chunk-GIU66J37.mjs → chunk-DQXCQWSG.mjs} +47 -5
  9. package/dist/chunk-DQXCQWSG.mjs.map +1 -0
  10. package/dist/{chunk-HBMPXNW2.mjs → chunk-LO4RRITI.mjs} +71 -18
  11. package/dist/chunk-LO4RRITI.mjs.map +1 -0
  12. package/dist/{chunk-3G4VFRVV.mjs → chunk-NXHQDCZF.mjs} +2 -2
  13. package/dist/{chunk-FDOMAPJY.mjs → chunk-QD7EID4N.mjs} +1 -1
  14. package/dist/chunk-QD7EID4N.mjs.map +1 -0
  15. package/dist/{chunk-YTQHRJUA.mjs → chunk-VKNLTZJE.mjs} +2 -2
  16. package/dist/{chunk-4RRUJHCI.mjs → chunk-VP43SLSZ.mjs} +2 -2
  17. package/dist/{chunk-MF2ZSLBV.mjs → chunk-XZFIJ7XF.mjs} +2 -2
  18. package/dist/components/copilot-provider/copilotkit.js +437 -150
  19. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  20. package/dist/components/copilot-provider/copilotkit.mjs +5 -3
  21. package/dist/components/copilot-provider/index.js +437 -150
  22. package/dist/components/copilot-provider/index.js.map +1 -1
  23. package/dist/components/copilot-provider/index.mjs +5 -3
  24. package/dist/components/index.js +437 -150
  25. package/dist/components/index.js.map +1 -1
  26. package/dist/components/index.mjs +5 -3
  27. package/dist/context/coagent-state-renders-context.d.ts +1 -0
  28. package/dist/context/coagent-state-renders-context.js.map +1 -1
  29. package/dist/context/coagent-state-renders-context.mjs +1 -1
  30. package/dist/context/index.js.map +1 -1
  31. package/dist/context/index.mjs +1 -1
  32. package/dist/hooks/index.js +512 -212
  33. package/dist/hooks/index.js.map +1 -1
  34. package/dist/hooks/index.mjs +19 -17
  35. package/dist/hooks/use-coagent-state-render-bridge.helpers.d.ts +92 -0
  36. package/dist/hooks/use-coagent-state-render-bridge.helpers.js +231 -0
  37. package/dist/hooks/use-coagent-state-render-bridge.helpers.js.map +1 -0
  38. package/dist/hooks/use-coagent-state-render-bridge.helpers.mjs +24 -0
  39. package/dist/hooks/use-coagent-state-render-bridge.helpers.mjs.map +1 -0
  40. package/dist/hooks/use-coagent-state-render-bridge.js +334 -72
  41. package/dist/hooks/use-coagent-state-render-bridge.js.map +1 -1
  42. package/dist/hooks/use-coagent-state-render-bridge.mjs +4 -2
  43. package/dist/hooks/use-coagent-state-render-registry.d.ts +25 -0
  44. package/dist/hooks/use-coagent-state-render-registry.js +358 -0
  45. package/dist/hooks/use-coagent-state-render-registry.js.map +1 -0
  46. package/dist/hooks/use-coagent-state-render-registry.mjs +9 -0
  47. package/dist/hooks/use-coagent-state-render-registry.mjs.map +1 -0
  48. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  49. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  50. package/dist/hooks/use-copilot-chat-headless_c.js +414 -114
  51. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
  52. package/dist/hooks/use-copilot-chat-headless_c.mjs +7 -5
  53. package/dist/hooks/use-copilot-chat.js +406 -106
  54. package/dist/hooks/use-copilot-chat.js.map +1 -1
  55. package/dist/hooks/use-copilot-chat.mjs +7 -5
  56. package/dist/hooks/use-copilot-chat_internal.js +406 -106
  57. package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
  58. package/dist/hooks/use-copilot-chat_internal.mjs +6 -4
  59. package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
  60. package/dist/index.js +651 -311
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.mjs +22 -20
  63. package/dist/lib/copilot-task.js.map +1 -1
  64. package/dist/lib/copilot-task.mjs +6 -4
  65. package/dist/lib/index.js.map +1 -1
  66. package/dist/lib/index.mjs +6 -4
  67. package/dist/setupTests.js +1 -0
  68. package/dist/setupTests.js.map +1 -1
  69. package/dist/setupTests.mjs +1 -0
  70. package/dist/setupTests.mjs.map +1 -1
  71. package/dist/test-helpers/copilot-context.d.ts +14 -0
  72. package/dist/test-helpers/copilot-context.js +128 -0
  73. package/dist/test-helpers/copilot-context.js.map +1 -0
  74. package/dist/test-helpers/copilot-context.mjs +74 -0
  75. package/dist/test-helpers/copilot-context.mjs.map +1 -0
  76. package/dist/types/index.mjs +1 -1
  77. package/package.json +5 -5
  78. package/src/components/copilot-provider/copilotkit.tsx +56 -0
  79. package/src/context/coagent-state-renders-context.tsx +1 -0
  80. package/src/hooks/__tests__/use-coagent-state-render-bridge.helpers.test.ts +100 -0
  81. package/src/hooks/__tests__/use-coagent-state-render.e2e.test.tsx +892 -37
  82. package/src/hooks/__tests__/use-coagent-state-render.test.tsx +334 -0
  83. package/src/hooks/use-coagent-state-render-bridge.helpers.ts +311 -0
  84. package/src/hooks/use-coagent-state-render-bridge.tsx +25 -120
  85. package/src/hooks/use-coagent-state-render-registry.ts +215 -0
  86. package/src/hooks/use-copilot-chat_internal.ts +93 -34
  87. package/src/setupTests.ts +1 -0
  88. package/src/test-helpers/copilot-context.ts +91 -0
  89. package/dist/chunk-3X3I7OJV.mjs +0 -172
  90. package/dist/chunk-3X3I7OJV.mjs.map +0 -1
  91. package/dist/chunk-FDOMAPJY.mjs.map +0 -1
  92. package/dist/chunk-GIU66J37.mjs.map +0 -1
  93. package/dist/chunk-HBMPXNW2.mjs.map +0 -1
  94. /package/dist/{chunk-3G4VFRVV.mjs.map → chunk-NXHQDCZF.mjs.map} +0 -0
  95. /package/dist/{chunk-YTQHRJUA.mjs.map → chunk-VKNLTZJE.mjs.map} +0 -0
  96. /package/dist/{chunk-4RRUJHCI.mjs.map → chunk-VP43SLSZ.mjs.map} +0 -0
  97. /package/dist/{chunk-MF2ZSLBV.mjs.map → chunk-XZFIJ7XF.mjs.map} +0 -0
@@ -83,7 +83,7 @@ __export(use_copilot_chat_headless_c_exports, {
83
83
  useCopilotChatHeadless_c: () => useCopilotChatHeadless_c
84
84
  });
85
85
  module.exports = __toCommonJS(use_copilot_chat_headless_c_exports);
86
- var import_react15 = require("react");
86
+ var import_react16 = require("react");
87
87
 
88
88
  // src/context/copilot-context.tsx
89
89
  var import_react = __toESM(require("react"));
@@ -187,7 +187,7 @@ function returnAndThrowInDebug(_value) {
187
187
  }
188
188
 
189
189
  // src/hooks/use-copilot-chat_internal.ts
190
- var import_react13 = require("react");
190
+ var import_react14 = require("react");
191
191
 
192
192
  // src/components/error-boundary/error-utils.tsx
193
193
  var import_react3 = require("react");
@@ -475,7 +475,7 @@ function useLangGraphInterruptRender(agent) {
475
475
  }
476
476
 
477
477
  // src/hooks/use-copilot-chat_internal.ts
478
- var import_react14 = require("@copilotkitnext/react");
478
+ var import_react15 = require("@copilotkitnext/react");
479
479
 
480
480
  // src/hooks/use-lazy-tool-renderer.tsx
481
481
  var import_react9 = require("@copilotkitnext/react");
@@ -506,8 +506,11 @@ function useLazyToolRenderer() {
506
506
  var import_client = require("@ag-ui/client");
507
507
 
508
508
  // src/hooks/use-coagent-state-render-bridge.tsx
509
- var import_react11 = require("@copilotkitnext/react");
510
- var import_react12 = require("react");
509
+ var import_react12 = require("@copilotkitnext/react");
510
+ var import_react13 = require("react");
511
+ var import_shared4 = require("@copilotkit/shared");
512
+
513
+ // src/hooks/use-coagent-state-render-bridge.helpers.ts
511
514
  var import_shared3 = require("@copilotkit/shared");
512
515
  function getStateWithoutConstantKeys(state) {
513
516
  if (!state)
@@ -530,16 +533,294 @@ function areStatesEquals(a, b) {
530
533
  ]);
531
534
  return JSON.stringify(aWithoutConstantKeys) === JSON.stringify(bWithoutConstantKeys);
532
535
  }
536
+ function isPlaceholderMessageId(messageId) {
537
+ return !!messageId && messageId.startsWith("coagent-state-render-");
538
+ }
539
+ function isPlaceholderMessageName(messageName) {
540
+ return messageName === "coagent-state-render";
541
+ }
542
+ function readCachedMessageEntry(entry) {
543
+ if (!entry || typeof entry !== "object") {
544
+ return { snapshot: entry, runId: void 0 };
545
+ }
546
+ const snapshot = "snapshot" in entry ? entry.snapshot : entry;
547
+ const runId = "runId" in entry ? entry.runId : void 0;
548
+ return { snapshot, runId };
549
+ }
550
+ function getEffectiveRunId({
551
+ existingClaimRunId,
552
+ cachedMessageRunId,
553
+ runId
554
+ }) {
555
+ return existingClaimRunId || cachedMessageRunId || runId || "pending";
556
+ }
557
+ function resolveClaim({
558
+ claims,
559
+ context,
560
+ stateSnapshot
561
+ }) {
562
+ const { messageId, stateRenderId, runId, messageIndex } = context;
563
+ const existing = claims[messageId];
564
+ if (existing) {
565
+ const canRender = existing.stateRenderId === stateRenderId;
566
+ const shouldUpdateRunId = canRender && runId && (!existing.runId || existing.runId === "pending");
567
+ return {
568
+ canRender,
569
+ action: canRender ? "existing" /* Existing */ : "block" /* Block */,
570
+ updateRunId: shouldUpdateRunId ? runId : void 0
571
+ };
572
+ }
573
+ const normalizedRunId = runId != null ? runId : "pending";
574
+ const renderClaimedByOtherMessageEntry = Object.entries(claims).find(
575
+ ([, claim]) => {
576
+ var _a;
577
+ return claim.stateRenderId === stateRenderId && ((_a = claim.runId) != null ? _a : "pending") === normalizedRunId && (0, import_shared3.dataToUUID)(getStateWithoutConstantKeys(claim.stateSnapshot)) === (0, import_shared3.dataToUUID)(getStateWithoutConstantKeys(stateSnapshot));
578
+ }
579
+ );
580
+ const renderClaimedByOtherMessage = renderClaimedByOtherMessageEntry == null ? void 0 : renderClaimedByOtherMessageEntry[1];
581
+ const claimedMessageId = renderClaimedByOtherMessageEntry == null ? void 0 : renderClaimedByOtherMessageEntry[0];
582
+ if (renderClaimedByOtherMessage) {
583
+ if (messageIndex !== void 0 && renderClaimedByOtherMessage.messageIndex !== void 0 && messageIndex > renderClaimedByOtherMessage.messageIndex) {
584
+ return {
585
+ canRender: true,
586
+ action: "override" /* Override */,
587
+ nextClaim: { stateRenderId, runId, messageIndex },
588
+ lockOthers: runId === renderClaimedByOtherMessage.runId || isPlaceholderMessageId(claimedMessageId)
589
+ };
590
+ }
591
+ if (runId && renderClaimedByOtherMessage.runId && runId !== renderClaimedByOtherMessage.runId) {
592
+ return {
593
+ canRender: true,
594
+ action: "override" /* Override */,
595
+ nextClaim: { stateRenderId, runId, messageIndex },
596
+ lockOthers: isPlaceholderMessageId(claimedMessageId)
597
+ };
598
+ }
599
+ if (isPlaceholderMessageId(claimedMessageId)) {
600
+ return {
601
+ canRender: true,
602
+ action: "override" /* Override */,
603
+ nextClaim: { stateRenderId, runId, messageIndex },
604
+ lockOthers: true
605
+ };
606
+ }
607
+ if (stateSnapshot && renderClaimedByOtherMessage.stateSnapshot && !areStatesEquals(renderClaimedByOtherMessage.stateSnapshot, stateSnapshot)) {
608
+ return {
609
+ canRender: true,
610
+ action: "override" /* Override */,
611
+ nextClaim: { stateRenderId, runId }
612
+ };
613
+ }
614
+ return { canRender: false, action: "block" /* Block */ };
615
+ }
616
+ if (!runId) {
617
+ return { canRender: false, action: "block" /* Block */ };
618
+ }
619
+ return {
620
+ canRender: true,
621
+ action: "create" /* Create */,
622
+ nextClaim: { stateRenderId, runId, messageIndex }
623
+ };
624
+ }
625
+ function selectSnapshot({
626
+ messageId,
627
+ messageName,
628
+ allowLiveState,
629
+ skipLatestCache,
630
+ stateRenderId,
631
+ effectiveRunId,
632
+ stateSnapshotProp,
633
+ agentState,
634
+ agentMessages,
635
+ existingClaim,
636
+ caches
637
+ }) {
638
+ var _a, _b, _c, _d, _e, _f;
639
+ const lastAssistantId = agentMessages ? (_a = [...agentMessages].reverse().find((msg) => msg.role === "assistant")) == null ? void 0 : _a.id : void 0;
640
+ const latestSnapshot = stateRenderId !== void 0 ? caches.byStateRenderAndRun[`${stateRenderId}::latest`] : void 0;
641
+ const messageIndex = agentMessages ? agentMessages.findIndex((msg) => msg.id === messageId) : -1;
642
+ const messageRole = messageIndex >= 0 && agentMessages ? (_b = agentMessages[messageIndex]) == null ? void 0 : _b.role : void 0;
643
+ let previousUserMessageId;
644
+ if (messageIndex > 0 && agentMessages) {
645
+ for (let i = messageIndex - 1; i >= 0; i -= 1) {
646
+ if (((_c = agentMessages[i]) == null ? void 0 : _c.role) === "user") {
647
+ previousUserMessageId = (_d = agentMessages[i]) == null ? void 0 : _d.id;
648
+ break;
649
+ }
650
+ }
651
+ }
652
+ const liveStateIsStale = stateSnapshotProp === void 0 && latestSnapshot !== void 0 && agentState !== void 0 && areStatesEquals(latestSnapshot, agentState);
653
+ const shouldUseLiveState = (Boolean(allowLiveState) || !lastAssistantId || messageId === lastAssistantId) && !liveStateIsStale;
654
+ const snapshot = stateSnapshotProp ? (0, import_shared3.parseJson)(stateSnapshotProp, stateSnapshotProp) : shouldUseLiveState ? agentState : void 0;
655
+ const hasSnapshotKeys = !!(snapshot && Object.keys(snapshot).length > 0);
656
+ const allowEmptySnapshot = snapshot !== void 0 && !hasSnapshotKeys && (stateSnapshotProp !== void 0 || shouldUseLiveState);
657
+ const messageCacheEntry = caches.byMessageId[messageId];
658
+ const cachedMessageSnapshot = readCachedMessageEntry(messageCacheEntry).snapshot;
659
+ const cacheKey = stateRenderId !== void 0 ? `${stateRenderId}::${effectiveRunId}` : void 0;
660
+ let cachedSnapshot = cachedMessageSnapshot != null ? cachedMessageSnapshot : caches.byMessageId[messageId];
661
+ if (cachedSnapshot === void 0 && cacheKey && caches.byStateRenderAndRun[cacheKey] !== void 0) {
662
+ cachedSnapshot = caches.byStateRenderAndRun[cacheKey];
663
+ }
664
+ if (cachedSnapshot === void 0 && stateRenderId && previousUserMessageId && caches.byStateRenderAndRun[`${stateRenderId}::pending:${previousUserMessageId}`] !== void 0) {
665
+ cachedSnapshot = caches.byStateRenderAndRun[`${stateRenderId}::pending:${previousUserMessageId}`];
666
+ }
667
+ if (cachedSnapshot === void 0 && !skipLatestCache && stateRenderId && messageRole !== "assistant" && (stateSnapshotProp !== void 0 || agentState && Object.keys(agentState).length > 0)) {
668
+ cachedSnapshot = caches.byStateRenderAndRun[`${stateRenderId}::latest`];
669
+ }
670
+ const snapshotForClaim = (existingClaim == null ? void 0 : existingClaim.locked) ? (_e = existingClaim.stateSnapshot) != null ? _e : cachedSnapshot : hasSnapshotKeys ? snapshot : (_f = existingClaim == null ? void 0 : existingClaim.stateSnapshot) != null ? _f : cachedSnapshot;
671
+ return { snapshot, hasSnapshotKeys, cachedSnapshot, allowEmptySnapshot, snapshotForClaim };
672
+ }
673
+
674
+ // src/hooks/use-coagent-state-render-registry.ts
675
+ var import_react11 = require("react");
676
+ var LAST_SNAPSHOTS_BY_RENDER_AND_RUN = "__lastSnapshotsByStateRenderIdAndRun";
677
+ var LAST_SNAPSHOTS_BY_MESSAGE = "__lastSnapshotsByMessageId";
678
+ function getClaimsStore(claimsRef) {
679
+ return claimsRef.current;
680
+ }
681
+ function getSnapshotCaches(claimsRef) {
682
+ var _a, _b;
683
+ const store = getClaimsStore(claimsRef);
684
+ return {
685
+ byStateRenderAndRun: (_a = store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN]) != null ? _a : {},
686
+ byMessageId: (_b = store[LAST_SNAPSHOTS_BY_MESSAGE]) != null ? _b : {}
687
+ };
688
+ }
689
+ function useStateRenderRegistry({
690
+ agentId,
691
+ stateRenderId,
692
+ message,
693
+ messageIndex,
694
+ stateSnapshot,
695
+ agentState,
696
+ agentMessages,
697
+ claimsRef
698
+ }) {
699
+ var _a, _b, _c, _d, _e, _f;
700
+ const store = getClaimsStore(claimsRef);
701
+ const runId = message.runId;
702
+ const cachedMessageEntry = (_a = store[LAST_SNAPSHOTS_BY_MESSAGE]) == null ? void 0 : _a[message.id];
703
+ const { runId: cachedMessageRunId } = readCachedMessageEntry(cachedMessageEntry);
704
+ const existingClaimRunId = (_b = claimsRef.current[message.id]) == null ? void 0 : _b.runId;
705
+ const effectiveRunId = getEffectiveRunId({
706
+ existingClaimRunId,
707
+ cachedMessageRunId,
708
+ runId
709
+ });
710
+ (0, import_react11.useEffect)(() => {
711
+ return () => {
712
+ var _a2, _b2, _c2, _d2;
713
+ const existingClaim2 = claimsRef.current[message.id];
714
+ if ((existingClaim2 == null ? void 0 : existingClaim2.stateSnapshot) && Object.keys(existingClaim2.stateSnapshot).length > 0) {
715
+ const snapshotCache = __spreadValues({}, (_a2 = store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN]) != null ? _a2 : {});
716
+ const cacheKey = `${existingClaim2.stateRenderId}::${(_b2 = existingClaim2.runId) != null ? _b2 : "pending"}`;
717
+ snapshotCache[cacheKey] = existingClaim2.stateSnapshot;
718
+ snapshotCache[`${existingClaim2.stateRenderId}::latest`] = existingClaim2.stateSnapshot;
719
+ store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN] = snapshotCache;
720
+ const messageCache = __spreadValues({}, (_c2 = store[LAST_SNAPSHOTS_BY_MESSAGE]) != null ? _c2 : {});
721
+ messageCache[message.id] = {
722
+ snapshot: existingClaim2.stateSnapshot,
723
+ runId: (_d2 = existingClaim2.runId) != null ? _d2 : effectiveRunId
724
+ };
725
+ store[LAST_SNAPSHOTS_BY_MESSAGE] = messageCache;
726
+ }
727
+ delete claimsRef.current[message.id];
728
+ };
729
+ }, [claimsRef, effectiveRunId, message.id]);
730
+ if (!stateRenderId) {
731
+ return { canRender: false };
732
+ }
733
+ const caches = getSnapshotCaches(claimsRef);
734
+ const existingClaim = claimsRef.current[message.id];
735
+ const { snapshot, hasSnapshotKeys, allowEmptySnapshot, snapshotForClaim } = selectSnapshot({
736
+ messageId: message.id,
737
+ messageName: message.name,
738
+ allowLiveState: isPlaceholderMessageName(message.name) || isPlaceholderMessageId(message.id),
739
+ skipLatestCache: isPlaceholderMessageName(message.name) || isPlaceholderMessageId(message.id),
740
+ stateRenderId,
741
+ effectiveRunId,
742
+ stateSnapshotProp: stateSnapshot,
743
+ agentState,
744
+ agentMessages,
745
+ existingClaim,
746
+ caches
747
+ });
748
+ const resolution = resolveClaim({
749
+ claims: claimsRef.current,
750
+ context: {
751
+ agentId,
752
+ messageId: message.id,
753
+ stateRenderId,
754
+ runId: effectiveRunId,
755
+ messageIndex
756
+ },
757
+ stateSnapshot: snapshotForClaim
758
+ });
759
+ if (resolution.action === "block" /* Block */) {
760
+ return { canRender: false };
761
+ }
762
+ if (resolution.updateRunId && claimsRef.current[message.id]) {
763
+ claimsRef.current[message.id].runId = resolution.updateRunId;
764
+ }
765
+ if (resolution.nextClaim) {
766
+ claimsRef.current[message.id] = resolution.nextClaim;
767
+ }
768
+ if (resolution.lockOthers) {
769
+ Object.entries(claimsRef.current).forEach(([id, claim]) => {
770
+ if (id !== message.id && claim.stateRenderId === stateRenderId) {
771
+ claim.locked = true;
772
+ }
773
+ });
774
+ }
775
+ if (existingClaim && !existingClaim.locked && (agentMessages == null ? void 0 : agentMessages.length)) {
776
+ const indexInAgentMessages = agentMessages.findIndex((msg) => msg.id === message.id);
777
+ if (indexInAgentMessages >= 0 && indexInAgentMessages < agentMessages.length - 1) {
778
+ existingClaim.locked = true;
779
+ }
780
+ }
781
+ const existingSnapshot = claimsRef.current[message.id].stateSnapshot;
782
+ const snapshotChanged = stateSnapshot && existingSnapshot !== void 0 && !areStatesEquals(existingSnapshot, snapshot);
783
+ if (snapshot && (stateSnapshot || hasSnapshotKeys || allowEmptySnapshot) && (!claimsRef.current[message.id].locked || snapshotChanged)) {
784
+ if (!claimsRef.current[message.id].locked || snapshotChanged) {
785
+ claimsRef.current[message.id].stateSnapshot = snapshot;
786
+ const snapshotCache = __spreadValues({}, (_c = store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN]) != null ? _c : {});
787
+ const cacheKey = `${stateRenderId}::${effectiveRunId}`;
788
+ snapshotCache[cacheKey] = snapshot;
789
+ snapshotCache[`${stateRenderId}::latest`] = snapshot;
790
+ store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN] = snapshotCache;
791
+ const messageCache = __spreadValues({}, (_d = store[LAST_SNAPSHOTS_BY_MESSAGE]) != null ? _d : {});
792
+ messageCache[message.id] = { snapshot, runId: effectiveRunId };
793
+ store[LAST_SNAPSHOTS_BY_MESSAGE] = messageCache;
794
+ if (stateSnapshot) {
795
+ claimsRef.current[message.id].locked = true;
796
+ }
797
+ }
798
+ } else if (snapshotForClaim) {
799
+ const existingSnapshot2 = claimsRef.current[message.id].stateSnapshot;
800
+ if (!existingSnapshot2) {
801
+ claimsRef.current[message.id].stateSnapshot = snapshotForClaim;
802
+ const snapshotCache = __spreadValues({}, (_e = store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN]) != null ? _e : {});
803
+ const cacheKey = `${stateRenderId}::${effectiveRunId}`;
804
+ snapshotCache[cacheKey] = snapshotForClaim;
805
+ snapshotCache[`${stateRenderId}::latest`] = snapshotForClaim;
806
+ store[LAST_SNAPSHOTS_BY_RENDER_AND_RUN] = snapshotCache;
807
+ const messageCache = __spreadValues({}, (_f = store[LAST_SNAPSHOTS_BY_MESSAGE]) != null ? _f : {});
808
+ messageCache[message.id] = { snapshot: snapshotForClaim, runId: effectiveRunId };
809
+ store[LAST_SNAPSHOTS_BY_MESSAGE] = messageCache;
810
+ }
811
+ }
812
+ return { canRender: true };
813
+ }
814
+
815
+ // src/hooks/use-coagent-state-render-bridge.tsx
533
816
  function useCoagentStateRenderBridge(agentId, props) {
534
817
  var _a;
535
- const { stateSnapshot, messageIndexInRun, message } = props;
818
+ const { stateSnapshot, message } = props;
536
819
  const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
537
- const { agent } = (0, import_react11.useAgent)({ agentId });
538
- const [nodeName, setNodeName] = (0, import_react12.useState)(void 0);
539
- const [, forceUpdate] = (0, import_react12.useState)(0);
540
- const runId = (_a = props.runId) != null ? _a : message.runId;
541
- const effectiveRunId = runId || "pending";
542
- (0, import_react12.useEffect)(() => {
820
+ const { agent } = (0, import_react12.useAgent)({ agentId });
821
+ const [nodeName, setNodeName] = (0, import_react13.useState)(void 0);
822
+ const [, forceUpdate] = (0, import_react13.useState)(0);
823
+ (0, import_react13.useEffect)(() => {
543
824
  if (!agent)
544
825
  return;
545
826
  const subscriber = {
@@ -562,103 +843,69 @@ function useCoagentStateRenderBridge(agentId, props) {
562
843
  unsubscribe();
563
844
  };
564
845
  }, [agentId, nodeName]);
565
- const getStateRender = (0, import_react12.useCallback)(
846
+ const getStateRender = (0, import_react13.useCallback)(
566
847
  (messageId) => {
567
- return Object.entries(coAgentStateRenders).find(([stateRenderId, stateRender]) => {
848
+ return Object.entries(coAgentStateRenders).find(([stateRenderId2, stateRender2]) => {
568
849
  if (claimsRef.current[messageId]) {
569
- return stateRenderId === claimsRef.current[messageId].stateRenderId;
850
+ return stateRenderId2 === claimsRef.current[messageId].stateRenderId;
570
851
  }
571
- const matchingAgentName = stateRender.name === agentId;
572
- const matchesNodeContext = stateRender.nodeName ? stateRender.nodeName === nodeName : true;
852
+ const matchingAgentName = stateRender2.name === agentId;
853
+ const matchesNodeContext = stateRender2.nodeName ? stateRender2.nodeName === nodeName : true;
573
854
  return matchingAgentName && matchesNodeContext;
574
855
  });
575
856
  },
576
857
  [coAgentStateRenders, nodeName, agentId]
577
858
  );
578
- const handleRenderRequest = ({
859
+ const stateRenderEntry = (0, import_react13.useMemo)(() => getStateRender(message.id), [getStateRender, message.id]);
860
+ const stateRenderId = stateRenderEntry == null ? void 0 : stateRenderEntry[0];
861
+ const stateRender = stateRenderEntry == null ? void 0 : stateRenderEntry[1];
862
+ const registryMessage = __spreadProps(__spreadValues({}, message), {
863
+ runId: (_a = props.runId) != null ? _a : message.runId
864
+ });
865
+ const { canRender } = useStateRenderRegistry({
866
+ agentId,
579
867
  stateRenderId,
580
- messageId,
581
- runId: runId2,
582
- stateSnapshot: renderSnapshot
583
- }) => {
584
- if (claimsRef.current[messageId]) {
585
- const canRender = claimsRef.current[messageId].stateRenderId === stateRenderId;
586
- if (canRender && runId2 && (!claimsRef.current[messageId].runId || claimsRef.current[messageId].runId === "pending")) {
587
- claimsRef.current[messageId].runId = runId2;
588
- }
589
- return canRender;
590
- }
591
- const renderClaimedByOtherMessage = Object.values(claimsRef.current).find(
592
- (c) => c.stateRenderId === stateRenderId && (0, import_shared3.dataToUUID)(getStateWithoutConstantKeys(c.stateSnapshot)) === (0, import_shared3.dataToUUID)(getStateWithoutConstantKeys(renderSnapshot))
593
- );
594
- if (renderClaimedByOtherMessage) {
595
- if (renderSnapshot && renderClaimedByOtherMessage.stateSnapshot && !areStatesEquals(renderClaimedByOtherMessage.stateSnapshot, renderSnapshot)) {
596
- claimsRef.current[messageId] = { stateRenderId, runId: runId2 };
597
- return true;
598
- }
599
- return false;
600
- }
601
- if (!runId2) {
602
- return false;
603
- }
604
- claimsRef.current[messageId] = { stateRenderId, runId: runId2 };
605
- return true;
606
- };
607
- return (0, import_react12.useMemo)(() => {
608
- var _a2, _b, _c;
609
- if (messageIndexInRun !== 0) {
610
- return null;
611
- }
612
- const [stateRenderId, stateRender] = (_a2 = getStateRender(message.id)) != null ? _a2 : [];
868
+ message: registryMessage,
869
+ messageIndex: props.messageIndex,
870
+ stateSnapshot,
871
+ agentState: agent == null ? void 0 : agent.state,
872
+ agentMessages: agent == null ? void 0 : agent.messages,
873
+ claimsRef
874
+ });
875
+ return (0, import_react13.useMemo)(() => {
876
+ var _a2, _b;
613
877
  if (!stateRender || !stateRenderId) {
614
878
  return null;
615
879
  }
616
- const snapshot = stateSnapshot ? (0, import_shared3.parseJson)(stateSnapshot, stateSnapshot) : agent == null ? void 0 : agent.state;
617
- const canRender = handleRenderRequest({
618
- stateRenderId,
619
- messageId: message.id,
620
- runId: effectiveRunId,
621
- stateSnapshot: snapshot
622
- });
623
880
  if (!canRender) {
624
881
  return null;
625
882
  }
626
- if (snapshot) {
627
- const existingSnapshot = claimsRef.current[message.id].stateSnapshot;
628
- const snapshotChanged = stateSnapshot && existingSnapshot !== void 0 && !areStatesEquals(existingSnapshot, snapshot);
629
- if (!claimsRef.current[message.id].locked || snapshotChanged) {
630
- claimsRef.current[message.id].stateSnapshot = snapshot;
631
- if (stateSnapshot) {
632
- claimsRef.current[message.id].locked = true;
633
- }
634
- }
635
- }
636
883
  if (stateRender.handler) {
637
884
  stateRender.handler({
638
- state: stateSnapshot ? (0, import_shared3.parseJson)(stateSnapshot, stateSnapshot) : (_b = agent == null ? void 0 : agent.state) != null ? _b : {},
885
+ state: stateSnapshot ? (0, import_shared4.parseJson)(stateSnapshot, stateSnapshot) : (_a2 = agent == null ? void 0 : agent.state) != null ? _a2 : {},
639
886
  nodeName: nodeName != null ? nodeName : ""
640
887
  });
641
888
  }
642
889
  if (stateRender.render) {
643
- const status = (agent == null ? void 0 : agent.isRunning) ? "inProgress" : "complete";
890
+ const status = (agent == null ? void 0 : agent.isRunning) ? "inProgress" /* InProgress */ : "complete" /* Complete */;
644
891
  if (typeof stateRender.render === "string")
645
892
  return stateRender.render;
646
893
  return stateRender.render({
647
894
  status,
648
895
  // Always use state from claim, to make sure the state does not seem "wiped" for a fraction of a second
649
- state: (_c = claimsRef.current[message.id].stateSnapshot) != null ? _c : {},
896
+ state: (_b = claimsRef.current[message.id].stateSnapshot) != null ? _b : {},
650
897
  nodeName: nodeName != null ? nodeName : ""
651
898
  });
652
899
  }
653
900
  }, [
654
- getStateRender,
655
- stateSnapshot,
901
+ stateRender,
902
+ stateRenderId,
656
903
  agent == null ? void 0 : agent.state,
657
904
  agent == null ? void 0 : agent.isRunning,
658
905
  nodeName,
659
- effectiveRunId,
660
906
  message.id,
661
- messageIndexInRun
907
+ stateSnapshot,
908
+ canRender
662
909
  ]);
663
910
  }
664
911
  function CoAgentStateRenderBridge(props) {
@@ -674,13 +921,13 @@ function useCopilotChatInternal({
674
921
  onReloadMessages
675
922
  } = {}) {
676
923
  var _a, _b, _c;
677
- const { copilotkit } = (0, import_react14.useCopilotKit)();
924
+ const { copilotkit } = (0, import_react15.useCopilotKit)();
678
925
  const { threadId, agentSession } = useCopilotContext();
679
- const existingConfig = (0, import_react14.useCopilotChatConfiguration)();
680
- const [agentAvailable, setAgentAvailable] = (0, import_react13.useState)(false);
926
+ const existingConfig = (0, import_react15.useCopilotChatConfiguration)();
927
+ const [agentAvailable, setAgentAvailable] = (0, import_react14.useState)(false);
681
928
  const resolvedAgentId = (_a = existingConfig == null ? void 0 : existingConfig.agentId) != null ? _a : "default";
682
- const { agent } = (0, import_react14.useAgent)({ agentId: resolvedAgentId });
683
- (0, import_react13.useEffect)(() => {
929
+ const { agent } = (0, import_react15.useAgent)({ agentId: resolvedAgentId });
930
+ (0, import_react14.useEffect)(() => {
684
931
  const connect = (agent2) => __async(this, null, function* () {
685
932
  setAgentAvailable(false);
686
933
  try {
@@ -689,7 +936,7 @@ function useCopilotChatInternal({
689
936
  } catch (error) {
690
937
  if (error instanceof import_client.AGUIConnectNotImplementedError) {
691
938
  } else {
692
- throw error;
939
+ console.error("CopilotChat: connectAgent failed", error);
693
940
  }
694
941
  }
695
942
  });
@@ -700,7 +947,7 @@ function useCopilotChatInternal({
700
947
  return () => {
701
948
  };
702
949
  }, [existingConfig == null ? void 0 : existingConfig.threadId, agent, copilotkit, resolvedAgentId]);
703
- (0, import_react13.useEffect)(() => {
950
+ (0, import_react14.useEffect)(() => {
704
951
  onInProgress == null ? void 0 : onInProgress(Boolean(agent == null ? void 0 : agent.isRunning));
705
952
  }, [agent == null ? void 0 : agent.isRunning, onInProgress]);
706
953
  const interrupt = useLangGraphInterruptRender(agent);
@@ -708,7 +955,7 @@ function useCopilotChatInternal({
708
955
  agent == null ? void 0 : agent.setMessages([]);
709
956
  agent == null ? void 0 : agent.setState(null);
710
957
  };
711
- const deleteMessage = (0, import_react13.useCallback)(
958
+ const deleteMessage = (0, import_react14.useCallback)(
712
959
  (messageId) => {
713
960
  var _a2;
714
961
  const filteredMessages = ((_a2 = agent == null ? void 0 : agent.messages) != null ? _a2 : []).filter(
@@ -719,13 +966,13 @@ function useCopilotChatInternal({
719
966
  [agent == null ? void 0 : agent.setMessages, agent == null ? void 0 : agent.messages]
720
967
  );
721
968
  const latestDelete = useUpdatedRef(deleteMessage);
722
- const latestDeleteFunc = (0, import_react13.useCallback)(
969
+ const latestDeleteFunc = (0, import_react14.useCallback)(
723
970
  (messageId) => {
724
971
  return latestDelete.current(messageId);
725
972
  },
726
973
  [latestDelete]
727
974
  );
728
- const currentSuggestions = (0, import_react14.useSuggestions)({ agentId: resolvedAgentId });
975
+ const currentSuggestions = (0, import_react15.useSuggestions)({ agentId: resolvedAgentId });
729
976
  const reload = useAsyncCallback(
730
977
  (reloadMessageId) => __async(this, null, function* () {
731
978
  var _a2;
@@ -760,7 +1007,11 @@ function useCopilotChatInternal({
760
1007
  }
761
1008
  agent == null ? void 0 : agent.setMessages(historyCutoff);
762
1009
  if (agent) {
763
- copilotkit.runAgent({ agent });
1010
+ try {
1011
+ yield copilotkit.runAgent({ agent });
1012
+ } catch (error) {
1013
+ console.error("CopilotChat: runAgent failed during reload", error);
1014
+ }
764
1015
  }
765
1016
  return;
766
1017
  }),
@@ -800,7 +1051,7 @@ function useCopilotChatInternal({
800
1051
  }),
801
1052
  [latestSendMessageFunc]
802
1053
  );
803
- const latestSetMessagesFunc = (0, import_react13.useCallback)(
1054
+ const latestSetMessagesFunc = (0, import_react14.useCallback)(
804
1055
  (messages) => {
805
1056
  var _a2, _b2;
806
1057
  if (messages.every((message) => message instanceof import_runtime_client_gql2.Message)) {
@@ -823,7 +1074,7 @@ function useCopilotChatInternal({
823
1074
  }),
824
1075
  [latestReload, agent, onReloadMessages]
825
1076
  );
826
- const latestStopFunc = (0, import_react13.useCallback)(() => {
1077
+ const latestStopFunc = (0, import_react14.useCallback)(() => {
827
1078
  var _a2, _b2;
828
1079
  onStopGeneration == null ? void 0 : onStopGeneration({
829
1080
  currentAgentName: agent == null ? void 0 : agent.agentId,
@@ -832,11 +1083,11 @@ function useCopilotChatInternal({
832
1083
  return (_b2 = agent == null ? void 0 : agent.abortRun) == null ? void 0 : _b2.call(agent);
833
1084
  }, [onStopGeneration, agent]);
834
1085
  const latestReset = useUpdatedRef(reset);
835
- const latestResetFunc = (0, import_react13.useCallback)(() => {
1086
+ const latestResetFunc = (0, import_react14.useCallback)(() => {
836
1087
  return latestReset.current();
837
1088
  }, [latestReset]);
838
1089
  const lazyToolRendered = useLazyToolRenderer();
839
- const renderCustomMessage = (0, import_react14.useRenderCustomMessages)();
1090
+ const renderCustomMessage = (0, import_react15.useRenderCustomMessages)();
840
1091
  const legacyCustomMessageRenderer = useLegacyCoagentRenderer({
841
1092
  copilotkit,
842
1093
  agent,
@@ -844,7 +1095,8 @@ function useCopilotChatInternal({
844
1095
  threadId: (_b = existingConfig == null ? void 0 : existingConfig.threadId) != null ? _b : threadId
845
1096
  });
846
1097
  const allMessages = (_c = agent == null ? void 0 : agent.messages) != null ? _c : [];
847
- const resolvedMessages = (0, import_react13.useMemo)(() => {
1098
+ const resolvedMessages = (0, import_react14.useMemo)(() => {
1099
+ var _a2, _b2;
848
1100
  let processedMessages = allMessages.map((message) => {
849
1101
  if (message.role !== "assistant") {
850
1102
  return message;
@@ -857,31 +1109,78 @@ function useCopilotChatInternal({
857
1109
  }
858
1110
  }
859
1111
  const bridgeRenderer = legacyCustomMessageRenderer || renderCustomMessage ? () => {
860
- const customRender = renderCustomMessage == null ? void 0 : renderCustomMessage({
861
- message,
862
- position: "before"
863
- });
864
- if (customRender) {
865
- return customRender;
1112
+ var _a3;
1113
+ if (legacyCustomMessageRenderer) {
1114
+ return legacyCustomMessageRenderer({ message, position: "before" });
1115
+ }
1116
+ try {
1117
+ return (_a3 = renderCustomMessage == null ? void 0 : renderCustomMessage({ message, position: "before" })) != null ? _a3 : null;
1118
+ } catch (error) {
1119
+ console.warn(
1120
+ "[CopilotKit] renderCustomMessages failed, falling back to legacy renderer",
1121
+ error
1122
+ );
1123
+ return null;
866
1124
  }
867
- return legacyCustomMessageRenderer == null ? void 0 : legacyCustomMessageRenderer({ message, position: "before" });
868
1125
  } : null;
869
1126
  if (bridgeRenderer) {
870
- return __spreadProps(__spreadValues({}, message), { generativeUI: bridgeRenderer });
1127
+ return __spreadProps(__spreadValues({}, message), {
1128
+ generativeUI: bridgeRenderer,
1129
+ generativeUIPosition: "before"
1130
+ });
871
1131
  }
872
1132
  return message;
873
1133
  });
874
1134
  const hasAssistantMessages = processedMessages.some((msg) => msg.role === "assistant");
1135
+ const canUseCustomRenderer = Boolean(
1136
+ renderCustomMessage && ((_a2 = copilotkit == null ? void 0 : copilotkit.getAgent) == null ? void 0 : _a2.call(copilotkit, resolvedAgentId))
1137
+ );
1138
+ const placeholderRenderer = legacyCustomMessageRenderer ? legacyCustomMessageRenderer : canUseCustomRenderer ? renderCustomMessage : null;
1139
+ const shouldRenderPlaceholder = Boolean(agent == null ? void 0 : agent.isRunning) || Boolean((agent == null ? void 0 : agent.state) && Object.keys(agent.state).length);
1140
+ const effectiveThreadId = (_b2 = threadId != null ? threadId : agent == null ? void 0 : agent.threadId) != null ? _b2 : "default";
1141
+ let latestUserIndex = -1;
1142
+ for (let i = processedMessages.length - 1; i >= 0; i -= 1) {
1143
+ if (processedMessages[i].role === "user") {
1144
+ latestUserIndex = i;
1145
+ break;
1146
+ }
1147
+ }
1148
+ const latestUserMessageId = latestUserIndex >= 0 ? processedMessages[latestUserIndex].id : void 0;
1149
+ const currentRunId = latestUserMessageId ? copilotkit.getRunIdForMessage(resolvedAgentId, effectiveThreadId, latestUserMessageId) || `pending:${latestUserMessageId}` : void 0;
1150
+ const hasAssistantForCurrentRun = latestUserIndex >= 0 ? processedMessages.slice(latestUserIndex + 1).some((msg) => msg.role === "assistant") : hasAssistantMessages;
1151
+ if (placeholderRenderer && shouldRenderPlaceholder && !hasAssistantForCurrentRun) {
1152
+ const placeholderId = currentRunId ? `coagent-state-render-${resolvedAgentId}-${currentRunId}` : `coagent-state-render-${resolvedAgentId}`;
1153
+ const placeholderMessage = {
1154
+ id: placeholderId,
1155
+ role: "assistant",
1156
+ content: "",
1157
+ name: "coagent-state-render",
1158
+ runId: currentRunId
1159
+ };
1160
+ processedMessages = [
1161
+ ...processedMessages,
1162
+ __spreadProps(__spreadValues({}, placeholderMessage), {
1163
+ generativeUIPosition: "before",
1164
+ generativeUI: () => placeholderRenderer({
1165
+ message: placeholderMessage,
1166
+ position: "before"
1167
+ })
1168
+ })
1169
+ ];
1170
+ }
875
1171
  return processedMessages;
876
1172
  }, [
877
1173
  agent == null ? void 0 : agent.messages,
878
1174
  lazyToolRendered,
879
1175
  allMessages,
880
1176
  renderCustomMessage,
881
- // legacyCustomMessageRenderer,
882
- resolvedAgentId
1177
+ legacyCustomMessageRenderer,
1178
+ resolvedAgentId,
1179
+ copilotkit,
1180
+ agent == null ? void 0 : agent.isRunning,
1181
+ agent == null ? void 0 : agent.state
883
1182
  ]);
884
- const renderedSuggestions = (0, import_react13.useMemo)(() => {
1183
+ const renderedSuggestions = (0, import_react14.useMemo)(() => {
885
1184
  if (Array.isArray(suggestions)) {
886
1185
  return {
887
1186
  suggestions: suggestions.map((s) => __spreadProps(__spreadValues({}, s), { isLoading: false })),
@@ -916,8 +1215,8 @@ function useCopilotChatInternal({
916
1215
  };
917
1216
  }
918
1217
  function useUpdatedRef(value) {
919
- const ref = (0, import_react13.useRef)(value);
920
- (0, import_react13.useEffect)(() => {
1218
+ const ref = (0, import_react14.useRef)(value);
1219
+ (0, import_react14.useEffect)(() => {
921
1220
  ref.current = value;
922
1221
  }, [value]);
923
1222
  return ref;
@@ -928,14 +1227,15 @@ function useLegacyCoagentRenderer({
928
1227
  agentId,
929
1228
  threadId
930
1229
  }) {
931
- return (0, import_react13.useMemo)(() => {
1230
+ return (0, import_react14.useMemo)(() => {
932
1231
  if (!copilotkit || !agent) {
933
1232
  return null;
934
1233
  }
935
1234
  return ({ message, position }) => {
936
1235
  var _a;
937
1236
  const effectiveThreadId = (_a = threadId != null ? threadId : agent.threadId) != null ? _a : "default";
938
- const existingRunId = copilotkit.getRunIdForMessage(agentId, effectiveThreadId, message.id);
1237
+ const providedRunId = message.runId;
1238
+ const existingRunId = providedRunId ? providedRunId : copilotkit.getRunIdForMessage(agentId, effectiveThreadId, message.id);
939
1239
  const runId = existingRunId || `pending:${message.id}`;
940
1240
  const messageIndex = Math.max(
941
1241
  agent.messages.findIndex((msg) => msg.id === message.id),
@@ -951,7 +1251,7 @@ function useLegacyCoagentRenderer({
951
1251
  agentId,
952
1252
  stateSnapshot: message.state
953
1253
  };
954
- return (0, import_react13.createElement)(CoAgentStateRenderBridge, bridgeProps);
1254
+ return (0, import_react14.createElement)(CoAgentStateRenderBridge, bridgeProps);
955
1255
  };
956
1256
  }, [agent, agentId, copilotkit, threadId]);
957
1257
  }
@@ -983,7 +1283,7 @@ ${additionalInstructions}` : "");
983
1283
  }
984
1284
 
985
1285
  // src/hooks/use-copilot-chat-headless_c.ts
986
- var import_shared4 = require("@copilotkit/shared");
1286
+ var import_shared5 = require("@copilotkit/shared");
987
1287
  var createNonFunctionalReturn = () => ({
988
1288
  visibleMessages: [],
989
1289
  messages: [],
@@ -1023,20 +1323,20 @@ function useCopilotChatHeadless_c(options = {}) {
1023
1323
  const { copilotApiConfig, setBannerError } = useCopilotContext();
1024
1324
  const hasPublicApiKey = Boolean(copilotApiConfig.publicApiKey);
1025
1325
  const internalResult = useCopilotChatInternal(options);
1026
- (0, import_react15.useEffect)(() => {
1326
+ (0, import_react16.useEffect)(() => {
1027
1327
  if (!hasPublicApiKey) {
1028
1328
  setBannerError(
1029
- new import_shared4.CopilotKitError({
1329
+ new import_shared5.CopilotKitError({
1030
1330
  message: (
1031
1331
  // add link to documentation here
1032
1332
  "You're using useCopilotChatHeadless_c, a premium-only feature, which offers extensive headless chat capabilities. To continue, you'll need to provide a free public license key."
1033
1333
  ),
1034
- code: import_shared4.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
1035
- severity: import_shared4.Severity.WARNING,
1036
- visibility: import_shared4.ErrorVisibility.BANNER
1334
+ code: import_shared5.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR,
1335
+ severity: import_shared5.Severity.WARNING,
1336
+ visibility: import_shared5.ErrorVisibility.BANNER
1037
1337
  })
1038
1338
  );
1039
- import_shared4.styledConsole.logCopilotKitPlatformMessage();
1339
+ import_shared5.styledConsole.logCopilotKitPlatformMessage();
1040
1340
  } else {
1041
1341
  setBannerError(null);
1042
1342
  }