@copilotkit/vue 2.0.0-rc.0 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/PARITY.md +13 -12
  2. package/README.md +1 -2
  3. package/dist/components/copilot-provider/CopilotKit.vue.d.ts +3 -1
  4. package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -1
  5. package/dist/index.cjs +43 -46
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.mjs +10170 -7506
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/v2/components/A2UIMessageRenderer.d.ts +7 -0
  10. package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
  11. package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
  12. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
  13. package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
  14. package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +136 -0
  15. package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
  16. package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +1 -1
  17. package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -0
  18. package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
  19. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +3 -1
  20. package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
  21. package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts +16 -0
  22. package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts.map +1 -0
  23. package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
  24. package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
  25. package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
  26. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +22 -0
  27. package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -0
  28. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +69 -16
  29. package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
  30. package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts +12 -0
  31. package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -0
  32. package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts +22 -0
  33. package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -0
  34. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +20 -0
  35. package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
  36. package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
  37. package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -1
  38. package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -1
  39. package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -1
  40. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +32 -0
  41. package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -0
  42. package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
  43. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +11 -1
  44. package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
  45. package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
  46. package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -0
  47. package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
  48. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts +5 -0
  49. package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -0
  50. package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
  51. package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
  52. package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -1
  53. package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -0
  54. package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
  55. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -0
  56. package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
  57. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -0
  58. package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
  59. package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -1
  60. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +2 -0
  61. package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
  62. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +2 -0
  63. package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
  64. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +2 -0
  65. package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
  66. package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -1
  67. package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
  68. package/dist/v2/components/chat/index.d.ts +17 -0
  69. package/dist/v2/components/chat/index.d.ts.map +1 -1
  70. package/dist/v2/components/chat/inspector-shortcuts.d.ts +12 -0
  71. package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -0
  72. package/dist/v2/components/chat/message-feedback.d.ts +89 -0
  73. package/dist/v2/components/chat/message-feedback.d.ts.map +1 -0
  74. package/dist/v2/components/chat/tool-call-capture.d.ts +39 -0
  75. package/dist/v2/components/chat/tool-call-capture.d.ts.map +1 -0
  76. package/dist/v2/components/chat/tool-call-display-context.d.ts +39 -0
  77. package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -0
  78. package/dist/v2/components/chat/tool-call-group-parts.d.ts +144 -0
  79. package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
  80. package/dist/v2/components/chat/tool-call-layout.d.ts +115 -0
  81. package/dist/v2/components/chat/tool-call-layout.d.ts.map +1 -0
  82. package/dist/v2/components/chat/turn-work.d.ts +35 -0
  83. package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
  84. package/dist/v2/components/chat/types.d.ts +104 -4
  85. package/dist/v2/components/chat/types.d.ts.map +1 -1
  86. package/dist/v2/components/chat/use-lightbox.d.ts +18 -0
  87. package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -0
  88. package/dist/v2/components/icons/index.d.ts +1 -1
  89. package/dist/v2/components/icons/index.d.ts.map +1 -1
  90. package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +55 -0
  91. package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -0
  92. package/dist/v2/components/ui/CopilotPopover.vue.d.ts +40 -0
  93. package/dist/v2/components/ui/CopilotPopover.vue.d.ts.map +1 -0
  94. package/dist/v2/components/ui/CopilotTooltip.vue.d.ts +37 -0
  95. package/dist/v2/components/ui/CopilotTooltip.vue.d.ts.map +1 -0
  96. package/dist/v2/components/ui/dropdown-menu.d.ts +14 -0
  97. package/dist/v2/components/ui/dropdown-menu.d.ts.map +1 -0
  98. package/dist/v2/components/ui/floating.d.ts +84 -0
  99. package/dist/v2/components/ui/floating.d.ts.map +1 -0
  100. package/dist/v2/components/ui/presence.d.ts +9 -0
  101. package/dist/v2/components/ui/presence.d.ts.map +1 -0
  102. package/dist/v2/components/ui/use-id.d.ts +9 -0
  103. package/dist/v2/components/ui/use-id.d.ts.map +1 -0
  104. package/dist/v2/hooks/use-default-render-tool.d.ts +6 -0
  105. package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
  106. package/dist/v2/hooks/use-render-tool.d.ts +4 -0
  107. package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
  108. package/dist/v2/index.cjs +1 -1
  109. package/dist/v2/index.d.cts +3 -0
  110. package/dist/v2/index.d.mts +3 -0
  111. package/dist/v2/index.d.ts +3 -0
  112. package/dist/v2/index.d.ts.map +1 -1
  113. package/dist/v2/index.mjs +165 -162
  114. package/dist/v2/lib/message-feedback.d.ts +33 -0
  115. package/dist/v2/lib/message-feedback.d.ts.map +1 -0
  116. package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
  117. package/dist/v2/providers/CopilotKitProvider.types.d.ts +56 -1
  118. package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
  119. package/dist/v2/providers/CopilotKitProvider.vue.d.ts +5 -1
  120. package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
  121. package/dist/v2/providers/index.d.ts +1 -1
  122. package/dist/v2/providers/index.d.ts.map +1 -1
  123. package/dist/v2/providers/keys.d.ts +8 -0
  124. package/dist/v2/providers/keys.d.ts.map +1 -1
  125. package/dist/v2/providers/types.d.ts +9 -0
  126. package/dist/v2/providers/types.d.ts.map +1 -1
  127. package/dist/v2/styles/CopilotKitStyles.d.ts +18 -0
  128. package/dist/v2/styles/CopilotKitStyles.d.ts.map +1 -0
  129. package/dist/v2/types/defineToolCallRenderer.d.ts +2 -0
  130. package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
  131. package/dist/v2/types/vue-tool-call-renderer.d.ts +7 -0
  132. package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
  133. package/package.json +11 -23
  134. package/src/components/copilot-provider/CopilotKit.vue +4 -1
  135. package/src/v2/__tests__/exports.test.ts +4 -2
  136. package/src/v2/components/A2UIMessageRenderer.ts +55 -67
  137. package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
  138. package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
  139. package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
  140. package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +14 -257
  141. package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
  142. package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
  143. package/src/v2/components/chat/BasicMarkdown.vue +8 -6
  144. package/src/v2/components/chat/CopilotChat.vue +7 -0
  145. package/src/v2/components/chat/CopilotChatAssistantMessage.vue +267 -67
  146. package/src/v2/components/chat/CopilotChatAssistantToolbarButton.vue +46 -0
  147. package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +141 -168
  148. package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +67 -18
  149. package/src/v2/components/chat/CopilotChatAudioRecorder.vue +2 -2
  150. package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +240 -0
  151. package/src/v2/components/chat/CopilotChatInput.vue +210 -161
  152. package/src/v2/components/chat/CopilotChatInspectorButton.vue +331 -0
  153. package/src/v2/components/chat/CopilotChatLightbox.vue +105 -0
  154. package/src/v2/components/chat/CopilotChatMessageView.vue +261 -18
  155. package/src/v2/components/chat/CopilotChatReasoningMessage.vue +21 -22
  156. package/src/v2/components/chat/CopilotChatSuggestionPill.vue +5 -14
  157. package/src/v2/components/chat/CopilotChatSuggestionView.vue +1 -4
  158. package/src/v2/components/chat/CopilotChatToggleButton.vue +3 -9
  159. package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +1 -1
  160. package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +1 -1
  161. package/src/v2/components/chat/CopilotChatToolCallGroup.vue +330 -0
  162. package/src/v2/components/chat/CopilotChatToolCallItem.vue +21 -11
  163. package/src/v2/components/chat/CopilotChatToolCallsView.vue +192 -21
  164. package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
  165. package/src/v2/components/chat/CopilotChatView.vue +33 -38
  166. package/src/v2/components/chat/CopilotChatWorkSummary.vue +85 -0
  167. package/src/v2/components/chat/CopilotModalHeader.vue +10 -8
  168. package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +7 -6
  169. package/src/v2/components/chat/CopilotModalHeaderTitle.ts +1 -4
  170. package/src/v2/components/chat/CopilotPopup.vue +3 -0
  171. package/src/v2/components/chat/CopilotPopupView.vue +1 -0
  172. package/src/v2/components/chat/CopilotPopupViewInternal.vue +9 -19
  173. package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +5 -8
  174. package/src/v2/components/chat/CopilotSidebar.vue +5 -0
  175. package/src/v2/components/chat/CopilotSidebarView.vue +2 -0
  176. package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -17
  177. package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +7 -10
  178. package/src/v2/components/chat/StreamingMarkdownDefault.vue +3 -5
  179. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.inspector.test.ts +269 -0
  180. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +760 -0
  181. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +3 -5
  182. package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +2 -2
  183. package/src/v2/components/chat/__tests__/CopilotChatInput.addMenu.test.ts +328 -0
  184. package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +6 -3
  185. package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +22 -13
  186. package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
  187. package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +735 -0
  188. package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +1 -1
  189. package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +3 -1
  190. package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.learning.test.ts +75 -0
  191. package/src/v2/components/chat/__tests__/CopilotChatUserMessage.attachments.test.ts +143 -0
  192. package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +5 -4
  193. package/src/v2/components/chat/__tests__/CopilotChatView.rootWidth.test.ts +7 -33
  194. package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +1 -1
  195. package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +3 -3
  196. package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +126 -0
  197. package/src/v2/components/chat/__tests__/messageFeedbackDefaults.test.ts +33 -0
  198. package/src/v2/components/chat/__tests__/modalChatDisplayProps.test.ts +44 -0
  199. package/src/v2/components/chat/index.ts +2 -0
  200. package/src/v2/components/chat/inspector-shortcuts.ts +34 -0
  201. package/src/v2/components/chat/message-feedback.ts +291 -0
  202. package/src/v2/components/chat/tool-call-capture.ts +55 -0
  203. package/src/v2/components/chat/tool-call-display-context.ts +49 -0
  204. package/src/v2/components/chat/tool-call-group-parts.ts +292 -0
  205. package/src/v2/components/chat/tool-call-layout.ts +304 -0
  206. package/src/v2/components/chat/turn-work.ts +61 -0
  207. package/src/v2/components/chat/types.ts +113 -3
  208. package/src/v2/components/chat/use-lightbox.ts +64 -0
  209. package/src/v2/components/icons/index.ts +4 -0
  210. package/src/v2/components/ui/CopilotDropdownMenuContent.vue +465 -0
  211. package/src/v2/components/ui/CopilotPopover.vue +138 -0
  212. package/src/v2/components/ui/CopilotTooltip.vue +237 -0
  213. package/src/v2/components/ui/__tests__/CopilotTooltip.test.ts +168 -0
  214. package/src/v2/components/ui/dropdown-menu.ts +15 -0
  215. package/src/v2/components/ui/floating.ts +321 -0
  216. package/src/v2/components/ui/presence.ts +54 -0
  217. package/src/v2/components/ui/use-id.ts +16 -0
  218. package/src/v2/hooks/use-default-render-tool.ts +123 -62
  219. package/src/v2/hooks/use-render-tool.ts +8 -0
  220. package/src/v2/index.ts +3 -0
  221. package/src/v2/lib/__tests__/message-feedback.test.ts +152 -0
  222. package/src/v2/lib/message-feedback.ts +120 -0
  223. package/src/v2/providers/CopilotChatConfigurationProvider.vue +29 -2
  224. package/src/v2/providers/CopilotKitProvider.types.ts +57 -0
  225. package/src/v2/providers/CopilotKitProvider.vue +125 -3
  226. package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
  227. package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +534 -0
  228. package/src/v2/providers/index.ts +4 -1
  229. package/src/v2/providers/keys.ts +12 -0
  230. package/src/v2/providers/types.ts +11 -0
  231. package/src/v2/styles/CopilotKitStyles.ts +95 -0
  232. package/src/v2/styles/__tests__/CopilotKitStyles.client.test.ts +149 -0
  233. package/src/v2/styles/__tests__/CopilotKitStyles.ssr.test.ts +71 -0
  234. package/src/v2/types/defineToolCallRenderer.ts +4 -0
  235. package/src/v2/types/vue-tool-call-renderer.ts +7 -0
  236. package/vite.config.ts +2 -1
  237. package/dist/styles.css +0 -2
  238. package/scripts/scope-preflight.mjs +0 -100
  239. package/src/styles/globals.css +0 -233
