@copilotkit/react-core 1.77.0 → 1.77.2

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.2";
1630
1630
 
1631
1631
  //#endregion
1632
1632
  //#region src/v2/components/CopilotKitInspector.tsx
@@ -3383,7 +3383,12 @@ 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)";
3386
+ const DEFAULT_LEARNING = Object.freeze({});
3387
+ function toLearningConfig(learning) {
3388
+ if (learning === true) return DEFAULT_LEARNING;
3389
+ if (learning === false) return void 0;
3390
+ return learning;
3391
+ }
3387
3392
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3388
3393
  const empty = useMemo(() => [], []);
3389
3394
  const value = prop ?? empty;
@@ -3394,6 +3399,7 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3394
3399
  return value;
3395
3400
  }
3396
3401
  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 }) => {
3402
+ const learningConfig = toLearningConfig(learning);
3397
3403
  const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
3398
3404
  const [inspectorVisible, setInspectorVisible] = useState(false);
3399
3405
  useEffect(() => {
@@ -3629,7 +3635,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3629
3635
  renderActivityMessages: allActivityRenderers,
3630
3636
  renderCustomMessages: renderCustomMessagesList,
3631
3637
  debug,
3632
- learning
3638
+ learning: learningConfig
3633
3639
  });
3634
3640
  if (defaultThrottleMs !== void 0) copilotkitRef.current.setDefaultThrottleMs(defaultThrottleMs);
3635
3641
  }
@@ -3734,17 +3740,21 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3734
3740
  useSingleEndpoint,
3735
3741
  debug
3736
3742
  ]);
