@copilotkit/react-core 1.87.1 → 1.89.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 (38) hide show
  1. package/dist/{copilotkit-BNPEXnEE.d.mts → copilotkit-CfnudBCL.d.mts} +25 -5
  2. package/dist/copilotkit-CfnudBCL.d.mts.map +1 -0
  3. package/dist/{copilotkit-DFxtDD2N.cjs → copilotkit-DHJJxCeI.cjs} +330 -73
  4. package/dist/copilotkit-DHJJxCeI.cjs.map +1 -0
  5. package/dist/{copilotkit-BJ-6BoJ_.mjs → copilotkit-GWoyxfzS.mjs} +334 -77
  6. package/dist/copilotkit-GWoyxfzS.mjs.map +1 -0
  7. package/dist/{copilotkit-Bop-sY6y.d.cts → copilotkit-XLp7jKQk.d.cts} +25 -5
  8. package/dist/copilotkit-XLp7jKQk.d.cts.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.umd.js +22 -12
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/v2/generative-ui.d.cts +116 -116
  16. package/dist/v2/generative-ui.d.cts.map +1 -1
  17. package/dist/v2/generative-ui.d.mts +116 -116
  18. package/dist/v2/generative-ui.d.mts.map +1 -1
  19. package/dist/v2/headless.cjs +7 -2
  20. package/dist/v2/headless.cjs.map +1 -1
  21. package/dist/v2/headless.d.cts +5 -0
  22. package/dist/v2/headless.d.cts.map +1 -1
  23. package/dist/v2/headless.d.mts +5 -0
  24. package/dist/v2/headless.d.mts.map +1 -1
  25. package/dist/v2/headless.mjs +7 -2
  26. package/dist/v2/headless.mjs.map +1 -1
  27. package/dist/v2/index.cjs +19 -1
  28. package/dist/v2/index.css +1 -1
  29. package/dist/v2/index.d.cts +2 -2
  30. package/dist/v2/index.d.mts +2 -2
  31. package/dist/v2/index.mjs +2 -2
  32. package/dist/v2/index.umd.js +347 -72
  33. package/dist/v2/index.umd.js.map +1 -1
  34. package/package.json +10 -10
  35. package/dist/copilotkit-BJ-6BoJ_.mjs.map +0 -1
  36. package/dist/copilotkit-BNPEXnEE.d.mts.map +0 -1
  37. package/dist/copilotkit-Bop-sY6y.d.cts.map +0 -1
  38. package/dist/copilotkit-DFxtDD2N.cjs.map +0 -1
@@ -3,8 +3,8 @@ import { n as useKatexStyles, t as MarkdownSurfaces } from "./MarkdownSurfaces-C
3
3
  import { t as useGenerativeUIRoot } from "./use-generative-ui-root-WI9ERMpo.mjs";
4
4
  import * as React$1 from "react";
5
5
  import React, { Fragment, createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
6
- import { A2UI_FENCE_LANGUAGE, AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, CopilotKitHeaderResolutionError, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInspectorThreadBridgeEnabled as isInspectorThreadBridgeEnabled$1, isRunCompletionAware, isRunCompletionAware as isRunCompletionAware$1, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorStopViewing as onInspectorStopViewing$1, onInspectorViewThread, onInspectorViewThread as onInspectorViewThread$1, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown as splitA2UIMarkdown$1, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵclearAgentInterruptState, ɵclearAgentInterruptState as ɵclearAgentInterruptState$1, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵgetAgentInterruptState, ɵgetAgentInterruptState as ɵgetAgentInterruptState$1, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisHttpAgent as ɵisHttpAgent$1, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectFetchMoreError as ɵselectFetchMoreError$1, ɵselectHasNextPage, ɵselectHasNextPage as ɵselectHasNextPage$1, ɵselectIsFetchingNextPage, ɵselectIsFetchingNextPage as ɵselectIsFetchingNextPage$1, ɵselectIsMutating, ɵselectIsMutating as ɵselectIsMutating$1, ɵselectMemories, ɵselectMemories as ɵselectMemories$1, ɵselectMemoriesAvailable, ɵselectMemoriesAvailable as ɵselectMemoriesAvailable$1, ɵselectMemoriesError, ɵselectMemoriesError as ɵselectMemoriesError$1, ɵselectMemoriesIsLoading, ɵselectMemoriesIsLoading as ɵselectMemoriesIsLoading$1, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectMemoriesRealtimeStatus as ɵselectMemoriesRealtimeStatus$1, ɵselectThreads, ɵselectThreads as ɵselectThreads$1, ɵselectThreadsError, ɵselectThreadsError as ɵselectThreadsError$1, ɵselectThreadsIsLoading, ɵselectThreadsIsLoading as ɵselectThreadsIsLoading$1, ɵthreadAdapterEvents, ɵwithHeaderDefaults, ɵwithHeaderDefaults as ɵwithHeaderDefaults$1 } from "@copilotkit/core";
7
- import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError as AGUIConnectNotImplementedError$1, AGUIError, AGUI_METADATA_KEY, AbstractAgent as AbstractAgent$1, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, CompatibilityBoundary, DebugLogger, EventType, FilterToolCallsMiddleware, FunctionMiddleware, HttpAgent, Middleware, PROTOCOL_VERSION, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, compactEvents, contentHasMedia, contentToText as contentToText$1, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, enforceEvents, enforceOutgoingInput, getRunOutcome, isInterruptExpired, isRecognizedEvent, mergeMetadata, omitOptionalNulls, parseProtoStream, parseSSEStream, randomUUID, randomUUID as randomUUID$2, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents, withAuthoritativeActivityTypes } from "@ag-ui/client";
6
+ import { A2UI_FENCE_LANGUAGE, AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, CopilotKitHeaderResolutionError, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, IntelligenceReplayFailedError, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInspectorThreadBridgeEnabled as isInspectorThreadBridgeEnabled$1, isRunCompletionAware, isRunCompletionAware as isRunCompletionAware$1, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorStopViewing as onInspectorStopViewing$1, onInspectorViewThread, onInspectorViewThread as onInspectorViewThread$1, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown as splitA2UIMarkdown$1, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵclearAgentInterruptState, ɵclearAgentInterruptState as ɵclearAgentInterruptState$1, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵgetAgentInterruptState, ɵgetAgentInterruptState as ɵgetAgentInterruptState$1, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisHttpAgent as ɵisHttpAgent$1, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectFetchMoreError as ɵselectFetchMoreError$1, ɵselectHasNextPage, ɵselectHasNextPage as ɵselectHasNextPage$1, ɵselectIsFetchingNextPage, ɵselectIsFetchingNextPage as ɵselectIsFetchingNextPage$1, ɵselectIsMutating, ɵselectIsMutating as ɵselectIsMutating$1, ɵselectMemories, ɵselectMemories as ɵselectMemories$1, ɵselectMemoriesAvailable, ɵselectMemoriesAvailable as ɵselectMemoriesAvailable$1, ɵselectMemoriesError, ɵselectMemoriesError as ɵselectMemoriesError$1, ɵselectMemoriesIsLoading, ɵselectMemoriesIsLoading as ɵselectMemoriesIsLoading$1, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectMemoriesRealtimeStatus as ɵselectMemoriesRealtimeStatus$1, ɵselectThreads, ɵselectThreads as ɵselectThreads$1, ɵselectThreadsError, ɵselectThreadsError as ɵselectThreadsError$1, ɵselectThreadsIsLoading, ɵselectThreadsIsLoading as ɵselectThreadsIsLoading$1, ɵthreadAdapterEvents, ɵwithHeaderDefaults, ɵwithHeaderDefaults as ɵwithHeaderDefaults$1 } from "@copilotkit/core";
7
+ import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError as AGUIConnectNotImplementedError$1, AGUIEnforcementLimitError, AGUIError, AGUI_METADATA_KEY, AbstractAgent as AbstractAgent$1, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, CompatibilityBoundary, DEFAULT_MAX_ENFORCED_ENTRIES, DebugLogger, EventType, FilterToolCallsMiddleware, FunctionMiddleware, HttpAgent, Middleware, PROTOCOL_VERSION, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, compactEvents, contentHasMedia, contentToText as contentToText$1, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, enforceEvents, enforceOutgoingInput, getRunOutcome, isInterruptExpired, isRecognizedEvent, mergeMetadata, omitOptionalNulls, parseProtoStream, parseSSEStream, randomUUID, randomUUID as randomUUID$2, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents, withAuthoritativeActivityTypes } from "@ag-ui/client";
8
8
  import { ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AssistantMessageSchema, AttributableSchema, AudioInputContentSchema, AudioInputPartSchema, AudioPartSchema, BaseEventSchema, BaseMessageSchema, ContentPartSchema, ContextSchema, CopyOperationSchema, CustomEventSchema, DataSourceSchema, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchemas, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FunctionCallSchema, HumanInTheLoopCapabilitiesSchema, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, ImagePartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OptionalMetadataSchema, OutputCapabilitiesSchema, PartSourceSchema, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunStartedEventSchema, StateCapabilitiesSchema, StateDeltaEventSchema, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SystemMessageSchema, TestOperationSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TextPartSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UrlSourceSchema, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, VideoPartSchema } from "@ag-ui/core/schemas";
9
9
  import { extendTailwindMerge, twMerge } from "tailwind-merge";