@@ -0,0 +1,89 @@
1
+ import type { AssistantMessage } from "@ag-ui/core";
2
+ import type { CopilotKitCore } from "@copilotkit/core";
3
+ import type { ComputedRef, InjectionKey, Ref } from "vue";
4
+ import type { MessageFeedback, MessageFeedbackRating } from "../../lib/message-feedback";
5
+ /** The chat whose assistant messages collect feedback for Learning. */
6
+ export interface MessageFeedbackScope {
7
+ readonly copilotkit: CopilotKitCore;
8
+ readonly agentId: string;
9
+ readonly threadId: string;
10
+ }
11
+ /**
12
+ * Provided by the message view while Learning is on for this chat. Assistant
13
+ * messages without it show thumbs only when the app passes its own handlers
14
+ * or thumb slots.
15
+ * @internal
16
+ */
17
+ export declare const MessageFeedbackScopeKey: InjectionKey<Ref<MessageFeedbackScope | null>>;
18
+ /**
19
+ * Whether the thumbs record feedback for Learning. True once a Trajectory of
20
+ * this Core has started and as long as Learning stays configured, also while
21
+ * capture reconnects or is stopped, so the buttons do not flicker. Ratings
22
+ * given meanwhile still show but, like any Trajectory event, are not sent.
23
+ * @internal
24
+ */
25
+ export declare function useLearningFeedbackEnabled(copilotkit: Ref<CopilotKitCore>): ComputedRef<boolean>;
26
+ /** Current feedback for one assistant message, and how to change it. */
27
+ export interface MessageFeedbackControls {
28
+ readonly feedback: MessageFeedback | undefined;
29
+ /** Gives `rating`; a different rating than before starts without a comment. */
30
+ readonly rate: (rating: MessageFeedbackRating) => void;
31
+ /** Removes the rating and its comment. */
32
+ readonly clear: () => void;
33
+ /** Sets the current rating's comment; an empty one removes it. */
34
+ readonly comment: (comment: string) => void;
35
+ }
36
+ /** Feedback controls for `message`, or `null` when this chat collects none. */
37
+ export declare function useMessageFeedback(message: Ref<AssistantMessage>): ComputedRef<MessageFeedbackControls | null>;
38
+ /**
39
+ * How long the pointer may be away from the rating and its comment before the
40
+ * comment closes: enough to cross the gap between them, short enough that
41
+ * passing over a rating does not leave it open.
42
+ */
43
+ export declare const FEEDBACK_COMMENT_CLOSE_DELAY_MS = 150;
44
+ /** The comment popover of one rated message: when it shows and what it holds. */
45
+ export interface FeedbackComment {
46
+ readonly open: Ref<boolean>;
47
+ /** The comment being edited. */
48
+ readonly draft: Ref<string>;
49
+ /** Grows each time the field should take focus: after a keyboard rating. */
50
+ readonly focusRequest: Ref<number>;
51
+ /** Whether a focus request waits; reading it answers the request. */
52
+ readonly takeFocusRequest: () => boolean;
53
+ /** The comment field, for moving focus into it. */
54
+ readonly input: Ref<HTMLInputElement | null>;
55
+ /** Opens with `comment` in the field. */
56
+ readonly show: (options: {
57
+ comment: string;
58
+ focus: boolean;
59
+ }) => void;
60
+ /** The pointer or focus reached the rating or the popover. */
61
+ readonly enter: (via?: "pointer" | "focus") => void;
62
+ /**
63
+ * It left them: close soon, unless the user is editing the comment or, when
64
+ * focus left, the pointer is still on the rating or the popover.
65
+ */
66
+ readonly leave: (via?: "pointer" | "focus") => void;
67
+ /** Tracks whether focus is in the comment form. */
68
+ readonly setEditing: (editing: boolean) => void;
69
+ /** Closes, saving a changed comment unless `save` is false. */
70
+ readonly close: (options?: {
71
+ save?: boolean;
72
+ }) => void;
73
+ /** Moves focus back to the thumb without opening the comment again. */
74
+ readonly returnFocus: (target: HTMLElement | null) => void;
75
+ }
76
+ /**
77
+ * Drives the comment popover of a rated message, as React's
78
+ * `useFeedbackComment` does.
79
+ *
80
+ * It opens when a rating is given and whenever the pointer or keyboard focus
81
+ * reaches the chosen thumb, with the saved comment in the field. It closes by
82
+ * itself shortly after the pointer leaves the thumb and the popover, unless
83
+ * focus is in the field: then it stays until focus moves away, Enter, or
84
+ * Escape. Closing saves a changed comment; Escape, a click on a thumb, and
85
+ * removing the rating discard it.
86
+ * @internal
87
+ */
88
+ export declare function useFeedbackComment(controls: Ref<MessageFeedbackControls | null>): FeedbackComment;
89
+ //# sourceMappingURL=message-feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-feedback.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/message-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAM1D,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAChD,GAAG,CAAC,oBAAoB,GAAG,IAAI,CAAC,CACO,CAAC;AAgB1C;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAC9B,WAAW,CAAC,OAAO,CAAC,CA4BtB;AAED,wEAAwE;AACxE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IAC/C,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvD,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,GAAG,CAAC,gBAAgB,CAAC,GAC7B,WAAW,CAAC,uBAAuB,GAAG,IAAI,CAAC,CA2C7C;AAED;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,qEAAqE;IACrE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,OAAO,CAAC;IACzC,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC7C,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACtE,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,KAAK,IAAI,CAAC;IACpD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,KAAK,IAAI,CAAC;IACpD,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACvD,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,GAAG,CAAC,uBAAuB,GAAG,IAAI,CAAC,GAC5C,eAAe,CAkGjB"}
@@ -0,0 +1,39 @@
1
+ import type { PropType, Ref } from "vue";
2
+ import type { CopilotKitCore } from "@copilotkit/core";
3
+ /**
4
+ * Whether interaction capture is configured on the core. Driven by the
5
+ * learning config, not by the Trajectory, so a wrapper keyed on it does not
6
+ * remount the tool UI on every reconnect.
7
+ * @internal
8
+ */
9
+ export declare function useLearningConfigured(copilotkit: Ref<CopilotKitCore>): Readonly<Ref<boolean>>;
10
+ /**
11
+ * Wraps a tool call's UI in `data-tool-call-id` while learning is configured,
12
+ * so interaction capture can attribute clicks to the tool call. The wrapper
13
+ * uses `display: contents`, so it does not change the layout.
14
+ * @internal
15
+ */
16
+ export declare const ToolCallCaptureScope: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
17
+ toolCallId: {
18
+ type: StringConstructor;
19
+ required: true;
20
+ };
21
+ enabled: {
22
+ type: PropType<boolean>;
23
+ required: true;
24
+ };
25
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
26
+ [key: string]: any;
27
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
28
+ [key: string]: any;
29
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
+ toolCallId: {
31
+ type: StringConstructor;
32
+ required: true;
33
+ };
34
+ enabled: {
35
+ type: PropType<boolean>;
36
+ required: true;
37
+ };
38
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
+ //# sourceMappingURL=tool-call-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-capture.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/tool-call-capture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,GAC9B,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAexB;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;cAID,QAAQ,CAAC,OAAO,CAAC;;;;;;;;;;;;;cAAjB,QAAQ,CAAC,OAAO,CAAC;;;iGAe/C,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { ComputedRef, InjectionKey } from "vue";
2
+ import type { CopilotChatToolCallDisplay, ToolCallLayout } from "./tool-call-layout";
3
+ /**
4
+ * Provided by the message view so each message's tool calls follow the view's
5
+ * `toolCallDisplay` without every layer passing it along.
6
+ * @internal
7
+ */
8
+ export interface ToolCallDisplayContextValue {
9
+ display: CopilotChatToolCallDisplay;
10
+ isRunning: boolean;
11
+ /** Each assistant message's tool calls, laid out across the whole list. */
12
+ layouts: ReadonlyMap<string, ToolCallLayout>;
13
+ /**
14
+ * `"turn"` display: for each message in a reply's working phase, whether
15
+ * that work is showing. Messages not in here are the reply itself.
16
+ */
17
+ workOpen: ReadonlyMap<string, boolean>;
18
+ /**
19
+ * Like `workOpen`, for the messages' text: text that ends the reply stays
20
+ * out of it even when its message also calls a tool.
21
+ */
22
+ workTextOpen: ReadonlyMap<string, boolean>;
23
+ }
24
+ /** @internal */
25
+ export declare const ToolCallDisplayContextKey: InjectionKey<ComputedRef<ToolCallDisplayContextValue>>;
26
+ /**
27
+ * Provided by a group around the calls it shows, so CopilotKit's built-in tool
28
+ * card draws itself as a compact row that fits the group instead of a card.
29
+ * @internal
30
+ */
31
+ export interface ToolCallGroupContextValue {
32
+ appearance: "card" | "line" | "stack";
33
+ failedIds: ReadonlySet<string>;
34
+ /** The agent may still finish the group's calls; see `isActive`. */
35
+ active: boolean;
36
+ }
37
+ /** @internal */
38
+ export declare const ToolCallGroupContextKey: InjectionKey<ComputedRef<ToolCallGroupContextValue | null>>;
39
+ //# sourceMappingURL=tool-call-display-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-display-context.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/tool-call-display-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EACV,0BAA0B,EAC1B,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,0BAA0B,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC7C;;;OAGG;IACH,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC;;;OAGG;IACH,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,gBAAgB;AAChB,eAAO,MAAM,yBAAyB,EAAE,YAAY,CAClD,WAAW,CAAC,2BAA2B,CAAC,CACF,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACtC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,oEAAoE;IACpE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAChD,WAAW,CAAC,yBAAyB,GAAG,IAAI,CAAC,CACT,CAAC"}
@@ -0,0 +1,144 @@
1
+ import type { PropType } from "vue";
2
+ import type { ToolCallEntry } from "./tool-call-layout";
3
+ /** A call that never got a result after the run ended (Stop, an error) is "stopped". */
4
+ export type ToolCallStatusName = "running" | "done" | "failed" | "stopped";
5
+ /**
6
+ * A call without a result is running only while the group is active: once
7
+ * the run has moved on or ended, its result is never coming.
8
+ * @internal
9
+ */
10
+ export declare const entryStatus: ({ toolMessage }: ToolCallEntry, active: boolean) => ToolCallStatusName;
11
+ /** @internal */
12
+ export declare const statusLabels: Record<ToolCallStatusName, string>;
13
+ /** The first non-empty string argument: usually a command, path or query. */
14
+ export declare function argumentPreview(parameters: unknown): string | undefined;
15
+ /** @internal */
16
+ export declare const entryPreview: (entry: ToolCallEntry) => string | undefined;
17
+ /** "run_command ×2, read_file" */
18
+ export declare function toolNames(calls: ToolCallEntry[]): string;
19
+ /** @internal */
20
+ export declare const pluralize: (count: number, noun: string) => string;
21
+ /**
22
+ * Height transition between closed and its content's height. Closed content
23
+ * stays mounted (so its state survives) but is inert.
24
+ * @internal
25
+ */
26
+ export declare const CopilotChatCollapsible: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
27
+ open: {
28
+ type: BooleanConstructor;
29
+ required: true;
30
+ };
31
+ id: {
32
+ type: StringConstructor;
33
+ default: undefined;
34
+ };
35
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
+ [key: string]: any;
37
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
38
+ open: {
39
+ type: BooleanConstructor;
40
+ required: true;
41
+ };
42
+ id: {
43
+ type: StringConstructor;
44
+ default: undefined;
45
+ };
46
+ }>> & Readonly<{}>, {
47
+ id: string;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ /** @internal */
50
+ export declare const ToolCallStatusIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
51
+ status: {
52
+ type: PropType<ToolCallStatusName>;
53
+ required: true;
54
+ };
55
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
56
+ [key: string]: any;
57
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
58
+ status: {
59
+ type: PropType<ToolCallStatusName>;
60
+ required: true;
61
+ };
62
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
63
+ /** @internal */
64
+ export declare const ToolCallChevron: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
65
+ open: {
66
+ type: BooleanConstructor;
67
+ required: true;
68
+ };
69
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
70
+ [key: string]: any;
71
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
72
+ open: {
73
+ type: BooleanConstructor;
74
+ required: true;
75
+ };
76
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
77
+ /** "2 failed", or nothing. @internal */
78
+ export declare const ToolCallFailedCount: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
79
+ calls: {
80
+ type: PropType<ToolCallEntry[]>;
81
+ required: true;
82
+ };
83
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
84
+ [key: string]: any;
85
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
86
+ calls: {
87
+ type: PropType<ToolCallEntry[]>;
88
+ required: true;
89
+ };
90
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
91
+ /**
92
+ * The built-in tool card drawn as a row inside a group: status, name and main
93
+ * argument, opening to the payloads.
94
+ * @internal
95
+ */
96
+ export declare const ToolCallRow: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
97
+ name: {
98
+ type: StringConstructor;
99
+ required: true;
100
+ };
101
+ parameters: {
102
+ type: null;
103
+ default: undefined;
104
+ };
105
+ result: {
106
+ type: null;
107
+ default: undefined;
108
+ };
109
+ status: {
110
+ type: PropType<ToolCallStatusName>;
111
+ required: true;
112
+ };
113
+ appearance: {
114
+ type: PropType<"card" | "line" | "stack">;
115
+ required: true;
116
+ };
117
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
118
+ [key: string]: any;
119
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
120
+ name: {
121
+ type: StringConstructor;
122
+ required: true;
123
+ };
124
+ parameters: {
125
+ type: null;
126
+ default: undefined;
127
+ };
128
+ result: {
129
+ type: null;
130
+ default: undefined;
131
+ };
132
+ status: {
133
+ type: PropType<ToolCallStatusName>;
134
+ required: true;
135
+ };
136
+ appearance: {
137
+ type: PropType<"card" | "line" | "stack">;
138
+ required: true;
139
+ };
140
+ }>> & Readonly<{}>, {
141
+ parameters: any;
142
+ result: any;
143
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
144
+ //# sourceMappingURL=tool-call-group-parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-group-parts.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/tool-call-group-parts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAUpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,wFAAwF;AACxF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,iBAAiB,aAAa,EAC9B,QAAQ,OAAO,KACd,kBAOc,CAAC;AAElB,gBAAgB;AAChB,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAK3D,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMvE;AAED,gBAAgB;AAChB,eAAO,MAAM,YAAY,GAAI,OAAO,aAAa,uBACqB,CAAC;AAEvE,kCAAkC;AAClC,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CASxD;AAED,gBAAgB;AAChB,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,WACR,CAAC;AAuB9C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;4EAwBjC,CAAC;AAEH,gBAAgB;AAChB,eAAO,MAAM,kBAAkB;;cAIT,QAAQ,CAAC,kBAAkB,CAAC;;;;;;;cAA5B,QAAQ,CAAC,kBAAkB,CAAC;;;iGAuBhD,CAAC;AAEH,gBAAgB;AAChB,eAAO,MAAM,eAAe;;;;;;;;;;;;iGAa1B,CAAC;AAEH,wCAAwC;AACxC,eAAO,MAAM,mBAAmB;;cAGJ,QAAQ,CAAC,aAAa,EAAE,CAAC;;;;;;;cAAzB,QAAQ,CAAC,aAAa,EAAE,CAAC;;;iGAenD,CAAC;AASH;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;cAOF,QAAQ,CAAC,kBAAkB,CAAC;;;;cAI5B,QAAQ,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;cAJnC,QAAQ,CAAC,kBAAkB,CAAC;;;;cAI5B,QAAQ,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;;;;;;4EA+EvD,CAAC"}
@@ -0,0 +1,115 @@
1
+ import type { Message, ToolCall, ToolMessage } from "@ag-ui/core";
2
+ /**
3
+ * How the chat shows tool calls.
4
+ *
5
+ * - `"grouped"` (default): calls made in a row share one card, collapsed to a
6
+ * summary ("Used 3 tools") that opens to a row per call.
7
+ * - `"line"`: the same grouping as a quiet line of text, like the reasoning
8
+ * message's "Thought for 4 seconds".
9
+ * - `"stacked"`: the latest call on top of a stack of the earlier ones; click
10
+ * to fan the stack out into its cards.
11
+ * - `"turn"`: the agent works in the open (narration, then a row per call),
12
+ * and when the reply is done everything before it folds into "Worked for 9s".
13
+ * - `"separate"`: every call gets its own card, as before grouping existed.
14
+ *
15
+ * Only calls drawn by a renderer that opts into grouping (`group: true`) are
16
+ * grouped; CopilotKit's built-in card from `useDefaultRenderTool()` does. Any
17
+ * other call always shows on its own and splits the group around it.
18
+ */
19
+ export type CopilotChatToolCallDisplay = "grouped" | "line" | "stacked" | "turn" | "separate";
20
+ /** One tool call and, once it has finished, the message carrying its result. */
21
+ export interface ToolCallEntry {
22
+ toolCall: ToolCall;
23
+ toolMessage?: ToolMessage;
24
+ }
25
+ export type ToolCallSegment =
26
+ /** Consecutive calls drawn by renderers that opted into grouping. */
27
+ {
28
+ kind: "group";
29
+ id: string;
30
+ calls: ToolCallEntry[];
31
+ /** Nothing renders after this group yet, so a running agent may add to it. */
32
+ trailing: boolean;
33
+ }
34
+ /**
35
+ * A call drawn by a renderer that didn't opt into grouping, or with no
36
+ * renderer at all. The latter renders nothing (and warns in development)
37
+ * without breaking a group.
38
+ */
39
+ | {
40
+ kind: "call";
41
+ id: string;
42
+ call: ToolCallEntry;
43
+ rendered: boolean;
44
+ };
45
+ /** What one assistant message's tool-call area renders. */
46
+ export interface ToolCallLayout {
47
+ segments: ToolCallSegment[];
48
+ /** Changes whenever anything this layout renders changes; for memoization. */
49
+ signature: string;
50
+ }
51
+ /** Which tool-call renderers are registered. */
52
+ export interface ToolCallRendererNames {
53
+ /** Tool names with a renderer of their own. */
54
+ named: ReadonlySet<string>;
55
+ /** Of those, the ones whose renderer opted into grouping. */
56
+ groupedNames: ReadonlySet<string>;
57
+ /** A wildcard (`"*"`) renderer is registered. */
58
+ wildcard: boolean;
59
+ /** The wildcard renderer opted into grouping (the built-in card does). */
60
+ wildcardGroups: boolean;
61
+ }
62
+ /** Index of tool results by the call they answer. */
63
+ export declare function getToolResults(messages: Message[]): Map<string, ToolMessage>;
64
+ /**
65
+ * Lays out the tool calls of every assistant message in `rendered`.
66
+ *
67
+ * Calls drawn by a renderer that opted into grouping join the group that's
68
+ * open; anything else that shows between them closes it: assistant text, a
69
+ * user, reasoning or activity message, or a call drawn by any other renderer. A group belongs to
70
+ * the message where it starts, so later messages whose calls joined it render
71
+ * no tool calls themselves.
72
+ *
73
+ * @param rendered - The messages as the chat renders them, in order.
74
+ * @param all - Every message, for finding tool results (a transform may hide them).
75
+ * @param renderers - The registered renderers.
76
+ */
77
+ export declare function getToolCallLayouts(rendered: Message[], all: Message[], renderers: ToolCallRendererNames): Map<string, ToolCallLayout>;
78
+ /**
79
+ * Which renderers draw tool calls, from the registered renderers and the
80
+ * view's tool-call slots. A slot wins over a registered renderer and never
81
+ * groups, since the chat can't tell what it draws: `#tool-call-<name>` takes
82
+ * that tool, and `#tool-call` takes every tool.
83
+ *
84
+ * @param renderers - The registered renderers (`copilotkit.renderToolCalls`).
85
+ * @param slotNames - The names of the slots the view was given.
86
+ */
87
+ export declare function getToolCallRendererNames(renderers: readonly {
88
+ name: string;
89
+ group?: boolean;
90
+ }[], slotNames?: readonly string[]): ToolCallRendererNames;
91
+ /** A reply's working phase, for the `"turn"` display. */
92
+ export interface TurnWork {
93
+ /** Stable across the turn's life: the id of the user message it answers. */
94
+ key: string;
95
+ /** The first assistant-side message, where the "Worked for" line goes. */
96
+ firstMessageId: string;
97
+ /** Everything up to and including the last message with a tool call. */
98
+ workMessageIds: ReadonlySet<string>;
99
+ /**
100
+ * The reply's last assistant message, when it has text and is part of the
101
+ * work (it also calls a tool). Its text is the answer, so it stays out.
102
+ */
103
+ replyTextMessageId?: string;
104
+ calls: ToolCallEntry[];
105
+ /** No user message follows, so the agent may still be working on it. */
106
+ isLatest: boolean;
107
+ }
108
+ /**
109
+ * Finds the working phase of every reply in `rendered`: its messages up to the
110
+ * last one that calls a tool. Text in there was narration; what follows is the
111
+ * reply itself. Replies that called no tools are omitted, except the latest,
112
+ * which may be about to.
113
+ */
114
+ export declare function getTurnWork(rendered: Message[], layouts: ReadonlyMap<string, ToolCallLayout>): Map<string, TurnWork>;
115
+ //# sourceMappingURL=tool-call-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-layout.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/tool-call-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,0BAA0B,GAClC,SAAS,GACT,MAAM,GACN,SAAS,GACT,MAAM,GACN,UAAU,CAAC;AAEf,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe;AACzB,qEAAqE;AACnE;IACE,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,8EAA8E;IAC9E,QAAQ,EAAE,OAAO,CAAC;CACnB;AACH;;;;GAIG;GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzE,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,6DAA6D;IAC7D,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,iDAAiD;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,cAAc,EAAE,OAAO,CAAC;CACzB;AA4BD,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAM5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,OAAO,EAAE,EACd,SAAS,EAAE,qBAAqB,GAC/B,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAuD7B;AAID;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,EACvD,SAAS,GAAE,SAAS,MAAM,EAAO,GAChC,qBAAqB,CAuBvB;AAED,yDAAyD;AACzD,MAAM,WAAW,QAAQ;IACvB,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,cAAc,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,wEAAwE;IACxE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,GAC3C,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CA6DvB"}
@@ -0,0 +1,35 @@
1
+ import type { FunctionalComponent } from "vue";
2
+ /** "45s", "1m 5s", "2m". Used for the live timer and the final duration. */
3
+ export declare function formatDuration(ms: number): string;
4
+ /**
5
+ * Folds its content away with a reply's work in the `"turn"` display. Without
6
+ * `open` (any other display) it renders the content as is.
7
+ * @internal
8
+ */
9
+ export declare const TurnWorkFold: FunctionalComponent<{
10
+ open?: boolean;
11
+ }>;
12
+ /**
13
+ * In the `"turn"` tool-call display, text in a reply's working phase was
14
+ * narration: it fades to muted once a call follows it, and folds away with the
15
+ * rest of the work when the reply is done. The wrapper is there for every
16
+ * message in that display, so text that turns into narration keeps its node
17
+ * (and its place) rather than remounting.
18
+ * @internal
19
+ */
20
+ export declare const CopilotChatWorkText: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
21
+ messageId: {
22
+ type: StringConstructor;
23
+ required: true;
24
+ };
25
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
26
+ [key: string]: any;
27
+ }> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
28
+ [key: string]: any;
29
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
+ messageId: {
31
+ type: StringConstructor;
32
+ required: true;
33
+ };
34
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
+ //# sourceMappingURL=turn-work.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-work.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/chat/turn-work.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,KAAK,CAAC;AAI/C,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,mBAAmB,CAAC;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAML,CAAC;AAG7D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;iGAwB9B,CAAC"}
@@ -1,16 +1,58 @@
1
1
  import type { AssistantMessage, Message, ReasoningMessage, ToolCall, ToolMessage, UserMessage } from "@ag-ui/core";
