@copilotkit/react-core 1.76.0 → 1.77.1

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 (42) hide show
  1. package/dist/{copilotkit-dHdNF7H5.cjs → copilotkit-BG1d4-qU.cjs} +326 -113
  2. package/dist/copilotkit-BG1d4-qU.cjs.map +1 -0
  3. package/dist/{copilotkit-W-bV_OSs.d.cts → copilotkit-BGHjMw0d.d.cts} +89 -3
  4. package/dist/copilotkit-BGHjMw0d.d.cts.map +1 -0
  5. package/dist/{copilotkit-B90cY0Zg.d.mts → copilotkit-BdH_CdBt.d.mts} +84 -3
  6. package/dist/copilotkit-BdH_CdBt.d.mts.map +1 -0
  7. package/dist/{copilotkit-LD7Gp2aV.mjs → copilotkit-C_Sy6Cc7.mjs} +315 -114
  8. package/dist/copilotkit-C_Sy6Cc7.mjs.map +1 -0
  9. package/dist/index.cjs +18 -8
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +8 -3
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +8 -3
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +18 -8
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +88 -25
  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 +19 -0
  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.map +1 -1
  30. package/dist/v2/headless.mjs +20 -1
  31. package/dist/v2/headless.mjs.map +1 -1
  32. package/dist/v2/index.cjs +3 -1
  33. package/dist/v2/index.d.cts +2 -2
  34. package/dist/v2/index.d.mts +2 -2
  35. package/dist/v2/index.mjs +2 -2
  36. package/dist/v2/index.umd.js +315 -112
  37. package/dist/v2/index.umd.js.map +1 -1
  38. package/package.json +22 -11
  39. package/dist/copilotkit-B90cY0Zg.d.mts.map +0 -1
  40. package/dist/copilotkit-LD7Gp2aV.mjs.map +0 -1
  41. package/dist/copilotkit-W-bV_OSs.d.cts.map +0 -1
  42. package/dist/copilotkit-dHdNF7H5.cjs.map +0 -1
@@ -5,7 +5,7 @@ import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError as AGUIConnec
5
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";
6
6
  import { extendTailwindMerge, twMerge } from "tailwind-merge";
7
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";
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";
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, GENERATE_SANDBOXED_UI_DESCRIPTION, 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";
9
9
  import { CopilotKitAgentIdContext, CopilotKitContext, LicenseContext, useCopilotKit, useCopilotKit as useCopilotKit$1, useDefaultAgentId, useLicenseContext, useLicenseContext as useLicenseContext$1 } from "@copilotkit/react-core/v2/context";
10
10
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
11
  import { Slot } from "@radix-ui/react-slot";
@@ -142,6 +142,25 @@ const CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId,
142
142
  parentConfig?.threadId,
143
143
  activeThreadOverride
144
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]);
145
164
  const resolvedHasExplicitThreadId = (threadIdPropIsAuthoritative ? true : activeThreadOverride?.explicit ?? hasExplicitThreadId ?? false) || !!parentConfig?.hasExplicitThreadId;
146
165
  const [internalModalOpen, setInternalModalOpen] = useState(isModalDefaultOpen ?? true);
147
166
  const hasExplicitDefault = isModalDefaultOpen !== void 0;
@@ -1607,7 +1626,7 @@ function useRenderToolCall() {
1607
1626
 
1608
1627
  //#endregion
1609
1628
  //#region package.json
1610
- var version = "1.76.0";
1629
+ var version = "1.77.1";
1611
1630
 
1612
1631
  //#endregion
1613
1632
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -1843,12 +1862,14 @@ function InlineFeatureWarning({ featureName }) {
1843
1862
  * Fetches resource content on-demand via proxied MCP requests. The React shell
1844
1863
  * owns the iframe; `bindMcpApp` owns the protocol.
1845
1864
  */
1846
- const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agent }) {
1865
+ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, message, agent }) {
1847
1866
  const { copilotkit } = useCopilotKit$1();
1867
+ const messageId = message?.id;
1848
1868
  const containerRef = useRef(null);
1849
1869
  const iframeRef = useRef(null);
1850
1870
  const sessionRef = useRef(null);
1851
1871
  const [error, setError] = useState(null);
1872
+ const [contentError, setContentError] = useState(null);
1852
1873
  const [isLoading, setIsLoading] = useState(true);
1853
1874
  const [iframeSize, setIframeSize] = useState({});
1854
1875
  const [fetchedResource, setFetchedResource] = useState(null);
@@ -1867,6 +1888,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1867
1888
  let mounted = true;
1868
1889
  setIsLoading(true);
1869
1890
  setError(null);
1891
+ setContentError(null);
1870
1892
  const iframe = document.createElement("iframe");
1871
1893
  iframe.style.width = "100%";
1872
1894
  iframe.style.height = "100px";
@@ -1889,6 +1911,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1889
1911
  getContent: () => contentRef.current,
1890
1912
  getAgent: () => agentRef.current,
1891
1913
  host: copilotkit,
1914
+ messageId,
1892
1915
  hooks: {
1893
1916
  onResource: (resource) => {
1894
1917
  if (!mounted) return;
@@ -1898,6 +1921,9 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1898
1921
  onSizeChanged: (size) => {
1899
1922
  if (mounted) setIframeSize(size);
1900
1923
  },
1924
+ onContentError: (err) => {
1925
+ if (mounted) setContentError(err);
1926
+ },
1901
1927
  onError: (err) => {
1902
1928
  if (!mounted) return;
1903
1929
  setError(err);
@@ -1906,9 +1932,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1906
1932
  }
1907
1933
  });
1908
1934
  sessionRef.current = session;
1909
- const current = contentRef.current;
1910
- if (current.toolInput) session.sendToolInput(current.toolInput);
1911
- if (current.result) session.sendToolResult(current.result);
1935
+ session.syncContent(contentRef.current);
1912
1936
  } catch (err) {
1913
1937
  console.error("[MCPAppsRenderer] Setup error:", err);
1914
1938
  if (mounted) {
@@ -1928,6 +1952,7 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1928
1952
  }, [
1929
1953
  agent,
1930
1954
  copilotkit,
1955
+ messageId,
1931
1956
  content.resourceUri,
1932
1957
  content.serverHash,
1933
1958
  content.serverId
@@ -1942,11 +1967,8 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1942
1967
  }
1943
1968
  }, [iframeSize]);
