@copilotkit/react-core 1.73.3 → 1.74.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.
package/dist/v2/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_copilotkit = require('../copilotkit-D_c2dJ9t.cjs');
4
+ const require_copilotkit = require('../copilotkit-C5FS3iDK.cjs');
5
5
  require("./index.css");
6
6
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
7
7
  let _copilotkit_core = require("@copilotkit/core");
package/dist/v2/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { $ as useAgentContext, $i as ɵisRetryableMemoryStatus, $n as ResumeEntrySchema, $r as compactEvents, $t as BaseMessageSchema, A as CopilotChatMessageView, Ai as parseSSEStream, An as MemoryError, Ar as ThinkingEndEventSchema, At as CopilotChatInput_default, B as CopilotChatAssistantMessage_default, Bi as tokenUsageFromLangChainMetadata, Bn as OutputCapabilitiesSchema, Br as ToolCallSchema, Bt as ActivityMessageSchema, C as CopilotModalHeader, Ca as ɵselectThreadsError, Ci as ofType, Cn as InputContentDataSourceSchema, Cr as SuggestionEngine, Ct as useSandboxFunctions, D as CopilotChat, Di as onInspectorViewThread, Dn as IntelligenceAgent, Dr as TextMessageContentEventSchema, Dt as ɵrunMcpFollowUp, E as DefaultOpenIcon, Ei as onInspectorStopViewing, En as InputContentUrlSourceSchema, Er as TextMessageChunkEventSchema, Et as MCPAppsActivityType, F as CopilotChatSuggestionView, Fi as resolveDebugLogger, Fn as MultiAgentCapabilitiesSchema, Fr as TokenUsageSchema, Ft as AGUIConnectNotImplementedError, G as useLearnFromUserActionInCurrentThread, Gi as ɵInterruptState, Gn as ReasoningEncryptedValueSubtypeSchema, Gr as ToolsCapabilitiesSchema, Gt as AssistantMessageSchema, H as useLearningContainersInCurrentThread, Hi as transformHttpEventStream, Hn as RawEventSchema, Hr as ToolCallStatus, Ht as AgentCapabilitiesSchema, I as CopilotChatSuggestionPill, Ii as runHttpRequest, In as MultimodalCapabilitiesSchema, Ir as ToolCallArgsEventSchema, It as AGUIError, J as useThreads, Ji as ɵTHREAD_REQUEST_TIMEOUT_MS, Jn as ReasoningMessageContentEventSchema, Jr as VideoInputContentSchema, Jt as BackwardCompatibility_0_0_39, K as useLearnFromUserAction, Ki as ɵMAX_SOCKET_RETRIES, Kn as ReasoningEndEventSchema, Kr as TransportCapabilitiesSchema, Kt as AudioInputContentSchema, L as CopilotChatReasoningMessage_default, Li as select, Ln as MultimodalInputCapabilitiesSchema, Lr as ToolCallChunkEventSchema, Lt as AGUI_METADATA_KEY, M as IntelligenceIndicator, Mi as props, Mn as MessagesSnapshotEventSchema, Mr as ThinkingTextMessageContentEventSchema, Mt as CopilotChatAudioRecorder, N as getIntelligenceTurnAnchors, Ni as randomUUID, Nn as MetadataSchema, Nr as ThinkingTextMessageEndEventSchema, Nt as CopilotChatConfigurationProvider, O as CopilotChatView_default, Oi as onInspectorViewThreadResult, On as InterruptSchema, Or as TextMessageEndEventSchema, Ot as CopilotKitInspector, P as IntelligenceIndicatorView, Pi as resolveAgentDebugConfig, Pn as Middleware, Pr as ThinkingTextMessageStartEventSchema, Pt as useCopilotChatConfiguration, Q as useSuggestions, Qi as ɵisCopilotKitFeature, Qn as ReasoningStartEventSchema, Qr as buildResumeArray, Qt as BaseEventSchema, R as CopilotChatUserMessage_default, Ri as structuredClone_, Rn as MultimodalOutputCapabilitiesSchema, Rr as ToolCallEndEventSchema, Rt as AbstractAgent, S as CopilotSidebarView, Sa as ɵselectThreads, Si as mergeMetadata, Sn as ImageInputPartSchema, Sr as SubagentStartedEventSchema, St as SandboxFunctionsContext, T as DefaultCloseIcon, Ta as ɵthreadAdapterEvents, Ti as onInspectorActiveThread, Tn as InputContentSourceSchema, Tr as TextInputContentSchema, Tt as MCPAppsActivityRenderer, U as useLearningContainers, Ui as verifyEvents, Un as ReasoningCapabilitiesSchema, Ur as ToolMessageSchema, Ut as AgentRegistry, V as CopilotChatToolCallsView, Vi as transformChunks, Vn as ProxiedCopilotRuntimeAgent, Vr as ToolCallStartEventSchema, Vt as ActivitySnapshotEventSchema, W as useAttachments, Wi as ɵCOPILOTKIT_FEATURES, Wn as ReasoningEncryptedValueEventSchema, Wr as ToolSchema, Wt as AgentThreadLockedError, X as INTERRUPT_EVENT_NAME, Xi as ɵcreateThreadSelectors, Xn as ReasoningMessageSchema, Xr as WebMCPRegistry, Xt as BackwardCompatibility_0_0_47, Y as useInterrupt, Yi as ɵcreateMemoryStore, Yn as ReasoningMessageEndEventSchema, Yr as VideoInputPartSchema, Yt as BackwardCompatibility_0_0_45, Z as useConfigureSuggestions, Zi as ɵcreateThreadStore, Zn as ReasoningMessageStartEventSchema, Zr as aggregateTokenUsage, Zt as BackwardCompatibility_0_0_57, _ as WildcardToolCallRender, _a as ɵselectMemoriesAvailable, _i as getWebMCPModelContext, _n as HttpAgent, _r as SubagentErrorEventSchema, _t as GenerateSandboxedUiArgsSchema, aa as ɵmemoryRestEvents, ai as createInspectorThreadRequestId, an as CopilotKitCoreRuntimeConnectionStatus, ar as RunFinishedOutcomeSchema, at as useRenderTool, b as CopilotSidebar, ba as ɵselectMemoriesIsMutating, bi as isInterruptExpired, bn as IdentityCapabilitiesSchema, br as SubagentFinishedSuccessOutcomeSchema, bt as OpenGenerativeUIContentSchema, ca as ɵobservePhoenixSocketHealth$, ci as createStore, cn as DeveloperMessageSchema, cr as RunStartedEventSchema, ct as useFrontendTool, da as ɵphoenixSocket$, di as emitInspectorStopViewing, dn as EventSchemas, dr as StateManager, dt as CopilotKitProvider, ea as ɵjoinPhoenixChannel$, ei as completePartialMarkdown, en as BinaryInputContentSchema, er as RoleSchema, et as useCapabilities, fa as ɵselectFetchMoreError, fi as emitInspectorViewThread, fn as EventType, fr as StateSchema, ft as useCopilotKit, ga as ɵselectMemories, gi as getRunOutcome, gn as FunctionMiddleware, gr as SubAgentInfoSchema, gt as createA2UIMessageRenderer, ha as ɵselectIsMutating, hi as ensureObjectArgs, hn as FunctionCallSchema, hr as StepStartedEventSchema, ht as defineToolCallRenderer, ia as ɵmemoryReducer, ii as createEffect, in as CopilotKitCoreErrorCode, ir as RunFinishedInterruptOutcomeSchema, it as useDefaultRenderTool, j as INTELLIGENCE_TURN_HEAD, ji as parseToolArguments, jn as MessageSchema, jr as ThinkingStartEventSchema, jt as AudioRecorderError, k as CopilotChatAttachmentQueue, ki as parseProtoStream, kn as MEMORY_ERROR_REGISTRY, kr as TextMessageStartEventSchema, kt as useRenderToolCall, la as ɵobservePhoenixSocketSignals$, li as defaultApplyEvents, ln as DocumentInputContentSchema, lr as StateCapabilitiesSchema, lt as useRenderActivityMessage, ma as ɵselectIsFetchingNextPage, mi as empty, mn as FilterToolCallsMiddleware, mr as StepFinishedEventSchema, mt as CopilotKitCoreReact, na as ɵmemoryAdapterEvents, ni as createActionGroup, nn as ContextStore, nr as RunErrorEventSchema, nt as useAgent, oa as ɵobservePhoenixEvent$, oi as createReducer, on as CustomEventSchema, or as RunFinishedSuccessOutcomeSchema, ot as useComponent, pa as ɵselectHasNextPage, pi as emitInspectorViewThreadResult, pn as ExecutionCapabilitiesSchema, pr as StateSnapshotEventSchema, pt as useLicenseContext, q as useMemories, qi as ɵRUNTIME_PROBE_TIMEOUT_MS, qn as ReasoningMessageChunkEventSchema, qr as UserMessageSchema, qt as AudioInputPartSchema, ra as ɵmemoryDomainEvents, ri as createDebugLogger, rn as CopilotKitCore, rr as RunFinishedEventSchema, rt as useHumanInTheLoop, sa as ɵobservePhoenixJoinOutcome$, si as createSelector, sn as DebugLogger, sr as RunHandler, st as useFrontendTools, t as CopilotKit, ta as ɵmapMemoryMetadataEvent, ti as convertToLegacyEvents, tn as ContextSchema, tr as RunAgentInputSchema, tt as UseAgentUpdate, ua as ɵphoenixChannel$, ui as emitInspectorActiveThread, un as DocumentInputPartSchema, ur as StateDeltaEventSchema, ut as useRenderCustomMessages, v as CopilotThreadsDrawer, va as ɵselectMemoriesError, vi as isAbortError, vn as HumanInTheLoopCapabilitiesSchema, vr as SubagentFinishedEventSchema, vt as OpenGenerativeUIActivityRenderer, w as CopilotChatToggleButton, wa as ɵselectThreadsIsLoading, wi as on, wn as InputContentSchema, wr as SystemMessageSchema, wt as MCPAppsActivityContentSchema, x as CopilotPopupView, xa as ɵselectMemoriesRealtimeStatus, xi as isRunCompletionAware, xn as ImageInputContentSchema, xr as SubagentFinishedSuspendedOutcomeSchema, xt as OpenGenerativeUIToolRenderer, y as CopilotPopup, ya as ɵselectMemoriesIsLoading, yi as isInspectorThreadBridgeEnabled, yn as INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, yr as SubagentFinishedOutcomeSchema, yt as OpenGenerativeUIActivityType, z as CopilotChatAttachmentRenderer, zi as tokenUsageFromAiSdkUsage, zn as OptionalMetadataSchema, zr as ToolCallResultEventSchema, zt as ActivityDeltaEventSchema } from "../copilotkit-CwVE-0JG.mjs";
3
+ import { $ as useAgentContext, $i as ɵisRetryableMemoryStatus, $n as ResumeEntrySchema, $r as compactEvents, $t as BaseMessageSchema, A as CopilotChatMessageView, Ai as parseSSEStream, An as MemoryError, Ar as ThinkingEndEventSchema, At as CopilotChatInput_default, B as CopilotChatAssistantMessage_default, Bi as tokenUsageFromLangChainMetadata, Bn as OutputCapabilitiesSchema, Br as ToolCallSchema, Bt as ActivityMessageSchema, C as CopilotModalHeader, Ca as ɵselectThreadsError, Ci as ofType, Cn as InputContentDataSourceSchema, Cr as SuggestionEngine, Ct as useSandboxFunctions, D as CopilotChat, Di as onInspectorViewThread, Dn as IntelligenceAgent, Dr as TextMessageContentEventSchema, Dt as ɵrunMcpFollowUp, E as DefaultOpenIcon, Ei as onInspectorStopViewing, En as InputContentUrlSourceSchema, Er as TextMessageChunkEventSchema, Et as MCPAppsActivityType, F as CopilotChatSuggestionView, Fi as resolveDebugLogger, Fn as MultiAgentCapabilitiesSchema, Fr as TokenUsageSchema, Ft as AGUIConnectNotImplementedError, G as useLearnFromUserActionInCurrentThread, Gi as ɵInterruptState, Gn as ReasoningEncryptedValueSubtypeSchema, Gr as ToolsCapabilitiesSchema, Gt as AssistantMessageSchema, H as useLearningContainersInCurrentThread, Hi as transformHttpEventStream, Hn as RawEventSchema, Hr as ToolCallStatus, Ht as AgentCapabilitiesSchema, I as CopilotChatSuggestionPill, Ii as runHttpRequest, In as MultimodalCapabilitiesSchema, Ir as ToolCallArgsEventSchema, It as AGUIError, J as useThreads, Ji as ɵTHREAD_REQUEST_TIMEOUT_MS, Jn as ReasoningMessageContentEventSchema, Jr as VideoInputContentSchema, Jt as BackwardCompatibility_0_0_39, K as useLearnFromUserAction, Ki as ɵMAX_SOCKET_RETRIES, Kn as ReasoningEndEventSchema, Kr as TransportCapabilitiesSchema, Kt as AudioInputContentSchema, L as CopilotChatReasoningMessage_default, Li as select, Ln as MultimodalInputCapabilitiesSchema, Lr as ToolCallChunkEventSchema, Lt as AGUI_METADATA_KEY, M as IntelligenceIndicator, Mi as props, Mn as MessagesSnapshotEventSchema, Mr as ThinkingTextMessageContentEventSchema, Mt as CopilotChatAudioRecorder, N as getIntelligenceTurnAnchors, Ni as randomUUID, Nn as MetadataSchema, Nr as ThinkingTextMessageEndEventSchema, Nt as CopilotChatConfigurationProvider, O as CopilotChatView_default, Oi as onInspectorViewThreadResult, On as InterruptSchema, Or as TextMessageEndEventSchema, Ot as CopilotKitInspector, P as IntelligenceIndicatorView, Pi as resolveAgentDebugConfig, Pn as Middleware, Pr as ThinkingTextMessageStartEventSchema, Pt as useCopilotChatConfiguration, Q as useSuggestions, Qi as ɵisCopilotKitFeature, Qn as ReasoningStartEventSchema, Qr as buildResumeArray, Qt as BaseEventSchema, R as CopilotChatUserMessage_default, Ri as structuredClone_, Rn as MultimodalOutputCapabilitiesSchema, Rr as ToolCallEndEventSchema, Rt as AbstractAgent, S as CopilotSidebarView, Sa as ɵselectThreads, Si as mergeMetadata, Sn as ImageInputPartSchema, Sr as SubagentStartedEventSchema, St as SandboxFunctionsContext, T as DefaultCloseIcon, Ta as ɵthreadAdapterEvents, Ti as onInspectorActiveThread, Tn as InputContentSourceSchema, Tr as TextInputContentSchema, Tt as MCPAppsActivityRenderer, U as useLearningContainers, Ui as verifyEvents, Un as ReasoningCapabilitiesSchema, Ur as ToolMessageSchema, Ut as AgentRegistry, V as CopilotChatToolCallsView, Vi as transformChunks, Vn as ProxiedCopilotRuntimeAgent, Vr as ToolCallStartEventSchema, Vt as ActivitySnapshotEventSchema, W as useAttachments, Wi as ɵCOPILOTKIT_FEATURES, Wn as ReasoningEncryptedValueEventSchema, Wr as ToolSchema, Wt as AgentThreadLockedError, X as INTERRUPT_EVENT_NAME, Xi as ɵcreateThreadSelectors, Xn as ReasoningMessageSchema, Xr as WebMCPRegistry, Xt as BackwardCompatibility_0_0_47, Y as useInterrupt, Yi as ɵcreateMemoryStore, Yn as ReasoningMessageEndEventSchema, Yr as VideoInputPartSchema, Yt as BackwardCompatibility_0_0_45, Z as useConfigureSuggestions, Zi as ɵcreateThreadStore, Zn as ReasoningMessageStartEventSchema, Zr as aggregateTokenUsage, Zt as BackwardCompatibility_0_0_57, _ as WildcardToolCallRender, _a as ɵselectMemoriesAvailable, _i as getWebMCPModelContext, _n as HttpAgent, _r as SubagentErrorEventSchema, _t as GenerateSandboxedUiArgsSchema, aa as ɵmemoryRestEvents, ai as createInspectorThreadRequestId, an as CopilotKitCoreRuntimeConnectionStatus, ar as RunFinishedOutcomeSchema, at as useRenderTool, b as CopilotSidebar, ba as ɵselectMemoriesIsMutating, bi as isInterruptExpired, bn as IdentityCapabilitiesSchema, br as SubagentFinishedSuccessOutcomeSchema, bt as OpenGenerativeUIContentSchema, ca as ɵobservePhoenixSocketHealth$, ci as createStore, cn as DeveloperMessageSchema, cr as RunStartedEventSchema, ct as useFrontendTool, da as ɵphoenixSocket$, di as emitInspectorStopViewing, dn as EventSchemas, dr as StateManager, dt as CopilotKitProvider, ea as ɵjoinPhoenixChannel$, ei as completePartialMarkdown, en as BinaryInputContentSchema, er as RoleSchema, et as useCapabilities, fa as ɵselectFetchMoreError, fi as emitInspectorViewThread, fn as EventType, fr as StateSchema, ft as useCopilotKit, ga as ɵselectMemories, gi as getRunOutcome, gn as FunctionMiddleware, gr as SubAgentInfoSchema, gt as createA2UIMessageRenderer, ha as ɵselectIsMutating, hi as ensureObjectArgs, hn as FunctionCallSchema, hr as StepStartedEventSchema, ht as defineToolCallRenderer, ia as ɵmemoryReducer, ii as createEffect, in as CopilotKitCoreErrorCode, ir as RunFinishedInterruptOutcomeSchema, it as useDefaultRenderTool, j as INTELLIGENCE_TURN_HEAD, ji as parseToolArguments, jn as MessageSchema, jr as ThinkingStartEventSchema, jt as AudioRecorderError, k as CopilotChatAttachmentQueue, ki as parseProtoStream, kn as MEMORY_ERROR_REGISTRY, kr as TextMessageStartEventSchema, kt as useRenderToolCall, la as ɵobservePhoenixSocketSignals$, li as defaultApplyEvents, ln as DocumentInputContentSchema, lr as StateCapabilitiesSchema, lt as useRenderActivityMessage, ma as ɵselectIsFetchingNextPage, mi as empty, mn as FilterToolCallsMiddleware, mr as StepFinishedEventSchema, mt as CopilotKitCoreReact, na as ɵmemoryAdapterEvents, ni as createActionGroup, nn as ContextStore, nr as RunErrorEventSchema, nt as useAgent, oa as ɵobservePhoenixEvent$, oi as createReducer, on as CustomEventSchema, or as RunFinishedSuccessOutcomeSchema, ot as useComponent, pa as ɵselectHasNextPage, pi as emitInspectorViewThreadResult, pn as ExecutionCapabilitiesSchema, pr as StateSnapshotEventSchema, pt as useLicenseContext, q as useMemories, qi as ɵRUNTIME_PROBE_TIMEOUT_MS, qn as ReasoningMessageChunkEventSchema, qr as UserMessageSchema, qt as AudioInputPartSchema, ra as ɵmemoryDomainEvents, ri as createDebugLogger, rn as CopilotKitCore, rr as RunFinishedEventSchema, rt as useHumanInTheLoop, sa as ɵobservePhoenixJoinOutcome$, si as createSelector, sn as DebugLogger, sr as RunHandler, st as useFrontendTools, t as CopilotKit, ta as ɵmapMemoryMetadataEvent, ti as convertToLegacyEvents, tn as ContextSchema, tr as RunAgentInputSchema, tt as UseAgentUpdate, ua as ɵphoenixChannel$, ui as emitInspectorActiveThread, un as DocumentInputPartSchema, ur as StateDeltaEventSchema, ut as useRenderCustomMessages, v as CopilotThreadsDrawer, va as ɵselectMemoriesError, vi as isAbortError, vn as HumanInTheLoopCapabilitiesSchema, vr as SubagentFinishedEventSchema, vt as OpenGenerativeUIActivityRenderer, w as CopilotChatToggleButton, wa as ɵselectThreadsIsLoading, wi as on, wn as InputContentSchema, wr as SystemMessageSchema, wt as MCPAppsActivityContentSchema, x as CopilotPopupView, xa as ɵselectMemoriesRealtimeStatus, xi as isRunCompletionAware, xn as ImageInputContentSchema, xr as SubagentFinishedSuspendedOutcomeSchema, xt as OpenGenerativeUIToolRenderer, y as CopilotPopup, ya as ɵselectMemoriesIsLoading, yi as isInspectorThreadBridgeEnabled, yn as INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, yr as SubagentFinishedOutcomeSchema, yt as OpenGenerativeUIActivityType, z as CopilotChatAttachmentRenderer, zi as tokenUsageFromAiSdkUsage, zn as OptionalMetadataSchema, zr as ToolCallResultEventSchema, zt as ActivityDeltaEventSchema } from "../copilotkit-DyZh7EH4.mjs";
4
4
  import "./index.css";