3737
- const learningEnabled = learning !== void 0;
3738
- const trajectoryId = learning?.trajectoryId;
3739
- const learningContainerIdsRef = useRef(learning?.learningContainerIds);
3740
- useEffect(() => {
3741
- copilotkit.setLearningConfig(learning);
3742
- learningContainerIdsRef.current = learning?.learningContainerIds;
3743
- if (learning?.sink === void 0 && learning?.trajectoryId === void 0 && learning?.learningContainerIds !== void 0) console.warn("[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture does not assign Learning Containers; remove learningContainerIds from the capture options.");
3744
- }, [copilotkit, learning]);
3745
- useEffect(() => {
3743
+ const learningEnabled = learningConfig !== void 0;
3744
+ const generatesTrajectoryId = learning === true;
3745
+ const suppliedTrajectoryId = learningConfig?.trajectoryId;
3746
+ const learningContainerIdsRef = useRef(learningConfig?.learningContainerIds);
3747
+ const generatedTrajectoryIdRef = useRef(void 0);
3748
+ useEffect(() => {
3749
+ copilotkit.setLearningConfig(learningConfig);
3750
+ learningContainerIdsRef.current = learningConfig?.learningContainerIds;
3751
+ if (learningConfig?.sink === void 0 && learningConfig?.trajectoryId === void 0 && learningConfig?.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.");
3752
+ }, [copilotkit, learningConfig]);
3753
+ useEffect(() => {
3754
+ if (!generatesTrajectoryId) generatedTrajectoryIdRef.current = void 0;
3746
3755
  if (!learningEnabled) return;
3747
3756
  let disposed = false;
3757
+ const trajectoryId = generatesTrajectoryId ? generatedTrajectoryIdRef.current ??= randomUUID$1() : suppliedTrajectoryId;
3748
3758
  if (trajectoryId !== void 0) copilotkit.startTrajectory({
3749
3759
  trajectoryId,
3750
3760
  learningContainerIds: learningContainerIdsRef.current
@@ -3758,7 +3768,8 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3758
3768
  }, [
3759
3769
  copilotkit,
3760
3770
  learningEnabled,
3761
- trajectoryId
3771
+ generatesTrajectoryId,
3772
+ suppliedTrajectoryId
3762
3773
  ]);
3763
3774
  const didMountRef = useRef(false);
3764
3775
  useEffect(() => {
@@ -7655,8 +7666,23 @@ function deduplicateMessages(messages) {
7655
7666
  }
7656
7667
  return [...acc.values()];
7657
7668
  }
7669
+ /** A row holding a single message, rendered as it would be ungrouped. */
7670
+ function messageRow(message) {
7671
+ return {
7672
+ type: "message",
7673
+ message
7674
+ };
7675
+ }
7676
+ /** A row holding a group of messages, rendered inside `wrapper`. */
7677
+ function messageGroup(group) {
7678
+ return {
7679
+ type: "group",
7680
+ ...group
7681
+ };
7682
+ }
7683
+ const GROUP_ROW_KEY_PREFIX = "copilotkit-group:";
7658
7684
  const VIRTUALIZE_THRESHOLD = 50;
7659
- function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, isRunning = false, transformMessages, children, className, ...props }) {
7685
+ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, isRunning = false, transformMessages, groupMessages, children, className, ...props }) {
7660
7686
  const isPinnedToBottom = useContext(ScrollPinnedContext);
7661
7687
  const renderCustomMessage = useRenderCustomMessages();
7662
7688
  const { renderActivityMessage } = useRenderActivityMessage();
@@ -7689,20 +7715,43 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7689
7715
  return copilotkit.getStateByRun(config.agentId, config.threadId, resolvedRunId);
7690
7716
  };
7691
7717
  const deduplicatedMessages = useMemo(() => deduplicateMessages(messages), [messages]);
7692
- const renderedMessages = useMemo(() => transformMessages ? transformMessages(deduplicatedMessages) : deduplicatedMessages, [deduplicatedMessages, transformMessages]);
7718
+ const transformedMessages = useMemo(() => transformMessages ? transformMessages(deduplicatedMessages) : deduplicatedMessages, [deduplicatedMessages, transformMessages]);
7719
+ const rows = useMemo(() => groupMessages ? groupMessages(transformedMessages) : transformedMessages.map(messageRow), [transformedMessages, groupMessages]);
7720
+ const renderedMessages = useMemo(() => groupMessages ? rows.flatMap((row) => row.type === "group" ? row.messages : [row.message]) : transformedMessages, [
7721
+ rows,
7722
+ groupMessages,
7723
+ transformedMessages
7724
+ ]);
7693
7725
  const latestRenderedId = renderedMessages[renderedMessages.length - 1]?.id;
7694
7726
  const transformDuplicateId = useMemo(() => {
7695
- if (process.env.NODE_ENV === "production" || !transformMessages) return;
7727
+ if (process.env.NODE_ENV === "production" || !transformMessages && !groupMessages) return;
7696
7728
  const seen = /* @__PURE__ */ new Set();
7697
7729
  for (const message of renderedMessages) {
7698
7730
  if (seen.has(message.id)) return message.id;
7699
7731
  seen.add(message.id);
7700
7732
  }
7701
- }, [renderedMessages, transformMessages]);
7733
+ }, [
7734
+ renderedMessages,
7735
+ transformMessages,
7736
+ groupMessages
7737
+ ]);
7702
7738
  useEffect(() => {
7703
7739
  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]);
7740
+ 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.`);
7741
+ }, [transformDuplicateId, groupMessages]);
7742
+ const duplicateGroupKey = useMemo(() => {
7743
+ if (process.env.NODE_ENV === "production" || !groupMessages) return;
7744
+ const seen = /* @__PURE__ */ new Set();
7745
+ for (const row of rows) {
7746
+ if (row.type !== "group") continue;
7747
+ if (seen.has(row.key)) return row.key;
7748
+ seen.add(row.key);
7749
+ }
7750
+ }, [rows, groupMessages]);
7751
+ useEffect(() => {
7752
+ if (duplicateGroupKey === void 0) return;
7753
+ console.warn(`[CopilotKit] CopilotChatMessageView: \`groupMessages\` returned more than one group with key "${duplicateGroupKey}". Give each group its own key, stable across renders.`);
7754
+ }, [duplicateGroupKey]);
7706
7755
  const rowKeyStoreRef = useRef(null);
7707
7756
  rowKeyStoreRef.current ??= createRowKeyStore();
7708
7757
  const rowKeyStore = rowKeyStoreRef.current;
@@ -7710,6 +7759,31 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7710
7759
  useLayoutEffect(() => {
7711
7760
  commitRowKeyStore(rowKeyStore, renderedMessages);
7712
7761
  }, [rowKeyStore, renderedMessages]);
