@yourgpt/copilot-sdk 2.1.5-alpha.4 → 2.1.5-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/{MessageTree-CSIHErPK.d.ts → MessageTree-Clhiv_k2.d.ts} +4 -3
  2. package/dist/{MessageTree-B0JGQOCi.d.cts → MessageTree-Dt9qfJ55.d.cts} +4 -3
  3. package/dist/{chunk-NUXLAZOE.cjs → chunk-3ZDRX7J2.cjs} +2 -2
  4. package/dist/{chunk-NUXLAZOE.cjs.map → chunk-3ZDRX7J2.cjs.map} +1 -1
  5. package/dist/{chunk-RKGRQRZU.js → chunk-533K2Z7C.js} +4 -4
  6. package/dist/{chunk-RKGRQRZU.js.map → chunk-533K2Z7C.js.map} +1 -1
  7. package/dist/chunk-5EGBIQYS.cjs +292 -0
  8. package/dist/chunk-5EGBIQYS.cjs.map +1 -0
  9. package/dist/chunk-5UGWLGFS.cjs +2039 -0
  10. package/dist/chunk-5UGWLGFS.cjs.map +1 -0
  11. package/dist/{chunk-3AONOZLY.js → chunk-AIVXGTWS.js} +2 -2
  12. package/dist/chunk-AIVXGTWS.js.map +1 -0
  13. package/dist/{chunk-LLM7AHMO.js → chunk-DDZLRCVX.js} +2 -2
  14. package/dist/{chunk-LLM7AHMO.js.map → chunk-DDZLRCVX.js.map} +1 -1
  15. package/dist/{chunk-FLZO2FO3.js → chunk-DH6EO6NW.js} +1334 -3048
  16. package/dist/chunk-DH6EO6NW.js.map +1 -0
  17. package/dist/{chunk-B4YDIMP3.cjs → chunk-KGYDGK3U.cjs} +82 -29
  18. package/dist/chunk-KGYDGK3U.cjs.map +1 -0
  19. package/dist/{chunk-XUR3IOPX.cjs → chunk-LHLVTGIP.cjs} +1336 -3100
  20. package/dist/chunk-LHLVTGIP.cjs.map +1 -0
  21. package/dist/{chunk-TPB7XED6.cjs → chunk-TPDMBDQX.cjs} +2 -2
  22. package/dist/chunk-TPDMBDQX.cjs.map +1 -0
  23. package/dist/chunk-TXQ37MAO.js +287 -0
  24. package/dist/chunk-TXQ37MAO.js.map +1 -0
  25. package/dist/{chunk-MDS23G2S.cjs → chunk-Y2A6AMGO.cjs} +10 -10
  26. package/dist/{chunk-MDS23G2S.cjs.map → chunk-Y2A6AMGO.cjs.map} +1 -1
  27. package/dist/{chunk-EEH3L64W.js → chunk-YLZCTR4O.js} +63 -10
  28. package/dist/chunk-YLZCTR4O.js.map +1 -0
  29. package/dist/chunk-ZAOTYA5L.js +1983 -0
  30. package/dist/chunk-ZAOTYA5L.js.map +1 -0
  31. package/dist/core/index.cjs +93 -93
  32. package/dist/core/index.d.cts +3 -3
  33. package/dist/core/index.d.ts +3 -3
  34. package/dist/core/index.js +5 -5
  35. package/dist/experimental/index.cjs +644 -0
  36. package/dist/experimental/index.cjs.map +1 -0
  37. package/dist/experimental/index.d.cts +924 -0
  38. package/dist/experimental/index.d.ts +924 -0
  39. package/dist/experimental/index.js +611 -0
  40. package/dist/experimental/index.js.map +1 -0
  41. package/dist/{index-D7169xuR.d.ts → index-D8zza1Q8.d.ts} +1 -1
  42. package/dist/{index-CzJB8Ddo.d.cts → index-DCVjTdIZ.d.cts} +1 -1
  43. package/dist/mcp/index.d.cts +3 -3
  44. package/dist/mcp/index.d.ts +3 -3
  45. package/dist/react/index.cjs +136 -123
  46. package/dist/react/index.d.cts +174 -8
  47. package/dist/react/index.d.ts +174 -8
  48. package/dist/react/index.js +7 -6
  49. package/dist/styles.css +45 -0
  50. package/dist/tools/anthropic/index.cjs +3 -3
  51. package/dist/tools/anthropic/index.d.cts +1 -1
  52. package/dist/tools/anthropic/index.d.ts +1 -1
  53. package/dist/tools/anthropic/index.js +2 -2
  54. package/dist/tools/brave/index.cjs +6 -6
  55. package/dist/tools/brave/index.d.cts +1 -1
  56. package/dist/tools/brave/index.d.ts +1 -1
  57. package/dist/tools/brave/index.js +3 -3
  58. package/dist/tools/exa/index.cjs +6 -6
  59. package/dist/tools/exa/index.d.cts +1 -1
  60. package/dist/tools/exa/index.d.ts +1 -1
  61. package/dist/tools/exa/index.js +3 -3
  62. package/dist/tools/google/index.cjs +6 -6
  63. package/dist/tools/google/index.d.cts +1 -1
  64. package/dist/tools/google/index.d.ts +1 -1
  65. package/dist/tools/google/index.js +4 -4
  66. package/dist/tools/openai/index.cjs +6 -6
  67. package/dist/tools/openai/index.d.cts +1 -1
  68. package/dist/tools/openai/index.d.ts +1 -1
  69. package/dist/tools/openai/index.js +3 -3
  70. package/dist/tools/searxng/index.cjs +6 -6
  71. package/dist/tools/searxng/index.d.cts +1 -1
  72. package/dist/tools/searxng/index.d.ts +1 -1
  73. package/dist/tools/searxng/index.js +3 -3
  74. package/dist/tools/serper/index.cjs +6 -6
  75. package/dist/tools/serper/index.d.cts +1 -1
  76. package/dist/tools/serper/index.d.ts +1 -1
  77. package/dist/tools/serper/index.js +3 -3
  78. package/dist/tools/tavily/index.cjs +6 -6
  79. package/dist/tools/tavily/index.d.cts +1 -1
  80. package/dist/tools/tavily/index.d.ts +1 -1
  81. package/dist/tools/tavily/index.js +3 -3
  82. package/dist/tools/web-search/index.cjs +7 -7
  83. package/dist/tools/web-search/index.d.cts +2 -2
  84. package/dist/tools/web-search/index.d.ts +2 -2
  85. package/dist/tools/web-search/index.js +4 -4
  86. package/dist/{tools-tmksfhUo.d.cts → tools-DcS6Aeao.d.cts} +7 -3
  87. package/dist/{tools-tmksfhUo.d.ts → tools-DcS6Aeao.d.ts} +7 -3
  88. package/dist/{types-BqwW3Baj.d.ts → types-BUYni9B8.d.ts} +1 -1
  89. package/dist/{types-BLw7mxtW.d.cts → types-Cvg4DUoc.d.cts} +1 -1
  90. package/dist/ui/index.cjs +345 -522
  91. package/dist/ui/index.cjs.map +1 -1
  92. package/dist/ui/index.d.cts +21 -3
  93. package/dist/ui/index.d.ts +21 -3
  94. package/dist/ui/index.js +188 -370
  95. package/dist/ui/index.js.map +1 -1
  96. package/package.json +6 -1
  97. package/dist/chunk-3AONOZLY.js.map +0 -1
  98. package/dist/chunk-B4YDIMP3.cjs.map +0 -1
  99. package/dist/chunk-EEH3L64W.js.map +0 -1
  100. package/dist/chunk-FLZO2FO3.js.map +0 -1
  101. package/dist/chunk-TPB7XED6.cjs.map +0 -1
  102. package/dist/chunk-XUR3IOPX.cjs.map +0 -1
