@copilotkit/react-core 2.0.0-rc.7 → 2.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{MarkdownRendererContext-B4Us6mwL.d.cts → MarkdownRendererContext-CS35epe1.d.mts} +17 -33
  2. package/dist/MarkdownRendererContext-CS35epe1.d.mts.map +1 -0
  3. package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-CfTh92vk.d.cts} +17 -33
  4. package/dist/MarkdownRendererContext-CfTh92vk.d.cts.map +1 -0
  5. package/dist/{MarkdownSurfaces-S4wfUl3J.cjs → MarkdownSurfaces-Ije2ZQh0.cjs} +111 -89
  6. package/dist/MarkdownSurfaces-Ije2ZQh0.cjs.map +1 -0
  7. package/dist/{MarkdownSurfaces-Bd--93O1.mjs → MarkdownSurfaces-iFKorV2w.mjs} +95 -80
  8. package/dist/MarkdownSurfaces-iFKorV2w.mjs.map +1 -0
  9. package/dist/context.cjs +20 -17
  10. package/dist/context.cjs.map +1 -1
  11. package/dist/context.d.cts +38 -98
  12. package/dist/context.d.cts.map +1 -1
  13. package/dist/context.d.mts +38 -98
  14. package/dist/context.d.mts.map +1 -1
  15. package/dist/context.mjs +20 -17
  16. package/dist/context.mjs.map +1 -1
  17. package/dist/generative-ui.cjs +541 -520
  18. package/dist/generative-ui.cjs.map +1 -1
  19. package/dist/generative-ui.d.cts +2137 -4178
  20. package/dist/generative-ui.d.cts.map +1 -1
  21. package/dist/generative-ui.d.mts +2137 -4178
  22. package/dist/generative-ui.d.mts.map +1 -1
  23. package/dist/generative-ui.mjs +37 -17
  24. package/dist/generative-ui.mjs.map +1 -1
  25. package/dist/headless.cjs +50 -76
  26. package/dist/headless.cjs.map +1 -1
  27. package/dist/headless.d.cts +78 -253
  28. package/dist/headless.d.cts.map +1 -1
  29. package/dist/headless.d.mts +56 -202
  30. package/dist/headless.d.mts.map +1 -1
  31. package/dist/headless.mjs +43 -74
  32. package/dist/headless.mjs.map +1 -1
  33. package/dist/index.cjs +765 -1292
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +176 -518
  36. package/dist/index.d.cts.map +1 -1
  37. package/dist/index.d.mts +175 -517
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +469 -1251
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/index.umd.js +867 -1375
  42. package/dist/index.umd.js.map +1 -1
  43. package/package.json +15 -16
  44. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
  45. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
  46. package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
  47. package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,23 +1,20 @@
1
1
  "use client";
2
2
 
3
- import { A as GenerativeUIError, B as renderSlot, C as issueKey, D as getMarkdownSurfaceSource, E as containsDynamicValue, F as toJsonSchema, G as useCopilotChatConfiguration, H as ControlledModalOpenScope, I as defineToolCallRenderer, K as useShallowStableRef, L as MarkdownRendererProvider, M as catalogIdsOf, N as componentCatalogIds, O as BASIC_FUNCTIONS, R as useMarkdownRenderer, S as isAsyncIssue, T as withoutRejectedNulls, U as CopilotChatConfigurationProvider, V as cn, W as CopilotChatDefaultLabels, a as GenerativeUIToolCallRenderer, i as GenerativeUIChatSlotContext, j as isRecord, k as ExpressionError, o as createGenerativeUIActivityRenderer, q as StreamingMarkdownDefaultRenderer, s as createGenerativeUIFunctionCallActivityRenderer, t as MarkdownSurfaces, v as GenerativeUIRuntimeContext, w as validateSchemaSync, x as formatIssues, y as useGenerativeUIRuntime, z as isReactComponentType } from "./MarkdownSurfaces-Bd--93O1.mjs";
4
- import { A2UI_FENCE_LANGUAGE, AgentRegistry, AgentThreadLockedError, ContextStore, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, CopilotKitHeaderResolutionError, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, IntelligenceAgent, MEMORY_ERROR_REGISTRY, MemoryError, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, WebMCPRegistry, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInspectorThreadBridgeEnabled as isInspectorThreadBridgeEnabled$1, isRunCompletionAware, isRunCompletionAware as isRunCompletionAware$1, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorStopViewing as onInspectorStopViewing$1, onInspectorViewThread, onInspectorViewThread as onInspectorViewThread$1, onInspectorViewThreadResult, parseMarkdown, parseMarkdown as parseMarkdown$1, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵclearAgentInterruptState, ɵclearAgentInterruptState as ɵclearAgentInterruptState$1, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵgetAgentInterruptState, ɵgetAgentInterruptState as ɵgetAgentInterruptState$1, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisHttpAgent as ɵisHttpAgent$1, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectFetchMoreError as ɵselectFetchMoreError$1, ɵselectHasNextPage, ɵselectHasNextPage as ɵselectHasNextPage$1, ɵselectIsFetchingNextPage, ɵselectIsFetchingNextPage as ɵselectIsFetchingNextPage$1, ɵselectIsMutating, ɵselectIsMutating as ɵselectIsMutating$1, ɵselectMemories, ɵselectMemories as ɵselectMemories$1, ɵselectMemoriesAvailable, ɵselectMemoriesAvailable as ɵselectMemoriesAvailable$1, ɵselectMemoriesError, ɵselectMemoriesError as ɵselectMemoriesError$1, ɵselectMemoriesIsLoading, ɵselectMemoriesIsLoading as ɵselectMemoriesIsLoading$1, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectMemoriesRealtimeStatus as ɵselectMemoriesRealtimeStatus$1, ɵselectThreads, ɵselectThreads as ɵselectThreads$1, ɵselectThreadsError, ɵselectThreadsError as ɵselectThreadsError$1, ɵselectThreadsIsLoading, ɵselectThreadsIsLoading as ɵselectThreadsIsLoading$1, ɵthreadAdapterEvents, ɵwithHeaderDefaults, ɵwithHeaderDefaults as ɵwithHeaderDefaults$1 } from "@copilotkit/core";
3
+ import { A as GenerativeUIError, B as renderSlot, C as issueKey, D as getMarkdownSurfaceSource, E as containsDynamicValue, F as toJsonSchema, G as CopilotIcon, H as CopilotChatConfigurationProvider, I as defineToolCallRenderer, J as StreamingMarkdownDefaultRenderer, L as MarkdownRendererProvider, M as catalogIdsOf, N as componentCatalogIds, O as BASIC_FUNCTIONS, R as useMarkdownRenderer, S as isAsyncIssue, T as withoutRejectedNulls, U as useCopilotChatConfiguration, V as ControlledModalOpenScope, W as useShallowStableRef, a as GenerativeUIToolCallRenderer, i as GenerativeUIChatSlotContext, j as isRecord, k as ExpressionError, o as createGenerativeUIActivityRenderer, q as cn, s as createGenerativeUIFunctionCallActivityRenderer, t as MarkdownSurfaces, v as GenerativeUIRuntimeContext, w as validateSchemaSync, x as formatIssues, y as useGenerativeUIRuntime, z as isReactComponentType } from "./MarkdownSurfaces-iFKorV2w.mjs";
4
+ import { A2UI_FENCE_LANGUAGE, AgentRegistry, AgentThreadLockedError, ContextStore, CopilotChatDefaultLabels, CopilotChatDefaultLabels as CopilotChatDefaultLabels$1, CopilotKitCore, CopilotKitCore as CopilotKitCore$1, CopilotKitCoreErrorCode, CopilotKitCoreErrorCode as CopilotKitCoreErrorCode$1, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreRuntimeConnectionStatus as CopilotKitCoreRuntimeConnectionStatus$1, CopilotKitHeaderResolutionError, DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL, DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL as DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL$1, GENERATE_SANDBOXED_UI_TOOL_NAME, GENERATE_SANDBOXED_UI_TOOL_NAME as GENERATE_SANDBOXED_UI_TOOL_NAME$1, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, INTERRUPT_EVENT_NAME, IntelligenceAgent, MEMORY_ERROR_REGISTRY, MemoryError, OPEN_GENERATIVE_UI_ACTIVITY_TYPE, OPEN_GENERATIVE_UI_ACTIVITY_TYPE as OPEN_GENERATIVE_UI_ACTIVITY_TYPE$1, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgent as ProxiedCopilotRuntimeAgent$1, RunHandler, StateManager, SuggestionEngine, ToolCallStatus, ToolCallStatus as ToolCallStatus$1, TranscriptionError, TranscriptionError as TranscriptionError$1, TranscriptionErrorCode, WebMCPRegistry, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorActiveThread as emitInspectorActiveThread$1, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, emitInspectorViewThreadResult as emitInspectorViewThreadResult$1, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInspectorThreadBridgeEnabled as isInspectorThreadBridgeEnabled$1, isRunCompletionAware, isRunCompletionAware as isRunCompletionAware$1, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorStopViewing as onInspectorStopViewing$1, onInspectorViewThread, onInspectorViewThread as onInspectorViewThread$1, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵInterruptState as ɵInterruptState$1, ɵMAX_SOCKET_RETRIES, ɵOpenGenerativeUIController, ɵOpenGenerativeUIController as ɵOpenGenerativeUIController$1, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵclearAgentInterruptState, ɵclearAgentInterruptState as ɵclearAgentInterruptState$1, ɵcomposerButtonState, ɵcomposerButtonState as ɵcomposerButtonState$1, ɵcopilotIconSvgAttributes, ɵcopilotIcons, ɵcountFailedToolCalls, ɵcountFailedToolCalls as ɵcountFailedToolCalls$1, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵcreateThreadStore as ɵcreateThreadStore$1, ɵdeduplicateMessages, ɵdeduplicateMessages as ɵdeduplicateMessages$1, ɵextractCompleteStyles, ɵformatCountLabel, ɵformatCountLabel as ɵformatCountLabel$1, ɵformatLabel, ɵformatLabel as ɵformatLabel$1, ɵformatReasoningDuration, ɵformatReasoningDuration as ɵformatReasoningDuration$1, ɵformatToolNames, ɵformatToolNames as ɵformatToolNames$1, ɵformatWorkDuration, ɵformatWorkDuration as ɵformatWorkDuration$1, ɵgetAgentInterruptState, ɵgetAgentInterruptState as ɵgetAgentInterruptState$1, ɵgetArgumentPreview, ɵgetArgumentPreview as ɵgetArgumentPreview$1, ɵgetLatestTurnKey, ɵgetLatestTurnKey as ɵgetLatestTurnKey$1, ɵgetToolCallLayouts, ɵgetToolCallLayouts as ɵgetToolCallLayouts$1, ɵgetToolCallPreview, ɵgetToolCallPreview as ɵgetToolCallPreview$1, ɵgetToolCallRendererNames, ɵgetToolCallRendererNames as ɵgetToolCallRendererNames$1, ɵgetToolCallRowStatus, ɵgetToolCallRowStatus as ɵgetToolCallRowStatus$1, ɵgetToolResults, ɵgetTurnWork, ɵgetTurnWork as ɵgetTurnWork$1, ɵgetWorkOpenState, ɵgetWorkOpenState as ɵgetWorkOpenState$1, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisHttpAgent as ɵisHttpAgent$1, ɵisRetryableMemoryStatus, ɵisTurnWorkOpen, ɵisTurnWorkOpen as ɵisTurnWorkOpen$1, ɵisTurnWorking, ɵisTurnWorking as ɵisTurnWorking$1, ɵjoinPhoenixChannel$, ɵloadWebsandbox, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵmessagesFingerprint, ɵmessagesFingerprint as ɵmessagesFingerprint$1, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵpluralize, ɵprocessPartialHtml, ɵrecordWorkTime, ɵrecordWorkTime as ɵrecordWorkTime$1, ɵresolveActivityRenderer, ɵresolveActivityRenderer as ɵresolveActivityRenderer$1, ɵresolveComposerKey, ɵresolveComposerKey as ɵresolveComposerKey$1, ɵresolveCustomMessageRenderers, ɵresolveCustomMessageRenderers as ɵresolveCustomMessageRenderers$1, ɵresolveLicenseState, ɵresolveLicenseState as ɵresolveLicenseState$1, ɵresolveThreadsLicense, ɵresolveToolCallRenderer, ɵresolveToolCallRenderer as ɵresolveToolCallRenderer$1, ɵselectFetchMoreError, ɵselectFetchMoreError as ɵselectFetchMoreError$1, ɵselectHasNextPage, ɵselectHasNextPage as ɵselectHasNextPage$1, ɵselectIsFetchingNextPage, ɵselectIsFetchingNextPage as ɵselectIsFetchingNextPage$1, ɵselectIsMutating, ɵselectIsMutating as ɵselectIsMutating$1, ɵselectMemories, ɵselectMemories as ɵselectMemories$1, ɵselectMemoriesAvailable, ɵselectMemoriesAvailable as ɵselectMemoriesAvailable$1, ɵselectMemoriesError, ɵselectMemoriesError as ɵselectMemoriesError$1, ɵselectMemoriesIsLoading, ɵselectMemoriesIsLoading as ɵselectMemoriesIsLoading$1, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectMemoriesRealtimeStatus as ɵselectMemoriesRealtimeStatus$1, ɵselectThreads, ɵselectThreads as ɵselectThreads$1, ɵselectThreadsError, ɵselectThreadsError as ɵselectThreadsError$1, ɵselectThreadsIsLoading, ɵselectThreadsIsLoading as ɵselectThreadsIsLoading$1, ɵstringifyToolCallPayload, ɵstringifyToolCallPayload as ɵstringifyToolCallPayload$1, ɵthreadAdapterEvents, ɵtranscribeAudio, ɵtranscribeAudio as ɵtranscribeAudio$1, ɵtranscriptionErrorMessageKey, ɵtranscriptionErrorMessageKey as ɵtranscriptionErrorMessageKey$1, ɵwithHeaderDefaults, ɵwithHeaderDefaults as ɵwithHeaderDefaults$1 } from "@copilotkit/core";
5
5
  import { ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError, AGUIError, AGUI_METADATA_KEY, AbstractAgent, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, CompatibilityBoundary, DebugLogger, EventType, FilterToolCallsMiddleware, FunctionMiddleware, HttpAgent, Middleware, PROTOCOL_VERSION, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, compactEvents, contentHasMedia, contentToText, convertToLegacyEvents, createDebugLogger, defaultApplyEvents, enforceEvents, enforceOutgoingInput, getRunOutcome, isInterruptExpired, isRecognizedEvent, mergeMetadata, omitOptionalNulls, parseProtoStream, parseSSEStream, randomUUID, randomUUID as randomUUID$1, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, verifyEvents, withAuthoritativeActivityTypes } from "@ag-ui/client";
6
6
  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";
7
7
  import * as React$1 from "react";
8
8
  import React, { Fragment, createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, version } from "react";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
- import { ArrowUp, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronRightIcon, Circle, Copy, Edit, EyeOff, Loader2, MessageCircle, Mic, PanelLeftOpen, Play, Plus, RefreshCw, Square, ThumbsDown, ThumbsUp, Upload, Volume2, Wrench, X } from "lucide-react";
11
- import { A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_VERSION, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_UI_ENVELOPE_FORMAT, DEFAULT_AGENT_ID, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, TranscriptionErrorCode, TranscriptionErrorCode as TranscriptionErrorCode$1, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childRefKind, commitRowKeyStore, copyToClipboard, createAttachmentContent, createLicenseContextValue, createRowKeyStore, envelopeToManifest, exceedsMaxSize, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIGuideFeatures, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getSourceUrl, matchesAcceptFilter, partialJSONParse, randomUUID as randomUUID$2, readFileAsBase64, resolveRowRenderKeysById, schemaToJsonSchema, shouldEnableInspector, toA2UIActionMessage, validateOperation } from "@copilotkit/shared";
10
+ import { A2UI_COMPONENT_ENVELOPE_KEYS, A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, A2UI_VERSION, COPILOTKIT_FORWARDED_PROPS_KEY, COPILOTKIT_UI_ENVELOPE_FORMAT, DEFAULT_AGENT_ID, GENERATE_SANDBOXED_UI_DESCRIPTION, GENERATIVE_UI_ACTIVITY_TYPE, GENERATIVE_UI_AGENT_FUNCTION_CALLS, GENERATIVE_UI_AGENT_FUNCTION_CALLS_OFF_REASON, GENERATIVE_UI_CHAT_TARGET, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_FUNCTION_CALL_ACTIVITY_TYPE, GENERATIVE_UI_MARKDOWN_GUIDELINES_DESCRIPTION, GENERATIVE_UI_MARKDOWN_SCHEMA_CONTEXT_DESCRIPTION, GENERATIVE_UI_MAX_REJECTION_LENGTH, GENERATIVE_UI_MAX_SUMMARY_REJECTIONS, buildGenerativeUIMarkdownGuidelines, buildGenerativeUIPrompt, callerProblem, childRefKind, commitRowKeyStore, copyToClipboard, createAttachmentContent, createRowKeyStore, envelopeToManifest, exceedsMaxSize, formatFileSize, functionCallers, generateVideoThumbnail, generativeUIGuideFeatures, getDocumentIcon, getModalityFromMimeType, getOperationKind, getOperationSurfaceId, getSourceUrl, matchesAcceptFilter, partialJSONParse, randomUUID as randomUUID$2, readFileAsBase64, resolveRowRenderKeysById, schemaToJsonSchema, shouldEnableInspector, toA2UIActionMessage, validateOperation, ɵanySchema } from "@copilotkit/shared";
12
11
  import { CopilotKitAgentIdContext, CopilotKitContext, LicenseContext, useCopilotKit, useCopilotKit as useCopilotKit$1, useDefaultAgentId, useLicenseContext, useLicenseContext as useLicenseContext$1 } from "@copilotkit/react-core/context";
13
- import { Slot } from "@radix-ui/react-slot";
14
12
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
15
13
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
16
14
  import { contentToText as contentToText$1 } from "@ag-ui/core";
17
- import { z } from "zod";
18
15
  import { MCPAppsActivityContentSchema, MCPAppsActivityType, ɵrunMcpFollowUp } from "@copilotkit/mcp-apps-renderer/activity";
16
+ import * as z from "zod";
19
17
  import { A2UIProvider, A2UIRenderer, A2UI_SCHEMA_CONTEXT_DESCRIPTION, Catalog, DEFAULT_SURFACE_ID, ROOT_COMPONENT_ID, buildCatalogContextValue, defaultTheme as a2uiDefaultTheme, extractCatalogComponentSchemas, filterCatalog, initializeDefaultCatalog, injectStyles, useA2UIActions, useA2UIError, viewerTheme } from "@copilotkit/a2ui-renderer";
20
- import { zodToJsonSchema } from "zod-to-json-schema";
21
18
  import { Catalog as Catalog$1, ComponentModel, DataModel, SurfaceModel } from "@a2ui/web_core/v0_9";
22
19
  import { stylesheet } from "@copilotkit/core/styles";
23
20
  import * as PopoverPrimitive from "@radix-ui/react-popover";
@@ -26,111 +23,6 @@ import { useVirtualizer } from "@tanstack/react-virtual";
26
23
  import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
27
24
  import { COPILOTKIT_THREADS_DRAWER_TAG, defineCopilotKitThreadsDrawer } from "@copilotkit/web-components/threads-drawer";
28
25
 
29
- //#region src/components/chat/BasicMarkdownRenderer.tsx
30
- const SAFE_HREF = /^(https?:|mailto:|tel:|#|\/|\.\/|\.\.\/)/i;
31
- const SAFE_IMG_SRC = /^(https?:|data:image\/(?!svg)|\/|\.\/|\.\.\/)/i;
32
- function sanitizeHref(href) {
33
- if (!href) return void 0;
34
- return SAFE_HREF.test(href.trim()) ? href : void 0;
35
- }
36
- function sanitizeImgSrc(src) {
37
- if (!src) return void 0;
38
- return SAFE_IMG_SRC.test(src.trim()) ? src : void 0;
39
- }
40
- /**
41
- * Dependency-light built-in markdown renderer (basic GFM). Walks the
42
- * framework-agnostic token tree from `@copilotkit/core` into React elements.
43
- * No syntax highlighting, no math, no table/image action buttons — plug in a
44
- * custom renderer via `CopilotKitProvider markdownRenderer={...}` for those.
45
- */
46
- function BasicMarkdownRenderer({ content, className }) {
47
- const tokens = React.useMemo(() => parseMarkdown$1(content ?? ""), [content]);
48
- if (!tokens.length) return null;
49
- return /* @__PURE__ */ jsx("div", {
50
- className,
51
- children: tokens.map((t, i) => /* @__PURE__ */ jsx(BlockToken, { token: t }, i))
52
- });
53
- }
54
- function renderInline(tokens) {
55
- if (!tokens) return null;
56
- return tokens.map((token, i) => {
57
- switch (token.type) {
58
- case "text": return "tokens" in token && token.tokens ? renderInline(token.tokens) : token.text;
59
- case "strong": return /* @__PURE__ */ jsx("strong", { children: renderInline(token.tokens) }, i);
60
- case "em": return /* @__PURE__ */ jsx("em", { children: renderInline(token.tokens) }, i);
61
- case "del": return /* @__PURE__ */ jsx("del", { children: renderInline(token.tokens) }, i);
62
- case "codespan": return /* @__PURE__ */ jsx("code", {
63
- className: "cpk-markdown-inline-code",
64
- children: token.text
65
- }, i);
66
- case "br": return /* @__PURE__ */ jsx("br", {}, i);
67
- case "link": {
68
- const l = token;
69
- return /* @__PURE__ */ jsx("a", {
70
- href: sanitizeHref(l.href),
71
- target: "_blank",
72
- rel: "noopener noreferrer",
73
- children: l.tokens ? renderInline(l.tokens) : l.text
74
- }, i);
75
- }
76
- case "image": {
77
- const img = token;
78
- return /* @__PURE__ */ jsx("img", {
79
- src: sanitizeImgSrc(img.href),
80
- alt: img.text,
81
- className: "cpk-markdown-image"
82
- }, i);
83
- }
84
- case "escape": return token.text;
85
- default: return "text" in token ? token.text : null;
86
- }
87
- });
88
- }
89
- function BlockToken({ token }) {
90
- switch (token.type) {
91
- case "space": return null;
92
- case "heading": {
93
- const h = token;
94
- return /* @__PURE__ */ jsx(`h${Math.min(Math.max(h.depth, 1), 6)}`, { children: renderInline(h.tokens) });
95
- }
96
- case "paragraph": return /* @__PURE__ */ jsx("p", { children: renderInline(token.tokens ?? []) });
97
- case "blockquote": return /* @__PURE__ */ jsx("blockquote", { children: (token.tokens ?? []).map((t, i) => /* @__PURE__ */ jsx(BlockToken, { token: t }, i)) });
98
- case "code": {
99
- const c = token;
100
- return /* @__PURE__ */ jsx("pre", {
101
- className: "cpk-markdown-code-block",
102
- children: /* @__PURE__ */ jsx("code", {
103
- "data-language": c.lang || void 0,
104
- children: c.text
105
- })
106
- });
107
- }
108
- case "hr": return /* @__PURE__ */ jsx("hr", {});
109
- case "list": {
110
- const list = token;
111
- const items = list.items.map((item, i) => /* @__PURE__ */ jsx("li", { children: (item.tokens ?? []).map((t, j) => /* @__PURE__ */ jsx(BlockToken, { token: t }, j)) }, i));
112
- return list.ordered ? /* @__PURE__ */ jsx("ol", {
113
- start: typeof list.start === "number" ? list.start : void 0,
114
- children: items
115
- }) : /* @__PURE__ */ jsx("ul", { children: items });
116
- }
117
- case "table": {
118
- const tbl = token;
119
- return /* @__PURE__ */ jsx("div", {
120
- className: "cpk-markdown-table-container",
121
- children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: tbl.header.map((cell, i) => /* @__PURE__ */ jsx("th", { children: renderInline(cell.tokens) }, i)) }) }), /* @__PURE__ */ jsx("tbody", { children: tbl.rows.map((row, i) => /* @__PURE__ */ jsx("tr", { children: row.map((cell, j) => /* @__PURE__ */ jsx("td", { children: renderInline(cell.tokens) }, j)) }, i)) })] })
122
- });
123
- }
124
- case "text": {
125
- const t = token;
126
- return /* @__PURE__ */ jsx("p", { children: t.tokens ? renderInline(t.tokens) : t.text });
127
- }
128
- default: return "text" in token ? /* @__PURE__ */ jsx("span", { children: token.text }) : null;
129
- }
130
- }
131
- BasicMarkdownRenderer.displayName = "BasicMarkdownRenderer";
132
-
133
- //#endregion
134
26
  //#region src/components/ui/button.tsx