7762
+ const stableGroupKey = (key) => rowRenderKeys.get(key) ?? key;
7763
+ const groupStateRef = useRef(/* @__PURE__ */ new Map());
7764
+ const groupSettersRef = useRef(/* @__PURE__ */ new Map());
7765
+ const groupStateThreadRef = useRef(config?.threadId);
7766
+ if (groupStateThreadRef.current !== config?.threadId) {
7767
+ groupStateThreadRef.current = config?.threadId;
7768
+ groupStateRef.current = /* @__PURE__ */ new Map();
7769
+ groupSettersRef.current = /* @__PURE__ */ new Map();
7770
+ }
7771
+ const groupSetter = (key) => {
7772
+ let setter = groupSettersRef.current.get(key);
7773
+ if (!setter) {
7774
+ setter = (next) => {
7775
+ groupStateRef.current.set(key, next);
7776
+ forceUpdate();
7777
+ };
7778
+ groupSettersRef.current.set(key, setter);
7779
+ }
7780
+ return setter;
7781
+ };
7782
+ useLayoutEffect(() => {
7783
+ const live = /* @__PURE__ */ new Set();
7784
+ for (const row of rows) if (row.type === "group") live.add(stableGroupKey(row.key));
7785
+ for (const store of [groupStateRef.current, groupSettersRef.current]) for (const key of store.keys()) if (!live.has(key)) store.delete(key);
7786
+ }, [rows, rowRenderKeys]);
7713
7787
  if (process.env.NODE_ENV === "development" && deduplicatedMessages.length < messages.length) console.warn(`CopilotChatMessageView: Merged ${messages.length - deduplicatedMessages.length} message(s) with duplicate IDs.`);
7714
7788
  const { Component: AssistantComponent, slotProps: assistantSlotProps } = useMemo(() => resolveSlotComponent(assistantMessage, CopilotChatAssistantMessage_default), [assistantMessage]);
7715
7789
  const agentId = config?.agentId;
@@ -7749,7 +7823,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7749
7823
  useEffect(() => {
7750
7824
  if (process.env.NODE_ENV === "production" || !childrenDisabledVirtualization || warnedChildrenRef.current) return;
7751
7825
  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."));
7826
+ 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
7827
  }, [
7754
7828
  childrenDisabledVirtualization,
7755
7829
  renderedMessages.length,
@@ -7789,7 +7863,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7789
7863
  return item.start < (instance.scrollOffset ?? 0) + scrollAdjustments;
7790
7864
  }, []);
7791
7865
  const virtualizer = useVirtualizer({
7792
- count: shouldVirtualize ? renderedMessages.length : 0,
7866
+ count: shouldVirtualize ? rows.length : 0,
7793
7867
  getScrollElement: () => scrollElement,
7794
7868
  estimateSize: estimateRowSize,
7795
7869
  overscan: 5,
@@ -7802,8 +7876,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7802
7876
  isPinnedToBottomRef.current = isPinnedToBottom;
7803
7877
  virtualizer.shouldAdjustScrollPositionOnItemSizeChange = shouldAdjustScrollOnResize;
7804
7878
  useLayoutEffect(() => {
7805
- if (!shouldVirtualize || !renderedMessages.length) return;
7806
- virtualizer.scrollToIndex(renderedMessages.length - 1, { align: "end" });
7879
+ if (!shouldVirtualize || !rows.length) return;
7880
+ virtualizer.scrollToIndex(rows.length - 1, { align: "end" });
7807
7881
  }, [shouldVirtualize, firstMessageId]);
7808
7882
  const intelligenceTurnAnchors = useMemo(() => getIntelligenceTurnAnchors(deduplicatedMessages, renderedMessages), [deduplicatedMessages, renderedMessages]);
7809
7883
  const renderMessageBlock = (message) => {
@@ -7855,7 +7929,20 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7855
7929
  }, `intelligence-${intelligenceTurnId}`));
7856
7930
  return elements.filter(Boolean);
7857
7931
  };