@@ -1,16 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { U as UIMessage, B as BranchInfo } from '../MessageTree-B0JGQOCi.cjs';
3
- export { M as MessageTree } from '../MessageTree-B0JGQOCi.cjs';
2
+ import { U as UIMessage, B as BranchInfo } from '../MessageTree-Dt9qfJ55.cjs';
3
+ export { M as MessageTree } from '../MessageTree-Dt9qfJ55.cjs';
4
4
  import * as React$1 from 'react';
5
5
  import React__default from 'react';
6
6
  import { L as LLMConfig, l as ToolsConfig, s as ActionDefinition, o as CapturedContext, m as ToolConsentRequest, T as ToolType, n as ToolConsentResponse, S as ScreenshotOptions, C as ConsoleLogOptions, N as NetworkRequestOptions, I as IntentDetectionResult, y as InternalKnowledgeBaseConfig, B as InternalKnowledgeBaseSearchResponse, z as InternalKnowledgeBaseResult, Y as ThreadManagerState, Z as LoadStatus, U as ThreadManagerConfig, F as ThreadManager, V as ThreadManagerCallbacks, W as CreateThreadOptions, X as UpdateThreadOptions } from '../ThreadManager-DK46fVl3.cjs';
7
7
  export { A as ActionParameter, q as CloudConfig, r as CopilotConfig, _ as LocalStorageAdapterConfig, J as createLocalStorageAdapter, O as createMemoryAdapter, i as generateSuggestionReason } from '../ThreadManager-DK46fVl3.cjs';
8
- import { T as ToolDefinition, t as ToolOptimizationConfig, r as ContextUsage, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, y as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolResultConfig, D as AIResponseMode, u as ToolSet, U as UnifiedToolCall, G as PermissionStorageConfig, H as PermissionStorageAdapter } from '../tools-tmksfhUo.cjs';
9
- export { z as AgentLoopConfig, q as ContextUsagePart, h as ToolConfig, a as ToolExecutionStatus, F as ToolPermission, v as ToolSetEntry, I as tool } from '../tools-tmksfhUo.cjs';
8
+ import { T as ToolDefinition, t as ToolOptimizationConfig, r as ContextUsage, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, y as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolResultConfig, D as AIResponseMode, u as ToolSet, U as UnifiedToolCall, G as PermissionStorageConfig, H as PermissionStorageAdapter } from '../tools-DcS6Aeao.cjs';
9
+ export { z as AgentLoopConfig, q as ContextUsagePart, h as ToolConfig, a as ToolExecutionStatus, F as ToolPermission, v as ToolSetEntry, I as tool } from '../tools-DcS6Aeao.cjs';
10
10
  import { A as AsyncThreadStorageAdapter, M as MessageAttachment, T as ToolCall, d as Message, S as Source, a as Thread, b as ThreadData, c as ThreadStorageAdapter } from '../types-waEqyE4K.cjs';
11
11
  export { P as PersistenceConfig, j as ThreadStorageAdapter } from '../types-waEqyE4K.cjs';
12
- import { G as MCPServerConfig, U as UseMCPClientConfig, D as UseMCPClientReturn, E as UseMCPToolsConfig, F as UseMCPToolsReturn } from '../types-BLw7mxtW.cjs';
13
- export { b as MCPClientState } from '../types-BLw7mxtW.cjs';
12
+ import { G as MCPServerConfig, U as UseMCPClientConfig, D as UseMCPClientReturn, E as UseMCPToolsConfig, F as UseMCPToolsReturn } from '../types-Cvg4DUoc.cjs';
13
+ export { b as MCPClientState } from '../types-Cvg4DUoc.cjs';
14
14
  import { S as SkillDefinition, R as ResolvedSkill } from '../types-BckL3hiw.cjs';
15
15
  export { C as ClientInlineSkill, b as SkillSource, c as SkillStrategy } from '../types-BckL3hiw.cjs';
16
16
  import { U as UseMCPUIIntentsConfig, m as UseMCPUIIntentsReturn } from '../types-B20VCJXL.cjs';
@@ -509,6 +509,15 @@ interface ChatCallbacks<T extends UIMessage = UIMessage> {
509
509
  result?: unknown;
510
510
  error?: string;
511
511
  }) => void;
512
+ /**
513
+ * Called for every raw stream chunk as it arrives.
514
+ * Use this to build custom real-time UI on top of the SDK — e.g. thinking
515
+ * step parsers, tool progress trackers, loop iteration counters.
516
+ * The `messageId` field is the ID of the assistant message being streamed.
517
+ */
518
+ onStreamChunk?: (chunk: StreamChunk & {
519
+ messageId?: string;
520
+ }) => void;
512
521
  }
513
522
  /**
514
523
  * Chat initialization options
@@ -763,6 +772,17 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
763
772
  toolCallId: string;
764
773
  result: unknown;
765
774
  }>): Promise<void>;
775
+ /**
776
+ * Add tool result messages to history and stop — does NOT trigger a new LLM request.
777
+ *
778
+ * Use this instead of continueWithToolResults when you want to close out pending
779
+ * tool_use blocks (so the history stays valid) without letting the AI continue.
780
+ * Optionally appends a final assistant message (e.g. an iteration-limit notice).
781
+ */
782
+ addToolResultMessages(toolResults: Array<{
783
+ toolCallId: string;
784
+ result: unknown;
785
+ }>, finalAssistantContent?: string): Promise<void>;
766
786
  /**
767
787
  * Stop generation
768
788
  */
@@ -804,7 +824,9 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
804
824
  /**
805
825
  * Process a chat request
806
826
  */
807
- protected processRequest(): Promise<void>;
827
+ protected processRequest(options?: {
828
+ preCreatedMessageId?: string;
829
+ }): Promise<void>;
808
830
  /**
809
831
  * Set tools available for the LLM
810
832
  */
@@ -1356,6 +1378,26 @@ interface CopilotProviderProps {
1356
1378
  */
1357
1379
  skills?: SkillDefinition[];
1358
1380
  }