1944
1969
  useEffect(() => {
1945
- if (content.toolInput) sessionRef.current?.sendToolInput(content.toolInput);
1946
- }, [content.toolInput]);
1947
- useEffect(() => {
1948
- if (content.result) sessionRef.current?.sendToolResult(content.result);
1949
- }, [content.result]);
1970
+ sessionRef.current?.syncContent(contentRef.current);
1971
+ }, [content.toolInput, content.result]);
1950
1972
  const borderStyle = fetchedResource?._meta?.ui?.prefersBorder === true ? {
1951
1973
  borderRadius: "8px",
1952
1974
  backgroundColor: "#f9f9f9",
@@ -1968,12 +1990,12 @@ const MCPAppsActivityRenderer = function MCPAppsActivityRenderer({ content, agen
1968
1990
  color: "#666"
1969
1991
  },
1970
1992
  children: "Loading..."
1971
- }), error && /* @__PURE__ */ jsxs("div", {
1993
+ }), (error ?? contentError) && /* @__PURE__ */ jsxs("div", {
1972
1994
  style: {
1973
1995
  color: "red",
1974
1996
  padding: "1rem"
1975
1997
  },
1976
- children: ["Error: ", error.message]
1998
+ children: ["Error: ", (error ?? contentError).message]
1977
1999
  })]
1978
2000
  });
1979
2001
  };
@@ -3361,7 +3383,6 @@ const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follo
3361
3383
  - Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.
3362
3384
  - Minimal transitions (150ms) for hover/focus states only. No decorative animations.
3363
3385
  - Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;
3364
- const GENERATE_SANDBOXED_UI_DESCRIPTION = "Generate sandboxed UI. IMPORTANT: The generated code runs in a sandboxed iframe WITHOUT same-origin access. Do NOT use localStorage, sessionStorage, document.cookie, IndexedDB, or fetch/XMLHttpRequest to same-origin URLs. To communicate with the host application, use Websandbox.connection.remote.<functionName>(args) which returns a Promise.\n\nYou CAN use external libraries from CDNs by including <script> or <link> tags in the HTML <head> (e.g., Chart.js, D3, Three.js, x-data-spreadsheet, etc.). CDN resources load normally inside the sandbox.\n\nPARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:\n1. initialHeight + placeholderMessages (shown to user while generating)\n2. css (all styles FIRST — the user sees a placeholder until CSS is complete)\n3. html (streams in live — the user watches the UI build as HTML is generated)\n4. jsFunctions (reusable helper functions)\n5. jsExpressions (applied one-by-one — the user sees each expression take effect)";
3365
3386
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3366
3387
  const empty = useMemo(() => [], []);
3367
3388
  const value = prop ?? empty;
@@ -3371,7 +3392,7 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3371
3392
  }, [value, warningMessage]);
3372
3393
  return value;
3373
3394
  }
3374
- 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 }) => {
3395
+ 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 }) => {
3375
3396
  const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
3376
3397
  const [inspectorVisible, setInspectorVisible] = useState(false);
3377
3398
  useEffect(() => {
@@ -3606,7 +3627,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3606
3627
  renderToolCalls: allRenderToolCalls,
3607
3628
  renderActivityMessages: allActivityRenderers,
3608
3629
  renderCustomMessages: renderCustomMessagesList,
3609
- debug
3630
+ debug,
3631
+ learning
3610
3632
  });
3611
3633
  if (defaultThrottleMs !== void 0) copilotkitRef.current.setDefaultThrottleMs(defaultThrottleMs);
3612
3634
  }
@@ -3711,6 +3733,32 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3711
3733
  useSingleEndpoint,
3712
3734
  debug
3713
3735
  ]);
3736
+ const learningEnabled = learning !== void 0;
3737
+ const trajectoryId = learning?.trajectoryId;
3738
+ const learningContainerIdsRef = useRef(learning?.learningContainerIds);
3739
+ useEffect(() => {
3740
+ copilotkit.setLearningConfig(learning);
3741
+ learningContainerIdsRef.current = learning?.learningContainerIds;
3742
+ 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.");
3743
+ }, [copilotkit, learning]);
3744
+ useEffect(() => {
3745
+ if (!learningEnabled) return;
3746
+ let disposed = false;
3747
+ if (trajectoryId !== void 0) copilotkit.startTrajectory({
3748
+ trajectoryId,
3749
+ learningContainerIds: learningContainerIdsRef.current
3750
+ }).catch(() => {
3751
+ if (!disposed) console.warn("[CopilotKit] Failed to start interaction capture.");
3752
+ });
3753
+ return () => {
3754
+ disposed = true;
3755
+ copilotkit.stopTrajectory();
3756
+ };
3757
+ }, [
3758
+ copilotkit,
3759
+ learningEnabled,
3760
+ trajectoryId
3761
+ ]);
3714
3762
  const didMountRef = useRef(false);
3715
3763
  useEffect(() => {
3716
3764
  if (!didMountRef.current) return;
@@ -3773,8 +3821,13 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3773
3821
  ]);
3774
3822
  const contextValue = useMemo(() => ({
3775
3823
  copilotkit,
3776
- executingToolCallIds
3777
- }), [copilotkit, executingToolCallIds]);
3824
+ executingToolCallIds,
3825
+ showIntelligenceIndicator
3826
+ }), [
3827
+ copilotkit,
3828
+ executingToolCallIds,
3829
+ showIntelligenceIndicator
3830
+ ]);
3778
3831
  const retryableRuntimeEntitlementFailure = runtimeEntitlements?.status !== "ready" && runtimeEntitlements?.error.retryable === true;
3779
3832
  const hasNonReadyRuntimeEntitlement = runtimeEntitlements !== void 0 && runtimeEntitlements.status !== "ready";
3780
3833
  const hasLegacyRuntimeEntitlementFallback = runtimeLicenseStatus === "valid" || runtimeLicenseStatus === "expiring";
@@ -6008,13 +6061,23 @@ function useLearningContainersInCurrentThread({ learningContainers }) {
6008
6061
  //#region src/v2/components/chat/CopilotChatToolCallsView.tsx
6009
6062
  function CopilotChatToolCallsView({ message, messages = [] }) {
6010
6063
  const renderToolCall = useRenderToolCall();
6064
+ const { copilotkit } = useCopilotKit();
6065
+ const subscribe = useCallback((onChange) => copilotkit.ɵsubscribeToLearningConfigured(onChange), [copilotkit]);
6066
+ const getSnapshot = () => copilotkit.ɵlearningConfigured;
6067
+ const learningConfigured = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
6011
6068
  if (!message.toolCalls || message.toolCalls.length === 0) return null;
6012
6069
  return /* @__PURE__ */ jsx(Fragment$1, { children: message.toolCalls.map((toolCall) => {
6013
- const toolMessage = messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id);
6014
- return /* @__PURE__ */ jsx(React.Fragment, { children: renderToolCall({
6070
+ const rendered = renderToolCall({
6015
6071
  toolCall,
6016
- toolMessage
6017
- }) }, toolCall.id);
6072
+ toolMessage: messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id)
6073
+ });
6074
+ if (rendered === null) return null;
6075
+ if (!learningConfigured) return rendered;
6076
+ return /* @__PURE__ */ jsx("div", {
6077
+ "data-tool-call-id": toolCall.id,
6078
+ style: { display: "contents" },
6079
+ children: rendered
6080
+ }, toolCall.id);
6018
6081
  }) });