7858
- const messageElements = shouldVirtualize ? [] : renderedMessages.flatMap(renderMessageBlock);
7932
+ const rowKey = (row) => row.type === "group" ? `${GROUP_ROW_KEY_PREFIX}${stableGroupKey(row.key)}` : rowRenderKeys.get(row.message.id) ?? row.message.id;
7933
+ const renderRow = (row) => {
7934
+ if (row.type === "message") return renderMessageBlock(row.message);
7935
+ const Wrapper = row.wrapper;
7936
+ const stateKey = stableGroupKey(row.key);
7937
+ return [/* @__PURE__ */ jsx(Wrapper, {
7938
+ groupKey: row.key,
7939
+ messages: row.messages,
7940
+ state: groupStateRef.current.get(stateKey),
7941
+ setState: groupSetter(stateKey),
7942
+ children: row.messages.flatMap(renderMessageBlock)
7943
+ }, rowKey(row))];
7944
+ };
7945
+ const messageElements = shouldVirtualize ? [] : rows.flatMap(renderRow);
7859
7946
  if (children) return /* @__PURE__ */ jsx("div", {
7860
7947
  "data-copilotkit": true,
7861
7948
  style: { display: "contents" },
@@ -7880,7 +7967,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7880
7967
  position: "relative"
7881
7968
  },
7882
7969
  children: virtualizer.getVirtualItems().map((virtualItem) => {
7883
- const message = renderedMessages[virtualItem.index];
7970
+ const row = rows[virtualItem.index];
7884
7971
  return /* @__PURE__ */ jsx("div", {
7885
7972
  "data-index": virtualItem.index,
7886
7973
  ref: virtualizer.measureElement,
@@ -7891,8 +7978,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7891
7978
  width: "100%",
7892
7979
  transform: `translateY(${virtualItem.start}px)`
7893
7980
  },
7894
- children: renderMessageBlock(message)
7895
- }, rowRenderKeys.get(message.id) ?? message.id);
7981
+ children: renderRow(row)
7982
+ }, rowKey(row));
7896
7983
  })
7897
7984
  }) : messageElements,
7898
7985
  interruptElement,
@@ -8960,6 +9047,29 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
8960
9047
  const [lastConnectedThreadId, setLastConnectedThreadId] = useState(null);
8961
9048
  const isConnecting = hasExplicitThreadId && lastConnectedThreadId !== resolvedThreadId;
8962
9049
  const activeConnectCountRef = useRef(0);
9050
+ const pendingConnectionsRef = useRef(/* @__PURE__ */ new Map());
9051
+ const failedConnectionsRef = useRef(/* @__PURE__ */ new WeakSet());
9052
+ const submissionQueueRef = useRef(Promise.resolve());
9053
+ const trackConnection = useCallback((connectingAgent, connect) => {
9054
+ const selection = previousThreadRef.current;
9055
+ const connectingThreadId = connectingAgent.threadId;
9056
+ let failed = false;
9057
+ const subscription = copilotkit.subscribe({ onError: (event) => {
9058
+ 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;
9059
+ } });
9060
+ const pending = connect().catch((error) => {
9061
+ failed = true;
9062
+ console.error("CopilotChat: connection failed", error);
9063
+ }).finally(() => {
9064
+ subscription.unsubscribe();
9065
+ if (pendingConnectionsRef.current.get(connectingAgent) === pending) {
9066
+ pendingConnectionsRef.current.delete(connectingAgent);
9067
+ if (selection?.active && previousThreadRef.current === selection) if (failed) failedConnectionsRef.current.add(connectingAgent);
9068
+ else failedConnectionsRef.current.delete(connectingAgent);
9069
+ }
9070
+ });
9071
+ pendingConnectionsRef.current.set(connectingAgent, pending);
9072
+ }, [copilotkit]);
8963
9073
  const pendingRunActivityReconnectRef = useRef(false);
8964
9074
  const runActivityReconnectGenerationRef = useRef(0);
8965
9075
  const activeLocalRunIdsRef = useRef(/* @__PURE__ */ new Set());
@@ -9019,9 +9129,12 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9019
9129
  const selection = {
9020
9130
  threadId: resolvedThreadId,
9021
9131
  inspectorRequestId,
9022
- agent
9132
+ agent,
9133
+ active: true
9023
9134
  };
9024
9135
  previousThreadRef.current = selection;
9136
+ submissionQueueRef.current = Promise.resolve();
9137
+ failedConnectionsRef.current.delete(agent);
9025
9138
  const discardedThreadId = previousThread?.agent === agent ? previousThread.threadId : agent.threadId;
9026
9139
  if (inspectorTransition) if (typeof copilotkit.stopAgent === "function") copilotkit.stopAgent({ agent });
9027
9140
  else agent.abortRun?.();
@@ -9059,6 +9172,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9059
9172
  }
9060
9173
  return () => {
9061
9174
  active = false;
9175
+ selection.active = false;
9062
9176
  };
9063
9177
  }
9064
9178
  let detached = false;
@@ -9072,8 +9186,8 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9072
9186
  await copilotkit.connectAgent({ agent: agentToConnect });