2
+ import type { VNode } from "vue";
2
3
  import type { CopilotKitCoreErrorCode, ToolCallStatus } from "@copilotkit/core";
3
4
  import type { Suggestion } from "@copilotkit/core";
4
- import type { Attachment, AttachmentsConfig, AttachmentModality } from "@copilotkit/shared";
5
+ import type { Attachment, AttachmentsConfig, AttachmentModality, InputContentSource } from "@copilotkit/shared";
5
6
  import type { CopilotChatLabels } from "../../providers/types";
6
7
  import type { InterruptEvent } from "../../types";
7
8
  import type { AutoScrollMode } from "./normalize-auto-scroll";
9
+ import type { CopilotChatToolCallDisplay, ToolCallEntry } from "./tool-call-layout";
8
10
  export type CopilotChatInputMode = "input" | "transcribe" | "processing";
9
11
  export type { Attachment, AttachmentsConfig, AttachmentModality };
10
12
  export type { AutoScrollMode };
13
+ export type { CopilotChatToolCallDisplay, ToolCallEntry };
14
+ /** How a `CopilotChatToolCallGroup` draws its calls. */
15
+ export type CopilotChatToolCallGroupAppearance = "card" | "line" | "stack";
16
+ /** Props of the `#tool-calls-group` slot, which replaces a group of calls. */
17
+ export interface CopilotChatToolCallsGroupSlotProps {
18
+ /** The calls in the group, in order. */
19
+ calls: ToolCallEntry[];
20
+ /** The appearance the view's `toolCallDisplay` asks for. */
21
+ appearance: CopilotChatToolCallGroupAppearance;
22
+ /** The agent is running and nothing follows the group, so more calls may join it. */
23
+ isActive: boolean;
24
+ /**
25
+ * Draws one call through the registered renderers and tool-call slots.
26
+ * Render the VNode with `<component :is="renderCall(call)" />`.
27
+ */
28
+ renderCall: (call: ToolCallEntry) => VNode;
29
+ }
30
+ /**
31
+ * Props of `CopilotChatWorkSummary` and of the `#work-summary` slot, which
32
+ * replaces the "Working… / Worked for 9s" line of the `"turn"` display.
33
+ */
34
+ export interface CopilotChatWorkSummarySlotProps {
35
+ /** The agent is still working on this reply. */
36
+ isWorking: boolean;
37
+ /** Whether the work (narration and tool calls) is showing. */
38
+ isOpen: boolean;
39
+ /** The tool calls the reply made. */
40
+ calls: ToolCallEntry[];
41
+ /**
42
+ * How long the agent has worked on the reply, in ms, summed over its runs
43
+ * so time spent waiting between them doesn't count. Only known for replies
44
+ * this client watched start; without it the summary shows the tool count.
45
+ */
46
+ elapsedMs?: number;
47
+ /** When the current run started (epoch ms), while the agent is working. */
48
+ workingSince?: number;
49
+ /** Opens or closes the reply's work. */
50
+ onClick: () => void;
51
+ }
11
52
  export interface CopilotChatAttachmentRendererProps {
12
53
  type: AttachmentModality;
13
- source: Attachment["source"];
54
+ /** Any AG-UI content source, as in React; a `file` handle shows no preview. */
55
+ source: InputContentSource;
14
56
  filename?: string;
15
57
  className?: string;
16
58
  }