1381
+ type StreamChunkWithMessageId = StreamChunk & {
1382
+ messageId?: string;
1383
+ };
1384
+ type StreamEventHandler = (chunk: StreamChunkWithMessageId) => void;
1385
+ /**
1386
+ * Reactive store for custom per-message metadata.
1387
+ * Powers useMessageMeta() — consumers write any shape they want,
1388
+ * all components reading the same messageId react automatically.
1389
+ */
1390
+ declare class MessageMetaStore {
1391
+ private store;
1392
+ private listeners;
1393
+ private static readonly EMPTY;
1394
+ subscribe: (cb: () => void) => (() => void);
1395
+ getSnapshot: () => Map<string, Record<string, unknown>>;
1396
+ getMeta: (messageId: string) => Record<string, unknown>;
1397
+ setMeta: (messageId: string, meta: Record<string, unknown>) => void;
1398
+ updateMeta: (messageId: string, updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
1399
+ clear: () => void;
1400
+ }
1359
1401
  interface CopilotContextValue {
1360
1402
  messages: UIMessage[];
1361
1403
  status: "ready" | "submitted" | "streaming" | "error";
@@ -1399,6 +1441,7 @@ interface CopilotContextValue {
1399
1441
  content: string;
1400
1442
  strategy?: string;
1401
1443
  }>) => void;
1444
+ agentIteration: number;
1402
1445
  threadId?: string;
1403
1446
  /**
1404
1447
  * Runtime URL configuration.
@@ -1406,6 +1449,24 @@ interface CopilotContextValue {
1406
1449
  */
1407
1450
  runtimeUrl: Resolvable<string>;
1408
1451
  toolsConfig?: ToolsConfig;
1452
+ /**
1453
+ * Subscribe to raw stream chunks as they arrive.
1454
+ * Returns an unsubscribe function. Use useCopilotEvent() for the hook API.
1455
+ *
1456
+ * @example
1457
+ * ```ts
1458
+ * const unsub = subscribeToStreamEvents((chunk) => {
1459
+ * if (chunk.type === 'thinking:delta') { ... }
1460
+ * })
1461
+ * return unsub // cleanup
1462
+ * ```
1463
+ */
1464
+ subscribeToStreamEvents: (handler: StreamEventHandler) => () => void;
1465
+ /**
1466
+ * Reactive per-message metadata store.
1467
+ * Use useMessageMeta(messageId) for the hook API.
1468
+ */
1469
+ messageMeta: MessageMetaStore;
1409
1470
  }
1410
1471
  declare function useCopilot(): CopilotContextValue;
1411
1472
  declare function CopilotProvider({ children, runtimeUrl, systemPrompt, tools: toolsConfig, threadId, initialMessages, onMessagesChange, onError, streaming, headers, body, debug, maxIterations, maxIterationsMessage, mcpServers, optimization, messageHistory, skills, }: CopilotProviderProps): react_jsx_runtime.JSX.Element;
@@ -2892,6 +2953,72 @@ interface UseSkillStatusReturn {
2892
2953
  }
2893
2954
  declare function useSkillStatus(): UseSkillStatusReturn;
2894
2955
 
2956
+ interface MessageCheckpoint {
2957
+ /** Unique checkpoint ID */
2958
+ id: string;
2959
+ /** ID of the user message that triggered this checkpoint */
2960
+ messageId: string;
2961
+ /** When this checkpoint was created */
2962
+ timestamp: number;
2963
+ /** Optional human-readable label */
2964
+ label?: string;
2965
+ /** Full message list BEFORE the user message was processed */
2966
+ messages: UIMessage[];
2967
+ }
2968
+ interface UseMessageCheckpointsReturn {
2969
+ /** All saved checkpoints, oldest first */
2970
+ checkpoints: MessageCheckpoint[];
2971
+ /** True if a checkpoint exists for the given user message ID */
2972
+ hasCheckpoint: (messageId: string) => boolean;
2973
+ /** Get the checkpoint for a user message ID, or undefined */
2974
+ getCheckpoint: (messageId: string) => MessageCheckpoint | undefined;
2975
+ /**
2976
+ * Restore chat to the state before the user message with the given ID.
2977
+ * Returns the checkpoint if found, undefined otherwise.
2978
+ * Checkpoints created after this one are pruned.
2979
+ */
2980
+ restore: (messageId: string) => MessageCheckpoint | undefined;
2981
+ /**
2982
+ * Manually save a checkpoint for a message ID.
2983
+ * Auto-save already runs on every new user message — use this for
2984
+ * programmatic checkpoints (e.g. before a destructive tool call).
2985
+ */
2986
+ save: (messageId: string, label?: string) => MessageCheckpoint | undefined;
2987
+ /** Clear all saved checkpoints */
2988
+ clear: () => void;
2989
+ }
2990
+ /**
2991
+ * useMessageCheckpoints
2992
+ *
2993
+ * Automatically saves a checkpoint before each user message is sent to the
2994
+ * agent. Each checkpoint captures the full chat state that existed BEFORE
2995
+ * that user message, so restoring it rolls the conversation back to exactly
2996
+ * that point.
2997
+ *
2998
+ * Generic — works for any agentic app (flow builders, code editors, document
2999
+ * assistants, etc.). App-specific side effects (e.g. restoring a canvas or
3000
+ * database state) can be layered on top via the returned `restore` value.
3001
+ *
3002
+ * @example
3003
+ * ```tsx
3004
+ * // Inside <CopilotChat> children
3005
+ * function MyCheckpointActions() {
3006
+ * const { hasCheckpoint, restore } = useMessageCheckpoints();
3007
+ * return (
3008
+ * <CopilotChat.MessageActions role="user">
3009
+ * <CopilotChat.Action
3010
+ * icon={<RotateCcw className="size-3.5" />}
3011
+ * tooltip="Restore to before this message"
3012
+ * onClick={({ message }) => restore(message.id)}
3013
+ * hidden={({ message }) => !hasCheckpoint(message.id)}
3014
+ * />
3015
+ * </CopilotChat.MessageActions>
3016
+ * );
3017
+ * }
3018
+ * ```
3019
+ */
3020
+ declare function useMessageCheckpoints(): UseMessageCheckpointsReturn;
3021
+
2895
3022
  /**
2896
3023
  * Create a permission storage adapter based on config
2897
3024
  */
@@ -3306,4 +3433,43 @@ declare function toLLMMessages(messages: DisplayMessage[]): LLMMessage[];
3306
3433
  declare function keepToolPairsAtomic(messages: DisplayMessage[]): DisplayMessage[];
3307
3434
  declare function isCompactionMarker(msg: DisplayMessage): msg is CompactionMarker;
3308
3435
 