9073
9187
  } catch (error) {
9074
9188
  if (detached) return;
9075
- console.error("CopilotChat: connectAgent failed", error);
9076
9189
  if (inspectorRequestId) failInspectorOverride(inspectorRequestId);
9190
+ throw error;
9077
9191
  } finally {
9078
9192
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
9079
9193
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
@@ -9089,8 +9203,9 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9089
9203
  }
9090
9204
  }
9091
9205
  };
9092
- connect(agent);
9206
+ trackConnection(agent, () => connect(agent));
9093
9207
  return () => {
9208
+ selection.active = false;
9094
9209
  detached = true;
9095
9210
  connectAbortController.abort();
9096
9211
  const detach = agent.detachActiveRun().catch(() => {});
@@ -9153,7 +9268,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9153
9268
  await copilotkit.connectAgent({ agent });
9154
9269
  didConnect = true;
9155
9270
  } catch (error) {
9156
- if (!detached) console.error("CopilotChat: run activity reconnect failed", error);
9271
+ if (!detached) throw error;
9157
9272
  } finally {
9158
9273
  if (wakeRunId) {
9159
9274
  activeWakeRunIdsRef.current.delete(wakeRunId);
@@ -9163,7 +9278,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9163
9278
  wakeReconnectActive = false;
9164
9279
  if (!detached && runActivityReconnectGenerationRef.current === generation && activeConnectCountRef.current === 0 && pendingRunActivityReconnectRef.current) {
9165
9280
  pendingRunActivityReconnectRef.current = false;
9166
- connect();
9281
+ trackConnection(agent, connect);
9167
9282
  }
9168
9283
  }
9169
9284
  };
@@ -9179,7 +9294,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9179
9294
  return;
9180
9295
  }
9181
9296
  pendingRunActivityReconnectRef.current = false;
9182
- connect();
9297
+ trackConnection(agent, connect);
9183
9298
  };
9184
9299
  const subscription = threadStore.subscribeToRunActivity((notification) => {
9185
9300
  if (notification.threadId !== resolvedThreadId) return;
@@ -9222,6 +9337,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9222
9337
  rememberRecentlyWakeRunId
9223
9338
  ]);
9224
9339
  const waitForActiveRunToSettle = useCallback(async () => {
9340
+ const selection = previousThreadRef.current;
9341
+ const isCurrentSelection = () => selection?.active && previousThreadRef.current === selection;
9342
+ let connection = pendingConnectionsRef.current.get(agent);
9343
+ while (connection && isCurrentSelection()) {
9344
+ await connection;
9345
+ connection = pendingConnectionsRef.current.get(agent);
9346
+ }
9347
+ if (!isCurrentSelection()) return false;
9348
+ if (failedConnectionsRef.current.has(agent)) {
9349
+ setTranscriptionError("Could not load saved conversation. Reopen the thread and try again.");
9350
+ return "failed";
9351
+ }
9225
9352
  const maybeAware = agent;
9226
9353
  const activeRunCompletionPromise = isRunCompletionAware(maybeAware) ? maybeAware.activeRunCompletionPromise : void 0;
9227
9354
  if (agent.isRunning && activeRunCompletionPromise) try {
@@ -9229,7 +9356,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9229
9356
  } catch (error) {
9230
9357
  console.error("CopilotChat: in-flight run rejected while queuing send", error);
9231
9358
  }
9359
+ return isCurrentSelection();
9232
9360
  }, [agent]);