6019
6082
  }
6020
6083
 
@@ -6358,6 +6421,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
6358
6421
  const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
6359
6422
  if (children) return /* @__PURE__ */ jsx("div", {
6360
6423
  "data-copilotkit": true,
6424
+ "data-message-id": message.id,
6361
6425
  style: { display: "contents" },
6362
6426
  children: children({
6363
6427
  markdownRenderer: boundMarkdownRenderer,
@@ -7590,12 +7654,27 @@ function deduplicateMessages(messages) {
7590
7654
  }
7591
7655
  return [...acc.values()];
7592
7656
  }
7657
+ /** A row holding a single message, rendered as it would be ungrouped. */
7658
+ function messageRow(message) {
7659
+ return {
7660
+ type: "message",
7661
+ message
7662
+ };
7663
+ }
7664
+ /** A row holding a group of messages, rendered inside `wrapper`. */
7665
+ function messageGroup(group) {
7666
+ return {
7667
+ type: "group",
7668
+ ...group
7669
+ };
7670
+ }
7671
+ const GROUP_ROW_KEY_PREFIX = "copilotkit-group:";
7593
7672
  const VIRTUALIZE_THRESHOLD = 50;
7594
- function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, isRunning = false, transformMessages, children, className, ...props }) {
7673
+ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, isRunning = false, transformMessages, groupMessages, children, className, ...props }) {
7595
7674
  const isPinnedToBottom = useContext(ScrollPinnedContext);
7596
7675
  const renderCustomMessage = useRenderCustomMessages();
7597
7676
  const { renderActivityMessage } = useRenderActivityMessage();
7598
- const { copilotkit } = useCopilotKit$1();
7677
+ const { copilotkit, showIntelligenceIndicator = true } = useCopilotKit$1();
7599
7678
  const config = useCopilotChatConfiguration();
7600
7679
  const [, forceUpdate] = useReducer((x) => x + 1, 0);
7601
7680
  useEffect(() => {
@@ -7624,20 +7703,43 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7624
7703
  return copilotkit.getStateByRun(config.agentId, config.threadId, resolvedRunId);
7625
7704
  };
7626
7705
  const deduplicatedMessages = useMemo(() => deduplicateMessages(messages), [messages]);
7627
- const renderedMessages = useMemo(() => transformMessages ? transformMessages(deduplicatedMessages) : deduplicatedMessages, [deduplicatedMessages, transformMessages]);
7706
+ const transformedMessages = useMemo(() => transformMessages ? transformMessages(deduplicatedMessages) : deduplicatedMessages, [deduplicatedMessages, transformMessages]);
7707
+ const rows = useMemo(() => groupMessages ? groupMessages(transformedMessages) : transformedMessages.map(messageRow), [transformedMessages, groupMessages]);
7708
+ const renderedMessages = useMemo(() => groupMessages ? rows.flatMap((row) => row.type === "group" ? row.messages : [row.message]) : transformedMessages, [
7709
+ rows,
7710
+ groupMessages,
7711
+ transformedMessages
7712
+ ]);
7628
7713
  const latestRenderedId = renderedMessages[renderedMessages.length - 1]?.id;
7629
7714
  const transformDuplicateId = useMemo(() => {
7630
- if (process.env.NODE_ENV === "production" || !transformMessages) return;
7715
+ if (process.env.NODE_ENV === "production" || !transformMessages && !groupMessages) return;
7631
7716
  const seen = /* @__PURE__ */ new Set();
7632
7717
  for (const message of renderedMessages) {
7633
7718
  if (seen.has(message.id)) return message.id;
7634
7719
  seen.add(message.id);
7635
7720
  }
7636
- }, [renderedMessages, transformMessages]);
7721
+ }, [
7722
+ renderedMessages,
7723
+ transformMessages,
7724
+ groupMessages
7725
+ ]);
7637
7726
  useEffect(() => {
7638
7727
  if (transformDuplicateId === void 0) return;
7639
- console.warn(`[CopilotKit] CopilotChatMessageView: \`transformMessages\` returned more than one message with id "${transformDuplicateId}". Return each id at most once; a message you create needs its own id, stable across renders.`);
7640
- }, [transformDuplicateId]);
7728
+ console.warn(groupMessages ? `[CopilotKit] CopilotChatMessageView: the message with id "${transformDuplicateId}" renders more than once. \`groupMessages\` should place each message in at most one row, and \`transformMessages\` return each id at most once.` : `[CopilotKit] CopilotChatMessageView: \`transformMessages\` returned more than one message with id "${transformDuplicateId}". Return each id at most once; a message you create needs its own id, stable across renders.`);
7729
+ }, [transformDuplicateId, groupMessages]);
7730
+ const duplicateGroupKey = useMemo(() => {
7731
+ if (process.env.NODE_ENV === "production" || !groupMessages) return;
7732
+ const seen = /* @__PURE__ */ new Set();
7733
+ for (const row of rows) {
7734
+ if (row.type !== "group") continue;
7735
+ if (seen.has(row.key)) return row.key;
7736
+ seen.add(row.key);
7737
+ }
7738
+ }, [rows, groupMessages]);
7739
+ useEffect(() => {
7740
+ if (duplicateGroupKey === void 0) return;
7741
+ console.warn(`[CopilotKit] CopilotChatMessageView: \`groupMessages\` returned more than one group with key "${duplicateGroupKey}". Give each group its own key, stable across renders.`);
7742
+ }, [duplicateGroupKey]);
7641
7743
  const rowKeyStoreRef = useRef(null);
7642
7744
  rowKeyStoreRef.current ??= createRowKeyStore();
7643
7745
  const rowKeyStore = rowKeyStoreRef.current;
@@ -7645,6 +7747,31 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7645
7747
  useLayoutEffect(() => {
7646
7748
  commitRowKeyStore(rowKeyStore, renderedMessages);
7647
7749
  }, [rowKeyStore, renderedMessages]);