10
10
  import { ArrowUp, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronRightIcon, Circle, Copy, Edit, EyeOff, Loader2, MessageCircle, Mic, PanelLeftOpen, Play, Plus, RefreshCw, Square, ThumbsDown, ThumbsUp, Upload, Volume2, Wrench, X } from "lucide-react";
@@ -24,7 +24,7 @@ import { A2UIProvider, A2UIRenderer, A2UI_SCHEMA_CONTEXT_DESCRIPTION, Catalog, C
24
24
  import { zodToJsonSchema } from "zod-to-json-schema";
25
25
  import * as PopoverPrimitive from "@radix-ui/react-popover";
26
26
  import { createPortal, flushSync } from "react-dom";
27
- import { observeElementRect, useVirtualizer } from "@tanstack/react-virtual";
27
+ import { defaultRangeExtractor, elementScroll, observeElementOffset, observeElementRect, useVirtualizer } from "@tanstack/react-virtual";
28
28
  import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
29
29
  import { COPILOTKIT_THREADS_DRAWER_TAG, defineCopilotKitThreadsDrawer } from "@copilotkit/web-components/threads-drawer";
30
30
  import ReactMarkdown from "react-markdown";
@@ -1323,7 +1323,7 @@ function useRenderToolCall() {
1323
1323
 
1324
1324
  //#endregion
1325
1325
  //#region package.json
1326
- var version = "1.87.1";
1326
+ var version = "1.89.0";
1327
1327
 
1328
1328
  //#endregion
1329
1329
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -1559,7 +1559,7 @@ function InlineFeatureWarning({ featureName }) {
1559
1559
  * Fetches resource content on-demand via proxied MCP requests. The React shell
1560
1560
  * owns the iframe; `bindMcpApp` owns the protocol.
1561
1561
  */
1562
- const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, message, agent, allowSameOriginFallback }) {
1562
+ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, message, agent, allowSameOriginFallback, modelContext }) {
1563
1563
  const { copilotkit } = useCopilotKit$1();
1564
1564
  const messageId = message?.id;
1565
1565
  const containerRef = useRef(null);
@@ -1609,7 +1609,10 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, mess
1609
1609
  getAgent: () => agentRef.current,
1610
1610
  host: copilotkit,
1611
1611
  messageId,
1612
- options: { allowSameOriginFallback },
1612
+ options: {
1613
+ allowSameOriginFallback,
1614
+ modelContext
1615
+ },
1613
1616
  hooks: {
1614
1617
  onResource: (resource) => {
1615
1618
  if (!mounted) return;
@@ -1652,6 +1655,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, mess
1652
1655
  copilotkit,
1653
1656
  messageId,
1654
1657
  allowSameOriginFallback,
1658
+ modelContext,
1655
1659
  content.resourceUri,
1656
1660
  content.serverHash,
1657
1661
  content.serverId
@@ -3195,11 +3199,6 @@ const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follo
3195
3199
  - Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.
3196
3200
  - Minimal transitions (150ms) for hover/focus states only. No decorative animations.
3197
3201
  - Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;
3198
- /** The MCP Apps renderer with `mcpApps.allowSameOriginFallback` applied. */
3199
- const SameOriginMCPAppsActivityRenderer = (props) => /* @__PURE__ */ jsx(MCPAppsActivityRenderer, {
3200
- ...props,
3201
- allowSameOriginFallback: true
3202
- });
3203
3202
  const DEFAULT_LEARNING = Object.freeze({});
3204
3203
  function toLearningConfig(learning) {
3205
3204
  if (learning === true) return DEFAULT_LEARNING;
@@ -3276,11 +3275,17 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3276
3275
  return filterCatalog(rawCatalog, (name) => core ? core.isCatalogComponentEnabled(name) : true);
3277
3276
  }, [rawCatalog, catalogToggleVersion]);
3278
3277
  const mcpAppsAllowSameOrigin = mcpApps?.allowSameOriginFallback === true;
3278
+ const mcpAppsModelContext = mcpApps?.modelContext === true;
3279
+ const mcpAppsRenderer = useMemo(() => mcpAppsAllowSameOrigin || mcpAppsModelContext ? (props) => /* @__PURE__ */ jsx(MCPAppsActivityRenderer, {
3280
+ ...props,
3281
+ allowSameOriginFallback: mcpAppsAllowSameOrigin,
3282
+ modelContext: mcpAppsModelContext
3283
+ }) : MCPAppsActivityRenderer, [mcpAppsAllowSameOrigin, mcpAppsModelContext]);
3279
3284
  const builtInActivityRenderers = useMemo(() => {
3280
3285
  const renderers = [{
3281
3286
  activityType: MCPAppsActivityType,
3282
3287
  content: MCPAppsActivityContentSchema,
3283
- render: mcpAppsAllowSameOrigin ? SameOriginMCPAppsActivityRenderer : MCPAppsActivityRenderer
3288
+ render: mcpAppsRenderer
3284
3289
  }];
3285
3290
  if (openGenUIActive) renderers.push({
3286
3291
  activityType: OpenGenerativeUIActivityType,
@@ -3301,7 +3306,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3301
3306
  generativeUIActive,
3302
3307
  a2ui,
3303
3308
  filteredCatalog,
3304
- mcpAppsAllowSameOrigin
3309
+ mcpAppsRenderer
3305
3310
  ]);
3306
3311
  const allActivityRenderers = useMemo(() => {
3307
3312
  return [...renderActivityMessagesList, ...builtInActivityRenderers];
@@ -4879,6 +4884,11 @@ const ALL_UPDATES = [
4879
4884
  UseAgentUpdate.OnStateChanged,
4880
4885
  UseAgentUpdate.OnRunStatusChanged
4881
4886
  ];
4887
+ /**
4888
+ * Returns the selected agent and its readiness, subscribing to agent updates.
4889
+ * Uses a shared agent by default, or a private proxy when `agentId`,
4890
+ * `runtimeAgentId`, and `threadId` are supplied together.
4891
+ */
4882
4892
  function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {}) {
4883
4893
  if (threadId != null && runtimeAgentId == null) throw new Error(`useAgent: \`threadId\` requires \`runtimeAgentId\`. A threadId is written onto a single agent, but an agent resolved by agentId alone is shared, so scoping a thread to it would clobber other useAgent callers. Pass a distinct local \`agentId\` and the runtime agent to route to, e.g. useAgent({ agentId: "chat-1", runtimeAgentId: "${agentId ?? "default"}", threadId }).`);
4884
4894
  if (runtimeAgentId != null && threadId == null) throw new Error(`useAgent: \`runtimeAgentId\` requires \`threadId\`. A proxied agent exists to scope a thread to a private instance; without a threadId it behaves like the shared agent while adding a registration and a local agentId to keep unique. Either pass the thread, e.g. useAgent({ agentId: "${agentId ?? "chat-1"}", runtimeAgentId: "${runtimeAgentId}", threadId }), or bind to the agent directly with useAgent({ agentId: "${runtimeAgentId}" }).`);
@@ -5005,7 +5015,7 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
5005
5015
  copilotkit.runtimeUrl,
5006
5016
  copilotkit.runtimeTransport,
5007
5017
  copilotkit.credentials,
5008
- JSON.stringify(copilotkit.headers)
5018
+ copilotkit.ɵheadersGeneration
5009
5019
  ]);
5010
5020
  useEffect(() => {
5011
5021
  if (updateFlags.length === 0) return;
@@ -5048,7 +5058,7 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
5048
5058
  if (agent instanceof ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
5049
5059
  }, [
5050
5060
  agent,
5051
- JSON.stringify(copilotkit.headers),
5061
+ copilotkit.ɵheadersGeneration,
5052
5062
  copilotkit.credentials
5053
5063
  ]);
5054
5064
  const configThreadId = chatConfig?.threadId;
@@ -6495,9 +6505,14 @@ function getToolCallLayouts(rendered, all, renderers) {
6495
6505
  }
6496
6506
  /**
6497
6507
  * Finds the working phase of every reply in `rendered`: its messages up to the
6498
- * last one that calls a tool. Text in there was narration; what follows is the
6508
+ * last one that calls a tool, plus the thinking and the silent messages that
6509
+ * trail it. Text in there was narration; the first text after the work is the
6499
6510
  * reply itself. Replies that called no tools are omitted, except the latest,
6500
6511
  * which may be about to.
6512
+ *
6513
+ * The trailing part matters: an agent that thinks once more after its last
6514
+ * tool call would otherwise leave those "Thought for 2 seconds" lines outside
6515
+ * the work, where nothing ever folds them away.
6501
6516
  */
6502
6517
  function getTurnWork(rendered, layouts) {
6503
6518
  const turns = /* @__PURE__ */ new Map();
@@ -6516,6 +6531,13 @@ function getTurnWork(rendered, layouts) {
6516
6531
  visible.forEach((message, index) => {
6517
6532
  if (message.role === "assistant" && message.toolCalls?.some((call) => shown.has(call.id))) lastWork = index;
6518
6533
  });
6534
+ let workEnd = lastWork;
6535
+ for (let index = lastWork + 1; lastWork >= 0 && index < visible.length; index++) {
6536
+ const message = visible[index];
6537
+ const content = message.content;
6538
+ if (message.role === "assistant" && typeof content === "string" && content.trim()) break;
6539
+ workEnd = index;
6540
+ }
6519
6541
  const first = visible[0];
6520
6542
  if (first && (calls.length > 0 || isLatest)) {
6521
6543
  let lastAssistant = -1;
@@ -6523,11 +6545,13 @@ function getTurnWork(rendered, layouts) {
6523
6545
  if (message.role === "assistant") lastAssistant = index;
6524
6546
  });
6525
6547
  const replyText = visible[lastAssistant]?.content;
6526
- const endsWithWork = lastAssistant >= 0 && lastAssistant <= lastWork && typeof replyText === "string" && replyText.trim().length > 0;
6548
+ const endsWithWork = lastAssistant >= 0 && lastAssistant <= workEnd && typeof replyText === "string" && replyText.trim().length > 0;
6549
+ const work = visible.slice(0, workEnd + 1);
6527
6550
  turns.set(key, {
6528
6551
  key,
6529
6552
  firstMessageId: first.id,
6530
- workMessageIds: new Set(visible.slice(0, lastWork + 1).map((message) => message.id)),
6553
+ workMessageIds: new Set(work.map((message) => message.id)),
6554
+ reasoningIds: work.filter((message) => message.role === "reasoning").map((message) => message.id),
6531
6555
  replyTextMessageId: endsWithWork ? visible[lastAssistant].id : void 0,
6532
6556
  calls,
6533
6557
  isLatest
@@ -7408,9 +7432,12 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
7408
7432
  }
7409
7433
  };
7410
7434
  };
7435
+ const isLatestAssistantMessage = message.role === "assistant" && (isLatest ?? messages?.[messages.length - 1]?.id === message.id);
7436
+ const isStreaming = !!isRunning && (isLatest === void 0 && messages === void 0 ? true : isLatestAssistantMessage);
7411
7437
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, {
7412
7438
  content: message.content || "",
7413
- messageId: message.id
7439
+ messageId: message.id,
7440
+ mode: isStreaming ? "streaming" : "static"
7414
7441
  });
7415
7442
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
7416
7443
  if (message.content) return await copyToClipboard(message.content);
@@ -7452,7 +7479,6 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
7452
7479
  messages
7453
7480
  });
7454
7481
  const hasContent = !!(message.content && message.content.trim().length > 0);
7455
- const isLatestAssistantMessage = message.role === "assistant" && (isLatest ?? messages?.[messages.length - 1]?.id === message.id);
7456
7482
  const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
7457
7483
  const { open: commentOpen, close: closeComment } = comment;
7458
7484
  useEffect(() => {
@@ -8142,7 +8168,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
8142
8168
  ...headerProps,
8143
8169
  children: [
8144
8170
  /* @__PURE__ */ jsx("span", {
8145
- className: "cpk:font-medium",
8171
+ className: twMerge("cpk:font-medium", isStreaming && "cpk-shimmer"),
8146
8172
  children: label
8147
8173
  }),
8148
8174
  isStreaming && !hasContent && /* @__PURE__ */ jsx("span", {
@@ -8792,25 +8818,14 @@ const MemoizedCustomMessage = React.memo(function MemoizedCustomMessage({ messag
8792
8818
  return true;
8793
8819
  });
8794
8820
  /**
8795
- * Deduplicates messages by ID. For assistant messages, merges occurrences:
8796
- * recovers non-empty content from any earlier occurrence if the latest wiped it
8797
- * (empty string means the streaming update cleared the field, not blank text),
8798
- * and similarly recovers toolCalls from earlier occurrences if the latest is
8799
- * undefined (an empty array [] is treated as intentional and kept as-is).
8800
- * For all other roles, keeps the last entry.
8801
- *
8802
- * @internal Exported for unit testing only — not part of the public API.
8803
- */
8804
- /**
8805
8821
  * Collapse tool calls that share an id, keeping first-seen order.
8806
8822
  *
8807
- * AG-UI's TOOL_CALL_START handler appends to the parent message's `toolCalls`
8808
- * without checking whether that id is already present. So whenever a start
8809
- * event is applied twice — which the human-in-the-loop flow triggers when the
8810
- * run syncs after `respond()` — the message ends up carrying the same call
8811
- * twice. The second copy has EMPTY `arguments`, because a start event carries
8812
- * none; the args arrive later as TOOL_CALL_ARGS deltas addressed to the first
8813
- * copy.
8823
+ * Older AG-UI clients appended to the parent message's `toolCalls` without
8824
+ * checking whether that id was already present. So whenever a start event was
8825
+ * applied twice — which the human-in-the-loop flow triggers when the run syncs
8826
+ * after `respond()` — the message ended up carrying the same call twice. The
8827
+ * second copy has EMPTY `arguments`, because a start event carries none; the
8828
+ * args arrive later as TOOL_CALL_ARGS deltas addressed to the first copy.
8814
8829
  *
8815
8830
  * Left alone that renders the same tool call twice: once populated and once
8816
8831
  * blank (an approval card with no transaction id, offering live buttons for an
@@ -8832,13 +8847,42 @@ function dedupeToolCalls(toolCalls) {
8832
8847
  }
8833
8848
  return byId.size === toolCalls.length ? toolCalls : [...byId.values()];
8834
8849
  }
8850
+ /**
8851
+ * Unite the tool calls of two occurrences of the same assistant message,
8852
+ * keeping first-seen order. Each occurrence can hold only some of the calls,
8853
+ * so neither list may replace the other.
8854
+ *
8855
+ * For an id present in both, the later occurrence wins when it carries
8856
+ * arguments: it is the newer streaming update. A blank later copy never
8857
+ * replaces a populated one.
8858
+ */
8859
+ function mergeToolCalls(earlier, later) {
8860
+ const byId = new Map(earlier.map((toolCall) => [toolCall.id, toolCall]));
8861
+ for (const toolCall of later) {
8862
+ const existing = byId.get(toolCall.id);
8863
+ if (!existing || toolCall.function?.arguments || !existing.function?.arguments) byId.set(toolCall.id, toolCall);
8864
+ }
8865
+ return [...byId.values()];
8866
+ }
8867
+ /**
8868
+ * Deduplicates messages by ID. For assistant messages, merges occurrences:
8869
+ * recovers non-empty content from any earlier occurrence if the latest wiped it
8870
+ * (empty string means the streaming update cleared the field, not blank text).
8871
+ * Tool calls from every occurrence are kept: a copy can hold only some of the
8872
+ * calls, so when two occurrences both carry tool calls they are united by id.
8873
+ * If the latest has undefined toolCalls they are recovered from earlier
8874
+ * occurrences; an explicit empty array [] is treated as intentional and kept.
8875
+ * For all other roles, keeps the last entry.
8876
+ *
8877
+ * @internal Exported for unit testing only — not part of the public API.
8878
+ */
8835
8879
  function deduplicateMessages(messages) {
8836
8880
  const acc = /* @__PURE__ */ new Map();
8837
8881
  for (const message of messages) {
8838
8882
  const existing = acc.get(message.id);
8839
8883
  if (existing && message.role === "assistant" && existing.role === "assistant") {
8840
8884
  const content = message.content || existing.content;
8841
- const toolCalls = message.toolCalls ?? existing.toolCalls;
8885
+ const toolCalls = message.toolCalls?.length && existing.toolCalls?.length ? mergeToolCalls(dedupeToolCalls(existing.toolCalls), dedupeToolCalls(message.toolCalls)) : message.toolCalls ?? existing.toolCalls;
8842
8886
  acc.set(message.id, {
8843
8887
  ...existing,
8844
8888
  ...message,
@@ -8853,6 +8897,8 @@ function deduplicateMessages(messages) {
8853
8897
  }
8854
8898
  return [...acc.values()];
8855
8899
  }
8900
+ /** At most this many rows are rendered beyond the viewport on either side. */
8901
+ const MAX_OVERSCAN_ROWS = 400;
8856
8902
  /** A row holding a single message, rendered as it would be ungrouped. */
8857
8903
  function messageRow(message) {
8858
8904
  return {
@@ -8868,7 +8914,19 @@ function messageGroup(group) {
8868
8914
  };
8869
8915
  }
8870
8916
  const GROUP_ROW_KEY_PREFIX = "copilotkit-group:";
8917
+ const MESSAGE_ROW_KEY_PREFIX = "copilotkit-message:";
8871
8918
  const VIRTUALIZE_THRESHOLD = 50;
8919
+ /**
8920
+ * How long the scroll position must stay still, with no wheel or touch input,
8921
+ * before a correction held back during scrolling is written to `scrollTop`.
8922
+ */
8923
+ const SCROLL_SETTLE_MS = 250;
8924
+ /**
8925
+ * The most a held correction moves per frame once it is written. Safari can
8926
+ * still drop a write when a new gesture starts in the same frame; a small
8927
+ * step keeps that from showing.
8928
+ */
8929
+ const SETTLE_STEP_PX = 4;
8872
8930
  function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, workSummary, isRunning = false, transformMessages, groupMessages, messageFeedback = true, toolCallDisplay = "grouped", children, className, ...props }) {
8873
8931
  const isPinnedToBottom = useContext(ScrollPinnedContext);
8874
8932
  const renderCustomMessage = useRenderCustomMessages();
@@ -8972,6 +9030,17 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
8972
9030
  isRunning,
8973
9031
  latestTurnKey
8974
9032
  ]);
9033
+ const supersededReasoning = useMemo(() => {
9034
+ const ids = /* @__PURE__ */ new Set();
9035
+ if (!isRunning) return ids;
9036
+ const turn = turnWork?.get(latestTurnKey);
9037
+ for (const id of turn?.reasoningIds.slice(0, -1) ?? []) ids.add(id);
9038
+ return ids;
9039
+ }, [
9040
+ turnWork,
9041
+ latestTurnKey,
9042
+ isRunning
9043
+ ]);
8975
9044
  const toolCallDisplayContext = useMemo(() => ({
8976
9045
  display: toolCallDisplay,
8977
9046
  isRunning,
@@ -9041,6 +9110,14 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9041
9110
  commitRowKeyStore(rowKeyStore, renderedMessages);
9042
9111
  }, [rowKeyStore, renderedMessages]);
9043
9112
  const stableGroupKey = (key) => rowRenderKeys.get(key) ?? key;
9113
+ const rowKey = (row) => row.type === "group" ? `${GROUP_ROW_KEY_PREFIX}${stableGroupKey(row.key)}` : `${MESSAGE_ROW_KEY_PREFIX}${rowRenderKeys.get(row.message.id) ?? row.message.id}`;
9114
+ const previousRowKeysRef = useRef([]);
9115
+ const rowKeys = useMemo(() => {
9116
+ const next = rows.map(rowKey);
9117
+ const previous = previousRowKeysRef.current;
9118
+ return next.length === previous.length && next.every((key, index) => key === previous[index]) ? previous : next;
9119
+ }, [rows, rowRenderKeys]);
9120
+ previousRowKeysRef.current = rowKeys;
9044
9121
  const groupStateRef = useRef(/* @__PURE__ */ new Map());
9045
9122
  const groupSettersRef = useRef(/* @__PURE__ */ new Map());
9046
9123
  const groupStateThreadRef = useRef(config?.threadId);
@@ -9124,24 +9201,75 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9124
9201
  ]);
9125
9202
  const measuredRef = React.useRef({
9126
9203
  total: 0,
9127
- sizes: /* @__PURE__ */ new Map()
9204
+ sizes: /* @__PURE__ */ new Map(),
9205
+ estimates: /* @__PURE__ */ new Map()
9128
9206
  });
9207
+ const rowKeysRef = React.useRef(rowKeys);
9208
+ rowKeysRef.current = rowKeys;
9129
9209
  const resizeAnchorRef = React.useRef(null);
9130
9210
  const restoringVisibilityRef = React.useRef(false);
9211
+ const heldOffsetRef = React.useRef(0);
9212
+ const spacerRef = React.useRef(null);
9213
+ const shiftedRowsRef = React.useRef(null);
9214
+ const lastMeasuredRef = React.useRef(null);
9215
+ const userScrollingRef = React.useRef(false);
9216
+ const ownScrollWriteRef = React.useRef(null);
9217
+ const renderedTotalRef = useRef(0);
9218
+ const applyHeldOffset = React.useCallback(() => {
9219
+ const held = heldOffsetRef.current;
9220
+ if (spacerRef.current) spacerRef.current.style.height = `${renderedTotalRef.current - held}px`;
9221
+ if (shiftedRowsRef.current) shiftedRowsRef.current.style.transform = held ? `translateY(${-held}px)` : "";
9222
+ }, []);
9223
+ const keepListTopInView = React.useCallback((scrollTop) => {
9224
+ if (heldOffsetRef.current >= 0 || scrollTop + heldOffsetRef.current >= 0) return false;
9225
+ heldOffsetRef.current = scrollTop > 0 ? -scrollTop : 0;
9226
+ return true;
9227
+ }, []);
9228
+ const releaseHeldOffset = React.useCallback((element, amount) => {
9229
+ if (amount === 0) return;
9230
+ const scrollTop = element.scrollTop;
9231
+ heldOffsetRef.current -= amount;
9232
+ applyHeldOffset();
9233
+ const target = Math.max(0, scrollTop + amount);
9234
+ ownScrollWriteRef.current = target;
9235
+ element.scrollTop = target;
9236
+ }, [applyHeldOffset]);
9131
9237
  const firstMessageId = deduplicatedMessages[0]?.id;
9132
9238
  const measuredThreadRef = React.useRef(firstMessageId);
9133
9239
  if (measuredThreadRef.current !== firstMessageId) {
9134
9240
  measuredThreadRef.current = firstMessageId;
9135
9241
  resizeAnchorRef.current = null;
9242
+ heldOffsetRef.current = 0;
9136
9243
  measuredRef.current = {
9137
9244
  total: 0,
9138
- sizes: /* @__PURE__ */ new Map()
9245
+ sizes: /* @__PURE__ */ new Map(),
9246
+ estimates: /* @__PURE__ */ new Map()
9139
9247
  };
9140
9248
  }
9141
- const estimateRowSize = React.useCallback(() => {
9142
- const { total, sizes } = measuredRef.current;
9143
- return sizes.size > 0 ? Math.max(1, Math.round(total / sizes.size)) : 100;
9249
+ const measuredKeysRef = React.useRef(rowKeys);
9250
+ if (measuredKeysRef.current !== rowKeys) {
9251
+ measuredKeysRef.current = rowKeys;
9252
+ const live = new Set(rowKeys);
9253
+ const measured = measuredRef.current;
9254
+ for (const [key, height] of measured.sizes) if (!live.has(key)) {
9255
+ measured.sizes.delete(key);
9256
+ measured.total -= height;
9257
+ }
9258
+ for (const key of measured.estimates.keys()) if (!live.has(key)) measured.estimates.delete(key);
9259
+ }
9260
+ const estimateRowSize = React.useCallback((index) => {
9261
+ const { total, sizes, estimates } = measuredRef.current;
9262
+ const mean = sizes.size > 0 ? Math.max(1, Math.round(total / sizes.size)) : 100;
9263
+ const key = rowKeysRef.current[index];
9264
+ if (key === void 0) return mean;
9265
+ let estimate = estimates.get(key);
9266
+ if (estimate === void 0) {
9267
+ estimate = mean;
9268
+ estimates.set(key, estimate);
9269
+ }
9270
+ return estimate;
9144
9271
  }, []);
9272
+ const getRowKey = React.useCallback((index) => rowKeys[index] ?? index, [rowKeys]);
9145
9273
  const isPinnedToBottomRef = React.useRef(isPinnedToBottom);
9146
9274
  const measuredWidthRef = React.useRef(null);
9147
9275
  const captureResizeAnchor = React.useCallback((instance) => {
@@ -9154,7 +9282,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9154
9282
  };
9155
9283
  return;
9156
9284
  }
9157
- const offset = instance.scrollElement?.scrollTop ?? 0;
9285
+ const offset = (instance.scrollElement?.scrollTop ?? 0) + heldOffsetRef.current;
9158
9286
  const anchor = instance.getVirtualItemForOffset(offset);
9159
9287
  if (anchor) resizeAnchorRef.current = {
9160
9288
  index: anchor.index,
@@ -9164,19 +9292,46 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9164
9292
  }, []);
9165
9293
  const measureRowElement = React.useCallback((el, _entry, instance) => {
9166
9294
  captureResizeAnchor(instance);
9167
- const height = el?.getBoundingClientRect().height ?? 0;
9295
+ const rect = el?.getBoundingClientRect();
9296
+ const height = rect?.height ?? 0;
9168
9297
  const index = Number(el?.dataset?.index);
9169
- if (height > 0 && Number.isInteger(index)) {
9298
+ const key = Number.isInteger(index) ? rowKeysRef.current[index] : void 0;
9299
+ const viewportTop = typeof rect?.top === "number" ? instance.scrollElement?.getBoundingClientRect().top : void 0;
9300
+ lastMeasuredRef.current = Number.isInteger(index) && typeof rect?.top === "number" && typeof viewportTop === "number" ? {
9301
+ index,
9302
+ above: rect.top < viewportTop
9303
+ } : null;
9304
+ const hidden = !el?.isConnected || !instance.scrollElement?.clientHeight;
9305
+ if ((height > 0 || !hidden) && key !== void 0) {
9170
9306
  const { total, sizes } = measuredRef.current;
9171
- measuredRef.current.total = total - (sizes.get(index) ?? 0) + height;
9172
- sizes.set(index, height);
9307
+ measuredRef.current.total = total - (sizes.get(key) ?? 0) + height;
9308
+ sizes.set(key, height);
9173
9309
  }
9174
- return height > 0 ? height : measuredRef.current.sizes.get(index) ?? 100;
9310
+ return height > 0 || !hidden ? height : (key === void 0 ? void 0 : measuredRef.current.sizes.get(key)) ?? 100;
9175
9311
  }, [captureResizeAnchor]);
9176
- const shouldAdjustScrollOnResize = React.useCallback((item, _delta, instance) => {
9312
+ const shouldAdjustScrollOnResize = React.useCallback((item, delta, instance) => {
9313
+ const measured = lastMeasuredRef.current;
9314
+ lastMeasuredRef.current = null;
9177
9315
  if (isPinnedToBottomRef.current || resizeAnchorRef.current || restoringVisibilityRef.current) return false;
9178
9316
  const scrollAdjustments = instance.scrollAdjustments ?? 0;
9179
- return item.start < (instance.scrollOffset ?? 0) + scrollAdjustments;
9317
+ if (!(measured?.index === item.index ? measured.above : item.start < (instance.scrollOffset ?? 0) + scrollAdjustments)) return false;
9318
+ if (userScrollingRef.current || heldOffsetRef.current !== 0) {
9319
+ const held = heldOffsetRef.current;
9320
+ heldOffsetRef.current += delta;
9321
+ keepListTopInView(instance.scrollElement?.scrollTop ?? 0);
9322
+ instance.scrollOffset = (instance.scrollOffset ?? 0) + heldOffsetRef.current - held;
9323
+ return false;
9324
+ }
9325
+ return true;
9326
+ }, [keepListTopInView]);
9327
+ const observeListOffset = React.useCallback((instance, notify) => observeElementOffset(instance, (offset, isScrolling) => {
9328
+ if (keepListTopInView(offset)) applyHeldOffset();
9329
+ notify(offset + heldOffsetRef.current, isScrolling);
9330
+ }), [keepListTopInView, applyHeldOffset]);
9331
+ const scrollToListOffset = React.useCallback((offset, options, instance) => {
9332
+ const elementOffset = offset - heldOffsetRef.current;
9333
+ ownScrollWriteRef.current = elementOffset + (options.adjustments ?? 0);
9334
+ elementScroll(elementOffset, options, instance);
9180
9335
  }, []);
9181
9336
  const observeScrollRect = React.useCallback((instance, notify) => {
9182
9337
  let frame;
@@ -9207,7 +9362,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9207
9362
  instance.getTotalSize();
9208
9363
  measuredRef.current = {
9209
9364
  total: 0,
9210
- sizes: /* @__PURE__ */ new Map()
9365
+ sizes: /* @__PURE__ */ new Map(),
9366
+ estimates: /* @__PURE__ */ new Map()
9211
9367
  };
9212
9368
  instance.elementsCache.forEach((element) => {
9213
9369
  measureRowElement(element, void 0, instance);
@@ -9232,27 +9388,120 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9232
9388
  resizeAnchorRef.current = null;
9233
9389
  };
9234
9390
  }, [captureResizeAnchor, measureRowElement]);
9391
+ const virtualizerRef = useRef(null);
9392
+ const rangeExtractor = React.useCallback((range) => {
9393
+ const instance = virtualizerRef.current;
9394
+ const items = instance?.measurementsCache;
9395
+ const reach = instance?.scrollRect?.height ?? 0;
9396
+ if (!items || items.length !== range.count || reach <= 0) return defaultRangeExtractor(range);
9397
+ let start = range.startIndex;
9398
+ for (let above = 0; start > 0 && range.startIndex - start < MAX_OVERSCAN_ROWS && (range.startIndex - start < range.overscan || above < reach);) {
9399
+ start -= 1;
9400
+ above += items[start].size;
9401
+ }
9402
+ let end = range.endIndex;
9403
+ for (let below = 0; end < range.count - 1 && end - range.endIndex < MAX_OVERSCAN_ROWS && (end - range.endIndex < range.overscan || below < reach);) {
9404
+ end += 1;
9405
+ below += items[end].size;
9406
+ }
9407
+ const indexes = [];
9408
+ for (let index = start; index <= end; index++) indexes.push(index);
9409
+ return indexes;
9410
+ }, []);
9235
9411
  const virtualizer = useVirtualizer({
9236
9412
  count: shouldVirtualize ? rows.length : 0,
9237
9413
  getScrollElement: () => shouldVirtualize ? scrollElement : null,
9238
9414
  observeElementRect: observeScrollRect,
9415
+ observeElementOffset: observeListOffset,
9416
+ scrollToFn: scrollToListOffset,
9239
9417
  estimateSize: estimateRowSize,
9418
+ getItemKey: getRowKey,
9240
9419
  overscan: 5,
9420
+ rangeExtractor,
9241
9421
  measureElement: measureRowElement,
9242
9422
  initialRect: {
9243
9423
  width: 0,
9244
9424
  height: 600
9245
9425
  }
9246
9426
  });
9427
+ virtualizerRef.current = virtualizer;
9428
+ renderedTotalRef.current = virtualizer.getTotalSize();
9429
+ useLayoutEffect(applyHeldOffset);
9430
+ useEffect(() => {
9431
+ const element = shouldVirtualize ? scrollElement : null;
9432
+ if (!element) return;
9433
+ let settleTimer;
9434
+ let settleFrame;
9435
+ let touching = false;
9436
+ const settleStep = () => {
9437
+ settleFrame = void 0;
9438
+ const held = heldOffsetRef.current;
9439
+ if (userScrollingRef.current || touching || held === 0) return;
9440
+ releaseHeldOffset(element, Math.sign(held) * Math.min(Math.abs(held), SETTLE_STEP_PX));
9441
+ if (heldOffsetRef.current !== 0) settleFrame = requestAnimationFrame(settleStep);
9442
+ };
9443
+ const settle = () => {
9444
+ settleTimer = void 0;
9445
+ if (touching) return;
9446
+ userScrollingRef.current = false;
9447
+ if (heldOffsetRef.current !== 0 && settleFrame === void 0) settleFrame = requestAnimationFrame(settleStep);
9448
+ };
9449
+ const scrolling = () => {
9450
+ userScrollingRef.current = true;
9451
+ if (settleFrame !== void 0) {
9452
+ cancelAnimationFrame(settleFrame);
9453
+ settleFrame = void 0;
9454
+ }
9455
+ if (settleTimer !== void 0) clearTimeout(settleTimer);
9456
+ settleTimer = setTimeout(settle, SCROLL_SETTLE_MS);
9457
+ };
9458
+ const onScroll = () => {
9459
+ const own = ownScrollWriteRef.current;
9460
+ if (own !== null && Math.abs(element.scrollTop - own) < 1) {
9461
+ ownScrollWriteRef.current = null;
9462
+ return;
9463
+ }
9464
+ scrolling();
9465
+ };
9466
+ const onTouchStart = () => {
9467
+ touching = true;
9468
+ scrolling();
9469
+ };
9470
+ const onTouchEnd = () => {
9471
+ touching = false;
9472
+ scrolling();
9473
+ };
9474
+ element.addEventListener("scroll", onScroll, { passive: true });
9475
+ element.addEventListener("wheel", scrolling, { passive: true });
9476
+ element.addEventListener("touchstart", onTouchStart, { passive: true });
9477
+ element.addEventListener("touchend", onTouchEnd, { passive: true });
9478
+ element.addEventListener("touchcancel", onTouchEnd, { passive: true });
9479
+ return () => {
9480
+ if (settleTimer !== void 0) clearTimeout(settleTimer);
9481
+ if (settleFrame !== void 0) cancelAnimationFrame(settleFrame);
9482
+ userScrollingRef.current = false;
9483
+ element.removeEventListener("scroll", onScroll);
9484
+ element.removeEventListener("wheel", scrolling);
9485
+ element.removeEventListener("touchstart", onTouchStart);
9486
+ element.removeEventListener("touchend", onTouchEnd);
9487
+ element.removeEventListener("touchcancel", onTouchEnd);
9488
+ };
9489
+ }, [
9490
+ shouldVirtualize,
9491
+ scrollElement,
9492
+ releaseHeldOffset
9493
+ ]);
9247
9494
  isPinnedToBottomRef.current = isPinnedToBottom;
9248
9495
  virtualizer.shouldAdjustScrollPositionOnItemSizeChange = shouldAdjustScrollOnResize;
9249
9496
  useLayoutEffect(() => {
9250
9497
  const anchor = resizeAnchorRef.current;
9251
9498
  if (!anchor?.ready || restoringVisibilityRef.current) return;
9499
+ if (scrollElement) releaseHeldOffset(scrollElement, heldOffsetRef.current);
9252
9500
  const position = virtualizer.getOffsetForIndex(anchor.index, "start");
9253
9501
  if (position && !isPinnedToBottomRef.current) {
9254
9502
  const target = position[0] + anchor.offset;
9255
- if (Math.abs((scrollElement?.scrollTop ?? 0) - target) > .5) virtualizer.scrollToOffset(target);
9503
+ const listOffset = (scrollElement?.scrollTop ?? 0) + heldOffsetRef.current;
9504
+ if (Math.abs(listOffset - target) > .5) virtualizer.scrollToOffset(target);
9256
9505
  }
9257
9506
  const frame = requestAnimationFrame(() => {
9258
9507
  if (resizeAnchorRef.current === anchor) resizeAnchorRef.current = null;
@@ -9306,7 +9555,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9306
9555
  slotProps: reasoningSlotProps
9307
9556
  }, rowKey);
9308
9557
  elements.push(toolCallDisplay === "turn" ? /* @__PURE__ */ jsx(Collapsible, {
9309
- open: workOpen.get(message.id) ?? true,
9558
+ open: (workOpen.get(message.id) ?? true) && !supersededReasoning.has(message.id),
9310
9559
  children: reasoning
9311
9560
  }, rowKey) : reasoning);
9312
9561
  }
@@ -9324,7 +9573,6 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9324
9573
  }, `intelligence-${intelligenceTurnId}`));
9325
9574
  return elements.filter(Boolean);
9326
9575
  };
9327
- const rowKey = (row) => row.type === "group" ? `${GROUP_ROW_KEY_PREFIX}${stableGroupKey(row.key)}` : rowRenderKeys.get(row.message.id) ?? row.message.id;
9328
9576
  const renderRow = (row) => {
9329
9577
  if (row.type === "message") return renderMessageBlock(row.message);
9330
9578
  const Wrapper = row.wrapper;
@@ -9337,8 +9585,6 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9337
9585
  children: row.messages.flatMap(renderMessageBlock)
9338
9586
  }, rowKey(row))];
9339
9587
  };
9340
- const rowKeysRef = useRef([]);
9341
- rowKeysRef.current = rows.map(rowKey);
9342
9588
  const virtualModeRef = useRef(shouldVirtualize);
9343
9589
  virtualModeRef.current = shouldVirtualize;
9344
9590
  useEffect(() => {
@@ -9473,26 +9719,37 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
9473
9719
  ...props,
9474
9720
  children: [
9475
9721
  shouldVirtualize ? /* @__PURE__ */ jsx("div", {
9722
+ ref: spacerRef,
9476
9723
  style: {
9477
- height: virtualizer.getTotalSize(),
9724
+ height: renderedTotalRef.current - heldOffsetRef.current,
9478
9725
  position: "relative",
9479
9726
  overflowAnchor: "none"
9480
9727
  },
9481
- children: virtualizer.getVirtualItems().map((virtualItem) => {
9482
- const row = rows[virtualItem.index];
9483
- return /* @__PURE__ */ jsx("div", {
9484
- "data-index": virtualItem.index,
9485
- "data-scroll-anchor": rowKey(row),
9486
- ref: virtualizer.measureElement,
9487
- style: {
9488
- position: "absolute",
9489
- top: 0,
9490
- left: 0,
9491
- width: "100%",
9492
- transform: `translateY(${virtualItem.start}px)`
9493
- },
9494
- children: renderRow(row)
9495
- }, rowKey(row));
9728
+ children: /* @__PURE__ */ jsx("div", {
9729
+ ref: shiftedRowsRef,
9730
+ style: {
9731
+ position: "absolute",
9732
+ top: 0,
9733
+ left: 0,
9734
+ width: "100%",
9735
+ transform: heldOffsetRef.current ? `translateY(${-heldOffsetRef.current}px)` : void 0
9736
+ },
9737
+ children: virtualizer.getVirtualItems().map((virtualItem) => {
9738
+ const row = rows[virtualItem.index];
9739
+ return /* @__PURE__ */ jsx("div", {
9740
+ "data-index": virtualItem.index,
9741
+ "data-scroll-anchor": rowKey(row),
9742
+ ref: virtualizer.measureElement,
9743
+ style: {
9744
+ position: "absolute",
9745
+ top: 0,
9746
+ left: 0,
9747
+ width: "100%",
9748
+ transform: `translateY(${virtualItem.start}px)`
9749
+ },
9750
+ children: renderRow(row)
9751
+ }, rowKey(row));
9752
+ })
9496
9753
  })
9497
9754
  }) : messageElements,
9498
9755
  interruptElement,
@@ -10373,7 +10630,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
10373
10630
  ...props,
10374
10631
  children: [/* @__PURE__ */ jsx(Loader2, {
10375
10632
  "aria-hidden": "true",
10376
- className: "cpk:size-6 cpk:animate-spin cpk:text-muted-foreground"
10633
+ className: "cpk:size-6 cpk:text-muted-foreground cpk:*:origin-center cpk:*:animate-spin"
10377
10634
  }), /* @__PURE__ */ jsx("span", {
10378
10635
  className: "cpk:sr-only",
10379
10636
  children: labels.chatConnectingLabel
@@ -14486,5 +14743,5 @@ function validateProps(props) {
14486
14743
  }
14487
14744
 
14488
14745
  //#endregion
14489
- export { INTERRUPT_EVENT_NAME as $, ɵobservePhoenixSocketSignals$ as $a, isAbortError as $i, MultiAgentCapabilitiesSchema as $n, TextMessageEndEventSchema as $r, AudioPartSchema as $t, CopilotChatMessageView as A, withAuthoritativeActivityTypes as Aa, createActionGroup as Ai, HttpAgent as An, RunHandler as Ar, ɵrunMcpFollowUp as At, CopilotChatReasoningMessage_default as B, ɵgetAgentInterruptState$1 as Ba, emitInspectorViewThread as Bi, InputContentUrlSourceSchema as Bn, SubagentFinishedEventSchema as Br, AGUI_METADATA_KEY as Bt, CopilotModalHeader as C, splitA2UIMarkdown$1 as Ca, buildResumeArray as Ci, EventType as Cn, RunAgentInputSchema as Cr, OpenGenerativeUIContentSchema as Ct, CopilotChat as D, transformChunks as Da, contentHasMedia as Di, FilterToolCallsMiddleware as Dn, RunFinishedInterruptOutcomeSchema as Dr, MCPAppsActivityContentSchema as Dt, DefaultOpenIcon as E, tokenUsageFromLangChainMetadata as Ea, completePartialMarkdown as Ei, FileSourceSchema as En, RunFinishedEventSchema as Er, useSandboxFunctions as Et, getIntelligenceTurnAnchors as F, ɵTHREAD_REQUEST_TIMEOUT_MS as Fa, createSelector as Fi, ImageInputPartSchema as Fn, StateSchema as Fr, CopilotChatAudioRecorder as Ft, useLearningContainersInCurrentThread as G, ɵmapMemoryMetadataEvent as Ga, ensureObjectArgs as Gi, JsonPointerSchema as Gn, SubagentRunIdSchema as Gr, AddOperationSchema as Gt, CopilotChatAttachmentRenderer as H, ɵisHttpAgent$1 as Ha, empty as Hi, InterruptSchema as Hn, SubagentFinishedSuccessOutcomeSchema as Hr, ActivityDeltaEventSchema as Ht, IntelligenceIndicatorView as I, ɵclearAgentInterruptState$1 as Ia, createStore as Ii, ImagePartSchema as In, StateSnapshotEventSchema as Ir, A2UI_FENCE_LANGUAGE as It, useLearnFromUserActionInCurrentThread as J, ɵmemoryReducer as Ja, extractStringField as Ji, MessageSchema as Jn, SystemMessageSchema as Jr, AgentThreadLockedError as Jt, useLearningContainers as K, ɵmemoryAdapterEvents as Ka, extractCompleteArrayItems as Ki, MEMORY_ERROR_REGISTRY as Kn, SubagentStartedEventSchema as Kr, AgentCapabilitiesSchema as Kt, CopilotChatWorkSummary as L, ɵcreateMemoryStore as La, defaultApplyEvents as Li, InputContentDataSourceSchema as Ln, StepFinishedEventSchema as Lr, ACTIVITY_HISTORY_METADATA as Lt, messageRow as M, ɵInterruptState$1 as Ma, createEffect as Mi, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as Mn, StateCapabilitiesSchema as Mr, useRenderToolCall as Mt, INTELLIGENCE_TURN_HEAD as N, ɵMAX_SOCKET_RETRIES as Na, createInspectorThreadRequestId as Ni, IdentityCapabilitiesSchema as Nn, StateDeltaEventSchema as Nr, CopilotChatInput_default as Nt, CopilotChatView_default as O, transformHttpEventStream as Oa, contentToText$1 as Oi, FunctionCallSchema as On, RunFinishedOutcomeSchema as Or, MCPAppsActivityRenderer as Ot, IntelligenceIndicator as P, ɵRUNTIME_PROBE_TIMEOUT_MS as Pa, createReducer as Pi, ImageInputContentSchema as Pn, StateManager as Pr, AudioRecorderError as Pt, useInterrupt as Q, ɵobservePhoenixSocketHealth$ as Qa, getWebMCPModelContext as Qi, MoveOperationSchema as Qn, TextMessageContentEventSchema as Qr, AudioInputPartSchema as Qt, CopilotChatSuggestionView as R, ɵcreateThreadSelectors as Ra, emitInspectorActiveThread$1 as Ri, InputContentSchema as Rn, StepStartedEventSchema as Rr, AGUIConnectNotImplementedError$1 as Rt, CopilotSidebarView as S, select as Sa, authoritativeActivityTypes as Si, EventSchemas as Sn, RoleSchema as Sr, OpenGenerativeUIActivityType as St, DefaultCloseIcon as T, tokenUsageFromAiSdkUsage as Ta, compactEvents as Ti, ExecutionCapabilitiesSchema as Tn, RunFinishedCancelledOutcomeSchema as Tr, SandboxFunctionsContext as Tt, CopilotChatAssistantMessage_default as U, ɵisRetryableMemoryStatus as Ua, enforceEvents as Ui, JsonPatchOperationSchema as Un, SubagentFinishedSuspendedOutcomeSchema as Ur, ActivityMessageSchema as Ut, CopilotChatUserMessage_default as V, ɵisCopilotKitFeature as Va, emitInspectorViewThreadResult$1 as Vi, IntelligenceAgent as Vn, SubagentFinishedOutcomeSchema as Vr, AbstractAgent$1 as Vt, CopilotChatToolCallsView as W, ɵjoinPhoenixChannel$ as Wa, enforceOutgoingInput as Wi, JsonPatchSchema as Wn, SubagentInfoSchema as Wr, ActivitySnapshotEventSchema as Wt, useMemories as X, ɵobservePhoenixEvent$ as Xa, getMarkdownOperationSurfaceId as Xi, MetadataSchema as Xn, TextInputContentSchema as Xr, AttributableSchema as Xt, useLearnFromUserAction as Y, ɵmemoryRestEvents as Ya, flattenInformationalCards as Yi, MessagesSnapshotEventSchema as Yn, TestOperationSchema as Yr, AssistantMessageSchema as Yt, useThreads$1 as Z, ɵobservePhoenixJoinOutcome$ as Za, getRunOutcome as Zi, Middleware as Zn, TextMessageChunkEventSchema as Zr, AudioInputContentSchema as Zt, WildcardToolCallRender as _, randomUUID$2 as _a, VideoInputContentSchema as _i, DeveloperMessageSchema as _n, ReasoningMessageStartEventSchema as _r, useLicenseContext$1 as _t, ThreadsProvider as a, ofType as aa, ToolCallChunkEventSchema as ai, CompatibilityBoundary as an, ɵselectIsMutating$1 as ao, PROTOCOL_VERSION as ar, useAgent as at, CopilotSidebar as b, runHttpRequest as ba, WebMCPRegistry as bi, DocumentPartSchema as bn, ReplaceOperationSchema as br, GenerateSandboxedUiArgsSchema as bt, CoAgentStateRendersProvider as c, onInspectorActiveThread as ca, ToolCallSchema as ci, ContextStore as cn, ɵselectMemoriesError$1 as co, RawEventSchema as cr, CopilotChatToolCallGroup as ct, shouldShowDevConsole as d, onInspectorViewThreadResult as da, ToolMessageSchema as di, CopilotKitCoreRuntimeConnectionStatus$1 as dn, ɵselectMemoriesRealtimeStatus$1 as do, ReasoningEncryptedValueSubtypeSchema as dr, useFrontendTools as dt, isInspectorThreadBridgeEnabled$1 as ea, TextMessageRoleSchema as ei, BackwardCompatibility_0_0_39 as en, ɵphoenixChannel$ as eo, MultimodalCapabilitiesSchema as er, useConfigureSuggestions as et, useToast as f, parseProtoStream as fa, ToolSchema as fi, CopilotKitHeaderResolutionError as fn, ɵselectThreads$1 as fo, ReasoningEndEventSchema as fr, useFrontendTool as ft, useCopilotContext as g, props as ga, UserMessageSchema as gi, DebugLogger as gn, ɵwithHeaderDefaults$1 as go, ReasoningMessageSchema as gr, useCopilotKit$1 as gt, CopilotContext as h, prepareSurfaceOperations as ha, UrlSourceSchema as hi, DataSourceSchema as hn, ɵthreadAdapterEvents as ho, ReasoningMessageEndEventSchema as hr, CopilotKitProvider as ht, ThreadsContext as i, mergeMetadata as ia, ToolCallArgsEventSchema as ii, BaseMessageSchema as in, ɵselectIsFetchingNextPage$1 as io, OutputCapabilitiesSchema as ir, UseAgentUpdate as it, messageGroup as j, ɵCOPILOTKIT_FEATURES as ja, createDebugLogger as ji, HumanInTheLoopCapabilitiesSchema as jn, RunStartedEventSchema as jr, CopilotKitInspector as jt, CopilotChatAttachmentQueue as k, verifyEvents as ka, convertToLegacyEvents as ki, FunctionMiddleware as kn, RunFinishedSuccessOutcomeSchema as kr, MCPAppsActivityType as kt, useCoAgentStateRenders as l, onInspectorStopViewing$1 as la, ToolCallStartEventSchema as li, CopilotKitCore$1 as ln, ɵselectMemoriesIsLoading$1 as lo, ReasoningCapabilitiesSchema as lr, useRenderTool as lt, useCopilotMessagesContext as m, parseToolArguments as ma, TransportCapabilitiesSchema as mi, CustomEventSchema as mn, ɵselectThreadsIsLoading$1 as mo, ReasoningMessageContentEventSchema as mr, useRenderCustomMessages as mt, defaultCopilotContextCategories as n, isRecognizedEvent as na, TextPartSchema as ni, BackwardCompatibility_0_0_57 as nn, ɵselectFetchMoreError$1 as no, MultimodalOutputCapabilitiesSchema as nr, useAgentContext as nt, useThreads as o, omitOptionalNulls as oa, ToolCallEndEventSchema as oi, ContentPartSchema as on, ɵselectMemories$1 as oo, PartSourceSchema as or, useHumanInTheLoop as ot, CopilotMessagesContext as p, parseSSEStream as pa, ToolsCapabilitiesSchema as pi, CopyOperationSchema as pn, ɵselectThreadsError$1 as po, ReasoningMessageChunkEventSchema as pr, useRenderActivityMessage as pt, useAttachments as q, ɵmemoryDomainEvents as qa, extractFenceOperations as qi, MemoryError as qn, SuggestionEngine as qr, AgentRegistry as qt, CoAgentStateRenderBridge as r, isRunCompletionAware$1 as ra, TokenUsageSchema as ri, BaseEventSchema as rn, ɵselectHasNextPage$1 as ro, OptionalMetadataSchema as rr, useCapabilities as rt, CoAgentStateRendersContext as s, on as sa, ToolCallResultEventSchema as si, ContextSchema as sn, ɵselectMemoriesAvailable$1 as so, ProxiedCopilotRuntimeAgent$1 as sr, useDefaultRenderTool as st, CopilotKit as t, isInterruptExpired as ta, TextMessageStartEventSchema as ti, BackwardCompatibility_0_0_45 as tn, ɵphoenixSocket$ as to, MultimodalInputCapabilitiesSchema as tr, useSuggestions as tt, useAsyncCallback as u, onInspectorViewThread$1 as ua, ToolCallStatus$1 as ui, CopilotKitCoreErrorCode$1 as un, ɵselectMemoriesIsMutating as uo, ReasoningEncryptedValueEventSchema as ur, useComponent as ut, CopilotThreadsDrawer as v, resolveAgentDebugConfig as va, VideoInputPartSchema as vi, DocumentInputContentSchema as vn, ReasoningStartEventSchema as vr, CopilotKitCoreReact as vt, CopilotChatToggleButton as w, structuredClone_ as wa, classifySurfaceCards as wi, EventTypeSchema as wn, RunErrorEventSchema as wr, OpenGenerativeUIToolRenderer as wt, CopilotPopupView as x, segmentSurfaceProse as xa, aggregateTokenUsage as xi, EventSchema as xn, ResumeEntrySchema as xr, OpenGenerativeUIActivityRenderer as xt, CopilotPopup as y, resolveDebugLogger as ya, VideoPartSchema as yi, DocumentInputPartSchema as yn, RemoveOperationSchema as yr, createA2UIMessageRenderer as yt, CopilotChatSuggestionPill as z, ɵcreateThreadStore$1 as za, emitInspectorStopViewing as zi, InputContentSourceSchema as zn, SubagentErrorEventSchema as zr, AGUIError as zt };
14490
- //# sourceMappingURL=copilotkit-BJ-6BoJ_.mjs.map
14746
+ export { INTERRUPT_EVENT_NAME as $, ɵobservePhoenixEvent$ as $a, getMarkdownOperationSurfaceId as $i, MetadataSchema as $n, TextInputContentSchema as $r, AudioInputPartSchema as $t, CopilotChatMessageView as A, transformChunks as Aa, contentHasMedia as Ai, FunctionCallSchema as An, RunFinishedInterruptOutcomeSchema as Ar, ɵrunMcpFollowUp as At, CopilotChatReasoningMessage_default as B, ɵcreateMemoryStore as Ba, defaultApplyEvents as Bi, InputContentSchema as Bn, StepFinishedEventSchema as Br, AGUIError as Bt, CopilotModalHeader as C, runHttpRequest as Ca, WebMCPRegistry as Ci, EventSchema as Cn, ReplaceOperationSchema as Cr, OpenGenerativeUIContentSchema as Ct, CopilotChat as D, structuredClone_ as Da, classifySurfaceCards as Di, ExecutionCapabilitiesSchema as Dn, RunErrorEventSchema as Dr, MCPAppsActivityContentSchema as Dt, DefaultOpenIcon as E, splitA2UIMarkdown$1 as Ea, buildResumeArray as Ei, EventTypeSchema as En, RunAgentInputSchema as Er, useSandboxFunctions as Et, getIntelligenceTurnAnchors as F, ɵInterruptState$1 as Fa, createEffect as Fi, IdentityCapabilitiesSchema as Fn, StateCapabilitiesSchema as Fr, CopilotChatAudioRecorder as Ft, useLearningContainersInCurrentThread as G, ɵisHttpAgent$1 as Ga, empty as Gi, InterruptSchema as Gn, SubagentFinishedSuccessOutcomeSchema as Gr, ActivitySnapshotEventSchema as Gt, CopilotChatAttachmentRenderer as H, ɵcreateThreadStore$1 as Ha, emitInspectorStopViewing as Hi, InputContentUrlSourceSchema as Hn, SubagentErrorEventSchema as Hr, AbstractAgent$1 as Ht, IntelligenceIndicatorView as I, ɵMAX_SOCKET_RETRIES as Ia, createInspectorThreadRequestId as Ii, ImageInputContentSchema as In, StateDeltaEventSchema as Ir, A2UI_FENCE_LANGUAGE as It, useLearnFromUserActionInCurrentThread as J, ɵmapMemoryMetadataEvent as Ja, ensureObjectArgs as Ji, JsonPointerSchema as Jn, SubagentRunIdSchema as Jr, AgentRegistry as Jt, useLearningContainers as K, ɵisRetryableMemoryStatus as Ka, enforceEvents as Ki, JsonPatchOperationSchema as Kn, SubagentFinishedSuspendedOutcomeSchema as Kr, AddOperationSchema as Kt, CopilotChatWorkSummary as L, ɵRUNTIME_PROBE_TIMEOUT_MS as La, createReducer as Li, ImageInputPartSchema as Ln, StateManager as Lr, ACTIVITY_HISTORY_METADATA as Lt, messageRow as M, verifyEvents as Ma, convertToLegacyEvents as Mi, HttpAgent as Mn, RunFinishedSuccessOutcomeSchema as Mr, useRenderToolCall as Mt, INTELLIGENCE_TURN_HEAD as N, withAuthoritativeActivityTypes as Na, createActionGroup as Ni, HumanInTheLoopCapabilitiesSchema as Nn, RunHandler as Nr, CopilotChatInput_default as Nt, CopilotChatView_default as O, tokenUsageFromAiSdkUsage as Oa, compactEvents as Oi, FileSourceSchema as On, RunFinishedCancelledOutcomeSchema as Or, MCPAppsActivityRenderer as Ot, IntelligenceIndicator as P, ɵCOPILOTKIT_FEATURES as Pa, createDebugLogger as Pi, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as Pn, RunStartedEventSchema as Pr, AudioRecorderError as Pt, useInterrupt as Q, ɵmemoryRestEvents as Qa, flattenInformationalCards as Qi, MessagesSnapshotEventSchema as Qn, TestOperationSchema as Qr, AudioInputContentSchema as Qt, CopilotChatSuggestionView as R, ɵTHREAD_REQUEST_TIMEOUT_MS as Ra, createSelector as Ri, ImagePartSchema as Rn, StateSchema as Rr, AGUIConnectNotImplementedError$1 as Rt, CopilotSidebarView as S, resolveDebugLogger as Sa, VideoPartSchema as Si, DocumentPartSchema as Sn, RemoveOperationSchema as Sr, OpenGenerativeUIActivityType as St, DefaultCloseIcon as T, select as Ta, authoritativeActivityTypes as Ti, EventType as Tn, RoleSchema as Tr, SandboxFunctionsContext as Tt, CopilotChatAssistantMessage_default as U, ɵgetAgentInterruptState$1 as Ua, emitInspectorViewThread as Ui, IntelligenceAgent as Un, SubagentFinishedEventSchema as Ur, ActivityDeltaEventSchema as Ut, CopilotChatUserMessage_default as V, ɵcreateThreadSelectors as Va, emitInspectorActiveThread$1 as Vi, InputContentSourceSchema as Vn, StepStartedEventSchema as Vr, AGUI_METADATA_KEY as Vt, CopilotChatToolCallsView as W, ɵisCopilotKitFeature as Wa, emitInspectorViewThreadResult$1 as Wi, IntelligenceReplayFailedError as Wn, SubagentFinishedOutcomeSchema as Wr, ActivityMessageSchema as Wt, useMemories as X, ɵmemoryDomainEvents as Xa, extractFenceOperations as Xi, MemoryError as Xn, SuggestionEngine as Xr, AssistantMessageSchema as Xt, useLearnFromUserAction as Y, ɵmemoryAdapterEvents as Ya, extractCompleteArrayItems as Yi, MEMORY_ERROR_REGISTRY as Yn, SubagentStartedEventSchema as Yr, AgentThreadLockedError as Yt, useThreads$1 as Z, ɵmemoryReducer as Za, extractStringField as Zi, MessageSchema as Zn, SystemMessageSchema as Zr, AttributableSchema as Zt, WildcardToolCallRender as _, parseToolArguments as _a, TransportCapabilitiesSchema as _i, DataSourceSchema as _n, ɵselectThreadsIsLoading$1 as _o, ReasoningMessageContentEventSchema as _r, useLicenseContext$1 as _t, ThreadsProvider as a, isRecognizedEvent as aa, TextPartSchema as ai, BaseMessageSchema as an, ɵselectFetchMoreError$1 as ao, MultimodalOutputCapabilitiesSchema as ar, useAgent as at, CopilotSidebar as b, randomUUID$2 as ba, VideoInputContentSchema as bi, DocumentInputContentSchema as bn, ReasoningMessageStartEventSchema as br, GenerateSandboxedUiArgsSchema as bt, CoAgentStateRendersProvider as c, ofType as ca, ToolCallChunkEventSchema as ci, ContextSchema as cn, ɵselectIsMutating$1 as co, PROTOCOL_VERSION as cr, CopilotChatToolCallGroup as ct, shouldShowDevConsole as d, onInspectorActiveThread as da, ToolCallSchema as di, CopilotKitCoreErrorCode$1 as dn, ɵselectMemoriesError$1 as do, RawEventSchema as dr, useFrontendTools as dt, getRunOutcome as ea, TextMessageChunkEventSchema as ei, AudioPartSchema as en, ɵobservePhoenixJoinOutcome$ as eo, Middleware as er, useConfigureSuggestions as et, useToast as f, onInspectorStopViewing$1 as fa, ToolCallStartEventSchema as fi, CopilotKitCoreRuntimeConnectionStatus$1 as fn, ɵselectMemoriesIsLoading$1 as fo, ReasoningCapabilitiesSchema as fr, useFrontendTool as ft, useCopilotContext as g, parseSSEStream as ga, ToolsCapabilitiesSchema as gi, DEFAULT_MAX_ENFORCED_ENTRIES as gn, ɵselectThreadsError$1 as go, ReasoningMessageChunkEventSchema as gr, useCopilotKit$1 as gt, CopilotContext as h, parseProtoStream as ha, ToolSchema as hi, CustomEventSchema as hn, ɵselectThreads$1 as ho, ReasoningEndEventSchema as hr, CopilotKitProvider as ht, ThreadsContext as i, isInterruptExpired as ia, TextMessageStartEventSchema as ii, BaseEventSchema as in, ɵphoenixSocket$ as io, MultimodalInputCapabilitiesSchema as ir, UseAgentUpdate as it, messageGroup as j, transformHttpEventStream as ja, contentToText$1 as ji, FunctionMiddleware as jn, RunFinishedOutcomeSchema as jr, CopilotKitInspector as jt, CopilotChatAttachmentQueue as k, tokenUsageFromLangChainMetadata as ka, completePartialMarkdown as ki, FilterToolCallsMiddleware as kn, RunFinishedEventSchema as kr, MCPAppsActivityType as kt, useCoAgentStateRenders as l, omitOptionalNulls as la, ToolCallEndEventSchema as li, ContextStore as ln, ɵselectMemories$1 as lo, PartSourceSchema as lr, useRenderTool as lt, useCopilotMessagesContext as m, onInspectorViewThreadResult as ma, ToolMessageSchema as mi, CopyOperationSchema as mn, ɵselectMemoriesRealtimeStatus$1 as mo, ReasoningEncryptedValueSubtypeSchema as mr, useRenderCustomMessages as mt, defaultCopilotContextCategories as n, isAbortError as na, TextMessageEndEventSchema as ni, BackwardCompatibility_0_0_45 as nn, ɵobservePhoenixSocketSignals$ as no, MultiAgentCapabilitiesSchema as nr, useAgentContext as nt, useThreads as o, isRunCompletionAware$1 as oa, TokenUsageSchema as oi, CompatibilityBoundary as on, ɵselectHasNextPage$1 as oo, OptionalMetadataSchema as or, useHumanInTheLoop as ot, CopilotMessagesContext as p, onInspectorViewThread$1 as pa, ToolCallStatus$1 as pi, CopilotKitHeaderResolutionError as pn, ɵselectMemoriesIsMutating as po, ReasoningEncryptedValueEventSchema as pr, useRenderActivityMessage as pt, useAttachments as q, ɵjoinPhoenixChannel$ as qa, enforceOutgoingInput as qi, JsonPatchSchema as qn, SubagentInfoSchema as qr, AgentCapabilitiesSchema as qt, CoAgentStateRenderBridge as r, isInspectorThreadBridgeEnabled$1 as ra, TextMessageRoleSchema as ri, BackwardCompatibility_0_0_57 as rn, ɵphoenixChannel$ as ro, MultimodalCapabilitiesSchema as rr, useCapabilities as rt, CoAgentStateRendersContext as s, mergeMetadata as sa, ToolCallArgsEventSchema as si, ContentPartSchema as sn, ɵselectIsFetchingNextPage$1 as so, OutputCapabilitiesSchema as sr, useDefaultRenderTool as st, CopilotKit as t, getWebMCPModelContext as ta, TextMessageContentEventSchema as ti, BackwardCompatibility_0_0_39 as tn, ɵobservePhoenixSocketHealth$ as to, MoveOperationSchema as tr, useSuggestions as tt, useAsyncCallback as u, on as ua, ToolCallResultEventSchema as ui, CopilotKitCore$1 as un, ɵselectMemoriesAvailable$1 as uo, ProxiedCopilotRuntimeAgent$1 as ur, useComponent as ut, CopilotThreadsDrawer as v, prepareSurfaceOperations as va, UrlSourceSchema as vi, DebugLogger as vn, ɵthreadAdapterEvents as vo, ReasoningMessageEndEventSchema as vr, CopilotKitCoreReact as vt, CopilotChatToggleButton as w, segmentSurfaceProse as wa, aggregateTokenUsage as wi, EventSchemas as wn, ResumeEntrySchema as wr, OpenGenerativeUIToolRenderer as wt, CopilotPopupView as x, resolveAgentDebugConfig as xa, VideoInputPartSchema as xi, DocumentInputPartSchema as xn, ReasoningStartEventSchema as xr, OpenGenerativeUIActivityRenderer as xt, CopilotPopup as y, props as ya, UserMessageSchema as yi, DeveloperMessageSchema as yn, ɵwithHeaderDefaults$1 as yo, ReasoningMessageSchema as yr, createA2UIMessageRenderer as yt, CopilotChatSuggestionPill as z, ɵclearAgentInterruptState$1 as za, createStore as zi, InputContentDataSourceSchema as zn, StateSnapshotEventSchema as zr, AGUIEnforcementLimitError as zt };
14747
+ //# sourceMappingURL=copilotkit-GWoyxfzS.mjs.map