@copilotkit/react-core 1.69.3 → 1.70.0

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 (36) hide show
  1. package/dist/{copilotkit-JdHy0xdu.mjs → copilotkit-B7aFKfQR.mjs} +65 -21
  2. package/dist/copilotkit-B7aFKfQR.mjs.map +1 -0
  3. package/dist/{copilotkit-BPeh62mW.cjs → copilotkit-BE76j111.cjs} +70 -20
  4. package/dist/copilotkit-BE76j111.cjs.map +1 -0
  5. package/dist/{copilotkit-CrNUgJiq.d.cts → copilotkit-BuzP0VeG.d.cts} +31 -4
  6. package/dist/copilotkit-BuzP0VeG.d.cts.map +1 -0
  7. package/dist/{copilotkit-DgO31tBq.d.mts → copilotkit-CbZGwElm.d.mts} +31 -4
  8. package/dist/copilotkit-CbZGwElm.d.mts.map +1 -0
  9. package/dist/index.cjs +93 -21
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +17 -2
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +17 -2
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +93 -21
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +133 -32
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/headless.cjs +14 -7
  20. package/dist/v2/headless.cjs.map +1 -1
  21. package/dist/v2/headless.d.cts.map +1 -1
  22. package/dist/v2/headless.d.mts.map +1 -1
  23. package/dist/v2/headless.mjs +14 -7
  24. package/dist/v2/headless.mjs.map +1 -1
  25. package/dist/v2/index.cjs +2 -1
  26. package/dist/v2/index.d.cts +2 -2
  27. package/dist/v2/index.d.mts +2 -2
  28. package/dist/v2/index.mjs +2 -2
  29. package/dist/v2/index.umd.js +64 -19
  30. package/dist/v2/index.umd.js.map +1 -1
  31. package/package.json +9 -9
  32. package/skills/react-core/SKILL.md +1 -1
  33. package/dist/copilotkit-BPeh62mW.cjs.map +0 -1
  34. package/dist/copilotkit-CrNUgJiq.d.cts.map +0 -1
  35. package/dist/copilotkit-DgO31tBq.d.mts.map +0 -1
  36. package/dist/copilotkit-JdHy0xdu.mjs.map +0 -1
@@ -1352,7 +1352,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1352
1352
  side: "bottom",