5
5
  import { defaultTheme as a2uiDefaultTheme } from "@copilotkit/a2ui-renderer";
6
6
 
@@ -1745,6 +1745,10 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1745
1745
  return renderToolCall;
1746
1746
  }
1747
1747
 
1748
+ //#endregion
1749
+ //#region package.json
1750
+ var version = "1.74.0";
1751
+
1748
1752
  //#endregion
1749
1753
  //#region src/v2/components/CopilotKitInspector.tsx
1750
1754
  const CopilotKitInspector = ({ core, openRequest, onVisibilityChange }) => {
@@ -1767,7 +1771,11 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1767
1771
  if (!mounted || !mountRef.current) return;
1768
1772
  mod.defineWebInspector?.();
1769
1773
  inspector = mountRef.current.ownerDocument.createElement(mod.WEB_INSPECTOR_TAG);
1770
- mod.configureWebInspectorElement(inspector, latestCoreRef.current);
1774
+ mod.configureWebInspectorElement(inspector, latestCoreRef.current, {
1775
+ development: process.env.NODE_ENV === "development",
1776
+ framework: "react",
1777
+ sdkVersion: version
1778
+ });
1771
1779
  inspector.addEventListener("cpk-inspector-visibility-change", handleVisibilityChange);
1772
1780
  mountRef.current.appendChild(inspector);
1773
1781
  inspectorRef.current = inspector;
@@ -3876,8 +3884,8 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
3876
3884
  if (aHasAgent === (b.agentId !== void 0)) return 0;
3877
3885
  return aHasAgent ? -1 : 1;
3878
3886
  });
