@copilotkit/react-core 1.75.2 → 1.77.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 (43) hide show
  1. package/dist/{copilotkit-Beiw32bn.cjs → copilotkit-CFPkj9B9.cjs} +155 -54
  2. package/dist/copilotkit-CFPkj9B9.cjs.map +1 -0
  3. package/dist/{copilotkit-D9iy3p2l.mjs → copilotkit-CP9qPAqV.mjs} +159 -57
  4. package/dist/copilotkit-CP9qPAqV.mjs.map +1 -0
  5. package/dist/{copilotkit-CGlSOKHM.d.mts → copilotkit-Cqa0TfEo.d.mts} +43 -17
  6. package/dist/copilotkit-Cqa0TfEo.d.mts.map +1 -0
  7. package/dist/{copilotkit-Cjj9wDI8.d.cts → copilotkit-DGc2YiW9.d.cts} +35 -4
  8. package/dist/copilotkit-DGc2YiW9.d.cts.map +1 -0
  9. package/dist/index.cjs +2 -2
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +4 -4
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +90 -44
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/context.cjs.map +1 -1
  20. package/dist/v2/context.d.cts +5 -0
  21. package/dist/v2/context.d.cts.map +1 -1
  22. package/dist/v2/context.d.mts +5 -0
  23. package/dist/v2/context.d.mts.map +1 -1
  24. package/dist/v2/context.mjs.map +1 -1
  25. package/dist/v2/headless.cjs +36 -24
  26. package/dist/v2/headless.cjs.map +1 -1
  27. package/dist/v2/headless.d.cts +5 -0
  28. package/dist/v2/headless.d.cts.map +1 -1
  29. package/dist/v2/headless.d.mts +2 -2
  30. package/dist/v2/headless.d.mts.map +1 -1
  31. package/dist/v2/headless.mjs +38 -26
  32. package/dist/v2/headless.mjs.map +1 -1
  33. package/dist/v2/index.cjs +302 -121
  34. package/dist/v2/index.d.cts +2 -2
  35. package/dist/v2/index.d.mts +2 -2
  36. package/dist/v2/index.mjs +2 -2
  37. package/dist/v2/index.umd.js +457 -177
  38. package/dist/v2/index.umd.js.map +1 -1
  39. package/package.json +10 -10
  40. package/dist/copilotkit-Beiw32bn.cjs.map +0 -1
  41. package/dist/copilotkit-CGlSOKHM.d.mts.map +0 -1
  42. package/dist/copilotkit-Cjj9wDI8.d.cts.map +0 -1
  43. package/dist/copilotkit-D9iy3p2l.mjs.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import * as React$1 from "react";
2
2
  import React, { createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
3
- import { AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, 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, props, select, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵisCopilotKitFeature, ɵ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 } from "@copilotkit/core";
4
- import { AGUIConnectNotImplementedError as AGUIConnectNotImplementedError$1, AGUIError, AGUI_METADATA_KEY, AbstractAgent as AbstractAgent$1, ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AgentCapabilitiesSchema, AssistantMessageSchema, AudioInputContentSchema, AudioInputPartSchema, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_47, BackwardCompatibility_0_0_57, BaseEventSchema, BaseMessageSchema, BinaryInputContentSchema, ContextSchema, CustomEventSchema, DebugLogger, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, EventSchemas, EventType, ExecutionCapabilitiesSchema, FilterToolCallsMiddleware, FunctionCallSchema, FunctionMiddleware, HttpAgent, HttpAgent as HttpAgent$1, HumanInTheLoopCapabilitiesSchema, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, InterruptSchema, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, Middleware, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OptionalMetadataSchema, OutputCapabilitiesSchema, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunStartedEventSchema, StateCapabilitiesSchema, StateDeltaEventSchema, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, SubAgentInfoSchema, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentStartedEventSchema, SystemMessageSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageStartEventSchema, ThinkingEndEventSchema, ThinkingStartEventSchema, ThinkingTextMessageContentEventSchema, ThinkingTextMessageEndEventSchema, ThinkingTextMessageStartEventSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, aggregateTokenUsage, buildResumeArray, compactEvents, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, getRunOutcome, isInterruptExpired, mergeMetadata, parseProtoStream, parseSSEStream, randomUUID, randomUUID as randomUUID$2, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents } from "@ag-ui/client";
3
+ import { AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, 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, props, select, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$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 } from "@copilotkit/core";
4
+ 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";
5
+ 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";
5
6
  import { extendTailwindMerge, twMerge } from "tailwind-merge";
6
7
  import { ArrowUp, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronRightIcon, Copy, Edit, EyeOff, Loader2, MessageCircle, Mic, PanelLeftOpen, Play, Plus, RefreshCw, Square, ThumbsDown, ThumbsUp, Upload, Volume2, Wrench, X } from "lucide-react";
7
8
  import { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitRemoteEndpointDiscoveryError, DEFAULT_AGENT_ID, ErrorVisibility, MissingPublicApiKeyError, Severity, TranscriptionErrorCode, TranscriptionErrorCode as TranscriptionErrorCode$1, commitRowKeyStore, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, dataToUUID, exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, parseJson, partialJSONParse, randomId, randomUUID as randomUUID$1, readFileAsBase64, resolveRowRenderKeysById, schemaToJsonSchema, shouldEnableInspector } from "@copilotkit/shared";
@@ -13,6 +14,7 @@ import { clsx } from "clsx";
13
14
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
14
15
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
15
16
  import { Streamdown } from "streamdown";
17
+ import { contentToText } from "@ag-ui/core";
16
18
  import { z } from "zod";
17
19
  import { MCPAppsActivityContentSchema, MCPAppsActivityType, ɵrunMcpFollowUp } from "@copilotkit/mcp-apps-renderer/activity";
18
20
  import { A2UIProvider, A2UIRenderer, A2UI_SCHEMA_CONTEXT_DESCRIPTION, Catalog, DEFAULT_SURFACE_ID, ROOT_COMPONENT_ID, buildCatalogContextValue, extractCatalogComponentSchemas, filterCatalog, initializeDefaultCatalog, injectStyles, useA2UIActions, useA2UIError, viewerTheme } from "@copilotkit/a2ui-renderer";
@@ -140,6 +142,25 @@ const CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId,
140
142
  parentConfig?.threadId,
141
143
  activeThreadOverride
142
144
  ]);
