@artooi/ag-ui-web-component 0.37.0 → 0.38.0

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 (195) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/dist/ag-ui-web-component.bundle.js +81 -81
  3. package/dist/ag-ui-web-component.bundle.js.map +4 -4
  4. package/dist/core/activity_registration.d.ts +19 -0
  5. package/dist/core/activity_registration.d.ts.map +1 -0
  6. package/dist/core/activity_renderer.d.ts +20 -0
  7. package/dist/core/activity_renderer.d.ts.map +1 -0
  8. package/dist/core/ag_ui_chat.d.ts +6 -126
  9. package/dist/core/ag_ui_chat.d.ts.map +1 -1
  10. package/dist/core/events/attachments_detail.d.ts +9 -0
  11. package/dist/core/events/attachments_detail.d.ts.map +1 -0
  12. package/dist/core/events/custom_agent_detail.d.ts +8 -0
  13. package/dist/core/events/custom_agent_detail.d.ts.map +1 -0
  14. package/dist/core/events/feedback_detail.d.ts +7 -0
  15. package/dist/core/events/feedback_detail.d.ts.map +1 -0
  16. package/dist/core/events/invalidate_detail.d.ts +16 -0
  17. package/dist/core/events/invalidate_detail.d.ts.map +1 -0
  18. package/dist/core/events/run_finished_detail.d.ts +22 -0
  19. package/dist/core/events/run_finished_detail.d.ts.map +1 -0
  20. package/dist/core/events/state_detail.d.ts +5 -0
  21. package/dist/core/events/state_detail.d.ts.map +1 -0
  22. package/dist/core/events/submit_detail.d.ts +8 -0
  23. package/dist/core/events/submit_detail.d.ts.map +1 -0
  24. package/dist/core/events/toggle_detail.d.ts +5 -0
  25. package/dist/core/events/toggle_detail.d.ts.map +1 -0
  26. package/dist/core/events/tool_run.d.ts +11 -0
  27. package/dist/core/events/tool_run.d.ts.map +1 -0
  28. package/dist/core/events/unread_detail.d.ts +5 -0
  29. package/dist/core/events/unread_detail.d.ts.map +1 -0
  30. package/dist/core/message_role.d.ts +4 -0
  31. package/dist/core/message_role.d.ts.map +1 -0
  32. package/dist/core/tool_outcome.d.ts +1 -1
  33. package/dist/core/tool_outcome.d.ts.map +1 -1
  34. package/dist/index.d.ts +30 -17
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +8579 -8573
  37. package/dist/index.js.map +4 -4
  38. package/dist/ui/charts/chart_block.d.ts.map +1 -0
  39. package/dist/ui/charts/chart_spec_from.d.ts.map +1 -0
  40. package/dist/ui/{chart_tool.d.ts → charts/chart_tool.d.ts} +1 -1
  41. package/dist/ui/charts/chart_tool.d.ts.map +1 -0
  42. package/dist/ui/{attachment_tray.d.ts → composer/attachment_tray.d.ts} +3 -3
  43. package/dist/ui/composer/attachment_tray.d.ts.map +1 -0
  44. package/dist/ui/{skills_menu.d.ts → composer/skills_menu.d.ts} +1 -1
  45. package/dist/ui/composer/skills_menu.d.ts.map +1 -0
  46. package/dist/ui/{voice_input.d.ts → composer/voice_input.d.ts} +2 -2
  47. package/dist/ui/composer/voice_input.d.ts.map +1 -0
  48. package/dist/ui/{attach_copy_buttons.d.ts → excerpts/attach_copy_buttons.d.ts} +1 -1
  49. package/dist/ui/excerpts/attach_copy_buttons.d.ts.map +1 -0
  50. package/dist/ui/excerpts/copy_payload.d.ts.map +1 -0
  51. package/dist/ui/excerpts/page_quote_offer.d.ts.map +1 -0
  52. package/dist/ui/excerpts/quote_selection.d.ts.map +1 -0
  53. package/dist/ui/{checkpoint_menu.d.ts → history/checkpoint_menu.d.ts} +2 -2
  54. package/dist/ui/history/checkpoint_menu.d.ts.map +1 -0
  55. package/dist/ui/{relative_time.d.ts → history/relative_time.d.ts} +1 -1
  56. package/dist/ui/history/relative_time.d.ts.map +1 -0
  57. package/dist/ui/{thread_drawer.d.ts → history/thread_drawer.d.ts} +2 -2
  58. package/dist/ui/history/thread_drawer.d.ts.map +1 -0
  59. package/dist/ui/{approval_card.d.ts → interrupts/approval_card.d.ts} +1 -1
  60. package/dist/ui/interrupts/approval_card.d.ts.map +1 -0
  61. package/dist/ui/{confirmation_card.d.ts → interrupts/confirmation_card.d.ts} +1 -1
  62. package/dist/ui/interrupts/confirmation_card.d.ts.map +1 -0
  63. package/dist/ui/{question_card.d.ts → interrupts/question_card.d.ts} +1 -1
  64. package/dist/ui/interrupts/question_card.d.ts.map +1 -0
  65. package/dist/ui/placement/clamp_launcher.d.ts.map +1 -0
  66. package/dist/ui/placement/clamp_panel.d.ts.map +1 -0
  67. package/dist/ui/placement/launcher_drag.d.ts.map +1 -0
  68. package/dist/ui/placement/launcher_placement.d.ts.map +1 -0
  69. package/dist/ui/placement/panel_drag.d.ts.map +1 -0
  70. package/dist/ui/placement/place_widget.d.ts.map +1 -0
  71. package/dist/ui/placement/resize_handle.d.ts.map +1 -0
  72. package/dist/ui/progress/prettify_tool_name.d.ts.map +1 -0
  73. package/dist/ui/progress/run_notice.d.ts.map +1 -0
  74. package/dist/ui/{subagent_panel.d.ts → progress/subagent_panel.d.ts} +2 -2
  75. package/dist/ui/progress/subagent_panel.d.ts.map +1 -0
  76. package/dist/ui/progress/subagent_update.d.ts.map +1 -0
  77. package/dist/ui/{thoughts_block.d.ts → progress/thoughts_block.d.ts} +1 -1
  78. package/dist/ui/progress/thoughts_block.d.ts.map +1 -0
  79. package/dist/ui/{tool_call_card.d.ts → progress/tool_call_card.d.ts} +2 -2
  80. package/dist/ui/progress/tool_call_card.d.ts.map +1 -0
  81. package/dist/ui/{attachment_chips.d.ts → transcript/attachment_chips.d.ts} +1 -1
  82. package/dist/ui/transcript/attachment_chips.d.ts.map +1 -0
  83. package/dist/ui/{message_actions.d.ts → transcript/message_actions.d.ts} +1 -1
  84. package/dist/ui/transcript/message_actions.d.ts.map +1 -0
  85. package/dist/ui/transcript/render_markdown.d.ts.map +1 -0
  86. package/dist/ui/transcript/reveal_words.d.ts.map +1 -0
  87. package/dist/ui/transcript/stick_to_bottom.d.ts.map +1 -0
  88. package/dist/ui/{suggestion_chips.d.ts → transcript/suggestion_chips.d.ts} +1 -1
  89. package/dist/ui/transcript/suggestion_chips.d.ts.map +1 -0
  90. package/package.json +5 -5
  91. package/src/core/activity_registration.ts +19 -0
  92. package/src/core/activity_renderer.ts +19 -0
  93. package/src/core/ag_ui_chat.ts +84 -178
  94. package/src/core/events/attachments_detail.ts +9 -0
  95. package/src/core/events/custom_agent_detail.ts +7 -0
  96. package/src/core/events/feedback_detail.ts +6 -0
  97. package/src/core/events/invalidate_detail.ts +15 -0
  98. package/src/core/events/run_finished_detail.ts +22 -0
  99. package/src/core/events/state_detail.ts +4 -0
  100. package/src/core/events/submit_detail.ts +8 -0
  101. package/src/core/events/toggle_detail.ts +4 -0
  102. package/src/core/events/tool_run.ts +10 -0
  103. package/src/core/events/unread_detail.ts +4 -0
  104. package/src/core/message_role.ts +4 -0
  105. package/src/core/tool_outcome.ts +1 -1
  106. package/src/index.ts +52 -54
  107. package/src/ui/{chart_tool.ts → charts/chart_tool.ts} +1 -1
  108. package/src/ui/{attachment_tray.ts → composer/attachment_tray.ts} +5 -5
  109. package/src/ui/{skills_menu.ts → composer/skills_menu.ts} +1 -1
  110. package/src/ui/{voice_input.ts → composer/voice_input.ts} +3 -3
  111. package/src/ui/{attach_copy_buttons.ts → excerpts/attach_copy_buttons.ts} +1 -1
  112. package/src/ui/{checkpoint_menu.ts → history/checkpoint_menu.ts} +2 -2
  113. package/src/ui/{relative_time.ts → history/relative_time.ts} +1 -1
  114. package/src/ui/{thread_drawer.ts → history/thread_drawer.ts} +2 -2
  115. package/src/ui/{approval_card.ts → interrupts/approval_card.ts} +1 -1
  116. package/src/ui/{confirmation_card.ts → interrupts/confirmation_card.ts} +1 -1
  117. package/src/ui/{question_card.ts → interrupts/question_card.ts} +1 -1
  118. package/src/ui/{clamp_launcher.ts → placement/clamp_launcher.ts} +1 -1
  119. package/src/ui/{clamp_panel.ts → placement/clamp_panel.ts} +1 -1
  120. package/src/ui/{launcher_placement.ts → placement/launcher_placement.ts} +1 -1
  121. package/src/ui/{subagent_panel.ts → progress/subagent_panel.ts} +2 -2
  122. package/src/ui/{subagent_update.ts → progress/subagent_update.ts} +1 -1
  123. package/src/ui/{thoughts_block.ts → progress/thoughts_block.ts} +1 -1
  124. package/src/ui/{tool_call_card.ts → progress/tool_call_card.ts} +2 -2
  125. package/src/ui/{attachment_chips.ts → transcript/attachment_chips.ts} +2 -2
  126. package/src/ui/{message_actions.ts → transcript/message_actions.ts} +2 -2
  127. package/src/ui/{suggestion_chips.ts → transcript/suggestion_chips.ts} +1 -1
  128. package/src/version.ts +1 -1
  129. package/dist/ui/approval_card.d.ts.map +0 -1
  130. package/dist/ui/attach_copy_buttons.d.ts.map +0 -1
  131. package/dist/ui/attachment_chips.d.ts.map +0 -1
  132. package/dist/ui/attachment_tray.d.ts.map +0 -1
  133. package/dist/ui/chart_block.d.ts.map +0 -1
  134. package/dist/ui/chart_spec_from.d.ts.map +0 -1
  135. package/dist/ui/chart_tool.d.ts.map +0 -1
  136. package/dist/ui/checkpoint_menu.d.ts.map +0 -1
  137. package/dist/ui/clamp_launcher.d.ts.map +0 -1
  138. package/dist/ui/clamp_panel.d.ts.map +0 -1
  139. package/dist/ui/confirmation_card.d.ts.map +0 -1
  140. package/dist/ui/copy_payload.d.ts.map +0 -1
  141. package/dist/ui/launcher_drag.d.ts.map +0 -1
  142. package/dist/ui/launcher_placement.d.ts.map +0 -1
  143. package/dist/ui/message_actions.d.ts.map +0 -1
  144. package/dist/ui/page_quote_offer.d.ts.map +0 -1
  145. package/dist/ui/panel_drag.d.ts.map +0 -1
  146. package/dist/ui/place_widget.d.ts.map +0 -1
  147. package/dist/ui/prettify_tool_name.d.ts.map +0 -1
  148. package/dist/ui/question_card.d.ts.map +0 -1
  149. package/dist/ui/quote_selection.d.ts.map +0 -1
  150. package/dist/ui/relative_time.d.ts.map +0 -1
  151. package/dist/ui/render_markdown.d.ts.map +0 -1
  152. package/dist/ui/resize_handle.d.ts.map +0 -1
  153. package/dist/ui/reveal_words.d.ts.map +0 -1
  154. package/dist/ui/run_notice.d.ts.map +0 -1
  155. package/dist/ui/skills_menu.d.ts.map +0 -1
  156. package/dist/ui/stick_to_bottom.d.ts.map +0 -1
  157. package/dist/ui/subagent_panel.d.ts.map +0 -1
  158. package/dist/ui/subagent_update.d.ts.map +0 -1
  159. package/dist/ui/suggestion_chips.d.ts.map +0 -1
  160. package/dist/ui/thoughts_block.d.ts.map +0 -1
  161. package/dist/ui/thread_drawer.d.ts.map +0 -1
  162. package/dist/ui/tool_call_card.d.ts.map +0 -1
  163. package/dist/ui/voice_input.d.ts.map +0 -1
  164. /package/dist/ui/{chart_block.d.ts → charts/chart_block.d.ts} +0 -0
  165. /package/dist/ui/{chart_spec_from.d.ts → charts/chart_spec_from.d.ts} +0 -0
  166. /package/dist/ui/{copy_payload.d.ts → excerpts/copy_payload.d.ts} +0 -0
  167. /package/dist/ui/{page_quote_offer.d.ts → excerpts/page_quote_offer.d.ts} +0 -0
  168. /package/dist/ui/{quote_selection.d.ts → excerpts/quote_selection.d.ts} +0 -0
  169. /package/dist/ui/{clamp_launcher.d.ts → placement/clamp_launcher.d.ts} +0 -0
  170. /package/dist/ui/{clamp_panel.d.ts → placement/clamp_panel.d.ts} +0 -0
  171. /package/dist/ui/{launcher_drag.d.ts → placement/launcher_drag.d.ts} +0 -0
  172. /package/dist/ui/{launcher_placement.d.ts → placement/launcher_placement.d.ts} +0 -0
  173. /package/dist/ui/{panel_drag.d.ts → placement/panel_drag.d.ts} +0 -0
  174. /package/dist/ui/{place_widget.d.ts → placement/place_widget.d.ts} +0 -0
  175. /package/dist/ui/{resize_handle.d.ts → placement/resize_handle.d.ts} +0 -0
  176. /package/dist/ui/{prettify_tool_name.d.ts → progress/prettify_tool_name.d.ts} +0 -0
  177. /package/dist/ui/{run_notice.d.ts → progress/run_notice.d.ts} +0 -0
  178. /package/dist/ui/{subagent_update.d.ts → progress/subagent_update.d.ts} +0 -0
  179. /package/dist/ui/{render_markdown.d.ts → transcript/render_markdown.d.ts} +0 -0
  180. /package/dist/ui/{reveal_words.d.ts → transcript/reveal_words.d.ts} +0 -0
  181. /package/dist/ui/{stick_to_bottom.d.ts → transcript/stick_to_bottom.d.ts} +0 -0
  182. /package/src/ui/{chart_block.ts → charts/chart_block.ts} +0 -0
  183. /package/src/ui/{chart_spec_from.ts → charts/chart_spec_from.ts} +0 -0
  184. /package/src/ui/{copy_payload.ts → excerpts/copy_payload.ts} +0 -0
  185. /package/src/ui/{page_quote_offer.ts → excerpts/page_quote_offer.ts} +0 -0
  186. /package/src/ui/{quote_selection.ts → excerpts/quote_selection.ts} +0 -0
  187. /package/src/ui/{launcher_drag.ts → placement/launcher_drag.ts} +0 -0
  188. /package/src/ui/{panel_drag.ts → placement/panel_drag.ts} +0 -0
  189. /package/src/ui/{place_widget.ts → placement/place_widget.ts} +0 -0
  190. /package/src/ui/{resize_handle.ts → placement/resize_handle.ts} +0 -0
  191. /package/src/ui/{prettify_tool_name.ts → progress/prettify_tool_name.ts} +0 -0
  192. /package/src/ui/{run_notice.ts → progress/run_notice.ts} +0 -0
  193. /package/src/ui/{render_markdown.ts → transcript/render_markdown.ts} +0 -0
  194. /package/src/ui/{reveal_words.ts → transcript/reveal_words.ts} +0 -0
  195. /package/src/ui/{stick_to_bottom.ts → transcript/stick_to_bottom.ts} +0 -0