3887
+ if (!customMessageRenderers.length) return null;
3879
3888
  return function(params) {
3880
- if (!customMessageRenderers.length) return null;
3881
3889
  const { message, position } = params;
3882
3890
  const resolvedRunId = copilotkit.getRunIdForMessage(agentId, threadId, message.id) ?? copilotkit.getRunIdsForThread(agentId, threadId).slice(-1)[0];
3883
3891
  const runId = resolvedRunId ?? `missing-run-id:${message.id}`;
@@ -7148,6 +7156,32 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
7148
7156
  */
7149
7157
  const ScrollElementContext = react.default.createContext(null);
7150
7158
 
7159
+ //#endregion
7160
+ //#region src/v2/components/chat/scroll-pinned-context.ts
7161
+ /**
7162
+ * True while the pin-to-bottom behaviour is actively following the bottom of
7163
+ * the thread — i.e. `use-stick-to-bottom` will animate the scroll position to
7164
+ * the bottom the next time the content grows.
7165
+ *
7166
+ * Only CopilotChatView's pin-to-bottom branch provides this. The other scroll
7167
+ * modes leave it `false`, which is correct: nothing else writes the scroll
7168
+ * position on its own, so no one is competing with the virtualizer.
7169
+ *
7170
+ * Why this exists: the virtualizer and `use-stick-to-bottom` both write
7171
+ * `scrollTop` on the same element. The virtualizer writes it to compensate
7172
+ * when a row above the viewport turns out taller than its estimate, so that
7173
+ * what the reader is looking at does not shift. That compensation is essential
7174
+ * while the reader is scrolled up — and pointless while pinned to the bottom,
7175
+ * because the pin is about to move the scroll position anyway. Worse than
7176
+ * pointless: the compensation changes the virtual container's height, the pin
7177
+ * reads that as content growth and animates, the animation brings unmeasured
7178
+ * rows into view, they measure, and the two keep shoving each other.
7179
+ *
7180
+ * Consumed by CopilotChatMessageView to stand the virtualizer down while the
7181
+ * pin owns the scroll position.
7182
+ */
7183
+ const ScrollPinnedContext = react.default.createContext(false);
7184
+
7151
7185
  //#endregion
7152
7186
  //#region src/v2/components/intelligence-indicator/IntelligenceIndicatorView.tsx
7153
7187
  /**
@@ -7613,6 +7647,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
7613
7647
  }
7614
7648
  const VIRTUALIZE_THRESHOLD = 50;
7615
7649
  function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, isRunning = false, children, className, ...props }) {
7650
+ const isPinnedToBottom = (0, react.useContext)(ScrollPinnedContext);
7616
7651
  const renderCustomMessage = useRenderCustomMessages();
7617
7652
  const { renderActivityMessage } = useRenderActivityMessage();
7618
7653
  const { copilotkit } = useCopilotKit();
@@ -7685,18 +7720,52 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
7685
7720
  if (process.env.NODE_ENV !== "production" && scrollElementFromCtx && scrollElementFromCtx.clientHeight === 0) console.warn("[CopilotKit] Chat scroll container has clientHeight=0 — virtualization disabled. Ensure the chat is rendered in a visible container with a non-zero height.");
7686
7721
  }, [scrollElementFromCtx]);
7687
7722
  const shouldVirtualize = !!scrollElement && !children && deduplicatedMessages.length > VIRTUALIZE_THRESHOLD;
7723
+ const measuredRef = react.default.useRef({
7724
+ total: 0,
7725
+ sizes: /* @__PURE__ */ new Map()
7726
+ });
7727
+ const firstMessageId = deduplicatedMessages[0]?.id;
7728
+ const measuredThreadRef = react.default.useRef(firstMessageId);
7729
+ if (measuredThreadRef.current !== firstMessageId) {
7730
+ measuredThreadRef.current = firstMessageId;
7731
+ measuredRef.current = {
7732
+ total: 0,
7733
+ sizes: /* @__PURE__ */ new Map()
7734
+ };
7735
+ }
7736
+ const estimateRowSize = react.default.useCallback(() => {
7737
+ const { total, sizes } = measuredRef.current;
7738
+ return sizes.size > 0 ? Math.max(1, Math.round(total / sizes.size)) : 100;
7739
+ }, []);
7740
+ const measureRowElement = react.default.useCallback((el) => {
7741
+ const height = el?.getBoundingClientRect().height ?? 0;
7742
+ const index = Number(el?.dataset?.index);
7743
+ if (height > 0 && Number.isInteger(index)) {
7744
+ const { total, sizes } = measuredRef.current;
7745
+ measuredRef.current.total = total - (sizes.get(index) ?? 0) + height;
7746
+ sizes.set(index, height);
7747
+ }
7748
+ return height;
7749
+ }, []);
7750
+ const isPinnedToBottomRef = react.default.useRef(isPinnedToBottom);
7751
+ const shouldAdjustScrollOnResize = react.default.useCallback((item, _delta, instance) => {
7752
+ if (isPinnedToBottomRef.current) return false;
7753
+ const scrollAdjustments = instance.scrollAdjustments ?? 0;
7754
+ return item.start < (instance.scrollOffset ?? 0) + scrollAdjustments;
7755
+ }, []);
7688
7756
  const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