7750
+ const stableGroupKey = (key) => rowRenderKeys.get(key) ?? key;
7751
+ const groupStateRef = useRef(/* @__PURE__ */ new Map());
7752
+ const groupSettersRef = useRef(/* @__PURE__ */ new Map());
7753
+ const groupStateThreadRef = useRef(config?.threadId);
7754
+ if (groupStateThreadRef.current !== config?.threadId) {
7755
+ groupStateThreadRef.current = config?.threadId;
7756
+ groupStateRef.current = /* @__PURE__ */ new Map();
7757
+ groupSettersRef.current = /* @__PURE__ */ new Map();
7758
+ }
7759
+ const groupSetter = (key) => {
7760
+ let setter = groupSettersRef.current.get(key);
7761
+ if (!setter) {
7762
+ setter = (next) => {
7763
+ groupStateRef.current.set(key, next);
7764
+ forceUpdate();
7765
+ };
7766
+ groupSettersRef.current.set(key, setter);
7767
+ }
7768
+ return setter;
7769
+ };
7770
+ useLayoutEffect(() => {
7771
+ const live = /* @__PURE__ */ new Set();
7772
+ for (const row of rows) if (row.type === "group") live.add(stableGroupKey(row.key));
7773
+ for (const store of [groupStateRef.current, groupSettersRef.current]) for (const key of store.keys()) if (!live.has(key)) store.delete(key);
7774
+ }, [rows, rowRenderKeys]);
7648
7775
  if (process.env.NODE_ENV === "development" && deduplicatedMessages.length < messages.length) console.warn(`CopilotChatMessageView: Merged ${messages.length - deduplicatedMessages.length} message(s) with duplicate IDs.`);
7649
7776
  const { Component: AssistantComponent, slotProps: assistantSlotProps } = useMemo(() => resolveSlotComponent(assistantMessage, CopilotChatAssistantMessage_default), [assistantMessage]);
7650
7777
  const agentId = config?.agentId;
@@ -7684,7 +7811,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7684
7811
  useEffect(() => {
7685
7812
  if (process.env.NODE_ENV === "production" || !childrenDisabledVirtualization || warnedChildrenRef.current) return;
7686
7813
  warnedChildrenRef.current = true;
7687
- console.warn(`[CopilotKit] CopilotChatMessageView: the \`children\` render prop disables virtualization, so all ${renderedMessages.length} messages are mounted. ` + (transformMessages ? "`transformMessages` keeps virtualization on by itself; drop `children` to use it." : "To reshape the list and keep virtualization, use `transformMessages` instead."));
7814
+ console.warn(`[CopilotKit] CopilotChatMessageView: the \`children\` render prop disables virtualization, so all ${renderedMessages.length} messages are mounted. ` + (transformMessages || groupMessages ? "`transformMessages` and `groupMessages` keep virtualization on by themselves; drop `children` to use them." : "To reshape the list and keep virtualization, use `transformMessages` instead, or `groupMessages` to render several messages as one row."));
7688
7815
  }, [
7689
7816
  childrenDisabledVirtualization,
7690
7817
  renderedMessages.length,
@@ -7724,7 +7851,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7724
7851
  return item.start < (instance.scrollOffset ?? 0) + scrollAdjustments;
7725
7852
  }, []);
7726
7853
  const virtualizer = useVirtualizer({
7727
- count: shouldVirtualize ? renderedMessages.length : 0,
7854
+ count: shouldVirtualize ? rows.length : 0,
7728
7855
  getScrollElement: () => scrollElement,
7729
7856
  estimateSize: estimateRowSize,
7730
7857
  overscan: 5,
@@ -7737,8 +7864,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7737
7864
  isPinnedToBottomRef.current = isPinnedToBottom;
7738
7865
  virtualizer.shouldAdjustScrollPositionOnItemSizeChange = shouldAdjustScrollOnResize;
7739
7866
  useLayoutEffect(() => {
7740
- if (!shouldVirtualize || !renderedMessages.length) return;
7741
- virtualizer.scrollToIndex(renderedMessages.length - 1, { align: "end" });
7867
+ if (!shouldVirtualize || !rows.length) return;
7868
+ virtualizer.scrollToIndex(rows.length - 1, { align: "end" });
7742
7869
  }, [shouldVirtualize, firstMessageId]);
7743
7870
  const intelligenceTurnAnchors = useMemo(() => getIntelligenceTurnAnchors(deduplicatedMessages, renderedMessages), [deduplicatedMessages, renderedMessages]);
7744
7871
  const renderMessageBlock = (message) => {
@@ -7782,7 +7909,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7782
7909
  renderCustomMessage,
7783
7910
  stateSnapshot
7784
7911
  }, `${rowKey}-custom-after`));
7785
- const intelligenceTurnId = intelligenceTurnAnchors.get(message.id);
7912
+ const intelligenceTurnId = showIntelligenceIndicator ? intelligenceTurnAnchors.get(message.id) : void 0;
7786
7913
  if (intelligenceTurnId !== void 0) elements.push(/* @__PURE__ */ jsx(IntelligenceIndicator, {
7787
7914
  message,
7788
7915
  agentId: config?.agentId ?? DEFAULT_AGENT_ID,
@@ -7790,7 +7917,20 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7790
7917
  }, `intelligence-${intelligenceTurnId}`));
7791
7918
  return elements.filter(Boolean);
7792
7919
  };
7793
- const messageElements = shouldVirtualize ? [] : renderedMessages.flatMap(renderMessageBlock);
7920
+ const rowKey = (row) => row.type === "group" ? `${GROUP_ROW_KEY_PREFIX}${stableGroupKey(row.key)}` : rowRenderKeys.get(row.message.id) ?? row.message.id;
7921
+ const renderRow = (row) => {
7922
+ if (row.type === "message") return renderMessageBlock(row.message);
7923
+ const Wrapper = row.wrapper;
7924
+ const stateKey = stableGroupKey(row.key);
7925
+ return [/* @__PURE__ */ jsx(Wrapper, {
7926
+ groupKey: row.key,
7927
+ messages: row.messages,
7928
+ state: groupStateRef.current.get(stateKey),
7929
+ setState: groupSetter(stateKey),
7930
+ children: row.messages.flatMap(renderMessageBlock)
7931
+ }, rowKey(row))];
7932
+ };
7933
+ const messageElements = shouldVirtualize ? [] : rows.flatMap(renderRow);
7794
7934
  if (children) return /* @__PURE__ */ jsx("div", {
7795
7935
  "data-copilotkit": true,
7796
7936
  style: { display: "contents" },
@@ -7815,7 +7955,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7815
7955
  position: "relative"
7816
7956
  },
7817
7957
  children: virtualizer.getVirtualItems().map((virtualItem) => {
7818
- const message = renderedMessages[virtualItem.index];
7958
+ const row = rows[virtualItem.index];
7819
7959
  return /* @__PURE__ */ jsx("div", {
7820
7960
  "data-index": virtualItem.index,
7821
7961
  ref: virtualizer.measureElement,
@@ -7826,8 +7966,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7826
7966
  width: "100%",
7827
7967
  transform: `translateY(${virtualItem.start}px)`
7828
7968
  },
7829
- children: renderMessageBlock(message)
7830
- }, rowRenderKeys.get(message.id) ?? message.id);
7969
+ children: renderRow(row)
7970
+ }, rowKey(row));
7831
7971
  })