@@ -61,47 +61,45 @@ import { createPageMapContext, type PageMap } from "../tools/page_map.js";
61
61
  import { createPageStateTools, type PageState } from "../tools/page_state.js";
62
62
  import { parseToolCatalog, type ToolCatalogEntry } from "../tools/parse_tool_catalog.js";
63
63
  import { createRouteTools, type RouteMap } from "../tools/route_map.js";
64
+ import { renderChart } from "../ui/charts/chart_block.js";
65
+ import { chartSpecFrom } from "../ui/charts/chart_spec_from.js";
66
+ import { CHART_TOOL_NAME, createChartTool } from "../ui/charts/chart_tool.js";
67
+ import { AttachmentTray } from "../ui/composer/attachment_tray.js";
68
+ import { SkillsMenu } from "../ui/composer/skills_menu.js";
69
+ import { VoiceInput } from "../ui/composer/voice_input.js";
70
+ import { attachCopyButtons } from "../ui/excerpts/attach_copy_buttons.js";
71
+ import { copyPayload } from "../ui/excerpts/copy_payload.js";
72
+ import { attachQuoteOffer, type PageQuoteOffer } from "../ui/excerpts/page_quote_offer.js";
73
+ import { asQuote, quotableSelection } from "../ui/excerpts/quote_selection.js";
74
+ import { CheckpointMenu, type CheckpointVerb } from "../ui/history/checkpoint_menu.js";
75
+ import type { RelativeTimeFormatter } from "../ui/history/relative_time.js";
76
+ import { ThreadDrawer } from "../ui/history/thread_drawer.js";
64
77
  import {
65
78
  type ApprovalRenderer,
66
79
  type ApprovalRequest,
67
80
  requestApproval,
68
- } from "../ui/approval_card.js";
69
- import { attachCopyButtons } from "../ui/attach_copy_buttons.js";
70
- import { renderAttachmentChips } from "../ui/attachment_chips.js";
71
- import { AttachmentTray } from "../ui/attachment_tray.js";
72
- import { renderChart } from "../ui/chart_block.js";
73
- import { chartSpecFrom } from "../ui/chart_spec_from.js";
74
- import { CHART_TOOL_NAME, createChartTool } from "../ui/chart_tool.js";
75
- import { CheckpointMenu, type CheckpointVerb } from "../ui/checkpoint_menu.js";
76
- import { clampLauncher } from "../ui/clamp_launcher.js";
77
- import { clampPanel } from "../ui/clamp_panel.js";
78
- import { type ConfirmationRequest, requestConfirmation } from "../ui/confirmation_card.js";
79
- import { copyPayload } from "../ui/copy_payload.js";
80
- import { enableLauncherDrag } from "../ui/launcher_drag.js";
81
+ } from "../ui/interrupts/approval_card.js";
82
+ import {
83
+ type ConfirmationRequest,
84
+ requestConfirmation,
85
+ } from "../ui/interrupts/confirmation_card.js";
86
+ import {
87
+ type QuestionRenderer,
88
+ type QuestionRequest,
89
+ requestQuestion,
90
+ } from "../ui/interrupts/question_card.js";
91
+ import { clampLauncher } from "../ui/placement/clamp_launcher.js";
92
+ import { clampPanel } from "../ui/placement/clamp_panel.js";
93
+ import { enableLauncherDrag } from "../ui/placement/launcher_drag.js";
81
94
  import {
82
95
  type ExpandCorner,
83
96
  type Extent,
84
97
  type LauncherBox,
85
98
  launcherPlacement,
86
99
  type ViewportBox,
87
- } from "../ui/launcher_placement.js";
88
- import {
89
- attachMessageActions,
90
- messageActionBar,
91
- messageActionButton,
92
- } from "../ui/message_actions.js";
93
- import { attachQuoteOffer, type PageQuoteOffer } from "../ui/page_quote_offer.js";
94
- import { enablePanelDrag } from "../ui/panel_drag.js";
95
- import { placeWidget } from "../ui/place_widget.js";
96
- import { prettifyToolName } from "../ui/prettify_tool_name.js";
97
- import {
98
- type QuestionRenderer,
99
- type QuestionRequest,
100
- requestQuestion,
101
- } from "../ui/question_card.js";
102
- import { asQuote, quotableSelection } from "../ui/quote_selection.js";
103
- import type { RelativeTimeFormatter } from "../ui/relative_time.js";
104
- import { renderMarkdown } from "../ui/render_markdown.js";
100
+ } from "../ui/placement/launcher_placement.js";
101
+ import { enablePanelDrag } from "../ui/placement/panel_drag.js";
102
+ import { placeWidget } from "../ui/placement/place_widget.js";
105
103
  import {
106
104
  createResizeHandle,
107
105
  gripName,
@@ -110,24 +108,35 @@ import {
110
108
  type ResizeAxis,
111
109
  type ResizeGrip,
112
110
  type ResizeSize,
113
- } from "../ui/resize_handle.js";
114
- import { wrapWords } from "../ui/reveal_words.js";
115
- import { renderRunNotice } from "../ui/run_notice.js";
116
- import { SkillsMenu } from "../ui/skills_menu.js";
117
- import { createStickToBottom, type StickToBottom } from "../ui/stick_to_bottom.js";
118
- import { STYLES } from "../ui/styles.js";
119
- import { SubAgentPanel, type SubAgentPhase, type SubAgentUpdate } from "../ui/subagent_panel.js";
120
- import { subAgentUpdate } from "../ui/subagent_update.js";
121
- import { renderSuggestionChips } from "../ui/suggestion_chips.js";
122
- import { ThoughtsBlock } from "../ui/thoughts_block.js";
123
- import { ThreadDrawer } from "../ui/thread_drawer.js";
111
+ } from "../ui/placement/resize_handle.js";
112
+ import { prettifyToolName } from "../ui/progress/prettify_tool_name.js";
113
+ import { renderRunNotice } from "../ui/progress/run_notice.js";
114
+ import {
115
+ SubAgentPanel,
116
+ type SubAgentPhase,
117
+ type SubAgentUpdate,
118
+ } from "../ui/progress/subagent_panel.js";
119
+ import { subAgentUpdate } from "../ui/progress/subagent_update.js";
120
+ import { ThoughtsBlock } from "../ui/progress/thoughts_block.js";
124
121
  import {
125
122
  ToolCallCard,
126
123
  type ToolDisplayMode,
127
124
  type ToolPayloadFormatter,
128
- } from "../ui/tool_call_card.js";
125
+ } from "../ui/progress/tool_call_card.js";
126
+ import { STYLES } from "../ui/styles.js";
127
+ import { renderAttachmentChips } from "../ui/transcript/attachment_chips.js";
128
+ import {
129
+ attachMessageActions,
130
+ messageActionBar,
131
+ messageActionButton,
132
+ } from "../ui/transcript/message_actions.js";
133
+ import { renderMarkdown } from "../ui/transcript/render_markdown.js";
134
+ import { wrapWords } from "../ui/transcript/reveal_words.js";
135
+ import { createStickToBottom, type StickToBottom } from "../ui/transcript/stick_to_bottom.js";
136
+ import { renderSuggestionChips } from "../ui/transcript/suggestion_chips.js";
129
137
  import { DEFAULT_UI_STRINGS, mergeUiStrings, type UiStrings } from "../ui/ui_strings.js";