7689
7757
  count: shouldVirtualize ? deduplicatedMessages.length : 0,
7690
7758
  getScrollElement: () => scrollElement,
7691
- estimateSize: () => 100,
7759
+ estimateSize: estimateRowSize,
7692
7760
  overscan: 5,
7693
- measureElement: (el) => el?.getBoundingClientRect().height ?? 0,
7761
+ measureElement: measureRowElement,
7694
7762
  initialRect: {
7695
7763
  width: 0,
7696
7764
  height: 600
7697
7765
  }
7698
7766
  });
7699
- const firstMessageId = deduplicatedMessages[0]?.id;
7767
+ isPinnedToBottomRef.current = isPinnedToBottom;
7768
+ virtualizer.shouldAdjustScrollPositionOnItemSizeChange = shouldAdjustScrollOnResize;
7700
7769
  (0, react.useLayoutEffect)(() => {
7701
7770
  if (!shouldVirtualize || !deduplicatedMessages.length) return;
7702
7771
  virtualizer.scrollToIndex(deduplicatedMessages.length - 1, { align: "end" });
@@ -7704,7 +7773,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
7704
7773
  const intelligenceTurnAnchors = (0, react.useMemo)(() => getIntelligenceTurnAnchors(deduplicatedMessages), [deduplicatedMessages]);
7705
7774
  const renderMessageBlock = (message) => {
7706
7775
  const elements = [];
7707
- const stateSnapshot = getStateSnapshotForMessage(message.id);
7776
+ const stateSnapshot = renderCustomMessage ? getStateSnapshotForMessage(message.id) : void 0;
7708
7777
  const rowKey = rowRenderKeys.get(message.id) ?? message.id;
7709
7778
  if (renderCustomMessage) elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedCustomMessage, {
7710
7779
  message,
@@ -8341,7 +8410,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
8341
8410
  }
8342
8411
  (function(_CopilotChatView) {
8343
8412
  const ScrollContent = ({ children, scrollToBottomButton, feather, inputContainerHeight, isResizing }) => {
8344
- const { isAtBottom, scrollToBottom, scrollRef } = (0, use_stick_to_bottom.useStickToBottomContext)();
8413
+ const { isAtBottom, scrollToBottom, scrollRef, state } = (0, use_stick_to_bottom.useStickToBottomContext)();
8345
8414
  const [scrollEl, setScrollEl] = (0, react.useState)(null);
8346
8415
  (0, react.useLayoutEffect)(() => {
8347
8416
  setScrollEl(scrollRef.current ?? null);
@@ -8349,25 +8418,28 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
8349
8418
  const BoundFeather = renderSlot(feather, CopilotChatView.Feather, {});
8350
8419
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollElementContext.Provider, {
8351
8420
  value: scrollEl,
8352
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8353
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(use_stick_to_bottom.StickToBottom.Content, {
8354
- className: "cpk:overflow-y-auto cpk:overflow-x-hidden",
8355
- style: {
8356
- flex: "1 1 0%",
8357
- minHeight: 0
8358
- },
8359
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8360
- className: "cpk:px-4 cpk:@3xl:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6",
8361
- children
8421
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollPinnedContext.Provider, {
8422
+ value: state.isAtBottom,
8423
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
8424
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(use_stick_to_bottom.StickToBottom.Content, {
8425
+ className: "cpk:overflow-y-auto cpk:overflow-x-hidden",
8426
+ style: {
8427
+ flex: "1 1 0%",
8428
+ minHeight: 0
8429
+ },
8430
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8431
+ className: "cpk:px-4 cpk:@3xl:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6",
8432
+ children
8433
+ })
8434
+ }),
8435
+ BoundFeather,
8436
+ !isAtBottom && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8437
+ className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
8438
+ style: { bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` },
8439
+ children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
8362
8440
  })
8363
- }),
8364
- BoundFeather,
8365
- !isAtBottom && !isResizing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
8366
- className: "cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none",
8367
- style: { bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` },
8368
- children: renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, { onClick: () => scrollToBottom() })
8369
- })
8370
- ] })
8441
+ ] })
8442
+ })
8371
8443
  });
8372
8444
  };
8373
8445
  const PinToSendScrollContainer = ({ children, scrollRef, contentRef, scrollToBottom, scrollToBottomButton, feather, inputContainerHeight, isResizing, nonAutoScrollEl, nonAutoScrollRefCallback, showScrollButton, className, ...props }) => {
@@ -10055,7 +10127,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
10055
10127
  const { status, checkFeature } = useLicenseContext();
10056
10128
  const licensePresent = status === "valid" || status === "expiring";
10057
10129
  const featureLicensed = checkFeature("threads");
10058
- const licensed = licensePresent && featureLicensed;
10130
+ const licensed = status === "unknown" || licensePresent && featureLicensed;
10059
10131
  const licensePending = status === null;
10060
10132
  const providerAgentId = useDefaultAgentId();
10061
10133
  const resolvedAgentId = agentId ?? configuration?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;