3309
- export { type AIContextItem, AbstractAgentLoop, AbstractChat, ActionDefinition, type AgentLoopActions, type AgentLoopCallbacks, type AgentLoopState, AsyncThreadStorageAdapter, BranchInfo, type CapabilitiesResponse, CapturedContext, type ChatActions, type ChatCallbacks, type ChatConfig, type ChatState, type ChatStatus, type ToolExecution as ChatToolExecution, type ToolResponse as ChatToolResponse, type CombinedChatState, type CompactedToolResult, type CompactionEvent, type CompactionMarker, type CompactionStrategy, type ContextStats, ContextUsage, type CopilotContextValue, CopilotProvider, type CopilotProviderProps, type AgentLoopState$1 as CoreAgentLoopState, type ChatState$1 as CoreChatState, type DevLoggerState, type DisplayMessage, IntentDetectionResult, type KnowledgeBaseConfig, type KnowledgeBaseResult, type KnowledgeBaseSearchResponse, LLMConfig, type LLMMessage, Message, type MessageHistoryConfig, MessageHistoryContext, type MessageHistoryContextValue, type MessageTokenUsage, PermissionLevel, PermissionStorageAdapter, PermissionStorageConfig, type ProviderCapabilities, ReactChat, type ReactChatConfig, ReactChatState, ReactThreadManager, type ReactThreadManagerConfig, ReactThreadManagerState, ResolvedSkill, type ServerAdapterConfig, type SessionCompactionState, SkillDefinition, SkillProvider, type SkillProviderProps, Source, type Suggestion, Thread, ThreadData, type TokenUsage, ToolConsentRequest, ToolConsentResponse, ToolContext, ToolDefinition, ToolExecution$1 as ToolExecution, ToolResponse$1 as ToolResponse, ToolSet, ToolType, type ToolsActions, ToolsConfig, type ToolsState, UIMessage, UnifiedToolCall, type UseAIToolsOptions, type UseAIToolsReturn, type UseAgentOptions, type UseAgentReturn, type UseChatConfig, type UseChatReturn, type UseKnowledgeBaseConfig, UseMCPClientConfig, UseMCPClientReturn, UseMCPToolsConfig, UseMCPToolsReturn, UseMCPUIIntentsConfig, UseMCPUIIntentsReturn, type UseMessageHistoryOptions, type UseMessageHistoryReturn, type UseSkillStatusReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadManagerConfig, type UseThreadManagerReturn, type UseToolConfig, type UseToolExecutorReturn, type UseToolWithSchemaConfig, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createServerAdapter, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageHistory, useMessageHistoryContext, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
3436
+ type StreamChunkType = StreamChunk["type"];
3437
+ type ChunkOfType<T extends StreamChunkType | "*"> = T extends "*" ? StreamChunkWithMessageId : Extract<StreamChunk, {
3438
+ type: T;
3439
+ }> & {
3440
+ messageId?: string;
3441
+ };
3442
+ /**
3443
+ * Subscribe to a specific stream event type (or all events with '*').
3444
+ *
3445
+ * The handler is called synchronously during streaming — keep it fast.
3446
+ * Handler identity doesn't need to be stable; the hook re-subscribes
3447
+ * automatically when it changes.
3448
+ *
3449
+ * @param eventType - Stream chunk type to listen for, or '*' for all
3450
+ * @param handler - Callback invoked for each matching chunk
3451
+ */
3452
+ declare function useCopilotEvent<T extends StreamChunkType | "*">(eventType: T, handler: (chunk: ChunkOfType<T>) => void): void;
3453
+
3454
+ interface UseMessageMetaReturn<T extends Record<string, unknown>> {
3455
+ /** Current metadata for this message. Empty object if nothing set yet. */
3456
+ meta: T;
3457
+ /**
3458
+ * Replace metadata entirely.
3459
+ */
3460
+ setMeta: (meta: T) => void;
3461
+ /**
3462
+ * Merge/update metadata using an updater function.
3463
+ * Receives previous meta, return next meta.
3464
+ */
3465
+ updateMeta: (updater: (prev: T) => T) => void;
3466
+ }
3467
+ /**
3468
+ * Read and write custom metadata for a specific message ID.
3469
+ *
3470
+ * @param messageId - The message to attach metadata to.
3471
+ * Pass undefined to get a no-op instance (safe for conditional use).
3472
+ */
3473
+ declare function useMessageMeta<T extends Record<string, unknown> = Record<string, unknown>>(messageId: string | undefined): UseMessageMetaReturn<T>;
3474
+
3475
+ export { type AIContextItem, AbstractAgentLoop, AbstractChat, ActionDefinition, type AgentLoopActions, type AgentLoopCallbacks, type AgentLoopState, AsyncThreadStorageAdapter, BranchInfo, type CapabilitiesResponse, CapturedContext, type ChatActions, type ChatCallbacks, type ChatConfig, type ChatState, type ChatStatus, type ToolExecution as ChatToolExecution, type ToolResponse as ChatToolResponse, type CombinedChatState, type CompactedToolResult, type CompactionEvent, type CompactionMarker, type CompactionStrategy, type ContextStats, ContextUsage, type CopilotContextValue, CopilotProvider, type CopilotProviderProps, type AgentLoopState$1 as CoreAgentLoopState, type ChatState$1 as CoreChatState, type DevLoggerState, type DisplayMessage, IntentDetectionResult, type KnowledgeBaseConfig, type KnowledgeBaseResult, type KnowledgeBaseSearchResponse, LLMConfig, type LLMMessage, Message, type MessageCheckpoint, type MessageHistoryConfig, MessageHistoryContext, type MessageHistoryContextValue, MessageMetaStore, type MessageTokenUsage, PermissionLevel, PermissionStorageAdapter, PermissionStorageConfig, type ProviderCapabilities, ReactChat, type ReactChatConfig, ReactChatState, ReactThreadManager, type ReactThreadManagerConfig, ReactThreadManagerState, ResolvedSkill, type ServerAdapterConfig, type SessionCompactionState, SkillDefinition, SkillProvider, type SkillProviderProps, Source, type StreamChunkWithMessageId, type StreamEventHandler, type Suggestion, Thread, ThreadData, type TokenUsage, ToolConsentRequest, ToolConsentResponse, ToolContext, ToolDefinition, ToolExecution$1 as ToolExecution, ToolResponse$1 as ToolResponse, ToolSet, ToolType, type ToolsActions, ToolsConfig, type ToolsState, UIMessage, UnifiedToolCall, type UseAIToolsOptions, type UseAIToolsReturn, type UseAgentOptions, type UseAgentReturn, type UseChatConfig, type UseChatReturn, type UseKnowledgeBaseConfig, UseMCPClientConfig, UseMCPClientReturn, UseMCPToolsConfig, UseMCPToolsReturn, UseMCPUIIntentsConfig, UseMCPUIIntentsReturn, type UseMessageCheckpointsReturn, type UseMessageHistoryOptions, type UseMessageHistoryReturn, type UseMessageMetaReturn, type UseSkillStatusReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadManagerConfig, type UseThreadManagerReturn, type UseToolConfig, type UseToolExecutorReturn, type UseToolWithSchemaConfig, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createServerAdapter, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useCopilotEvent, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageCheckpoints, useMessageHistory, useMessageHistoryContext, useMessageMeta, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
@@ -1,16 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { U as UIMessage, B as BranchInfo } from '../MessageTree-CSIHErPK.js';
3
- export { M as MessageTree } from '../MessageTree-CSIHErPK.js';
2
+ import { U as UIMessage, B as BranchInfo } from '../MessageTree-Clhiv_k2.js';
3
+ export { M as MessageTree } from '../MessageTree-Clhiv_k2.js';
4
4
  import * as React$1 from 'react';
5
5
  import React__default from 'react';
6
6
  import { L as LLMConfig, l as ToolsConfig, s as ActionDefinition, o as CapturedContext, m as ToolConsentRequest, T as ToolType, n as ToolConsentResponse, S as ScreenshotOptions, C as ConsoleLogOptions, N as NetworkRequestOptions, I as IntentDetectionResult, y as InternalKnowledgeBaseConfig, B as InternalKnowledgeBaseSearchResponse, z as InternalKnowledgeBaseResult, Y as ThreadManagerState, Z as LoadStatus, U as ThreadManagerConfig, F as ThreadManager, V as ThreadManagerCallbacks, W as CreateThreadOptions, X as UpdateThreadOptions } from '../ThreadManager-D7KwT2FJ.js';
7
7
  export { A as ActionParameter, q as CloudConfig, r as CopilotConfig, _ as LocalStorageAdapterConfig, J as createLocalStorageAdapter, O as createMemoryAdapter, i as generateSuggestionReason } from '../ThreadManager-D7KwT2FJ.js';
8
- import { T as ToolDefinition, t as ToolOptimizationConfig, r as ContextUsage, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, y as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolResultConfig, D as AIResponseMode, u as ToolSet, U as UnifiedToolCall, G as PermissionStorageConfig, H as PermissionStorageAdapter } from '../tools-tmksfhUo.js';
9
- export { z as AgentLoopConfig, q as ContextUsagePart, h as ToolConfig, a as ToolExecutionStatus, F as ToolPermission, v as ToolSetEntry, I as tool } from '../tools-tmksfhUo.js';
8
+ import { T as ToolDefinition, t as ToolOptimizationConfig, r as ContextUsage, f as ToolSource, P as PermissionLevel, c as ToolInputSchema, y as ToolExecution$1, e as ToolContext, b as ToolResponse$1, g as ToolRenderProps, i as ToolResultConfig, D as AIResponseMode, u as ToolSet, U as UnifiedToolCall, G as PermissionStorageConfig, H as PermissionStorageAdapter } from '../tools-DcS6Aeao.js';
9
+ export { z as AgentLoopConfig, q as ContextUsagePart, h as ToolConfig, a as ToolExecutionStatus, F as ToolPermission, v as ToolSetEntry, I as tool } from '../tools-DcS6Aeao.js';
10
10
  import { A as AsyncThreadStorageAdapter, M as MessageAttachment, T as ToolCall, d as Message, S as Source, a as Thread, b as ThreadData, c as ThreadStorageAdapter } from '../types-waEqyE4K.js';
11
11
  export { P as PersistenceConfig, j as ThreadStorageAdapter } from '../types-waEqyE4K.js';
12
- import { G as MCPServerConfig, U as UseMCPClientConfig, D as UseMCPClientReturn, E as UseMCPToolsConfig, F as UseMCPToolsReturn } from '../types-BqwW3Baj.js';
13
- export { b as MCPClientState } from '../types-BqwW3Baj.js';
12
+ import { G as MCPServerConfig, U as UseMCPClientConfig, D as UseMCPClientReturn, E as UseMCPToolsConfig, F as UseMCPToolsReturn } from '../types-BUYni9B8.js';
13
+ export { b as MCPClientState } from '../types-BUYni9B8.js';
14
14
  import { S as SkillDefinition, R as ResolvedSkill } from '../types-BckL3hiw.js';
15
15
  export { C as ClientInlineSkill, b as SkillSource, c as SkillStrategy } from '../types-BckL3hiw.js';
16
16
  import { U as UseMCPUIIntentsConfig, m as UseMCPUIIntentsReturn } from '../types-B20VCJXL.js';
@@ -509,6 +509,15 @@ interface ChatCallbacks<T extends UIMessage = UIMessage> {
509
509
  result?: unknown;
510
510
  error?: string;
511
511
  }) => void;
512
+ /**
513
+ * Called for every raw stream chunk as it arrives.
514
+ * Use this to build custom real-time UI on top of the SDK — e.g. thinking
515
+ * step parsers, tool progress trackers, loop iteration counters.
516
+ * The `messageId` field is the ID of the assistant message being streamed.
517
+ */
518
+ onStreamChunk?: (chunk: StreamChunk & {
519
+ messageId?: string;
520
+ }) => void;
512
521
  }