7832
7972
  }) : messageElements,
7833
7973
  interruptElement,
@@ -8895,6 +9035,29 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8895
9035
  const [lastConnectedThreadId, setLastConnectedThreadId] = useState(null);
8896
9036
  const isConnecting = hasExplicitThreadId && lastConnectedThreadId !== resolvedThreadId;
8897
9037
  const activeConnectCountRef = useRef(0);
9038
+ const pendingConnectionsRef = useRef(/* @__PURE__ */ new Map());
9039
+ const failedConnectionsRef = useRef(/* @__PURE__ */ new WeakSet());
9040
+ const submissionQueueRef = useRef(Promise.resolve());
9041
+ const trackConnection = useCallback((connectingAgent, connect) => {
9042
+ const selection = previousThreadRef.current;
9043
+ const connectingThreadId = connectingAgent.threadId;
9044
+ let failed = false;
9045
+ const subscription = copilotkit.subscribe({ onError: (event) => {
9046
+ if (selection?.active && previousThreadRef.current === selection && event.context?.agentId === connectingAgent.agentId && (!event.context.threadId || event.context.threadId === connectingThreadId) && (event.code === CopilotKitCoreErrorCode.AGENT_CONNECT_FAILED || event.code === CopilotKitCoreErrorCode.AGENT_RUN_FAILED_EVENT)) failed = true;
9047
+ } });
9048
+ const pending = connect().catch((error) => {
9049
+ failed = true;
9050
+ console.error("CopilotChat: connection failed", error);
9051
+ }).finally(() => {
9052
+ subscription.unsubscribe();
9053
+ if (pendingConnectionsRef.current.get(connectingAgent) === pending) {
9054
+ pendingConnectionsRef.current.delete(connectingAgent);
9055
+ if (selection?.active && previousThreadRef.current === selection) if (failed) failedConnectionsRef.current.add(connectingAgent);
9056
+ else failedConnectionsRef.current.delete(connectingAgent);
9057
+ }
9058
+ });
9059
+ pendingConnectionsRef.current.set(connectingAgent, pending);
9060
+ }, [copilotkit]);
8898
9061
  const pendingRunActivityReconnectRef = useRef(false);
8899
9062
  const runActivityReconnectGenerationRef = useRef(0);
8900
9063
  const activeLocalRunIdsRef = useRef(/* @__PURE__ */ new Set());
@@ -8954,9 +9117,12 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8954
9117
  const selection = {
8955
9118
  threadId: resolvedThreadId,
8956
9119
  inspectorRequestId,
8957
- agent
9120
+ agent,
9121
+ active: true
8958
9122
  };
8959
9123
  previousThreadRef.current = selection;
9124
+ submissionQueueRef.current = Promise.resolve();
9125
+ failedConnectionsRef.current.delete(agent);
8960
9126
  const discardedThreadId = previousThread?.agent === agent ? previousThread.threadId : agent.threadId;
8961
9127
  if (inspectorTransition) if (typeof copilotkit.stopAgent === "function") copilotkit.stopAgent({ agent });
8962
9128
  else agent.abortRun?.();
@@ -8994,6 +9160,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8994
9160
  }
8995
9161
  return () => {
8996
9162
  active = false;
9163
+ selection.active = false;
8997
9164
  };
8998
9165
  }
8999
9166
  let detached = false;
@@ -9007,8 +9174,8 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9007
9174
  await copilotkit.connectAgent({ agent: agentToConnect });
9008
9175
  } catch (error) {
9009
9176
  if (detached) return;
9010
- console.error("CopilotChat: connectAgent failed", error);
9011
9177
  if (inspectorRequestId) failInspectorOverride(inspectorRequestId);
9178
+ throw error;
9012
9179
  } finally {
9013
9180
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
9014
9181
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
@@ -9024,8 +9191,9 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9024
9191
  }
9025
9192
  }
9026
9193
  };
9027
- connect(agent);
9194
+ trackConnection(agent, () => connect(agent));
9028
9195
  return () => {
9196
+ selection.active = false;
9029
9197
  detached = true;
9030
9198
  connectAbortController.abort();
9031
9199
  const detach = agent.detachActiveRun().catch(() => {});
@@ -9088,7 +9256,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9088
9256
  await copilotkit.connectAgent({ agent });
9089
9257
  didConnect = true;
9090
9258
  } catch (error) {
9091
- if (!detached) console.error("CopilotChat: run activity reconnect failed", error);
9259
+ if (!detached) throw error;
9092
9260
  } finally {
9093
9261
  if (wakeRunId) {
9094
9262
  activeWakeRunIdsRef.current.delete(wakeRunId);
@@ -9098,7 +9266,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9098
9266
  wakeReconnectActive = false;
9099
9267
  if (!detached && runActivityReconnectGenerationRef.current === generation && activeConnectCountRef.current === 0 && pendingRunActivityReconnectRef.current) {
9100
9268
  pendingRunActivityReconnectRef.current = false;
9101
- connect();
9269
+ trackConnection(agent, connect);
9102
9270
  }
9103
9271
  }
9104
9272
  };
@@ -9114,7 +9282,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9114
9282
  return;
9115
9283
  }
9116
9284
  pendingRunActivityReconnectRef.current = false;
9117
- connect();
9285
+ trackConnection(agent, connect);
9118
9286
  };
9119
9287
  const subscription = threadStore.subscribeToRunActivity((notification) => {
9120
9288
  if (notification.threadId !== resolvedThreadId) return;
@@ -9157,6 +9325,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9157
9325
  rememberRecentlyWakeRunId
9158
9326
  ]);
9159
9327
  const waitForActiveRunToSettle = useCallback(async () => {
9328
+ const selection = previousThreadRef.current;
9329
+ const isCurrentSelection = () => selection?.active && previousThreadRef.current === selection;
9330
+ let connection = pendingConnectionsRef.current.get(agent);
9331
+ while (connection && isCurrentSelection()) {
9332
+ await connection;
9333
+ connection = pendingConnectionsRef.current.get(agent);
9334
+ }
9335
+ if (!isCurrentSelection()) return false;
9336
+ if (failedConnectionsRef.current.has(agent)) {
9337
+ setTranscriptionError("Could not load saved conversation. Reopen the thread and try again.");
9338
+ return "failed";
9339
+ }
9160
9340
  const maybeAware = agent;
9161
9341
  const activeRunCompletionPromise = isRunCompletionAware(maybeAware) ? maybeAware.activeRunCompletionPromise : void 0;
9162
9342
  if (agent.isRunning && activeRunCompletionPromise) try {
@@ -9164,7 +9344,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9164
9344
  } catch (error) {
9165
9345
  console.error("CopilotChat: in-flight run rejected while queuing send", error);
9166
9346
  }
9347
+ return isCurrentSelection();
9167
9348
  }, [agent]);
