@copilotkit/core 2.0.0-rc.6 → 2.0.0-rc.8

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.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as _ag_ui_client0 from "@ag-ui/client";
2
- import { AbstractAgent, AgentCapabilities, AgentSubscriber, BaseEvent, Context, HttpAgent, HttpAgentConfig, Interrupt, Message, ResumeEntry, RunAgentInput, RunAgentParameters, RunAgentResult, State, Tool, ToolCall } from "@ag-ui/client";
2
+ import { AbstractAgent, ActivityMessage, AgentCapabilities, AgentSubscriber, BaseEvent, Context, HttpAgent, HttpAgentConfig, Interrupt, Message, ResumeEntry, RunAgentInput, RunAgentParameters, RunAgentResult, State, Tool, ToolCall } from "@ag-ui/client";
3
3
  import { CaptureOptions, CollectorOptions, JsonValue, JsonValue as JsonValue$1, StartResult, StartResult as StartResult$1, TrajectoryCaptureOptions } from "@copilotkit/learning";
4
- import { A2UIOperation, CopilotKitUIEnvelope, DebugConfig, GenerativeUIComponentManifest, GenerativeUIJSONSchema, GenerativeUIRejectedOperation, GenerativeUISurfaceStatus, GenerativeUITarget, InspectorMetadataV1, InspectorMetadataV1 as InspectorMetadataV1$1, IntelligenceRuntimeInfo, IntelligenceRuntimeInfo as IntelligenceRuntimeInfo$1, ResolvedDebugConfig, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeLicenseStatus as RuntimeLicenseStatus$1, RuntimeMode, RuntimeMode as RuntimeMode$1, StandardSchemaV1, ThreadEndpointRuntimeInfo, ThreadEndpointRuntimeInfo as ThreadEndpointRuntimeInfo$1 } from "@copilotkit/shared";
4
+ import { A2UIOperation, CopilotKitUIEnvelope, DebugConfig, GenerativeUIComponentManifest, GenerativeUIJSONSchema, GenerativeUIRejectedOperation, GenerativeUISurfaceStatus, GenerativeUITarget, InspectorMetadataV1, InspectorMetadataV1 as InspectorMetadataV1$1, IntelligenceRuntimeInfo, IntelligenceRuntimeInfo as IntelligenceRuntimeInfo$1, LicenseContextValue, ResolvedDebugConfig, RuntimeEntitlementResponse, RuntimeInfo, RuntimeLicenseStatus, RuntimeLicenseStatus as RuntimeLicenseStatus$1, RuntimeMode, RuntimeMode as RuntimeMode$1, StandardSchemaV1, ThreadEndpointRuntimeInfo, ThreadEndpointRuntimeInfo as ThreadEndpointRuntimeInfo$1, TranscriptionErrorCode } from "@copilotkit/shared";
5
5
  import { Observable, OperatorFunction, Subscription } from "rxjs";
6
- import { Token, Tokens, TokensList } from "marked";
6
+ import { Message as Message$1, ToolCall as ToolCall$1, ToolMessage } from "@ag-ui/core";
7
7
 
8
8
  //#region src/core/learning-bridge.d.ts
9
9
  /** Interaction capture settings for {@link CopilotKitCore}. See `@copilotkit/learning`. */