135
27
  const variantClasses = {
136
28
  default: "cpk-button-default",
@@ -158,8 +50,8 @@ const sizeClasses = {
158
50
  function buttonVariants({ variant, size, className, class: classProp } = {}) {
159
51
  return cn("cpk-button", variant !== null && variantClasses[variant ?? "default"], size !== null && sizeClasses[size ?? "default"], classProp, className);
160
52
  }
161
- const Button = React$1.forwardRef(function Button({ className, variant, size, asChild = false, ...props }, ref) {
162
- return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
53
+ const Button = React$1.forwardRef(function Button({ className, variant, size, ...props }, ref) {
54
+ return /* @__PURE__ */ jsx("button", {
163
55
  ref,
164
56
  "data-slot": "button",
165
57
  className: buttonVariants({
@@ -264,7 +156,10 @@ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
264
156
  "data-inset": inset,
265
157
  className: cn("cpk-dropdown-menu-sub-trigger", className),
266
158
  ...props,
267
- children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "cpk-dropdown-menu-sub-trigger-icon" })]
159
+ children: [children, /* @__PURE__ */ jsx(CopilotIcon, {
160
+ name: "ChevronRight",
161
+ className: "cpk-dropdown-menu-sub-trigger-icon"
162
+ })]
268
163
  });
269
164
  }
270
165
  function DropdownMenuSubContent({ className, ...props }) {
@@ -504,7 +399,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
504
399
  const audioRecorderRef = useRef(null);
505
400
  const slashMenuRef = useRef(null);
506
401
  const config = useCopilotChatConfiguration();
507
- const labels = config?.labels ?? CopilotChatDefaultLabels;
402
+ const labels = config?.labels ?? CopilotChatDefaultLabels$1;
508
403
  const previousModalStateRef = useRef(void 0);
509
404
  const measurementCanvasRef = useRef(null);
510
405
  const measurementsRef = useRef({
@@ -625,6 +520,14 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
625
520
  inputRef.current?.focus();
626
521
  });
627
522
  }, [clearInputValue]);
523
+ const composerInput = {
524
+ mode,
525
+ isRunning,
526
+ value: resolvedValue,
527
+ canSubmit: !!onSubmitMessage,
528
+ canStop: !!onStop
529
+ };
530
+ const { isProcessing, action: buttonAction, disabled: buttonDisabled } = ɵcomposerButtonState$1(composerInput);
628
531
  const handleKeyDown = (e) => {
629
532
  if (e.nativeEvent.isComposing || e.keyCode === 229) return;
630
533
  if (commandQuery !== null && mode === "input") {
@@ -663,11 +566,15 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
663
566
  return;
664
567
  }
665
568
  }
666
- if (e.key === "Enter" && !e.shiftKey) {
667
- e.preventDefault();
668
- if (isProcessing && !canSend) onStop?.();
669
- else send();
670
- }
569
+ if (e.key === "Enter" && !e.shiftKey) e.preventDefault();
570
+ const action = ɵresolveComposerKey$1({
571
+ key: e.key,
572
+ shiftKey: e.shiftKey,
573
+ isComposing: e.nativeEvent.isComposing,
574
+ keyCode: e.keyCode
575
+ }, composerInput);
576
+ if (action === "stop") onStop?.();
577
+ else if (action === "send") send();
671
578
  };
672
579
  const send = () => {
673
580
  if (!onSubmitMessage) return;
@@ -692,9 +599,6 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
692
599
  autoFocus,
693
600
  className: isExpanded ? "cpk-chat-input-textarea-expanded" : "cpk-chat-input-textarea-compact"
694
601
  });
695
- const isProcessing = mode !== "transcribe" && isRunning;
696
- const canSend = resolvedValue.trim().length > 0 && !!onSubmitMessage;
697
- const canStop = !!onStop;
698
602
  const handleSendButtonClick = () => {
699
603
  if (isProcessing) {
700
604
  onStop?.();
@@ -703,12 +607,15 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
703
607
  send();
704
608
  };
705
609
  const BoundAudioRecorder = renderSlot(audioRecorder, CopilotChatAudioRecorder, { ref: audioRecorderRef });
706
- const showsStop = isProcessing && canStop;
610
+ const showsStop = buttonAction === "stop";
707
611
  const BoundSendButton = renderSlot(sendButton, CopilotChatInput.SendButton, {
708
612
  onClick: handleSendButtonClick,
709
- disabled: isProcessing ? !canStop : !canSend,
613
+ disabled: buttonDisabled,
710
614
  "aria-label": showsStop ? labels.chatInputToolbarStopButtonLabel : labels.chatInputToolbarSendButtonLabel,
711
- children: showsStop ? /* @__PURE__ */ jsx(Square, { className: "cpk-chat-input-stop-icon" }) : void 0
615
+ children: showsStop ? /* @__PURE__ */ jsx(CopilotIcon, {
616
+ name: "Square",
617
+ className: "cpk-chat-input-stop-icon"
618
+ }) : void 0
712
619
  });
713
620
  const BoundStartTranscribeButton = renderSlot(startTranscribeButton, CopilotChatInput.StartTranscribeButton, { onClick: onStartTranscribe });
714
621
  const BoundCancelTranscribeButton = renderSlot(cancelTranscribeButton, CopilotChatInput.CancelTranscribeButton, { onClick: onCancelTranscribe });
@@ -965,7 +872,10 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
965
872
  className: "cpk-chat-input-field",
966
873
  children: mode === "transcribe" ? BoundAudioRecorder : mode === "processing" ? /* @__PURE__ */ jsx("div", {
967
874
  className: "cpk-chat-input-processing",
968
- children: /* @__PURE__ */ jsx(Loader2, { className: "cpk-chat-input-processing-spinner" })
875
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
876
+ name: "Loader2",
877
+ className: "cpk-chat-input-processing-spinner"
878
+ })
969
879
  }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [BoundTextArea, slashMenu] })
970
880
  }),