513
522
  /**
514
523
  * Chat initialization options
@@ -763,6 +772,17 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
763
772
  toolCallId: string;
764
773
  result: unknown;
765
774
  }>): Promise<void>;
775
+ /**
776
+ * Add tool result messages to history and stop — does NOT trigger a new LLM request.
777
+ *
778
+ * Use this instead of continueWithToolResults when you want to close out pending
779
+ * tool_use blocks (so the history stays valid) without letting the AI continue.
780
+ * Optionally appends a final assistant message (e.g. an iteration-limit notice).
781
+ */
782
+ addToolResultMessages(toolResults: Array<{
783
+ toolCallId: string;
784
+ result: unknown;
785
+ }>, finalAssistantContent?: string): Promise<void>;
766
786
  /**
767
787
  * Stop generation
768
788
  */
@@ -804,7 +824,9 @@ declare class AbstractChat<T extends UIMessage = UIMessage> {
804
824
  /**
805
825
  * Process a chat request
806
826
  */
807
- protected processRequest(): Promise<void>;
827
+ protected processRequest(options?: {
828
+ preCreatedMessageId?: string;
829
+ }): Promise<void>;
808
830
  /**
809
831
  * Set tools available for the LLM
810
832
  */
@@ -1356,6 +1378,26 @@ interface CopilotProviderProps {
1356
1378
  */
1357
1379
  skills?: SkillDefinition[];
1358
1380
  }
1381
+ type StreamChunkWithMessageId = StreamChunk & {
1382
+ messageId?: string;
1383
+ };
1384
+ type StreamEventHandler = (chunk: StreamChunkWithMessageId) => void;
1385
+ /**
1386
+ * Reactive store for custom per-message metadata.
1387
+ * Powers useMessageMeta() — consumers write any shape they want,
1388
+ * all components reading the same messageId react automatically.
1389
+ */
1390
+ declare class MessageMetaStore {
1391
+ private store;
1392
+ private listeners;
1393
+ private static readonly EMPTY;
1394
+ subscribe: (cb: () => void) => (() => void);
1395
+ getSnapshot: () => Map<string, Record<string, unknown>>;
1396
+ getMeta: (messageId: string) => Record<string, unknown>;
1397
+ setMeta: (messageId: string, meta: Record<string, unknown>) => void;
1398
+ updateMeta: (messageId: string, updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
1399
+ clear: () => void;
1400
+ }
1359
1401
  interface CopilotContextValue {
1360
1402
  messages: UIMessage[];
1361
1403
  status: "ready" | "submitted" | "streaming" | "error";
@@ -1399,6 +1441,7 @@ interface CopilotContextValue {
1399
1441
  content: string;
1400
1442
  strategy?: string;
1401
1443
  }>) => void;
1444
+ agentIteration: number;
1402
1445
  threadId?: string;
1403
1446
  /**
1404
1447
  * Runtime URL configuration.
@@ -1406,6 +1449,24 @@ interface CopilotContextValue {
1406
1449
  */
1407
1450
  runtimeUrl: Resolvable<string>;
1408
1451
  toolsConfig?: ToolsConfig;
1452
+ /**
1453
+ * Subscribe to raw stream chunks as they arrive.
1454
+ * Returns an unsubscribe function. Use useCopilotEvent() for the hook API.
1455
+ *
1456
+ * @example
1457
+ * ```ts
1458
+ * const unsub = subscribeToStreamEvents((chunk) => {
1459
+ * if (chunk.type === 'thinking:delta') { ... }
1460
+ * })
1461
+ * return unsub // cleanup
1462
+ * ```
1463
+ */
1464
+ subscribeToStreamEvents: (handler: StreamEventHandler) => () => void;
1465
+ /**
1466
+ * Reactive per-message metadata store.
1467
+ * Use useMessageMeta(messageId) for the hook API.
1468
+ */
1469
+ messageMeta: MessageMetaStore;
1409
1470
  }
1410
1471
  declare function useCopilot(): CopilotContextValue;
1411
1472
  declare function CopilotProvider({ children, runtimeUrl, systemPrompt, tools: toolsConfig, threadId, initialMessages, onMessagesChange, onError, streaming, headers, body, debug, maxIterations, maxIterationsMessage, mcpServers, optimization, messageHistory, skills, }: CopilotProviderProps): react_jsx_runtime.JSX.Element;
@@ -2892,6 +2953,72 @@ interface UseSkillStatusReturn {
2892
2953
  }
2893
2954
  declare function useSkillStatus(): UseSkillStatusReturn;
2894
2955
 
2956
+ interface MessageCheckpoint {
2957
+ /** Unique checkpoint ID */
2958
+ id: string;
2959
+ /** ID of the user message that triggered this checkpoint */
2960
+ messageId: string;
2961
+ /** When this checkpoint was created */
2962
+ timestamp: number;
2963
+ /** Optional human-readable label */
2964
+ label?: string;
2965
+ /** Full message list BEFORE the user message was processed */
2966
+ messages: UIMessage[];
2967
+ }
2968
+ interface UseMessageCheckpointsReturn {
2969
+ /** All saved checkpoints, oldest first */
2970
+ checkpoints: MessageCheckpoint[];
2971
+ /** True if a checkpoint exists for the given user message ID */
2972
+ hasCheckpoint: (messageId: string) => boolean;
2973
+ /** Get the checkpoint for a user message ID, or undefined */
2974
+ getCheckpoint: (messageId: string) => MessageCheckpoint | undefined;
2975
+ /**
2976
+ * Restore chat to the state before the user message with the given ID.
2977
+ * Returns the checkpoint if found, undefined otherwise.
2978
+ * Checkpoints created after this one are pruned.
2979
+ */
2980
+ restore: (messageId: string) => MessageCheckpoint | undefined;
2981
+ /**
2982
+ * Manually save a checkpoint for a message ID.
2983
+ * Auto-save already runs on every new user message — use this for
2984
+ * programmatic checkpoints (e.g. before a destructive tool call).
2985
+ */
2986
+ save: (messageId: string, label?: string) => MessageCheckpoint | undefined;
2987
+ /** Clear all saved checkpoints */
2988
+ clear: () => void;
2989
+ }
2990
+ /**
2991
+ * useMessageCheckpoints
2992
+ *
2993
+ * Automatically saves a checkpoint before each user message is sent to the
2994
+ * agent. Each checkpoint captures the full chat state that existed BEFORE
2995
+ * that user message, so restoring it rolls the conversation back to exactly
2996
+ * that point.
2997
+ *
2998
+ * Generic — works for any agentic app (flow builders, code editors, document
2999
+ * assistants, etc.). App-specific side effects (e.g. restoring a canvas or
3000
+ * database state) can be layered on top via the returned `restore` value.
3001
+ *
3002
+ * @example
3003
+ * ```tsx
3004
+ * // Inside <CopilotChat> children
3005
+ * function MyCheckpointActions() {
3006
+ * const { hasCheckpoint, restore } = useMessageCheckpoints();
3007
+ * return (
3008
+ * <CopilotChat.MessageActions role="user">
3009
+ * <CopilotChat.Action
3010
+ * icon={<RotateCcw className="size-3.5" />}
3011
+ * tooltip="Restore to before this message"
3012
+ * onClick={({ message }) => restore(message.id)}
3013
+ * hidden={({ message }) => !hasCheckpoint(message.id)}
3014
+ * />
3015
+ * </CopilotChat.MessageActions>
3016
+ * );
3017
+ * }
3018
+ * ```
3019
+ */
3020
+ declare function useMessageCheckpoints(): UseMessageCheckpointsReturn;
3021
+
2895
3022
  /**
2896
3023
  * Create a permission storage adapter based on config
2897
3024
  */
@@ -3306,4 +3433,43 @@ declare function toLLMMessages(messages: DisplayMessage[]): LLMMessage[];
3306
3433
  declare function keepToolPairsAtomic(messages: DisplayMessage[]): DisplayMessage[];
3307
3434
  declare function isCompactionMarker(msg: DisplayMessage): msg is CompactionMarker;
3308
3435
 
3309
- export { type AIContextItem, AbstractAgentLoop, AbstractChat, ActionDefinition, type AgentLoopActions, type AgentLoopCallbacks, type AgentLoopState, AsyncThreadStorageAdapter, BranchInfo, type CapabilitiesResponse, CapturedContext, type ChatActions, type ChatCallbacks, type ChatConfig, type ChatState, type ChatStatus, type ToolExecution as ChatToolExecution, type ToolResponse as ChatToolResponse, type CombinedChatState, type CompactedToolResult, type CompactionEvent, type CompactionMarker, type CompactionStrategy, type ContextStats, ContextUsage, type CopilotContextValue, CopilotProvider, type CopilotProviderProps, type AgentLoopState$1 as CoreAgentLoopState, type ChatState$1 as CoreChatState, type DevLoggerState, type DisplayMessage, IntentDetectionResult, type KnowledgeBaseConfig, type KnowledgeBaseResult, type KnowledgeBaseSearchResponse, LLMConfig, type LLMMessage, Message, type MessageHistoryConfig, MessageHistoryContext, type MessageHistoryContextValue, type MessageTokenUsage, PermissionLevel, PermissionStorageAdapter, PermissionStorageConfig, type ProviderCapabilities, ReactChat, type ReactChatConfig, ReactChatState, ReactThreadManager, type ReactThreadManagerConfig, ReactThreadManagerState, ResolvedSkill, type ServerAdapterConfig, type SessionCompactionState, SkillDefinition, SkillProvider, type SkillProviderProps, Source, type Suggestion, Thread, ThreadData, type TokenUsage, ToolConsentRequest, ToolConsentResponse, ToolContext, ToolDefinition, ToolExecution$1 as ToolExecution, ToolResponse$1 as ToolResponse, ToolSet, ToolType, type ToolsActions, ToolsConfig, type ToolsState, UIMessage, UnifiedToolCall, type UseAIToolsOptions, type UseAIToolsReturn, type UseAgentOptions, type UseAgentReturn, type UseChatConfig, type UseChatReturn, type UseKnowledgeBaseConfig, UseMCPClientConfig, UseMCPClientReturn, UseMCPToolsConfig, UseMCPToolsReturn, UseMCPUIIntentsConfig, UseMCPUIIntentsReturn, type UseMessageHistoryOptions, type UseMessageHistoryReturn, type UseSkillStatusReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadManagerConfig, type UseThreadManagerReturn, type UseToolConfig, type UseToolExecutorReturn, type UseToolWithSchemaConfig, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createServerAdapter, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageHistory, useMessageHistoryContext, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
3436
+ type StreamChunkType = StreamChunk["type"];
3437
+ type ChunkOfType<T extends StreamChunkType | "*"> = T extends "*" ? StreamChunkWithMessageId : Extract<StreamChunk, {
3438
+ type: T;
3439
+ }> & {
3440
+ messageId?: string;
3441
+ };
3442
+ /**
3443
+ * Subscribe to a specific stream event type (or all events with '*').
3444
+ *
3445
+ * The handler is called synchronously during streaming — keep it fast.
3446
+ * Handler identity doesn't need to be stable; the hook re-subscribes
3447
+ * automatically when it changes.
3448
+ *
3449
+ * @param eventType - Stream chunk type to listen for, or '*' for all
3450
+ * @param handler - Callback invoked for each matching chunk
3451
+ */
3452
+ declare function useCopilotEvent<T extends StreamChunkType | "*">(eventType: T, handler: (chunk: ChunkOfType<T>) => void): void;
3453
+
3454
+ interface UseMessageMetaReturn<T extends Record<string, unknown>> {
3455
+ /** Current metadata for this message. Empty object if nothing set yet. */
3456
+ meta: T;
3457
+ /**
3458
+ * Replace metadata entirely.
3459
+ */
3460
+ setMeta: (meta: T) => void;
3461
+ /**
3462
+ * Merge/update metadata using an updater function.
3463
+ * Receives previous meta, return next meta.
3464
+ */
3465
+ updateMeta: (updater: (prev: T) => T) => void;
3466
+ }
3467
+ /**
3468
+ * Read and write custom metadata for a specific message ID.
3469
+ *
3470
+ * @param messageId - The message to attach metadata to.
3471
+ * Pass undefined to get a no-op instance (safe for conditional use).
3472
+ */
3473
+ declare function useMessageMeta<T extends Record<string, unknown> = Record<string, unknown>>(messageId: string | undefined): UseMessageMetaReturn<T>;
3474
+
3475
+ export { type AIContextItem, AbstractAgentLoop, AbstractChat, ActionDefinition, type AgentLoopActions, type AgentLoopCallbacks, type AgentLoopState, AsyncThreadStorageAdapter, BranchInfo, type CapabilitiesResponse, CapturedContext, type ChatActions, type ChatCallbacks, type ChatConfig, type ChatState, type ChatStatus, type ToolExecution as ChatToolExecution, type ToolResponse as ChatToolResponse, type CombinedChatState, type CompactedToolResult, type CompactionEvent, type CompactionMarker, type CompactionStrategy, type ContextStats, ContextUsage, type CopilotContextValue, CopilotProvider, type CopilotProviderProps, type AgentLoopState$1 as CoreAgentLoopState, type ChatState$1 as CoreChatState, type DevLoggerState, type DisplayMessage, IntentDetectionResult, type KnowledgeBaseConfig, type KnowledgeBaseResult, type KnowledgeBaseSearchResponse, LLMConfig, type LLMMessage, Message, type MessageCheckpoint, type MessageHistoryConfig, MessageHistoryContext, type MessageHistoryContextValue, MessageMetaStore, type MessageTokenUsage, PermissionLevel, PermissionStorageAdapter, PermissionStorageConfig, type ProviderCapabilities, ReactChat, type ReactChatConfig, ReactChatState, ReactThreadManager, type ReactThreadManagerConfig, ReactThreadManagerState, ResolvedSkill, type ServerAdapterConfig, type SessionCompactionState, SkillDefinition, SkillProvider, type SkillProviderProps, Source, type StreamChunkWithMessageId, type StreamEventHandler, type Suggestion, Thread, ThreadData, type TokenUsage, ToolConsentRequest, ToolConsentResponse, ToolContext, ToolDefinition, ToolExecution$1 as ToolExecution, ToolResponse$1 as ToolResponse, ToolSet, ToolType, type ToolsActions, ToolsConfig, type ToolsState, UIMessage, UnifiedToolCall, type UseAIToolsOptions, type UseAIToolsReturn, type UseAgentOptions, type UseAgentReturn, type UseChatConfig, type UseChatReturn, type UseKnowledgeBaseConfig, UseMCPClientConfig, UseMCPClientReturn, UseMCPToolsConfig, UseMCPToolsReturn, UseMCPUIIntentsConfig, UseMCPUIIntentsReturn, type UseMessageCheckpointsReturn, type UseMessageHistoryOptions, type UseMessageHistoryReturn, type UseMessageMetaReturn, type UseSkillStatusReturn, type UseSuggestionsOptions, type UseSuggestionsReturn, type UseThreadManagerConfig, type UseThreadManagerReturn, type UseToolConfig, type UseToolExecutorReturn, type UseToolWithSchemaConfig, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createServerAdapter, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useCopilotEvent, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageCheckpoints, useMessageHistory, useMessageHistoryContext, useMessageMeta, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema };
@@ -1,10 +1,12 @@
1
- export { AbstractAgentLoop, AbstractChat, CopilotProvider, MessageHistoryContext, MessageTree, ReactChat, ReactChatState, ReactThreadManager, ReactThreadManagerState, SkillProvider, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactChatState, createReactThreadManager, createReactThreadManagerState, createSessionPermissionCache, createToolIntentHandler, defaultMessageHistoryConfig, defineSkill, formatKnowledgeResultsForAI, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, searchKnowledgeBase, toDisplayMessage, toLLMMessage, toLLMMessages, useAIAction, useAIActions, useAIContext, useAIContexts, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilot, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPClient, useMCPTools, useMCPUIIntents, useMessageHistory, useMessageHistoryContext, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useTool, useToolExecutor, useToolWithSchema, useTools, useToolsWithSchema } from '../chunk-FLZO2FO3.js';
2
- export { createLocalStorageAdapter, createMemoryAdapter, createServerAdapter, generateSuggestionReason } from '../chunk-EEH3L64W.js';
1
+ export { ReactChat, ReactThreadManager, ReactThreadManagerState, createMessageIntentHandler, createPermissionStorage, createReactChat, createReactThreadManager, createReactThreadManagerState, createSessionPermissionCache, createToolIntentHandler, defineSkill, formatKnowledgeResultsForAI, searchKnowledgeBase, useAIAction, useAIActions, useAITools, useAgent, useCapabilities, useChat, useContextStats, useCopilotEvent, useDevLogger, useFeatureSupport, useKnowledgeBase, useMCPUIIntents, useMessageCheckpoints, useMessageMeta, useSkill, useSkillStatus, useSuggestions, useSupportedMediaTypes, useThreadManager, useToolExecutor, useToolWithSchema, useToolsWithSchema } from '../chunk-ZAOTYA5L.js';
2
+ export { AbstractAgentLoop, AbstractChat, CopilotProvider, MessageHistoryContext, MessageTree, ReactChatState, SkillProvider, createReactChatState, defaultMessageHistoryConfig, initialAgentLoopState, isCompactionMarker, keepToolPairsAtomic, toDisplayMessage, toLLMMessage, toLLMMessages, useAIContext, useAIContexts, useCopilot, useMCPClient, useMCPTools, useMessageHistory, useMessageHistoryContext, useTool, useTools } from '../chunk-DH6EO6NW.js';
3
+ export { createLocalStorageAdapter, createMemoryAdapter, createServerAdapter, generateSuggestionReason } from '../chunk-YLZCTR4O.js';
3
4
  import '../chunk-EWVQWTNV.js';
4
5
  import '../chunk-VNLLW3ZI.js';
5
- import '../chunk-RKGRQRZU.js';
6
- export { tool } from '../chunk-3AONOZLY.js';
7
- import '../chunk-LLM7AHMO.js';
6
+ import '../chunk-533K2Z7C.js';
7
+ export { tool } from '../chunk-AIVXGTWS.js';
8
+ import '../chunk-DDZLRCVX.js';
9
+ import '../chunk-53UGJNHN.js';
8
10
  import '../chunk-RQ74USYU.js';
9
11
  import '../chunk-7W7QLZNC.js';
10
12
  import '../chunk-CEOMTQTP.js';
@@ -12,7 +14,6 @@ import '../chunk-PPFHA6IL.js';
12
14
  import '../chunk-DABZYCVX.js';
13
15
  import '../chunk-MNDGIW47.js';
14
16
  import '../chunk-VD74IPKB.js';
15
- import '../chunk-53UGJNHN.js';
16
17
  import '../chunk-DGUM43GV.js';
17
18
  //# sourceMappingURL=index.js.map
18
19
  //# sourceMappingURL=index.js.map
package/dist/styles.css CHANGED
@@ -60,6 +60,51 @@
60
60
  }
61
61
  }