145
+ const copilotkit = useContext(CopilotKitContext)?.copilotkit;
146
+ const openThreadRef = useRef(null);
147
+ const latestThreadIdRef = useRef(resolvedThreadId);
148
+ latestThreadIdRef.current = resolvedThreadId;
149
+ useEffect(() => {
150
+ if (copilotkit === void 0) return;
151
+ const registration = copilotkit.registerOpenThread({
152
+ agentId: resolvedAgentId,
153
+ threadId: latestThreadIdRef.current
154
+ });
155
+ openThreadRef.current = registration;
156
+ return () => {
157
+ registration.unregister();
158
+ openThreadRef.current = null;
159
+ };
160
+ }, [copilotkit, resolvedAgentId]);
161
+ useEffect(() => {
162
+ openThreadRef.current?.update(resolvedThreadId);
163
+ }, [resolvedThreadId]);
143
164
  const resolvedHasExplicitThreadId = (threadIdPropIsAuthoritative ? true : activeThreadOverride?.explicit ?? hasExplicitThreadId ?? false) || !!parentConfig?.hasExplicitThreadId;
144
165
  const [internalModalOpen, setInternalModalOpen] = useState(isModalDefaultOpen ?? true);
145
166
  const hasExplicitDefault = isModalDefaultOpen !== void 0;
@@ -1509,7 +1530,7 @@ const ToolCallRenderer = React.memo(function ToolCallRenderer({ toolCall, toolMe
1509
1530
  toolCallId: toolCall.id,
1510
1531
  args,
1511
1532
  status: ToolCallStatus.Complete,
1512
- result: toolMessage.content
1533
+ result: contentToText(toolMessage.content)
1513
1534
  });
1514
1535
  else if (isExecuting) return /* @__PURE__ */ jsx(RenderComponent, {
1515
1536
  name: toolName,
@@ -1605,7 +1626,7 @@ function useRenderToolCall() {
1605
1626
 
1606
1627
  //#endregion
1607
1628
  //#region package.json
1608
- var version = "1.75.2";
1629
+ var version = "1.77.0";
1609
1630
 
1610
1631
  //#endregion
1611
1632
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -1841,12 +1862,14 @@ function InlineFeatureWarning({ featureName }) {
1841
1862
  * Fetches resource content on-demand via proxied MCP requests. The React shell
1842
1863
  * owns the iframe; `bindMcpApp` owns the protocol.
1843
1864
  */
1844
- const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agent }) {
1865
+ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, message, agent }) {
1845
1866
  const { copilotkit } = useCopilotKit$1();
1867
+ const messageId = message?.id;
1846
1868
  const containerRef = useRef(null);
1847
1869
  const iframeRef = useRef(null);
1848
1870
  const sessionRef = useRef(null);
1849
1871
  const [error, setError] = useState(null);
1872
+ const [contentError, setContentError] = useState(null);
1850
1873
  const [isLoading, setIsLoading] = useState(true);
1851
1874
  const [iframeSize, setIframeSize] = useState({});
1852
1875
  const [fetchedResource, setFetchedResource] = useState(null);
@@ -1865,6 +1888,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1865
1888
  let mounted = true;
1866
1889
  setIsLoading(true);
1867
1890
  setError(null);
1891
+ setContentError(null);
1868
1892
  const iframe = document.createElement("iframe");
1869
1893
  iframe.style.width = "100%";
1870
1894
  iframe.style.height = "100px";
@@ -1887,6 +1911,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1887
1911
  getContent: () => contentRef.current,
1888
1912
  getAgent: () => agentRef.current,
1889
1913
  host: copilotkit,
1914
+ messageId,
1890
1915
  hooks: {
1891
1916
  onResource: (resource) => {
1892
1917
  if (!mounted) return;
@@ -1896,6 +1921,9 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1896
1921
  onSizeChanged: (size) => {
1897
1922
  if (mounted) setIframeSize(size);
1898
1923
  },
1924
+ onContentError: (err) => {
1925
+ if (mounted) setContentError(err);
1926
+ },
1899
1927
  onError: (err) => {
1900
1928
  if (!mounted) return;
1901
1929
  setError(err);
@@ -1904,9 +1932,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1904
1932
  }
1905
1933
  });
1906
1934
  sessionRef.current = session;
1907
- const current = contentRef.current;
1908
- if (current.toolInput) session.sendToolInput(current.toolInput);
1909
- if (current.result) session.sendToolResult(current.result);
1935
+ session.syncContent(contentRef.current);
1910
1936
  } catch (err) {
1911
1937
  console.error("[MCPAppsRenderer] Setup error:", err);
1912
1938
  if (mounted) {
@@ -1926,6 +1952,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1926
1952
  }, [
1927
1953
  agent,
1928
1954
  copilotkit,
1955
+ messageId,
1929
1956
  content.resourceUri,
1930
1957
  content.serverHash,
1931
1958
  content.serverId
@@ -1940,11 +1967,8 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1940
1967
  }
1941
1968
  }, [iframeSize]);
1942
1969
  useEffect(() => {
1943
- if (content.toolInput) sessionRef.current?.sendToolInput(content.toolInput);
1944
- }, [content.toolInput]);
1945
- useEffect(() => {
1946
- if (content.result) sessionRef.current?.sendToolResult(content.result);
1947
- }, [content.result]);
1970
+ sessionRef.current?.syncContent(contentRef.current);
1971
+ }, [content.toolInput, content.result]);
1948
1972
  const borderStyle = fetchedResource?._meta?.ui?.prefersBorder === true ? {
1949
1973
  borderRadius: "8px",
1950
1974
  backgroundColor: "#f9f9f9",
@@ -1966,12 +1990,12 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1966
1990
  color: "#666"
1967
1991
  },
1968
1992
  children: "Loading..."
1969
- }), error && /* @__PURE__ */ jsxs("div", {
1993
+ }), (error ?? contentError) && /* @__PURE__ */ jsxs("div", {
1970
1994
  style: {
1971
1995
  color: "red",
1972
1996
  padding: "1rem"
1973
1997
  },
1974
- children: ["Error: ", error.message]
1998
+ children: ["Error: ", (error ?? contentError).message]
1975
1999
  })]
1976
2000
  });
1977
2001
  };
@@ -3369,7 +3393,7 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3369
3393
  }, [value, warningMessage]);
3370
3394
  return value;
3371
3395
  }
3372
- const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, messageFilter, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, enableInspector, agentId, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug }) => {
3396
+ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, messageFilter, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, enableInspector, agentId, showIntelligenceIndicator = true, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug, learning }) => {
3373
3397
  const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
3374
3398
  const [inspectorVisible, setInspectorVisible] = useState(false);
3375
3399
  useEffect(() => {
@@ -3604,7 +3628,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3604
3628
  renderToolCalls: allRenderToolCalls,
3605
3629
  renderActivityMessages: allActivityRenderers,
3606
3630
  renderCustomMessages: renderCustomMessagesList,
3607
- debug
3631
+ debug,
3632
+ learning
3608
3633
  });
3609
3634
  if (defaultThrottleMs !== void 0) copilotkitRef.current.setDefaultThrottleMs(defaultThrottleMs);
3610
3635
  }
