@copilotkit/react-core 1.77.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.
@@ -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";
@@ -1626,7 +1626,7 @@ function useRenderToolCall() {
1626
1626
 
1627
1627
  //#endregion
1628
1628
  //#region package.json
1629
- var version = "1.77.0";
1629
+ var version = "1.77.1";
1630
1630
 
1631
1631
  //#endregion
1632
1632
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -3383,7 +3383,6 @@ const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follo
3383
3383
  - Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.
3384
3384
  - Minimal transitions (150ms) for hover/focus states only. No decorative animations.
3385
3385
  - Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;
3386
- 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)";
3387
3386
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3388
3387
  const empty = useMemo(() => [], []);
3389
3388
  const value = prop ?? empty;
@@ -7655,8 +7654,23 @@ function deduplicateMessages(messages) {
7655
7654
  }
7656
7655
  return [...acc.values()];
7657
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:";
7658
7672
  const VIRTUALIZE_THRESHOLD = 50;
7659
- 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 }) {
7660
7674
  const isPinnedToBottom = useContext(ScrollPinnedContext);
7661
7675
  const renderCustomMessage = useRenderCustomMessages();
7662
7676
  const { renderActivityMessage } = useRenderActivityMessage();
@@ -7689,20 +7703,43 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7689
7703
  return copilotkit.getStateByRun(config.agentId, config.threadId, resolvedRunId);
7690
7704
  };
7691
7705
  const deduplicatedMessages = useMemo(() => deduplicateMessages(messages), [messages]);
7692
- 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
+ ]);
7693
7713
  const latestRenderedId = renderedMessages[renderedMessages.length - 1]?.id;