9361
+ const enqueueSubmission = useCallback((submit) => {
9362
+ const selection = previousThreadRef.current;
9363
+ const pending = submissionQueueRef.current.then(async () => {
9364
+ if (selection?.active && previousThreadRef.current === selection) await submit();
9365
+ }).catch((error) => {
9366
+ console.error("CopilotChat: queued submission failed", error);
9367
+ });
9368
+ submissionQueueRef.current = pending;
9369
+ return pending;
9370
+ }, []);
9233
9371
  const onSubmitInput = useCallback(async (value) => {
9234
9372
  if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9235
9373
  console.error("[CopilotKit] Cannot send while attachments are uploading (pre-await guard)");
@@ -9237,92 +9375,102 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
9237
9375
  return;
9238
9376
  }
9239
9377
  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({
9378
+ await enqueueSubmission(async () => {
9379
+ const ready = await waitForActiveRunToSettle();
9380
+ if (ready !== true) {
9381
+ if (ready === "failed") setInputValue(value);
9382
+ return;
9383
+ }
9384
+ if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
9385
+ console.error("[CopilotKit] Cannot send while attachments are uploading (post-await re-check)");
9386
+ setTranscriptionError("Cannot send while attachments are uploading.");
9387
+ setInputValue(value);
9388
+ return;
9389
+ }
9390
+ const readyAttachments = consumeAttachments();
9391
+ if (readyAttachments.length > 0) {
9392
+ const contentParts = [];
9393
+ if (value.trim()) contentParts.push({
9394
+ type: "text",
9395
+ text: value
9396
+ });
9397
+ for (const att of readyAttachments) contentParts.push(createAttachmentContent(att));
9398
+ agent.addMessage({
9399
+ id: randomUUID$1(),
9400
+ role: "user",
9401
+ content: contentParts
9402
+ });
9403
+ } else agent.addMessage({
9256
9404
  id: randomUUID$1(),
9257
9405
  role: "user",
9258
- content: contentParts
9259
- });
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 } : {}
9406
+ content: value
9271
9407
  });
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);
9408
+ const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9409
+ if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9410
+ try {
9411
+ await copilotkit.runAgent({
9412
+ agent,
9413
+ ...localRunId !== void 0 ? { runId: localRunId } : {}
9414
+ });
9415
+ } catch (error) {
9416
+ console.error("CopilotChat: runAgent failed", error);
9417
+ } finally {
9418
+ if (localRunId) {
9419
+ activeLocalRunIdsRef.current.delete(localRunId);
9420
+ rememberRecentlyLocalRunId(localRunId);
9421
+ }
9422
+ if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9423
+ const startReconnect = startRunActivityReconnectRef.current;
9424
+ if (startReconnect) {
9425
+ pendingRunActivityReconnectRef.current = false;
9426
+ startReconnect(runActivityReconnectGenerationRef.current);
9427
+ }
9284
9428
  }
9285
9429
  }
9286
- }
9430
+ });
9287
9431
  }, [
9288
9432
  agent,
9289
9433
  consumeAttachments,
9290
9434
  waitForActiveRunToSettle,
9435
+ enqueueSubmission,
9291
9436
  hasNativeIntelligenceRunActivity,
9292
9437
  rememberRecentlyLocalRunId
9293
9438
  ]);
9294
9439
  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 } : {}
9440
+ await enqueueSubmission(async () => {
9441
+ if (await waitForActiveRunToSettle() !== true) return;
9442
+ agent.addMessage({
9443
+ id: randomUUID$1(),
9444
+ role: "user",
9445
+ content: suggestion.message
9307
9446
  });
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);
9447
+ const localRunId = hasNativeIntelligenceRunActivity ? randomUUID$1() : void 0;
9448
+ if (localRunId) activeLocalRunIdsRef.current.add(localRunId);
9449
+ try {
9450
+ await copilotkit.runAgent({
9451
+ agent,
9452
+ ...localRunId !== void 0 ? { runId: localRunId } : {}
9453
+ });
9454
+ } catch (error) {
9455
+ console.error("CopilotChat: runAgent failed after selecting suggestion", error);
9456
+ } finally {
9457
+ if (localRunId) {
9458
+ activeLocalRunIdsRef.current.delete(localRunId);
9459
+ rememberRecentlyLocalRunId(localRunId);
9460
+ }
9461
+ if (pendingRunActivityReconnectRef.current && activeLocalRunIdsRef.current.size === 0 && activeConnectCountRef.current === 0) {
9462
+ const startReconnect = startRunActivityReconnectRef.current;
9463
+ if (startReconnect) {
9464
+ pendingRunActivityReconnectRef.current = false;
9465
+ startReconnect(runActivityReconnectGenerationRef.current);
9466
+ }
9320
9467
  }
9321
9468
  }
9322
- }
9469
+ });
9323
9470
  }, [
9324
9471
  agent,
9325
9472
  waitForActiveRunToSettle,
9473
+ enqueueSubmission,
9326
9474
  hasNativeIntelligenceRunActivity,
9327
9475
  rememberRecentlyLocalRunId
9328
9476
  ]);
@@ -12673,5 +12821,5 @@ function validateProps(props) {
12673
12821
  }
12674
12822
 
12675
12823
  //#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
12824
+ 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 };
12825
+ //# sourceMappingURL=copilotkit-BI7KSQQw.mjs.map