971
881
  /* @__PURE__ */ jsx("div", {
@@ -1025,7 +935,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1025
935
  }
1026
936
  (function(_CopilotChatInput) {
1027
937
  _CopilotChatInput.SendButton = ({ className, children, ...props }) => {
1028
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
938
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
1029
939
  return /* @__PURE__ */ jsx("div", {
1030
940
  className: "cpk-chat-input-send",
1031
941
  children: /* @__PURE__ */ jsx(Button, {
@@ -1036,12 +946,15 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1036
946
  className: cn("cpk-chat-input-send-button", className),
1037
947
  "aria-label": labels.chatInputToolbarSendButtonLabel,
1038
948
  ...props,
1039
- children: children ?? /* @__PURE__ */ jsx(ArrowUp, { className: "cpk-chat-input-send-icon" })
949
+ children: children ?? /* @__PURE__ */ jsx(CopilotIcon, {
950
+ name: "ArrowUp",
951
+ className: "cpk-chat-input-send-icon"
952
+ })
1040
953
  })
1041
954
  });
1042
955
  };
1043
956
  const ToolbarButton = _CopilotChatInput.ToolbarButton = ({ icon, labelKey, defaultClassName, className, ...props }) => {
1044
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
957
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
1045
958
  return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
1046
959
  asChild: true,
1047
960
  children: /* @__PURE__ */ jsx(Button, {
@@ -1060,27 +973,36 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1060
973
  };
1061
974
  _CopilotChatInput.StartTranscribeButton = (props) => /* @__PURE__ */ jsx(ToolbarButton, {
1062
975
  "data-testid": "copilot-start-transcribe-button",
1063
- icon: /* @__PURE__ */ jsx(Mic, { className: "cpk-chat-input-toolbar-icon" }),
976
+ icon: /* @__PURE__ */ jsx(CopilotIcon, {
977
+ name: "Mic",
978
+ className: "cpk-chat-input-toolbar-icon"
979
+ }),
1064
980
  labelKey: "chatInputToolbarStartTranscribeButtonLabel",
1065
981
  defaultClassName: "cpk-chat-input-start-transcribe-button",
1066
982
  ...props
1067
983
  });
1068
984
  _CopilotChatInput.CancelTranscribeButton = (props) => /* @__PURE__ */ jsx(ToolbarButton, {
1069
985
  "data-testid": "copilot-cancel-transcribe-button",
1070
- icon: /* @__PURE__ */ jsx(X, { className: "cpk-chat-input-toolbar-icon" }),
986
+ icon: /* @__PURE__ */ jsx(CopilotIcon, {
987
+ name: "X",
988
+ className: "cpk-chat-input-toolbar-icon"
989
+ }),
1071
990
  labelKey: "chatInputToolbarCancelTranscribeButtonLabel",
1072
991
  defaultClassName: "cpk-chat-input-cancel-transcribe-button",
1073
992
  ...props
1074
993
  });
1075
994
  _CopilotChatInput.FinishTranscribeButton = (props) => /* @__PURE__ */ jsx(ToolbarButton, {
1076
995
  "data-testid": "copilot-finish-transcribe-button",
1077
- icon: /* @__PURE__ */ jsx(Check, { className: "cpk-chat-input-toolbar-icon" }),
996
+ icon: /* @__PURE__ */ jsx(CopilotIcon, {
997
+ name: "Check",
998
+ className: "cpk-chat-input-toolbar-icon"
999
+ }),
1078
1000
  labelKey: "chatInputToolbarFinishTranscribeButtonLabel",
1079
1001
  defaultClassName: "cpk-chat-input-finish-transcribe-button",
1080
1002
  ...props
1081
1003
  });
1082
1004
  _CopilotChatInput.AddMenuButton = ({ className, toolsMenu, onAddFile, disabled, ...props }) => {
1083
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
1005
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
1084
1006
  const [mounted, setMounted] = useState(false);
1085
1007
  useEffect(() => setMounted(true), []);
1086
1008
  const menuItems = useMemo(() => {
@@ -1122,7 +1044,10 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1122
1044
  disabled: isDisabled,
1123
1045
  "aria-label": labels.chatInputToolbarAddButtonLabel,
1124
1046
  ...props,
1125
- children: /* @__PURE__ */ jsx(Plus, { className: "cpk-chat-input-add-menu-icon" })
1047
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
1048
+ name: "Plus",
1049
+ className: "cpk-chat-input-add-menu-icon"
1050
+ })
1126
1051
  });
1127
1052
  if (!mounted) return button;
1128
1053
  return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
@@ -1148,7 +1073,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1148
1073
  };
1149
1074
  _CopilotChatInput.TextArea = forwardRef(function TextArea({ style, className, autoFocus, placeholder, ...props }, ref) {
1150
1075
  const internalTextareaRef = useRef(null);
1151
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
1076
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
1152
1077
  useImperativeHandle(ref, () => internalTextareaRef.current);
1153
1078
  useEffect(() => {
1154
1079
  if (autoFocus) internalTextareaRef.current?.focus({ preventScroll: true });
@@ -1169,7 +1094,7 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1169
1094
  });
1170
1095
  _CopilotChatInput.AudioRecorder = CopilotChatAudioRecorder;
1171
1096
  _CopilotChatInput.Disclaimer = ({ className, ...props }) => {
1172
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
1097
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
1173
1098
  return /* @__PURE__ */ jsx("div", {
1174
1099
  className: cn("cpk-chat-input-disclaimer", className),
1175
1100
  ...props,
@@ -1265,16 +1190,7 @@ function useToolCallRenderers() {
1265
1190
  */
1266
1191
  function useToolCallRendererNames() {
1267
1192
  const renderers = useToolCallRenderers();
1268
- return useMemo(() => {
1269
- const named = renderers.filter((rc) => rc.name !== "*");
1270
- const wildcards = renderers.filter((rc) => rc.name === "*");
1271
- return {
1272
- named: new Set(named.map((rc) => rc.name)),
1273
- groupedNames: new Set(named.filter((rc) => rc.group).map((rc) => rc.name)),
1274
- wildcard: wildcards.length > 0,
1275
- wildcardGroups: wildcards.some((rc) => rc.group)
1276
- };
1277
- }, [renderers]);
1193
+ return useMemo(() => ɵgetToolCallRendererNames$1(renderers), [renderers]);
1278
1194
  }
1279
1195
  /**
1280
1196
  * Hook that returns a function to render tool calls based on the render functions
@@ -1289,18 +1205,17 @@ function useRenderToolCall() {
1289
1205
  const warnedToolNames = useRef(/* @__PURE__ */ new Set());
1290
1206
  const renderToolCalls = useToolCallRenderers();
1291
1207
  const renderToolCall = useCallback(({ toolCall, toolMessage }) => {
1292
- const exactMatches = renderToolCalls.filter((rc) => rc.name === toolCall.function.name);
1293
- const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
1208
+ const renderConfig = ɵresolveToolCallRenderer$1(renderToolCalls, toolCall.function.name, agentId);
1294
1209
  if (!renderConfig) {
1295
1210
  if (IS_DEVELOPMENT$1) unrenderedToolNames.current.add(toolCall.function.name);
1296
1211
  return null;
1297
1212
  }
1298
- const RenderComponent = renderConfig.render;
1213
+ const isExecuting = executingToolCallIds.has(toolCall.id);
1299
1214
  return /* @__PURE__ */ jsx(ToolCallRenderer, {
1300
1215
  toolCall,
1301
1216
  toolMessage,
1302
- RenderComponent,
1303
- isExecuting: executingToolCallIds.has(toolCall.id)
1217
+ RenderComponent: renderConfig.render,
1218
+ isExecuting
1304
1219
  }, toolCall.id);
1305
1220
  }, [
1306
1221
  renderToolCalls,
@@ -1322,7 +1237,7 @@ function useRenderToolCall() {
1322
1237
 
1323
1238
  //#endregion
1324
1239
  //#region package.json
1325
- var version$1 = "2.0.0-rc.7";
1240
+ var version$1 = "2.0.0-rc.9";
1326
1241
 
1327
1242
  //#endregion
1328
1243
  //#region src/components/CopilotKitInspector.tsx
@@ -1393,6 +1308,15 @@ function useCopilotKitInspector() {
1393
1308
 
1394
1309
  //#endregion
1395
1310
  //#region src/components/license-warning-banner.tsx
1311
+ const labels = CopilotChatDefaultLabels$1;
1312
+ /**
1313
+ * The "expires soon" banner text. Without a day count it says "soon", never
1314
+ * "in undefined days".
1315
+ */
1316
+ function expiringMessage(graceRemaining) {
1317
+ if (graceRemaining === void 0) return labels.licenseExpiringText;
1318
+ return ɵformatLabel$1(graceRemaining === 1 ? labels.licenseExpiringInDaysOne : labels.licenseExpiringInDaysOther, { days: graceRemaining });
1319
+ }
1396
1320
  const LICENSE_BANNER_OFFSET_PX = 52;
1397
1321
  const LICENSE_BANNER_OFFSET_VAR = "--copilotkit-license-banner-offset";
1398
1322
  const BANNER_STYLES = {
@@ -1483,36 +1407,36 @@ function LicenseWarningBanner({ type, featureName, expiryDate, graceRemaining, o
1483
1407
  switch (type) {
1484
1408
  case "no_license": return /* @__PURE__ */ jsx(BannerShell, {
1485
1409
  severity: "info",
1486
- message: "Powered by CopilotKit",
1487
- actionLabel: "Get a license",
1410
+ message: labels.licensePoweredByText,
1411
+ actionLabel: labels.licenseGetLicenseLabel,
1488
1412
  actionUrl: "https://copilotkit.ai/pricing",
1489
1413
  onDismiss
1490
1414
  });
1491
1415
  case "feature_unlicensed": return /* @__PURE__ */ jsx(BannerShell, {
1492
1416
  severity: "warning",
1493
- message: `⚠ The "${featureName}" feature requires a CopilotKit license.`,
1494
- actionLabel: "Get a license",
1417
+ message: ɵformatLabel$1(labels.licenseFeatureUnlicensedText, { feature: featureName ?? "" }),
1418
+ actionLabel: labels.licenseGetLicenseLabel,
1495
1419
  actionUrl: "https://copilotkit.ai/pricing",
1496
1420
  onDismiss
1497
1421
  });
1498
1422
  case "expiring": return /* @__PURE__ */ jsx(BannerShell, {
1499
1423
  severity: "warning",
1500
- message: `Your CopilotKit license expires in ${graceRemaining} day${graceRemaining !== 1 ? "s" : ""}. Please renew.`,
1501
- actionLabel: "Renew",
1424
+ message: expiringMessage(graceRemaining),
1425
+ actionLabel: labels.licenseRenewLabel,
1502
1426
  actionUrl: "https://dashboard.operations.copilotkit.ai",
1503
1427
  onDismiss
1504
1428
  });
1505
1429
  case "expired": return /* @__PURE__ */ jsx(BannerShell, {
1506
1430
  severity: "critical",
1507
- message: `Your CopilotKit license expired${expiryDate ? ` on ${expiryDate}` : ""}. Please renew at copilotkit.ai/pricing`,
1508
- actionLabel: "Renew now",
1431
+ message: expiryDate ? ɵformatLabel$1(labels.licenseExpiredOnDateText, { date: expiryDate }) : labels.licenseExpiredText,
1432
+ actionLabel: labels.licenseRenewNowLabel,
1509
1433
  actionUrl: "https://copilotkit.ai/pricing",
1510
1434
  onDismiss
1511
1435
  });
1512
1436
  case "invalid": return /* @__PURE__ */ jsx(BannerShell, {
1513
1437
  severity: "critical",
1514
- message: "Invalid CopilotKit license token. Please check your configuration.",
1515
- actionLabel: "Get a license",
1438
+ message: labels.licenseInvalidText,
1439
+ actionLabel: labels.licenseGetLicenseLabel,
1516
1440
  actionUrl: "https://copilotkit.ai/pricing",
1517
1441
  onDismiss
1518
1442
  });
@@ -1531,9 +1455,7 @@ function InlineFeatureWarning({ featureName }) {
1531
1455
  fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif"
1532
1456
  },
1533
1457
  children: [
1534
- "⚠ The \"",
1535
- featureName,
1536
- "\" feature requires a CopilotKit license.",
1458
+ ɵformatLabel$1(labels.licenseFeatureUnlicensedText, { feature: featureName }),
1537
1459
  " ",
1538
1460
  /* @__PURE__ */ jsx("a", {
1539
1461
  href: "https://copilotkit.ai/pricing",
@@ -1705,44 +1627,9 @@ function useSandboxFunctions() {
1705
1627
  return useContext(SandboxFunctionsContext);
1706
1628
  }
1707
1629
 
1708
- //#endregion
1709
- //#region src/lib/processPartialHtml.ts
1710
- /**
1711
- * Extracts all complete `<style>` blocks from the raw HTML.
1712
- * Returns the concatenated style tags, suitable for injection into `<head>`.
1713
- */
1714
- function extractCompleteStyles(html) {
1715
- const matches = html.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi);
1716
- return matches ? matches.join("") : "";
1717
- }
1718
- /**
1719
- * Processes raw accumulated HTML for safe preview via innerHTML injection.
1720
- * Pure function, no DOM dependencies.
1721
- *
1722
- * Pipeline (order matters):
1723
- * 1. Strip incomplete tag at end
1724
- * 2. Strip complete <style>, <script>, and <head> blocks
1725
- * 3. Strip incomplete <style>/<script>/<head> blocks
1726
- * 4. Strip incomplete HTML entities
1727
- * 5. Extract body content (or use full string if no <body>)
1728
- */
1729
- function processPartialHtml(html) {
1730
- let result = html;
1731
- result = result.replace(/<[^>]*$/, "");
1732
- result = result.replace(/<(style|script|head)\b[^>]*>[\s\S]*?<\/\1>/gi, "");
1733
- result = result.replace(/<(style|script|head)\b[^>]*>[\s\S]*$/gi, "");
1734
- result = result.replace(/&[a-zA-Z0-9#]*$/, "");
1735
- const bodyMatch = result.match(/<body[^>]*>([\s\S]*)/i);
1736
- if (bodyMatch) {
1737
- result = bodyMatch[1];
1738
- result = result.replace(/<\/body>[\s\S]*/i, "");
1739
- }
1740
- return result;
1741
- }
1742
-
1743
1630
  //#endregion
1744
1631
  //#region src/components/OpenGenerativeUIRenderer.tsx
1745
- const OpenGenerativeUIActivityType = "open-generative-ui";
1632
+ const OpenGenerativeUIActivityType = OPEN_GENERATIVE_UI_ACTIVITY_TYPE$1;
1746
1633
  const OpenGenerativeUIContentSchema = z.object({
1747
1634
  initialHeight: z.number().optional(),
1748
1635
  generating: z.boolean().optional(),
@@ -1767,262 +1654,36 @@ const GenerateSandboxedUiArgsSchema = z.object({
1767
1654
  jsFunctions: z.string().optional(),
1768
1655
  jsExpressions: z.array(z.string()).optional()
1769
1656
  });
1770
- const THROTTLE_MS = 1e3;
1771
1657
  /**
1772
- * Returns true when the inner component should re-render immediately
1773
- * (no throttle delay).
1774
- */
1775
- function shouldFlushImmediately(prev, next) {
1776
- if (next.cssComplete && (!prev || !prev.cssComplete)) return true;
1777
- if (next.htmlComplete) return true;
1778
- if (next.generating === false) return true;
1779
- if (next.jsFunctions && (!prev || !prev.jsFunctions)) return true;
1780
- if ((next.jsExpressions?.length ?? 0) > (prev?.jsExpressions?.length ?? 0)) return true;
1781
- if (next.html?.length && (!prev || !prev.html?.length)) return true;
1782
- return false;
1783
- }
1784
- /**
1785
- * Outer wrapper — absorbs every parent re-render but only forwards
1786
- * throttled content snapshots to the memoized inner component.
1658
+ * Renders an Open Generative UI activity. The core controller throttles the
1659
+ * content and runs the websandbox iframes inside the container div.
1787
1660
  */
1788
1661
  const OpenGenerativeUIActivityRenderer = function OpenGenerativeUIActivityRenderer({ content }) {
1789
- const latestContentRef = useRef(content);
1790
- latestContentRef.current = content;
1791
- const [throttledContent, setThrottledContent] = useState(content);
1792
- const throttledContentRef = useRef(throttledContent);
1793
- const timerRef = useRef(null);
1794
- if (throttledContentRef.current !== content) {
1795
- if (shouldFlushImmediately(throttledContentRef.current, content)) {
1796
- if (timerRef.current !== null) {
1797
- clearTimeout(timerRef.current);
1798
- timerRef.current = null;
1799
- }
1800
- throttledContentRef.current = content;
1801
- setThrottledContent(content);
1802
- }
1803
- }
1804
- const flush = useCallback(() => {
1805
- timerRef.current = null;
1806
- const latest = latestContentRef.current;
1807
- throttledContentRef.current = latest;
1808
- setThrottledContent(latest);
1809
- }, []);
1810
- useEffect(() => {
1811
- if (throttledContentRef.current === content) return;
1812
- if (timerRef.current === null) timerRef.current = setTimeout(flush, THROTTLE_MS);
1813
- }, [content, flush]);
1814
- useEffect(() => {
1815
- return () => {
1816
- if (timerRef.current !== null) clearTimeout(timerRef.current);
1817
- };
1818
- }, []);
1819
- return /* @__PURE__ */ jsx(OpenGenerativeUIActivityRendererInner, { content: throttledContent });
1820
- };
1821
- function ensureHead(html) {
1822
- if (/<head[\s>]/i.test(html)) return html;
1823
- return `<head></head>${html}`;
1824
- }
1825
- function injectCssIntoHtml(html, css) {
1826
- const headCloseIdx = html.indexOf("</head>");
1827
- if (headCloseIdx !== -1) return html.slice(0, headCloseIdx) + `<style>${css}</style>` + html.slice(headCloseIdx);
1828
- return `<head><style>${css}</style></head>${html}`;
1829
- }
1830
- const OpenGenerativeUIActivityRendererInner = React.memo(function OpenGenerativeUIActivityRendererInner({ content }) {
1831
- const initialHeight = content.initialHeight ?? 200;
1832
- const [autoHeight, setAutoHeight] = useState(null);
1662
+ const [controller] = useState(() => {
1663
+ const created = new ɵOpenGenerativeUIController$1();
1664
+ created.setContent(content);
1665
+ return created;
1666
+ });
1833
1667
  const sandboxFunctions = useSandboxFunctions();
1834
- const localApi = useMemo(() => {
1835
- const api = {};
1836
- for (const fn of sandboxFunctions) api[fn.name] = fn.handler;
1837
- return api;
1838
- }, [sandboxFunctions]);
1839
- const fullHtml = content.htmlComplete && content.html?.length ? content.html.join("") : void 0;
1840
- const css = content.cssComplete ? content.css : void 0;
1841
- const cssReady = !!content.cssComplete;
1842
- const partialHtml = !content.htmlComplete && content.html?.length ? content.html.join("") : void 0;
1843
- const previewBody = partialHtml ? processPartialHtml(partialHtml) : void 0;
1844
- const previewStyles = partialHtml ? extractCompleteStyles(partialHtml) : "";
1845
- const hasPreview = cssReady && !!previewBody?.trim();
1846
- const hasVisibleSandbox = !!fullHtml || hasPreview;
1847
1668
  const containerRef = useRef(null);
1848
- const sandboxRef = useRef(null);
1849
- const previewSandboxRef = useRef(null);
1850
- const previewReadyRef = useRef(false);
1851
- const sandboxReadyRef = useRef(false);
1852
- const executedIndexRef = useRef(0);
1853
- const pendingQueueRef = useRef([]);
1854
- const jsFunctionsInjectedRef = useRef(false);
1855
- useEffect(() => {
1856
- const container = containerRef.current;
1857
- if (!container || fullHtml || !hasPreview || previewSandboxRef.current) return;
1858
- let cancelled = false;
1859
- import("@jetbrains/websandbox").then((mod) => {
1860
- if (cancelled) return;
1861
- const sandbox = (mod.default?.default ?? mod.default).create({}, {
1862
- frameContainer: container,
1863
- frameContent: "<head></head><body></body>",
1864
- allowAdditionalAttributes: ""
1865
- });
1866
- previewSandboxRef.current = sandbox;
1867
- sandbox.iframe.style.width = "100%";
1868
- sandbox.iframe.style.height = "100%";
1869
- sandbox.iframe.style.border = "none";
1870
- sandbox.iframe.style.backgroundColor = "transparent";
1871
- sandbox.promise.then(() => {
1872
- if (cancelled) return;
1873
- previewReadyRef.current = true;
1874
- sandbox.run(`
1875
- var s = document.createElement('style');
1876
- s.textContent = 'html, body { overflow: hidden !important; }';
1877
- document.head.appendChild(s);
1878
- `);
1879
- const headParts = [];
1880
- if (css) headParts.push(`<style>${css}</style>`);
1881
- if (previewStyles) headParts.push(previewStyles);
1882
- if (headParts.length) sandbox.run(`document.head.innerHTML = ${JSON.stringify(headParts.join(""))}`);
1883
- if (previewBody) sandbox.run(`document.body.innerHTML = ${JSON.stringify(previewBody)}`);
1884
- });
1885
- }).catch((err) => {
1886
- console.error("[OpenGenerativeUI] Failed to load sandbox module:", err);
1887
- });
1888
- return () => {
1889
- cancelled = true;
1890
- };
1891
- }, [hasPreview, fullHtml]);
1892
- useEffect(() => {
1893
- if (!previewSandboxRef.current || !previewReadyRef.current) return;
1894
- const headParts = [];
1895
- if (css) headParts.push(`<style>${css}</style>`);
1896
- if (previewStyles) headParts.push(previewStyles);
1897
- if (headParts.length) previewSandboxRef.current.run(`document.head.innerHTML = ${JSON.stringify(headParts.join(""))}`);
1898
- if (!previewBody) return;
1899
- previewSandboxRef.current.run(`document.body.innerHTML = ${JSON.stringify(previewBody)}`);
1900
- }, [
1901
- previewBody,
1902
- previewStyles,
1903
- css
1904
- ]);
1905
- useEffect(() => {
1906
- const container = containerRef.current;
1907
- if (!container || !fullHtml) return;
1908
- if (previewSandboxRef.current) {
1909
- previewSandboxRef.current.destroy();
1910
- previewSandboxRef.current = null;
1911
- previewReadyRef.current = false;
1912
- }
1913
- let cancelled = false;
1914
- executedIndexRef.current = 0;
1915
- jsFunctionsInjectedRef.current = false;
1916
- sandboxReadyRef.current = false;
1917
- pendingQueueRef.current = [];
1918
- const htmlContent = css ? injectCssIntoHtml(fullHtml, css) : fullHtml;
1919
- import("@jetbrains/websandbox").then((mod) => {
1920
- if (cancelled) return;
1921
- const sandbox = (mod.default?.default ?? mod.default).create(localApi, {
1922
- frameContainer: container,
1923
- frameContent: ensureHead(htmlContent),
1924
- allowAdditionalAttributes: ""
1925
- });
1926
- sandboxRef.current = sandbox;
1927
- sandbox.iframe.style.width = "100%";
1928
- sandbox.iframe.style.height = "100%";
1929
- sandbox.iframe.style.border = "none";
1930
- sandbox.iframe.style.backgroundColor = "transparent";
1931
- sandbox.promise.then(() => {
1932
- if (cancelled) return;
1933
- sandboxReadyRef.current = true;
1934
- sandbox.run(`
1935
- var s = document.createElement('style');
1936
- s.textContent = 'html, body { overflow: hidden !important; }';
1937
- document.head.appendChild(s);
1938
- `);
1939
- const queue = pendingQueueRef.current;
1940
- pendingQueueRef.current = [];
1941
- for (const code of queue) sandbox.run(code);
1942
- });
1943
- }).catch((err) => {
1944
- console.error("[OpenGenerativeUI] Failed to load sandbox module:", err);
1945
- });
1946
- return () => {
1947
- cancelled = true;
1948
- if (previewSandboxRef.current) {
1949
- previewSandboxRef.current.destroy();
1950
- previewSandboxRef.current = null;
1951
- previewReadyRef.current = false;
1952
- }
1953
- if (sandboxRef.current) {
1954
- sandboxRef.current.destroy();
1955
- sandboxRef.current = null;
1956
- }
1957
- sandboxReadyRef.current = false;
1958
- setAutoHeight(null);
1959
- };
1960
- }, [
1961
- fullHtml,
1962
- css,
1963
- localApi
1964
- ]);
1669
+ const state = useSyncExternalStore(controller.subscribe, controller.getState, controller.getState);
1965
1670
  useEffect(() => {
1966
- if (!content.jsFunctions || jsFunctionsInjectedRef.current) return;
1967
- jsFunctionsInjectedRef.current = true;
1968
- const sandbox = sandboxRef.current;
1969
- if (sandboxReadyRef.current && sandbox) sandbox.run(content.jsFunctions);
1970
- else pendingQueueRef.current.push(content.jsFunctions);
1971
- }, [content.jsFunctions]);
1671
+ controller.setSandboxFunctions(sandboxFunctions);
1672
+ }, [controller, sandboxFunctions]);
1972
1673
  useEffect(() => {
1973
- const expressions = content.jsExpressions;
1974
- if (!expressions || expressions.length === 0) return;
1975
- const startIndex = executedIndexRef.current;
1976
- if (startIndex >= expressions.length) return;
1977
- const newExprs = expressions.slice(startIndex);
1978
- executedIndexRef.current = expressions.length;
1979
- const sandbox = sandboxRef.current;
1980
- if (sandboxReadyRef.current && sandbox) (async () => {
1981
- for (const expr of newExprs) await sandbox.run(expr);
1982
- })();
1983
- else pendingQueueRef.current.push(...newExprs);
1984
- }, [content.jsExpressions?.length]);
1985
- const generationDone = content.generating === false;
1674
+ controller.setContent(content);
1675
+ }, [controller, content]);
1986
1676
  useEffect(() => {
1987
- const sandbox = sandboxRef.current;
1988
- if (!generationDone || !sandbox) return;
1989
- let handled = false;
1990
- const onMessage = (e) => {
1991
- if (handled) return;
1992
- if (e.source === sandbox.iframe.contentWindow && e.data?.type === "__ck_resize") {
1993
- handled = true;
1994
- setAutoHeight(e.data.height);
1995
- window.removeEventListener("message", onMessage);
1996
- }
1997
- };
1998
- window.addEventListener("message", onMessage);
1999
- const measureOnce = `
2000
- (function() {
2001
- var s = document.createElement('style');
2002
- s.textContent = 'body { height: auto !important; min-height: 0 !important; }';
2003
- document.head.appendChild(s);
2004
- var h = document.body.scrollHeight;
2005
- var cs = getComputedStyle(document.body);
2006
- h += parseFloat(cs.marginTop) || 0;
2007
- h += parseFloat(cs.marginBottom) || 0;
2008
- s.remove();
2009
- parent.postMessage({ type: "__ck_resize", height: Math.ceil(h) }, "*");
2010
- })();
2011
- `;
2012
- if (sandboxReadyRef.current) sandbox.run(measureOnce);
2013
- else pendingQueueRef.current.push(measureOnce);
2014
- return () => {
2015
- window.removeEventListener("message", onMessage);
2016
- };
2017
- }, [generationDone]);
2018
- const height = autoHeight ?? initialHeight;
2019
- const isGenerating = content.generating !== false;
1677
+ controller.setHost(containerRef.current);
1678
+ return () => controller.destroy();
1679
+ }, [controller]);
1680
+ const hasVisibleSandbox = state.phase !== "placeholder";
2020
1681
  return /* @__PURE__ */ jsx("div", {
2021
1682
  ref: containerRef,
2022
1683
  style: {
2023
1684
  position: "relative",
2024
1685
  width: "100%",
2025
- height: `${height}px`,
1686
+ height: `${state.height}px`,
2026
1687
  borderRadius: "8px",
2027
1688
  backgroundColor: hasVisibleSandbox ? "transparent" : "#f5f5f5",
2028
1689
  border: hasVisibleSandbox ? "none" : "1px solid #e0e0e0",
@@ -2031,7 +1692,7 @@ const OpenGenerativeUIActivityRendererInner = React.memo(function OpenGenerative
2031
1692
  justifyContent: hasVisibleSandbox ? void 0 : "center",
2032
1693
  overflow: "hidden"
2033
1694
  },
2034
- children: isGenerating && /* @__PURE__ */ jsxs("div", {
1695
+ children: state.generating && /* @__PURE__ */ jsxs("div", {
2035
1696
  style: {
2036
1697
  position: "absolute",
2037
1698
  inset: 0,
@@ -2063,7 +1724,7 @@ const OpenGenerativeUIActivityRendererInner = React.memo(function OpenGenerative
2063
1724
  }), /* @__PURE__ */ jsx("style", { children: `@keyframes ck-spin { to { transform: rotate(360deg) } }` })]
2064
1725
  })
2065
1726
  });
2066
- }, (prev, next) => prev.content === next.content);
1727
+ };
2067
1728
  /**
2068
1729
  * Frontend tool renderer for generateSandboxedUi.
2069
1730
  * Displays placeholder messages while the UI is being generated.
@@ -2100,7 +1761,7 @@ const OpenGenerativeUIToolRenderer = function OpenGenerativeUIToolRenderer(props
2100
1761
  //#region src/a2ui/A2UIRecoveryStates.tsx
2101
1762
  /**
2102
1763
  * The pre-paint lifecycle fields the middleware stamps onto the `a2ui-surface`
2103
- * activity content (alongside `a2ui_operations` on paint). `.passthrough()` keeps
1764
+ * activity content (alongside `a2ui_operations` on paint). `.loose()` keeps
2104
1765
  * `a2ui_operations` and any future fields intact.
2105
1766
  */
2106
1767
  const A2UILifecycleFields = {
@@ -2506,12 +2167,12 @@ function ensureInitialized() {
2506
2167
  * stable messageId (OSS-162): pre-paint `status` ("building" | "retrying" |
2507
2168
  * "failed") with recovery detail, then `a2ui_operations` on paint. The states
2508
2169
  * swap in place, so the painted surface replaces the skeleton with no extra
2509
- * coordination. `.passthrough()` preserves operations + any future fields.
2170
+ * coordination. `.loose()` preserves operations + any future fields.
2510
2171
  */
2511
2172
  const A2UISurfaceContentSchema = z.object({
2512
2173
  a2ui_operations: z.array(z.any()).optional(),
2513
2174
  ...A2UILifecycleFields
2514
- }).passthrough();
2175
+ }).loose();
2515
2176
  const IS_DEVELOPMENT = process.env.NODE_ENV !== "production";
2516
2177
  /**
2517
2178
  * How long to wait for a surface to report its first paint before giving up on
@@ -4764,9 +4425,28 @@ function useGenerativeUIRoot(copilotkit, config) {
4764
4425
 
4765
4426
  //#endregion
4766
4427
  //#region src/lib/react-core.ts
4428
+ /**
4429
+ * Wait for pending React state updates before the follow-up agent run.
4430
+ *
4431
+ * When a frontend tool handler calls setState(), React 18 batches the update
4432
+ * and schedules a commit via its internal scheduler (MessageChannel). The
4433
+ * useAgentContext hook registers context via useLayoutEffect, which runs
4434
+ * synchronously after React commits that batch.
4435
+ *
4436
+ * Awaiting a zero-delay timeout yields to the macrotask queue. React's
4437
+ * MessageChannel task runs first, committing the pending state and running
4438
+ * useLayoutEffect (which updates the context store). The follow-up runAgent
4439
+ * call then reads fresh context.
4440
+ */
4441
+ function waitForReactCommit() {
4442
+ return new Promise((resolve) => setTimeout(resolve, 0));
4443
+ }
4767
4444
  var CopilotKitCoreReact = class extends CopilotKitCore$1 {
4768
4445
  constructor(config) {
4769
- super(config);
4446
+ super({
4447
+ ...config,
4448
+ ɵwaitForFrameworkUpdates: waitForReactCommit
4449
+ });
4770
4450
  this._renderToolCalls = [];
4771
4451
  this._hookRenderToolCalls = /* @__PURE__ */ new Map();
4772
4452
  this._cachedMergedRenderToolCalls = null;
@@ -4840,22 +4520,6 @@ var CopilotKitCoreReact = class extends CopilotKitCore$1 {
4840
4520
  subscribe(subscriber) {
4841
4521
  return super.subscribe(subscriber);
4842
4522
  }
4843
- /**
4844
- * Wait for pending React state updates before the follow-up agent run.
4845
- *
4846
- * When a frontend tool handler calls setState(), React 18 batches the update
4847
- * and schedules a commit via its internal scheduler (MessageChannel). The
4848
- * useAgentContext hook registers context via useLayoutEffect, which runs
4849
- * synchronously after React commits that batch.
4850
- *
4851
- * Awaiting a zero-delay timeout yields to the macrotask queue. React's
4852
- * MessageChannel task runs first, committing the pending state and running
4853
- * useLayoutEffect (which updates the context store). The follow-up runAgent
4854
- * call then reads fresh context.
4855
- */
4856
- async waitForPendingFrameworkUpdates() {
4857
- await new Promise((resolve) => setTimeout(resolve, 0));
4858
- }
4859
4523
  };
4860
4524
 
4861
4525
  //#endregion
@@ -4897,10 +4561,6 @@ function CopilotKitStyles() {
4897
4561
 
4898
4562
  //#endregion
4899
4563
  //#region src/providers/CopilotKitProvider.tsx
4900
- const zodToJsonSchemaAdapter = (schema, options) => {
4901
- const refStrategy = options?.$refStrategy;
4902
- return zodToJsonSchema(schema, refStrategy === "root" || refStrategy === "relative" || refStrategy === "none" || refStrategy === "seen" ? { $refStrategy: refStrategy } : {});
4903
- };
4904
4564
  const HEADER_NAME = "X-CopilotCloud-Public-Api-Key";
4905
4565
  const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
4906
4566
  const EMPTY_HEADERS = Object.freeze({});
@@ -4909,16 +4569,6 @@ const EMPTY_AGENTS = Object.freeze({});
4909
4569
  /** Registration name of a catch-all tool: handles any otherwise-unhandled call. */
4910
4570
  const WILDCARD_TOOL_NAME$1 = "*";
4911
4571
  const HUMAN_IN_THE_LOOP_ABORTED_MESSAGE = "Human-in-the-loop interaction aborted";
4912
- const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follow these design principles inspired by shadcn/ui:
4913
-
4914
- - Use a minimal, flat aesthetic. Avoid drop shadows and gradients — rely on subtle borders (1px solid, light gray like #e5e7eb) to define surfaces.
4915
- - Neutral base palette: white backgrounds, zinc/slate gray text (#09090b for headings, #71717a for secondary text). One accent color for interactive elements.
4916
- - Use system font stacks (system-ui, -apple-system, sans-serif) at readable sizes (14px body, 600 weight for headings). Tight line-heights.
4917
- - Small, consistent border-radius (6–8px). Cards and containers use border, not shadow, for separation.
4918
- - Buttons: solid fill for primary (dark bg, white text), outline for secondary (border + transparent bg). Subtle hover state (slight opacity or background shift).
4919
- - Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.
4920
- - Minimal transitions (150ms) for hover/focus states only. No decorative animations.
4921
- - Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;
4922
4572
  /** The MCP Apps renderer with `mcpApps.allowSameOriginFallback` applied. */
4923
4573
  const SameOriginMCPAppsActivityRenderer = (props) => /* @__PURE__ */ jsx(MCPAppsActivityRenderer, {
4924
4574
  ...props,
@@ -5129,7 +4779,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5129
4779
  const builtInFrontendTools = useMemo(() => {
5130
4780
  if (!openGenUIActive) return [];
5131
4781
  return [{
5132
- name: "generateSandboxedUi",
4782
+ name: GENERATE_SANDBOXED_UI_TOOL_NAME$1,
5133
4783
  description: GENERATE_SANDBOXED_UI_DESCRIPTION,
5134
4784
  parameters: GenerateSandboxedUiArgsSchema,
5135
4785
  handler: async () => "UI generated",
@@ -5153,7 +4803,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5153
4803
  const combined = [...renderToolCallsList];
5154
4804
  [...frontendToolsList, ...builtInFrontendTools].forEach((tool) => {
5155
4805
  if (tool.render) {
5156
- const args = tool.parameters || (tool.name === "*" ? z.any() : void 0);
4806
+ const args = tool.parameters || (tool.name === "*" ? ɵanySchema : void 0);
5157
4807
  if (args) combined.push({
5158
4808
  name: tool.name,
5159
4809
  args,
@@ -5354,7 +5004,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5354
5004
  useEffect(() => {
5355
5005
  copilotkit.setDefaultThrottleMs(defaultThrottleMs);
5356
5006
  }, [copilotkit, defaultThrottleMs]);
5357
- const designSkill = openGenerativeUI?.designSkill ?? DEFAULT_DESIGN_SKILL;
5007
+ const designSkill = openGenerativeUI?.designSkill ?? DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL$1;
5358
5008
  useLayoutEffect(() => {
5359
5009
  if (!copilotkit || !openGenUIActive) return;
5360
5010
  const id = copilotkit.addContext({
@@ -5374,7 +5024,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5374
5024
  return JSON.stringify(sandboxFunctionsList.map((fn) => ({
5375
5025
  name: fn.name,
5376
5026
  description: fn.description,
5377
- parameters: schemaToJsonSchema(fn.parameters, { zodToJsonSchema: zodToJsonSchemaAdapter })
5027
+ parameters: schemaToJsonSchema(fn.parameters)
5378
5028
  })));
5379
5029
  }, [sandboxFunctionsList]);
5380
5030
  useLayoutEffect(() => {
@@ -5400,26 +5050,17 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5400
5050
  executingToolCallIds,
5401
5051
  showIntelligenceIndicator
5402
5052
  ]);
5403
- const retryableRuntimeEntitlementFailure = runtimeEntitlements?.status !== "ready" && runtimeEntitlements?.error.retryable === true;
5404
- const hasNonReadyRuntimeEntitlement = runtimeEntitlements !== void 0 && runtimeEntitlements.status !== "ready";
5405
- const hasLegacyRuntimeEntitlementFallback = runtimeLicenseStatus === "valid" || runtimeLicenseStatus === "expiring";
5406
- const runtimeEntitlementRetryInProgress = retryableRuntimeEntitlementFailure && runtimeEntitlementRetryPending && !hasLegacyRuntimeEntitlementFallback;
5407
- const terminalRuntimeEntitlementFailure = hasNonReadyRuntimeEntitlement && !retryableRuntimeEntitlementFailure && !hasLegacyRuntimeEntitlementFallback;
5408
- const licenseContextValue = useMemo(() => {
5409
- const runtimeLicenseContext = createLicenseContextValue(runtimeEntitlementRetryInProgress ? void 0 : runtimeLicenseStatus, runtimeEntitlements);
5410
- if (!terminalRuntimeEntitlementFailure) return runtimeLicenseContext;
5411
- return {
5412
- ...runtimeLicenseContext,
5413
- checkFeature: () => false,
5414
- getLimit: () => null
5415
- };
5416
- }, [
5417
- terminalRuntimeEntitlementFailure,
5418
- runtimeEntitlementRetryInProgress,
5053
+ const licenseState = useMemo(() => ɵresolveLicenseState$1({
5054
+ status: runtimeLicenseStatus,
5055
+ entitlements: runtimeEntitlements,
5056
+ retryPending: runtimeEntitlementRetryPending,
5057
+ publicKey: resolvedPublicKey
5058
+ }), [
5059
+ runtimeLicenseStatus,
5419
5060
  runtimeEntitlements,
5420
- runtimeLicenseStatus
5061
+ runtimeEntitlementRetryPending,
5062
+ resolvedPublicKey
5421
5063
  ]);
5422
- const runtimeLicenseWarningStatus = runtimeEntitlementRetryInProgress ? void 0 : licenseContextValue.status ?? void 0;
5423
5064
  return /* @__PURE__ */ jsx(CopilotStyleOptionsProvider, {
5424
5065
  value: useMemo(() => ({
5425
5066
  nonce,
@@ -5430,7 +5071,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5430
5071
  children: /* @__PURE__ */ jsx(CopilotKitContext.Provider, {
5431
5072
  value: contextValue,
5432
5073
  children: /* @__PURE__ */ jsxs(LicenseContext.Provider, {
5433
- value: licenseContextValue,
5074
+ value: licenseState.context,
5434
5075
  children: [
5435
5076
  a2uiActive && /* @__PURE__ */ jsx(A2UIBuiltInToolCallRenderer, {}),
5436
5077
  generativeUIActive && /* @__PURE__ */ jsx(GenerativeUIToolCallRenderer, {}),
@@ -5455,10 +5096,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
5455
5096
  }) : null]
5456
5097
  })
5457
5098
  }),
5458
- runtimeLicenseWarningStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "no_license" }),
5459
- runtimeLicenseWarningStatus === "expired" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expired" }),
5460
- runtimeLicenseWarningStatus === "invalid" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "invalid" }),
5461
- runtimeLicenseWarningStatus === "expiring" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expiring" })
5099
+ licenseState.bannerType && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: licenseState.bannerType })
5462
5100
  ]
5463
5101
  })
5464
5102
  })
@@ -5473,11 +5111,7 @@ function useRenderCustomMessages() {
5473
5111
  const config = useCopilotChatConfiguration();
5474
5112
  if (!config) return null;
5475
5113
  const { agentId, threadId } = config;
5476
- const customMessageRenderers = copilotkit.renderCustomMessages.filter((renderer) => renderer.agentId === void 0 || renderer.agentId === agentId).sort((a, b) => {
5477
- const aHasAgent = a.agentId !== void 0;
5478
- if (aHasAgent === (b.agentId !== void 0)) return 0;
5479
- return aHasAgent ? -1 : 1;
5480
- });
5114
+ const customMessageRenderers = ɵresolveCustomMessageRenderers$1(copilotkit.renderCustomMessages, agentId);
5481
5115
  if (!customMessageRenderers.length) return null;
5482
5116
  return function(params) {
5483
5117
  const { message, position } = params;
@@ -5513,6 +5147,18 @@ function useRenderCustomMessages() {
5513
5147
 
5514
5148
  //#endregion
5515
5149
  //#region src/hooks/use-render-activity-message.tsx
5150
+ /**
5151
+ * Explain why an activity message that has a renderer drew nothing: its
5152
+ * content validates asynchronously, or it fails the renderer's schema.
5153
+ */
5154
+ function warnAboutRejectedContent(renderer, message) {
5155
+ const result = renderer.content["~standard"].validate(message.content);
5156
+ if (result instanceof Promise) {
5157
+ console.warn(`Async content validation is not supported for activity message '${message.activityType}'`);
5158
+ return;
5159
+ }
5160
+ if (result.issues) console.warn(`Failed to parse content for activity message '${message.activityType}':`, result.issues);
5161
+ }
5516
5162
  function useRenderActivityMessage() {
5517
5163
  const { copilotkit } = useCopilotKit();
5518
5164
  const agentId = useCopilotChatConfiguration()?.agentId ?? DEFAULT_AGENT_ID;
@@ -5523,29 +5169,29 @@ function useRenderActivityMessage() {
5523
5169
  return matches.find((candidate) => candidate.agentId === agentId) ?? matches.find((candidate) => candidate.agentId === void 0) ?? renderers.find((candidate) => candidate.activityType === "*") ?? null;
5524
5170
  }, [agentId, renderers]);
5525
5171
  const renderActivityMessage = useCallback((message) => {
5526
- const renderer = findRenderer(message.activityType);
5527
- if (!renderer) return null;
5528
- const parseResult = renderer.content["~standard"].validate(message.content);
5529
- if (parseResult instanceof Promise) {
5530
- console.warn(`Async content validation is not supported for activity message '${message.activityType}'`);
5531
- return null;
5532
- }
5533
- if (parseResult.issues) {
5534
- console.warn(`Failed to parse content for activity message '${message.activityType}':`, parseResult.issues);
5172
+ const match = ɵresolveActivityRenderer$1(renderers, {
5173
+ activityType: message.activityType,
5174
+ agentId,
5175
+ content: message.content
5176
+ });
5177
+ if (!match) {
5178
+ const renderer = findRenderer(message.activityType);
5179
+ if (renderer) warnAboutRejectedContent(renderer, message);
5535
5180
  return null;
5536
5181
  }
5537
- const Component = renderer.render;
5182
+ const Component = match.renderer.render;
5538
5183
  const agent = copilotkit.getAgent(agentId);
5539
5184
  return /* @__PURE__ */ jsx(Component, {
5540
5185
  activityType: message.activityType,
5541
- content: parseResult.value,
5186
+ content: match.content,
5542
5187
  message,
5543
5188
  agent
5544
5189
  }, message.id);
5545
5190
  }, [
5546
5191
  agentId,
5547
5192
  copilotkit,
5548
- findRenderer
5193
+ findRenderer,
5194
+ renderers
5549
5195
  ]);
5550
5196
  return useMemo(() => ({
5551
5197
  renderActivityMessage,
@@ -5630,6 +5276,30 @@ function useDepsVersion(deps) {
5630
5276
 
5631
5277
  //#endregion
5632
5278
  //#region src/hooks/use-frontend-tool.tsx
5279
+ /**
5280
+ * Register a frontend tool while the component is mounted. The agent can
5281
+ * call it, and its `render` component draws the call in the chat.
5282
+ *
5283
+ * A tool with the same name and agentId as a tool that is already registered
5284
+ * (for example one from the provider's `tools`) overrides it while this
5285
+ * component is mounted. When the component unmounts, the overridden tool is
5286
+ * active again. The renderer stays registered after unmount, so past tool
5287
+ * calls still render in the chat history.
5288
+ *
5289
+ * @param tool - The tool to register.
5290
+ * @param deps - Extra values that re-register the tool when they change. Use
5291
+ * it when the handler closes over a value that is not part of the tool.
5292
+ *
5293
+ * @example
5294
+ * ```tsx
5295
+ * useFrontendTool({
5296
+ * name: "showWeather",
5297
+ * description: "Show the weather for a city",
5298
+ * parameters: z.object({ city: z.string() }),
5299
+ * handler: async ({ city }) => `Sunny in ${city}`,
5300
+ * });
5301
+ * ```
5302
+ */
5633
5303
  function useFrontendTool(tool, deps) {
5634
5304
  const { copilotkit } = useCopilotKit$1();
5635
5305
  const depsVersion = useDepsVersion(deps);
@@ -5638,11 +5308,8 @@ function useFrontendTool(tool, deps) {
5638
5308
  if (copilotkit.getTool({
5639
5309
  toolName: name,
5640
5310
  agentId: tool.agentId
5641
- })) {
5642
- console.warn(`Tool '${name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
5643
- copilotkit.removeTool(name, tool.agentId);
5644
- }
5645
- copilotkit.addTool(tool);
5311
+ })) console.warn(`Tool '${name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
5312
+ const unregister = copilotkit.addTool(tool);
5646
5313
  if (tool.render) copilotkit.addHookRenderToolCall({
5647
5314
  name,
5648
5315
  args: tool.parameters,
@@ -5650,7 +5317,7 @@ function useFrontendTool(tool, deps) {
5650
5317
  render: tool.render
5651
5318
  });
5652
5319
  return () => {
5653
- copilotkit.removeTool(name, tool.agentId);
5320
+ unregister();
5654
5321
  };
5655
5322
  }, [
5656
5323
  tool.name,
@@ -5675,8 +5342,10 @@ const EMPTY_TOOLS = [];
5675
5342
  *
5676
5343
  * Tools are keyed by `name` plus `agentId`, the same as `useFrontendTool`. A
5677
5344
  * tool that disappears from the array is unregistered on the next render, and
5678
- * every tool is unregistered on unmount. Renderers stay registered after
5679
- * unmount so past tool calls still render in the chat history.
5345
+ * every tool is unregistered on unmount. A listed tool hides a tool with the
5346
+ * same name and agentId (for example one from the provider's `tools`) until it
5347
+ * is unregistered, and then the hidden tool is active again. Renderers stay
5348
+ * registered after unmount so past tool calls still render in the chat history.
5680
5349
  *
5681
5350
  * @param tools - The tools to register. May be empty and may change length.
5682
5351
  * @param deps - Extra dependencies that force re-registration, compared by
@@ -5726,15 +5395,13 @@ function useFrontendTools(tools, deps) {
5726
5395
  deduped.set(key, tool);
5727
5396
  }
5728
5397
  const registered = [...deduped.values()];
5398
+ const unregisters = [];
5729
5399
  for (const tool of registered) {
5730
5400
  if (copilotkit.getTool({
5731
5401
  toolName: tool.name,
5732
5402
  agentId: tool.agentId
5733
- })) {
5734
- console.warn(`Tool '${tool.name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
5735
- copilotkit.removeTool(tool.name, tool.agentId);
5736
- }
5737
- copilotkit.addTool(tool);
5403
+ })) console.warn(`Tool '${tool.name}' already exists for agent '${tool.agentId || "global"}'. Overriding with latest registration.`);
5404
+ unregisters.push(copilotkit.addTool(tool));
5738
5405
  if (tool.render) copilotkit.addHookRenderToolCall({
5739
5406
  name: tool.name,
5740
5407
  args: tool.parameters,
@@ -5743,7 +5410,7 @@ function useFrontendTools(tools, deps) {
5743
5410
  });
5744
5411
  }
5745
5412
  return () => {
5746
- for (const tool of registered) copilotkit.removeTool(tool.name, tool.agentId);
5413
+ for (const unregister of unregisters) unregister();
5747
5414
  };
5748
5415
  }, [
5749
5416
  JSON.stringify(toolList.map((tool) => [
@@ -5918,34 +5585,24 @@ function useRenderTool(config, deps) {
5918
5585
  * @internal
5919
5586
  */
5920
5587
  const ToolCallGroupContext = createContext(null);
5921
- /**
5922
- * A call without a result is running only while the group is active: once
5923
- * the run has moved on or ended, its result is never coming.
5924
- */
5925
- const entryStatus = ({ toolMessage }, active) => toolMessage ? toolMessage.error ? "failed" : "done" : active ? "running" : "stopped";
5926
- /** @internal */
5927
- const statusLabels = {
5928
- running: "Running",
5929
- done: "Done",
5930
- failed: "Failed",
5931
- stopped: "Stopped"
5588
+ /** The label key for each call status. */
5589
+ const STATUS_LABEL_KEYS = {
5590
+ running: "toolCallStatusRunningLabel",
5591
+ done: "toolCallStatusDoneLabel",
5592
+ failed: "toolCallStatusFailedLabel",
5593
+ stopped: "toolCallStatusStoppedLabel"
5932
5594
  };
5933
- /** The first non-empty string argument: usually a command, path or query. */
5934
- function argumentPreview(parameters) {
5935
- if (!parameters || typeof parameters !== "object") return void 0;
5936
- return Object.values(parameters).find((v) => typeof v === "string" && v.trim().length > 0)?.replace(/\s+/g, " ");
5937
- }
5938
- const entryPreview = (entry) => argumentPreview(partialJSONParse(entry.toolCall.function.arguments));
5939
- /** "run_command ×2, read_file" */
5940
- function toolNames(calls) {
5941
- const counts = /* @__PURE__ */ new Map();
5942
- for (const { toolCall } of calls) {
5943
- const name = toolCall.function.name;
5944
- counts.set(name, (counts.get(name) ?? 0) + 1);
5945
- }
5946
- return [...counts].map(([name, count]) => count > 1 ? `${name} ×${count}` : name).join(", ");
5595
+ /** The icon for each call status. */
5596
+ const STATUS_ICONS = {
5597
+ running: "Loader2",
5598
+ done: "Check",
5599
+ failed: "X",
5600
+ stopped: "Circle"
5601
+ };
5602
+ /** The chat labels from the nearest chat configuration, or the defaults. */
5603
+ function useLabels$1() {
5604
+ return useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
5947
5605
  }
5948
- const pluralize = (count, noun) => `${count} ${noun}${count === 1 ? "" : "s"}`;
5949
5606
  /**
5950
5607
  * Height transition between closed and its content's height. Closed content
5951
5608
  * stays mounted (so its state survives) but is inert.
@@ -5968,55 +5625,35 @@ function Collapsible({ open, id, className, children }) {
5968
5625
  });
5969
5626
  }
5970
5627
  function StatusIcon({ status, className }) {
5971
- const Icon = {
5972
- running: Loader2,
5973
- done: Check,
5974
- failed: X,
5975
- stopped: Circle
5976
- }[status];
5977
- return /* @__PURE__ */ jsx(Icon, {
5628
+ return /* @__PURE__ */ jsx(CopilotIcon, {
5629
+ name: STATUS_ICONS[status],
5978
5630
  "aria-hidden": "true",
5979
5631
  className: cn("cpk-tool-call-status-icon", status === "running" && "cpk-tool-call-status-icon-running", status === "failed" && "cpk-tool-call-status-icon-failed", className)
5980
5632
  });
5981
5633
  }
5982
5634
  function Chevron({ open, className }) {
5983
- return /* @__PURE__ */ jsx(ChevronRight, {
5635
+ return /* @__PURE__ */ jsx(CopilotIcon, {
5636
+ name: "ChevronRight",
5984
5637
  "aria-hidden": "true",
5985
5638
  className: cn("cpk-tool-call-chevron", open && "cpk-tool-call-chevron-open", className)
5986
5639
  });
5987
5640
  }
5988
5641
  function FailedCount({ calls }) {
5989
- const failed = calls.filter((call) => call.toolMessage?.error).length;
5642
+ const labels = useLabels$1();
5643
+ const failed = ɵcountFailedToolCalls$1(calls);
5990
5644
  if (!failed) return null;
5991
- return /* @__PURE__ */ jsxs("span", {
5645
+ return /* @__PURE__ */ jsx("span", {
5992
5646
  className: "cpk-tool-call-failed-count",
5993
- children: [failed, " failed"]
5647
+ children: ɵformatLabel$1(labels.toolCallFailedCountLabel, { count: failed })
5994
5648
  });
5995
5649
  }
5996
- /**
5997
- * Guarded JSON.stringify for the payload blocks. A circular reference would
5998
- * otherwise crash the entire React tree on render.
5999
- */
6000
- function stringifyPayload(value) {
6001
- if (typeof value === "string") return value;
6002
- try {
6003
- return JSON.stringify(value, null, 2);
6004
- } catch (err) {
6005
- console.warn("[CopilotKit] Failed to JSON.stringify tool-call payload; falling back to String():", err);
6006
- try {
6007
- return String(value);
6008
- } catch {
6009
- return "[unserializable]";
6010
- }
6011
- }
6012
- }
6013
5650
  function Payload({ label, value }) {
6014
5651
  return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
6015
5652
  className: "cpk-tool-call-payload-label",
6016
5653
  children: label
6017
5654
  }), /* @__PURE__ */ jsx("pre", {
6018
5655
  className: "cpk-tool-call-payload-code",
6019
- children: stringifyPayload(value)
5656
+ children: ɵstringifyToolCallPayload$1(value)
6020
5657
  })] });
6021
5658
  }
6022
5659
  /**
@@ -6024,13 +5661,14 @@ function Payload({ label, value }) {
6024
5661
  * @internal
6025
5662
  */
6026
5663
  function ToolCallPayloads({ parameters, result, className }) {
5664
+ const labels = useLabels$1();
6027
5665
  return /* @__PURE__ */ jsxs("div", {
6028
5666
  className: cn("cpk-tool-call-payloads", className),
6029
5667
  children: [/* @__PURE__ */ jsx(Payload, {
6030
- label: "Arguments",
5668
+ label: labels.toolCallArgumentsLabel,
6031
5669
  value: parameters ?? {}
6032
5670
  }), result !== void 0 && /* @__PURE__ */ jsx(Payload, {
6033
- label: "Result",
5671
+ label: labels.toolCallResultLabel,
6034
5672
  value: result
6035
5673
  })]
6036
5674
  });
@@ -6041,9 +5679,10 @@ function ToolCallPayloads({ parameters, result, className }) {
6041
5679
  * @internal
6042
5680
  */
6043
5681
  function ToolCallRow({ name, parameters, result, status, appearance, className, ...props }) {
5682
+ const labels = useLabels$1();
6044
5683
  const [open, setOpen] = useState(false);
6045
5684
  const detailsId = useId();
6046
- const preview = argumentPreview(parameters);
5685
+ const preview = ɵgetArgumentPreview$1(parameters);
6047
5686
  return /* @__PURE__ */ jsxs("div", {
6048
5687
  "data-copilotkit": true,
6049
5688
  className: cn("cpk-tool-call-row", `cpk-tool-call-row-${appearance}`, className),
@@ -6068,7 +5707,7 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
6068
5707
  /* @__PURE__ */ jsx("span", {
6069
5708
  "data-testid": "copilot-tool-render-status",
6070
5709
  className: "cpk-tool-call-row-status",
6071
- children: statusLabels[status]
5710
+ children: labels[STATUS_LABEL_KEYS[status]]
6072
5711
  }),
6073
5712
  /* @__PURE__ */ jsx(Chevron, {
6074
5713
  open,
@@ -6097,14 +5736,15 @@ function ToolCallRow({ name, parameters, result, status, appearance, className,
6097
5736
  * draws.
6098
5737
  */
6099
5738
  function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isActive = false, className, ...props }) {
5739
+ const labels = useLabels$1();
6100
5740
  const [open, setOpen] = useState(false);
6101
5741
  const bodyId = useId();
6102
5742
  const latest = calls[calls.length - 1];
6103
5743
  if (!latest) return null;
6104
5744
  const current = isActive ? calls.find((call) => !call.toolMessage) ?? latest : void 0;
6105
- const preview = current ? entryPreview(current) : void 0;
5745
+ const preview = current ? ɵgetToolCallPreview$1(current) : void 0;
6106
5746
  const done = calls.filter((call) => call.toolMessage).length;
6107
- const statuses = calls.map((call) => entryStatus(call, isActive));
5747
+ const statuses = calls.map((call) => ɵgetToolCallRowStatus$1(call, isActive));
6108
5748
  const failedIds = new Set(calls.filter((_, index) => statuses[index] === "failed").map((call) => call.toolCall.id));
6109
5749
  const status = current ? "running" : failedIds.size > 0 ? "failed" : statuses.includes("stopped") ? "stopped" : "done";
6110
5750
  const rows = (rowAppearance) => /* @__PURE__ */ jsx(ToolCallGroupContext.Provider, {
@@ -6122,9 +5762,9 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6122
5762
  "data-state": status,
6123
5763
  ...props
6124
5764
  };
6125
- const runningLabel = current && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
5765
+ const runningLabel = current && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
6126
5766
  className: "cpk-tool-call-group-running cpk-shimmer",
6127
- children: ["Running ", current.toolCall.function.name]
5767
+ children: ɵformatLabel$1(labels.toolCallRunningLabel, { name: current.toolCall.function.name })
6128
5768
  }), preview && /* @__PURE__ */ jsx("span", {
6129
5769
  className: "cpk-tool-call-group-preview",
6130
5770
  children: preview
@@ -6152,13 +5792,16 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6152
5792
  onClick: () => setOpen((value) => !value),
6153
5793
  className: "cpk-tool-call-group-line-toggle",
6154
5794
  children: [runningLabel || /* @__PURE__ */ jsxs(Fragment$1, { children: [
6155
- /* @__PURE__ */ jsxs("span", {
5795
+ /* @__PURE__ */ jsx("span", {
6156
5796
  className: "cpk-tool-call-group-line-summary",
6157
- children: ["Used ", pluralize(calls.length, "tool")]
5797
+ children: ɵformatCountLabel$1(calls.length, {
5798
+ one: labels.toolCallUsedToolsOne,
5799
+ other: labels.toolCallUsedToolsOther
5800
+ })
6158
5801
  }),
6159
5802
  /* @__PURE__ */ jsx("span", {
6160
5803
  className: "cpk-tool-call-group-line-names",
6161
- children: toolNames(calls)
5804
+ children: ɵformatToolNames$1(calls)
6162
5805
  }),
6163
5806
  /* @__PURE__ */ jsx(FailedCount, { calls })
6164
5807
  ] }), /* @__PURE__ */ jsx(Chevron, { open })]
@@ -6175,8 +5818,8 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6175
5818
  if (appearance === "stack") {
6176
5819
  const behind = open ? 0 : Math.min(calls.length - 1, 2);
6177
5820
  const layer = "cpk-tool-call-group-stack-layer";
6178
- const latestStatus = entryStatus(latest, isActive);
6179
- const latestPreview = entryPreview(latest);
5821
+ const latestStatus = ɵgetToolCallRowStatus$1(latest, isActive);
5822
+ const latestPreview = ɵgetToolCallPreview$1(latest);
6180
5823
  return /* @__PURE__ */ jsxs("div", {
6181
5824
  ...groupProps,
6182
5825
  className: cn("cpk-tool-call-group cpk-tool-call-group-stack", className),
@@ -6203,11 +5846,14 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6203
5846
  onClick: () => setOpen((value) => !value),
6204
5847
  className: cn("cpk-tool-call-group-stack-toggle", open ? "cpk-tool-call-group-stack-toggle-open" : [layer, "cpk-tool-call-group-stack-toggle-closed"]),
6205
5848
  children: open ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
6206
- pluralize(calls.length, "tool call"),
5849
+ ɵformatCountLabel$1(calls.length, {
5850
+ one: labels.toolCallToolCallCountOne,
5851
+ other: labels.toolCallToolCallCountOther
5852
+ }),
6207
5853
  /* @__PURE__ */ jsx(FailedCount, { calls }),
6208
5854
  /* @__PURE__ */ jsxs("span", {
6209
5855
  className: "cpk-tool-call-group-stack-collapse",
6210
- children: ["Collapse", /* @__PURE__ */ jsx(Chevron, {
5856
+ children: [labels.toolCallCollapseLabel, /* @__PURE__ */ jsx(Chevron, {
6211
5857
  open: true,
6212
5858
  className: "cpk-tool-call-group-stack-collapse-icon"
6213
5859
  })]
@@ -6226,7 +5872,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6226
5872
  }),
6227
5873
  /* @__PURE__ */ jsx("span", {
6228
5874
  className: "cpk-tool-call-group-stack-status",
6229
- children: statusLabels[latestStatus]
5875
+ children: labels[STATUS_LABEL_KEYS[latestStatus]]
6230
5876
  })
6231
5877
  ]
6232
5878
  }, latest.toolCall.id), /* @__PURE__ */ jsxs("span", {
@@ -6235,7 +5881,10 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6235
5881
  /* @__PURE__ */ jsx(FailedCount, { calls }),
6236
5882
  /* @__PURE__ */ jsx("span", {
6237
5883
  className: "cpk-tool-call-group-stack-count",
6238
- children: pluralize(calls.length, "call")
5884
+ children: ɵformatCountLabel$1(calls.length, {
5885
+ one: labels.toolCallCallCountOne,
5886
+ other: labels.toolCallCallCountOther
5887
+ })
6239
5888
  }),
6240
5889
  /* @__PURE__ */ jsx(Chevron, {
6241
5890
  open: false,
@@ -6247,7 +5896,7 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6247
5896
  /* @__PURE__ */ jsx("span", {
6248
5897
  "aria-live": "polite",
6249
5898
  className: "cpk-tool-call-group-stack-live",
6250
- children: open ? "" : `${latest.toolCall.function.name}: ${statusLabels[latestStatus]}`
5899
+ children: open ? "" : `${latest.toolCall.function.name}: ${labels[STATUS_LABEL_KEYS[latestStatus]]}`
6251
5900
  })
6252
5901
  ]
6253
5902
  }), open && /* @__PURE__ */ jsx("div", {
@@ -6279,18 +5928,21 @@ function CopilotChatToolCallGroup({ calls, renderCall, appearance = "card", isAc
6279
5928
  className: "cpk-tool-call-group-card-toggle",
6280
5929
  children: [
6281
5930
  /* @__PURE__ */ jsx(StatusIcon, { status }),
6282
- runningLabel || /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
5931
+ runningLabel || /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
6283
5932
  className: "cpk-tool-call-group-card-summary",
6284
- children: ["Used ", pluralize(calls.length, "tool")]
5933
+ children: ɵformatCountLabel$1(calls.length, {
5934
+ one: labels.toolCallUsedToolsOne,
5935
+ other: labels.toolCallUsedToolsOther
5936
+ })
6285
5937
  }), /* @__PURE__ */ jsx("span", {
6286
5938
  className: "cpk-tool-call-group-card-names",
6287
- children: toolNames(calls)
5939
+ children: ɵformatToolNames$1(calls)
6288
5940
  })] }),
6289
5941
  /* @__PURE__ */ jsxs("span", {
6290
5942
  className: "cpk-tool-call-group-card-meta",
6291
5943
  children: [status === "failed" ? /* @__PURE__ */ jsx(FailedCount, { calls }) : /* @__PURE__ */ jsx("span", {
6292
5944
  className: "cpk-tool-call-group-card-status",
6293
- children: status !== "running" ? statusLabels[status] : done > 0 && `${done} done`
5945
+ children: status !== "running" ? labels[STATUS_LABEL_KEYS[status]] : done > 0 && ɵformatLabel$1(labels.toolCallDoneCountLabel, { count: done })
6294
5946
  }), /* @__PURE__ */ jsx(Chevron, { open })]
6295
5947
  })
6296
5948
  ]
@@ -7057,11 +6709,6 @@ function normalizeStaticSuggestions(suggestions) {
7057
6709
  }));
7058
6710
  }
7059
6711
 
7060
- //#endregion
7061
- //#region src/types/interrupt.ts
7062
- /** Name of the legacy custom event agents emit to signal an interrupt. */
7063
- const INTERRUPT_EVENT_NAME = "on_interrupt";
7064
-
7065
6712
  //#endregion
7066
6713
  //#region src/hooks/use-interrupt.tsx
7067
6714
  /** Recognize thenables returned by interrupt preprocessing handlers. */
@@ -7978,297 +7625,11 @@ function useAttachments({ config }) {
7978
7625
  };
7979
7626
  }
7980
7627
 
7981
- //#endregion
7982
- //#region src/hooks/use-learning-containers.tsx
7983
- /** The default learning containers value. Matches the backend default. */
7984
- const DEFAULT_CONTAINERS = ["project"];
7985
- /**
7986
- * Legacy compatibility hook that keeps a thread's plural learning-container
7987
- * annotation in sync by emitting
7988
- * `set_learning_containers` annotations via the CopilotKit runtime annotate
7989
- * endpoint (`POST ${runtimeUrl}/annotate`).
7990
- *
7991
- * **Emit rules:**
7992
- * - On mount with `["project"]` (the backend default) → does NOT emit.
7993
- * Absence of an annotation equals the default, so the round-trip is skipped.
7994
- * - On mount with any other value → emits immediately.
7995
- * - On any subsequent content change (including a switch back to
7996
- * `["project"]`) → emits (a deliberate switch is always recorded).
7997
- * - On unmount or threadId change → emits a reset to `["project"]`
7998
- * so the backend is left in a clean state for the next consumer.
7999
- * Changing `learningContainers` within the same thread does NOT reset the
8000
- * thread; only the new value is emitted.
8001
- *
8002
- * Content-equality is evaluated via `JSON.stringify` so a fresh array literal
8003
- * with the same items does NOT trigger a redundant emit.
8004
- *
8005
- * If `runtimeUrl` is absent, all emits are silently skipped.
8006
- *
8007
- * @example
8008
- * ```tsx
8009
- * function ThreadPane({ threadId, userScope }: Props) {
8010
- * useLearningContainers({
8011
- * threadId,
8012
- * learningContainers: [userScope],
8013
- * });
8014
- * // ...
8015
- * }
8016
- * ```
8017
- *
8018
- * @deprecated This hook supports only the legacy plural-container annotation.
8019
- * Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
8020
- * Intelligence runtimes.
8021
- */
8022
- function useLearningContainers({ threadId, learningContainers }) {
8023
- const { copilotkit } = useCopilotKit$1();
8024
- /**
8025
- * Tracks the last-synced container list so content-identical rerenders
8026
- * (fresh array, same values) do not fire a redundant emit.
8027
- * `null` = nothing synced yet (initial state or after a threadId reset).
8028
- */
8029
- const lastSyncedRef = useRef(null);
8030
- /** Guards the missing-runtimeUrl warning so it fires at most once per hook instance. */
8031
- const warnedMissingUrlRef = useRef(false);
8032
- const runtimeUrlRef = useRef(copilotkit.runtimeUrl);
8033
- const runtimeFetchRef = useRef(copilotkit.ɵruntimeFetch);
8034
- runtimeUrlRef.current = copilotkit.runtimeUrl;
8035
- runtimeFetchRef.current = copilotkit.ɵruntimeFetch;
8036
- const key = JSON.stringify(learningContainers);
8037
- const defaultKey = JSON.stringify(DEFAULT_CONTAINERS);
8038
- useEffect(() => {
8039
- const runtimeUrl = copilotkit.runtimeUrl;
8040
- /**
8041
- * Fire-and-forget emit; errors must not surface in render.
8042
- * Failures are logged as warnings so they are diagnosable without
8043
- * propagating into the React render cycle.
8044
- */
8045
- const emit = (containers) => {
8046
- if (!runtimeUrl) {
8047
- if (!warnedMissingUrlRef.current) {
8048
- warnedMissingUrlRef.current = true;
8049
- console.warn("useLearningContainers: runtimeUrl not configured; learning-container sync disabled");
8050
- }
8051
- return;
8052
- }
8053
- recordAnnotation({
8054
- fetch: copilotkit.ɵruntimeFetch,
8055
- runtimeUrl,
8056
- headers: {},
8057
- type: "set_learning_containers",
8058
- payload: { containers },
8059
- threadId
8060
- }).catch((err) => {
8061
- console.warn("useLearningContainers: failed to record set_learning_containers", err);
8062
- });
8063
- };
8064
- if (lastSyncedRef.current === null) {
8065
- if (key === defaultKey) {
8066
- lastSyncedRef.current = learningContainers;
8067
- return;
8068
- }
8069
- emit(learningContainers);
8070
- lastSyncedRef.current = learningContainers;
8071
- } else if (key !== JSON.stringify(lastSyncedRef.current)) {
8072
- emit(learningContainers);
8073
- lastSyncedRef.current = learningContainers;
8074
- }
8075
- }, [threadId, key]);
8076
- useEffect(() => {
8077
- const capturedThreadId = threadId;
8078
- return () => {
8079
- const capturedRuntimeUrl = runtimeUrlRef.current;
8080
- if (capturedRuntimeUrl) recordAnnotation({
8081
- fetch: runtimeFetchRef.current,
8082
- runtimeUrl: capturedRuntimeUrl,
8083
- headers: {},
8084
- type: "set_learning_containers",
8085
- payload: { containers: DEFAULT_CONTAINERS },
8086
- threadId: capturedThreadId
8087
- }).catch((err) => {
8088
- console.warn("useLearningContainers: failed to record set_learning_containers", err);
8089
- });
8090
- lastSyncedRef.current = null;
8091
- };
8092
- }, [threadId]);
8093
- }
8094
-
8095
- //#endregion
8096
- //#region src/hooks/use-learning-containers-in-current-thread.tsx
8097
- /**
8098
- * Legacy compatibility hook that keeps the **current chat thread's** plural
8099
- * learning-container annotation in sync. The `threadId` is sourced from the surrounding
8100
- * `<CopilotChatConfigurationProvider>` (the same provider `<CopilotChat>`,
8101
- * `<CopilotSidebar>`, and friends set up), so callers in a chat-aware
8102
- * subtree don't need to thread an id through manually.
8103
- *
8104
- * **Throws on render** when there is no chat-config provider in scope or
8105
- * when the provider does not yet have an active `threadId`. Mount the hook
8106
- * inside a subtree that is guaranteed to have a thread context.
8107
- *
8108
- * If you need to manage an explicit thread, use {@link useLearningContainers}
8109
- * directly — two hooks, two crisp contracts, no mode confusion.
8110
- *
8111
- * @throws When no `CopilotChatConfigurationProvider` is in scope or when the
8112
- * active `threadId` is absent/empty.
8113
- *
8114
- * @example
8115
- * ```tsx
8116
- * function ThreadPanel({ scope }: Props) {
8117
- * useLearningContainersInCurrentThread({
8118
- * learningContainers: [scope],
8119
- * });
8120
- * // ...
8121
- * }
8122
- * ```
8123
- *
8124
- * @deprecated This hook supports only the legacy plural-container annotation.
8125
- * Configure `getLearningContainerId` on `CopilotKitIntelligence` for new
8126
- * Intelligence runtimes.
8127
- */
8128
- function useLearningContainersInCurrentThread({ learningContainers }) {
8129
- const threadId = useCopilotChatConfiguration()?.threadId;
8130
- if (!threadId) throw new Error("useLearningContainersInCurrentThread must be used within a thread context (no active threadId). Wrap the component in <CopilotChat>, <CopilotSidebar>, or <CopilotChatConfigurationProvider>, or use `useLearningContainers()` and pass `threadId` explicitly.");
8131
- useLearningContainers({
8132
- threadId,
8133
- learningContainers
8134
- });
8135
- }
8136
-
8137
7628
  //#endregion
8138
7629
  //#region src/components/chat/tool-call-display-context.ts
8139
7630
  /** @internal */
8140
7631
  const ToolCallDisplayContext = createContext(null);
8141
7632
 
8142
- //#endregion
8143
- //#region src/components/chat/tool-call-layout.ts
8144
- function contentLength(content) {
8145
- return typeof content === "string" ? content.length : JSON.stringify(content ?? "").length;
8146
- }
8147
- const entrySignature = ({ toolCall, toolMessage }) => [
8148
- toolCall.id,
8149
- toolCall.function.name,
8150
- toolCall.function.arguments.length,
8151
- toolMessage ? `${contentLength(toolMessage.content)}${toolMessage.error ? "!" : ""}` : "-"
8152
- ].join(":");
8153
- function signatureOf(segments) {
8154
- return segments.map((segment) => segment.kind === "call" ? `c(${entrySignature(segment.call)})` : `g${segment.trailing ? "*" : ""}(${segment.calls.map(entrySignature).join(",")})`).join("|");
8155
- }
8156
- /** Index of tool results by the call they answer. */
8157
- function getToolResults(messages) {
8158
- const results = /* @__PURE__ */ new Map();
8159
- for (const message of messages) if (message.role === "tool") results.set(message.toolCallId, message);
8160
- return results;
8161
- }
8162
- /**
8163
- * Lays out the tool calls of every assistant message in `rendered`.
8164
- *
8165
- * Calls drawn by a renderer that opted into grouping join the group that's
8166
- * open; anything else that shows between them closes it: assistant text, a
8167
- * user, reasoning or activity message, or a call drawn by any other renderer. A group belongs to
8168
- * the message where it starts, so later messages whose calls joined it render
8169
- * no tool calls themselves.
8170
- *
8171
- * @param rendered - The messages as the chat renders them, in order.
8172
- * @param all - Every message, for finding tool results (a transform may hide them).
8173
- * @param renderers - The registered renderers.
8174
- */
8175
- function getToolCallLayouts(rendered, all, renderers) {
8176
- const results = getToolResults(all);
8177
- const layouts = /* @__PURE__ */ new Map();
8178
- let open;
8179
- for (const message of rendered) {
8180
- if (message.role === "tool") continue;
8181
- if (message.role !== "assistant") {
8182
- open = void 0;
8183
- continue;
8184
- }
8185
- if (typeof message.content === "string" && message.content.trim()) open = void 0;
8186
- const segments = [];
8187
- layouts.set(message.id, segments);
8188
- const toolCalls = /* @__PURE__ */ new Map();
8189
- for (const toolCall of message.toolCalls ?? []) toolCalls.set(toolCall.id, toolCall);
8190
- for (const toolCall of toolCalls.values()) {
8191
- const entry = {
8192
- toolCall,
8193
- toolMessage: results.get(toolCall.id)
8194
- };
8195
- const name = toolCall.function.name;
8196
- const named = renderers.named.has(name);
8197
- const rendered = named || renderers.wildcard;
8198
- const groups = named ? renderers.groupedNames.has(name) : renderers.wildcardGroups;
8199
- if (!rendered || !groups) {
8200
- if (rendered) open = void 0;
8201
- segments.push({
8202
- kind: "call",
8203
- id: toolCall.id,
8204
- call: entry,
8205
- rendered
8206
- });
8207
- } else if (open) open.calls.push(entry);
8208
- else {
8209
- open = {
8210
- kind: "group",
8211
- id: toolCall.id,
8212
- calls: [entry],
8213
- trailing: false
8214
- };
8215
- segments.push(open);
8216
- }
8217
- }
8218
- }
8219
- if (open) open.trailing = true;
8220
- const layout = /* @__PURE__ */ new Map();
8221
- for (const [id, segments] of layouts) layout.set(id, {
8222
- segments,
8223
- signature: signatureOf(segments)
8224
- });
8225
- return layout;
8226
- }
8227
- /**
8228
- * Finds the working phase of every reply in `rendered`: its messages up to the
8229
- * last one that calls a tool. Text in there was narration; what follows is the
8230
- * reply itself. Replies that called no tools are omitted, except the latest,
8231
- * which may be about to.
8232
- */
8233
- function getTurnWork(rendered, layouts) {
8234
- const turns = /* @__PURE__ */ new Map();
8235
- let start = 0;
8236
- while (start < rendered.length) {
8237
- let end = start;
8238
- while (end < rendered.length && rendered[end].role !== "user") end++;
8239
- const key = start > 0 ? rendered[start - 1].id : "start";
8240
- const visible = rendered.slice(start, end).filter((message) => message.role !== "tool");
8241
- const isLatest = end === rendered.length;
8242
- const calls = [];
8243
- for (const message of visible) for (const segment of layouts.get(message.id)?.segments ?? []) if (segment.kind === "group") calls.push(...segment.calls);
8244
- else if (segment.rendered) calls.push(segment.call);
8245
- const shown = new Set(calls.map((entry) => entry.toolCall.id));
8246
- let lastWork = -1;
8247
- visible.forEach((message, index) => {
8248
- if (message.role === "assistant" && message.toolCalls?.some((call) => shown.has(call.id))) lastWork = index;
8249
- });
8250
- const first = visible[0];
8251
- if (first && (calls.length > 0 || isLatest)) {
8252
- let lastAssistant = -1;
8253
- visible.forEach((message, index) => {
8254
- if (message.role === "assistant") lastAssistant = index;
8255
- });
8256
- const replyText = visible[lastAssistant]?.content;
8257
- const endsWithWork = lastAssistant >= 0 && lastAssistant <= lastWork && typeof replyText === "string" && replyText.trim().length > 0;
8258
- turns.set(key, {
8259
- key,
8260
- firstMessageId: first.id,
8261
- workMessageIds: new Set(visible.slice(0, lastWork + 1).map((message) => message.id)),
8262
- replyTextMessageId: endsWithWork ? visible[lastAssistant].id : void 0,
8263
- calls,
8264
- isLatest
8265
- });
8266
- }
8267
- start = end + 1;
8268
- }
8269
- return turns;
8270
- }
8271
-
8272
7633
  //#endregion
8273
7634
  //#region src/components/chat/CopilotChatToolCallsView.tsx
8274
7635
  const appearances = {
@@ -8288,7 +7649,7 @@ function CopilotChatToolCallsView({ message, messages = [], display: displayProp
8288
7649
  const viewLayout = context?.layouts.get(message.id);
8289
7650
  const layout = useMemo(() => {
8290
7651
  if (display === "separate") return void 0;
8291
- return viewLayout ?? getToolCallLayouts([message], messages, rendererNames).get(message.id);
7652
+ return viewLayout ?? ɵgetToolCallLayouts$1([message], messages, rendererNames).get(message.id);
8292
7653
  }, [
8293
7654
  display,
8294
7655
  viewLayout,
@@ -8478,7 +7839,7 @@ function InspectorKiteIcon({ className, ...props }) {
8478
7839
  });
8479
7840
  }
8480
7841
  function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
8481
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
7842
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
8482
7843
  const { isInspectorEnabled } = useCopilotKitInspector();
8483
7844
  const hidden = useInspectorShortcutsHidden();
8484
7845
  const [open, setOpen] = useState(false);
@@ -8547,7 +7908,8 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
8547
7908
  event.currentTarget.click();
8548
7909
  }
8549
7910
  },
8550
- children: /* @__PURE__ */ jsx(Wrench, {
7911
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
7912
+ name: "Wrench",
8551
7913
  "aria-hidden": "true",
8552
7914
  className: "cpk-inspector-button-icon",
8553
7915
  "data-testid": "copilot-inspector-icon"
@@ -8614,7 +7976,8 @@ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown,
8614
7976
  /* @__PURE__ */ jsxs(DropdownMenuItem, {
8615
7977
  onSelect: hideShortcuts,
8616
7978
  className: "cpk-inspector-button-menu-item cpk-inspector-button-hide-item",
8617
- children: [/* @__PURE__ */ jsx(EyeOff, {
7979
+ children: [/* @__PURE__ */ jsx(CopilotIcon, {
7980
+ name: "EyeOff",
8618
7981
  "aria-hidden": "true",
8619
7982
  className: "cpk-inspector-button-menu-item-icon"
8620
7983
  }), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
@@ -9008,7 +8371,7 @@ function nextFocusable(element, skip) {
9008
8371
  * control after the thumb, and Enter or Escape inside it returns to the thumb.
9009
8372
  */
9010
8373
  function FeedbackCommentPopover({ feedbackComment, comment, savedComment, rating, anchor, messageId }) {
9011
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8374
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9012
8375
  const contentRef = useRef(null);
9013
8376
  const focusInside = () => contentRef.current?.contains(document.activeElement) ?? false;
9014
8377
  const { focusRequest, takeFocusRequest, inputRef } = comment;
@@ -9312,7 +8675,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
9312
8675
  });
9313
8676
  };
9314
8677
  _CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
9315
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8678
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9316
8679
  const [copied, setCopied] = useState(false);
9317
8680
  const timerRef = useRef(null);
9318
8681
  useEffect(() => {
@@ -9338,36 +8701,44 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
9338
8701
  onClick: handleClick,
9339
8702
  className,
9340
8703
  ...props,
9341
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "cpk-assistant-message-toolbar-icon" }) : /* @__PURE__ */ jsx(Copy, { className: "cpk-assistant-message-toolbar-icon" })
8704
+ children: copied ? /* @__PURE__ */ jsx(CopilotIcon, {
8705
+ name: "Check",
8706
+ className: "cpk-assistant-message-toolbar-icon"
8707
+ }) : /* @__PURE__ */ jsx(CopilotIcon, {
8708
+ name: "Copy",
8709
+ className: "cpk-assistant-message-toolbar-icon"
8710
+ })
9342
8711
  });
9343
8712
  };
9344
8713
  _CopilotChatAssistantMessage.InspectorButton = CopilotChatInspectorButton;
9345
8714
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
9346
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8715
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9347
8716
  return /* @__PURE__ */ jsx(ToolbarButton, {
9348
8717
  "data-testid": "copilot-thumbs-up-button",
9349
8718
  title: title || labels.assistantMessageToolbarThumbsUpLabel,
9350
8719
  ...props,
9351
- children: /* @__PURE__ */ jsx(ThumbsUp, {
8720
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
8721
+ name: "ThumbsUp",
9352
8722
  className: "cpk-assistant-message-toolbar-icon",
9353
8723
  fill: props["aria-pressed"] === true ? "currentColor" : "none"
9354
8724
  })
9355
8725
  });
9356
8726
  };
9357
8727
  _CopilotChatAssistantMessage.ThumbsDownButton = ({ title, ...props }) => {
9358
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8728
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9359
8729
  return /* @__PURE__ */ jsx(ToolbarButton, {
9360
8730
  "data-testid": "copilot-thumbs-down-button",
9361
8731
  title: title || labels.assistantMessageToolbarThumbsDownLabel,
9362
8732
  ...props,
9363
- children: /* @__PURE__ */ jsx(ThumbsDown, {
8733
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
8734
+ name: "ThumbsDown",
9364
8735
  className: "cpk-assistant-message-toolbar-icon",
9365
8736
  fill: props["aria-pressed"] === true ? "currentColor" : "none"
9366
8737
  })
9367
8738
  });
9368
8739
  };
9369
8740
  _CopilotChatAssistantMessage.FeedbackComment = ({ value, savedComment, inputRef, onChange, onSubmit, onEditingChange, onLeave, className }) => {
9370
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8741
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9371
8742
  const changed = value.trim() !== savedComment;
9372
8743
  return /* @__PURE__ */ jsxs("form", {
9373
8744
  "data-testid": "copilot-feedback-comment",
@@ -9397,26 +8768,35 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, isLatest, o
9397
8768
  variant: "assistantMessageToolbarButton",
9398
8769
  "aria-label": labels.assistantMessageFeedbackCommentSubmitLabel,
9399
8770
  title: labels.assistantMessageFeedbackCommentSubmitLabel,
9400
- children: /* @__PURE__ */ jsx(ArrowUp, { className: "cpk-assistant-message-feedback-comment-submit-icon" })
8771
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
8772
+ name: "ArrowUp",
8773
+ className: "cpk-assistant-message-feedback-comment-submit-icon"
8774
+ })
9401
8775
  })]
9402
8776
  });
9403
8777
  };
9404
8778
  _CopilotChatAssistantMessage.ReadAloudButton = ({ title, ...props }) => {
9405
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8779
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9406
8780
  return /* @__PURE__ */ jsx(ToolbarButton, {
9407
8781
  "data-testid": "copilot-read-aloud-button",
9408
8782
  title: title || labels.assistantMessageToolbarReadAloudLabel,
9409
8783
  ...props,
9410
- children: /* @__PURE__ */ jsx(Volume2, { className: "cpk-assistant-message-read-aloud-icon" })
8784
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
8785
+ name: "Volume2",
8786
+ className: "cpk-assistant-message-read-aloud-icon"
8787
+ })
9411
8788
  });
9412
8789
  };
9413
8790
  _CopilotChatAssistantMessage.RegenerateButton = ({ title, ...props }) => {
9414
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8791
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9415
8792
  return /* @__PURE__ */ jsx(ToolbarButton, {
9416
8793
  "data-testid": "copilot-regenerate-button",
9417
8794
  title: title || labels.assistantMessageToolbarRegenerateLabel,
9418
8795
  ...props,
9419
- children: /* @__PURE__ */ jsx(RefreshCw, { className: "cpk-assistant-message-toolbar-icon" })
8796
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
8797
+ name: "RefreshCw",
8798
+ className: "cpk-assistant-message-toolbar-icon"
8799
+ })
9420
8800
  });
9421
8801
  };
9422
8802
  })(CopilotChatAssistantMessage || (CopilotChatAssistantMessage = {}));
@@ -9439,7 +8819,7 @@ var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
9439
8819
  * `labels.attachmentPreviewCloseButtonLabel`.
9440
8820
  */
9441
8821
  function Lightbox({ onClose, children }) {
9442
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
8822
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9443
8823
  useEffect(() => {
9444
8824
  const handleKey = (e) => {
9445
8825
  if (e.key === "Escape") onClose();
@@ -9455,7 +8835,10 @@ function Lightbox({ onClose, children }) {
9455
8835
  onClick: onClose,
9456
8836
  className: "cpk-attachment-lightbox-close-button",
9457
8837
  "aria-label": labels.attachmentPreviewCloseButtonLabel,
9458
- children: /* @__PURE__ */ jsx(X, { className: "cpk-attachment-lightbox-close-icon" })
8838
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
8839
+ name: "X",
8840
+ className: "cpk-attachment-lightbox-close-icon"
8841
+ })
9459
8842
  }), /* @__PURE__ */ jsx("div", {
9460
8843
  onClick: (e) => e.stopPropagation(),
9461
8844
  children
@@ -9509,17 +8892,22 @@ function useLightbox() {
9509
8892
 
9510
8893
  //#endregion
9511
8894
  //#region src/components/chat/CopilotChatAttachmentRenderer.tsx
8895
+ /** The chat labels from the nearest chat configuration, or the defaults. */
8896
+ function useLabels() {
8897
+ return useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
8898
+ }
9512
8899
  const ImageAttachment = memo(function ImageAttachment({ src, className }) {
8900
+ const labels = useLabels();
9513
8901
  const [error, setError] = useState(false);
9514
8902
  const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
9515
8903
  if (error) return /* @__PURE__ */ jsx("div", {
9516
8904
  className: cn("cpk-attachment-renderer cpk-attachment-renderer-image-error", className),
9517
- children: /* @__PURE__ */ jsx("span", { children: "Failed to load image" })
8905
+ children: /* @__PURE__ */ jsx("span", { children: labels.attachmentImageLoadErrorText })
9518
8906
  });
9519
8907
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
9520
8908
  ref: thumbnailRef,
9521
8909
  src,
9522
- alt: "Image attachment",
8910
+ alt: labels.attachmentImageAltText,
9523
8911
  className: cn("cpk-attachment-renderer cpk-attachment-renderer-image", className),
9524
8912
  onClick: openLightbox,
9525
8913
  onError: () => setError(true)
@@ -9528,7 +8916,7 @@ const ImageAttachment = memo(function ImageAttachment({ src, className }) {
9528
8916
  children: /* @__PURE__ */ jsx("img", {
9529
8917
  style: { viewTransitionName: vtName },
9530
8918
  src,
9531
- alt: "Image attachment",
8919
+ alt: labels.attachmentImageAltText,
9532
8920
  className: "cpk-attachment-renderer-lightbox-image"
9533
8921
  })
9534
8922
  })] });
@@ -9556,7 +8944,8 @@ const VideoAttachment = memo(function VideoAttachment({ src, className }) {
9556
8944
  });
9557
8945
  });
9558
8946
  const DocumentAttachment = memo(function DocumentAttachment({ src, source, filename, className }) {
9559
- const label = filename || source.mimeType || "Document attachment";
8947
+ const labels = useLabels();
8948
+ const label = filename || source.mimeType || labels.attachmentDocumentAltText;
9560
8949
  return /* @__PURE__ */ jsxs("a", {
9561
8950
  href: src,
9562
8951
  download: filename ?? "",
@@ -9569,7 +8958,7 @@ const DocumentAttachment = memo(function DocumentAttachment({ src, source, filen
9569
8958
  children: getDocumentIcon(source.mimeType ?? "")
9570
8959
  }), /* @__PURE__ */ jsx("span", {
9571
8960
  className: "cpk-attachment-renderer-document-name",
9572
- children: filename || source.mimeType || "Unknown type"
8961
+ children: filename || source.mimeType || labels.attachmentUnknownTypeText
9573
8962
  })]
9574
8963
  });
9575
8964
  });
@@ -9708,7 +9097,7 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
9708
9097
  })] });
9709
9098
  };
9710
9099
  _CopilotChatUserMessage.CopyButton = ({ className, title, onClick, ...props }) => {
9711
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
9100
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9712
9101
  const [copied, setCopied] = useState(false);
9713
9102
  const handleClick = async (event) => {
9714
9103
  let success = false;
@@ -9724,21 +9113,30 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
9724
9113
  onClick: handleClick,
9725
9114
  className,
9726
9115
  ...props,
9727
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "cpk-user-message-toolbar-icon" }) : /* @__PURE__ */ jsx(Copy, { className: "cpk-user-message-toolbar-icon" })
9116
+ children: copied ? /* @__PURE__ */ jsx(CopilotIcon, {
9117
+ name: "Check",
9118
+ className: "cpk-user-message-toolbar-icon"
9119
+ }) : /* @__PURE__ */ jsx(CopilotIcon, {
9120
+ name: "Copy",
9121
+ className: "cpk-user-message-toolbar-icon"
9122
+ })
9728
9123
  });
9729
9124
  };
9730
9125
  _CopilotChatUserMessage.EditButton = ({ className, title, ...props }) => {
9731
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
9126
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9732
9127
  return /* @__PURE__ */ jsx(ToolbarButton, {
9733
9128
  "data-testid": "copilot-edit-button",
9734
9129
  title: title || labels.userMessageToolbarEditMessageLabel,
9735
9130
  className,
9736
9131
  ...props,
9737
- children: /* @__PURE__ */ jsx(Edit, { className: "cpk-user-message-toolbar-icon" })
9132
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
9133
+ name: "Edit",
9134
+ className: "cpk-user-message-toolbar-icon"
9135
+ })
9738
9136
  });
9739
9137
  };
9740
9138
  _CopilotChatUserMessage.BranchNavigation = ({ className, currentBranch = 0, numberOfBranches = 1, onSwitchToBranch, message, ...props }) => {
9741
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
9139
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9742
9140
  if (!numberOfBranches || numberOfBranches <= 1 || !onSwitchToBranch) return null;
9743
9141
  const canGoPrev = currentBranch > 0;
9744
9142
  const canGoNext = currentBranch < numberOfBranches - 1;
@@ -9758,7 +9156,10 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
9758
9156
  disabled: !canGoPrev,
9759
9157
  className: "cpk-user-message-branch-button",
9760
9158
  "aria-label": labels.userMessageToolbarPreviousBranchLabel,
9761
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "cpk-user-message-branch-icon" })
9159
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
9160
+ name: "ChevronLeft",
9161
+ className: "cpk-user-message-branch-icon"
9162
+ })
9762
9163
  }),
9763
9164
  /* @__PURE__ */ jsxs("span", {
9764
9165
  className: "cpk-user-message-branch-counter",
@@ -9779,7 +9180,10 @@ function CopilotChatUserMessage({ message, onEditMessage, branchIndex, numberOfB
9779
9180
  disabled: !canGoNext,
9780
9181
  className: "cpk-user-message-branch-button",
9781
9182
  "aria-label": labels.userMessageToolbarNextBranchLabel,
9782
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "cpk-user-message-branch-icon" })
9183
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
9184
+ name: "ChevronRight",
9185
+ className: "cpk-user-message-branch-icon"
9186
+ })
9783
9187
  })
9784
9188
  ]
9785
9189
  });
@@ -9797,24 +9201,35 @@ var CopilotChatUserMessage_default = CopilotChatUserMessage;
9797
9201
  //#endregion
9798
9202
  //#region src/components/chat/CopilotChatReasoningMessage.tsx
9799
9203
  /**
9800
- * Formats an elapsed duration (in seconds) to a human-readable string.
9204
+ * The reasoning time as label text, such as "4 seconds" or "1m 5s".
9205
+ *
9206
+ * @param seconds - The elapsed time in seconds. It may have a fraction.
9207
+ * @param labels - The chat labels that hold the duration texts.
9801
9208
  */
9802
- function formatDuration$1(seconds) {
9803
- if (seconds < 1) return "a few seconds";
9804
- if (seconds < 60) return `${Math.round(seconds)} seconds`;
9805
- const mins = Math.floor(seconds / 60);
9806
- const secs = Math.round(seconds % 60);
9807
- if (secs === 0) return `${mins} minute${mins > 1 ? "s" : ""}`;
9808
- return `${mins}m ${secs}s`;
9209
+ function formatDuration(seconds, labels) {
9210
+ const duration = ɵformatReasoningDuration$1(seconds);
9211
+ switch (duration.unit) {
9212
+ case "fewSeconds": return labels.reasoningMessageDurationFewSeconds;
9213
+ case "seconds": return ɵformatLabel$1(labels.reasoningMessageDurationSeconds, { count: duration.seconds });
9214
+ case "minutes": return ɵformatCountLabel$1(duration.minutes, {
9215
+ one: labels.reasoningMessageDurationMinutesOne,
9216
+ other: labels.reasoningMessageDurationMinutesOther
9217
+ });
9218
+ case "minutesSeconds": return ɵformatLabel$1(labels.reasoningMessageDurationMinutesSeconds, {
9219
+ minutes: duration.minutes,
9220
+ seconds: duration.seconds
9221
+ });
9222
+ }
9809
9223
  }
9810
9224
  /**
9811
9225
  * A reasoning message as a collapsible block. While the model reasons it is
9812
9226
  * open and the header shows `labels.reasoningMessageThinkingLabel`; when
9813
- * streaming ends it collapses and the header reads "Thought for …". The
9227
+ * streaming ends it collapses and the header reads
9228
+ * `labels.reasoningMessageThoughtForLabel` ("Thought for 4 seconds"). The
9814
9229
  * `header` slot also receives `elapsedSeconds`.
9815
9230
  */
9816
9231
  function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: isLatestProp, header, contentView, toggle, children, className, ...props }) {
9817
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
9232
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
9818
9233
  const isLatest = isLatestProp ?? messages?.[messages.length - 1]?.id === message.id;
9819
9234
  const isStreaming = !!(isRunning && isLatest);
9820
9235
  const hasContent = !!(message.content && message.content.length > 0);
@@ -9844,7 +9259,7 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9844
9259
  userToggledRef.current = true;
9845
9260
  setIsOpen((prev) => !prev);
9846
9261
  } : void 0;
9847
- const label = isStreaming ? labels.reasoningMessageThinkingLabel : `Thought for ${formatDuration$1(elapsed)}`;
9262
+ const label = isStreaming ? labels.reasoningMessageThinkingLabel : ɵformatLabel$1(labels.reasoningMessageThoughtForLabel, { duration: formatDuration(elapsed, labels) });
9848
9263
  const boundHeader = renderSlot(header, CopilotChatReasoningMessage.Header, {
9849
9264
  isOpen,
9850
9265
  label,
@@ -9899,7 +9314,10 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, isLatest: i
9899
9314
  children: /* @__PURE__ */ jsx("span", { className: "cpk-reasoning-message-indicator-dot" })
9900
9315
  }),
9901
9316
  headerChildren,
9902
- isExpandable && /* @__PURE__ */ jsx(ChevronRight, { className: cn("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open") })
9317
+ isExpandable && /* @__PURE__ */ jsx(CopilotIcon, {
9318
+ name: "ChevronRight",
9319
+ className: cn("cpk-reasoning-message-chevron", isOpen && "cpk-reasoning-message-chevron-open")
9320
+ })
9903
9321
  ]
9904
9322
  });
9905
9323
  };
@@ -9953,7 +9371,8 @@ const CopilotChatSuggestionPill = React.forwardRef(function CopilotChatSuggestio
9953
9371
  ...props,
9954
9372
  children: [isLoading ? /* @__PURE__ */ jsx("span", {
9955
9373
  className: "cpk-suggestion-pill-icon",
9956
- children: /* @__PURE__ */ jsx(Loader2, {
9374
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
9375
+ name: "Loader2",
9957
9376
  className: "cpk-suggestion-pill-spinner",
9958
9377
  "aria-hidden": "true"
9959
9378
  })
@@ -10070,14 +9489,6 @@ const ScrollPinnedContext = React.createContext(false);
10070
9489
 
10071
9490
  //#endregion
10072
9491
  //#region src/components/chat/CopilotChatWorkSummary.tsx
10073
- /** "45s", "1m 5s", "2m". Used for the live timer and the final duration. */
10074
- function formatDuration(ms) {
10075
- const seconds = Math.max(0, Math.floor(ms / 1e3));
10076
- if (seconds < 60) return `${seconds}s`;
10077
- const minutes = Math.floor(seconds / 60);
10078
- const rest = seconds % 60;
10079
- return rest ? `${minutes}m ${rest}s` : `${minutes}m`;
10080
- }
10081
9492
  /** Re-renders every second while `active`, returning the current time. */
10082
9493
  function useNow(active) {
10083
9494
  const [now, setNow] = useState(() => Date.now());
@@ -10091,14 +9502,20 @@ function useNow(active) {
10091
9502
  }
10092
9503
  /**
10093
9504
  * The line at the top of a reply in the `"turn"` tool-call display. While the
10094
- * agent works it reads "Working 4s"; once the reply is done it reads "Worked
10095
- * for 9s · 7 tools" and toggles the work it folded away.
9505
+ * agent works it reads "Working 4s". Once the reply is done it reads "Worked
9506
+ * for 9s" and "7 tools", and toggles the work it folded away. The text comes
9507
+ * from the `workSummary...` and `toolCall...` chat labels.
10096
9508
  */
10097
9509
  function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSince, className, ...props }) {
9510
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
10098
9511
  const now = useNow(isWorking);
10099
- const failed = calls.filter((call) => call.toolMessage?.error).length;
9512
+ const failed = ɵcountFailedToolCalls$1(calls);
9513
+ const toolCount = ɵformatCountLabel$1(calls.length, {
9514
+ one: labels.toolCallToolCountOne,
9515
+ other: labels.toolCallToolCountOther
9516
+ });
10100
9517
  const liveMs = elapsedMs !== void 0 && workingSince !== void 0 ? elapsedMs + Math.max(0, now - workingSince) : void 0;
10101
- const duration = elapsedMs !== void 0 ? formatDuration(Math.max(1e3, elapsedMs)) : void 0;
9518
+ const duration = elapsedMs !== void 0 ? ɵformatWorkDuration$1(Math.max(1e3, elapsedMs)) : void 0;
10102
9519
  return /* @__PURE__ */ jsxs("button", {
10103
9520
  type: "button",
10104
9521
  "data-copilotkit": true,
@@ -10109,24 +9526,28 @@ function CopilotChatWorkSummary({ isWorking, isOpen, calls, elapsedMs, workingSi
10109
9526
  ...props,
10110
9527
  children: [isWorking ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
10111
9528
  className: "cpk-work-summary-label cpk-shimmer",
10112
- children: "Working"
9529
+ children: labels.workSummaryWorkingLabel
10113
9530
  }), liveMs !== void 0 && /* @__PURE__ */ jsx("span", {
10114
9531
  className: "cpk-work-summary-detail cpk-work-summary-timer",
10115
- children: formatDuration(liveMs)
9532
+ children: ɵformatWorkDuration$1(liveMs)
10116
9533
  })] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
10117
9534
  /* @__PURE__ */ jsx("span", {
10118
9535
  className: "cpk-work-summary-label",
10119
- children: duration ? `Worked for ${duration}` : `Used ${pluralize(calls.length, "tool")}`
9536
+ children: duration ? ɵformatLabel$1(labels.workSummaryWorkedForLabel, { duration }) : ɵformatCountLabel$1(calls.length, {
9537
+ one: labels.toolCallUsedToolsOne,
9538
+ other: labels.toolCallUsedToolsOther
9539
+ })
10120
9540
  }),
10121
9541
  duration && /* @__PURE__ */ jsx("span", {
10122
9542
  className: "cpk-work-summary-detail",
10123
- children: pluralize(calls.length, "tool")
9543
+ children: toolCount
10124
9544
  }),
10125
- failed > 0 && /* @__PURE__ */ jsxs("span", {
9545
+ failed > 0 && /* @__PURE__ */ jsx("span", {
10126
9546
  className: "cpk-work-summary-failed",
10127
- children: [failed, " failed"]
9547
+ children: ɵformatLabel$1(labels.toolCallFailedCountLabel, { count: failed })
10128
9548
  })
10129
- ] }), /* @__PURE__ */ jsx(ChevronRight, {
9549
+ ] }), /* @__PURE__ */ jsx(CopilotIcon, {
9550
+ name: "ChevronRight",
10130
9551
  "aria-hidden": "true",
10131
9552
  className: cn("cpk-work-summary-chevron", isOpen && "cpk-work-summary-chevron-open")
10132
9553
  })]
@@ -10541,68 +9962,6 @@ const MemoizedCustomMessage = React.memo(function MemoizedCustomMessage({ messag
10541
9962
  if (JSON.stringify(prevProps.stateSnapshot) !== JSON.stringify(nextProps.stateSnapshot)) return false;
10542
9963
  return true;
10543
9964
  });
10544
- /**
10545
- * Deduplicates messages by ID. For assistant messages, merges occurrences:
10546
- * recovers non-empty content from any earlier occurrence if the latest wiped it
10547
- * (empty string means the streaming update cleared the field, not blank text),
10548
- * and similarly recovers toolCalls from earlier occurrences if the latest is
10549
- * undefined (an empty array [] is treated as intentional and kept as-is).
10550
- * For all other roles, keeps the last entry.
10551
- *
10552
- * @internal Exported for unit testing only — not part of the public API.
10553
- */
10554
- /**
10555
- * Collapse tool calls that share an id, keeping first-seen order.
10556
- *
10557
- * AG-UI's TOOL_CALL_START handler appends to the parent message's `toolCalls`
10558
- * without checking whether that id is already present. So whenever a start
10559
- * event is applied twice — which the human-in-the-loop flow triggers when the
10560
- * run syncs after `respond()` — the message ends up carrying the same call
10561
- * twice. The second copy has EMPTY `arguments`, because a start event carries
10562
- * none; the args arrive later as TOOL_CALL_ARGS deltas addressed to the first
10563
- * copy.
10564
- *
10565
- * Left alone that renders the same tool call twice: once populated and once
10566
- * blank (an approval card with no transaction id, offering live buttons for an
10567
- * action already taken), and React warns "Encountered two children with the
10568
- * same key" because the call id is the render key.
10569
- *
10570
- * The empty copy is the redundant one, so prefer whichever entry actually
10571
- * carries arguments rather than blindly taking the first.
10572
- */
10573
- function dedupeToolCalls(toolCalls) {
10574
- const byId = /* @__PURE__ */ new Map();
10575
- for (const toolCall of toolCalls) {
10576
- const existing = byId.get(toolCall.id);
10577
- if (!existing) {
10578
- byId.set(toolCall.id, toolCall);
10579
- continue;
10580
- }
10581
- if (!existing.function?.arguments && toolCall.function?.arguments) byId.set(toolCall.id, toolCall);
10582
- }
10583
- return byId.size === toolCalls.length ? toolCalls : [...byId.values()];
10584
- }
10585
- function deduplicateMessages(messages) {
10586
- const acc = /* @__PURE__ */ new Map();
10587
- for (const message of messages) {
10588
- const existing = acc.get(message.id);
10589
- if (existing && message.role === "assistant" && existing.role === "assistant") {
10590
- const content = message.content || existing.content;
10591
- const toolCalls = message.toolCalls ?? existing.toolCalls;
10592
- acc.set(message.id, {
10593
- ...existing,
10594
- ...message,
10595
- content,
10596
- toolCalls: toolCalls ? dedupeToolCalls(toolCalls) : toolCalls
10597
- });
10598
- } else if (message.role === "assistant" && message.toolCalls) acc.set(message.id, {
10599
- ...message,
10600
- toolCalls: dedupeToolCalls(message.toolCalls)
10601
- });
10602
- else acc.set(message.id, message);
10603
- }
10604
- return [...acc.values()];
10605
- }
10606
9965
  /** A row holding a single message, rendered as it would be ungrouped. */
10607
9966
  function messageRow(message) {
10608
9967
  return {
@@ -10651,7 +10010,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
10651
10010
  if (!resolvedRunId) return void 0;
10652
10011
  return copilotkit.getStateByRun(config.agentId, config.threadId, resolvedRunId);
10653
10012
  };
10654
- const deduplicatedMessages = useMemo(() => deduplicateMessages(messages), [messages]);
10013
+ const deduplicatedMessages = useMemo(() => ɵdeduplicateMessages$1(messages), [messages]);
10655
10014
  const transformedMessages = useMemo(() => transformMessages ? transformMessages(deduplicatedMessages) : deduplicatedMessages, [deduplicatedMessages, transformMessages]);
10656
10015
  const rows = useMemo(() => groupMessages ? groupMessages(transformedMessages) : transformedMessages.map(messageRow), [transformedMessages, groupMessages]);
10657
10016
  const renderedMessages = useMemo(() => groupMessages ? rows.flatMap((row) => row.type === "group" ? row.messages : [row.message]) : transformedMessages, [
@@ -10661,13 +10020,13 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
10661
10020
  ]);
10662
10021
  const latestRenderedId = renderedMessages[renderedMessages.length - 1]?.id;
10663
10022
  const rendererNames = useToolCallRendererNames();
10664
- const toolCallLayouts = useMemo(() => toolCallDisplay === "separate" ? /* @__PURE__ */ new Map() : getToolCallLayouts(renderedMessages, messages, rendererNames), [
10023
+ const toolCallLayouts = useMemo(() => toolCallDisplay === "separate" ? /* @__PURE__ */ new Map() : ɵgetToolCallLayouts$1(renderedMessages, messages, rendererNames), [
10665
10024
  toolCallDisplay,
10666
10025
  renderedMessages,
10667
10026
  messages,
10668
10027
  rendererNames
10669
10028
  ]);
10670
- const turnWork = useMemo(() => toolCallDisplay === "turn" ? getTurnWork(renderedMessages, toolCallLayouts) : void 0, [
10029
+ const turnWork = useMemo(() => toolCallDisplay === "turn" ? ɵgetTurnWork$1(renderedMessages, toolCallLayouts) : void 0, [
10671
10030
  toolCallDisplay,
10672
10031
  renderedMessages,
10673
10032
  toolCallLayouts
@@ -10677,46 +10036,25 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
10677
10036
  for (const turn of turnWork?.values() ?? []) byFirst.set(turn.firstMessageId, turn);
10678
10037
  return byFirst;
10679
10038
  }, [turnWork]);
10680
- let latestTurnKey = "start";
10681
- for (let i = renderedMessages.length - 1; i >= 0; i--) if (renderedMessages[i].role === "user") {
10682
- latestTurnKey = renderedMessages[i].id;
10683
- break;
10684
- }
10685
- const isWorkingOn = (turnKey) => isRunning && turnKey === latestTurnKey;
10039
+ const latestTurnKey = ɵgetLatestTurnKey$1(renderedMessages);
10686
10040
  const [toggledTurns, setToggledTurns] = useState(() => /* @__PURE__ */ new Map());
10687
- const isWorkOpen = (turnKey) => toggledTurns.get(turnKey) ?? isWorkingOn(turnKey);
10041
+ const turnState = {
10042
+ toggledTurns,
10043
+ isRunning,
10044
+ latestTurnKey
10045
+ };
10688
10046
  const workTimesRef = useRef(/* @__PURE__ */ new Map());
10689
- if (toolCallDisplay === "turn") {
10690
- const now = Date.now();
10691
- const workTimes = workTimesRef.current;
10692
- if (isRunning) {
10693
- const times = workTimes.get(latestTurnKey);
10694
- if (times) times.workingSince ??= now;
10695
- else if (renderedMessages[renderedMessages.length - 1]?.role === "user") workTimes.set(latestTurnKey, {
10696
- elapsedMs: 0,
10697
- workingSince: now
10698
- });
10699
- } else for (const times of workTimes.values()) {
10700
- if (times.workingSince === void 0) continue;
10701
- times.elapsedMs += now - times.workingSince;
10702
- times.workingSince = void 0;
10703
- }
10704
- }
10705
- const { workOpen, workTextOpen } = useMemo(() => {
10706
- const open = /* @__PURE__ */ new Map();
10707
- const textOpen = /* @__PURE__ */ new Map();
10708
- for (const turn of turnWork?.values() ?? []) {
10709
- const turnOpen = toggledTurns.get(turn.key) ?? (isRunning && turn.key === latestTurnKey);
10710
- for (const id of turn.workMessageIds) {
10711
- open.set(id, turnOpen);
10712
- if (id !== turn.replyTextMessageId) textOpen.set(id, turnOpen);
10713
- }
10714
- }
10715
- return {
10716
- workOpen: open,
10717
- workTextOpen: textOpen
10718
- };
10719
- }, [
10047
+ if (toolCallDisplay === "turn") ɵrecordWorkTime$1(workTimesRef.current, {
10048
+ isRunning,
10049
+ latestTurnKey,
10050
+ lastMessageRole: renderedMessages[renderedMessages.length - 1]?.role,
10051
+ now: Date.now()
10052
+ });
10053
+ const { workOpen, workTextOpen } = useMemo(() => ɵgetWorkOpenState$1(turnWork?.values() ?? [], {
10054
+ toggledTurns,
10055
+ isRunning,
10056
+ latestTurnKey
10057
+ }), [
10720
10058
  turnWork,
10721
10059
  toggledTurns,
10722
10060
  isRunning,
@@ -10736,8 +10074,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
10736
10074
  workTextOpen
10737
10075
  ]);
10738
10076
  const renderWorkSummary = (turnKey, calls) => {
10739
- const working = isWorkingOn(turnKey);
10740
- const open = isWorkOpen(turnKey);
10077
+ const working = ɵisTurnWorking$1(turnKey, turnState);
10078
+ const open = ɵisTurnWorkOpen$1(turnKey, turnState);
10741
10079
  const times = workTimesRef.current.get(turnKey);
10742
10080
  return /* @__PURE__ */ jsx(Collapsible, {
10743
10081
  open: working || calls.length > 0,
@@ -11164,7 +10502,7 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
11164
10502
  * button named by `labels.attachmentRemoveButtonLabel`.
11165
10503
  */
11166
10504
  const CopilotChatAttachmentQueue = ({ attachments, onRemoveAttachment, className }) => {
11167
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
10505
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11168
10506
  if (attachments.length === 0) return null;
11169
10507
  return /* @__PURE__ */ jsx("div", {
11170
10508
  "data-testid": "copilot-attachment-queue",
@@ -11240,7 +10578,7 @@ function AudioPreview({ attachment }) {
11240
10578
  * lightbox.
11241
10579
  */
11242
10580
  function VideoPreview({ attachment }) {
11243
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
10581
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11244
10582
  const src = getSourceUrl(attachment.source);
11245
10583
  const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
11246
10584
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
@@ -11264,7 +10602,10 @@ function VideoPreview({ attachment }) {
11264
10602
  "aria-label": labels.attachmentPlayVideoButtonLabel,
11265
10603
  children: /* @__PURE__ */ jsx("div", {
11266
10604
  className: "cpk-attachment-queue-video-play-badge",
11267
- children: /* @__PURE__ */ jsx(Play, { className: "cpk-attachment-queue-video-play-icon" })
10605
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
10606
+ name: "Play",
10607
+ className: "cpk-attachment-queue-video-play-icon"
10608
+ })
11268
10609
  })
11269
10610
  }),
11270
10611
  open && /* @__PURE__ */ jsx(Lightbox, {
@@ -11317,6 +10658,7 @@ function useBlobUrl(attachment) {
11317
10658
  return url;
11318
10659
  }
11319
10660
  function DocumentLightboxContent({ attachment, vtName }) {
10661
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11320
10662
  const mimeType = attachment.source.mimeType;
11321
10663
  const blobUrl = useBlobUrl(attachment);
11322
10664
  if (isPdf(mimeType)) {
@@ -11364,20 +10706,21 @@ function DocumentLightboxContent({ attachment, vtName }) {
11364
10706
  className: "cpk-attachment-queue-document-card-details",
11365
10707
  children: [/* @__PURE__ */ jsx("div", {
11366
10708
  className: "cpk-attachment-queue-document-card-name",
11367
- children: attachment.filename || "Document"
10709
+ children: attachment.filename || labels.attachmentDocumentLabel
11368
10710
  }), /* @__PURE__ */ jsxs("div", {
11369
10711
  className: "cpk-attachment-queue-document-card-meta",
11370
- children: [mimeType || "Unknown type", attachment.size != null && ` · ${formatFileSize(attachment.size)}`]
10712
+ children: [mimeType || labels.attachmentUnknownTypeText, attachment.size != null && ` · ${formatFileSize(attachment.size)}`]
11371
10713
  })]
11372
10714
  }),
11373
10715
  /* @__PURE__ */ jsx("div", {
11374
10716
  className: "cpk-attachment-queue-document-card-note",
11375
- children: "No preview available for this file type"
10717
+ children: labels.attachmentNoPreviewText
11376
10718
  })
11377
10719
  ]
11378
10720
  });
11379
10721
  }
11380
10722
  function DocumentPreview({ attachment }) {
10723
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11381
10724
  const { thumbnailRef, vtName, open, openLightbox, closeLightbox } = useLightbox();
11382
10725
  const mimeType = attachment.source.mimeType;
11383
10726
  const previewable = canPreviewInBrowser(mimeType);
@@ -11392,7 +10735,7 @@ function DocumentPreview({ attachment }) {
11392
10735
  className: "cpk-attachment-queue-document-info",
11393
10736
  children: [/* @__PURE__ */ jsx("span", {
11394
10737
  className: "cpk-attachment-queue-document-name",
11395
- children: attachment.filename || "Document"
10738
+ children: attachment.filename || labels.attachmentDocumentLabel
11396
10739
  }), attachment.size != null && /* @__PURE__ */ jsx("span", {
11397
10740
  className: "cpk-attachment-queue-document-size",
11398
10741
  children: formatFileSize(attachment.size)
@@ -11529,13 +10872,17 @@ function computeOffsetTop(el, stopAt) {
11529
10872
  //#region src/components/chat/CopilotChatView.tsx
11530
10873
  const SCROLL_BUTTON_OFFSET = 16;
11531
10874
  function DropOverlay() {
10875
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11532
10876
  return /* @__PURE__ */ jsx("div", {
11533
10877
  className: "cpk-chat-view-drop-overlay",
11534
10878
  children: /* @__PURE__ */ jsxs("div", {
11535
10879
  className: "cpk-chat-view-drop-overlay-content",
11536
- children: [/* @__PURE__ */ jsx(Upload, { className: "cpk-chat-view-drop-overlay-icon" }), /* @__PURE__ */ jsx("span", {
10880
+ children: [/* @__PURE__ */ jsx(CopilotIcon, {
10881
+ name: "Upload",
10882
+ className: "cpk-chat-view-drop-overlay-icon"
10883
+ }), /* @__PURE__ */ jsx("span", {
11537
10884
  className: "cpk-chat-view-drop-overlay-label",
11538
- children: "Drop files here"
10885
+ children: labels.chatDropFilesLabel
11539
10886
  })]
11540
10887
  })
11541
10888
  });
@@ -11975,7 +11322,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11975
11322
  });
11976
11323
  };
11977
11324
  _CopilotChatView.ScrollToBottomButton = ({ className, ...props }) => {
11978
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
11325
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11979
11326
  return /* @__PURE__ */ jsx(Button, {
11980
11327
  "data-testid": "copilot-scroll-to-bottom",
11981
11328
  variant: "outline",
@@ -11983,7 +11330,10 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11983
11330
  className: cn("cpk-chat-view-scroll-to-bottom-button", className),
11984
11331
  "aria-label": labels.chatScrollToBottomLabel,
11985
11332
  ...props,
11986
- children: /* @__PURE__ */ jsx(ChevronDown, { className: "cpk-chat-view-scroll-to-bottom-icon" })
11333
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
11334
+ name: "ChevronDown",
11335
+ className: "cpk-chat-view-scroll-to-bottom-icon"
11336
+ })
11987
11337
  });
11988
11338
  };
11989
11339
  _CopilotChatView.Feather = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
@@ -11991,7 +11341,7 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
11991
11341
  ...props
11992
11342
  });
11993
11343
  _CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
11994
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
11344
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
11995
11345
  return /* @__PURE__ */ jsx("h1", {
11996
11346
  className: cn("cpk-chat-view-welcome-message", className),
11997
11347
  ...props,
@@ -12037,119 +11387,6 @@ function CopilotChatView({ messageView, input, scrollView, suggestionView, welco
12037
11387
  })(CopilotChatView || (CopilotChatView = {}));
12038
11388
  var CopilotChatView_default = CopilotChatView;
12039
11389
 
12040
- //#endregion
12041
- //#region src/lib/transcription-client.ts
12042
- /**
12043
- * Convert a Blob to a base64 string
12044
- */
12045
- async function blobToBase64(blob) {
12046
- return new Promise((resolve, reject) => {
12047
- const reader = new FileReader();
12048
- reader.onloadend = () => {
12049
- const base64 = reader.result.split(",")[1];
12050
- resolve(base64 ?? "");
12051
- };
12052
- reader.onerror = () => reject(/* @__PURE__ */ new Error("Failed to read audio data"));
12053
- reader.readAsDataURL(blob);
12054
- });
12055
- }
12056
- /**
12057
- * Check if an error response matches our expected format
12058
- */
12059
- function isTranscriptionErrorResponse(data) {
12060
- return typeof data === "object" && data !== null && "error" in data && "message" in data && typeof data.error === "string" && typeof data.message === "string";
12061
- }
12062
- /**
12063
- * Parse error info from a transcription error response
12064
- */
12065
- function parseTranscriptionError(response) {
12066
- return {
12067
- code: response.error,
12068
- message: response.message,
12069
- retryable: response.retryable ?? false
12070
- };
12071
- }
12072
- /**
12073
- * Custom error type for transcription failures.
12074
- * Extends Error with transcription-specific info for contextual error handling.
12075
- */
12076
- var TranscriptionError = class extends Error {
12077
- constructor(info) {
12078
- super(info.message);
12079
- this.name = "TranscriptionError";
12080
- this.info = info;
12081
- }
12082
- };
12083
- /**
12084
- * Transcribe an audio blob using the CopilotKit runtime
12085
- *
12086
- * Supports both REST mode (multipart/form-data) and single-endpoint mode (base64 JSON)
12087
- *
12088
- * @throws {TranscriptionError} When transcription fails with typed error information
12089
- */
12090
- async function transcribeAudio(core, audioBlob, filename = "recording.webm") {
12091
- const runtimeUrl = core.runtimeUrl;
12092
- if (!runtimeUrl) throw new TranscriptionError({
12093
- code: TranscriptionErrorCode$1.INVALID_REQUEST,
12094
- message: "Runtime URL is not configured",
12095
- retryable: false
12096
- });
12097
- const headers = { ...await core.resolveHeaders() };
12098
- let response;
12099
- try {
12100
- if (core.runtimeTransport === "single") {
12101
- const base64Audio = await blobToBase64(audioBlob);
12102
- headers["Content-Type"] = "application/json";
12103
- response = await fetch(runtimeUrl, {
12104
- method: "POST",
12105
- headers,
12106
- body: JSON.stringify({
12107
- method: "transcribe",
12108
- body: {
12109
- audio: base64Audio,
12110
- mimeType: audioBlob.type || "audio/webm",
12111
- filename
12112
- }
12113
- })
12114
- });
12115
- } else {
12116
- delete headers["Content-Type"];
12117
- const formData = new FormData();
12118
- formData.append("audio", audioBlob, filename);
12119
- response = await fetch(`${runtimeUrl}/transcribe`, {
12120
- method: "POST",
12121
- headers,
12122
- body: formData
12123
- });
12124
- }
12125
- } catch (error) {
12126
- throw new TranscriptionError({
12127
- code: TranscriptionErrorCode$1.NETWORK_ERROR,
12128
- message: error instanceof Error ? error.message : "Network request failed",
12129
- retryable: true
12130
- });
12131
- }
12132
- if (!response.ok) {
12133
- let errorData;
12134
- try {
12135
- errorData = await response.json();
12136
- } catch {
12137
- throw new TranscriptionError({
12138
- code: TranscriptionErrorCode$1.PROVIDER_ERROR,
12139
- message: `HTTP ${response.status}: ${response.statusText}`,
12140
- retryable: response.status >= 500
12141
- });
12142
- }
12143
- if (isTranscriptionErrorResponse(errorData)) throw new TranscriptionError(parseTranscriptionError(errorData));
12144
- throw new TranscriptionError({
12145
- code: TranscriptionErrorCode$1.PROVIDER_ERROR,
12146
- message: typeof errorData === "object" && errorData !== null && "message" in errorData ? String(errorData.message) : "Transcription failed",
12147
- retryable: response.status >= 500
12148
- });
12149
- }
12150
- return await response.json();
12151
- }
12152
-
12153
11390
  //#endregion
12154
11391
  //#region src/providers/use-inspector-thread-override.ts
12155
11392
  function useInspectorThreadOverride(args) {
@@ -12631,7 +11868,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12631
11868
  }
12632
11869
  if (!isCurrentSelection()) return false;
12633
11870
  if (failedConnectionsRef.current.has(agent)) {
12634
- setTranscriptionError("Could not load saved conversation. Reopen the thread and try again.");
11871
+ setTranscriptionError({ labelKey: "threadLoadErrorText" });
12635
11872
  return "failed";
12636
11873
  }
12637
11874
  const maybeAware = agent;
@@ -12656,7 +11893,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12656
11893
  const onSubmitInput = useCallback(async (value) => {
12657
11894
  if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
12658
11895
  console.error("[CopilotKit] Cannot send while attachments are uploading (pre-await guard)");
12659
- setTranscriptionError("Cannot send while attachments are uploading.");
11896
+ setTranscriptionError({ labelKey: "chatAttachmentsUploadingText" });
12660
11897
  return;
12661
11898
  }
12662
11899
  setInputValue("");
@@ -12668,7 +11905,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12668
11905
  }
12669
11906
  if (selectedAttachmentsRef.current.some((a) => a.status === "uploading")) {
12670
11907
  console.error("[CopilotKit] Cannot send while attachments are uploading (post-await re-check)");
12671
- setTranscriptionError("Cannot send while attachments are uploading.");
11908
+ setTranscriptionError({ labelKey: "chatAttachmentsUploadingText" });
12672
11909
  setInputValue(value);
12673
11910
  return;
12674
11911
  }
@@ -12786,7 +12023,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12786
12023
  setIsTranscribing(true);
12787
12024
  try {
12788
12025
  setTranscriptionError(null);
12789
- const result = await transcribeAudio(copilotkit, audioBlob);
12026
+ const result = await ɵtranscribeAudio$1(copilotkit, audioBlob);
12790
12027
  setInputValue((prev) => {
12791
12028
  const trimmedPrev = prev.trim();
12792
12029
  if (trimmedPrev) return `${trimmedPrev} ${result.text}`;
@@ -12794,33 +12031,10 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12794
12031
  });
12795
12032
  } catch (error) {
12796
12033
  console.error("CopilotChat: Transcription failed", error);
12797
- if (error instanceof TranscriptionError) {
12798
- const { code, retryable, message } = error.info;
12799
- switch (code) {
12800
- case TranscriptionErrorCode.RATE_LIMITED:
12801
- setTranscriptionError("Too many requests. Please wait a moment.");
12802
- break;
12803
- case TranscriptionErrorCode.AUTH_FAILED:
12804
- setTranscriptionError("Authentication error. Please check your configuration.");
12805
- break;
12806
- case TranscriptionErrorCode.AUDIO_TOO_LONG:
12807
- setTranscriptionError("Recording is too long. Please try a shorter recording.");
12808
- break;
12809
- case TranscriptionErrorCode.AUDIO_TOO_SHORT:
12810
- setTranscriptionError("Recording is too short. Please try again.");
12811
- break;
12812
- case TranscriptionErrorCode.INVALID_AUDIO_FORMAT:
12813
- setTranscriptionError("Audio format not supported.");
12814
- break;
12815
- case TranscriptionErrorCode.SERVICE_NOT_CONFIGURED:
12816
- setTranscriptionError("Transcription service is not available.");
12817
- break;
12818
- case TranscriptionErrorCode.NETWORK_ERROR:
12819
- setTranscriptionError("Network error. Please check your connection.");
12820
- break;
12821
- default: setTranscriptionError(retryable ? "Transcription failed. Please try again." : message);
12822
- }
12823
- } else setTranscriptionError("Transcription failed. Please try again.");
12034
+ if (error instanceof TranscriptionError$1) {
12035
+ const labelKey = ɵtranscriptionErrorMessageKey$1(error.info);
12036
+ setTranscriptionError(labelKey ? { labelKey } : { text: error.info.message });
12037
+ } else setTranscriptionError({ labelKey: "transcriptionErrorGenericText" });
12824
12038
  } finally {
12825
12039
  setIsTranscribing(false);
12826
12040
  }
@@ -12852,11 +12066,7 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12852
12066
  const effectiveStopHandler = agent.isRunning && hasMessages ? providedStopHandler ?? stopCurrentRun : providedStopHandler;
12853
12067
  const showTranscription = isTranscriptionEnabled && isMediaRecorderSupported;
12854
12068
  const effectiveMode = isTranscribing ? "processing" : transcribeMode;
12855
- const messages = useMemo(() => [...agent.messages], [agent.messages.map((m) => {
12856
- const contentKey = typeof m.content === "string" ? m.content.length : Array.isArray(m.content) ? m.content.length : m.content && typeof m.content === "object" ? JSON.stringify(m.content) : 0;
12857
- const toolCallsKey = "toolCalls" in m && Array.isArray(m.toolCalls) ? m.toolCalls.map((tc) => `${tc.id}:${tc.function?.arguments?.length ?? 0}`).join(";") : "";
12858
- return `${m.id}:${m.role}:${contentKey}:${toolCallsKey}`;
12859
- }).join(",")]);
12069
+ const messages = useMemo(() => [...agent.messages], [ɵmessagesFingerprint$1(agent.messages)]);
12860
12070
  const lastUserMessageId = useMemo(() => {
12861
12071
  for (let i = messages.length - 1; i >= 0; i--) if (messages[i].role === "user") return messages[i].id;
12862
12072
  return null;
@@ -12928,7 +12138,11 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12928
12138
  fontSize: "14px",
12929
12139
  zIndex: 50
12930
12140
  },
12931
- children: transcriptionError
12141
+ children: "labelKey" in transcriptionError ? {
12142
+ ...CopilotChatDefaultLabels$1,
12143
+ ...existingConfig?.labels,
12144
+ ...labels
12145
+ }[transcriptionError.labelKey] : transcriptionError.text
12932
12146
  }),
12933
12147
  /* @__PURE__ */ jsx(LastUserMessageContext.Provider, {
12934
12148
  value: lastUserMessageState,
@@ -12951,16 +12165,18 @@ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isMo
12951
12165
  //#endregion
12952
12166
  //#region src/components/chat/CopilotChatToggleButton.tsx
12953
12167
  const ICON_CLASS = "cpk-chat-toggle-button-icon";
12954
- const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(MessageCircle, {
12168
+ const DefaultOpenIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(CopilotIcon, {
12955
12169
  className: className ?? ICON_CLASS,
12956
12170
  strokeWidth: 1.75,
12957
12171
  fill: "currentColor",
12958
- ...props
12172
+ ...props,
12173
+ name: "MessageCircle"
12959
12174
  });
12960
- const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(X, {
12175
+ const DefaultCloseIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(CopilotIcon, {
12961
12176
  className: className ?? ICON_CLASS,
12962
12177
  strokeWidth: 1.75,
12963
- ...props
12178
+ ...props,
12179
+ name: "X"
12964
12180
  });
12965
12181
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
12966
12182
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
@@ -12969,7 +12185,7 @@ const ICON_WRAPPER_CLASS = "cpk-chat-toggle-button-icon-wrapper";
12969
12185
  const CopilotChatToggleButton = React.forwardRef(function CopilotChatToggleButton({ openIcon, closeIcon, className, ...buttonProps }, ref) {
12970
12186
  const { onClick, type, disabled, ...restProps } = buttonProps;
12971
12187
  const configuration = useCopilotChatConfiguration();
12972
- const labels = configuration?.labels ?? CopilotChatDefaultLabels;
12188
+ const labels = configuration?.labels ?? CopilotChatDefaultLabels$1;
12973
12189
  const [fallbackOpen, setFallbackOpen] = useState(false);
12974
12190
  const isOpen = configuration?.isModalOpen ?? fallbackOpen;
12975
12191
  const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;
@@ -13086,7 +12302,7 @@ function useIsMobileViewport() {
13086
12302
  }
13087
12303
  function CopilotModalHeader({ title, titleContent, closeButton, drawerLauncher, children, className, ...rest }) {
13088
12304
  const configuration = useCopilotChatConfiguration();
13089
- const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;
12305
+ const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels$1.modalHeaderTitle;
13090
12306
  const resolvedTitle = title ?? fallbackTitle;
13091
12307
  const isMobile = useIsMobileViewport();
13092
12308
  const drawerRegistered = (configuration?.drawerRegistered ?? false) && isMobile;
@@ -13142,28 +12358,30 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
13142
12358
  children
13143
12359
  });
13144
12360
  _CopilotModalHeader.CloseButton = ({ className, ...props }) => {
13145
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
12361
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
13146
12362
  return /* @__PURE__ */ jsx("button", {
13147
12363
  type: "button",
13148
12364
  "data-testid": "copilot-close-button",
13149
12365
  className: cn("cpk-modal-header-close-button", className),
13150
12366
  "aria-label": labels.modalHeaderCloseButtonLabel,
13151
12367
  ...props,
13152
- children: /* @__PURE__ */ jsx(X, {
12368
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
12369
+ name: "X",
13153
12370
  className: "cpk-modal-header-close-icon",
13154
12371
  "aria-hidden": "true"
13155
12372
  })
13156
12373
  });
13157
12374
  };
13158
12375
  _CopilotModalHeader.DrawerLauncher = ({ className, ...props }) => {
13159
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
12376
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels$1;
13160
12377
  return /* @__PURE__ */ jsx("button", {
13161
12378
  type: "button",
13162
12379
  "data-testid": "copilot-threads-drawer-launcher",
13163
12380
  className: cn("cpk-modal-header-drawer-launcher", className),
13164
12381
  "aria-label": labels.modalHeaderThreadsButtonLabel,
13165
12382
  ...props,
13166
- children: /* @__PURE__ */ jsx(PanelLeftOpen, {
12383
+ children: /* @__PURE__ */ jsx(CopilotIcon, {
12384
+ name: "PanelLeftOpen",
13167
12385
  className: "cpk-modal-header-drawer-launcher-icon",
13168
12386
  "aria-hidden": "true"
13169
12387
  })
@@ -13268,7 +12486,7 @@ function CopilotSidebarViewInternal({ header, toggleButton, width, position = "r
13268
12486
  paddingBottom: "env(safe-area-inset-bottom)"
13269
12487
  },
13270
12488
  "aria-hidden": !isSidebarOpen,
13271
- "aria-label": configuration?.labels.sidebarLabel ?? CopilotChatDefaultLabels.sidebarLabel,
12489
+ "aria-label": configuration?.labels.sidebarLabel ?? CopilotChatDefaultLabels$1.sidebarLabel,
13272
12490
  role: "complementary",
13273
12491
  children: /* @__PURE__ */ jsxs("div", {
13274
12492
  className: "cpk-sidebar-view-panel",
@@ -13349,7 +12567,7 @@ function CopilotPopupViewInternal({ header, toggleButton, width, height, clickOu
13349
12567
  const configuration = useCopilotChatConfiguration();
13350
12568
  const isPopupOpen = configuration?.isModalOpen ?? false;
13351
12569
  const setModalOpen = configuration?.setModalOpen;
13352
- const labels = configuration?.labels ?? CopilotChatDefaultLabels;
12570
+ const labels = configuration?.labels ?? CopilotChatDefaultLabels$1;
13353
12571
  const containerRef = useRef(null);
13354
12572
  const [isRendered, setIsRendered] = useState(isPopupOpen);
13355
12573
  const [isAnimatingOut, setIsAnimatingOut] = useState(false);
@@ -13917,5 +13135,5 @@ const WildcardToolCallRender = defineToolCallRenderer({
13917
13135
  });
13918
13136
 
13919
13137
  //#endregion
13920
- export { A2UI_FENCE_LANGUAGE, ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError, AGUIError, AGUI_METADATA_KEY, AbstractAgent, ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AgentRegistry, AgentThreadLockedError, AssistantMessageSchema, AttributableSchema, AudioInputContentSchema, AudioInputPartSchema, AudioPartSchema, AudioRecorderError, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, BaseEventSchema, BaseMessageSchema, BasicMarkdownRenderer, CompatibilityBoundary, ContentPartSchema, ContextSchema, ContextStore, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView, CopilotChatReasoningMessage_default as CopilotChatReasoningMessage, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallGroup, CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotChatWorkSummary, CopilotKitCore, CopilotKitCoreErrorCode, CopilotKitCoreReact, CopilotKitCoreRuntimeConnectionStatus, CopilotKitHeaderResolutionError, CopilotKitInspector, CopilotKitProvider, CopilotKitStyles, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, CopilotThreadsDrawer, CopyOperationSchema, CustomEventSchema, DataSourceSchema, DebugLogger, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchemas, EventType, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FilterToolCallsMiddleware, FunctionCallSchema, FunctionMiddleware, GenerateSandboxedUiArgsSchema, HttpAgent, HumanInTheLoopCapabilitiesSchema, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, INTELLIGENCE_TURN_HEAD, INTERRUPT_EVENT_NAME, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, ImagePartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, IntelligenceAgent, IntelligenceIndicator, IntelligenceIndicatorView, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, MEMORY_ERROR_REGISTRY, MarkdownRendererProvider, MemoryError, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, Middleware, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OpenGenerativeUIActivityRenderer, OpenGenerativeUIActivityType, OpenGenerativeUIContentSchema, OpenGenerativeUIToolRenderer, OptionalMetadataSchema, OutputCapabilitiesSchema, PROTOCOL_VERSION, PartSourceSchema, ProxiedCopilotRuntimeAgent, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunHandler, RunStartedEventSchema, SandboxFunctionsContext, StateCapabilitiesSchema, StateDeltaEventSchema, StateManager, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, StreamingMarkdownDefaultRenderer, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SuggestionEngine, SystemMessageSchema, TestOperationSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TextPartSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolCallStatus, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TransportCapabilitiesSchema, UrlSourceSchema, UseAgentUpdate, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, VideoPartSchema, WebMCPRegistry, WildcardToolCallRender, a2uiDefaultTheme, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, classifySurfaceCards, compactEvents, completePartialMarkdown, contentHasMedia, contentToText, convertToLegacyEvents, createA2UIMessageRenderer, createActionGroup, createDebugLogger, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, defaultApplyEvents, defineToolCallRenderer, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, enforceEvents, enforceOutgoingInput, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getIntelligenceTurnAnchors, getMarkdownOperationSurfaceId, getRunOutcome, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInterruptExpired, isRecognizedEvent, isRunCompletionAware, mergeMetadata, messageGroup, messageRow, ofType, omitOptionalNulls, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseMarkdown, parseProtoStream, parseSSEStream, parseToolArguments, prepareSurfaceOperations, props, randomUUID, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, segmentSurfaceProse, select, splitA2UIMarkdown, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useFrontendTools, useHumanInTheLoop, useInterrupt, useLearnFromUserAction, useLearnFromUserActionInCurrentThread, useLearningContainers, useLearningContainersInCurrentThread, useLicenseContext, useMarkdownRenderer, useMemories, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads, verifyEvents, withAuthoritativeActivityTypes, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵMAX_SOCKET_RETRIES, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵclearAgentInterruptState, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵrunMcpFollowUp, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
13138
+ export { A2UI_FENCE_LANGUAGE, ACTIVITY_HISTORY_METADATA, AGUIConnectNotImplementedError, AGUIError, AGUI_METADATA_KEY, AbstractAgent, ActivityDeltaEventSchema, ActivityMessageSchema, ActivitySnapshotEventSchema, AddOperationSchema, AgentCapabilitiesSchema, AgentRegistry, AgentThreadLockedError, AssistantMessageSchema, AttributableSchema, AudioInputContentSchema, AudioInputPartSchema, AudioPartSchema, AudioRecorderError, BackwardCompatibility_0_0_39, BackwardCompatibility_0_0_45, BackwardCompatibility_0_0_57, BaseEventSchema, BaseMessageSchema, CompatibilityBoundary, ContentPartSchema, ContextSchema, ContextStore, CopilotChat, CopilotChatAssistantMessage_default as CopilotChatAssistantMessage, CopilotChatAttachmentQueue, CopilotChatAttachmentRenderer, CopilotChatAudioRecorder, CopilotChatConfigurationProvider, CopilotChatDefaultLabels, CopilotChatInput_default as CopilotChatInput, CopilotChatMessageView, CopilotChatReasoningMessage_default as CopilotChatReasoningMessage, CopilotChatSuggestionPill, CopilotChatSuggestionView, CopilotChatToggleButton, DefaultCloseIcon as CopilotChatToggleButtonCloseIcon, DefaultOpenIcon as CopilotChatToggleButtonOpenIcon, CopilotChatToolCallGroup, CopilotChatToolCallsView, CopilotChatUserMessage_default as CopilotChatUserMessage, CopilotChatView_default as CopilotChatView, CopilotChatWorkSummary, CopilotKitCore, CopilotKitCoreErrorCode, CopilotKitCoreReact, CopilotKitCoreRuntimeConnectionStatus, CopilotKitHeaderResolutionError, CopilotKitInspector, CopilotKitProvider, CopilotKitStyles, CopilotModalHeader, CopilotPopup, CopilotPopupView, CopilotSidebar, CopilotSidebarView, CopilotThreadsDrawer, CopyOperationSchema, CustomEventSchema, DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL, DataSourceSchema, DebugLogger, DeveloperMessageSchema, DocumentInputContentSchema, DocumentInputPartSchema, DocumentPartSchema, EventSchema, EventSchemas, EventType, EventTypeSchema, ExecutionCapabilitiesSchema, FileSourceSchema, FilterToolCallsMiddleware, FunctionCallSchema, FunctionMiddleware, GENERATE_SANDBOXED_UI_TOOL_NAME, GenerateSandboxedUiArgsSchema, HttpAgent, HumanInTheLoopCapabilitiesSchema, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, INTELLIGENCE_TURN_HEAD, INTERRUPT_EVENT_NAME, IdentityCapabilitiesSchema, ImageInputContentSchema, ImageInputPartSchema, ImagePartSchema, InputContentDataSourceSchema, InputContentSchema, InputContentSourceSchema, InputContentUrlSourceSchema, IntelligenceAgent, IntelligenceIndicator, IntelligenceIndicatorView, InterruptSchema, JsonPatchOperationSchema, JsonPatchSchema, JsonPointerSchema, MCPAppsActivityContentSchema, MCPAppsActivityRenderer, MCPAppsActivityType, MEMORY_ERROR_REGISTRY, MarkdownRendererProvider, MemoryError, MessageSchema, MessagesSnapshotEventSchema, MetadataSchema, Middleware, MoveOperationSchema, MultiAgentCapabilitiesSchema, MultimodalCapabilitiesSchema, MultimodalInputCapabilitiesSchema, MultimodalOutputCapabilitiesSchema, OPEN_GENERATIVE_UI_ACTIVITY_TYPE, OpenGenerativeUIActivityRenderer, OpenGenerativeUIActivityType, OpenGenerativeUIContentSchema, OpenGenerativeUIToolRenderer, OptionalMetadataSchema, OutputCapabilitiesSchema, PROTOCOL_VERSION, PartSourceSchema, ProxiedCopilotRuntimeAgent, RawEventSchema, ReasoningCapabilitiesSchema, ReasoningEncryptedValueEventSchema, ReasoningEncryptedValueSubtypeSchema, ReasoningEndEventSchema, ReasoningMessageChunkEventSchema, ReasoningMessageContentEventSchema, ReasoningMessageEndEventSchema, ReasoningMessageSchema, ReasoningMessageStartEventSchema, ReasoningStartEventSchema, RemoveOperationSchema, ReplaceOperationSchema, ResumeEntrySchema, RoleSchema, RunAgentInputSchema, RunErrorEventSchema, RunFinishedCancelledOutcomeSchema, RunFinishedEventSchema, RunFinishedInterruptOutcomeSchema, RunFinishedOutcomeSchema, RunFinishedSuccessOutcomeSchema, RunHandler, RunStartedEventSchema, SandboxFunctionsContext, StateCapabilitiesSchema, StateDeltaEventSchema, StateManager, StateSchema, StateSnapshotEventSchema, StepFinishedEventSchema, StepStartedEventSchema, StreamingMarkdownDefaultRenderer, SubagentErrorEventSchema, SubagentFinishedEventSchema, SubagentFinishedOutcomeSchema, SubagentFinishedSuccessOutcomeSchema, SubagentFinishedSuspendedOutcomeSchema, SubagentInfoSchema, SubagentRunIdSchema, SubagentStartedEventSchema, SuggestionEngine, SystemMessageSchema, TestOperationSchema, TextInputContentSchema, TextMessageChunkEventSchema, TextMessageContentEventSchema, TextMessageEndEventSchema, TextMessageRoleSchema, TextMessageStartEventSchema, TextPartSchema, TokenUsageSchema, ToolCallArgsEventSchema, ToolCallChunkEventSchema, ToolCallEndEventSchema, ToolCallResultEventSchema, ToolCallSchema, ToolCallStartEventSchema, ToolCallStatus, ToolMessageSchema, ToolSchema, ToolsCapabilitiesSchema, TranscriptionError, TranscriptionErrorCode, TransportCapabilitiesSchema, UrlSourceSchema, UseAgentUpdate, UserMessageSchema, VideoInputContentSchema, VideoInputPartSchema, VideoPartSchema, WebMCPRegistry, WildcardToolCallRender, a2uiDefaultTheme, aggregateTokenUsage, authoritativeActivityTypes, buildResumeArray, classifySurfaceCards, compactEvents, completePartialMarkdown, contentHasMedia, contentToText, convertToLegacyEvents, createA2UIMessageRenderer, createActionGroup, createDebugLogger, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, defaultApplyEvents, defineToolCallRenderer, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, enforceEvents, enforceOutgoingInput, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getIntelligenceTurnAnchors, getMarkdownOperationSurfaceId, getRunOutcome, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isInterruptExpired, isRecognizedEvent, isRunCompletionAware, mergeMetadata, messageGroup, messageRow, ofType, omitOptionalNulls, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseProtoStream, parseSSEStream, parseToolArguments, prepareSurfaceOperations, props, randomUUID, resolveAgentDebugConfig, resolveDebugLogger, runHttpRequest, segmentSurfaceProse, select, splitA2UIMarkdown, structuredClone_, tokenUsageFromAiSdkUsage, tokenUsageFromLangChainMetadata, transformChunks, transformHttpEventStream, useAgent, useAgentContext, useAttachments, useCapabilities, useComponent, useConfigureSuggestions, useCopilotChatConfiguration, useCopilotKit, useDefaultRenderTool, useFrontendTool, useFrontendTools, useHumanInTheLoop, useInterrupt, useLearnFromUserAction, useLearnFromUserActionInCurrentThread, useLicenseContext, useMarkdownRenderer, useMemories, useRenderActivityMessage, useRenderCustomMessages, useRenderTool, useRenderToolCall, useSandboxFunctions, useSuggestions, useThreads, verifyEvents, withAuthoritativeActivityTypes, ɵCOPILOTKIT_FEATURES, ɵInterruptState, ɵMAX_SOCKET_RETRIES, ɵOpenGenerativeUIController, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵclearAgentInterruptState, ɵcomposerButtonState, ɵcopilotIconSvgAttributes, ɵcopilotIcons, ɵcountFailedToolCalls, ɵcreateMemoryStore, ɵcreateThreadSelectors, ɵcreateThreadStore, ɵdeduplicateMessages, ɵextractCompleteStyles, ɵformatCountLabel, ɵformatLabel, ɵformatReasoningDuration, ɵformatToolNames, ɵformatWorkDuration, ɵgetAgentInterruptState, ɵgetArgumentPreview, ɵgetLatestTurnKey, ɵgetToolCallLayouts, ɵgetToolCallPreview, ɵgetToolCallRendererNames, ɵgetToolCallRowStatus, ɵgetToolResults, ɵgetTurnWork, ɵgetWorkOpenState, ɵisCopilotKitFeature, ɵisHttpAgent, ɵisRetryableMemoryStatus, ɵisTurnWorkOpen, ɵisTurnWorking, ɵjoinPhoenixChannel$, ɵloadWebsandbox, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵmessagesFingerprint, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵpluralize, ɵprocessPartialHtml, ɵrecordWorkTime, ɵresolveActivityRenderer, ɵresolveComposerKey, ɵresolveCustomMessageRenderers, ɵresolveLicenseState, ɵresolveThreadsLicense, ɵresolveToolCallRenderer, ɵrunMcpFollowUp, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵstringifyToolCallPayload, ɵthreadAdapterEvents, ɵtranscribeAudio, ɵtranscriptionErrorMessageKey, ɵwithHeaderDefaults };
13921
13139
  //# sourceMappingURL=index.mjs.map