1353
1353
  children: /* @__PURE__ */ jsxs("p", {
1354
1354
  className: "cpk:flex cpk:items-center cpk:gap-1 cpk:text-xs cpk:font-medium",
1355
- children: [/* @__PURE__ */ jsx("span", { children: "Add attachments" }), /* @__PURE__ */ jsx("code", {
1355
+ children: [/* @__PURE__ */ jsx("span", { children: labels.chatInputToolbarAddButtonLabel }), /* @__PURE__ */ jsx("code", {
1356
1356
  className: "cpk:rounded cpk:bg-[#4a4a4a] cpk:px-1 cpk:py-[1px] cpk:font-mono cpk:text-[11px] cpk:text-white cpk:dark:bg-[#e0e0e0] cpk:dark:text-black",
1357
1357
  children: "/"
1358
1358
  })]
@@ -3506,6 +3506,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3506
3506
  const a2uiCatalogProvided = !!a2ui?.catalog;
3507
3507
  const a2uiActive = runtimeA2UIEnabled || a2uiCatalogProvided;
3508
3508
  const [runtimeLicenseStatus, setRuntimeLicenseStatus] = useState(void 0);
3509
+ const [runtimeEntitlements, setRuntimeEntitlements] = useState(void 0);
3510
+ const [runtimeEntitlementRetryPending, setRuntimeEntitlementRetryPending] = useState(false);
3509
3511
  const requestInspectorOpen = useCallback((request) => {
3510
3512
  setInspectorOpenRequest({ ...request });
3511
3513
  }, []);
@@ -3696,6 +3698,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3696
3698
  setRuntimeA2UIEnabled(copilotkit.a2uiEnabled);
3697
3699
  setRuntimeOpenGenUIEnabled(copilotkit.openGenerativeUIEnabled);
3698
3700
  setRuntimeLicenseStatus(copilotkit.licenseStatus);
3701
+ setRuntimeEntitlements(copilotkit.runtimeEntitlements);
3702
+ setRuntimeEntitlementRetryPending(copilotkit.runtimeEntitlementRetryPending);
3699
3703
  };
3700
3704
  const subscription = copilotkit.subscribe({ onRuntimeConnectionStatusChanged: syncRuntimeInfo });
3701
3705
  syncRuntimeInfo();
@@ -3836,7 +3840,26 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3836
3840
  copilotkit,
3837
3841
  executingToolCallIds
3838
3842
  }), [copilotkit, executingToolCallIds]);
3839
- const licenseContextValue = useMemo(() => createLicenseContextValue(runtimeLicenseStatus), [runtimeLicenseStatus]);
3843
+ const retryableRuntimeEntitlementFailure = runtimeEntitlements?.status !== "ready" && runtimeEntitlements?.error.retryable === true;
3844
+ const hasNonReadyRuntimeEntitlement = runtimeEntitlements !== void 0 && runtimeEntitlements.status !== "ready";
3845
+ const hasLegacyRuntimeEntitlementFallback = runtimeLicenseStatus === "valid" || runtimeLicenseStatus === "expiring";
3846
+ const runtimeEntitlementRetryInProgress = retryableRuntimeEntitlementFailure && runtimeEntitlementRetryPending && !hasLegacyRuntimeEntitlementFallback;
3847
+ const runtimeEntitlementFailureSettled = hasNonReadyRuntimeEntitlement && !runtimeEntitlementRetryInProgress && !hasLegacyRuntimeEntitlementFallback;
3848
+ const licenseContextValue = useMemo(() => {
3849
+ const runtimeLicenseContext = createLicenseContextValue(runtimeEntitlementRetryInProgress ? void 0 : runtimeLicenseStatus, runtimeEntitlements);
3850
+ if (!runtimeEntitlementFailureSettled) return runtimeLicenseContext;
3851
+ return {
3852
+ ...runtimeLicenseContext,
3853
+ checkFeature: () => false,
3854
+ getLimit: () => null
3855
+ };
3856
+ }, [
3857
+ runtimeEntitlementFailureSettled,
3858
+ runtimeEntitlementRetryInProgress,
3859
+ runtimeEntitlements,
3860
+ runtimeLicenseStatus
3861
+ ]);
3862
+ const runtimeLicenseWarningStatus = runtimeEntitlementRetryInProgress ? void 0 : licenseContextValue.status ?? void 0;
3840
3863
  return /* @__PURE__ */ jsx(SandboxFunctionsContext.Provider, {
3841
3864
  value: sandboxFunctionsList,
3842
3865
  children: /* @__PURE__ */ jsx(CopilotKitContext.Provider, {
@@ -3856,10 +3879,10 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3856
3879
  openRequest: inspectorOpenRequest
3857
3880
  }) : null]
3858
3881
  }),
3859
- runtimeLicenseStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "no_license" }),
3860
- runtimeLicenseStatus === "expired" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expired" }),
3861
- runtimeLicenseStatus === "invalid" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "invalid" }),
3862
- runtimeLicenseStatus === "expiring" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expiring" })
3882
+ runtimeLicenseWarningStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "no_license" }),
3883
+ runtimeLicenseWarningStatus === "expired" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expired" }),
3884
+ runtimeLicenseWarningStatus === "invalid" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "invalid" }),
3885
+ runtimeLicenseWarningStatus === "expiring" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expiring" })
3863
3886
  ]
3864
3887
  })
3865
3888
  })