@@ -3709,6 +3734,32 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3709
3734
  useSingleEndpoint,
3710
3735
  debug
3711
3736
  ]);
3737
+ const learningEnabled = learning !== void 0;
3738
+ const trajectoryId = learning?.trajectoryId;
3739
+ const learningContainerIdsRef = useRef(learning?.learningContainerIds);
3740
+ useEffect(() => {
3741
+ copilotkit.setLearningConfig(learning);
3742
+ learningContainerIdsRef.current = learning?.learningContainerIds;
3743
+ if (learning?.sink === void 0 && learning?.trajectoryId === void 0 && learning?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture does not assign Learning Containers; remove learningContainerIds from the capture options.");
3744
+ }, [copilotkit, learning]);
3745
+ useEffect(() => {
3746
+ if (!learningEnabled) return;
3747
+ let disposed = false;
3748
+ if (trajectoryId !== void 0) copilotkit.startTrajectory({
3749
+ trajectoryId,
3750
+ learningContainerIds: learningContainerIdsRef.current
3751
+ }).catch(() => {
3752
+ if (!disposed) console.warn("[CopilotKit] Failed to start interaction capture.");
3753
+ });
3754
+ return () => {
3755
+ disposed = true;
3756
+ copilotkit.stopTrajectory();
3757
+ };
3758
+ }, [
3759
+ copilotkit,
3760
+ learningEnabled,
3761
+ trajectoryId
3762
+ ]);
3712
3763
  const didMountRef = useRef(false);
3713
3764
  useEffect(() => {
3714
3765
  if (!didMountRef.current) return;
@@ -3771,8 +3822,13 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3771
3822
  ]);
3772
3823
  const contextValue = useMemo(() => ({
3773
3824
  copilotkit,
3774
- executingToolCallIds
3775
- }), [copilotkit, executingToolCallIds]);
3825
+ executingToolCallIds,
3826
+ showIntelligenceIndicator
3827
+ }), [
3828
+ copilotkit,
3829
+ executingToolCallIds,
3830
+ showIntelligenceIndicator
3831
+ ]);
3776
3832
  const retryableRuntimeEntitlementFailure = runtimeEntitlements?.status !== "ready" && runtimeEntitlements?.error.retryable === true;
3777
3833
  const hasNonReadyRuntimeEntitlement = runtimeEntitlements !== void 0 && runtimeEntitlements.status !== "ready";
3778
3834
  const hasLegacyRuntimeEntitlementFallback = runtimeLicenseStatus === "valid" || runtimeLicenseStatus === "expiring";
@@ -4653,7 +4709,7 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
4653
4709
  updateFlags
4654
4710
  ]);