130
- import { VoiceInput } from "../ui/voice_input.js";
138
+ import type { ActivityRegistration } from "./activity_registration.js";
139
+ import type { ActivityRenderer } from "./activity_renderer.js";
131
140
  import {
132
141
  AgUiClient,
133
142
  type AgUiClientHandlers,
@@ -143,6 +152,17 @@ import {
143
152
  writeStoredItem,
144
153
  } from "./conversation_store.js";
145
154
  import { type AgentFactory, createHttpAgent } from "./create_http_agent.js";
155
+ import type { AttachmentsDetail } from "./events/attachments_detail.js";
156
+ import type { CustomAgentDetail } from "./events/custom_agent_detail.js";
157
+ import type { FeedbackDetail } from "./events/feedback_detail.js";
158
+ import type { InvalidateDetail } from "./events/invalidate_detail.js";
159
+ import type { RunFinishedDetail } from "./events/run_finished_detail.js";
160
+ import type { StateDetail } from "./events/state_detail.js";
161
+ import type { SubmitDetail } from "./events/submit_detail.js";
162
+ import type { ToggleDetail } from "./events/toggle_detail.js";
163
+ import type { ToolRun } from "./events/tool_run.js";
164
+ import type { UnreadDetail } from "./events/unread_detail.js";
165
+ import type { MessageRole } from "./message_role.js";
146
166
  import { RemoteConversationStore } from "./remote_conversation_store.js";
147
167
  import { RunIndex } from "./run_index.js";
148
168
  import { toolStatusFromOutcome } from "./tool_outcome.js";
@@ -150,140 +170,6 @@ import { type TranscribeHandler, transcribeAudio } from "./transcribe_audio.js";
150
170
  import { type UploadHandler, uploadAttachment } from "./upload_attachment.js";
151
171
  import { mintThread, warnOnCrossOriginCredentials, withCredentials } from "./utils.js";
152
172
 
153
- /** The role a rendered chat message takes. */
154
- export type MessageRole = (typeof MESSAGE_ROLE)[keyof typeof MESSAGE_ROLE];
155
-
156
- /** `detail` shape of the {@link SUBMIT_EVENT} CustomEvent. */
157
- export interface SubmitDetail {
158
- readonly content: string;
159
- /** Durable refs for the files attached to this message (empty when none). */
160
- readonly attachments: readonly AttachmentRef[];
161
- }
162
-
163
- /** `detail` shape of the {@link ATTACHMENT_EVENT} CustomEvent. */
164
- export interface AttachmentsDetail {
165
- /** Durable refs for every file that has finished uploading. */
166
- readonly attachments: readonly AttachmentRef[];
167
- /** How many files are still uploading; a send now would leave these behind. */
168
- readonly pending: number;
169
- }
170
-
171
- /** `detail` shape of the {@link STATE_EVENT} CustomEvent. */
172
- /** {@link FEEDBACK_EVENT} detail: what was rated, and how. */
173
- export interface FeedbackDetail {
174
- /** The rated message's text, as rendered. */
175
- readonly content: string;
176
- readonly rating: "up" | "down";
177
- }
178
-
179
- export interface StateDetail {
180
- readonly state: Readonly<Record<string, unknown>>;
181
- }
182
-
183
- /** One tool that ran during an interaction, as {@link RunFinishedDetail} lists it. */
184
- export interface ToolRun {
185
- readonly name: string;
186
- /**
187
- * Where it executed. `"server"` is the one a data-rendering host cares about:
188
- * a `"client"` tool ran in the host's own handler, so the host already knows
189
- * whatever it did.
190
- */
191
- readonly side: "server" | "client";
192
- }
193
-
194
- /** `detail` shape of the {@link RUN_FINISHED_EVENT} CustomEvent. */
195
- export interface RunFinishedDetail {
196
- /** In settle order. Empty when the interaction called no tools. */
197
- readonly tools: readonly ToolRun[];
198
- /**
199
- * Every key announced during the interaction, de-duplicated, first-seen order.
200
- *
201
- * **This is the field that makes adoption one line** for a host already
202
- * listening here, and the `else` is the whole compatibility story:
203
- *
204
- * ```js
205
- * if (detail.invalidated.length > 0) refetchOnly(detail.invalidated);
206
- * else if (detail.tools.some((t) => t.side === "server")) refetchEverything();
207
- * ```
208
- *
209
- * Empty against a server that announces nothing, so an old server and a new
210
- * client fall through to the coarse refetch that shipped before either.
211
- */
212
- readonly invalidated: readonly string[];
213
- }
214
-
215
- /**
216
- * Draw one activity, from its content alone.
217
- *
218
- * The contract is {@link ClientTool.render}'s, and for the same reason rather
219
- * than by analogy. An activity is materialised into a `role: "activity"`
220
- * message, persisted with the transcript, and re-fired on every restore -- so a
221
- * renderer that writes to the page instead of returning DOM fires again on
222
- * every thread load, which is exactly the bug the tool registry's purity rule
223
- * was written to make unmakeable.
224
- *
225
- * - a pure function of `content` -- no host state, no network, no clock;
226
- * - deterministic, so a reload reproduces what was there before;
227
- * - free of effects outside the node it returns, which the component places.
228
- *
229
- * Return `null` for content that says nothing worth drawing. Anything already
230
- * drawn under that message id is then removed: live and reload should agree,
231
- * and the stored content is the version that could not be drawn.
232
- */
233
- export type ActivityRenderer = (content: unknown) => Node | null;
234
-
235
- /** One `activity_type` a host can draw. See {@link AgUiChat.registerActivityRenderer}. */
236
- export interface ActivityRegistration {
237
- /**
238
- * The AG-UI `activity_type` this draws, matched exactly.
239
- *
240
- * An open string the protocol does not enumerate -- which is the whole reason
241
- * this is a registry rather than a branch.
242
- */
243
- readonly type: string;
244
- readonly render: ActivityRenderer;
245
- /**
246
- * Shown in the transcript when something already drawn under this type stops
247
- * being renderable. Omit for an activity whose disappearance needs no
248
- * explanation.
249
- */
250
- readonly removedNotice?: string;
251
- }
252
-
253
- /** `detail` shape of the {@link CUSTOM_AGENT_EVENT} CustomEvent. */
254
- export interface CustomAgentDetail {
255
- /** The `CUSTOM` event's `name`, verbatim. An open string; never interpreted here. */
256
- readonly name: string;
257
- /** Its `value`, verbatim and unparsed. `unknown` because the protocol says nothing about it. */
258
- readonly value: unknown;
259
- }
260
-
261
- /** `detail` shape of the {@link INVALIDATE_EVENT} CustomEvent. */
262
- export interface InvalidateDetail {
263
- /**
264
- * The resources that moved, as the server named them.
265
- *
266
- * **Opaque strings, and matching is exact.** `orders/42` does not imply
267
- * `orders` -- a prefix rule would be this component guessing at a scheme it
268
- * does not own, and `orders/1` would match `orders/11`. A server that wants
269
- * the collection refreshed names it. Your own matching may be hierarchical,
270
- * because in your vocabulary the scheme is known.
271
- */
272
- readonly keys: readonly string[];
273
- /** What caused the write -- usually the tool's name. `null` when unstated. */
274
- readonly reason: string | null;
275
- }
276
-
277
- /** `detail` shape of the {@link TOGGLE_EVENT} CustomEvent. */
278
- export interface ToggleDetail {
279
- readonly collapsed: boolean;
280
- }
281
-
282
- /** `detail` shape of the {@link UNREAD_EVENT} CustomEvent. */
283
- export interface UnreadDetail {
284
- readonly unread: number;
285
- }
286
-
287
173
  /**
288
174
  * Attributes read once while connecting, to decide what chrome exists at all.
289
175
  *
@@ -5508,6 +5394,26 @@ export class AgUiChat extends HTMLElement {
5508
5394
  this.#streamDeltas += 1;
5509
5395
  },
5510
5396
  onTextEnd: (buffer) => {
5397
+ // A text message that carried no content is a declaration, not an
5398
+ // answer, and drawing one puts an empty bubble above every tool call.
5399
+ //
5400
+ // `TOOL_CALL_START` names the assistant message a call belongs to, and
5401
+ // a response whose first part is a tool call has no text to open that
5402
+ // message with. pydantic-ai 2.37 started opening and closing an empty
5403
+ // one there so the id names a message the stream actually announced --
5404
+ // before that it named one no event carried, which a client could only
5405
+ // answer by inventing an id of its own that matches nothing echoed
5406
+ // back. So this envelope is a correctness fix upstream, it is legal
5407
+ // AG-UI, and any server may send one.
5408
+ //
5409
+ // `#renderHistoricMessage` already declines to draw a bubble for an
5410
+ // assistant message with no text. Without the same rule here the live
5411
+ // transcript and the reloaded one disagree about the same
5412
+ // conversation, which is the harder half of the bug to notice.
5413
+ if (buffer === "") {
5414
+ this.#endStream();
5415
+ return;
5416
+ }
5511
5417
  const bubble = this.#streamInto(buffer);
5512
5418
  // Only reveal word-by-word when the message arrived at once. If it
5513
5419
  // streamed across multiple deltas it already revealed progressively, so
@@ -0,0 +1,9 @@
1
+ import type { AttachmentRef } from "../attachment.js";
2
+
3
+ /** `detail` shape of the {@link ATTACHMENT_EVENT} CustomEvent. */
4
+ export interface AttachmentsDetail {
5
+ /** Durable refs for every file that has finished uploading. */
6
+ readonly attachments: readonly AttachmentRef[];
7
+ /** How many files are still uploading; a send now would leave these behind. */
8
+ readonly pending: number;
9
+ }
@@ -0,0 +1,7 @@
1
+ /** `detail` shape of the {@link CUSTOM_AGENT_EVENT} CustomEvent. */
2
+ export interface CustomAgentDetail {
3
+ /** The `CUSTOM` event's `name`, verbatim. An open string; never interpreted here. */
4
+ readonly name: string;
5
+ /** Its `value`, verbatim and unparsed. `unknown` because the protocol says nothing about it. */
6
+ readonly value: unknown;
7
+ }
@@ -0,0 +1,6 @@
1
+ /** {@link FEEDBACK_EVENT} detail: what was rated, and how. */
2
+ export interface FeedbackDetail {
3
+ /** The rated message's text, as rendered. */
4
+ readonly content: string;
5
+ readonly rating: "up" | "down";
6
+ }
@@ -0,0 +1,15 @@
1
+ /** `detail` shape of the {@link INVALIDATE_EVENT} CustomEvent. */
2
+ export interface InvalidateDetail {
3
+ /**
4
+ * The resources that moved, as the server named them.
5
+ *
6
+ * **Opaque strings, and matching is exact.** `orders/42` does not imply
7
+ * `orders` -- a prefix rule would be this component guessing at a scheme it
8
+ * does not own, and `orders/1` would match `orders/11`. A server that wants
9
+ * the collection refreshed names it. Your own matching may be hierarchical,
10
+ * because in your vocabulary the scheme is known.
11
+ */
12
+ readonly keys: readonly string[];
13
+ /** What caused the write -- usually the tool's name. `null` when unstated. */
14
+ readonly reason: string | null;
15
+ }
@@ -0,0 +1,22 @@
1
+ import type { ToolRun } from "./tool_run.js";
2
+
3
+ /** `detail` shape of the {@link RUN_FINISHED_EVENT} CustomEvent. */
4
+ export interface RunFinishedDetail {
5
+ /** In settle order. Empty when the interaction called no tools. */
6
+ readonly tools: readonly ToolRun[];
7
+ /**
8
+ * Every key announced during the interaction, de-duplicated, first-seen order.
9
+ *
10
+ * **This is the field that makes adoption one line** for a host already
11
+ * listening here, and the `else` is the whole compatibility story:
12
+ *
13
+ * ```js
14
+ * if (detail.invalidated.length > 0) refetchOnly(detail.invalidated);
15
+ * else if (detail.tools.some((t) => t.side === "server")) refetchEverything();
16
+ * ```
17
+ *
18
+ * Empty against a server that announces nothing, so an old server and a new
19
+ * client fall through to the coarse refetch that shipped before either.
20
+ */
21
+ readonly invalidated: readonly string[];
22
+ }
@@ -0,0 +1,4 @@
1
+ /** `detail` shape of the {@link STATE_EVENT} CustomEvent. */
2
+ export interface StateDetail {
3
+ readonly state: Readonly<Record<string, unknown>>;
4
+ }
@@ -0,0 +1,8 @@
1
+ import type { AttachmentRef } from "../attachment.js";
2
+
3
+ /** `detail` shape of the {@link SUBMIT_EVENT} CustomEvent. */
4
+ export interface SubmitDetail {
5
+ readonly content: string;
6
+ /** Durable refs for the files attached to this message (empty when none). */
7
+ readonly attachments: readonly AttachmentRef[];
8
+ }
@@ -0,0 +1,4 @@
1
+ /** `detail` shape of the {@link TOGGLE_EVENT} CustomEvent. */
2
+ export interface ToggleDetail {
3
+ readonly collapsed: boolean;
4
+ }
@@ -0,0 +1,10 @@
1
+ /** One tool that ran during an interaction, as {@link RunFinishedDetail} lists it. */
2
+ export interface ToolRun {
3
+ readonly name: string;
4
+ /**
5
+ * Where it executed. `"server"` is the one a data-rendering host cares about:
6
+ * a `"client"` tool ran in the host's own handler, so the host already knows
7
+ * whatever it did.
8
+ */
9
+ readonly side: "server" | "client";
10
+ }
@@ -0,0 +1,4 @@
1
+ /** `detail` shape of the {@link UNREAD_EVENT} CustomEvent. */
2
+ export interface UnreadDetail {
3
+ readonly unread: number;
4
+ }
@@ -0,0 +1,4 @@
1
+ import type { MESSAGE_ROLE } from "../constants.js";
2
+
3
+ /** The role a rendered chat message takes. */
4
+ export type MessageRole = (typeof MESSAGE_ROLE)[keyof typeof MESSAGE_ROLE];
@@ -1,5 +1,5 @@
1
1
  import { TOOL_CALL_STATUS, TOOL_OUTCOME } from "../constants.js";
2
- import type { SettledStatus } from "../ui/tool_call_card.js";
2
+ import type { SettledStatus } from "../ui/progress/tool_call_card.js";
3
3
 
4
4
  /**
5
5
  * How a tool call ended, in the wire's own words. See {@link TOOL_OUTCOME}.
package/src/index.ts CHANGED
@@ -27,22 +27,9 @@ export {
27
27
  X_NAVIGATES_KEY,
28
28
  X_SUMMARY_KEY,
29
29
  } from "./constants.js";
30
- export {
31
- type ActivityRegistration,
32
- type ActivityRenderer,
33
- AgUiChat,
34
- type AttachmentsDetail,
35
- type CustomAgentDetail,
36
- type FeedbackDetail,
37
- type InvalidateDetail,
38
- type MessageRole,
39
- type RunFinishedDetail,
40
- type StateDetail,
41
- type SubmitDetail,
42
- type ToggleDetail,
43
- type ToolRun,
44
- type UnreadDetail,
45
- } from "./core/ag_ui_chat.js";
30
+ export type { ActivityRegistration } from "./core/activity_registration.js";
31
+ export type { ActivityRenderer } from "./core/activity_renderer.js";
32
+ export { AgUiChat } from "./core/ag_ui_chat.js";
46
33
  export {
47
34
  AgUiClient,
48
35
  type AgUiClientConfig,
@@ -68,6 +55,17 @@ export {
68
55
  type HttpAgentOptions,
69
56
  } from "./core/create_http_agent.js";
70
57
  export { defineAgUiChat } from "./core/define_ag_ui_chat.js";
58
+ export type { AttachmentsDetail } from "./core/events/attachments_detail.js";
59
+ export type { CustomAgentDetail } from "./core/events/custom_agent_detail.js";
60
+ export type { FeedbackDetail } from "./core/events/feedback_detail.js";
61
+ export type { InvalidateDetail } from "./core/events/invalidate_detail.js";
62
+ export type { RunFinishedDetail } from "./core/events/run_finished_detail.js";
63
+ export type { StateDetail } from "./core/events/state_detail.js";
64
+ export type { SubmitDetail } from "./core/events/submit_detail.js";
65
+ export type { ToggleDetail } from "./core/events/toggle_detail.js";
66
+ export type { ToolRun } from "./core/events/tool_run.js";
67
+ export type { UnreadDetail } from "./core/events/unread_detail.js";
68
+ export type { MessageRole } from "./core/message_role.js";
71
69
  export { RemoteConversationStore } from "./core/remote_conversation_store.js";
72
70
  export { RunIndex, type RunRow } from "./core/run_index.js";
73
71
  export { type ToolOutcome, toolStatusFromOutcome } from "./core/tool_outcome.js";
@@ -149,42 +147,18 @@ export {
149
147
  type RouteMap,
150
148
  type RouteWithParams,
151
149
  } from "./tools/route_map.js";
152
- export {
153
- type ApprovalOptions,
154
- type ApprovalRenderer,
155
- type ApprovalRequest,
156
- requestApproval,
157
- } from "./ui/approval_card.js";
158
150
  // Charts. `CHART_ACTIVITY_TYPE` above is the wire name a server sets on an
159
151
  // ACTIVITY_SNAPSHOT; these are the shape it carries and the renderer itself,
160
152
  // for a host building its own visual on the same seam.
161
- export type { ChartKind, ChartSeries, ChartSpec } from "./ui/chart_block.js";
162
- export { renderChart } from "./ui/chart_block.js";
163
- export { chartSpecFrom } from "./ui/chart_spec_from.js";
164
- export { CHART_TOOL_NAME } from "./ui/chart_tool.js";
165
- export { CheckpointMenu, type CheckpointVerb } from "./ui/checkpoint_menu.js";
166
- export {
167
- type ConfirmationOptions,
168
- type ConfirmationRequest,
169
- requestConfirmation,
170
- } from "./ui/confirmation_card.js";
171
- export {
172
- attachMessageActions,
173
- type MessageActionsOptions,
174
- messageActionBar,
175
- } from "./ui/message_actions.js";
153
+ export type { ChartKind, ChartSeries, ChartSpec } from "./ui/charts/chart_block.js";
154
+ export { renderChart } from "./ui/charts/chart_block.js";
155
+ export { chartSpecFrom } from "./ui/charts/chart_spec_from.js";
156
+ export { CHART_TOOL_NAME } from "./ui/charts/chart_tool.js";
176
157
  export {
177
158
  attachQuoteOffer,
178
159
  type PageQuoteOffer,
179
160
  type PageQuoteOfferOptions,
180
- } from "./ui/page_quote_offer.js";
181
- export { prettifyToolName } from "./ui/prettify_tool_name.js";
182
- export {
183
- type QuestionOptions,
184
- type QuestionRenderer,
185
- type QuestionRequest,
186
- requestQuestion,
187
- } from "./ui/question_card.js";
161
+ } from "./ui/excerpts/page_quote_offer.js";
188
162
  // Quoting. The transcript wires these itself; they are exported for the half
189
163
  // the component cannot reach -- a selection made in the **host page**, which
190
164
  // a host reads its own way and hands to `AgUiChat.quote()`.
@@ -193,18 +167,30 @@ export {
193
167
  MAX_QUOTE_CHARS,
194
168
  type QuotableSelection,
195
169
  quotableSelection,
196
- } from "./ui/quote_selection.js";
170
+ } from "./ui/excerpts/quote_selection.js";
171
+ export { CheckpointMenu, type CheckpointVerb } from "./ui/history/checkpoint_menu.js";
197
172
  export {
198
173
  type RelativeTimeFormatter,
199
174
  relativeTime,
200
- } from "./ui/relative_time.js";
201
- export { type RenderMarkdownOptions, renderMarkdown } from "./ui/render_markdown.js";
175
+ } from "./ui/history/relative_time.js";
202
176
  export {
203
- MAX_SUGGESTION_CHARS,
204
- MAX_SUGGESTIONS,
205
- renderSuggestionChips,
206
- suggestionPrompts,
207
- } from "./ui/suggestion_chips.js";
177
+ type ApprovalOptions,
178
+ type ApprovalRenderer,
179
+ type ApprovalRequest,
180
+ requestApproval,
181
+ } from "./ui/interrupts/approval_card.js";
182
+ export {
183
+ type ConfirmationOptions,
184
+ type ConfirmationRequest,
185
+ requestConfirmation,
186
+ } from "./ui/interrupts/confirmation_card.js";
187
+ export {
188
+ type QuestionOptions,
189
+ type QuestionRenderer,
190
+ type QuestionRequest,
191
+ requestQuestion,
192
+ } from "./ui/interrupts/question_card.js";
193
+ export { prettifyToolName } from "./ui/progress/prettify_tool_name.js";
208
194
  export {
209
195
  type SettledStatus,
210
196
  ToolCallCard,
@@ -213,6 +199,18 @@ export {
213
199
  type ToolDisplayMode,
214
200
  type ToolPayload,
215
201
  type ToolPayloadFormatter,
216
- } from "./ui/tool_call_card.js";
202
+ } from "./ui/progress/tool_call_card.js";
203
+ export {
204
+ attachMessageActions,
205
+ type MessageActionsOptions,
206
+ messageActionBar,
207
+ } from "./ui/transcript/message_actions.js";
208
+ export { type RenderMarkdownOptions, renderMarkdown } from "./ui/transcript/render_markdown.js";
209
+ export {
210
+ MAX_SUGGESTION_CHARS,
211
+ MAX_SUGGESTIONS,
212
+ renderSuggestionChips,
213
+ suggestionPrompts,
214
+ } from "./ui/transcript/suggestion_chips.js";
217
215
  export { DEFAULT_UI_STRINGS, mergeUiStrings, type UiStrings } from "./ui/ui_strings.js";
218
216
  export { VERSION } from "./version.js";
@@ -8,7 +8,7 @@
8
8
  * tool against the same seam.
9
9
  */
10
10
 
11
- import type { ClientTool } from "../tools/client_tool_registry.js";
11
+ import type { ClientTool } from "../../tools/client_tool_registry.js";
12
12
  import { renderChart } from "./chart_block.js";
13
13
  import { chartSpecFrom } from "./chart_spec_from.js";
14
14
 
@@ -1,9 +1,9 @@
1
1
  import { randomUUID } from "@ag-ui/client";
2
- import { ATTACHMENT_STATUS } from "../constants.js";
3
- import type { AttachmentRef } from "../core/attachment.js";
4
- import type { UploadHandler } from "../core/upload_attachment.js";
5
- import { formatBytes, iconFor } from "./attachment_chips.js";
6
- import { DEFAULT_UI_STRINGS, type UiStrings } from "./ui_strings.js";
2
+ import { ATTACHMENT_STATUS } from "../../constants.js";
3
+ import type { AttachmentRef } from "../../core/attachment.js";
4
+ import type { UploadHandler } from "../../core/upload_attachment.js";
5
+ import { formatBytes, iconFor } from "../transcript/attachment_chips.js";
6
+ import { DEFAULT_UI_STRINGS, type UiStrings } from "../ui_strings.js";
7
7
 
8
8
  /** Status of a pending tray chip. */
9
9
  type AttachmentStatus = (typeof ATTACHMENT_STATUS)[keyof typeof ATTACHMENT_STATUS];
@@ -1,4 +1,4 @@
1
- import type { Skill } from "../skills/skill.js";
1
+ import type { Skill } from "../../skills/skill.js";
2
2
 
3
3
  /**
4
4
  * The two skill surfaces over a single catalog: a chips row (the `chip: true`
@@ -1,6 +1,6 @@
1
- import { ICON_VOICE } from "../constants.js";
2
- import type { TranscribeHandler } from "../core/transcribe_audio.js";
3
- import { DEFAULT_UI_STRINGS, type UiStrings } from "./ui_strings.js";
1
+ import { ICON_VOICE } from "../../constants.js";
2
+ import type { TranscribeHandler } from "../../core/transcribe_audio.js";
3
+ import { DEFAULT_UI_STRINGS, type UiStrings } from "../ui_strings.js";
4
4
 
5
5
  /** Lifecycle of the mic button, reflected on its `data-state` for CSS. */
6
6
  type VoiceState = "idle" | "recording" | "transcribing";
@@ -1,4 +1,4 @@
1
- import type { UiStrings } from "./ui_strings.js";
1
+ import type { UiStrings } from "../ui_strings.js";
2
2
 
3
3
  /** How long the button shows its "copied" confirmation before reverting. */
4
4
  const CONFIRM_MS = 1500;
@@ -1,6 +1,6 @@
1
- import type { RunRow } from "../core/run_index.js";
1
+ import type { RunRow } from "../../core/run_index.js";
2
+ import { DEFAULT_UI_STRINGS, type UiStrings } from "../ui_strings.js";
2
3
  import { type RelativeTimeFormatter, relativeTime } from "./relative_time.js";
3
- import { DEFAULT_UI_STRINGS, type UiStrings } from "./ui_strings.js";
4
4
 
5
5
  /** How the host continues a picked run. */
6
6
  export type CheckpointVerb = "resume" | "fork";
@@ -1,4 +1,4 @@
1
- import { DEFAULT_UI_STRINGS, type UiStrings } from "./ui_strings.js";
1
+ import { DEFAULT_UI_STRINGS, type UiStrings } from "../ui_strings.js";
2
2
 
3
3
  /**
4
4
  * A compact relative timestamp for a thread row — e.g. `"just now"`, `"5m ago"`,