@@ -3959,7 +3982,7 @@ const EMPTY_DEPS$1 = [];
3959
3982
  function useFrontendTool(tool, deps) {
3960
3983
  const { copilotkit } = useCopilotKit();
3961
3984
  const extraDeps = deps ?? EMPTY_DEPS$1;
3962
- useEffect(() => {
3985
+ useLayoutEffect(() => {
3963
3986
  const name = tool.name;
3964
3987
  if (copilotkit.getTool({
3965
3988
  toolName: name,
@@ -4326,6 +4349,8 @@ function safeStringifyForAttr(value) {
4326
4349
 
4327
4350
  //#endregion
4328
4351
  //#region src/v2/hooks/use-human-in-the-loop.tsx
4352
+ /** Registration name of a catch-all tool: handles any otherwise-unhandled call. */
4353
+ const WILDCARD_TOOL_NAME = "*";
4329
4354
  function useHumanInTheLoop(tool, deps) {
4330
4355
  const { copilotkit } = useCopilotKit();
4331
4356
  const resolvePromiseRef = useRef(null);
@@ -4361,10 +4386,11 @@ function useHumanInTheLoop(tool, deps) {
4361
4386
  }, []);
4362
4387
  const RenderComponent = useCallback((props) => {
4363
4388
  const ToolComponent = tool.render;
4389
+ const name = tool.name === WILDCARD_TOOL_NAME ? props.name : tool.name;
4364
4390
  if (props.status === ToolCallStatus.InProgress) {
4365
4391
  const enhancedProps = {
4366
4392
  ...props,
4367
- name: tool.name,
4393
+ name,
4368
4394
  description: tool.description || "",
4369
4395
  agentId: tool.agentId,
4370
4396
  respond: void 0
@@ -4373,7 +4399,7 @@ function useHumanInTheLoop(tool, deps) {
4373
4399
  } else if (props.status === ToolCallStatus.Executing) {
4374
4400
  const enhancedProps = {
4375
4401
  ...props,
4376
- name: tool.name,
4402
+ name,
4377
4403
  description: tool.description || "",
4378
4404
  agentId: tool.agentId,
4379
4405
  respond
@@ -4382,7 +4408,7 @@ function useHumanInTheLoop(tool, deps) {
4382
4408
  } else if (props.status === ToolCallStatus.Complete) {
4383
4409
  const enhancedProps = {
4384
4410
  ...props,
4385
- name: tool.name,
4411
+ name,
4386
4412
  description: tool.description || "",
4387
4413
  agentId: tool.agentId,
4388
4414
  respond: void 0
@@ -4402,7 +4428,7 @@ function useHumanInTheLoop(tool, deps) {
4402
4428
  handler,
4403
4429
  render: RenderComponent
4404
4430
  }, deps);
4405
- useEffect(() => {
4431
+ useLayoutEffect(() => {
4406
4432
  return () => {
4407
4433
  copilotkit.removeHookRenderToolCall(tool.name, tool.agentId);
4408
4434
  };
@@ -4867,8 +4893,12 @@ function normalizeStaticSuggestions(suggestions) {
4867
4893
  }
4868
4894
 
4869
4895
  //#endregion
4870
- //#region src/v2/hooks/use-interrupt.tsx
4896
+ //#region src/v2/types/interrupt.ts
4897
+ /** Name of the legacy custom event agents emit to signal an interrupt. */
4871
4898
  const INTERRUPT_EVENT_NAME = "on_interrupt";
4899
+
4900
+ //#endregion
4901
+ //#region src/v2/hooks/use-interrupt.tsx
4872
4902
  function isPromiseLike(value) {
4873
4903
  return (typeof value === "object" || typeof value === "function") && value !== null && typeof Reflect.get(value, "then") === "function";
4874
4904
  }
@@ -5205,7 +5235,7 @@ function useThreadStoreSelector(store, selector) {
5205
5235
  */
5206
5236
  function useThreads$1({ agentId, includeArchived, limit, enabled = true }) {
5207
5237
  const { copilotkit } = useCopilotKit();
5208
- const [store] = useState(() => ɵcreateThreadStore({ fetch: globalThis.fetch }));
5238
+ const [store] = useState(() => ɵcreateThreadStore({ fetch: copilotkit.ɵruntimeFetch }));
5209
5239
  const coreThreads = useThreadStoreSelector(store, ɵselectThreads);
5210
5240
  const threads = useMemo(() => coreThreads.map(({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({
5211
5241
  id,
@@ -5904,21 +5934,35 @@ function CopilotChatToolCallsView({ message, messages = [] }) {
5904
5934
 
5905
5935
  //#endregion
5906
5936
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
5937
+ /**
5938
+ * Binds the Inspector action to the active chat without making the full
5939
+ * assistant message subscribe to chat configuration changes.
5940
+ */
5941
+ function BoundInspectorButton({ inspectorButton, messageId, openInspector, ...props }) {
5942
+ const chatConfiguration = useCopilotChatConfiguration();
5943
+ return renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, {
5944
+ ...props,
5945
+ onClick: () => openInspector({
5946
+ messageId,
5947
+ threadId: chatConfiguration?.threadId,
5948
+ agentId: chatConfiguration?.agentId
5949
+ })
5950
+ });
5951
+ }
5907
5952
  function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
5908
5953
  useKatexStyles();
5909
5954
  const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
5910
- const chatConfiguration = useCopilotChatConfiguration();
5911
5955
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
5912
5956
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
5913
5957
  if (message.content) return await copyToClipboard(message.content);
5914
5958
  return false;
5915
5959
  } });
5916
5960
  const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
5917
- const boundInspectorButton = renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, { onClick: () => openInspector({
5961
+ const boundInspectorButton = /* @__PURE__ */ jsx(BoundInspectorButton, {
5962
+ inspectorButton,
5918
5963
  messageId: message.id,
5919
- threadId: chatConfiguration?.threadId,
5920
- agentId: chatConfiguration?.agentId
5921
- }) });
5964
+ openInspector
5965
+ });
5922
5966
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
5923
5967
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
5924
5968
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
@@ -8498,7 +8542,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8498
8542
  const startRunActivityReconnectRef = useRef(null);
8499
8543
  const runtimeStatus = copilotkit.runtimeConnectionStatus === CopilotKitCoreRuntimeConnectionStatus.Connected ? "Connected" : copilotkit.runtimeConnectionStatus;
8500
8544
  const hasNativeIntelligenceRunActivity = hasExplicitThreadId && runtimeStatus === "Connected" && !!copilotkit.intelligence?.wsUrl && copilotkit.threadEndpoints?.realtimeMetadata === true;
8501
- const [standaloneRunActivityStore] = useState(() => ɵcreateThreadStore({ fetch: globalThis.fetch }));
8545
+ const [standaloneRunActivityStore] = useState(() => ɵcreateThreadStore({ fetch: copilotkit.ɵruntimeFetch }));
8502
8546
  const previousThreadRef = useRef(null);
8503
8547
  const hasExplicitThreadIdRef = useRef(hasExplicitThreadId);
8504
8548
  hasExplicitThreadIdRef.current = hasExplicitThreadId;
@@ -12099,5 +12143,5 @@ function validateProps(props) {
12099
12143
  }
12100
12144
 
12101
12145
  //#endregion
12102
- export { useCapabilities as $, CopilotChatMessageView as A, CopilotChatAudioRecorder as At, CopilotChatAssistantMessage_default as B, CopilotModalHeader as C, MCPAppsActivityRenderer as Ct, CopilotChat as D, useRenderToolCall as Dt, DefaultOpenIcon as E, CopilotKitInspector as Et, CopilotChatSuggestionView as F, useLearnFromUserActionInCurrentThread as G, useLearningContainersInCurrentThread as H, CopilotChatSuggestionPill as I, useThreads$1 as J, useLearnFromUserAction as K, CopilotChatReasoningMessage_default as L, IntelligenceIndicator as M, useCopilotChatConfiguration as Mt, getIntelligenceTurnAnchors as N, CopilotChatView_default as O, CopilotChatInput_default as Ot, IntelligenceIndicatorView as P, useAgentContext as Q, CopilotChatUserMessage_default as R, CopilotSidebarView as S, MCPAppsActivityContentSchema as St, DefaultCloseIcon as T, ɵrunMcpFollowUp as Tt, useLearningContainers as U, CopilotChatToolCallsView as V, useAttachments as W, useConfigureSuggestions as X, useInterrupt as Y, useSuggestions as Z, WildcardToolCallRender as _, OpenGenerativeUIActivityType as _t, ThreadsProvider as a, useComponent as at, CopilotSidebar as b, SandboxFunctionsContext as bt, CoAgentStateRendersProvider as c, useRenderCustomMessages as ct, shouldShowDevConsole as d, useLicenseContext$1 as dt, UseAgentUpdate as et, useToast as f, CopilotKitCoreReact as ft, useCopilotContext as g, OpenGenerativeUIActivityRenderer as gt, CopilotContext as h, GenerateSandboxedUiArgsSchema as ht, ThreadsContext as i, useRenderTool as it, INTELLIGENCE_TURN_HEAD as j, CopilotChatConfigurationProvider as jt, CopilotChatAttachmentQueue as k, AudioRecorderError as kt, useCoAgentStateRenders as l, CopilotKitProvider as lt, useCopilotMessagesContext as m, createA2UIMessageRenderer as mt, defaultCopilotContextCategories as n, useHumanInTheLoop as nt, useThreads as o, useFrontendTool as ot, CopilotMessagesContext as p, defineToolCallRenderer as pt, useMemories as q, CoAgentStateRenderBridge as r, useDefaultRenderTool as rt, CoAgentStateRendersContext as s, useRenderActivityMessage as st, CopilotKit as t, useAgent as tt, useAsyncCallback as u, useCopilotKit$1 as ut, CopilotThreadsDrawer as v, OpenGenerativeUIContentSchema as vt, CopilotChatToggleButton as w, MCPAppsActivityType as wt, CopilotPopupView as x, useSandboxFunctions as xt, CopilotPopup as y, OpenGenerativeUIToolRenderer as yt, CopilotChatAttachmentRenderer as z };
12103
- //# sourceMappingURL=copilotkit-JdHy0xdu.mjs.map
12146
+ export { useAgentContext as $, CopilotChatMessageView as A, AudioRecorderError as At, CopilotChatAssistantMessage_default as B, CopilotModalHeader as C, MCPAppsActivityContentSchema as Ct, CopilotChat as D, CopilotKitInspector as Dt, DefaultOpenIcon as E, ɵrunMcpFollowUp as Et, CopilotChatSuggestionView as F, useLearnFromUserActionInCurrentThread as G, useLearningContainersInCurrentThread as H, CopilotChatSuggestionPill as I, useThreads$1 as J, useLearnFromUserAction as K, CopilotChatReasoningMessage_default as L, IntelligenceIndicator as M, CopilotChatConfigurationProvider as Mt, getIntelligenceTurnAnchors as N, useCopilotChatConfiguration as Nt, CopilotChatView_default as O, useRenderToolCall as Ot, IntelligenceIndicatorView as P, useSuggestions as Q, CopilotChatUserMessage_default as R, CopilotSidebarView as S, useSandboxFunctions as St, DefaultCloseIcon as T, MCPAppsActivityType as Tt, useLearningContainers as U, CopilotChatToolCallsView as V, useAttachments as W, INTERRUPT_EVENT_NAME as X, useInterrupt as Y, useConfigureSuggestions as Z, WildcardToolCallRender as _, OpenGenerativeUIActivityRenderer as _t, ThreadsProvider as a, useRenderTool as at, CopilotSidebar as b, OpenGenerativeUIToolRenderer as bt, CoAgentStateRendersProvider as c, useRenderActivityMessage as ct, shouldShowDevConsole as d, useCopilotKit$1 as dt, useCapabilities as et, useToast as f, useLicenseContext$1 as ft, useCopilotContext as g, GenerateSandboxedUiArgsSchema as gt, CopilotContext as h, createA2UIMessageRenderer as ht, ThreadsContext as i, useDefaultRenderTool as it, INTELLIGENCE_TURN_HEAD as j, CopilotChatAudioRecorder as jt, CopilotChatAttachmentQueue as k, CopilotChatInput_default as kt, useCoAgentStateRenders as l, useRenderCustomMessages as lt, useCopilotMessagesContext as m, defineToolCallRenderer as mt, defaultCopilotContextCategories as n, useAgent as nt, useThreads as o, useComponent as ot, CopilotMessagesContext as p, CopilotKitCoreReact as pt, useMemories as q, CoAgentStateRenderBridge as r, useHumanInTheLoop as rt, CoAgentStateRendersContext as s, useFrontendTool as st, CopilotKit as t, UseAgentUpdate as tt, useAsyncCallback as u, CopilotKitProvider as ut, CopilotThreadsDrawer as v, OpenGenerativeUIActivityType as vt, CopilotChatToggleButton as w, MCPAppsActivityRenderer as wt, CopilotPopupView as x, SandboxFunctionsContext as xt, CopilotPopup as y, OpenGenerativeUIContentSchema as yt, CopilotChatAttachmentRenderer as z };
12147
+ //# sourceMappingURL=copilotkit-B7aFKfQR.mjs.map