62
62
 
63
+ /* Links inside user message bubble — override link color for visibility on primary background */
64
+ .csdk-message-user {
65
+ --csdk-link-color: hsl(var(--primary-foreground) / 0.9);
66
+ }
67
+
68
+ /* Message entrance animation — fires on React DOM mount via @starting-style.
69
+ csdk-message: applied to every message row (user + assistant + tool).
70
+ Consumers can override via .csdk-user-message / .csdk-assistant-message selectors. */
71
+
72
+ .csdk-message {
73
+ opacity: 1;
74
+ transform: translateY(0) scale(1);
75
+ transition: opacity 0.22s cubic-bezier(0, 0, 0.2, 1),
76
+ transform 0.22s cubic-bezier(0, 0, 0.2, 1);
77
+ }
78
+
79
+ @starting-style {
80
+ .csdk-message {
81
+ opacity: 0;
82
+ transform: translateY(8px) scale(0.97);
83
+ }
84
+ }
85
+
86
+ /* Avatar pop-in — independent scale spring, fires alongside the message row entry.
87
+ Scoped to assistant messages so user-side layout stays clean.
88
+ The parent .csdk-message handles fade + translateY; this adds a separate scale
89
+ with a slight spring overshoot so the avatar feels "alive" on arrival. */
90
+ .csdk-assistant-message .csdk-avatar {
91
+ transform-origin: center;
92
+ transform: scale(1);
93
+ transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
94
+ }
95
+
96
+ @starting-style {
97
+ .csdk-assistant-message .csdk-avatar {
98
+ transform: scale(0.35);
99
+ }
100
+ }
101
+
102
+ @media (prefers-reduced-motion: reduce) {
103
+ .csdk-assistant-message .csdk-avatar {
104
+ transition: none;
105
+ }
106
+ }
107
+
63
108
  /* Confirmation Card Animations */