9349
+ const enqueueSubmission = useCallback((submit) => {
9350
+ const selection = previousThreadRef.current;
9351
+ const pending = submissionQueueRef.current.then(async () => {
9352
+ if (selection?.active && previousThreadRef.current === selection) await submit();
9353
+ }).catch((error) => {
9354
+ console.error("CopilotChat: queued submission failed", error);
9355
+ });
9356
+ submissionQueueRef.current = pending;
9357
+ return pending;
9358
+ }, []);
9168
9359
  const onSubmitInput = useCallback(async (value) => {
9169
9360
  if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9170
9361
  console.error("[CopilotKit] Cannot send while attachments are uploading (pre-await guard)");
@@ -9172,92 +9363,102 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9172
9363
  return;
9173
9364
  }
9174
9365
  setInputValue("");
9175
- await waitForActiveRunToSettle();
9176
- if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9177
- console.error("[CopilotKit] Cannot send while attachments are uploading (post-await re-check)");
9178
- setTranscriptionError("Cannot send while attachments are uploading.");
9179
- setInputValue(value);
9180
- return;
9181
- }
9182
- const readyAttachments = consumeAttachments();
9183
- if (readyAttachments.length > 0) {
9184
- const contentParts = [];
9185
- if (value.trim()) contentParts.push({
9186
- type: "text",
9187
- text: value
9188
- });
9189
- for (const att of readyAttachments) contentParts.push(createAttachmentContent(att));
9190
- agent.addMessage({
9366
+ await enqueueSubmission(async () => {
9367
+ const ready = await waitForActiveRunToSettle();
9368
+ if (ready !== true) {
9369
+ if (ready === "failed") setInputValue(value);
9370
+ return;
9371
+ }
9372
+ if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9373
+ console.error("[CopilotKit] Cannot send while attachments are uploading (post-await re-check)");
9374
+ setTranscriptionError("Cannot send while attachments are uploading.");
9375
+ setInputValue(value);
9376
+ return;
9377
+ }
9378
+ const readyAttachments = consumeAttachments();
9379
+ if (readyAttachments.length > 0) {
9380
+ const contentParts = [];
9381
+ if (value.trim()) contentParts.push({
9382
+ type: "text",
9383
+ text: value
9384
+ });
9385
+ for (const att of readyAttachments) contentParts.push(createAttachmentContent(att));
9386
+ agent.addMessage({
9387
+ id: randomUUID$1(),
9388
+ role: "user",
9389
+ content: contentParts
9390
+ });
9391
+ } else agent.addMessage({
9191
9392
  id: randomUUID$1(),
9192
9393
  role: "user",
9193
- content: contentParts
9394
+ content: value
9194
9395
  });
9195
- } else agent.addMessage({
9196
- id: randomUUID$1(),
9197
- role: "user",
9198
- content: value
9199
- });
9200
- const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9201
- if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9202
- try {
9203
- await copilotkit.runAgent({
9204
- agent,
9205
- ...localRunId !== void 0 ? { runId: localRunId } : {}
9206
- });
9207
- } catch (error) {
9208
- console.error("CopilotChat: runAgent failed", error);
9209
- } finally {
9210
- if (localRunId) {
9211
- activeLocalRunIdsRef.current.delete(localRunId);
9212
- rememberRecentlyLocalRunId(localRunId);
9213
- }
9214
- if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9215
- const startReconnect = startRunActivityReconnectRef.current;
9216
- if (startReconnect) {
9217
- pendingRunActivityReconnectRef.current = false;
9218
- startReconnect(runActivityReconnectGenerationRef.current);
9396
+ const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9397
+ if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9398
+ try {
9399
+ await copilotkit.runAgent({
9400
+ agent,
9401
+ ...localRunId !== void 0 ? { runId: localRunId } : {}
9402
+ });
9403
+ } catch (error) {
9404
+ console.error("CopilotChat: runAgent failed", error);
9405
+ } finally {
9406
+ if (localRunId) {
9407
+ activeLocalRunIdsRef.current.delete(localRunId);
9408
+ rememberRecentlyLocalRunId(localRunId);
9409
+ }
9410
+ if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9411
+ const startReconnect = startRunActivityReconnectRef.current;
9412
+ if (startReconnect) {
9413
+ pendingRunActivityReconnectRef.current = false;
9414
+ startReconnect(runActivityReconnectGenerationRef.current);
9415
+ }
9219
9416
  }
9220
9417
  }
9221
- }
9418
+ });
9222
9419
  }, [
9223
9420
  agent,
9224
9421
  consumeAttachments,
9225
9422
  waitForActiveRunToSettle,
9423
+ enqueueSubmission,
9226
9424
  hasNativeIntelligenceRunActivity,
9227
9425
  rememberRecentlyLocalRunId
9228
9426
  ]);