4655
4711
  useEffect(() => {
4656
- if (agent instanceof HttpAgent) copilotkit.applyHeadersToAgent(agent);
4712
+ if (ɵisHttpAgent(agent)) copilotkit.applyHeadersToAgent(agent);
4657
4713
  if (agent instanceof ProxiedCopilotRuntimeAgent) agent.credentials = copilotkit.credentials;
4658
4714
  }, [
4659
4715
  agent,
@@ -4991,7 +5047,6 @@ function useInterrupt(config) {
4991
5047
  pendingRef.current = pending;
4992
5048
  const [handlerResult, setHandlerResult] = useState(null);
4993
5049
  const interruptStateRef = useRef(new ɵInterruptState());
4994
- const legacyRunIdRef = useRef(void 0);
4995
5050
  useEffect(() => {
4996
5051
  const interruptState = interruptStateRef.current;
4997
5052
  let localLegacy = null;
@@ -5009,16 +5064,14 @@ function useInterrupt(config) {
5009
5064
  onRunStartedEvent: () => {
5010
5065
  localLegacy = null;
5011
5066
  localStandard = null;
5012
- legacyRunIdRef.current = void 0;
5013
5067
  interruptState.clear();
5014
5068
  setPending(null);
5015
5069
  },
5016
- onRunFinalized: (params) => {
5070
+ onRunFinalized: () => {
5017
5071
  if (localStandard && localStandard.length > 0) {
5018
5072
  interruptState.setStandard(localStandard);
5019
5073
  setPending(interruptState.pending);
5020
5074
  } else if (localLegacy) {
5021
- legacyRunIdRef.current = params.input.runId;
5022
5075
  interruptState.setLegacy(localLegacy);
5023
5076
  setPending(interruptState.pending);
5024
5077
  }
@@ -5028,7 +5081,6 @@ function useInterrupt(config) {
5028
5081
  onRunFailed: () => {
5029
5082
  localLegacy = null;
5030
5083
  localStandard = null;
5031
- legacyRunIdRef.current = void 0;
5032
5084
  interruptState.clear();
5033
5085
  setPending(null);
5034
5086
  }
@@ -5043,22 +5095,18 @@ function useInterrupt(config) {
5043
5095
  if (!current) return;
5044
5096
  if (current.kind === "standard" && current.interrupts.length > 1 && interruptId === void 0) console.warn(`[CopilotKit] useInterrupt: resolve()/cancel() called without an interruptId while ${current.interrupts.length} interrupts are open; defaulting to the first. Pass an interruptId to address a specific interrupt.`);
5045
5097
  const decision = interruptStateRef.current.resolve(payload, interruptId);
5046
- if (decision.kind === "legacy-resume") {
5047
- const runId = legacyRunIdRef.current;
5048
- try {
5049
- return await copilotkit.runAgent({
5050
- agent,
5051
- ...runId !== void 0 ? { runId } : {},
5052
- forwardedProps: { command: {
5053
- resume: decision.payload,
5054
- interruptEvent: decision.interruptValue
5055
- } }
5056
- });
5057
- } catch (err) {
5058
- console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
5059
- setPending(null);
5060
- throw err;
5061
- }
5098
+ if (decision.kind === "legacy-resume") try {
5099
+ return await copilotkit.runAgent({
5100
+ agent,
5101
+ forwardedProps: { command: {
5102
+ resume: decision.payload,
5103
+ interruptEvent: decision.interruptValue
5104
+ } }
5105
+ });
5106
+ } catch (err) {
5107
+ console.error("[CopilotKit] useInterrupt resolve: runAgent rejected; clearing pending + rethrowing", err);
5108
+ setPending(null);
5109
+ throw err;
5062
5110
  }
5063
5111
  if (decision.kind === "expired") {
5064
5112
  console.error(`[CopilotKit] useInterrupt: interrupt ${decision.interrupt.id} expired at ${decision.interrupt.expiresAt}; not resuming.`);
@@ -6014,13 +6062,23 @@ function useLearningContainersInCurrentThread({ learningContainers }) {
6014
6062
  //#region src/v2/components/chat/CopilotChatToolCallsView.tsx
6015
6063
  function CopilotChatToolCallsView({ message, messages = [] }) {
6016
6064
  const renderToolCall = useRenderToolCall();
6065
+ const { copilotkit } = useCopilotKit();
6066
+ const subscribe = useCallback((onChange) => copilotkit.ɵsubscribeToLearningConfigured(onChange), [copilotkit]);
6067
+ const getSnapshot = () => copilotkit.ɵlearningConfigured;
6068
+ const learningConfigured = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
6017
6069
  if (!message.toolCalls || message.toolCalls.length === 0) return null;
6018
6070
  return /* @__PURE__ */ jsx(Fragment$1, { children: message.toolCalls.map((toolCall) => {
6019
- const toolMessage = messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id);
6020
- return /* @__PURE__ */ jsx(React.Fragment, { children: renderToolCall({
6071
+ const rendered = renderToolCall({
6021
6072
  toolCall,
6022
- toolMessage
6023
- }) }, toolCall.id);
6073
+ toolMessage: messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id)
6074
+ });
6075
+ if (rendered === null) return null;
6076
+ if (!learningConfigured) return rendered;
6077
+ return /* @__PURE__ */ jsx("div", {
6078
+ "data-tool-call-id": toolCall.id,
6079
+ style: { display: "contents" },
6080
+ children: rendered
6081
+ }, toolCall.id);
6024
6082
  }) });
6025
6083
  }
6026
6084
 
@@ -6364,6 +6422,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
6364
6422
  const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
6365
6423
  if (children) return /* @__PURE__ */ jsx("div", {
6366
6424
  "data-copilotkit": true,
6425
+ "data-message-id": message.id,
6367
6426
  style: { display: "contents" },
6368
6427
  children: children({
6369
6428
  markdownRenderer: boundMarkdownRenderer,
@@ -7601,7 +7660,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7601
7660
  const isPinnedToBottom = useContext(ScrollPinnedContext);
7602
7661
  const renderCustomMessage = useRenderCustomMessages();
7603
7662
  const { renderActivityMessage } = useRenderActivityMessage();
7604
- const { copilotkit } = useCopilotKit$1();
7663
+ const { copilotkit, showIntelligenceIndicator = true } = useCopilotKit$1();
7605
7664
  const config = useCopilotChatConfiguration();
7606
7665
  const [, forceUpdate] = useReducer((x) => x + 1, 0);
7607
7666
  useEffect(() => {
@@ -7788,7 +7847,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7788
7847
  renderCustomMessage,
7789
7848
  stateSnapshot
7790
7849
  }, `${rowKey}-custom-after`));
7791
- const intelligenceTurnId = intelligenceTurnAnchors.get(message.id);
7850
+ const intelligenceTurnId = showIntelligenceIndicator ? intelligenceTurnAnchors.get(message.id) : void 0;
7792
7851
  if (intelligenceTurnId !== void 0) elements.push(/* @__PURE__ */ jsx(IntelligenceIndicator, {
7793
7852
  message,
7794
7853
  agentId: config?.agentId ?? DEFAULT_AGENT_ID,
@@ -8913,6 +8972,8 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8913
8972
  const hasNativeIntelligenceRunActivity = hasExplicitThreadId && runtimeStatus === "Connected" && !!copilotkit.intelligence?.wsUrl && copilotkit.threadEndpoints?.realtimeMetadata === true;
8914
8973
  const [standaloneRunActivityStore] = useState(() => ɵcreateThreadStore({ fetch: copilotkit.ɵruntimeFetch }));
8915
8974
  const previousThreadRef = useRef(null);
8975
+ const detachPromisesRef = useRef(/* @__PURE__ */ new WeakMap());
8976
+ const pendingTeardownRef = useRef(Promise.resolve());
8916
8977
  const hasExplicitThreadIdRef = useRef(hasExplicitThreadId);
8917
8978
  hasExplicitThreadIdRef.current = hasExplicitThreadId;
8918
8979
  const rememberRecentlyLocalRunId = useCallback((runId) => {
@@ -8955,23 +9016,59 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8955
9016
  const previousThread = previousThreadRef.current;
8956
9017
  const threadChanged = previousThread?.threadId !== resolvedThreadId;
8957
9018
  const inspectorTransition = threadChanged && previousThread !== null && previousThread.inspectorRequestId !== inspectorRequestId && (previousThread.inspectorRequestId !== null || inspectorRequestId !== null);
8958
- previousThreadRef.current = {
9019
+ const selection = {
8959
9020
  threadId: resolvedThreadId,
8960
- inspectorRequestId
9021
+ inspectorRequestId,
9022
+ agent
8961
9023
  };
9024
+ previousThreadRef.current = selection;
9025
+ const discardedThreadId = previousThread?.agent === agent ? previousThread.threadId : agent.threadId;
8962
9026
  if (inspectorTransition) if (typeof copilotkit.stopAgent === "function") copilotkit.stopAgent({ agent });
8963
9027
  else agent.abortRun?.();
8964
9028
  agent.threadId = resolvedThreadId;
8965
9029
  if (!hasExplicitThreadId) {
8966
- if (threadChanged && agent.messages.length > 0) agent.setMessages([]);
8967
- return;
9030
+ let active = true;
9031
+ if (threadChanged && previousThread !== null) {
9032
+ let resetPending = true;
9033
+ const clearCursor = () => {
9034
+ if ("clearReplayCursor" in agent && typeof agent.clearReplayCursor === "function") agent.clearReplayCursor(discardedThreadId);
9035
+ if ("clearReconnectCursor" in agent && typeof agent.clearReconnectCursor === "function") agent.clearReconnectCursor(discardedThreadId);
9036
+ };
9037
+ const clearDiscardedBaseline = () => {
9038
+ if (!active || !resetPending || previousThreadRef.current !== selection) return;
9039
+ agent.setMessages([]);
9040
+ agent.setState({});
9041
+ agent.pendingInterrupts = [];
9042
+ clearCursor();
9043
+ };
9044
+ if (previousThread.agent === agent) previousThread.clearDiscardedBaseline = clearDiscardedBaseline;
9045
+ const detach = detachPromisesRef.current.get(agent) ?? agent.detachActiveRun();
9046
+ detachPromisesRef.current.set(agent, detach);
9047
+ const finishReset = () => {
9048
+ if (!resetPending) return;
9049
+ clearCursor();
9050
+ clearDiscardedBaseline();
9051
+ resetPending = false;
9052
+ };
9053
+ clearDiscardedBaseline();
9054
+ pendingTeardownRef.current = Promise.all([pendingTeardownRef.current, detach]).then(finishReset).catch((error) => {
9055
+ console.error("CopilotChat: detachActiveRun failed", error);
9056
+ }).finally(() => {
9057
+ if (detachPromisesRef.current.get(agent) === detach) detachPromisesRef.current.delete(agent);
9058
+ });
9059
+ }
9060
+ return () => {
9061
+ active = false;
9062
+ };
8968
9063
  }
8969
9064
  let detached = false;
8970
9065
  const connectAbortController = new AbortController();
8971
- if (agent instanceof HttpAgent) agent.abortController = connectAbortController;
8972
9066
  const connect = async (agentToConnect) => {
8973
9067
  activeConnectCountRef.current += 1;
8974
9068
  try {
9069
+ await pendingTeardownRef.current;
9070
+ if (detached) return;
9071
+ if (ɵisHttpAgent(agentToConnect)) agentToConnect.abortController = connectAbortController;
8975
9072
  await copilotkit.connectAgent({ agent: agentToConnect });
8976
9073
  } catch (error) {
8977
9074
  if (detached) return;
@@ -8981,7 +9078,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8981
9078
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
8982
9079
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
8983
9080
  });
8984
- else if (!hasExplicitThreadIdRef.current) agentToConnect.setMessages([]);
9081
+ else if (!hasExplicitThreadIdRef.current) selection.clearDiscardedBaseline?.();
8985
9082
  activeConnectCountRef.current = Math.max(0, activeConnectCountRef.current - 1);
8986
9083
  if (!detached && activeConnectCountRef.current === 0) {
8987
9084
  const startReconnect = startRunActivityReconnectRef.current;
@@ -8996,7 +9093,12 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8996
9093
  return () => {
8997
9094
  detached = true;
8998
9095
  connectAbortController.abort();
8999
- agent.detachActiveRun().catch(() => {});
9096
+ const detach = agent.detachActiveRun().catch(() => {});
9097
+ detachPromisesRef.current.set(agent, detach);
9098
+ pendingTeardownRef.current = Promise.all([pendingTeardownRef.current, detach]).then(() => {});
9099
+ detach.then(() => {
9100
+ if (detachPromisesRef.current.get(agent) === detach) detachPromisesRef.current.delete(agent);
9101
+ });
9000
9102
  };
9001
9103
  }, [
9002
9104
  resolvedThreadId,
@@ -9872,7 +9974,7 @@ function CopilotPopupViewInternal({ header, toggleButton, width, height, clickOu
9872
9974
  const popupAnimationClass = isPopupOpen && !isAnimatingOut ? "cpk:pointer-events-auto cpk:translate-y-0 cpk:opacity-100 cpk:md:scale-100" : "cpk:pointer-events-none cpk:translate-y-4 cpk:opacity-0 cpk:md:translate-y-5 cpk:md:scale-[0.95]";
9873
9975
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [toggleButtonElement, isRendered ? /* @__PURE__ */ jsx("div", {
9874
9976
  "data-copilotkit": true,
9875
- className: cn("cpk:fixed cpk:inset-0 cpk:z-[1200] cpk:flex cpk:max-w-full cpk:flex-col cpk:items-stretch", "cpk:md:inset-auto cpk:md:bottom-24 cpk:md:right-6 cpk:md:items-end cpk:md:gap-4"),
9977
+ className: cn("cpk:fixed cpk:inset-0 cpk:z-[1200] cpk:flex cpk:max-w-full cpk:flex-col cpk:items-stretch cpk:bg-transparent", "cpk:md:inset-auto cpk:md:bottom-24 cpk:md:right-6 cpk:md:items-end cpk:md:gap-4"),
9876
9978
  children: /* @__PURE__ */ jsxs("div", {
9877
9979
  ref: containerRef,
9878
9980
  tabIndex: -1,
@@ -12571,5 +12673,5 @@ function validateProps(props) {
12571
12673
  }
12572
12674
 
12573
12675
  //#endregion
12574
- export { useAgentContext as $, ɵisRetryableMemoryStatus as $i, ResumeEntrySchema as $n, compactEvents as $r, BaseMessageSchema as $t, CopilotChatMessageView as A, parseSSEStream as Ai, MemoryError as An, ThinkingEndEventSchema as Ar, CopilotChatInput_default as At, CopilotChatAssistantMessage_default as B, tokenUsageFromLangChainMetadata as Bi, OutputCapabilitiesSchema as Bn, ToolCallSchema as Br, ActivityMessageSchema as Bt, CopilotModalHeader as C, ɵselectThreadsError$1 as Ca, ofType as Ci, InputContentDataSourceSchema as Cn, SuggestionEngine as Cr, useSandboxFunctions as Ct, CopilotChat as D, onInspectorViewThread$1 as Di, IntelligenceAgent as Dn, TextMessageContentEventSchema as Dr, ɵrunMcpFollowUp as Dt, DefaultOpenIcon as E, onInspectorStopViewing$1 as Ei, InputContentUrlSourceSchema as En, TextMessageChunkEventSchema as Er, MCPAppsActivityType as Et, CopilotChatSuggestionView as F, resolveDebugLogger as Fi, MultiAgentCapabilitiesSchema as Fn, TokenUsageSchema as Fr, AGUIConnectNotImplementedError$1 as Ft, useLearnFromUserActionInCurrentThread as G, ɵInterruptState$1 as Gi, ReasoningEncryptedValueSubtypeSchema as Gn, ToolsCapabilitiesSchema as Gr, AssistantMessageSchema as Gt, useLearningContainersInCurrentThread as H, transformHttpEventStream as Hi, RawEventSchema as Hn, ToolCallStatus$1 as Hr, AgentCapabilitiesSchema as Ht, CopilotChatSuggestionPill as I, runHttpRequest as Ii, MultimodalCapabilitiesSchema as In, ToolCallArgsEventSchema as Ir, AGUIError as It, useThreads$1 as J, ɵTHREAD_REQUEST_TIMEOUT_MS as Ji, ReasoningMessageContentEventSchema as Jn, VideoInputContentSchema as Jr, BackwardCompatibility_0_0_39 as Jt, useLearnFromUserAction as K, ɵMAX_SOCKET_RETRIES as Ki, ReasoningEndEventSchema as Kn, TransportCapabilitiesSchema as Kr, AudioInputContentSchema as Kt, CopilotChatReasoningMessage_default as L, select as Li, MultimodalInputCapabilitiesSchema as Ln, ToolCallChunkEventSchema as Lr, AGUI_METADATA_KEY as Lt, IntelligenceIndicator as M, props as Mi, MessagesSnapshotEventSchema as Mn, ThinkingTextMessageContentEventSchema as Mr, CopilotChatAudioRecorder as Mt, getIntelligenceTurnAnchors as N, randomUUID$2 as Ni, MetadataSchema as Nn, ThinkingTextMessageEndEventSchema as Nr, CopilotChatConfigurationProvider as Nt, CopilotChatView_default as O, onInspectorViewThreadResult as Oi, InterruptSchema as On, TextMessageEndEventSchema as Or, CopilotKitInspector as Ot, IntelligenceIndicatorView as P, resolveAgentDebugConfig as Pi, Middleware as Pn, ThinkingTextMessageStartEventSchema as Pr, useCopilotChatConfiguration as Pt, useSuggestions as Q, ɵisCopilotKitFeature as Qi, ReasoningStartEventSchema as Qn, buildResumeArray as Qr, BaseEventSchema as Qt, CopilotChatUserMessage_default as R, structuredClone_ as Ri, MultimodalOutputCapabilitiesSchema as Rn, ToolCallEndEventSchema as Rr, AbstractAgent$1 as Rt, CopilotSidebarView as S, ɵselectThreads$1 as Sa, mergeMetadata as Si, ImageInputPartSchema as Sn, SubagentStartedEventSchema as Sr, SandboxFunctionsContext as St, DefaultCloseIcon as T, ɵthreadAdapterEvents as Ta, onInspectorActiveThread as Ti, InputContentSourceSchema as Tn, TextInputContentSchema as Tr, MCPAppsActivityRenderer as Tt, useLearningContainers as U, verifyEvents as Ui, ReasoningCapabilitiesSchema as Un, ToolMessageSchema as Ur, AgentRegistry as Ut, CopilotChatToolCallsView as V, transformChunks as Vi, ProxiedCopilotRuntimeAgent$1 as Vn, ToolCallStartEventSchema as Vr, ActivitySnapshotEventSchema as Vt, useAttachments as W, ɵCOPILOTKIT_FEATURES as Wi, ReasoningEncryptedValueEventSchema as Wn, ToolSchema as Wr, AgentThreadLockedError as Wt, INTERRUPT_EVENT_NAME as X, ɵcreateThreadSelectors as Xi, ReasoningMessageSchema as Xn, WebMCPRegistry as Xr, BackwardCompatibility_0_0_47 as Xt, useInterrupt as Y, ɵcreateMemoryStore as Yi, ReasoningMessageEndEventSchema as Yn, VideoInputPartSchema as Yr, BackwardCompatibility_0_0_45 as Yt, useConfigureSuggestions as Z, ɵcreateThreadStore$1 as Zi, ReasoningMessageStartEventSchema as Zn, aggregateTokenUsage as Zr, BackwardCompatibility_0_0_57 as Zt, WildcardToolCallRender as _, ɵselectMemoriesAvailable$1 as _a, getWebMCPModelContext as _i, HttpAgent$1 as _n, SubagentErrorEventSchema as _r, GenerateSandboxedUiArgsSchema as _t, ThreadsProvider as a, ɵmemoryRestEvents as aa, createInspectorThreadRequestId as ai, CopilotKitCoreRuntimeConnectionStatus$1 as an, RunFinishedOutcomeSchema as ar, useRenderTool as at, CopilotSidebar as b, ɵselectMemoriesIsMutating as ba, isInterruptExpired as bi, IdentityCapabilitiesSchema as bn, SubagentFinishedSuccessOutcomeSchema as br, OpenGenerativeUIContentSchema as bt, CoAgentStateRendersProvider as c, ɵobservePhoenixSocketHealth$ as ca, createStore as ci, DeveloperMessageSchema as cn, RunStartedEventSchema as cr, useFrontendTool as ct, shouldShowDevConsole as d, ɵphoenixSocket$ as da, emitInspectorStopViewing as di, EventSchemas as dn, StateManager as dr, CopilotKitProvider as dt, ɵjoinPhoenixChannel$ as ea, completePartialMarkdown as ei, BinaryInputContentSchema as en, RoleSchema as er, useCapabilities as et, useToast as f, ɵselectFetchMoreError$1 as fa, emitInspectorViewThread as fi, EventType as fn, StateSchema as fr, useCopilotKit$1 as ft, useCopilotContext as g, ɵselectMemories$1 as ga, getRunOutcome as gi, FunctionMiddleware as gn, SubAgentInfoSchema as gr, createA2UIMessageRenderer as gt, CopilotContext as h, ɵselectIsMutating$1 as ha, ensureObjectArgs as hi, FunctionCallSchema as hn, StepStartedEventSchema as hr, defineToolCallRenderer as ht, ThreadsContext as i, ɵmemoryReducer as ia, createEffect as ii, CopilotKitCoreErrorCode$1 as in, RunFinishedInterruptOutcomeSchema as ir, useDefaultRenderTool as it, INTELLIGENCE_TURN_HEAD as j, parseToolArguments as ji, MessageSchema as jn, ThinkingStartEventSchema as jr, AudioRecorderError as jt, CopilotChatAttachmentQueue as k, parseProtoStream as ki, MEMORY_ERROR_REGISTRY as kn, TextMessageStartEventSchema as kr, useRenderToolCall as kt, useCoAgentStateRenders as l, ɵobservePhoenixSocketSignals$ as la, defaultApplyEvents as li, DocumentInputContentSchema as ln, StateCapabilitiesSchema as lr, useRenderActivityMessage as lt, useCopilotMessagesContext as m, ɵselectIsFetchingNextPage$1 as ma, empty as mi, FilterToolCallsMiddleware as mn, StepFinishedEventSchema as mr, CopilotKitCoreReact as mt, defaultCopilotContextCategories as n, ɵmemoryAdapterEvents as na, createActionGroup as ni, ContextStore as nn, RunErrorEventSchema as nr, useAgent as nt, useThreads as o, ɵobservePhoenixEvent$ as oa, createReducer as oi, CustomEventSchema as on, RunFinishedSuccessOutcomeSchema as or, useComponent as ot, CopilotMessagesContext as p, ɵselectHasNextPage$1 as pa, emitInspectorViewThreadResult$1 as pi, ExecutionCapabilitiesSchema as pn, StateSnapshotEventSchema as pr, useLicenseContext$1 as pt, useMemories as q, ɵRUNTIME_PROBE_TIMEOUT_MS as qi, ReasoningMessageChunkEventSchema as qn, UserMessageSchema as qr, AudioInputPartSchema as qt, CoAgentStateRenderBridge as r, ɵmemoryDomainEvents as ra, createDebugLogger as ri, CopilotKitCore$1 as rn, RunFinishedEventSchema as rr, useHumanInTheLoop as rt, CoAgentStateRendersContext as s, ɵobservePhoenixJoinOutcome$ as sa, createSelector as si, DebugLogger as sn, RunHandler as sr, useFrontendTools as st, CopilotKit as t, ɵmapMemoryMetadataEvent as ta, convertToLegacyEvents as ti, ContextSchema as tn, RunAgentInputSchema as tr, UseAgentUpdate as tt, useAsyncCallback as u, ɵphoenixChannel$ as ua, emitInspectorActiveThread$1 as ui, DocumentInputPartSchema as un, StateDeltaEventSchema as ur, useRenderCustomMessages as ut, CopilotThreadsDrawer as v, ɵselectMemoriesError$1 as va, isAbortError as vi, HumanInTheLoopCapabilitiesSchema as vn, SubagentFinishedEventSchema as vr, OpenGenerativeUIActivityRenderer as vt, CopilotChatToggleButton as w, ɵselectThreadsIsLoading$1 as wa, on as wi, InputContentSchema as wn, SystemMessageSchema as wr, MCPAppsActivityContentSchema as wt, CopilotPopupView as x, ɵselectMemoriesRealtimeStatus$1 as xa, isRunCompletionAware$1 as xi, ImageInputContentSchema as xn, SubagentFinishedSuspendedOutcomeSchema as xr, OpenGenerativeUIToolRenderer as xt, CopilotPopup as y, ɵselectMemoriesIsLoading$1 as ya, isInspectorThreadBridgeEnabled$1 as yi, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as yn, SubagentFinishedOutcomeSchema as yr, OpenGenerativeUIActivityType as yt, CopilotChatAttachmentRenderer as z, tokenUsageFromAiSdkUsage as zi, OptionalMetadataSchema as zn, ToolCallResultEventSchema as zr, ActivityDeltaEventSchema as zt };
12575
- //# sourceMappingURL=copilotkit-D9iy3p2l.mjs.map
12676
+ export { useAgentContext as $, ɵselectThreadsError$1 as $a, onInspectorActiveThread as $i, MultimodalOutputCapabilitiesSchema as $n, TextPartSchema as $r, BackwardCompatibility_0_0_45 as $t, CopilotChatMessageView as A, ɵjoinPhoenixChannel$ as Aa, createReducer as Ai, IdentityCapabilitiesSchema as An, StateDeltaEventSchema as Ar, CopilotChatInput_default as At, CopilotChatAssistantMessage_default as B, ɵphoenixChannel$ as Ba, enforceOutgoingInput as Bi, JsonPatchOperationSchema as Bn, SubagentFinishedSuspendedOutcomeSchema as Br, ActivityDeltaEventSchema as Bt, CopilotModalHeader as C, ɵTHREAD_REQUEST_TIMEOUT_MS as Ca, contentHasMedia as Ci, FileSourceSchema as Cn, RunFinishedEventSchema as Cr, useSandboxFunctions as Ct, CopilotChat as D, ɵisCopilotKitFeature as Da, createDebugLogger as Di, HttpAgent as Dn, RunHandler as Dr, ɵrunMcpFollowUp as Dt, DefaultOpenIcon as E, ɵcreateThreadStore$1 as Ea, createActionGroup as Ei, FunctionMiddleware as En, RunFinishedSuccessOutcomeSchema as Er, MCPAppsActivityType as Et, CopilotChatSuggestionView as F, ɵmemoryRestEvents as Fa, emitInspectorStopViewing as Fi, InputContentSchema as Fn, StepStartedEventSchema as Fr, ACTIVITY_HISTORY_METADATA as Ft, useLearnFromUserActionInCurrentThread as G, ɵselectIsMutating$1 as Ga, isInspectorThreadBridgeEnabled$1 as Gi, MessageSchema as Gn, SystemMessageSchema as Gr, AgentRegistry as Gt, useLearningContainersInCurrentThread as H, ɵselectFetchMoreError$1 as Ha, getRunOutcome as Hi, JsonPointerSchema as Hn, SubagentRunIdSchema as Hr, ActivitySnapshotEventSchema as Ht, CopilotChatSuggestionPill as I, ɵobservePhoenixEvent$ as Ia, emitInspectorViewThread as Ii, InputContentSourceSchema as In, SubagentErrorEventSchema as Ir, AGUIConnectNotImplementedError$1 as It, useThreads$1 as J, ɵselectMemoriesError$1 as Ja, isRunCompletionAware$1 as Ji, Middleware as Jn, TextMessageChunkEventSchema as Jr, AttributableSchema as Jt, useLearnFromUserAction as K, ɵselectMemories$1 as Ka, isInterruptExpired as Ki, MessagesSnapshotEventSchema as Kn, TestOperationSchema as Kr, AgentThreadLockedError as Kt, CopilotChatReasoningMessage_default as L, ɵobservePhoenixJoinOutcome$ as La, emitInspectorViewThreadResult$1 as Li, InputContentUrlSourceSchema as Ln, SubagentFinishedEventSchema as Lr, AGUIError as Lt, IntelligenceIndicator as M, ɵmemoryAdapterEvents as Ma, createStore as Mi, ImageInputPartSchema as Mn, StateSchema as Mr, CopilotChatAudioRecorder as Mt, getIntelligenceTurnAnchors as N, ɵmemoryDomainEvents as Na, defaultApplyEvents as Ni, ImagePartSchema as Nn, StateSnapshotEventSchema as Nr, CopilotChatConfigurationProvider as Nt, CopilotChatView_default as O, ɵisHttpAgent$1 as Oa, createEffect as Oi, HumanInTheLoopCapabilitiesSchema as On, RunStartedEventSchema as Or, CopilotKitInspector as Ot, IntelligenceIndicatorView as P, ɵmemoryReducer as Pa, emitInspectorActiveThread$1 as Pi, InputContentDataSourceSchema as Pn, StepFinishedEventSchema as Pr, useCopilotChatConfiguration as Pt, useSuggestions as Q, ɵselectThreads$1 as Qa, on as Qi, MultimodalInputCapabilitiesSchema as Qn, TextMessageStartEventSchema as Qr, BackwardCompatibility_0_0_39 as Qt, CopilotChatUserMessage_default as R, ɵobservePhoenixSocketHealth$ as Ra, empty as Ri, IntelligenceAgent as Rn, SubagentFinishedOutcomeSchema as Rr, AGUI_METADATA_KEY as Rt, CopilotSidebarView as S, ɵRUNTIME_PROBE_TIMEOUT_MS as Sa, completePartialMarkdown as Si, ExecutionCapabilitiesSchema as Sn, RunFinishedCancelledOutcomeSchema as Sr, SandboxFunctionsContext as St, DefaultCloseIcon as T, ɵcreateThreadSelectors as Ta, convertToLegacyEvents as Ti, FunctionCallSchema as Tn, RunFinishedOutcomeSchema as Tr, MCPAppsActivityRenderer as Tt, useLearningContainers as U, ɵselectHasNextPage$1 as Ua, getWebMCPModelContext as Ui, MEMORY_ERROR_REGISTRY as Un, SubagentStartedEventSchema as Ur, AddOperationSchema as Ut, CopilotChatToolCallsView as V, ɵphoenixSocket$ as Va, ensureObjectArgs as Vi, JsonPatchSchema as Vn, SubagentInfoSchema as Vr, ActivityMessageSchema as Vt, useAttachments as W, ɵselectIsFetchingNextPage$1 as Wa, isAbortError as Wi, MemoryError as Wn, SuggestionEngine as Wr, AgentCapabilitiesSchema as Wt, INTERRUPT_EVENT_NAME as X, ɵselectMemoriesIsMutating as Xa, ofType as Xi, MultiAgentCapabilitiesSchema as Xn, TextMessageEndEventSchema as Xr, AudioInputPartSchema as Xt, useInterrupt as Y, ɵselectMemoriesIsLoading$1 as Ya, mergeMetadata as Yi, MoveOperationSchema as Yn, TextMessageContentEventSchema as Yr, AudioInputContentSchema as Yt, useConfigureSuggestions as Z, ɵselectMemoriesRealtimeStatus$1 as Za, omitOptionalNulls as Zi, MultimodalCapabilitiesSchema as Zn, TextMessageRoleSchema as Zr, AudioPartSchema as Zt, WildcardToolCallRender as _, verifyEvents as _a, WebMCPRegistry as _i, DocumentPartSchema as _n, ReplaceOperationSchema as _r, GenerateSandboxedUiArgsSchema as _t, ThreadsProvider as a, parseToolArguments as aa, ToolCallSchema as ai, ContextSchema as an, RawEventSchema as ar, useRenderTool as at, CopilotSidebar as b, ɵInterruptState$1 as ba, buildResumeArray as bi, EventType as bn, RunAgentInputSchema as br, OpenGenerativeUIContentSchema as bt, CoAgentStateRendersProvider as c, resolveAgentDebugConfig as ca, ToolMessageSchema as ci, CopilotKitCoreErrorCode$1 as cn, ReasoningEncryptedValueSubtypeSchema as cr, useFrontendTool as ct, shouldShowDevConsole as d, select as da, TransportCapabilitiesSchema as di, CustomEventSchema as dn, ReasoningMessageContentEventSchema as dr, CopilotKitProvider as dt, onInspectorStopViewing$1 as ea, TokenUsageSchema as ei, BackwardCompatibility_0_0_57 as en, ɵselectThreadsIsLoading$1 as eo, OptionalMetadataSchema as er, useCapabilities as et, useToast as f, structuredClone_ as fa, UrlSourceSchema as fi, DataSourceSchema as fn, ReasoningMessageEndEventSchema as fr, useCopilotKit$1 as ft, useCopilotContext as g, transformHttpEventStream as ga, VideoPartSchema as gi, DocumentInputPartSchema as gn, RemoveOperationSchema as gr, createA2UIMessageRenderer as gt, CopilotContext as h, transformChunks as ha, VideoInputPartSchema as hi, DocumentInputContentSchema as hn, ReasoningStartEventSchema as hr, defineToolCallRenderer as ht, ThreadsContext as i, parseSSEStream as ia, ToolCallResultEventSchema as ii, ContentPartSchema as in, ProxiedCopilotRuntimeAgent$1 as ir, useDefaultRenderTool as it, INTELLIGENCE_TURN_HEAD as j, ɵmapMemoryMetadataEvent as ja, createSelector as ji, ImageInputContentSchema as jn, StateManager as jr, AudioRecorderError as jt, CopilotChatAttachmentQueue as k, ɵisRetryableMemoryStatus as ka, createInspectorThreadRequestId as ki, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as kn, StateCapabilitiesSchema as kr, useRenderToolCall as kt, useCoAgentStateRenders as l, resolveDebugLogger as la, ToolSchema as li, CopilotKitCoreRuntimeConnectionStatus$1 as ln, ReasoningEndEventSchema as lr, useRenderActivityMessage as lt, useCopilotMessagesContext as m, tokenUsageFromLangChainMetadata as ma, VideoInputContentSchema as mi, DeveloperMessageSchema as mn, ReasoningMessageStartEventSchema as mr, CopilotKitCoreReact as mt, defaultCopilotContextCategories as n, onInspectorViewThreadResult as na, ToolCallChunkEventSchema as ni, BaseMessageSchema as nn, PROTOCOL_VERSION as nr, useAgent as nt, useThreads as o, props as oa, ToolCallStartEventSchema as oi, ContextStore as on, ReasoningCapabilitiesSchema as or, useComponent as ot, CopilotMessagesContext as p, tokenUsageFromAiSdkUsage as pa, UserMessageSchema as pi, DebugLogger as pn, ReasoningMessageSchema as pr, useLicenseContext$1 as pt, useMemories as q, ɵselectMemoriesAvailable$1 as qa, isRecognizedEvent as qi, MetadataSchema as qn, TextInputContentSchema as qr, AssistantMessageSchema as qt, CoAgentStateRenderBridge as r, parseProtoStream as ra, ToolCallEndEventSchema as ri, CompatibilityBoundary as rn, PartSourceSchema as rr, useHumanInTheLoop as rt, CoAgentStateRendersContext as s, randomUUID$2 as sa, ToolCallStatus$1 as si, CopilotKitCore$1 as sn, ReasoningEncryptedValueEventSchema as sr, useFrontendTools as st, CopilotKit as t, onInspectorViewThread$1 as ta, ToolCallArgsEventSchema as ti, BaseEventSchema as tn, ɵthreadAdapterEvents as to, OutputCapabilitiesSchema as tr, UseAgentUpdate as tt, useAsyncCallback as u, runHttpRequest as ua, ToolsCapabilitiesSchema as ui, CopyOperationSchema as un, ReasoningMessageChunkEventSchema as ur, useRenderCustomMessages as ut, CopilotThreadsDrawer as v, withAuthoritativeActivityTypes as va, aggregateTokenUsage as vi, EventSchema as vn, ResumeEntrySchema as vr, OpenGenerativeUIActivityRenderer as vt, CopilotChatToggleButton as w, ɵcreateMemoryStore as wa, contentToText$1 as wi, FilterToolCallsMiddleware as wn, RunFinishedInterruptOutcomeSchema as wr, MCPAppsActivityContentSchema as wt, CopilotPopupView as x, ɵMAX_SOCKET_RETRIES as xa, compactEvents as xi, EventTypeSchema as xn, RunErrorEventSchema as xr, OpenGenerativeUIToolRenderer as xt, CopilotPopup as y, ɵCOPILOTKIT_FEATURES as ya, authoritativeActivityTypes as yi, EventSchemas as yn, RoleSchema as yr, OpenGenerativeUIActivityType as yt, CopilotChatAttachmentRenderer as z, ɵobservePhoenixSocketSignals$ as za, enforceEvents as zi, InterruptSchema as zn, SubagentFinishedSuccessOutcomeSchema as zr, AbstractAgent$1 as zt };
12677
+ //# sourceMappingURL=copilotkit-CP9qPAqV.mjs.map