64
109
  /* Uses @starting-style for reliable first-paint entry in React (more robust than @keyframes) */
65
110
 
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkNUXLAZOE_cjs = require('../../chunk-NUXLAZOE.cjs');
3
+ var chunk3ZDRX7J2_cjs = require('../../chunk-3ZDRX7J2.cjs');
4
+ require('../../chunk-XWOHNY3F.cjs');
4
5
  var chunkTXLIY7GF_cjs = require('../../chunk-TXLIY7GF.cjs');
5
6
  require('../../chunk-CBAHCI4R.cjs');
6
7
  require('../../chunk-MEBXW75C.cjs');
@@ -8,7 +9,6 @@ require('../../chunk-W73FBYIH.cjs');
8
9
  require('../../chunk-2FAWEBZS.cjs');
9
10
  require('../../chunk-6T5XXJEP.cjs');
10
11
  require('../../chunk-GANCV72Z.cjs');
11
- require('../../chunk-XWOHNY3F.cjs');
12
12
  require('../../chunk-JEQ2X3Z6.cjs');
13
13
 
14
14
  // src/tools/anthropic/index.ts
@@ -46,7 +46,7 @@ function anthropicSearch(config = {}) {
46
46
  return {
47
47
  success: true,
48
48
  data: response,
49
- _aiContext: chunkNUXLAZOE_cjs.formatSearchResultsForAI(response)
49
+ _aiContext: chunk3ZDRX7J2_cjs.formatSearchResultsForAI(response)
50
50
  };
51
51
  }