@@ -76,6 +118,20 @@ export interface CopilotChatViewProps {
76
118
  onDragLeave?: (event: DragEvent) => void;
77
119
  onDrop?: (event: DragEvent) => void;
78
120
  onFinishTranscribeWithAudio?: (audioBlob: Blob) => void | Promise<void>;
121
+ /**
122
+ * How tool calls show. Defaults to `"grouped"`: calls made in a row share
123
+ * one card that opens to a row per call. `"line"` and `"stacked"` group
124
+ * them too; `"separate"` gives every call its own card. Calls drawn by a
125
+ * renderer that does not set `group: true`, or by a tool-call slot, always
126
+ * show on their own.
127
+ */
128
+ toolCallDisplay?: CopilotChatToolCallDisplay;
129
+ /**
130
+ * Whether reply thumbs record ratings for Automatic Learning once a
131
+ * Trajectory has started. Defaults to `true`; set `false` to keep the
132
+ * thumbs to your own `thumbs-up` / `thumbs-down` handlers and slots.
133
+ */
134
+ messageFeedback?: boolean;
79
135
  }
80
136
  export interface CopilotChatProps extends Omit<CopilotChatViewProps, "messages" | "isRunning" | "suggestions" | "suggestionLoadingIndexes" | "attachments" | "onRemoveAttachment" | "onAddFile" | "dragOver" | "onDragOver" | "onDragLeave" | "onDrop" | "onSubmitMessage" | "onStop" | "onInputChange" | "onSelectSuggestion" | "onStartTranscribe" | "onCancelTranscribe" | "onFinishTranscribe"> {
81
137
  agentId?: string;
@@ -247,12 +303,52 @@ export interface CopilotChatAssistantMessageCopyButtonSlotProps {
247
303
  copied: boolean;
248
304
  label: string;
249
305
  }
306
+ /**
307
+ * Attributes and listeners that let a thumb record a Learning rating and open
308
+ * its comment popover. Bind them on the thumb's `<button>` with `v-bind`;
309
+ * they are empty while the chat records no ratings.
310
+ */
311
+ export type CopilotChatAssistantMessageThumbProps = Record<string, unknown>;
250
312
  export interface CopilotChatAssistantMessageThumbsUpButtonSlotProps {
251
- onThumbsUp: () => void;
313
+ /**
314
+ * Rates the reply. Pass the click event, so the comment points at the
315
+ * clicked thumb and a keyboard click moves focus into it.
316
+ */
317
+ onThumbsUp: (event?: MouseEvent) => void;
252
318
  label: string;
319
+ /** This rating is the chosen one (Learning only). */
320
+ pressed: boolean;
321
+ thumbProps: CopilotChatAssistantMessageThumbProps;
253
322
  }
254
323
  export interface CopilotChatAssistantMessageThumbsDownButtonSlotProps {
255
- onThumbsDown: () => void;
324
+ /** See {@link CopilotChatAssistantMessageThumbsUpButtonSlotProps.onThumbsUp}. */
325
+ onThumbsDown: (event?: MouseEvent) => void;
326
+ label: string;
327
+ /** This rating is the chosen one (Learning only). */
328
+ pressed: boolean;
329
+ thumbProps: CopilotChatAssistantMessageThumbProps;
330
+ }
331
+ /** Props of the `feedback-comment` slot: the comment field of a rating. */
332
+ export interface CopilotChatAssistantMessageFeedbackCommentSlotProps {
333
+ value: string;
334
+ /** The comment already saved. */
335
+ savedComment: string;
336
+ /** Bind as `:ref` on the text field, so a keyboard rating can focus it. */
337
+ inputRef: (element: unknown) => void;
338
+ onChange: (value: string) => void;
339
+ /** Saves the comment, closes the popover and returns focus to the thumb. */
340
+ onSubmit: () => void;
341
+ onEditingChange: (editing: boolean) => void;
342
+ /**
343
+ * Focus left the form for `next`, or for no focusable element when null.
344
+ * Not called when the window loses focus.
345
+ */
346
+ onLeave: (next: Element | null) => void;
347
+ }
348
+ /** Props of the `inspector-button` slot. */
349
+ export interface CopilotChatAssistantMessageInspectorButtonSlotProps {
350
+ /** Opens this message in the Inspector. */
351
+ onInspect: () => void;
256
352
  label: string;
257
353
  }
258
354
  export interface CopilotChatAssistantMessageReadAloudButtonSlotProps {
@@ -381,6 +477,8 @@ export interface CopilotSidebarViewToggleButtonSlotProps {
381
477
  export interface CopilotSidebarViewProps extends CopilotChatViewProps {
382
478
  width?: number | string;
383
479
  defaultOpen?: boolean;
480
+ /** The edge the sidebar docks to. Defaults to `"right"`. */
481
+ position?: "left" | "right";
384
482
  }
385
483
  export type CopilotPopupViewHeaderSlotProps = CopilotSidebarViewHeaderSlotProps;
386
484
  export type CopilotPopupViewToggleButtonSlotProps = CopilotSidebarViewToggleButtonSlotProps;
@@ -403,5 +501,7 @@ export interface CopilotPopupProps extends CopilotChatProps {
403
501
  export interface CopilotSidebarProps extends CopilotChatProps {
404
502
  width?: number | string;
405
503
  defaultOpen?: boolean;
504
+ /** The edge the sidebar docks to. Defaults to `"right"`. */
505
+ position?: CopilotSidebarViewProps["position"];
406
506
  }
407
507
  //# sourceMappingURL=types.d.ts.map