7694
7714
  const transformDuplicateId = useMemo(() => {
7695
- if (process.env.NODE_ENV === "production" || !transformMessages) return;
7715
+ if (process.env.NODE_ENV === "production" || !transformMessages && !groupMessages) return;
7696
7716
  const seen = /* @__PURE__ */ new Set();
7697
7717
  for (const message of renderedMessages) {
7698
7718
  if (seen.has(message.id)) return message.id;
7699
7719
  seen.add(message.id);
7700
7720
  }
7701
- }, [renderedMessages, transformMessages]);
7721
+ }, [
7722
+ renderedMessages,
7723
+ transformMessages,
7724
+ groupMessages
7725
+ ]);
7702
7726
  useEffect(() => {
7703
7727
  if (transformDuplicateId === void 0) return;
7704
- 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.`);
7705
- }, [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]);
7706
7743
  const rowKeyStoreRef = useRef(null);
7707
7744
  rowKeyStoreRef.current ??= createRowKeyStore();
7708
7745
  const rowKeyStore = rowKeyStoreRef.current;
@@ -7710,6 +7747,31 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7710
7747
  useLayoutEffect(() => {
7711
7748
  commitRowKeyStore(rowKeyStore, renderedMessages);
7712
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]);
7713
7775
  if (process.env.NODE_ENV === "development" && deduplicatedMessages.length < messages.length) console.warn(`CopilotChatMessageView: Merged ${messages.length - deduplicatedMessages.length} message(s) with duplicate IDs.`);
7714
7776
  const { Component: AssistantComponent, slotProps: assistantSlotProps } = useMemo(() => resolveSlotComponent(assistantMessage, CopilotChatAssistantMessage_default), [assistantMessage]);
7715
7777
  const agentId = config?.agentId;
@@ -7749,7 +7811,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7749
7811
  useEffect(() => {
7750
7812
  if (process.env.NODE_ENV === "production" || !childrenDisabledVirtualization || warnedChildrenRef.current) return;
7751
7813
  warnedChildrenRef.current = true;
7752
- 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."));
7753
7815
  }, [
7754
7816
  childrenDisabledVirtualization,
7755
7817
  renderedMessages.length,
@@ -7789,7 +7851,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7789
7851
  return item.start < (instance.scrollOffset ?? 0) + scrollAdjustments;
7790
7852
  }, []);
7791
7853
  const virtualizer = useVirtualizer({
7792
- count: shouldVirtualize ? renderedMessages.length : 0,
7854
+ count: shouldVirtualize ? rows.length : 0,
7793
7855
  getScrollElement: () => scrollElement,
7794
7856
  estimateSize: estimateRowSize,
7795
7857
  overscan: 5,
@@ -7802,8 +7864,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7802
7864
  isPinnedToBottomRef.current = isPinnedToBottom;
7803
7865
  virtualizer.shouldAdjustScrollPositionOnItemSizeChange = shouldAdjustScrollOnResize;
7804
7866
  useLayoutEffect(() => {
7805
- if (!shouldVirtualize || !renderedMessages.length) return;
7806
- virtualizer.scrollToIndex(renderedMessages.length - 1, { align: "end" });
7867
+ if (!shouldVirtualize || !rows.length) return;
7868
+ virtualizer.scrollToIndex(rows.length - 1, { align: "end" });
7807
7869
  }, [shouldVirtualize, firstMessageId]);
7808
7870
  const intelligenceTurnAnchors = useMemo(() => getIntelligenceTurnAnchors(deduplicatedMessages, renderedMessages), [deduplicatedMessages, renderedMessages]);
7809
7871
  const renderMessageBlock = (message) => {
@@ -7855,7 +7917,20 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7855
7917
  }, `intelligence-${intelligenceTurnId}`));
7856
7918
  return elements.filter(Boolean);
7857
7919
  };
7858
- 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);
7859
7934
  if (children) return /* @__PURE__ */ jsx("div", {
7860
7935
  "data-copilotkit": true,
7861
7936
  style: { display: "contents" },
@@ -7880,7 +7955,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7880
7955
  position: "relative"
7881
7956
  },
7882
7957
  children: virtualizer.getVirtualItems().map((virtualItem) => {
7883
- const message = renderedMessages[virtualItem.index];
7958
+ const row = rows[virtualItem.index];
7884
7959
  return /* @__PURE__ */ jsx("div", {
7885
7960
  "data-index": virtualItem.index,
7886
7961
  ref: virtualizer.measureElement,
@@ -7891,8 +7966,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7891
7966
  width: "100%",
7892
7967
  transform: `translateY(${virtualItem.start}px)`
7893
7968
  },
7894
- children: renderMessageBlock(message)
7895
- }, rowRenderKeys.get(message.id) ?? message.id);
7969
+ children: renderRow(row)
7970
+ }, rowKey(row));
7896
7971
  })
7897
7972
  }) : messageElements,
7898
7973
  interruptElement,
@@ -8960,6 +9035,29 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8960
9035
  const [lastConnectedThreadId, setLastConnectedThreadId] = useState(null);
8961
9036
  const isConnecting = hasExplicitThreadId && lastConnectedThreadId !== resolvedThreadId;
8962
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]);
8963
9061
  const pendingRunActivityReconnectRef = useRef(false);
8964
9062
  const runActivityReconnectGenerationRef = useRef(0);
8965
9063
  const activeLocalRunIdsRef = useRef(/* @__PURE__ */ new Set());
@@ -9019,9 +9117,12 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9019
9117
  const selection = {
9020
9118
  threadId: resolvedThreadId,
9021
9119
  inspectorRequestId,
9022
- agent
9120
+ agent,
9121
+ active: true
9023
9122
  };
9024
9123
  previousThreadRef.current = selection;
9124
+ submissionQueueRef.current = Promise.resolve();
9125
+ failedConnectionsRef.current.delete(agent);
9025
9126
  const discardedThreadId = previousThread?.agent === agent ? previousThread.threadId : agent.threadId;
9026
9127
  if (inspectorTransition) if (typeof copilotkit.stopAgent === "function") copilotkit.stopAgent({ agent });
9027
9128
  else agent.abortRun?.();
@@ -9059,6 +9160,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9059
9160
  }
9060
9161
  return () => {
9061
9162
  active = false;
9163
+ selection.active = false;
9062
9164
  };
9063
9165
  }
9064
9166
  let detached = false;
@@ -9072,8 +9174,8 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9072
9174
  await copilotkit.connectAgent({ agent: agentToConnect });
9073
9175
  } catch (error) {
9074
9176
  if (detached) return;
9075
- console.error("CopilotChat: connectAgent failed", error);
9076
9177
  if (inspectorRequestId) failInspectorOverride(inspectorRequestId);
9178
+ throw error;
9077
9179
  } finally {
9078
9180
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
9079
9181
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
@@ -9089,8 +9191,9 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9089
9191
  }
9090
9192
  }
9091
9193
  };
9092
- connect(agent);
9194
+ trackConnection(agent, () => connect(agent));
9093
9195
  return () => {
9196
+ selection.active = false;
9094
9197
  detached = true;
9095
9198
  connectAbortController.abort();
9096
9199
  const detach = agent.detachActiveRun().catch(() => {});
@@ -9153,7 +9256,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9153
9256
  await copilotkit.connectAgent({ agent });
9154
9257
  didConnect = true;
9155
9258
  } catch (error) {
9156
- if (!detached) console.error("CopilotChat: run activity reconnect failed", error);
9259
+ if (!detached) throw error;
9157
9260
  } finally {
9158
9261
  if (wakeRunId) {
9159
9262
  activeWakeRunIdsRef.current.delete(wakeRunId);
@@ -9163,7 +9266,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9163
9266
  wakeReconnectActive = false;
9164
9267
  if (!detached && runActivityReconnectGenerationRef.current === generation && activeConnectCountRef.current === 0 && pendingRunActivityReconnectRef.current) {
9165
9268
  pendingRunActivityReconnectRef.current = false;
9166
- connect();
9269
+ trackConnection(agent, connect);
9167
9270
  }
9168
9271
  }
9169
9272
  };
@@ -9179,7 +9282,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9179
9282
  return;
9180
9283
  }
9181
9284
  pendingRunActivityReconnectRef.current = false;
9182
- connect();
9285
+ trackConnection(agent, connect);
9183
9286
  };
9184
9287
  const subscription = threadStore.subscribeToRunActivity((notification) => {
9185
9288
  if (notification.threadId !== resolvedThreadId) return;
@@ -9222,6 +9325,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9222
9325
  rememberRecentlyWakeRunId
9223
9326
  ]);
9224
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
+ }
9225
9340
  const maybeAware = agent;
9226
9341
  const activeRunCompletionPromise = isRunCompletionAware(maybeAware) ? maybeAware.activeRunCompletionPromise : void 0;
9227
9342
  if (agent.isRunning && activeRunCompletionPromise) try {
@@ -9229,7 +9344,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9229
9344
  } catch (error) {
9230
9345
  console.error("CopilotChat: in-flight run rejected while queuing send", error);
9231
9346
  }
9347
+ return isCurrentSelection();
9232
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
+ }, []);
9233
9359
  const onSubmitInput = useCallback(async (value) => {
9234
9360
  if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9235
9361
  console.error("[CopilotKit] Cannot send while attachments are uploading (pre-await guard)");
@@ -9237,92 +9363,102 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9237
9363
  return;
9238
9364
  }
9239
9365
  setInputValue("");
9240
- await waitForActiveRunToSettle();
9241
- if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9242
- console.error("[CopilotKit] Cannot send while attachments are uploading (post-await re-check)");
9243
- setTranscriptionError("Cannot send while attachments are uploading.");
9244
- setInputValue(value);
9245
- return;
9246
- }
9247
- const readyAttachments = consumeAttachments();
9248
- if (readyAttachments.length > 0) {
9249
- const contentParts = [];
9250
- if (value.trim()) contentParts.push({
9251
- type: "text",
9252
- text: value
9253
- });
9254
- for (const att of readyAttachments) contentParts.push(createAttachmentContent(att));
9255
- 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({
9256
9392
  id: randomUUID$1(),
9257
9393
  role: "user",
9258
- content: contentParts
9394
+ content: value
9259
9395
  });
9260
- } else agent.addMessage({
9261
- id: randomUUID$1(),
9262
- role: "user",
9263
- content: value
9264
- });
9265
- const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9266
- if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9267
- try {
9268
- await copilotkit.runAgent({
9269
- agent,
9270
- ...localRunId !== void 0 ? { runId: localRunId } : {}
9271
- });
9272
- } catch (error) {
9273
- console.error("CopilotChat: runAgent failed", error);
9274
- } finally {
9275
- if (localRunId) {
9276
- activeLocalRunIdsRef.current.delete(localRunId);
9277
- rememberRecentlyLocalRunId(localRunId);
9278
- }
9279
- if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9280
- const startReconnect = startRunActivityReconnectRef.current;
9281
- if (startReconnect) {
9282
- pendingRunActivityReconnectRef.current = false;
9283
- 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
+ }
9284
9416
  }
9285
9417
  }
9286
- }
9418
+ });
9287
9419
  }, [
9288
9420
  agent,
9289
9421
  consumeAttachments,
9290
9422
  waitForActiveRunToSettle,
9423
+ enqueueSubmission,
9291
9424
  hasNativeIntelligenceRunActivity,
9292
9425
  rememberRecentlyLocalRunId
9293
9426
  ]);
9294
9427
  const handleSelectSuggestion = useCallback(async (suggestion) => {
9295
- await waitForActiveRunToSettle();
9296
- agent.addMessage({
9297
- id: randomUUID$1(),
9298
- role: "user",
9299
- content: suggestion.message
9300
- });
9301
- const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9302
- if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9303
- try {
9304
- await copilotkit.runAgent({
9305
- agent,
9306
- ...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
9307
9434
  });
9308
- } catch (error) {
9309
- console.error("CopilotChat: runAgent failed after selecting suggestion", error);
9310
- } finally {
9311
- if (localRunId) {
9312
- activeLocalRunIdsRef.current.delete(localRunId);
9313
- rememberRecentlyLocalRunId(localRunId);
9314
- }
9315
- if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9316
- const startReconnect = startRunActivityReconnectRef.current;
9317
- if (startReconnect) {
9318
- pendingRunActivityReconnectRef.current = false;
9319
- 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
+ }
9320
9455
  }
9321
9456
  }
9322
- }
9457
+ });
9323
9458
  }, [
9324
9459
  agent,
9325
9460
  waitForActiveRunToSettle,
9461
+ enqueueSubmission,
9326
9462
  hasNativeIntelligenceRunActivity,
9327
9463
  rememberRecentlyLocalRunId
9328
9464
  ]);
@@ -12673,5 +12809,5 @@ function validateProps(props) {
12673
12809
  }
12674
12810
 
12675
12811
  //#endregion
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
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