52
52
  };
@@ -1,4 +1,4 @@
1
- import { T as ToolDefinition } from '../../tools-tmksfhUo.cjs';
1
+ import { T as ToolDefinition } from '../../tools-DcS6Aeao.cjs';
2
2
  export { a as anthropicProvider } from '../../anthropic-DGalr_Fw.cjs';
3
3
  import '../../types-ZguuKEs_.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { T as ToolDefinition } from '../../tools-tmksfhUo.js';
1
+ import { T as ToolDefinition } from '../../tools-DcS6Aeao.js';
2
2
  export { a as anthropicProvider } from '../../anthropic-DkCEDYOt.js';
3
3
  import '../../types-ZguuKEs_.js';
4
4
 
@@ -1,4 +1,5 @@
1
- import { formatSearchResultsForAI } from '../../chunk-LLM7AHMO.js';
1
+ import { formatSearchResultsForAI } from '../../chunk-DDZLRCVX.js';
2
+ import '../../chunk-53UGJNHN.js';
2
3
  import { searchAnthropic } from '../../chunk-RQ74USYU.js';
3
4
  export { anthropicProvider } from '../../chunk-RQ74USYU.js';
4
5
  import '../../chunk-7W7QLZNC.js';
@@ -7,7 +8,6 @@ import '../../chunk-PPFHA6IL.js';
7
8
  import '../../chunk-DABZYCVX.js';
8
9
  import '../../chunk-MNDGIW47.js';
9
10
  import '../../chunk-VD74IPKB.js';
10
- import '../../chunk-53UGJNHN.js';
11
11
  import '../../chunk-DGUM43GV.js';
12
12
 
13
13
  // src/tools/anthropic/index.ts