9229
9427
  const handleSelectSuggestion = useCallback(async (suggestion) => {
9230
- await waitForActiveRunToSettle();
9231
- agent.addMessage({
9232
- id: randomUUID$1(),
9233
- role: "user",
9234
- content: suggestion.message
9235
- });
9236
- const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9237
- if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9238
- try {
9239
- await copilotkit.runAgent({
9240
- agent,
9241
- ...localRunId !== void 0 ? { runId: localRunId } : {}
9428
+ await enqueueSubmission(async () => {
9429
+ if (await waitForActiveRunToSettle() !== true) return;
9430
+ agent.addMessage({
9431
+ id: randomUUID$1(),
9432
+ role: "user",
9433
+ content: suggestion.message
9242
9434
  });
9243
- } catch (error) {
9244
- console.error("CopilotChat: runAgent failed after selecting suggestion", error);
9245
- } finally {
9246
- if (localRunId) {
9247
- activeLocalRunIdsRef.current.delete(localRunId);
9248
- rememberRecentlyLocalRunId(localRunId);
9249
- }
9250
- if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9251
- const startReconnect = startRunActivityReconnectRef.current;
9252
- if (startReconnect) {
9253
- pendingRunActivityReconnectRef.current = false;
9254
- startReconnect(runActivityReconnectGenerationRef.current);
9435
+ const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9436
+ if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9437
+ try {
9438
+ await copilotkit.runAgent({
9439
+ agent,
9440
+ ...localRunId !== void 0 ? { runId: localRunId } : {}
9441
+ });
9442
+ } catch (error) {
9443
+ console.error("CopilotChat: runAgent failed after selecting suggestion", error);
9444
+ } finally {
9445
+ if (localRunId) {
9446
+ activeLocalRunIdsRef.current.delete(localRunId);
9447
+ rememberRecentlyLocalRunId(localRunId);
9448
+ }
9449
+ if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9450
+ const startReconnect = startRunActivityReconnectRef.current;
9451
+ if (startReconnect) {
9452
+ pendingRunActivityReconnectRef.current = false;
9453
+ startReconnect(runActivityReconnectGenerationRef.current);
9454
+ }
9255
9455
  }
9256
9456
  }
9257
- }
9457
+ });
9258
9458
  }, [
9259
9459
  agent,
9260
9460
  waitForActiveRunToSettle,
9461
+ enqueueSubmission,
9261
9462
  hasNativeIntelligenceRunActivity,
9262
9463
  rememberRecentlyLocalRunId
9263
9464
  ]);
@@ -9909,7 +10110,7 @@ function CopilotPopupViewInternal({ header, toggleButton, width, height, clickOu
9909
10110
  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]";
9910
10111
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [toggleButtonElement, isRendered ? /* @__PURE__ */ jsx("div", {
9911
10112
  "data-copilotkit": true,
9912
- 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"),
10113
+ 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"),
9913
10114
  children: /* @__PURE__ */ jsxs("div", {
9914
10115
  ref: containerRef,
9915
10116
  tabIndex: -1,
@@ -12608,5 +12809,5 @@ function validateProps(props) {
12608
12809
  }
12609
12810
 
12610
12811
  //#endregion
12611
- 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 };
12612
- //# sourceMappingURL=copilotkit-LD7Gp2aV.mjs.map
12812
+ export { useConfigureSuggestions as $, ɵselectMemoriesRealtimeStatus$1 as $a, omitOptionalNulls as $i, MultimodalCapabilitiesSchema as $n, TextMessageRoleSchema as $r, AudioPartSchema as $t, CopilotChatMessageView as A, ɵisHttpAgent$1 as Aa, createEffect as Ai, HumanInTheLoopCapabilitiesSchema as An, RunStartedEventSchema as Ar, CopilotKitInspector as At, CopilotChatUserMessage_default as B, ɵobservePhoenixSocketHealth$ as Ba, empty as Bi, IntelligenceAgent as Bn, SubagentFinishedOutcomeSchema as Br, AGUI_METADATA_KEY as Bt, CopilotModalHeader as C, ɵMAX_SOCKET_RETRIES as Ca, compactEvents as Ci, EventTypeSchema as Cn, RunErrorEventSchema as Cr, OpenGenerativeUIToolRenderer as Ct, CopilotChat as D, ɵcreateThreadSelectors as Da, convertToLegacyEvents as Di, FunctionCallSchema as Dn, RunFinishedOutcomeSchema as Dr, MCPAppsActivityRenderer as Dt, DefaultOpenIcon as E, ɵcreateMemoryStore as Ea, contentToText$1 as Ei, FilterToolCallsMiddleware as En, RunFinishedInterruptOutcomeSchema as Er, MCPAppsActivityContentSchema as Et, getIntelligenceTurnAnchors as F, ɵmemoryDomainEvents as Fa, defaultApplyEvents as Fi, ImagePartSchema as Fn, StateSnapshotEventSchema as Fr, CopilotChatConfigurationProvider as Ft, useLearningContainers as G, ɵselectHasNextPage$1 as Ga, getWebMCPModelContext as Gi, MEMORY_ERROR_REGISTRY as Gn, SubagentStartedEventSchema as Gr, AddOperationSchema as Gt, CopilotChatAssistantMessage_default as H, ɵphoenixChannel$ as Ha, enforceOutgoingInput as Hi, JsonPatchOperationSchema as Hn, SubagentFinishedSuspendedOutcomeSchema as Hr, ActivityDeltaEventSchema as Ht, IntelligenceIndicatorView as I, ɵmemoryReducer as Ia, emitInspectorActiveThread$1 as Ii, InputContentDataSourceSchema as In, StepFinishedEventSchema as Ir, useCopilotChatConfiguration as It, useLearnFromUserAction as J, ɵselectMemories$1 as Ja, isInterruptExpired as Ji, MessagesSnapshotEventSchema as Jn, TestOperationSchema as Jr, AgentThreadLockedError as Jt, useAttachments as K, ɵselectIsFetchingNextPage$1 as Ka, isAbortError as Ki, MemoryError as Kn, SuggestionEngine as Kr, AgentCapabilitiesSchema as Kt, CopilotChatSuggestionView as L, ɵmemoryRestEvents as La, emitInspectorStopViewing as Li, InputContentSchema as Ln, StepStartedEventSchema as Lr, ACTIVITY_HISTORY_METADATA as Lt, messageRow as M, ɵjoinPhoenixChannel$ as Ma, createReducer as Mi, IdentityCapabilitiesSchema as Mn, StateDeltaEventSchema as Mr, CopilotChatInput_default as Mt, INTELLIGENCE_TURN_HEAD as N, ɵmapMemoryMetadataEvent as Na, createSelector as Ni, ImageInputContentSchema as Nn, StateManager as Nr, AudioRecorderError as Nt, CopilotChatView_default as O, ɵcreateThreadStore$1 as Oa, createActionGroup as Oi, FunctionMiddleware as On, RunFinishedSuccessOutcomeSchema as Or, MCPAppsActivityType as Ot, IntelligenceIndicator as P, ɵmemoryAdapterEvents as Pa, createStore as Pi, ImageInputPartSchema as Pn, StateSchema as Pr, CopilotChatAudioRecorder as Pt, INTERRUPT_EVENT_NAME as Q, ɵselectMemoriesIsMutating as Qa, ofType as Qi, MultiAgentCapabilitiesSchema as Qn, TextMessageEndEventSchema as Qr, AudioInputPartSchema as Qt, CopilotChatSuggestionPill as R, ɵobservePhoenixEvent$ as Ra, emitInspectorViewThread as Ri, InputContentSourceSchema as Rn, SubagentErrorEventSchema as Rr, AGUIConnectNotImplementedError$1 as Rt, CopilotSidebarView as S, ɵInterruptState$1 as Sa, buildResumeArray as Si, EventType as Sn, RunAgentInputSchema as Sr, OpenGenerativeUIContentSchema as St, DefaultCloseIcon as T, ɵTHREAD_REQUEST_TIMEOUT_MS as Ta, contentHasMedia as Ti, FileSourceSchema as Tn, RunFinishedEventSchema as Tr, useSandboxFunctions as Tt, CopilotChatToolCallsView as U, ɵphoenixSocket$ as Ua, ensureObjectArgs as Ui, JsonPatchSchema as Un, SubagentInfoSchema as Ur, ActivityMessageSchema as Ut, CopilotChatAttachmentRenderer as V, ɵobservePhoenixSocketSignals$ as Va, enforceEvents as Vi, InterruptSchema as Vn, SubagentFinishedSuccessOutcomeSchema as Vr, AbstractAgent$1 as Vt, useLearningContainersInCurrentThread as W, ɵselectFetchMoreError$1 as Wa, getRunOutcome as Wi, JsonPointerSchema as Wn, SubagentRunIdSchema as Wr, ActivitySnapshotEventSchema as Wt, useThreads$1 as X, ɵselectMemoriesError$1 as Xa, isRunCompletionAware$1 as Xi, Middleware as Xn, TextMessageChunkEventSchema as Xr, AttributableSchema as Xt, useMemories as Y, ɵselectMemoriesAvailable$1 as Ya, isRecognizedEvent as Yi, MetadataSchema as Yn, TextInputContentSchema as Yr, AssistantMessageSchema as Yt, useInterrupt as Z, ɵselectMemoriesIsLoading$1 as Za, mergeMetadata as Zi, MoveOperationSchema as Zn, TextMessageContentEventSchema as Zr, AudioInputContentSchema as Zt, WildcardToolCallRender as _, transformChunks as _a, VideoInputPartSchema as _i, DocumentInputContentSchema as _n, ReasoningStartEventSchema as _r, defineToolCallRenderer as _t, ThreadsProvider as a, parseProtoStream as aa, ToolCallEndEventSchema as ai, CompatibilityBoundary as an, PartSourceSchema as ar, useHumanInTheLoop as at, CopilotSidebar as b, withAuthoritativeActivityTypes as ba, aggregateTokenUsage as bi, EventSchema as bn, ResumeEntrySchema as br, OpenGenerativeUIActivityRenderer as bt, CoAgentStateRendersProvider as c, props as ca, ToolCallStartEventSchema as ci, ContextStore as cn, ReasoningCapabilitiesSchema as cr, useComponent as ct, shouldShowDevConsole as d, resolveDebugLogger as da, ToolSchema as di, CopilotKitCoreRuntimeConnectionStatus$1 as dn, ReasoningEndEventSchema as dr, useRenderActivityMessage as dt, on as ea, TextMessageStartEventSchema as ei, BackwardCompatibility_0_0_39 as en, ɵselectThreads$1 as eo, MultimodalInputCapabilitiesSchema as er, useSuggestions as et, useToast as f, runHttpRequest as fa, ToolsCapabilitiesSchema as fi, CopyOperationSchema as fn, ReasoningMessageChunkEventSchema as fr, useRenderCustomMessages as ft, useCopilotContext as g, tokenUsageFromLangChainMetadata as ga, VideoInputContentSchema as gi, DeveloperMessageSchema as gn, ReasoningMessageStartEventSchema as gr, CopilotKitCoreReact as gt, CopilotContext as h, tokenUsageFromAiSdkUsage as ha, UserMessageSchema as hi, DebugLogger as hn, ReasoningMessageSchema as hr, useLicenseContext$1 as ht, ThreadsContext as i, onInspectorViewThreadResult as ia, ToolCallChunkEventSchema as ii, BaseMessageSchema as in, PROTOCOL_VERSION as ir, useAgent as it, messageGroup as j, ɵisRetryableMemoryStatus as ja, createInspectorThreadRequestId as ji, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID as jn, StateCapabilitiesSchema as jr, useRenderToolCall as jt, CopilotChatAttachmentQueue as k, ɵisCopilotKitFeature as ka, createDebugLogger as ki, HttpAgent as kn, RunHandler as kr, ɵrunMcpFollowUp as kt, useCoAgentStateRenders as l, randomUUID$2 as la, ToolCallStatus$1 as li, CopilotKitCore$1 as ln, ReasoningEncryptedValueEventSchema as lr, useFrontendTools as lt, useCopilotMessagesContext as m, structuredClone_ as ma, UrlSourceSchema as mi, DataSourceSchema as mn, ReasoningMessageEndEventSchema as mr, useCopilotKit$1 as mt, defaultCopilotContextCategories as n, onInspectorStopViewing$1 as na, TokenUsageSchema as ni, BackwardCompatibility_0_0_57 as nn, ɵselectThreadsIsLoading$1 as no, OptionalMetadataSchema as nr, useCapabilities as nt, useThreads as o, parseSSEStream as oa, ToolCallResultEventSchema as oi, ContentPartSchema as on, ProxiedCopilotRuntimeAgent$1 as or, useDefaultRenderTool as ot, CopilotMessagesContext as p, select as pa, TransportCapabilitiesSchema as pi, CustomEventSchema as pn, ReasoningMessageContentEventSchema as pr, CopilotKitProvider as pt, useLearnFromUserActionInCurrentThread as q, ɵselectIsMutating$1 as qa, isInspectorThreadBridgeEnabled$1 as qi, MessageSchema as qn, SystemMessageSchema as qr, AgentRegistry as qt, CoAgentStateRenderBridge as r, onInspectorViewThread$1 as ra, ToolCallArgsEventSchema as ri, BaseEventSchema as rn, ɵthreadAdapterEvents as ro, OutputCapabilitiesSchema as rr, UseAgentUpdate as rt, CoAgentStateRendersContext as s, parseToolArguments as sa, ToolCallSchema as si, ContextSchema as sn, RawEventSchema as sr, useRenderTool as st, CopilotKit as t, onInspectorActiveThread as ta, TextPartSchema as ti, BackwardCompatibility_0_0_45 as tn, ɵselectThreadsError$1 as to, MultimodalOutputCapabilitiesSchema as tr, useAgentContext as tt, useAsyncCallback as u, resolveAgentDebugConfig as ua, ToolMessageSchema as ui, CopilotKitCoreErrorCode$1 as un, ReasoningEncryptedValueSubtypeSchema as ur, useFrontendTool as ut, CopilotThreadsDrawer as v, transformHttpEventStream as va, VideoPartSchema as vi, DocumentInputPartSchema as vn, RemoveOperationSchema as vr, createA2UIMessageRenderer as vt, CopilotChatToggleButton as w, ɵRUNTIME_PROBE_TIMEOUT_MS as wa, completePartialMarkdown as wi, ExecutionCapabilitiesSchema as wn, RunFinishedCancelledOutcomeSchema as wr, SandboxFunctionsContext as wt, CopilotPopupView as x, ɵCOPILOTKIT_FEATURES as xa, authoritativeActivityTypes as xi, EventSchemas as xn, RoleSchema as xr, OpenGenerativeUIActivityType as xt, CopilotPopup as y, verifyEvents as ya, WebMCPRegistry as yi, DocumentPartSchema as yn, ReplaceOperationSchema as yr, GenerateSandboxedUiArgsSchema as yt, CopilotChatReasoningMessage_default as z, ɵobservePhoenixJoinOutcome$ as za, emitInspectorViewThreadResult$1 as zi, InputContentUrlSourceSchema as zn, SubagentFinishedEventSchema as zr, AGUIError as zt };
12813
+ //# sourceMappingURL=copilotkit-C_Sy6Cc7.mjs.map