@@ -410,6 +410,13 @@ declare class AgentRegistry {
410
410
  private core;
411
411
  private _agents;
412
412
  private localAgents;
413
+ /**
414
+ * Whether `onAgentsChanged` has run since {@link initialize}. Constructor
415
+ * agents are not announced, so the first `setAgents__unsafe_dev_only` with
416
+ * the same agents must still announce them (core subscribes to agents on
417
+ * that notification).
418
+ */
419
+ private agentsPublished;
413
420
  private remoteAgents;
414
421
  private readonly mintedThreadIds;
415
422
  private _runtimeUrl?;
@@ -455,6 +462,12 @@ declare class AgentRegistry {
455
462
  private runtimeRecoveryRunning;
456
463
  private runtimeRecoveryPending;
457
464
  private runtimeHealthGeneration;
465
+ /**
466
+ * Aborted by {@link dispose}. Runtime probes, recovery fetches and request
467
+ * watchdogs listen to it so a disposed core leaves no timer or request
468
+ * behind.
469
+ */
470
+ private readonly disposeController;
458
471
  /**
459
472
  * The headers each HttpAgent was constructed with, captured on the first
460
473
  * `applyHeadersToAgent` call for that agent (which, for agents the registry
@@ -494,6 +507,15 @@ declare class AgentRegistry {
494
507
  get runtimeEntitlements(): RuntimeEntitlementResponse | undefined;
495
508
  get runtimeEntitlementRetryPending(): boolean;
496
509
  get telemetryDisabled(): boolean;
510
+ /**
511
+ * Stop runtime work this registry owns: the entitlement retry timer, the
512
+ * inspector metadata request, runtime probes and recovery fetches with
513
+ * their timeouts, and request watchdogs. In-flight `/info` connections are
514
+ * detached so their late results change nothing. Called by
515
+ * `CopilotKitCore.dispose`.
516
+ */
517
+ dispose(): void;
518
+ private get isDisposed();
497
519
  /**
498
520
  * Initialize agents from configuration
499
521
  */
@@ -522,7 +544,9 @@ declare class AgentRegistry {
522
544
  private carriesConversationState;
523
545
  private abandonRuntimeHealthProbe;
524
546
  /**
525
- * Set all agents at once (for development use)
547
+ * Set all agents at once (for development use). Same ids mapped to the
548
+ * same instances as the current local agents is a no-op once the agents
549
+ * have been announced.
526
550
  */
527
551
  setAgents__unsafe_dev_only(agents: Record<string, AbstractAgent>): void;
528
552
  /**
@@ -805,6 +829,8 @@ declare class StateManager {
805
829
  * Unsubscribe an agent's subscription.
806
830
  */
807
831
  unsubscribeFromAgent(agentId: string): void;
832
+ /** Unsubscribe from every agent. Called by `CopilotKitCore.dispose`. */
833
+ dispose(): void;
808
834
  /**
809
835
  * Get state for a specific run
810
836
  * Returns a deep copy to prevent external mutations
@@ -955,6 +981,12 @@ declare class RunHandler {
955
981
  * one array before, so the `/info` response flipping `openGenerativeUI` (or
956
982
  * any other provider-prop change) silently dropped every hook-registered
957
983
  * tool (#4952). Key = `capabilityKey(name, agentId)`.
984
+ *
985
+ * Each key holds a stack of registrations. The last one is the active tool;
986
+ * removing it (via the function `addTool` returns) brings back the one
987
+ * below, and an empty stack lets the provider tool of that key show again.
988
+ * A registration is its own object, so removing one never removes another
989
+ * registration of the same tool object.
958
990
  */
959
991
  private _hookTools;
960
992
  /**
@@ -1010,6 +1042,13 @@ declare class RunHandler {
1010
1042
  * that runaway follow-up chains trip `MAX_FOLLOW_UP_DEPTH`.
1011
1043
  */
1012
1044
  private _runDepths;
1045
+ /**
1046
+ * Agents with at least one run in flight (depth above 0), so
1047
+ * {@link dispose} can stop them. Removed when the last run ends.
1048
+ */
1049
+ private _runningAgents;
1050
+ /** Set by {@link dispose}. Stops WebMCP from registering tools again. */
1051
+ private _disposed;
1013
1052
  /**
1014
1053
  * Each agent's own `abortRun`, saved while RunHandler's intercept is
1015
1054
  * installed. Restored only once none of the agent's runs is in flight, so an
@@ -1064,6 +1103,12 @@ declare class RunHandler {
1064
1103
  * not start a follow-up run.
1065
1104
  */
1066
1105
  abortCurrentRun(agent: AbstractAgent): void;
1106
+ /**
1107
+ * Stop every run chain and tool interaction this handler tracks, and every
1108
+ * agent in `agents` that reports a run in flight, the same way `stopAgent`
1109
+ * does. Then unregister all WebMCP tools. Called by `CopilotKitCore.dispose`.
1110
+ */
1111
+ dispose(agents: Iterable<AbstractAgent>): void;
1067
1112
  private abortAgentRuns;
1068
1113
  /** Signal of the agent's most recently started in-flight run, if any. */
1069
1114
  private latestRunSignal;
@@ -1091,8 +1136,15 @@ declare class RunHandler {
1091
1136
  /**
1092
1137
  * Add a tool to the registry. Survives provider re-syncs ({@link setTools}),
1093
1138
  * and shadows a provider tool of the same name + agentId.
1139
+ *
1140
+ * Registrations of the same name + agentId stack: the most recent one is
1141
+ * active. Call the returned function to remove exactly this registration;
1142
+ * the previous registration (or the provider tool) becomes active again.
1143
+ * Calling it more than once does nothing.
1094
1144
  */
1095
- addTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: FrontendTool<T>): void;
1145
+ addTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: FrontendTool<T>): () => void;
1146
+ /** Remove one `addTool` registration. Unknown registrations are ignored. */
1147
+ private unregisterHookTool;
1096
1148
  /**
1097
1149
  * Report, once per tool and at development time only, a tool registered with
1098
1150
  * no `parameters` schema.
@@ -1114,7 +1166,10 @@ declare class RunHandler {
1114
1166
  */
1115
1167
  private warnOnMissingToolParameters;
1116
1168
  /**
1117
- * Remove a tool by name and optionally by agentId
1169
+ * Remove a tool by name and optionally by agentId: every `addTool`
1170
+ * registration of that key and the provider tool of that key. Without an
1171
+ * agentId only global tools are removed. To remove one `addTool`
1172
+ * registration and keep the others, call the function `addTool` returned.
1118
1173
  */
1119
1174
  removeTool(id: string, agentId?: string): void;
1120
1175
  /**
@@ -2234,6 +2289,14 @@ interface CopilotKitCoreConfig {
2234
2289
  * {@link CopilotKitCore.setLearningConfig}.
2235
2290
  */
2236
2291
  learning?: LearningConfig;
2292
+ /**
2293
+ * @internal For framework adapters. Awaited after frontend tools run and
2294
+ * before the follow-up run starts, so state updates that the tool handlers
2295
+ * scheduled in the framework (and the context those updates register) land
2296
+ * before the follow-up reads it. React passes a `setTimeout(0)` yield, Vue
2297
+ * passes `nextTick`.
2298
+ */
2299
+ ɵwaitForFrameworkUpdates?: () => Promise<void>;
2237
2300
  }
2238
2301
  interface CopilotKitCoreStopAgentParams {
2239
2302
  agent: AbstractAgent;
@@ -2515,6 +2578,8 @@ declare class CopilotKitCore {
2515
2578
  private _defaultThrottleMs?;
2516
2579
  private _debug?;
2517
2580
  private subscribers;
2581
+ private _disposed;
2582
+ private readonly waitForFrameworkUpdates?;
2518
2583
  private agentRegistry;
2519
2584
  private contextStore;
2520
2585
  private suggestionEngine;
@@ -2552,7 +2617,8 @@ declare class CopilotKitCore {
2552
2617
  tools,
2553
2618
  suggestionsConfig,
2554
2619
  debug,
2555
- learning
2620
+ learning,
2621
+ ɵwaitForFrameworkUpdates
2556
2622
  }: CopilotKitCoreConfig);
2557
2623
  /**
2558
2624
  * Internal method used by delegate classes and subclasses to notify subscribers
@@ -2690,13 +2756,18 @@ declare class CopilotKitCore {
2690
2756
  * also a no-op — safe to call on every render with a fresh object literal.
2691
2757
  */
2692
2758
  setHeaders(headers: CopilotKitHeadersSource): void;
2759
+ /**
2760
+ * Set the credentials mode for runtime requests (for example `"include"`
2761
+ * to send HTTP-only cookies). Passing the current value does nothing.
2762
+ */
2693
2763
  setCredentials(credentials: RequestCredentials | undefined): void;
2694
2764
  /**
2695
2765
  * Replace the message filter applied to every runtime agent.
2696
2766
  *
2697
2767
  * Applies to agents already discovered as well as ones discovered later, so
2698
2768
  * a filter set before `/info` lands is not lost. Pass `undefined` to go back
2699
- * to sending the full thread.
2769
+ * to sending the full thread. Passing the current filter function again
2770
+ * does nothing.
2700
2771
  */
2701
2772
  setMessageFilter(messageFilter: CopilotKitMessageFilter | undefined): void;
2702
2773
  /**
@@ -2730,9 +2801,18 @@ declare class CopilotKitCore {
2730
2801
  * `agentIds` does not match when `agentId` is omitted.
2731
2802
  */
2732
2803
  getPropertiesForAgent(agentId?: string): Record<string, unknown>;
2804
+ /**
2805
+ * Replace the properties sent as `forwardedProps` with every run, and
2806
+ * notify `onPropertiesChanged`. Passing an object with the same keys and
2807
+ * values as the current one does nothing, so a fresh object literal on
2808
+ * every render is safe.
2809
+ */
2733
2810
  setProperties(properties: Record<string, unknown>): void;
2734
2811
  /**
2735
- * Agent management (delegated to AgentRegistry)
2812
+ * Agent management (delegated to AgentRegistry).
2813
+ *
2814
+ * Replace the local (development) agents. Passing the same ids mapped to
2815
+ * the same agent instances does nothing.
2736
2816
  */
2737
2817
  setAgents__unsafe_dev_only(agents: Record<string, AbstractAgent>): void;
2738
2818
  addAgent__unsafe_dev_only(params: CopilotKitCoreAddAgentParams): void;
@@ -2905,9 +2985,32 @@ declare class CopilotKitCore {
2905
2985
  clearSuggestions(agentId: string): void;
2906
2986
  getSuggestions(agentId: string): CopilotKitCoreGetSuggestionsResult;
2907
2987
  /**
2908
- * Tool management (delegated to RunHandler)
2988
+ * Register a frontend tool. It shadows a provider tool (from the `tools`
2989
+ * config or `setTools`) with the same name and agentId.
2990
+ *
2991
+ * A second registration with the same name and agentId shadows the first.
2992
+ * Call the returned function to remove only this registration: the tool it
2993
+ * shadowed becomes active again. Calling it more than once does nothing.
2994
+ *
2995
+ * @param tool - The tool to register.
2996
+ * @returns A function that removes this registration.
2997
+ *
2998
+ * @example
2999
+ * const unregister = copilotkit.addTool({
3000
+ * name: "showWeather",
3001
+ * handler: async ({ city }) => `Sunny in ${city}`,
3002
+ * });
3003
+ * // later
3004
+ * unregister();
3005
+ */
3006
+ addTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: FrontendTool<T>): () => void;
3007
+ /**
3008
+ * Remove a tool by name, and by agentId when given. This removes every
3009
+ * `addTool` registration with that name and agentId, and the provider tool
3010
+ * with that name and agentId. Without an agentId, only global tools are
3011
+ * removed. To remove one registration, call the function `addTool`
3012
+ * returned.
2909
3013
  */
2910
- addTool<T extends Record<string, unknown> = Record<string, unknown>>(tool: FrontendTool<T>): void;
2911
3014
  removeTool(id: string, agentId?: string): void;
2912
3015
  getTool(params: CopilotKitCoreGetToolParams): FrontendTool<any> | undefined;
2913
3016
  setTools(tools: FrontendTool<any>[]): void;
@@ -2978,11 +3081,36 @@ declare class CopilotKitCore {
2978
3081
  * synchronously while the deferred updates are still pending, producing stale
2979
3082
  * context for the next agent turn.
2980
3083
  *
2981
- * Override in framework-specific subclasses to yield to the framework
2982
- * scheduler before the follow-up run. The base implementation is a no-op
2983
- * because non-React environments have no deferred state to flush.
3084
+ * Awaits the `ɵwaitForFrameworkUpdates` config option when one is given.
3085
+ * Without it there is nothing to wait for, because a plain JavaScript
3086
+ * environment has no deferred state to flush. Framework subclasses that
3087
+ * still override this method keep working.
2984
3088
  */
2985
3089
  waitForPendingFrameworkUpdates(): Promise<void>;
3090
+ /**
3091
+ * Stop everything this core started, so it can be dropped without leaks.
3092
+ *
3093
+ * Call it when you created a `CopilotKitCore` yourself and are done with it
3094
+ * (for example when a page or test tears down). Framework providers call it
3095
+ * for you.
3096
+ *
3097
+ * It does this, in order:
3098
+ *
3099
+ * - removes every subscriber, so no callback runs after this call;
3100
+ * - stops agent runs in flight and aborts running frontend tools;
3101
+ * - aborts suggestion generation;
3102
+ * - clears runtime timers and aborts runtime requests it can cancel;
3103
+ * - removes agent subscriptions, WebMCP tools, and the learning capture;
3104
+ * - stops the memory store and every registered thread store.
3105
+ *
3106
+ * Calling it again does nothing. Do not use the core after this call.
3107
+ *
3108
+ * @example
3109
+ * const copilotkit = new CopilotKitCore({ runtimeUrl: "/api/copilotkit" });
3110
+ * // ... use it ...
3111
+ * copilotkit.dispose();
3112
+ */
3113
+ dispose(): void;
2986
3114
  }
2987
3115
  //#endregion
2988
3116
  //#region src/core/suggestion-engine.d.ts
@@ -2995,6 +3123,13 @@ declare class SuggestionEngine {
2995
3123
  private _suggestionsConfig;
2996
3124
  private _suggestions;
2997
3125
  private _runningSuggestions;
3126
+ /**
3127
+ * The last `getSuggestions` result per agent, with the per-generation
3128
+ * arrays it was built from. Each generation's array is replaced (never
3129
+ * mutated) on change, so comparing those references tells whether the
3130
+ * cached result is still current.
3131
+ */
3132
+ private _snapshots;
2998
3133
  constructor(core: CopilotKitCore);
2999
3134
  /**
3000
3135
  * Initialize with suggestion configs
@@ -3019,9 +3154,12 @@ declare class SuggestionEngine {
3019
3154
  */
3020
3155
  clearSuggestions(agentId: string): void;
3021
3156
  /**
3022
- * Get current suggestions for an agent
3157
+ * Get current suggestions for an agent. Returns the same object until the
3158
+ * agent's suggestions or loading state change.
3023
3159
  */
3024
3160
  getSuggestions(agentId: string): CopilotKitCoreGetSuggestionsResult;
3161
+ /** Abort every running suggestion generation. Called by `CopilotKitCore.dispose`. */
3162
+ dispose(): void;
3025
3163
  /**
3026
3164
  * Generate suggestions by running a provider agent and extracting the
3027
3165
  * `copilotkitSuggest` tool call from its streamed messages.
@@ -3142,35 +3280,6 @@ declare class WebMCPRegistry {
3142
3280
  //#region src/utils/markdown/complete-partial-markdown.d.ts
3143
3281
  declare function completePartialMarkdown(input: string): string;
3144
3282
  //#endregion
3145
- //#region src/utils/markdown/types.d.ts
3146
- /**
3147
- * A single parsed markdown node. This is `marked`'s token union, re-exported as
3148
- * the stable public contract that framework renderers switch on. Consumers
3149
- * should treat `type` as the discriminant (e.g. "heading", "paragraph", "code",
3150
- * "list", "table", "strong", "em", "link", "image", ...).
3151
- */
3152
- type MarkdownToken = Token;
3153
- /** The ordered list of top-level tokens returned by parseMarkdown. */
3154
- type MarkdownTokenList = TokensList;
3155
- //#endregion
3156
- //#region src/utils/markdown/parse.d.ts
3157
- interface ParseMarkdownOptions {
3158
- /**
3159
- * When true (default), the input is run through `completePartialMarkdown`
3160
- * first so that incomplete streaming markdown (unterminated emphasis, code
3161
- * fences, links) renders cleanly. Set false to parse the raw string as-is.
3162
- */
3163
- complete?: boolean;
3164
- }
3165
- /**
3166
- * Parse a markdown string into a framework-agnostic token tree.
3167
- *
3168
- * Uses `marked`'s lexer (GFM enabled) so the result is DOM-free and can be
3169
- * walked into React, Vue, or React Native elements by each framework's
3170
- * built-in renderer.
3171
- */
3172
- declare function parseMarkdown(content: string, options?: ParseMarkdownOptions): MarkdownTokenList;
3173
- //#endregion
3174
3283
  //#region src/utils/http-agent.d.ts
3175
3284
  /**
3176
3285
  * Whether an agent is an `HttpAgent`, including one built from another copy of
@@ -3552,7 +3661,12 @@ type ɵInterruptDecision = {
3552
3661
  */
3553
3662
  declare class ɵInterruptState<TValue = unknown> {
3554
3663
  #private;
3555
- /** Return the active normalized interrupt without exposing mutable state. */
3664
+ /**
3665
+ * Return the active normalized interrupt. A standard interrupt set is a
3666
+ * frozen snapshot, and every read returns the same object until the
3667
+ * interrupt is replaced or cleared, so a framework can compare it by
3668
+ * reference.
3669
+ */
3556
3670
  get pending(): ɵPendingInterrupt<TValue> | null;
3557
3671
  /** Replace the current interrupt with a legacy custom-event interrupt. */
3558
3672
  setLegacy(event: ɵInterruptEvent<TValue>): void;
@@ -3904,5 +4018,1481 @@ type SurfaceSegment = {
3904
4018
  */
3905
4019
  declare function segmentSurfaceProse(components: Record<string, unknown>[], options?: ChildWalkOptions): SurfaceSegment[];
3906
4020
  //#endregion
3907
- export { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRegisterProxiedAgentParams, type CopilotKitCoreRegisterProxiedAgentResult, type CopilotKitCoreRunAgentParams, type CopilotKitCoreRunToolParams, type CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, type CopilotKitHeadersSource, type CopilotKitMessageFilter, CopilotRuntimeTransport, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, FrontendToolReconnectBehavior, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, InspectorActiveThreadPayload, type InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, type IntelligenceRuntimeInfo, type JsonValue, type LearningConfig, type LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, MarkdownToken, MarkdownTokenList, Memory, MemoryChanges, MemoryError, type MemoryErrorCategory, type MemoryErrorCode, type MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryScope, NewMemory, NonDispatchingEffect, NonDispatchingEffectOptions, type OpenThreadRegistration, ParseMarkdownOptions, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, type RuntimeLicenseStatus, type RuntimeMode, ScopedContext, ScopedProperties, Selector, type StartResult, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, type ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, type Tokens, ToolCallStatus, type TrajectoryStartOptions, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseMarkdown, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, ɵCOPILOTKIT_FEATURES, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, ɵclearAgentInterruptState, createMemoryStore as ɵcreateMemoryStore, ɵcreateThreadSelectors, createThreadStore as ɵcreateThreadStore, ɵgetAgentInterruptState, ɵisCopilotKitFeature, ɵisHttpAgent, isRetryableStatus as ɵisRetryableMemoryStatus, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, ɵthreadAdapterEvents, ɵwithHeaderDefaults };
4021
+ //#region src/chat/labels.d.ts
4022
+ /**
4023
+ * The default English text for every word the chat UI shows. React, Vue and
4024
+ * Angular all read their chat text from this one set.
4025
+ *
4026
+ * To change or translate the text, pass a partial set to your framework's chat
4027
+ * configuration. Keys you leave out keep their default:
4028
+ *
4029
+ * ```ts
4030
+ * const labels = { ...CopilotChatDefaultLabels, chatInputPlaceholder: "Ask me" };
4031
+ * ```
4032
+ *
4033
+ * Some values are templates with `{name}` placeholders, such as
4034
+ * `"Thought for {duration}"`. Keep the placeholders when you translate them.
4035
+ *
4036
+ * Counts use two keys: `...One` for a count of 1, and `...Other` for any other
4037
+ * count.
4038
+ */
4039
+ declare const CopilotChatDefaultLabels: Readonly<{
4040
+ chatInputPlaceholder: "Type a message...";
4041
+ chatInputToolbarStartTranscribeButtonLabel: "Transcribe";
4042
+ chatInputToolbarCancelTranscribeButtonLabel: "Cancel";
4043
+ chatInputToolbarFinishTranscribeButtonLabel: "Finish";
4044
+ chatInputToolbarAddButtonLabel: "Add attachments";
4045
+ chatInputToolbarToolsButtonLabel: "Tools";
4046
+ chatInputToolbarSendButtonLabel: "Send message";
4047
+ chatInputToolbarStopButtonLabel: "Stop";
4048
+ assistantMessageToolbarCopyCodeLabel: "Copy";
4049
+ assistantMessageToolbarCopyCodeCopiedLabel: "Copied";
4050
+ assistantMessageToolbarCopyMessageLabel: "Copy";
4051
+ assistantMessageToolbarInspectorLabel: "View in Inspector";
4052
+ assistantMessageToolbarInspectorDescription: "Open this message in the Inspector";
4053
+ assistantMessageToolbarInspectorLocalOnlyLabel: "Local only";
4054
+ assistantMessageToolbarInspectorLocalOnlyDescription: "Only visible on localhost or loopback hosts in development. Never shown in production.";
4055
+ assistantMessageToolbarInspectorTitle: "CopilotKit Inspector";
4056
+ assistantMessageToolbarInspectorHideLabel: "Hide this icon";
4057
+ assistantMessageToolbarInspectorHideDescription: "Until you reload this page";
4058
+ assistantMessageToolbarThumbsUpLabel: "Good response";
4059
+ assistantMessageToolbarThumbsDownLabel: "Bad response";
4060
+ assistantMessageFeedbackCommentPlaceholder: "Add a comment (optional)";
4061
+ assistantMessageFeedbackCommentSubmitLabel: "Send comment";
4062
+ assistantMessageToolbarReadAloudLabel: "Read aloud";
4063
+ assistantMessageToolbarRegenerateLabel: "Regenerate";
4064
+ userMessageToolbarCopyMessageLabel: "Copy";
4065
+ userMessageToolbarEditMessageLabel: "Edit";
4066
+ userMessageToolbarPreviousBranchLabel: "Previous branch";
4067
+ userMessageToolbarNextBranchLabel: "Next branch";
4068
+ chatDisclaimerText: "AI can make mistakes. Please verify important information.";
4069
+ chatToggleOpenLabel: "Open chat";
4070
+ chatToggleCloseLabel: "Close chat";
4071
+ chatScrollToBottomLabel: "Scroll to bottom";
4072
+ modalHeaderTitle: "CopilotKit Chat";
4073
+ welcomeMessageText: "How can I help you today?";
4074
+ reasoningMessageThinkingLabel: "Thinking…";
4075
+ chatInputSlashMenuLabel: "Slash commands";
4076
+ chatInputSlashMenuEmptyText: "No commands found";
4077
+ attachmentRemoveButtonLabel: "Remove attachment";
4078
+ attachmentPlayVideoButtonLabel: "Play video";
4079
+ attachmentPreviewCloseButtonLabel: "Close preview";
4080
+ modalHeaderCloseButtonLabel: "Close";
4081
+ modalHeaderThreadsButtonLabel: "Open threads";
4082
+ sidebarLabel: "Copilot chat sidebar"; /** Shown over the chat while the user drags files onto it. */
4083
+ chatDropFilesLabel: "Drop files here"; /** Shown when a saved thread fails to load. */
4084
+ threadLoadErrorText: "Could not load saved conversation. Reopen the thread and try again."; /** Reasoning header after the model stops thinking. `{duration}` is one of the `reasoningMessageDuration...` texts. */
4085
+ reasoningMessageThoughtForLabel: "Thought for {duration}"; /** Duration under 1 second. */
4086
+ reasoningMessageDurationFewSeconds: "a few seconds"; /** Duration under 1 minute. `{count}`: whole seconds. */
4087
+ reasoningMessageDurationSeconds: "{count} seconds"; /** Duration of exactly 1 minute. `{count}`: minutes. */
4088
+ reasoningMessageDurationMinutesOne: "{count} minute"; /** Duration of whole minutes, more than 1. `{count}`: minutes. */
4089
+ reasoningMessageDurationMinutesOther: "{count} minutes"; /** Duration of minutes plus seconds. `{minutes}`, `{seconds}`. */
4090
+ reasoningMessageDurationMinutesSeconds: "{minutes}m {seconds}s"; /** Status of a tool call that is still running. */
4091
+ toolCallStatusRunningLabel: "Running"; /** Status of a tool call that finished. */
4092
+ toolCallStatusDoneLabel: "Done"; /** Status of a tool call that returned an error. */
4093
+ toolCallStatusFailedLabel: "Failed"; /** Status of a tool call that stopped before it finished. */
4094
+ toolCallStatusStoppedLabel: "Stopped"; /** Summary while a tool runs. `{name}`: the tool name. */
4095
+ toolCallRunningLabel: "Running {name}"; /** Number of failed tool calls. `{count}`: the number. */
4096
+ toolCallFailedCountLabel: "{count} failed"; /** Number of finished tool calls. `{count}`: the number. */
4097
+ toolCallDoneCountLabel: "{count} done"; /** Heading above the arguments of a tool call. */
4098
+ toolCallArgumentsLabel: "Arguments"; /** Heading above the result of a tool call. */
4099
+ toolCallResultLabel: "Result"; /** Button that closes an open group of tool calls. */
4100
+ toolCallCollapseLabel: "Collapse"; /** Summary of a finished group with 1 tool call. `{count}`: the number. */
4101
+ toolCallUsedToolsOne: "Used {count} tool"; /** Summary of a finished group with any other number of tool calls. `{count}`: the number. */
4102
+ toolCallUsedToolsOther: "Used {count} tools"; /** Count of tools, for 1. `{count}`: the number. */
4103
+ toolCallToolCountOne: "{count} tool"; /** Count of tools, for any other number. `{count}`: the number. */
4104
+ toolCallToolCountOther: "{count} tools"; /** Count of tool calls, for 1. `{count}`: the number. */
4105
+ toolCallToolCallCountOne: "{count} tool call"; /** Count of tool calls, for any other number. `{count}`: the number. */
4106
+ toolCallToolCallCountOther: "{count} tool calls"; /** Short count of calls, for 1. `{count}`: the number. */
4107
+ toolCallCallCountOne: "{count} call"; /** Short count of calls, for any other number. `{count}`: the number. */
4108
+ toolCallCallCountOther: "{count} calls"; /** Work summary while the agent runs. */
4109
+ workSummaryWorkingLabel: "Working"; /** Work summary after the run. `{duration}`: the run time. */
4110
+ workSummaryWorkedForLabel: "Worked for {duration}"; /** Shown in place of an image attachment that fails to load. */
4111
+ attachmentImageLoadErrorText: "Failed to load image"; /** Alt text of an image attachment. */
4112
+ attachmentImageAltText: "Image attachment"; /** Shown when a file attachment has no name and no type. */
4113
+ attachmentUnknownTypeText: "Unknown type"; /** Name of a document attachment that has no file name. */
4114
+ attachmentDocumentLabel: "Document"; /** Label of a document attachment that has no file name and no type. */
4115
+ attachmentDocumentAltText: "Document attachment"; /** Shown in the preview of a file type the chat cannot preview. */
4116
+ attachmentNoPreviewText: "No preview available for this file type"; /** Shown when the user sends while attachments are still uploading. */
4117
+ chatAttachmentsUploadingText: "Cannot send while attachments are uploading."; /** Transcription error: too many requests. */
4118
+ transcriptionErrorRateLimitedText: "Too many requests. Please wait a moment."; /** Transcription error: the service rejected the credentials. */
4119
+ transcriptionErrorAuthFailedText: "Authentication error. Please check your configuration."; /** Transcription error: the recording is too long. */
4120
+ transcriptionErrorAudioTooLongText: "Recording is too long. Please try a shorter recording."; /** Transcription error: the recording is too short. */
4121
+ transcriptionErrorAudioTooShortText: "Recording is too short. Please try again."; /** Transcription error: the audio format is not supported. */
4122
+ transcriptionErrorInvalidAudioFormatText: "Audio format not supported."; /** Transcription error: no transcription service is set up. */
4123
+ transcriptionErrorServiceNotConfiguredText: "Transcription service is not available."; /** Transcription error: the network request failed. */
4124
+ transcriptionErrorNetworkText: "Network error. Please check your connection."; /** Transcription error that the user can retry, or an unknown error. */
4125
+ transcriptionErrorGenericText: "Transcription failed. Please try again."; /** License banner when no license is set. */
4126
+ licensePoweredByText: "Powered by CopilotKit"; /** License banner link to get a license. */
4127
+ licenseGetLicenseLabel: "Get a license"; /** License banner when a feature needs a license. `{feature}`: the feature name. */
4128
+ licenseFeatureUnlicensedText: "⚠ The \"{feature}\" feature requires a CopilotKit license."; /** License banner when the license expires soon and the day count is not known. */
4129
+ licenseExpiringText: "Your CopilotKit license expires soon. Please renew."; /** License banner when the license expires in 1 day. `{days}`: the number. */
4130
+ licenseExpiringInDaysOne: "Your CopilotKit license expires in {days} day. Please renew."; /** License banner when the license expires in any other number of days. `{days}`: the number. */
4131
+ licenseExpiringInDaysOther: "Your CopilotKit license expires in {days} days. Please renew."; /** License banner when the license expired and the date is not known. */
4132
+ licenseExpiredText: "Your CopilotKit license expired. Please renew at copilotkit.ai/pricing"; /** License banner when the license expired. `{date}`: the expiry date. */
4133
+ licenseExpiredOnDateText: "Your CopilotKit license expired on {date}. Please renew at copilotkit.ai/pricing"; /** License banner when the license token is not valid. */
4134
+ licenseInvalidText: "Invalid CopilotKit license token. Please check your configuration."; /** License banner link when the license expires soon. */
4135
+ licenseRenewLabel: "Renew"; /** License banner link when the license expired. */
4136
+ licenseRenewNowLabel: "Renew now";
4137
+ }>;
4138
+ /**
4139
+ * Every text of the chat UI, by key. Each value is a `string`, so a translated
4140
+ * set fits the same type. See {@link CopilotChatDefaultLabels} for the keys and
4141
+ * the default English text.
4142
+ */
4143
+ type CopilotChatLabels = { -readonly [K in keyof typeof CopilotChatDefaultLabels]: string };
4144
+ /**
4145
+ * Puts values into a label template. Each `{name}` in the template is replaced
4146
+ * by `values[name]`. A placeholder with no value stays in the text as is.
4147
+ *
4148
+ * @param template - A label value, such as `"Running {name}"`.
4149
+ * @param values - The value for each placeholder.
4150
+ *
4151
+ * ```ts
4152
+ * ɵformatLabel(labels.toolCallRunningLabel, { name: "read_file" });
4153
+ * // "Running read_file"
4154
+ * ```
4155
+ */
4156
+ declare function ɵformatLabel(template: string, values: Record<string, string | number>): string;
4157
+ /**
4158
+ * Fills a counted label pair: the `one` template for a count of 1, the
4159
+ * `other` template for any other count. Both templates take `{count}`.
4160
+ *
4161
+ * @param count - The number to show.
4162
+ * @param templates - The `...One` and `...Other` label templates.
4163
+ *
4164
+ * ```ts
4165
+ * ɵformatCountLabel(3, {
4166
+ * one: labels.toolCallToolCountOne,
4167
+ * other: labels.toolCallToolCountOther,
4168
+ * }); // "3 tools"
4169
+ * ```
4170
+ */
4171
+ declare function ɵformatCountLabel(count: number, templates: {
4172
+ one: string;
4173
+ other: string;
4174
+ }): string;
4175
+ //#endregion
4176
+ //#region src/chat/renderer-types.d.ts
4177
+ /**
4178
+ * Props a tool call renderer receives. The `status` field tells which stage
4179
+ * the call is in:
4180
+ *
4181
+ * - `InProgress`: the agent is still streaming arguments, so `args` is partial.
4182
+ * - `Executing`: `args` is complete and the tool is running.
4183
+ * - `Complete`: the tool finished and `result` holds its output.
4184
+ *
4185
+ * @typeParam T - The shape of the tool arguments.
4186
+ */
4187
+ type ToolCallRenderProps<T = unknown> = {
4188
+ name: string;
4189
+ toolCallId: string;
4190
+ args: Partial<T>;
4191
+ status: ToolCallStatus.InProgress;
4192
+ result: undefined;
4193
+ } | {
4194
+ name: string;
4195
+ toolCallId: string;
4196
+ args: T;
4197
+ status: ToolCallStatus.Executing;
4198
+ result: undefined;
4199
+ } | {
4200
+ name: string;
4201
+ toolCallId: string;
4202
+ args: T;
4203
+ status: ToolCallStatus.Complete;
4204
+ result: string;
4205
+ };
4206
+ /**
4207
+ * Props a human-in-the-loop renderer receives.
4208
+ *
4209
+ * Beyond the tool call's `args`/`status`/`result`, the render props carry
4210
+ * attribution:
4211
+ * - `toolCallId`: the AG-UI tool call id, unique per interrupt. It is the
4212
+ * stable key for correlating this interrupt with runtime (sub)agent
4213
+ * attribution, e.g. the `agentId` reported by `onToolExecutionStart`, or
4214
+ * per-run attribution stamped on the event stream, so the UI can label
4215
+ * the interrupt with the agent that actually raised it.
4216
+ * - `agentId`: the agent this tool was *registered* to (the tool's own
4217
+ * `agentId`), or `undefined` for an unscoped tool. This is the static
4218
+ * registration scope; it is NOT necessarily the runtime (sub)agent that
4219
+ * raised the interrupt. For runtime attribution, correlate `toolCallId`
4220
+ * with the event-stream/`onToolExecutionStart` agent id.
4221
+ *
4222
+ * `respond` is only defined while the status is `Executing`. Call it with the
4223
+ * user's answer to send the tool result back to the agent.
4224
+ *
4225
+ * @typeParam T - The shape of the tool arguments.
4226
+ */
4227
+ type HumanInTheLoopRenderProps<T = unknown> = {
4228
+ name: string;
4229
+ description: string;
4230
+ toolCallId: string;
4231
+ agentId?: string;
4232
+ args: Partial<T>;
4233
+ status: ToolCallStatus.InProgress;
4234
+ result: undefined;
4235
+ respond: undefined;
4236
+ } | {
4237
+ name: string;
4238
+ description: string;
4239
+ toolCallId: string;
4240
+ agentId?: string;
4241
+ args: T;
4242
+ status: ToolCallStatus.Executing;
4243
+ result: undefined;
4244
+ respond: (result: unknown) => Promise<void>;
4245
+ } | {
4246
+ name: string;
4247
+ description: string;
4248
+ toolCallId: string;
4249
+ agentId?: string;
4250
+ args: T;
4251
+ status: ToolCallStatus.Complete;
4252
+ result: string;
4253
+ respond: undefined;
4254
+ };
4255
+ /**
4256
+ * A tool call renderer registration. Core stores and looks up renderers by
4257
+ * `name` and `agentId`. It never calls `render`, so each framework picks its
4258
+ * own render type (a React component, a Vue render function, and so on).
4259
+ *
4260
+ * @typeParam T - The shape of the tool arguments.
4261
+ * @typeParam TRender - The framework's render type.
4262
+ */
4263
+ interface ToolCallRendererDef<T = unknown, TRender = unknown> {
4264
+ /** Tool name to match. Use `"*"` for a wildcard renderer. */
4265
+ name: string;
4266
+ /**
4267
+ * Schema describing the tool arguments. Optional: renderers registered for
4268
+ * tools without parameters (e.g. HITL confirm dialogs) have no schema.
4269
+ */
4270
+ args?: StandardSchemaV1<unknown, T>;
4271
+ /**
4272
+ * Optional agent ID to constrain this tool renderer to a specific agent.
4273
+ * If specified, this renderer will only be used for the specified agent.
4274
+ */
4275
+ agentId?: string;
4276
+ /**
4277
+ * Whether calls this renderer draws join the chat's tool-call groups (see
4278
+ * `toolCallDisplay` on `CopilotChatMessageView`). CopilotKit's built-in card
4279
+ * sets it; a renderer that leaves it unset always shows its calls on their
4280
+ * own, since the chat can't tell what it draws (it may even draw nothing).
4281
+ */
4282
+ group?: boolean;
4283
+ /** Draws the tool call. Receives {@link ToolCallRenderProps}. */
4284
+ render: TRender;
4285
+ }
4286
+ /**
4287
+ * Props an activity message renderer receives.
4288
+ *
4289
+ * @typeParam C - The shape of the activity content.
4290
+ */
4291
+ interface ActivityMessageRenderProps<C = unknown> {
4292
+ /** Activity type of the message being drawn. */
4293
+ activityType: string;
4294
+ /** Activity content, parsed with the renderer's `content` schema. */
4295
+ content: C;
4296
+ /** The activity message being drawn. */
4297
+ message: ActivityMessage;
4298
+ /** The agent that produced the message, if it is still registered. */
4299
+ agent: AbstractAgent | undefined;
4300
+ }
4301
+ /**
4302
+ * An activity message renderer registration. Core never calls `render`.
4303
+ *
4304
+ * @typeParam C - The shape of the activity content.
4305
+ * @typeParam TRender - The framework's render type.
4306
+ */
4307
+ interface ActivityMessageRendererDef<C = unknown, TRender = unknown> {
4308
+ /**
4309
+ * Activity type to match when rendering. Use "*" as a wildcard renderer.
4310
+ */
4311
+ activityType: string;
4312
+ /**
4313
+ * Optional agent ID to scope the renderer to a particular agent.
4314
+ */
4315
+ agentId?: string;
4316
+ /**
4317
+ * Schema describing the activity content payload.
4318
+ */
4319
+ content: StandardSchemaV1<unknown, C>;
4320
+ /** Draws the activity message. Receives {@link ActivityMessageRenderProps}. */
4321
+ render: TRender;
4322
+ }
4323
+ /** Where a custom message renderer draws, relative to its message. */
4324
+ type CustomMessageRendererPosition = "before" | "after";
4325
+ /** Props a custom message renderer receives. */
4326
+ interface CustomMessageRenderProps {
4327
+ /** The message this renderer draws next to. */
4328
+ message: Message;
4329
+ /** Whether the renderer draws before or after `message`. */
4330
+ position: CustomMessageRendererPosition;
4331
+ /** The run that produced `message`. */
4332
+ runId: string;
4333
+ /** Index of `message` in the whole conversation. */
4334
+ messageIndex: number;
4335
+ /** Index of `message` inside its run. */
4336
+ messageIndexInRun: number;
4337
+ /** How many messages the run produced. */
4338
+ numberOfMessagesInRun: number;
4339
+ /** The agent that owns the conversation. */
4340
+ agentId: string;
4341
+ /** Agent state captured for this run, or `undefined` when the run is unknown. */
4342
+ stateSnapshot: unknown;
4343
+ }
4344
+ /**
4345
+ * A custom message renderer registration. Core never calls `render`.
4346
+ *
4347
+ * @typeParam TRender - The framework's render type.
4348
+ */
4349
+ interface CustomMessageRendererDef<TRender = unknown> {
4350
+ /** Optional agent ID to scope the renderer to a particular agent. */
4351
+ agentId?: string;
4352
+ /** Draws next to a message. Receives {@link CustomMessageRenderProps}. */
4353
+ render: TRender;
4354
+ }
4355
+ //#endregion
4356
+ //#region src/chat/renderers.d.ts
4357
+ /**
4358
+ * Find the renderer that draws a tool call.
4359
+ *
4360
+ * The first rule that matches wins:
4361
+ *
4362
+ * 1. A renderer for `toolName` with `agentId` equal to the current agent.
4363
+ * 2. A renderer for `toolName` with no `agentId`.
4364
+ * 3. The first renderer for `toolName` from any other agent.
4365
+ * 4. The first `"*"` renderer, from any agent.
4366
+ *
4367
+ * Inside each rule, the earlier renderer in the list wins.
4368
+ *
4369
+ * @param renderers - Registered renderers in registration order. If you
4370
+ * build tiers (for example app renderers before built-in ones), flatten
4371
+ * them into one ordered list first.
4372
+ * @param toolName - Name of the tool the agent called.
4373
+ * @param agentId - The agent that owns the chat. The caller picks the
4374
+ * default: React and Vue pass `DEFAULT_AGENT_ID` when the chat has no
4375
+ * agent. With `undefined`, rule 1 matches the same renderers as rule 2.
4376
+ * @returns The renderer, or `null` when no renderer matches. Draw nothing
4377
+ * for `null`.
4378
+ *
4379
+ * @example
4380
+ * ```ts
4381
+ * const renderer = ɵresolveToolCallRenderer(
4382
+ * core.renderToolCalls,
4383
+ * toolCall.function.name,
4384
+ * chatAgentId ?? DEFAULT_AGENT_ID,
4385
+ * );
4386
+ * ```
4387
+ */
4388
+ declare function ɵresolveToolCallRenderer<R extends {
4389
+ name: string;
4390
+ agentId?: string;
4391
+ }>(renderers: readonly R[], toolName: string, agentId: string | undefined): R | null;
4392
+ /** What {@link ɵresolveActivityRenderer} needs to know about the message. */
4393
+ interface ɵActivityRendererQuery {
4394
+ /** Activity type of the message. */
4395
+ activityType: string;
4396
+ /** The agent that owns the chat. Omit it when the chat has no agent. */
4397
+ agentId?: string;
4398
+ /** The message content, before validation. */
4399
+ content: unknown;
4400
+ }
4401
+ /**
4402
+ * Find the renderer that draws an activity message, and validate the
4403
+ * message content with that renderer's `content` schema.
4404
+ *
4405
+ * The first rule that matches picks the renderer:
4406
+ *
4407
+ * 1. A renderer for `activityType` with `agentId` equal to the current agent.
4408
+ * 2. A renderer for `activityType` with no `agentId`.
4409
+ * 3. The first `"*"` renderer, from any agent.
4410
+ *
4411
+ * A renderer for `activityType` that belongs to a different agent never
4412
+ * matches. Inside each rule, the earlier renderer in the list wins.
4413
+ *
4414
+ * Only the picked renderer validates the content. When validation fails, or
4415
+ * the schema validates asynchronously, the result is `null`. The function
4416
+ * does not try the next renderer.
4417
+ *
4418
+ * @param renderers - Registered renderers in registration order.
4419
+ * @param query - The activity type, the current agent, and the raw content.
4420
+ * @returns `{ renderer, content }`, where `content` is the value the schema
4421
+ * returned. Pass that value to `render`, not the raw content. Returns
4422
+ * `null` when no renderer matches or validation does not pass.
4423
+ *
4424
+ * @example
4425
+ * ```ts
4426
+ * const match = ɵresolveActivityRenderer(core.renderActivityMessages, {
4427
+ * activityType: message.activityType,
4428
+ * agentId,
4429
+ * content: message.content,
4430
+ * });
4431
+ * if (match) draw(match.renderer.render, match.content);
4432
+ * ```
4433
+ */
4434
+ declare function ɵresolveActivityRenderer<R extends ActivityMessageRendererDef<unknown, unknown>>(renderers: readonly R[], query: ɵActivityRendererQuery): {
4435
+ renderer: R;
4436
+ content: unknown;
4437
+ } | null;
4438
+ /**
4439
+ * List the custom message renderers that apply to an agent, in the order to
4440
+ * try them.
4441
+ *
4442
+ * The list keeps renderers with no `agentId` and renderers for `agentId`.
4443
+ * Renderers for `agentId` come first. Inside each group, registration order
4444
+ * stays the same.
4445
+ *
4446
+ * The framework tries each renderer in this order and shows the first one
4447
+ * that draws something (a non-null result).
4448
+ *
4449
+ * @param renderers - Registered renderers in registration order.
4450
+ * @param agentId - The agent that owns the chat.
4451
+ * @returns A new array. Empty when no renderer applies.
4452
+ *
4453
+ * @example
4454
+ * ```ts
4455
+ * const candidates = ɵresolveCustomMessageRenderers(
4456
+ * core.renderCustomMessages,
4457
+ * agentId,
4458
+ * );
4459
+ * ```
4460
+ */
4461
+ declare function ɵresolveCustomMessageRenderers<R extends CustomMessageRendererDef<unknown>>(renderers: readonly R[], agentId: string): R[];
4462
+ //#endregion
4463
+ //#region src/chat/interrupt-types.d.ts
4464
+ /** Name of the legacy custom event agents emit to signal an interrupt. */
4465
+ declare const INTERRUPT_EVENT_NAME = "on_interrupt";
4466
+ /** Legacy custom-event interrupt payload (agent emits a custom `on_interrupt` event). */
4467
+ type InterruptEvent<TValue = unknown> = ɵInterruptEvent<TValue>;
4468
+ /**
4469
+ * Resolve the agent with user input for an interrupt.
4470
+ *
4471
+ * - Standard interrupts: records `{ status: "resolved", payload }` for the target
4472
+ * interrupt (defaults to the primary one). Resumes once every open interrupt is
4473
+ * addressed; returns the resume run result, or `void` while still awaiting others.
4474
+ * - Legacy interrupts: resumes immediately via `command.resume = payload`.
4475
+ */
4476
+ type InterruptResolveFn = (payload?: unknown, interruptId?: string) => Promise<RunAgentResult | void>;
4477
+ /**
4478
+ * Cancel an interrupt.
4479
+ *
4480
+ * - Standard interrupts: records `{ status: "cancelled" }` for the target interrupt
4481
+ * (defaults to the primary one), then resumes once all are addressed.
4482
+ * - Legacy interrupts: dismisses the pending interrupt without resuming.
4483
+ */
4484
+ type InterruptCancelFn = (interruptId?: string) => Promise<RunAgentResult | void>;
4485
+ /**
4486
+ * Props an interrupt handler receives.
4487
+ *
4488
+ * @typeParam TValue - The shape of the interrupt value.
4489
+ */
4490
+ interface InterruptHandlerProps<TValue = unknown> {
4491
+ /**
4492
+ * Legacy event shape (`{ name, value }`). Always present for back-compat: for
4493
+ * standard interrupts, `value` is the primary `Interrupt` and `name` is `"on_interrupt"`.
4494
+ * Prefer `interrupt` / `interrupts` for standard interrupts.
4495
+ */
4496
+ event: InterruptEvent<TValue>;
4497
+ /** Primary standard interrupt (`interrupts[0]`), or `null` for legacy interrupts. */
4498
+ interrupt: Interrupt | null;
4499
+ /** All open standard interrupts (empty array for legacy interrupts). */
4500
+ interrupts: Interrupt[];
4501
+ resolve: InterruptResolveFn;
4502
+ cancel: InterruptCancelFn;
4503
+ }
4504
+ /**
4505
+ * Props an interrupt renderer receives. Same as {@link InterruptHandlerProps},
4506
+ * plus the value the handler returned.
4507
+ *
4508
+ * @typeParam TValue - The shape of the interrupt value.
4509
+ * @typeParam TResult - The value the interrupt handler returned.
4510
+ */
4511
+ interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
4512
+ event: InterruptEvent<TValue>;
4513
+ interrupt: Interrupt | null;
4514
+ interrupts: Interrupt[];
4515
+ /** The value the interrupt handler returned. */
4516
+ result: TResult;
4517
+ resolve: InterruptResolveFn;
4518
+ cancel: InterruptCancelFn;
4519
+ }
4520
+ //#endregion
4521
+ //#region src/chat/tool-call-layout.d.ts
4522
+ /**
4523
+ * How the chat shows tool calls.
4524
+ *
4525
+ * - `"grouped"` (default): calls made in a row share one card, collapsed to a
4526
+ * summary ("Used 3 tools") that opens to a row per call.
4527
+ * - `"line"`: the same grouping as a quiet line of text, like the reasoning
4528
+ * message's "Thought for 4 seconds".
4529
+ * - `"stacked"`: the latest call on top of a stack of the earlier ones; click
4530
+ * to fan the stack out into its cards.
4531
+ * - `"turn"`: the agent works in the open (narration, then a row per call),
4532
+ * and when the reply is done everything before it folds into "Worked for 9s".
4533
+ * - `"separate"`: every call gets its own card.
4534
+ *
4535
+ * Only calls drawn by a renderer that opts into grouping (`group: true`) are
4536
+ * grouped. CopilotKit's built-in tool card does. Any other call always shows
4537
+ * on its own and splits the group around it.
4538
+ */
4539
+ type CopilotChatToolCallDisplay = "grouped" | "line" | "stacked" | "turn" | "separate";
4540
+ /** One tool call and, once it has finished, the message carrying its result. */
4541
+ interface ToolCallEntry {
4542
+ toolCall: ToolCall$1;
4543
+ toolMessage?: ToolMessage;
4544
+ }
4545
+ type ToolCallSegment = /** Consecutive calls drawn by renderers that opted into grouping. */{
4546
+ kind: "group";
4547
+ id: string;
4548
+ calls: ToolCallEntry[]; /** Nothing renders after this group yet, so a running agent may add to it. */
4549
+ trailing: boolean;
4550
+ }
4551
+ /**
4552
+ * A call drawn by a renderer that didn't opt into grouping, or with no
4553
+ * renderer at all. The latter renders nothing (and warns in development)
4554
+ * without breaking a group.
4555
+ */
4556
+ | {
4557
+ kind: "call";
4558
+ id: string;
4559
+ call: ToolCallEntry;
4560
+ rendered: boolean;
4561
+ };
4562
+ /** What one assistant message's tool-call area renders. */
4563
+ interface ToolCallLayout {
4564
+ segments: ToolCallSegment[];
4565
+ /** Changes whenever anything this layout renders changes. Use it to memoize. */
4566
+ signature: string;
4567
+ }
4568
+ /** Which tool-call renderers are registered. */
4569
+ interface ToolCallRendererNames {
4570
+ /** Tool names with a renderer of their own. */
4571
+ named: ReadonlySet<string>;
4572
+ /** Of those, the ones whose renderer opted into grouping. */
4573
+ groupedNames: ReadonlySet<string>;
4574
+ /** A wildcard (`"*"`) renderer is registered. */
4575
+ wildcard: boolean;
4576
+ /** The wildcard renderer opted into grouping (the built-in card does). */
4577
+ wildcardGroups: boolean;
4578
+ }
4579
+ /**
4580
+ * The tool-call display state a message view hands down to each message's
4581
+ * tool-call area, so every layer follows the view's `toolCallDisplay`.
4582
+ */
4583
+ interface ToolCallDisplayContextValue {
4584
+ display: CopilotChatToolCallDisplay;
4585
+ isRunning: boolean;
4586
+ /** Each assistant message's tool calls, laid out across the whole list. */
4587
+ layouts: ReadonlyMap<string, ToolCallLayout>;
4588
+ /**
4589
+ * `"turn"` display: for each message in a reply's working phase, whether
4590
+ * that work is showing. Messages not in here are the reply itself.
4591
+ */
4592
+ workOpen: ReadonlyMap<string, boolean>;
4593
+ /**
4594
+ * Like `workOpen`, for the messages' text: text that ends the reply stays
4595
+ * out of it even when its message also calls a tool.
4596
+ */
4597
+ workTextOpen: ReadonlyMap<string, boolean>;
4598
+ }
4599
+ /**
4600
+ * Indexes tool results by the id of the call they answer.
4601
+ *
4602
+ * @param messages - The messages to search. Only `role: "tool"` messages count.
4603
+ */
4604
+ declare function getToolResults(messages: readonly Message$1[]): Map<string, ToolMessage>;
4605
+ /**
4606
+ * Lays out the tool calls of every assistant message in `rendered`.
4607
+ *
4608
+ * Calls drawn by a renderer that opted into grouping join the group that is
4609
+ * open. Anything else that shows between them closes it: assistant text, a
4610
+ * user, reasoning or activity message, or a call drawn by any other renderer.
4611
+ * A group belongs to the message where it starts, so later messages whose
4612
+ * calls joined it render no tool calls themselves.
4613
+ *
4614
+ * @param rendered - The messages as the chat renders them, in order.
4615
+ * @param all - Every message, for finding tool results (a transform may hide them).
4616
+ * @param renderers - The registered renderers, from `getToolCallRendererNames`.
4617
+ * @returns A map from assistant message id to its layout.
4618
+ *
4619
+ * @example
4620
+ * ```ts
4621
+ * const names = getToolCallRendererNames(core.renderToolCalls);
4622
+ * const layouts = getToolCallLayouts(renderedMessages, messages, names);
4623
+ * layouts.get(message.id)?.segments;
4624
+ * ```
4625
+ */
4626
+ declare function getToolCallLayouts(rendered: readonly Message$1[], all: readonly Message$1[], renderers: ToolCallRendererNames): Map<string, ToolCallLayout>;
4627
+ /** Options for `getToolCallRendererNames`. */
4628
+ interface ToolCallRendererNamesOptions {
4629
+ /**
4630
+ * The names of the tool-call slots a view was given (Vue). A slot wins over
4631
+ * a registered renderer and never groups, because the chat cannot tell what
4632
+ * it draws. `tool-call-<name>` takes that tool. `tool-call` takes every
4633
+ * tool and turns grouping off.
4634
+ */
4635
+ slotNames?: readonly string[];
4636
+ /**
4637
+ * More tool names that have a renderer of their own, which never group
4638
+ * (Angular: client tool renderers with a component, and human-in-the-loop
4639
+ * tools).
4640
+ */
4641
+ extraNamed?: readonly string[];
4642
+ /**
4643
+ * A built-in wildcard card that draws tools no other renderer takes
4644
+ * (Angular: `defaultToolRendering`). A registered `"*"` renderer wins over
4645
+ * it, including its `group` choice.
4646
+ */
4647
+ builtInWildcard?: {
4648
+ enabled: boolean;
4649
+ groups: boolean;
4650
+ };
4651
+ }
4652
+ /**
4653
+ * Works out which tool calls have a renderer and which of those group, for
4654
+ * `getToolCallLayouts`.
4655
+ *
4656
+ * @param renderers - The registered renderers. A renderer named `"*"` is the
4657
+ * wildcard. `group: true` opts the renderer into grouping.
4658
+ * @param options - Slots, extra named tools, and a built-in wildcard card.
4659
+ * See `ToolCallRendererNamesOptions`.
4660
+ *
4661
+ * @example
4662
+ * ```ts
4663
+ * // React: only registered renderers.
4664
+ * getToolCallRendererNames(core.renderToolCalls);
4665
+ * // Vue: the view's slots count too.
4666
+ * getToolCallRendererNames(core.renderToolCalls, { slotNames: Object.keys(slots) });
4667
+ * // Angular: client and human-in-the-loop renderers, and the built-in card.
4668
+ * getToolCallRendererNames(appRenderers, {
4669
+ * extraNamed: [...clientNames, ...hitlNames],
4670
+ * builtInWildcard: { enabled: defaultToolRenderingEnabled, groups: true },
4671
+ * });
4672
+ * ```
4673
+ */
4674
+ declare function getToolCallRendererNames(renderers: ReadonlyArray<{
4675
+ name: string;
4676
+ group?: boolean;
4677
+ }>, options?: ToolCallRendererNamesOptions): ToolCallRendererNames;
4678
+ /** A reply's working phase, for the `"turn"` display. */
4679
+ interface TurnWork {
4680
+ /** Stable across the turn's life: the id of the user message it answers. */
4681
+ key: string;
4682
+ /** The first assistant-side message, where the "Worked for" line goes. */
4683
+ firstMessageId: string;
4684
+ /** Everything up to and including the last message with a tool call. */
4685
+ workMessageIds: ReadonlySet<string>;
4686
+ /**
4687
+ * The reply's last assistant message, when it has text and is part of the
4688
+ * work (it also calls a tool). Its text is the answer, so it stays out.
4689
+ */
4690
+ replyTextMessageId?: string;
4691
+ calls: ToolCallEntry[];
4692
+ /** No user message follows, so the agent may still be working on it. */
4693
+ isLatest: boolean;
4694
+ }
4695
+ /**
4696
+ * Finds the working phase of every reply in `rendered`: its messages up to the
4697
+ * last one that calls a tool. Text in there was narration. What follows is the
4698
+ * reply itself. Replies that called no tools are left out, except the latest,
4699
+ * which may be about to.
4700
+ *
4701
+ * @param rendered - The messages as the chat renders them, in order.
4702
+ * @param layouts - The layouts from `getToolCallLayouts` for the same messages.
4703
+ * @returns A map from turn key (see `TurnWork.key`) to the turn's work.
4704
+ */
4705
+ declare function getTurnWork(rendered: readonly Message$1[], layouts: ReadonlyMap<string, ToolCallLayout>): Map<string, TurnWork>;
4706
+ /**
4707
+ * The key of the latest reply (see `TurnWork.key`): the id of the last user
4708
+ * message, or `"start"` when there is none.
4709
+ *
4710
+ * @param rendered - The messages as the chat renders them, in order.
4711
+ */
4712
+ declare function getLatestTurnKey(rendered: readonly Message$1[]): string;
4713
+ /** What decides whether a `"turn"` reply's work shows. */
4714
+ interface TurnOpenState {
4715
+ /** Turns the user opened (`true`) or closed (`false`) by hand. */
4716
+ toggledTurns: ReadonlyMap<string, boolean>;
4717
+ isRunning: boolean;
4718
+ /** From `getLatestTurnKey`. */
4719
+ latestTurnKey: string;
4720
+ }
4721
+ /**
4722
+ * Whether the agent is working on this reply now: it is the latest one and a
4723
+ * run is going.
4724
+ *
4725
+ * @param turnKey - The reply's `TurnWork.key`.
4726
+ * @param state - The run state and the latest turn key.
4727
+ */
4728
+ declare function isTurnWorking(turnKey: string, state: Pick<TurnOpenState, "isRunning" | "latestTurnKey">): boolean;
4729
+ /**
4730
+ * Whether a reply's work shows. It shows while the agent works on the reply
4731
+ * and folds once the reply is done, unless the user opened or closed it.
4732
+ *
4733
+ * @param turnKey - The reply's `TurnWork.key`.
4734
+ * @param state - The user's toggles, the run state, and the latest turn key.
4735
+ */
4736
+ declare function isTurnWorkOpen(turnKey: string, state: TurnOpenState): boolean;
4737
+ /**
4738
+ * For each message in a reply's working phase, whether its work and its text
4739
+ * show. Text that ends the reply stays out of `workTextOpen` even when its
4740
+ * message also calls a tool, because it is the answer.
4741
+ *
4742
+ * @param turns - The turns from `getTurnWork`.
4743
+ * @param state - The user's toggles, the run state, and the latest turn key.
4744
+ * @returns The `workOpen` and `workTextOpen` maps of `ToolCallDisplayContextValue`.
4745
+ */
4746
+ declare function getWorkOpenState(turns: Iterable<TurnWork>, state: TurnOpenState): {
4747
+ workOpen: Map<string, boolean>;
4748
+ workTextOpen: Map<string, boolean>;
4749
+ };
4750
+ /** How long the agent has worked on one reply, summed over its runs. */
4751
+ interface WorkTime {
4752
+ elapsedMs: number;
4753
+ /** When the current run started (epoch ms), while the agent works. */
4754
+ workingSince?: number;
4755
+ }
4756
+ /**
4757
+ * Records run starts and ends in `workTimes`, for "Worked for 9s". Time spent
4758
+ * between runs (say, waiting for an approval) does not count. A reply is only
4759
+ * timed when this client saw it start from the user's message, so a restored
4760
+ * thread gets no entry. Calling it again with the same state changes nothing.
4761
+ *
4762
+ * @param workTimes - The times by turn key. This function updates it in place.
4763
+ * @param state - The run state now.
4764
+ * @param state.lastMessageRole - The role of the last rendered message.
4765
+ * @param state.now - The current time, in epoch ms.
4766
+ */
4767
+ declare function recordWorkTime(workTimes: Map<string, WorkTime>, state: {
4768
+ isRunning: boolean;
4769
+ latestTurnKey: string;
4770
+ lastMessageRole: Message$1["role"] | undefined;
4771
+ now: number;
4772
+ }): void;
4773
+ /**
4774
+ * The status of one row in a tool-call group. A call that never got a result
4775
+ * after the run ended (Stop, an error) is `"stopped"`.
4776
+ */
4777
+ type ToolCallRowStatus = "running" | "done" | "failed" | "stopped";
4778
+ /**
4779
+ * The status of one call in a group. A call without a result is running only
4780
+ * while the group is active: once the run has moved on or ended, its result
4781
+ * is never coming.
4782
+ *
4783
+ * @param entry - The call and its result, if any.
4784
+ * @param active - The agent may still finish the group's calls.
4785
+ */
4786
+ declare function getToolCallRowStatus(entry: ToolCallEntry, active: boolean): ToolCallRowStatus;
4787
+ /**
4788
+ * The first non-empty string argument, with runs of whitespace collapsed to
4789
+ * one space. This is usually a command, path or query.
4790
+ *
4791
+ * @param parameters - The call's parsed arguments.
4792
+ * @returns The preview, or `undefined` when no argument is a non-empty string.
4793
+ */
4794
+ declare function getArgumentPreview(parameters: unknown): string | undefined;
4795
+ /**
4796
+ * `getArgumentPreview` for a call whose arguments may still be streaming in
4797
+ * as partial JSON.
4798
+ *
4799
+ * @param entry - The call.
4800
+ */
4801
+ declare function getToolCallPreview(entry: ToolCallEntry): string | undefined;
4802
+ /**
4803
+ * The names of the tools the calls used, in first-use order, with a count
4804
+ * for repeats: `"run_command ×2, read_file"`.
4805
+ *
4806
+ * @param calls - The calls to name.
4807
+ */
4808
+ declare function formatToolNames(calls: readonly ToolCallEntry[]): string;
4809
+ /**
4810
+ * How many of the calls finished with an error.
4811
+ *
4812
+ * @param calls - The calls to count.
4813
+ */
4814
+ declare function countFailedToolCalls(calls: readonly ToolCallEntry[]): number;
4815
+ /**
4816
+ * A count followed by the word that fits it: `"1 tool"`, `"3 tools"`.
4817
+ *
4818
+ * @param count - The number to show.
4819
+ * @param words - The word for exactly one (`one`) and for any other count (`other`).
4820
+ *
4821
+ * @example
4822
+ * ```ts
4823
+ * pluralize(3, { one: "tool", other: "tools" }); // "3 tools"
4824
+ * ```
4825
+ */
4826
+ declare function pluralize(count: number, words: {
4827
+ one: string;
4828
+ other: string;
4829
+ }): string;
4830
+ /**
4831
+ * A tool call's arguments or result as display text. Strings pass through.
4832
+ * Other values are pretty-printed JSON. A value JSON cannot encode (say, a
4833
+ * circular reference) falls back to `String(value)`, then to
4834
+ * `"[unserializable]"`, so it never throws during a render.
4835
+ *
4836
+ * @param value - The arguments or the result.
4837
+ */
4838
+ declare function stringifyToolCallPayload(value: unknown): string;
4839
+ /**
4840
+ * How long a `"turn"` reply worked, as short text: `"45s"`, `"1m 5s"`, `"2m"`.
4841
+ * Used for the live timer and the final duration. Partial seconds round down,
4842
+ * and a negative time reads `"0s"`.
4843
+ *
4844
+ * @param ms - The time in milliseconds.
4845
+ */
4846
+ declare function formatWorkDuration(ms: number): string;
4847
+ /**
4848
+ * How long a model reasoned, split into the parts a label needs. The default
4849
+ * English text for each unit:
4850
+ *
4851
+ * - `fewSeconds`: `"a few seconds"`.
4852
+ * - `seconds`: `"${seconds} seconds"`.
4853
+ * - `minutes`: `"1 minute"`, or `"${minutes} minutes"` when more than one.
4854
+ * - `minutesSeconds`: `"${minutes}m ${seconds}s"`.
4855
+ */
4856
+ type ReasoningDuration = {
4857
+ unit: "fewSeconds";
4858
+ } | {
4859
+ unit: "seconds";
4860
+ seconds: number;
4861
+ } | {
4862
+ unit: "minutes";
4863
+ minutes: number;
4864
+ } | {
4865
+ unit: "minutesSeconds";
4866
+ minutes: number;
4867
+ seconds: number;
4868
+ };
4869
+ /**
4870
+ * Splits a reasoning time into the unit and counts the "Thought for ..."
4871
+ * header shows. See `ReasoningDuration` for the text each unit maps to.
4872
+ *
4873
+ * - Under 1 second: `fewSeconds`.
4874
+ * - Under 60 seconds: `seconds`, rounded to the nearest second.
4875
+ * - Whole minutes after rounding the seconds: `minutes`.
4876
+ * - Otherwise: `minutesSeconds`.
4877
+ *
4878
+ * @param seconds - The elapsed time in seconds. It may have a fraction.
4879
+ */
4880
+ declare function formatReasoningDuration(seconds: number): {
4881
+ unit: "fewSeconds";
4882
+ seconds?: undefined;
4883
+ minutes?: undefined;
4884
+ } | {
4885
+ unit: "seconds";
4886
+ seconds: number;
4887
+ minutes?: undefined;
4888
+ } | {
4889
+ unit: "minutes";
4890
+ minutes: number;
4891
+ seconds?: undefined;
4892
+ } | {
4893
+ unit: "minutesSeconds";
4894
+ minutes: number;
4895
+ seconds: number;
4896
+ };
4897
+ //#endregion
4898
+ //#region src/chat/messages.d.ts
4899
+ /**
4900
+ * De-duplicates chat messages by id, for rendering.
4901
+ *
4902
+ * A message list from an agent can hold the same message id more than once
4903
+ * while it streams. This keeps one entry per id, at the position the id first
4904
+ * appears:
4905
+ *
4906
+ * - **Assistant messages** are merged. Later fields win, but empty `content`
4907
+ * falls back to earlier non-empty content, and `toolCalls: undefined` falls
4908
+ * back to earlier tool calls (an explicit `[]` is kept).
4909
+ * - **Tool calls** on an assistant message are de-duplicated by id, also
4910
+ * when the message itself is not repeated. The copy that has arguments
4911
+ * wins, and the first-seen order is kept.
4912
+ * - **Other roles** keep the last copy.
4913
+ *
4914
+ * @param messages - The agent's messages, in order.
4915
+ * @returns A new array. A message that needed no change is returned as the
4916
+ * same object.
4917
+ *
4918
+ * @example
4919
+ * ```ts
4920
+ * const visible = ɵdeduplicateMessages(agent.messages);
4921
+ * ```
4922
+ */
4923
+ declare function ɵdeduplicateMessages(messages: readonly Message$1[]): Message$1[];
4924
+ /**
4925
+ * Builds a string that changes whenever a render of the message list could
4926
+ * change. Use it as a cheap memo key in place of a deep comparison.
4927
+ *
4928
+ * The key covers, per message:
4929
+ * - the id and the role.
4930
+ * - the content: text length, part count, or the JSON of object content.
4931
+ * - the `toolCallId` of a tool message.
4932
+ * - each tool call's id and the length of its arguments, so streamed
4933
+ * arguments change the key.
4934
+ *
4935
+ * It never throws. Object content that cannot be serialized (for example a
4936
+ * circular tool result) gets a constant key.
4937
+ *
4938
+ * @param messages - The agent's messages, in order.
4939
+ * @returns The fingerprint string.
4940
+ *
4941
+ * @example
4942
+ * ```ts
4943
+ * const key = ɵmessagesFingerprint(agent.messages);
4944
+ * if (key !== previousKey) rerender();
4945
+ * ```
4946
+ */
4947
+ declare function ɵmessagesFingerprint(messages: readonly Message$1[]): string;
4948
+ //#endregion
4949
+ //#region src/chat/composer.d.ts
4950
+ /**
4951
+ * Send and stop rules for the chat input (the composer).
4952
+ *
4953
+ * These functions hold no state and touch no DOM. React, Vue, and Angular
4954
+ * call them so the three chat inputs make the same send or stop decision.
4955
+ */
4956
+ /** What the chat input shows: the text box, the recorder, or a spinner. */
4957
+ type ɵComposerMode = "input" | "transcribe" | "processing";
4958
+ /** What the chat input knows when it decides to send or stop. */
4959
+ interface ɵComposerInput {
4960
+ /** What the input shows. Default: `"input"`. */
4961
+ mode?: ɵComposerMode;
4962
+ /** `true` while the agent runs. */
4963
+ isRunning: boolean;
4964
+ /** The text in the input, before trimming. */
4965
+ value: string;
4966
+ /** `true` when the input has a handler that sends a message. */
4967
+ canSubmit: boolean;
4968
+ /** `true` when the input has a handler that stops the run. */
4969
+ canStop: boolean;
4970
+ /** `true` when the whole input is disabled. Send is off. Stop stays on. */
4971
+ disabled?: boolean;
4972
+ /** `true` while attached files upload. Send is off. Stop stays on. */
4973
+ attachmentsUploading?: boolean;
4974
+ }
4975
+ /**
4976
+ * Get the state of the send/stop button in the chat input.
4977
+ *
4978
+ * @param input - The current state of the chat input.
4979
+ * @returns
4980
+ * - `isProcessing`: the agent runs and the input does not record audio.
4981
+ * - `canSend`: the text is not empty and nothing blocks a send.
4982
+ * - `action`: `"stop"` when the button stops the run, else `"send"`.
4983
+ * Use it for the icon, the label, and the click.
4984
+ * - `disabled`: `true` when a click does nothing.
4985
+ *
4986
+ * @example
4987
+ * ```ts
4988
+ * const button = ɵcomposerButtonState({
4989
+ * mode: "input",
4990
+ * isRunning: agent.isRunning,
4991
+ * value: text,
4992
+ * canSubmit: true,
4993
+ * canStop: true,
4994
+ * });
4995
+ * // On click:
4996
+ * if (button.action === "stop") stopRun();
4997
+ * else if (button.canSend) sendMessage(text.trim());
4998
+ * ```
4999
+ */
5000
+ declare function ɵcomposerButtonState(input: ɵComposerInput): {
5001
+ isProcessing: boolean;
5002
+ canSend: boolean;
5003
+ action: "send" | "stop";
5004
+ disabled: boolean;
5005
+ };
5006
+ /** The keyboard fields that {@link ɵresolveComposerKey} reads. */
5007
+ interface ɵComposerKeyEvent {
5008
+ key: string;
5009
+ shiftKey: boolean;
5010
+ isComposing: boolean;
5011
+ /** `229` means the key is part of IME composition in some browsers. */
5012
+ keyCode?: number;
5013
+ }
5014
+ /**
5015
+ * Decide what a key press in the chat input does.
5016
+ *
5017
+ * This handles Enter only. Keys for the slash-command menu stay in each
5018
+ * framework, and the framework handles them before it calls this function.
5019
+ *
5020
+ * Results:
5021
+ * - `"send"`: send the trimmed text.
5022
+ * - `"stop"`: stop the run. This happens for Enter in an empty input while
5023
+ * the agent runs. Text in the input always means send, not stop.
5024
+ * - `"newline"`: Shift+Enter. Let the browser add the line break.
5025
+ * - `"none"`: do nothing. Returned during IME composition, while the input
5026
+ * is disabled, for keys other than Enter, and for an Enter that has
5027
+ * nothing to send or stop.
5028
+ *
5029
+ * Call `preventDefault()` for every Enter without Shift that is not part of
5030
+ * IME composition, including when the result is `"none"`. This stops Enter
5031
+ * from adding a line break that the user cannot send.
5032
+ *
5033
+ * @param event - The keyboard event, or an object with the same fields.
5034
+ * @param input - The current state of the chat input.
5035
+ *
5036
+ * @example
5037
+ * ```ts
5038
+ * function onKeyDown(event: KeyboardEvent) {
5039
+ * if (event.isComposing || event.keyCode === 229) return;
5040
+ * // ...slash-command menu keys...
5041
+ * const result = ɵresolveComposerKey(event, composerInput);
5042
+ * if (event.key === "Enter" && !event.shiftKey) event.preventDefault();
5043
+ * if (result === "send") sendMessage(composerInput.value.trim());
5044
+ * if (result === "stop") stopRun();
5045
+ * }
5046
+ * ```
5047
+ */
5048
+ declare function ɵresolveComposerKey(event: ɵComposerKeyEvent, input: ɵComposerInput): "send" | "stop" | "none" | "newline";
5049
+ //#endregion
5050
+ //#region src/chat/transcription.d.ts
5051
+ /** The text the runtime returned for one recording. */
5052
+ interface TranscriptionResult {
5053
+ text: string;
5054
+ size: number;
5055
+ type: string;
5056
+ }
5057
+ /** Why a transcription failed, and whether trying again can help. */
5058
+ interface TranscriptionErrorInfo {
5059
+ code: TranscriptionErrorCode;
5060
+ message: string;
5061
+ retryable: boolean;
5062
+ }
5063
+ /**
5064
+ * The error `ɵtranscribeAudio` throws. Read `error.info.code` to pick a
5065
+ * message for the user, or pass `error.info` to
5066
+ * `ɵtranscriptionErrorMessageKey`.
5067
+ */
5068
+ declare class TranscriptionError extends Error {
5069
+ readonly info: TranscriptionErrorInfo;
5070
+ constructor(info: TranscriptionErrorInfo);
5071
+ }
5072
+ /** The parts of `CopilotKitCore` that a transcription request reads. */
5073
+ type TranscriptionCore = Pick<CopilotKitCore, "runtimeUrl" | "runtimeTransport" | "resolveHeaders" | "credentials">;
5074
+ /**
5075
+ * Send a recording to the CopilotKit runtime and get its text back.
5076
+ *
5077
+ * The request follows the transport set on the core:
5078
+ * - `"single"`: one JSON POST to `runtimeUrl`, with the audio as base64.
5079
+ * - any other transport: a multipart POST to `${runtimeUrl}/transcribe`.
5080
+ *
5081
+ * Headers are resolved on each call. The core's `credentials` are sent when
5082
+ * they are set, the same as for agent requests.
5083
+ *
5084
+ * @param core - The `CopilotKitCore` (or a framework subclass) to send through.
5085
+ * @param audioBlob - The recorded audio.
5086
+ * @param filename - The file name the runtime sees. Defaults to `"recording.webm"`.
5087
+ * @returns The transcription result, with the text in `result.text`.
5088
+ * @throws {TranscriptionError} When the runtime URL is not set, the request
5089
+ * fails, or the runtime returns an error. `error.info` has the code.
5090
+ *
5091
+ * @example
5092
+ * ```ts
5093
+ * try {
5094
+ * const { text } = await ɵtranscribeAudio(core, blob);
5095
+ * } catch (error) {
5096
+ * if (error instanceof TranscriptionError) {
5097
+ * const key = ɵtranscriptionErrorMessageKey(error.info);
5098
+ * showError(key ? labels[key] : error.info.message);
5099
+ * }
5100
+ * }
5101
+ * ```
5102
+ */
5103
+ declare function ɵtranscribeAudio(core: TranscriptionCore, audioBlob: Blob, filename?: string): Promise<TranscriptionResult>;
5104
+ /**
5105
+ * Pick the chat label to show the user for a transcription error.
5106
+ *
5107
+ * @param error - The `info` of a `TranscriptionError`.
5108
+ * @returns A key of the chat labels, or `null`. `null` means no label fits:
5109
+ * show `error.message` instead.
5110
+ *
5111
+ * @example
5112
+ * ```ts
5113
+ * const key = ɵtranscriptionErrorMessageKey(error.info);
5114
+ * const text = key ? labels[key] : error.info.message;
5115
+ * ```
5116
+ */
5117
+ declare function ɵtranscriptionErrorMessageKey(error: TranscriptionErrorInfo): "transcriptionErrorRateLimitedText" | "transcriptionErrorAuthFailedText" | "transcriptionErrorAudioTooLongText" | "transcriptionErrorAudioTooShortText" | "transcriptionErrorInvalidAudioFormatText" | "transcriptionErrorServiceNotConfiguredText" | "transcriptionErrorNetworkText" | "transcriptionErrorGenericText" | null;
5118
+ /** The chat label keys that `ɵtranscriptionErrorMessageKey` can return. */
5119
+ type ɵTranscriptionErrorLabelKey = NonNullable<ReturnType<typeof ɵtranscriptionErrorMessageKey>>;
5120
+ //#endregion
5121
+ //#region src/chat/license.d.ts
5122
+ /** Input for {@link ɵresolveLicenseState}. */
5123
+ interface LicenseStateInput {
5124
+ /**
5125
+ * The legacy license status the runtime reported through `/info`
5126
+ * (`core.licenseStatus`). Leave it out until the first `/info` response.
5127
+ */
5128
+ status?: RuntimeLicenseStatus$1;
5129
+ /**
5130
+ * The structured entitlement response the runtime reported through `/info`
5131
+ * (`core.runtimeEntitlements`).
5132
+ */
5133
+ entitlements?: RuntimeEntitlementResponse;
5134
+ /**
5135
+ * Whether core is still retrying a retryable entitlement failure
5136
+ * (`core.runtimeEntitlementRetryPending`).
5137
+ */
5138
+ retryPending: boolean;
5139
+ /** The public API key or public license key given to the provider. */
5140
+ publicKey?: string;
5141
+ }
5142
+ /**
5143
+ * Resolves the license context and the license banner from the runtime
5144
+ * license authority. React, Vue, and Angular call it with the values core
5145
+ * reports, then show the banner and provide the context.
5146
+ *
5147
+ * Rules:
5148
+ *
5149
+ * - A retryable entitlement failure that core is still retrying hides the
5150
+ * status, so no banner shows until the retry ends. A `valid` or `expiring`
5151
+ * legacy status stays in use during the retry.
5152
+ * - A terminal entitlement failure (not retryable, no `valid` or `expiring`
5153
+ * legacy status) keeps the reported status, but `checkFeature` returns
5154
+ * `false` and `getLimit` returns `null` for every feature.
5155
+ * - The `no_license` banner shows only when the status is `none` and no
5156
+ * public key is set.
5157
+ *
5158
+ * The banner text has no day count. No data source gives the days left.
5159
+ *
5160
+ * @param input - The runtime license values and the public key. See
5161
+ * {@link LicenseStateInput}.
5162
+ * @returns `context` for the license context, `warningStatus` (the status the
5163
+ * banner is based on, `undefined` while a retry runs), and `bannerType`
5164
+ * (`null` when no banner shows).
5165
+ *
5166
+ * @example
5167
+ * ```ts
5168
+ * const { context, bannerType } = ɵresolveLicenseState({
5169
+ * status: core.licenseStatus,
5170
+ * entitlements: core.runtimeEntitlements,
5171
+ * retryPending: core.runtimeEntitlementRetryPending,
5172
+ * publicKey,
5173
+ * });
5174
+ * ```
5175
+ */
5176
+ declare function ɵresolveLicenseState({
5177
+ status,
5178
+ entitlements,
5179
+ retryPending,
5180
+ publicKey
5181
+ }: LicenseStateInput): {
5182
+ context: LicenseContextValue;
5183
+ warningStatus: RuntimeLicenseStatus$1 | undefined;
5184
+ bannerType: "expired" | "expiring" | "invalid" | "no_license" | null;
5185
+ };
5186
+ /**
5187
+ * Resolves whether the threads drawer can load its thread list.
5188
+ *
5189
+ * - `licensed` is `true` when the status is `unknown` (an entitlement lookup
5190
+ * that did not recover, so the threads endpoint decides), or when the
5191
+ * status is `valid` or `expiring` and `checkFeature("threads")` is `true`.
5192
+ * - `licensePending` is `true` while the status is `null` (the runtime has
5193
+ * not reported yet). Show the loading state then, not the locked view.
5194
+ *
5195
+ * @param context - The license context from {@link ɵresolveLicenseState}.
5196
+ *
5197
+ * @example
5198
+ * ```ts
5199
+ * const { licensed, licensePending } = ɵresolveThreadsLicense(context);
5200
+ * ```
5201
+ */
5202
+ declare function ɵresolveThreadsLicense(context: LicenseContextValue): {
5203
+ licensed: boolean;
5204
+ licensePending: boolean;
5205
+ };
5206
+ //#endregion
5207
+ //#region src/chat/icons.d.ts
5208
+ /**
5209
+ * One SVG child element of a chat icon, such as a `<path>` or a `<rect>`.
5210
+ *
5211
+ * Draw it as `<{tag} {...attributes} />` inside the icon's `<svg>`.
5212
+ */
5213
+ interface CopilotIconNode {
5214
+ readonly tag: "path" | "rect" | "circle" | "polygon";
5215
+ /** SVG attributes for the element, for example `{ d: "M5 12h14" }`. */
5216
+ readonly attributes: Readonly<Record<string, string>>;
5217
+ }
5218
+ /** The SVG child elements of one chat icon, in drawing order. */
5219
+ type CopilotIconData = readonly CopilotIconNode[];
5220
+ /** One chat icon: its Lucide name and its SVG child elements. */
5221
+ interface CopilotIconDefinition {
5222
+ /**
5223
+ * The Lucide icon name in kebab case, for example `"arrow-up"`.
5224
+ *
5225
+ * Put `lucide lucide-<name>` in the `<svg>` class so CSS that selects
5226
+ * Lucide classes (such as `.lucide-copy`) keeps working.
5227
+ */
5228
+ readonly name: string;
5229
+ readonly nodes: CopilotIconData;
5230
+ }
5231
+ declare const icons: {
5232
+ ArrowUp: {
5233
+ name: string;
5234
+ nodes: {
5235
+ tag: "path";
5236
+ attributes: {
5237
+ d: string;
5238
+ };
5239
+ }[];
5240
+ };
5241
+ Check: {
5242
+ name: string;
5243
+ nodes: {
5244
+ tag: "path";
5245
+ attributes: {
5246
+ d: string;
5247
+ };
5248
+ }[];
5249
+ };
5250
+ ChevronDown: {
5251
+ name: string;
5252
+ nodes: {
5253
+ tag: "path";
5254
+ attributes: {
5255
+ d: string;
5256
+ };
5257
+ }[];
5258
+ };
5259
+ ChevronLeft: {
5260
+ name: string;
5261
+ nodes: {
5262
+ tag: "path";
5263
+ attributes: {
5264
+ d: string;
5265
+ };
5266
+ }[];
5267
+ };
5268
+ ChevronRight: {
5269
+ name: string;
5270
+ nodes: {
5271
+ tag: "path";
5272
+ attributes: {
5273
+ d: string;
5274
+ };
5275
+ }[];
5276
+ };
5277
+ Circle: {
5278
+ name: string;
5279
+ nodes: {
5280
+ tag: "circle";
5281
+ attributes: {
5282
+ cx: string;
5283
+ cy: string;
5284
+ r: string;
5285
+ };
5286
+ }[];
5287
+ };
5288
+ Copy: {
5289
+ name: string;
5290
+ nodes: ({
5291
+ tag: "path";
5292
+ attributes: {
5293
+ d: string;
5294
+ };
5295
+ } | {
5296
+ tag: "rect";
5297
+ attributes: {
5298
+ width: string;
5299
+ height: string;
5300
+ x: string;
5301
+ y: string;
5302
+ rx: string;
5303
+ ry: string;
5304
+ };
5305
+ })[];
5306
+ };
5307
+ Edit: {
5308
+ name: string;
5309
+ nodes: {
5310
+ tag: "path";
5311
+ attributes: {
5312
+ d: string;
5313
+ };
5314
+ }[];
5315
+ };
5316
+ EyeOff: {
5317
+ name: string;
5318
+ nodes: {
5319
+ tag: "path";
5320
+ attributes: {
5321
+ d: string;
5322
+ };
5323
+ }[];
5324
+ };
5325
+ Loader2: {
5326
+ name: string;
5327
+ nodes: {
5328
+ tag: "path";
5329
+ attributes: {
5330
+ d: string;
5331
+ };
5332
+ }[];
5333
+ };
5334
+ MessageCircle: {
5335
+ name: string;
5336
+ nodes: {
5337
+ tag: "path";
5338
+ attributes: {
5339
+ d: string;
5340
+ };
5341
+ }[];
5342
+ };
5343
+ Mic: {
5344
+ name: string;
5345
+ nodes: ({
5346
+ tag: "path";
5347
+ attributes: {
5348
+ d: string;
5349
+ };
5350
+ } | {
5351
+ tag: "rect";
5352
+ attributes: {
5353
+ x: string;
5354
+ y: string;
5355
+ width: string;
5356
+ height: string;
5357
+ rx: string;
5358
+ };
5359
+ })[];
5360
+ };
5361
+ PanelLeftOpen: {
5362
+ name: string;
5363
+ nodes: ({
5364
+ tag: "path";
5365
+ attributes: {
5366
+ d: string;
5367
+ };
5368
+ } | {
5369
+ tag: "rect";
5370
+ attributes: {
5371
+ width: string;
5372
+ height: string;
5373
+ x: string;
5374
+ y: string;
5375
+ rx: string;
5376
+ };
5377
+ })[];
5378
+ };
5379
+ Play: {
5380
+ name: string;
5381
+ nodes: {
5382
+ tag: "polygon";
5383
+ attributes: {
5384
+ points: string;
5385
+ };
5386
+ }[];
5387
+ };
5388
+ Plus: {
5389
+ name: string;
5390
+ nodes: {
5391
+ tag: "path";
5392
+ attributes: {
5393
+ d: string;
5394
+ };
5395
+ }[];
5396
+ };
5397
+ RefreshCw: {
5398
+ name: string;
5399
+ nodes: {
5400
+ tag: "path";
5401
+ attributes: {
5402
+ d: string;
5403
+ };
5404
+ }[];
5405
+ };
5406
+ Square: {
5407
+ name: string;
5408
+ nodes: {
5409
+ tag: "rect";
5410
+ attributes: {
5411
+ width: string;
5412
+ height: string;
5413
+ x: string;
5414
+ y: string;
5415
+ rx: string;
5416
+ };
5417
+ }[];
5418
+ };
5419
+ ThumbsDown: {
5420
+ name: string;
5421
+ nodes: {
5422
+ tag: "path";
5423
+ attributes: {
5424
+ d: string;
5425
+ };
5426
+ }[];
5427
+ };
5428
+ ThumbsUp: {
5429
+ name: string;
5430
+ nodes: {
5431
+ tag: "path";
5432
+ attributes: {
5433
+ d: string;
5434
+ };
5435
+ }[];
5436
+ };
5437
+ Upload: {
5438
+ name: string;
5439
+ nodes: {
5440
+ tag: "path";
5441
+ attributes: {
5442
+ d: string;
5443
+ };
5444
+ }[];
5445
+ };
5446
+ Volume2: {
5447
+ name: string;
5448
+ nodes: {
5449
+ tag: "path";
5450
+ attributes: {
5451
+ d: string;
5452
+ };
5453
+ }[];
5454
+ };
5455
+ Wrench: {
5456
+ name: string;
5457
+ nodes: {
5458
+ tag: "path";
5459
+ attributes: {
5460
+ d: string;
5461
+ };
5462
+ }[];
5463
+ };
5464
+ X: {
5465
+ name: string;
5466
+ nodes: {
5467
+ tag: "path";
5468
+ attributes: {
5469
+ d: string;
5470
+ };
5471
+ }[];
5472
+ };
5473
+ };
5474
+ /** The name of a chat icon in `ɵcopilotIcons`, for example `"ArrowUp"`. */
5475
+ type CopilotIconName = keyof typeof icons;
5476
+ /**
5477
+ * Internal. The SVG data for every icon the chat components draw.
5478
+ *
5479
+ * Each framework's `CopilotIcon` component reads an entry and draws it:
5480
+ *
5481
+ * ```ts
5482
+ * const { name, nodes } = ɵcopilotIcons.ArrowUp;
5483
+ * // <svg {...ɵcopilotIconSvgAttributes} class="lucide lucide-arrow-up">
5484
+ * // one child element per node: <{node.tag} {...node.attributes} />
5485
+ * // </svg>
5486
+ * ```
5487
+ */
5488
+ declare const ɵcopilotIcons: Readonly<Record<CopilotIconName, CopilotIconDefinition>>;
5489
+ /**
5490
+ * Internal. The attributes to put on the `<svg>` of every chat icon.
5491
+ *
5492
+ * These are Lucide's default attributes, so a drawn icon matches the Lucide
5493
+ * icon. Set `width` and `height` to change the size.
5494
+ */
5495
+ declare const ɵcopilotIconSvgAttributes: Readonly<Record<string, string>>;
5496
+ //#endregion
5497
+ export { A2UIMarkdownOperation, A2UI_FENCE_LANGUAGE, ActionConfig, ActionCreator, ActionFromCreator, ActionFromCreators, ActionGroupConfig, ActionGroupResult, type ActivityMessageRenderProps, type ActivityMessageRendererDef, AgentRegistry, AgentThreadLockedError, AnyAction, ChildIdsOf, ChildWalkOptions, ContextStore, CopilotChatDefaultLabels, type CopilotChatLabels, type CopilotChatToolCallDisplay, type CopilotIconData, type CopilotIconDefinition, type CopilotIconName, type CopilotIconNode, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreCatalogComponent, CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreContinuationHandoff, CopilotKitCoreErrorCode, CopilotKitCoreFriendsAccess, CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRegisterProxiedAgentParams, type CopilotKitCoreRegisterProxiedAgentResult, type CopilotKitCoreRunAgentParams, type CopilotKitCoreRunToolParams, type CopilotKitCoreRunToolResult, CopilotKitCoreRuntimeConnectionStatus, CopilotKitCoreStopAgentParams, CopilotKitCoreSubscriber, CopilotKitCoreSubscription, CopilotKitHeaderResolutionError, type CopilotKitHeadersSource, type CopilotKitMessageFilter, CopilotRuntimeTransport, type CustomMessageRenderProps, type CustomMessageRendererDef, type CustomMessageRendererPosition, DispatchingEffect, DispatchingEffectOptions, DynamicSuggestionsConfig, Effect, EmptyActionConfig, FrontendTool, FrontendToolHandlerContext, FrontendToolReconnectBehavior, type HumanInTheLoopRenderProps, INSPECTOR_THREAD_BRIDGE_PLUGIN_ID, INTERRUPT_EVENT_NAME, InspectorActiveThreadPayload, type InspectorMetadataV1, InspectorStopViewingPayload, InspectorViewThreadPayload, InspectorViewThreadResultPayload, IntelligenceAgent, IntelligenceAgentConfig, type IntelligenceRuntimeInfo, type InterruptCancelFn, type InterruptEvent, type InterruptHandlerProps, type InterruptRenderProps, type InterruptResolveFn, type JsonValue, type LearningConfig, type LegacyLearningConfig, MEMORY_ERROR_REGISTRY, MarkdownSegment, Memory, MemoryChanges, MemoryError, type MemoryErrorCategory, type MemoryErrorCode, type MemoryErrorRegistryEntry, MemoryKind, MemoryRealtimeStatus, MemoryScope, NewMemory, NonDispatchingEffect, NonDispatchingEffectOptions, type OpenThreadRegistration, PropsActionConfig, ProxiedCopilotRuntimeAgent, ProxiedCopilotRuntimeAgentConfig, Reducer, RunCompletionAware, RunHandler, type RuntimeLicenseStatus, type RuntimeMode, ScopedContext, ScopedProperties, Selector, type StartResult, StateManager, StaticSuggestionsConfig, Store, StoreLifecycleAction, SubscribeToAgentOptions, SubscribeToAgentSubscriber, Suggestion, SuggestionAvailability, SuggestionEngine, SuggestionsConfig, SurfaceSegment, type ThreadEndpointRuntimeInfo, ThreadRunActivityNotification, type ToolCallEntry, type ToolCallRenderProps, type ToolCallRendererDef, ToolCallStatus, type TrajectoryStartOptions, TranscriptionError, TranscriptionErrorCode, type TranscriptionErrorInfo, type TranscriptionResult, WebMCPModelContext, WebMCPRegistry, WebMCPToolAnnotations, WebMCPToolConfig, classifySurfaceCards, completePartialMarkdown, createActionGroup, createEffect, createInspectorThreadRequestId, createReducer, createSelector, createStore, emitInspectorActiveThread, emitInspectorStopViewing, emitInspectorViewThread, emitInspectorViewThreadResult, empty, ensureObjectArgs, extractCompleteArrayItems, extractFenceOperations, extractStringField, flattenInformationalCards, getMarkdownOperationSurfaceId, getWebMCPModelContext, isAbortError, isInspectorThreadBridgeEnabled, isRunCompletionAware, ofType, on, onInspectorActiveThread, onInspectorStopViewing, onInspectorViewThread, onInspectorViewThreadResult, parseToolArguments, prepareSurfaceOperations, props, segmentSurfaceProse, select, splitA2UIMarkdown, type ɵActivityRendererQuery, ɵCOPILOTKIT_FEATURES, type ɵComposerInput, type ɵComposerKeyEvent, type ɵComposerMode, ɵCopilotKitFeature, ɵGenerativeUIDebugFunction, ɵGenerativeUIDebugPromptSection, ɵGenerativeUIDebugRun, ɵGenerativeUIDebugSnapshot, ɵGenerativeUIDebugSource, ɵGenerativeUIDebugSurface, ɵInterruptDecision, ɵInterruptEvent, ɵInterruptState, ɵInterruptToolResult, type LicenseStateInput as ɵLicenseStateInput, ɵMAX_SOCKET_RETRIES, ɵMemoryEnvironment, ɵMemoryMetadataEvent, ɵMemoryRuntimeContext, ɵMemoryState, ɵMemoryStore, ɵPendingInterrupt, ɵPhoenixChannelLike, ɵPhoenixChannelOptions, ɵPhoenixChannelSession, ɵPhoenixJoinOutcome, ɵPhoenixPushLike, ɵPhoenixSocketLike, ɵPhoenixSocketOptions, ɵPhoenixSocketSession, ɵPhoenixSocketSignal, ɵRUNTIME_PROBE_TIMEOUT_MS, type ReasoningDuration as ɵReasoningDuration, ɵTHREAD_REQUEST_TIMEOUT_MS, ɵThread, ɵThreadEnvironment, ɵThreadMetadataEvent, ɵThreadRuntimeContext, ɵThreadSelectors, ɵThreadStore, type ToolCallDisplayContextValue as ɵToolCallDisplayContextValue, type ToolCallLayout as ɵToolCallLayout, type ToolCallRendererNames as ɵToolCallRendererNames, type ToolCallRendererNamesOptions as ɵToolCallRendererNamesOptions, type ToolCallRowStatus as ɵToolCallRowStatus, type ToolCallSegment as ɵToolCallSegment, type TranscriptionCore as ɵTranscriptionCore, type ɵTranscriptionErrorLabelKey, type TurnOpenState as ɵTurnOpenState, type TurnWork as ɵTurnWork, type WorkTime as ɵWorkTime, ɵclearAgentInterruptState, ɵcomposerButtonState, ɵcopilotIconSvgAttributes, ɵcopilotIcons, countFailedToolCalls as ɵcountFailedToolCalls, createMemoryStore as ɵcreateMemoryStore, ɵcreateThreadSelectors, createThreadStore as ɵcreateThreadStore, ɵdeduplicateMessages, ɵformatCountLabel, ɵformatLabel, formatReasoningDuration as ɵformatReasoningDuration, formatToolNames as ɵformatToolNames, formatWorkDuration as ɵformatWorkDuration, ɵgetAgentInterruptState, getArgumentPreview as ɵgetArgumentPreview, getLatestTurnKey as ɵgetLatestTurnKey, getToolCallLayouts as ɵgetToolCallLayouts, getToolCallPreview as ɵgetToolCallPreview, getToolCallRendererNames as ɵgetToolCallRendererNames, getToolCallRowStatus as ɵgetToolCallRowStatus, getToolResults as ɵgetToolResults, getTurnWork as ɵgetTurnWork, getWorkOpenState as ɵgetWorkOpenState, ɵisCopilotKitFeature, ɵisHttpAgent, isRetryableStatus as ɵisRetryableMemoryStatus, isTurnWorkOpen as ɵisTurnWorkOpen, isTurnWorking as ɵisTurnWorking, ɵjoinPhoenixChannel$, ɵmapMemoryMetadataEvent, ɵmemoryAdapterEvents, ɵmemoryDomainEvents, ɵmemoryReducer, ɵmemoryRestEvents, ɵmessagesFingerprint, ɵobservePhoenixEvent$, ɵobservePhoenixJoinOutcome$, ɵobservePhoenixSocketHealth$, ɵobservePhoenixSocketSignals$, ɵphoenixChannel$, ɵphoenixSocket$, pluralize as ɵpluralize, recordWorkTime as ɵrecordWorkTime, ɵresolveActivityRenderer, ɵresolveComposerKey, ɵresolveCustomMessageRenderers, ɵresolveLicenseState, ɵresolveThreadsLicense, ɵresolveToolCallRenderer, ɵselectFetchMoreError, ɵselectHasNextPage, ɵselectIsFetchingNextPage, ɵselectIsMutating, ɵselectMemories, ɵselectMemoriesAvailable, ɵselectMemoriesError, ɵselectMemoriesIsLoading, ɵselectMemoriesIsMutating, ɵselectMemoriesRealtimeStatus, ɵselectThreads, ɵselectThreadsError, ɵselectThreadsIsLoading, stringifyToolCallPayload as ɵstringifyToolCallPayload, ɵthreadAdapterEvents, ɵtranscribeAudio, ɵtranscriptionErrorMessageKey, ɵwithHeaderDefaults };
3908
5498
  //# sourceMappingURL=index.d.cts.map