@adecore/agents-react 0.62.1 → 0.63.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 (549) hide show
  1. package/dist/agents/AccountDot.js +1 -1
  2. package/dist/agents/AgentIcon.js +43 -51
  3. package/dist/agents/accounts.d.ts +3 -6
  4. package/dist/agents/model-name.d.ts +2 -1
  5. package/dist/agents/model-requirement.d.ts +2 -1
  6. package/dist/agents/provider-paths.d.ts +1 -1
  7. package/dist/agents/status-look.d.ts +3 -2
  8. package/dist/chat/account-choice.d.ts +2 -1
  9. package/dist/chat/account-choice.js +2 -1
  10. package/dist/chat/actions.d.ts +1 -3
  11. package/dist/chat/actions.js +2 -2
  12. package/dist/chat/attachments.js +0 -2
  13. package/dist/chat/bookmarks.d.ts +1 -1
  14. package/dist/chat/chat-references.d.ts +1 -30
  15. package/dist/chat/chat-references.js +0 -12
  16. package/dist/chat/drafts.js +1 -1
  17. package/dist/chat/forks.js +0 -2
  18. package/dist/chat/guards.js +0 -1
  19. package/dist/chat/index.d.ts +20 -24
  20. package/dist/chat/index.js +6 -6
  21. package/dist/chat/logic/ansi.d.ts +2 -1
  22. package/dist/chat/logic/bookmarks.d.ts +1 -1
  23. package/dist/chat/logic/command-looks.d.ts +4 -3
  24. package/dist/chat/logic/command-looks.js +0 -2
  25. package/dist/chat/logic/context-usage.d.ts +2 -2
  26. package/dist/chat/logic/context-usage.js +1 -1
  27. package/dist/chat/logic/effort.d.ts +2 -1
  28. package/dist/chat/logic/embedded-code.d.ts +4 -3
  29. package/dist/chat/logic/embedded-code.js +0 -1
  30. package/dist/chat/logic/fork.d.ts +11 -6
  31. package/dist/chat/logic/fork.js +12 -9
  32. package/dist/chat/logic/generated-image.d.ts +2 -1
  33. package/dist/chat/logic/generated-image.js +0 -2
  34. package/dist/chat/logic/goal.d.ts +2 -1
  35. package/dist/chat/logic/limit.d.ts +2 -1
  36. package/dist/chat/logic/picker-entries.d.ts +4 -10
  37. package/dist/chat/logic/picker-entries.js +2 -13
  38. package/dist/chat/logic/resume-compaction.js +0 -1
  39. package/dist/chat/logic/scrubber.d.ts +5 -5
  40. package/dist/chat/logic/scrubber.js +1 -3
  41. package/dist/chat/logic/steer.d.ts +2 -0
  42. package/dist/chat/logic/steer.js +4 -0
  43. package/dist/chat/logic/thought.js +0 -1
  44. package/dist/chat/logic/thread-cards.d.ts +4 -4
  45. package/dist/chat/logic/thread-cards.js +1 -1
  46. package/dist/chat/logic/timeline-copy.d.ts +1 -1
  47. package/dist/chat/logic/timeline-copy.js +0 -2
  48. package/dist/chat/logic/timeline-target.d.ts +4 -3
  49. package/dist/chat/logic/timeline-target.js +0 -1
  50. package/dist/chat/logic/timeline.d.ts +3 -133
  51. package/dist/chat/logic/timeline.js +0 -2
  52. package/dist/chat/logic/tool-catalog.d.ts +2 -1
  53. package/dist/chat/logic/tool-looks.d.ts +4 -3
  54. package/dist/chat/logic/tool-looks.js +0 -1
  55. package/dist/chat/logic/tools.d.ts +3 -2
  56. package/dist/chat/logic/tools.js +11 -32
  57. package/dist/chat/logic/visual-height.js +0 -1
  58. package/dist/chat/logic/welcome.d.ts +2 -1
  59. package/dist/chat/logic/workflow.d.ts +3 -2
  60. package/dist/chat/logic/workflow.js +0 -1
  61. package/dist/chat/mentions.d.ts +3 -3
  62. package/dist/chat/mentions.js +1 -2
  63. package/dist/chat/pending-prompts.d.ts +1 -1
  64. package/dist/chat/preferences.js +1 -2
  65. package/dist/chat/prompt-hold.js +0 -1
  66. package/dist/chat/prompts/index.d.ts +11 -0
  67. package/dist/{prompts → chat/prompts}/index.js +2 -0
  68. package/dist/{prompts → chat/prompts}/logic/keys.d.ts +4 -3
  69. package/dist/{prompts → chat/prompts}/logic/prompts.d.ts +2 -26
  70. package/dist/{prompts → chat/prompts}/logic/prompts.js +1 -1
  71. package/dist/{prompts → chat/prompts}/logic/subjects.d.ts +2 -38
  72. package/dist/{prompts → chat/prompts}/logic/useFocusAfterAnswer.d.ts +2 -1
  73. package/dist/{prompts → chat/prompts}/logic/usePromptSession.d.ts +2 -2
  74. package/dist/{prompts → chat/prompts}/logic/usePromptSession.js +2 -1
  75. package/dist/{prompts → chat/prompts}/ui/ApprovalBody.d.ts +1 -5
  76. package/dist/{prompts → chat/prompts}/ui/ApprovalBody.js +5 -6
  77. package/dist/{prompts → chat/prompts}/ui/PromptActions.d.ts +2 -1
  78. package/dist/{prompts → chat/prompts}/ui/PromptActions.js +0 -1
  79. package/dist/{prompts → chat/prompts}/ui/PromptCard.d.ts +1 -1
  80. package/dist/{prompts → chat/prompts}/ui/PromptCard.js +1 -1
  81. package/dist/{prompts → chat/prompts}/ui/PromptView.d.ts +1 -1
  82. package/dist/{prompts → chat/prompts}/ui/PromptView.js +4 -2
  83. package/dist/{prompts → chat/prompts}/ui/QuestionBody.d.ts +1 -1
  84. package/dist/{prompts → chat/prompts}/ui/QuestionBody.js +2 -2
  85. package/dist/chat/reading-width.js +2 -1
  86. package/dist/chat/recent-messages.d.ts +2 -6
  87. package/dist/chat/recent-messages.js +1 -1
  88. package/dist/chat/send-key.js +0 -1
  89. package/dist/chat/stash.d.ts +3 -2
  90. package/dist/chat/stash.js +1 -1
  91. package/dist/chat/subagent-conversation.d.ts +0 -1
  92. package/dist/chat/subagent-conversation.js +1 -1
  93. package/dist/chat/subagent-list.d.ts +3 -3
  94. package/dist/chat/subagent-list.js +2 -6
  95. package/dist/chat/subagent-view.d.ts +1 -1
  96. package/dist/chat/subagent-view.js +0 -1
  97. package/dist/chat/tag-suggestions.d.ts +3 -4
  98. package/dist/chat/tag-suggestions.js +3 -3
  99. package/dist/chat/thumbnails.d.ts +2 -1
  100. package/dist/chat/thumbnails.js +0 -1
  101. package/dist/chat/timeline-flash.d.ts +1 -1
  102. package/dist/chat/ui/BookmarkMarker.js +1 -1
  103. package/dist/chat/ui/BookmarkSubmenu.js +2 -2
  104. package/dist/chat/ui/ChatActivity.js +8 -48
  105. package/dist/chat/ui/CodeBlock.js +1 -1
  106. package/dist/chat/ui/Composer.d.ts +1 -1
  107. package/dist/chat/ui/Composer.js +174 -209
  108. package/dist/chat/ui/ComposerInput.d.ts +1 -1
  109. package/dist/chat/ui/ComposerInput.js +1 -1
  110. package/dist/chat/ui/EditDiff.js +2 -3
  111. package/dist/chat/ui/GoalDock.js +1 -1
  112. package/dist/chat/ui/HostMenuItems.d.ts +1 -1
  113. package/dist/chat/ui/HostMenuItems.js +0 -1
  114. package/dist/chat/ui/ImageView.d.ts +3 -2
  115. package/dist/chat/ui/LimitState.js +2 -2
  116. package/dist/chat/ui/Markdown.d.ts +1 -1
  117. package/dist/chat/ui/Markdown.js +1 -2
  118. package/dist/chat/ui/MermaidBlock.js +1 -1
  119. package/dist/chat/ui/MessageActions.d.ts +1 -1
  120. package/dist/chat/ui/MessageActions.js +94 -88
  121. package/dist/chat/ui/Pickers.d.ts +1 -1
  122. package/dist/chat/ui/Pickers.js +4 -3
  123. package/dist/chat/ui/PromptComposer.d.ts +1 -1
  124. package/dist/chat/ui/PromptComposer.js +9 -8
  125. package/dist/chat/ui/PromptEditor.d.ts +1 -1
  126. package/dist/chat/ui/PromptEditor.js +1 -1
  127. package/dist/chat/ui/ReferenceChip.js +1 -1
  128. package/dist/chat/ui/ReferenceTrail.d.ts +2 -2
  129. package/dist/chat/ui/RunSettings.js +3 -3
  130. package/dist/chat/ui/SessionLine.d.ts +1 -1
  131. package/dist/chat/ui/SessionLine.js +2 -1
  132. package/dist/chat/ui/ShellCommand.d.ts +1 -1
  133. package/dist/chat/ui/ShellCommand.js +1 -3
  134. package/dist/chat/ui/SubagentInfo.js +4 -3
  135. package/dist/chat/ui/SubagentStopButton.js +1 -1
  136. package/dist/chat/ui/SubagentTimeline.js +2 -2
  137. package/dist/chat/ui/Timeline.js +6 -4
  138. package/dist/chat/ui/TimelineMenu.js +125 -119
  139. package/dist/chat/ui/UnifiedDiff.js +2 -3
  140. package/dist/chat/ui/VisualFrame.d.ts +3 -2
  141. package/dist/chat/ui/VisualFrame.js +1 -1
  142. package/dist/chat/ui/chip-clipboard.d.ts +1 -2
  143. package/dist/chat/ui/chip-clipboard.js +1 -1
  144. package/dist/chat/ui/code-theme.d.ts +1 -1
  145. package/dist/chat/ui/code-theme.js +2 -2
  146. package/dist/chat/ui/composer/ComposerControls.d.ts +0 -3
  147. package/dist/chat/ui/composer/ComposerControls.js +60 -215
  148. package/dist/chat/ui/composer/ComposerMenu.js +1 -1
  149. package/dist/chat/ui/composer/ComposerStatusLine.d.ts +1 -1
  150. package/dist/chat/ui/composer/DraftParts.js +0 -1
  151. package/dist/chat/ui/composer/chip-paste.d.ts +1 -1
  152. package/dist/chat/ui/composer/chip-paste.js +0 -1
  153. package/dist/chat/ui/composer/chips.d.ts +4 -3
  154. package/dist/chat/ui/composer/chips.js +0 -1
  155. package/dist/chat/ui/composer/editor.d.ts +2 -1
  156. package/dist/chat/ui/composer/key-handler.d.ts +1 -1
  157. package/dist/chat/ui/composer/key-handler.js +0 -1
  158. package/dist/chat/ui/composer/keys.d.ts +4 -3
  159. package/dist/chat/ui/composer/keys.js +0 -4
  160. package/dist/chat/ui/composer/placeholder.js +1 -1
  161. package/dist/chat/ui/composer/prompt-picks.d.ts +2 -2
  162. package/dist/chat/ui/composer/prompt-picks.js +1 -0
  163. package/dist/chat/ui/composer/use-chat-controls.js +2 -2
  164. package/dist/chat/ui/composer/use-composer-menus.d.ts +0 -1
  165. package/dist/chat/ui/composer/use-composer-menus.js +2 -2
  166. package/dist/chat/ui/composer/use-composer-submit.d.ts +1 -1
  167. package/dist/chat/ui/composer/use-composer-submit.js +1 -1
  168. package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
  169. package/dist/chat/ui/composer/use-draft-files.d.ts +1 -1
  170. package/dist/chat/ui/composer/use-draft-files.js +1 -1
  171. package/dist/chat/ui/composer/use-pending-requests.d.ts +1 -1
  172. package/dist/chat/ui/composer/use-prompt-menus.d.ts +6 -5
  173. package/dist/chat/ui/composer/use-prompt-menus.js +3 -2
  174. package/dist/chat/ui/composer/use-take-back.js +1 -2
  175. package/dist/chat/ui/diff/EditorEditDiff.js +1 -1
  176. package/dist/chat/ui/diff/LegacyDiffPool.js +1 -1
  177. package/dist/chat/ui/diff/LegacyEditDiff.js +1 -1
  178. package/dist/chat/ui/diff/LegacyUnifiedDiff.js +1 -1
  179. package/dist/chat/ui/diff/ReviewDiff.js +1 -2
  180. package/dist/chat/ui/diff/diff-source-budget.d.ts +0 -7
  181. package/dist/chat/ui/diff/diff-source-budget.js +1 -1
  182. package/dist/chat/ui/diff/review-plan.d.ts +2 -2
  183. package/dist/chat/ui/diff/review-plan.js +1 -1
  184. package/dist/chat/ui/diff/syntax-runtime.d.ts +1 -1
  185. package/dist/chat/ui/diff-theme.js +2 -2
  186. package/dist/chat/ui/file-links.d.ts +1 -1
  187. package/dist/chat/ui/file-links.js +1 -2
  188. package/dist/chat/ui/highlighter.d.ts +1 -1
  189. package/dist/chat/ui/highlighter.js +1 -2
  190. package/dist/chat/ui/index.d.ts +9 -17
  191. package/dist/chat/ui/index.js +3 -9
  192. package/dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts +2 -1
  193. package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +1 -1
  194. package/dist/chat/ui/intelligent-ui/UiFallbackPart.d.ts +2 -1
  195. package/dist/chat/ui/intelligent-ui/UiReply.js +1 -1
  196. package/dist/chat/ui/intelligent-ui/chart-data.d.ts +1 -1
  197. package/dist/chat/ui/intelligent-ui/render-context.d.ts +1 -1
  198. package/dist/chat/ui/intelligent-ui/renderers/chart.js +0 -2
  199. package/dist/chat/ui/intelligent-ui/renderers/choices.js +1 -1
  200. package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +2 -1
  201. package/dist/chat/ui/intelligent-ui/renderers/content.js +2 -2
  202. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +0 -1
  203. package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +1 -5
  204. package/dist/chat/ui/intelligent-ui/renderers/links.js +1 -1
  205. package/dist/chat/ui/intelligent-ui/renderers/map-slots.d.ts +2 -2
  206. package/dist/chat/ui/intelligent-ui/renderers/map-slots.js +1 -1
  207. package/dist/chat/ui/intelligent-ui/renderers/map-style.d.ts +3 -8
  208. package/dist/chat/ui/intelligent-ui/renderers/map-style.js +3 -5
  209. package/dist/chat/ui/intelligent-ui/renderers/map-view.d.ts +1 -1
  210. package/dist/chat/ui/intelligent-ui/renderers/map-view.js +2 -2
  211. package/dist/chat/ui/intelligent-ui/renderers/map.js +3 -4
  212. package/dist/chat/ui/intelligent-ui/reply-parts.d.ts +2 -1
  213. package/dist/chat/ui/intelligent-ui/table-data.d.ts +2 -1
  214. package/dist/chat/ui/intelligent-ui/use-ui-links.js +1 -1
  215. package/dist/chat/ui/intelligent-ui/use-ui-queries.js +1 -1
  216. package/dist/chat/ui/markdown-blocks.js +0 -1
  217. package/dist/chat/ui/named-chip-look.d.ts +1 -1
  218. package/dist/chat/ui/named-chip-look.js +1 -1
  219. package/dist/chat/ui/reference-icons.d.ts +2 -2
  220. package/dist/chat/ui/reference-lookup.d.ts +2 -2
  221. package/dist/chat/ui/rehype-fade.js +0 -1
  222. package/dist/chat/ui/reveal.d.ts +2 -3
  223. package/dist/chat/ui/reveal.js +2 -2
  224. package/dist/chat/ui/rows/ForksRow.js +1 -1
  225. package/dist/chat/ui/rows/GeneratedImageRow.js +2 -2
  226. package/dist/chat/ui/rows/MessageRows.d.ts +1 -1
  227. package/dist/chat/ui/rows/MessageRows.js +2 -3
  228. package/dist/chat/ui/rows/RowContainer.d.ts +3 -2
  229. package/dist/chat/ui/rows/RowContainer.js +1 -1
  230. package/dist/chat/ui/rows/Rows.d.ts +1 -1
  231. package/dist/chat/ui/rows/SubagentRow.d.ts +2 -2
  232. package/dist/chat/ui/rows/SubagentRow.js +6 -6
  233. package/dist/chat/ui/rows/TaskRow.d.ts +1 -1
  234. package/dist/chat/ui/rows/VisualRow.js +1 -1
  235. package/dist/chat/ui/rows/WorkRows.d.ts +3 -2
  236. package/dist/chat/ui/rows/WorkRows.js +4 -8
  237. package/dist/chat/ui/rows/WorkflowRow.js +1 -1
  238. package/dist/chat/ui/rows/row-rhythm.d.ts +1 -1
  239. package/dist/chat/ui/rows/row-rhythm.js +1 -0
  240. package/dist/chat/ui/thread-references.d.ts +0 -2
  241. package/dist/chat/ui/thread-references.js +3 -3
  242. package/dist/chat/ui/use-diff-source-tokens.js +1 -1
  243. package/dist/chat/ui/useToggleSet.d.ts +2 -1
  244. package/dist/chat/ui/visual-theme.js +1 -1
  245. package/dist/chat/visual-bridge.js +0 -1
  246. package/dist/chat/waiting-on.js +1 -1
  247. package/dist/chat/workflow-list.d.ts +2 -1
  248. package/dist/{chat/chat-client.d.ts → chat-client.d.ts} +2 -2
  249. package/dist/{chat/chat-client.js → chat-client.js} +2 -2
  250. package/dist/chat-sink.d.ts +20 -0
  251. package/dist/chat-sink.js +1 -0
  252. package/dist/{ui → host}/PlainTextarea.d.ts +1 -1
  253. package/dist/{host-hooks.d.ts → host/host-hooks.d.ts} +3 -6
  254. package/dist/{host-hooks.js → host/host-hooks.js} +2 -13
  255. package/dist/{host.d.ts → host/host.d.ts} +27 -25
  256. package/dist/{host.js → host/host.js} +65 -32
  257. package/dist/host/prompts.d.ts +61 -0
  258. package/dist/host/prompts.js +1 -0
  259. package/dist/host/references.d.ts +31 -0
  260. package/dist/host/references.js +12 -0
  261. package/dist/host/timeline-row.d.ts +133 -0
  262. package/dist/host/timeline-row.js +1 -0
  263. package/dist/images.d.ts +1 -1
  264. package/dist/images.js +1 -1
  265. package/dist/index.d.ts +3 -5
  266. package/dist/index.js +1 -3
  267. package/dist/locales/en/agent-chat.d.ts +1 -1
  268. package/dist/locales/en/agent-chat.js +1 -1
  269. package/dist/locales/nl/agent-chat.d.ts +1 -1
  270. package/dist/locales/nl/agent-chat.js +1 -1
  271. package/dist/locales.d.ts +1 -1
  272. package/dist/{chat/persisted-json.d.ts → persisted-json.d.ts} +2 -1
  273. package/dist/{chat/persisted-json.js → persisted-json.js} +1 -1
  274. package/dist/providers/AccountColors.js +1 -2
  275. package/dist/providers/AccountDetail.js +2 -3
  276. package/dist/providers/AccountVariables.js +1 -1
  277. package/dist/providers/AddAccountForm.js +1 -1
  278. package/dist/providers/CliDetail.js +2 -3
  279. package/dist/providers/InstallPage.js +2 -3
  280. package/dist/providers/ProviderList.js +0 -1
  281. package/dist/providers/ProvidersPane.js +2 -3
  282. package/dist/providers/account-actions.d.ts +2 -3
  283. package/dist/providers/account-actions.js +1 -1
  284. package/dist/providers/index.d.ts +2 -4
  285. package/dist/providers/index.js +1 -1
  286. package/dist/providers/install-steps.js +0 -1
  287. package/dist/providers/provider-abilities.d.ts +1 -2
  288. package/dist/providers/provider-abilities.js +0 -5
  289. package/dist/providers/variables.js +0 -1
  290. package/dist/scope.d.ts +1 -1
  291. package/dist/settings/sections.d.ts +2 -1
  292. package/dist/state/chats.d.ts +2 -20
  293. package/dist/state/chats.js +0 -2
  294. package/dist/state/index.d.ts +4 -3
  295. package/dist/state/provider-accounts.js +0 -1
  296. package/dist/state/usage.d.ts +2 -2
  297. package/dist/state/usage.js +1 -1
  298. package/dist/storage.d.ts +4 -3
  299. package/dist/testing/prompts.d.ts +1 -1
  300. package/dist/usage/ChartLogo.js +0 -1
  301. package/dist/usage/LimitsList.d.ts +1 -1
  302. package/dist/usage/LimitsList.js +3 -7
  303. package/dist/usage/UsageBreakdown.js +1 -5
  304. package/dist/usage/UsageLimits.js +2 -3
  305. package/dist/usage/UsagePage.js +3 -3
  306. package/dist/usage/UsageTiles.js +0 -1
  307. package/dist/usage/format.d.ts +1 -2
  308. package/dist/usage/format.js +0 -2
  309. package/dist/usage/index.d.ts +2 -3
  310. package/dist/usage/index.js +1 -2
  311. package/dist/usage/limit-groups.d.ts +0 -1
  312. package/dist/usage/limit-groups.js +0 -2
  313. package/dist/usage/limits.js +0 -1
  314. package/dist/usage/summary.d.ts +3 -2
  315. package/dist/usage/summary.js +0 -1
  316. package/package.json +19 -12
  317. package/src/agents/AccountDot.tsx +1 -1
  318. package/src/agents/AgentIcon.tsx +2 -2
  319. package/src/agents/accounts.ts +2 -5
  320. package/src/agents/model-name.ts +1 -1
  321. package/src/agents/model-requirement.ts +1 -1
  322. package/src/agents/provider-paths.ts +1 -1
  323. package/src/agents/status-look.ts +2 -2
  324. package/src/chat/account-choice.ts +3 -11
  325. package/src/chat/actions.ts +2 -2
  326. package/src/chat/attachments.ts +0 -2
  327. package/src/chat/bookmarks.ts +1 -1
  328. package/src/chat/chat-references.ts +1 -64
  329. package/src/chat/drafts.ts +1 -1
  330. package/src/chat/forks.ts +0 -2
  331. package/src/chat/guards.ts +0 -2
  332. package/src/chat/index.ts +21 -38
  333. package/src/chat/logic/ansi.ts +1 -1
  334. package/src/chat/logic/bookmarks.ts +1 -1
  335. package/src/chat/logic/command-looks.ts +3 -7
  336. package/src/chat/logic/context-usage.ts +2 -2
  337. package/src/chat/logic/effort.ts +1 -1
  338. package/src/chat/logic/embedded-code.ts +3 -7
  339. package/src/chat/logic/fork.ts +23 -13
  340. package/src/chat/logic/generated-image.ts +1 -3
  341. package/src/chat/logic/goal.ts +1 -1
  342. package/src/chat/logic/limit.ts +1 -1
  343. package/src/chat/logic/picker-entries.ts +5 -19
  344. package/src/chat/logic/resume-compaction.ts +0 -1
  345. package/src/chat/logic/scrubber.ts +6 -9
  346. package/src/chat/logic/steer.ts +6 -0
  347. package/src/chat/logic/thought.ts +0 -1
  348. package/src/chat/logic/thread-cards.ts +4 -4
  349. package/src/chat/logic/timeline-copy.ts +1 -3
  350. package/src/chat/logic/timeline-target.ts +3 -6
  351. package/src/chat/logic/timeline.ts +4 -85
  352. package/src/chat/logic/tool-catalog.ts +1 -2
  353. package/src/chat/logic/tool-looks.ts +3 -6
  354. package/src/chat/logic/tools.ts +6 -25
  355. package/src/chat/logic/visual-height.ts +0 -1
  356. package/src/chat/logic/welcome.ts +1 -1
  357. package/src/chat/logic/workflow.ts +2 -3
  358. package/src/chat/mentions.ts +3 -5
  359. package/src/chat/pending-prompts.ts +2 -2
  360. package/src/chat/preferences.ts +1 -2
  361. package/src/chat/prompt-hold.ts +0 -1
  362. package/src/chat/prompts/index.ts +14 -0
  363. package/src/{prompts → chat/prompts}/logic/keys.ts +3 -3
  364. package/src/{prompts → chat/prompts}/logic/prompts.ts +3 -24
  365. package/src/{prompts → chat/prompts}/logic/subjects.ts +3 -42
  366. package/src/{prompts → chat/prompts}/logic/useFocusAfterAnswer.ts +1 -1
  367. package/src/{prompts → chat/prompts}/logic/usePromptSession.ts +4 -4
  368. package/src/{prompts → chat/prompts}/ui/ApprovalBody.tsx +6 -7
  369. package/src/{prompts → chat/prompts}/ui/PromptActions.tsx +1 -2
  370. package/src/{prompts → chat/prompts}/ui/PromptCard.tsx +2 -2
  371. package/src/{prompts → chat/prompts}/ui/PromptView.tsx +6 -4
  372. package/src/{prompts → chat/prompts}/ui/QuestionBody.tsx +3 -3
  373. package/src/chat/reading-width.ts +2 -1
  374. package/src/chat/recent-messages.ts +3 -3
  375. package/src/chat/send-key.ts +0 -1
  376. package/src/chat/stash.ts +3 -3
  377. package/src/chat/subagent-conversation.ts +1 -1
  378. package/src/chat/subagent-list.ts +4 -9
  379. package/src/chat/subagent-view.ts +1 -2
  380. package/src/chat/tag-suggestions.ts +5 -5
  381. package/src/chat/thumbnails.ts +1 -3
  382. package/src/chat/timeline-flash.ts +1 -1
  383. package/src/chat/timeline-scroll.ts +0 -2
  384. package/src/chat/ui/BookmarkMarker.tsx +1 -1
  385. package/src/chat/ui/BookmarkSubmenu.tsx +2 -2
  386. package/src/chat/ui/ChatActivity.tsx +8 -18
  387. package/src/chat/ui/CodeBlock.tsx +1 -1
  388. package/src/chat/ui/Composer.tsx +5 -15
  389. package/src/chat/ui/ComposerInput.tsx +2 -2
  390. package/src/chat/ui/EditDiff.tsx +2 -3
  391. package/src/chat/ui/GoalDock.tsx +1 -1
  392. package/src/chat/ui/HostMenuItems.tsx +1 -2
  393. package/src/chat/ui/ImageView.tsx +2 -2
  394. package/src/chat/ui/LimitState.tsx +2 -2
  395. package/src/chat/ui/Markdown.tsx +1 -2
  396. package/src/chat/ui/MermaidBlock.tsx +1 -2
  397. package/src/chat/ui/MessageActions.tsx +5 -3
  398. package/src/chat/ui/Pickers.tsx +4 -4
  399. package/src/chat/ui/PromptComposer.tsx +9 -8
  400. package/src/chat/ui/PromptEditor.tsx +2 -2
  401. package/src/chat/ui/ReferenceChip.tsx +1 -1
  402. package/src/chat/ui/ReferenceTrail.tsx +2 -2
  403. package/src/chat/ui/RunSettings.tsx +4 -2
  404. package/src/chat/ui/SessionLine.tsx +2 -2
  405. package/src/chat/ui/ShellCommand.tsx +1 -4
  406. package/src/chat/ui/SubagentInfo.tsx +4 -3
  407. package/src/chat/ui/SubagentStopButton.tsx +1 -1
  408. package/src/chat/ui/SubagentTimeline.tsx +2 -2
  409. package/src/chat/ui/Timeline.tsx +7 -6
  410. package/src/chat/ui/TimelineMenu.tsx +4 -2
  411. package/src/chat/ui/UnifiedDiff.tsx +2 -3
  412. package/src/chat/ui/VisualFrame.tsx +3 -3
  413. package/src/chat/ui/chip-clipboard.ts +2 -2
  414. package/src/chat/ui/code-theme.ts +2 -2
  415. package/src/chat/ui/composer/ComposerControls.tsx +8 -59
  416. package/src/chat/ui/composer/ComposerMenu.tsx +2 -2
  417. package/src/chat/ui/composer/ComposerStatusLine.tsx +1 -1
  418. package/src/chat/ui/composer/DraftParts.tsx +0 -1
  419. package/src/chat/ui/composer/chip-paste.ts +1 -2
  420. package/src/chat/ui/composer/chips.ts +3 -4
  421. package/src/chat/ui/composer/editor.ts +1 -1
  422. package/src/chat/ui/composer/key-handler.ts +1 -2
  423. package/src/chat/ui/composer/keys.ts +3 -8
  424. package/src/chat/ui/composer/placeholder.ts +1 -1
  425. package/src/chat/ui/composer/prompt-picks.ts +3 -2
  426. package/src/chat/ui/composer/use-chat-controls.ts +2 -2
  427. package/src/chat/ui/composer/use-composer-menus.ts +2 -2
  428. package/src/chat/ui/composer/use-composer-submit.ts +2 -2
  429. package/src/chat/ui/composer/use-continuable-turn.ts +0 -1
  430. package/src/chat/ui/composer/use-draft-files.ts +2 -2
  431. package/src/chat/ui/composer/use-pending-requests.ts +1 -1
  432. package/src/chat/ui/composer/use-prompt-menus.ts +6 -9
  433. package/src/chat/ui/composer/use-take-back.ts +1 -3
  434. package/src/chat/ui/diff/EditorEditDiff.tsx +1 -1
  435. package/src/chat/ui/diff/LegacyDiffPool.tsx +1 -1
  436. package/src/chat/ui/diff/LegacyEditDiff.tsx +1 -1
  437. package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +1 -1
  438. package/src/chat/ui/diff/ReviewDiff.tsx +1 -2
  439. package/src/chat/ui/diff/diff-source-budget.ts +1 -1
  440. package/src/chat/ui/diff/review-plan.ts +2 -2
  441. package/src/chat/ui/diff/syntax-runtime.ts +1 -1
  442. package/src/chat/ui/diff-theme.ts +2 -2
  443. package/src/chat/ui/file-links.ts +1 -2
  444. package/src/chat/ui/highlighter.ts +1 -2
  445. package/src/chat/ui/index.ts +9 -39
  446. package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +2 -2
  447. package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -1
  448. package/src/chat/ui/intelligent-ui/UiReply.tsx +1 -1
  449. package/src/chat/ui/intelligent-ui/chart-data.ts +1 -1
  450. package/src/chat/ui/intelligent-ui/render-context.ts +1 -1
  451. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +0 -3
  452. package/src/chat/ui/intelligent-ui/renderers/choices.tsx +1 -1
  453. package/src/chat/ui/intelligent-ui/renderers/content.tsx +3 -3
  454. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +0 -1
  455. package/src/chat/ui/intelligent-ui/renderers/links.tsx +1 -1
  456. package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +2 -2
  457. package/src/chat/ui/intelligent-ui/renderers/map-style.ts +5 -7
  458. package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +2 -3
  459. package/src/chat/ui/intelligent-ui/renderers/map.tsx +3 -4
  460. package/src/chat/ui/intelligent-ui/reply-parts.ts +1 -1
  461. package/src/chat/ui/intelligent-ui/table-data.ts +1 -1
  462. package/src/chat/ui/intelligent-ui/use-ui-links.ts +1 -1
  463. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +1 -1
  464. package/src/chat/ui/markdown-blocks.ts +0 -2
  465. package/src/chat/ui/named-chip-look.ts +1 -1
  466. package/src/chat/ui/reference-icons.ts +2 -2
  467. package/src/chat/ui/reference-lookup.ts +2 -2
  468. package/src/chat/ui/rehype-fade.ts +0 -1
  469. package/src/chat/ui/reveal.ts +3 -3
  470. package/src/chat/ui/rows/ForksRow.tsx +1 -1
  471. package/src/chat/ui/rows/GeneratedImageRow.tsx +2 -2
  472. package/src/chat/ui/rows/MessageRows.tsx +2 -3
  473. package/src/chat/ui/rows/RowContainer.tsx +3 -3
  474. package/src/chat/ui/rows/Rows.tsx +2 -2
  475. package/src/chat/ui/rows/SubagentRow.tsx +7 -8
  476. package/src/chat/ui/rows/TaskRow.tsx +1 -1
  477. package/src/chat/ui/rows/VisualRow.tsx +1 -1
  478. package/src/chat/ui/rows/WorkRows.tsx +6 -10
  479. package/src/chat/ui/rows/WorkflowRow.tsx +1 -1
  480. package/src/chat/ui/rows/row-rhythm.ts +2 -1
  481. package/src/chat/ui/thread-references.ts +3 -3
  482. package/src/chat/ui/use-diff-source-tokens.ts +1 -1
  483. package/src/chat/ui/useToggleSet.ts +1 -1
  484. package/src/chat/ui/visual-theme.ts +1 -1
  485. package/src/chat/visual-bridge.ts +0 -2
  486. package/src/chat/waiting-on.ts +1 -1
  487. package/src/chat/workflow-list.ts +1 -1
  488. package/src/{chat/chat-client.ts → chat-client.ts} +3 -3
  489. package/src/chat-sink.ts +37 -0
  490. package/src/{ui → host}/PlainTextarea.tsx +1 -1
  491. package/src/{host-hooks.ts → host/host-hooks.ts} +4 -20
  492. package/src/{host.ts → host/host.ts} +78 -42
  493. package/src/host/prompts.ts +62 -0
  494. package/src/host/references.ts +63 -0
  495. package/src/host/timeline-row.ts +85 -0
  496. package/src/images.ts +1 -1
  497. package/src/index.ts +6 -12
  498. package/src/locales/en/agent-chat.ts +1 -1
  499. package/src/locales/nl/agent-chat.ts +1 -1
  500. package/src/locales.ts +1 -1
  501. package/src/{chat/persisted-json.ts → persisted-json.ts} +2 -2
  502. package/src/providers/AccountColors.tsx +1 -2
  503. package/src/providers/AccountDetail.tsx +2 -4
  504. package/src/providers/AccountVariables.tsx +1 -1
  505. package/src/providers/AddAccountForm.tsx +1 -1
  506. package/src/providers/CliDetail.tsx +2 -3
  507. package/src/providers/InstallPage.tsx +2 -3
  508. package/src/providers/ProviderList.tsx +0 -1
  509. package/src/providers/ProvidersPane.tsx +2 -3
  510. package/src/providers/account-actions.ts +2 -2
  511. package/src/providers/index.ts +2 -14
  512. package/src/providers/install-steps.ts +0 -1
  513. package/src/providers/provider-abilities.ts +1 -7
  514. package/src/providers/variables.ts +0 -2
  515. package/src/scope.ts +1 -1
  516. package/src/settings/sections.ts +1 -1
  517. package/src/state/chats.ts +1 -40
  518. package/src/state/index.ts +4 -22
  519. package/src/state/provider-accounts.ts +0 -1
  520. package/src/state/usage.ts +5 -5
  521. package/src/storage.ts +3 -3
  522. package/src/testing/prompts.ts +1 -1
  523. package/src/usage/ChartLogo.tsx +0 -1
  524. package/src/usage/LimitsList.tsx +3 -11
  525. package/src/usage/UsageBreakdown.tsx +1 -5
  526. package/src/usage/UsageLimits.tsx +2 -3
  527. package/src/usage/UsagePage.tsx +3 -3
  528. package/src/usage/UsagePane.tsx +2 -2
  529. package/src/usage/UsageTiles.tsx +0 -1
  530. package/src/usage/format.ts +1 -6
  531. package/src/usage/index.ts +2 -3
  532. package/src/usage/limit-groups.ts +0 -4
  533. package/src/usage/limits.ts +0 -1
  534. package/src/usage/summary.ts +2 -5
  535. package/dist/agents/agent-marks.d.ts +0 -9
  536. package/dist/agents/agent-marks.js +0 -14
  537. package/dist/lazy.d.ts +0 -8
  538. package/dist/lazy.js +0 -63
  539. package/dist/prompts/index.d.ts +0 -9
  540. package/src/agents/agent-marks.ts +0 -28
  541. package/src/lazy.tsx +0 -76
  542. package/src/prompts/index.ts +0 -22
  543. /package/dist/{prompts → chat/prompts}/logic/focus.d.ts +0 -0
  544. /package/dist/{prompts → chat/prompts}/logic/focus.js +0 -0
  545. /package/dist/{prompts → chat/prompts}/logic/keys.js +0 -0
  546. /package/dist/{prompts → chat/prompts}/logic/subjects.js +0 -0
  547. /package/dist/{prompts → chat/prompts}/logic/useFocusAfterAnswer.js +0 -0
  548. /package/dist/{ui → host}/PlainTextarea.js +0 -0
  549. /package/src/{prompts → chat/prompts}/logic/focus.ts +0 -0
@@ -4,7 +4,7 @@ import clsx from 'clsx';
4
4
  import { ChevronRight, Square, TriangleAlert, Workflow } from 'lucide-react';
5
5
  import { useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
- import { useChatHost } from '../../../host';
7
+ import { useChatHost } from '../../../host/host';
8
8
  import { useChatScope } from '../../../scope';
9
9
  import { useChats } from '../../../state/chats';
10
10
  import { useChatActions } from '../../actions';
@@ -1,6 +1,7 @@
1
1
  import clsx from 'clsx';
2
2
  import type { CSSProperties } from 'react';
3
- import { isBlock, type TimelineRow } from '../../logic/timeline';
3
+ import { type TimelineRow } from '../../../host/timeline-row';
4
+ import { isBlock } from '../../logic/timeline';
4
5
 
5
6
  /* Below this distance from the bottom a thread follows what the agent writes; above it the reader scrolled back on purpose. */
6
7
  export const FOLLOW_THRESHOLD_PX = 40;
@@ -1,6 +1,6 @@
1
1
  import type { ChatItem } from '@adecore/agent-contracts';
2
- import { useChatHost } from '../../host';
3
- import { useHostReferables } from '../../host-hooks';
2
+ import { useChatHost } from '../../host/host';
3
+ import { useHostReferables } from '../../host/host-hooks';
4
4
  import { useChatScope } from '../../scope';
5
5
  import { useChatRow } from '../../state/chats';
6
6
  import type { ReferenceLookup } from './reference-lookup';
@@ -12,7 +12,7 @@ const referencedOf = new WeakMap<Record<string, ChatItem>, string>();
12
12
  * it answers the same value until a message with another one comes; the structure a streamed word
13
13
  * leaves alone is what it is cached on.
14
14
  */
15
- export function threadReferencedKey(structure: Record<string, ChatItem> | undefined): string {
15
+ function threadReferencedKey(structure: Record<string, ChatItem> | undefined): string {
16
16
  if (structure === undefined) {
17
17
  return '';
18
18
  }
@@ -1,7 +1,7 @@
1
1
  import { diffSyntaxDocument, type DiffSourceTokens } from '@adecore/editor-react';
2
2
  import type { DiffDocument } from '@adecore/merge';
3
3
  import { useLayoutEffect, useMemo } from 'react';
4
- import { useChatHost } from '../../host';
4
+ import { useChatHost } from '../../host/host';
5
5
  import { diffSourceTokens, diffSyntaxRuntime, type DiffSourceTokenSession, type DiffSyntaxRuntime } from './diff-syntax';
6
6
 
7
7
  function createSourceBinding(document: DiffDocument, language: string, theme: string, runtime: () => DiffSyntaxRuntime) {
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
 
3
- export interface ToggleSet {
3
+ interface ToggleSet {
4
4
  ids: ReadonlySet<string>;
5
5
  /* Opens what is closed and closes what is open, and tells `onToggle` a person did it. */
6
6
  toggle(id: string): void;
@@ -1,6 +1,6 @@
1
1
  import { cleanVisualVariables, type VisualAppearance, type VisualTheme, type VisualThemeVariable } from '@adecore/agent-contracts/visual';
2
2
  import { useLayoutEffect, useState, type RefObject } from 'react';
3
- import { useHostCodeMode } from '../../host-hooks';
3
+ import { useHostCodeMode } from '../../host/host-hooks';
4
4
  import { watchTheme } from './theme-watch';
5
5
 
6
6
  /* The tokens of the app's theme where a frame stands; each answers '' for a token the theme lacks. */
@@ -20,7 +20,6 @@ import { clampVisualHeight, visualContentHeight } from './logic/visual-height';
20
20
  */
21
21
  const SILENCE_MS = 3000;
22
22
 
23
- /* The window of a visual's frame, as the bridge posts into it. */
24
23
  export interface VisualFrameWindow {
25
24
  postMessage(message: unknown, targetOrigin: string): void;
26
25
  }
@@ -192,7 +191,6 @@ export class VisualBridge {
192
191
  }
193
192
  }
194
193
 
195
- /* The frame fired `load`. */
196
194
  loaded(): void {
197
195
  if (this.suspended) {
198
196
  this.loadedWhileSuspended = true;
@@ -81,7 +81,7 @@ export function waitingOnLabel(waiting: WaitingOn, now: number): string {
81
81
  return waiting.until === undefined ? t('waitingOn.paused') : t('waitingOn.pausedUntil', { time: formatMoment(waiting.until, now) });
82
82
  case 'command':
83
83
  return t('waitingOn.command', {
84
- command: waiting.task.command || waiting.task.description || t(`activity.${waiting.task.kind}`),
84
+ command: waiting.task.description || waiting.task.command || t(`activity.${waiting.task.kind}`),
85
85
  age: formatElapsedShort(Math.max(0, now - waiting.task.startedAt))
86
86
  });
87
87
  case 'background':
@@ -8,7 +8,7 @@ export type WorkflowCall = ChatToolItem & { workflow: ChatWorkflow };
8
8
  /* `stalled` still runs, but reported nothing for a while. */
9
9
  export type WorkflowWord = 'running' | 'stalled' | 'done' | 'failed';
10
10
 
11
- export interface WorkflowPill {
11
+ interface WorkflowPill {
12
12
  word: WorkflowWord;
13
13
  label: string;
14
14
  }
@@ -11,9 +11,9 @@ import type {
11
11
  ProviderInfo,
12
12
  RuntimeMode
13
13
  } from '@adecore/agent-contracts';
14
- import { MountedRegistry, type MountedEntry } from '../mounted-registry';
15
- import type { ChatSink } from '../state/chats';
16
- import { errorCode, isConnectionError, type ChatTransport, type ChatTransportStatus } from '../transport';
14
+ import type { ChatSink } from './chat-sink';
15
+ import { MountedRegistry, type MountedEntry } from './mounted-registry';
16
+ import { errorCode, isConnectionError, type ChatTransport, type ChatTransportStatus } from './transport';
17
17
 
18
18
  interface ChatOpenOptions {
19
19
  /* Which agent CLI answers; a chat that exists on the host keeps its own. */
@@ -0,0 +1,37 @@
1
+ import type { ChatBookmark, ChatEvent, ChatHistoryResult, ChatInfo, ChatItem, ChatSubagentItem, ChatToolItem, ChatVisual } from '@adecore/agent-contracts';
2
+
3
+ export type ChatHistoryPage = ChatHistoryResult['history'];
4
+
5
+ /* The newest part of a thread, as `chat.attach` hands it over with a `historyLimit`. */
6
+ export interface ChatPage {
7
+ history: ChatHistoryPage;
8
+ /* Every request of the chat that still waits, wherever in the thread it is. */
9
+ pending: ChatItem[];
10
+ /* The active sub-agents from before the page; absent from a host that sends none. */
11
+ subagents?: ChatSubagentItem[];
12
+ /* The active Workflow calls from before the page; absent from a host that sends none. */
13
+ workflows?: ChatToolItem[];
14
+ /* The outline of the thread before the page; absent from a host that sends none. */
15
+ outline?: ChatItem[];
16
+ }
17
+
18
+ /* What a chat client writes. It owns one host's link, so it speaks in chat ids alone. */
19
+ export interface ChatSink {
20
+ /*
21
+ * A token held by the cached thread, replaced on reset or eviction. It may change after a write.
22
+ * Without it a client can only retain a replay checkpoint while the chat is mounted.
23
+ */
24
+ historyIdentity?(chatId: string): object | undefined;
25
+ /* Without a page the items are the whole thread. */
26
+ reset(chatId: string, info: ChatInfo, items: ChatItem[], page?: ChatPage): void;
27
+ /* The page before the one the chat holds, read with `cursor`. */
28
+ prepend(chatId: string, cursor: string, page: ChatHistoryResult): void;
29
+ apply(chatId: string, event: ChatEvent): void;
30
+ /* A reconnect can publish its complete replay at once; absent sinks receive each event through apply. */
31
+ replay?(chatId: string, events: readonly ChatEvent[]): void;
32
+ /* What a chat is doing, for a thread nobody in this window has open. */
33
+ status(chatId: string, info: ChatInfo): void;
34
+ bookmarks(chatId: string, bookmarks: ChatBookmark[]): void;
35
+ visuals(chatId: string, visuals: ChatVisual[]): void;
36
+ forget(chatId: string): void;
37
+ }
@@ -1,4 +1,4 @@
1
- import type { TextareaProps } from '../host';
1
+ import type { TextareaProps } from './host';
2
2
 
3
3
  /* The field a written answer goes in when the app brings no dictation of its own. */
4
4
  export function PlainTextarea({ buttonClassName: _buttonClassName, ...props }: TextareaProps) {
@@ -4,9 +4,9 @@
4
4
  * hooks are called through these wrappers only. `ChatHostProvider` pins its host, so they never change.
5
5
  */
6
6
  import type { ProviderPlatform } from '@adecore/agent-contracts';
7
- import type { AccountRule } from './agents/accounts';
8
- import { referablesOfChats, type Referables } from './chat/chat-references';
9
- import { useChatHost, type ChatHost, type CommandLook, type ComposerSendAction, type ComposerStatusItem } from './host';
7
+ import type { AccountRule } from './host';
8
+ import { useChatHost, type ChatHost, type CommandLook, type ComposerStatusItem } from './host';
9
+ import { referablesOfChats, type Referables } from './references';
10
10
 
11
11
  export function useHostCodeMode(): 'light' | 'dark' {
12
12
  return useChatHost().code.useMode();
@@ -48,7 +48,7 @@ export function useHostTimelineFind(...args: Parameters<ChatHost['useTimelineFin
48
48
  return useChatHost().useTimelineFind(...args);
49
49
  }
50
50
 
51
- export function useHostReferableChats(): ReturnType<ChatHost['useReferableChats']> {
51
+ function useHostReferableChats(): ReturnType<ChatHost['useReferableChats']> {
52
52
  return useChatHost().useReferableChats();
53
53
  }
54
54
 
@@ -68,7 +68,6 @@ export function useHostLoginBlocked(...args: Parameters<ChatHost['useLoginBlocke
68
68
  const NO_EXPANDING: ReturnType<NonNullable<ChatHost['useExpandingCommands']>> = [];
69
69
  const noExpanding = (): ReturnType<NonNullable<ChatHost['useExpandingCommands']>> => NO_EXPANDING;
70
70
 
71
- /* None where the host has no commands of its own. */
72
71
  export function useHostExpandingCommands(): ReturnType<NonNullable<ChatHost['useExpandingCommands']>> {
73
72
  const useExpanding = useChatHost().useExpandingCommands ?? noExpanding;
74
73
 
@@ -77,7 +76,6 @@ export function useHostExpandingCommands(): ReturnType<NonNullable<ChatHost['use
77
76
 
78
77
  const noPlatform = (): ProviderPlatform | null => null;
79
78
 
80
- /* Null where the host does not say, as it need not. */
81
79
  export function useHostMachinePlatform(scopeId: string): ProviderPlatform | null {
82
80
  const useMachinePlatform = useChatHost().useMachinePlatform ?? noPlatform;
83
81
 
@@ -100,10 +98,6 @@ export function useHostContextSources(...args: Parameters<ChatHost['useContextSo
100
98
  return useChatHost().useContextSources(...args);
101
99
  }
102
100
 
103
- export function useHostHidesFolder(...args: Parameters<ChatHost['useHidesFolder']>): ReturnType<ChatHost['useHidesFolder']> {
104
- return useChatHost().useHidesFolder(...args);
105
- }
106
-
107
101
  export function useHostWelcome(...args: Parameters<ChatHost['useWelcome']>): ReturnType<ChatHost['useWelcome']> {
108
102
  return useChatHost().useWelcome(...args);
109
103
  }
@@ -116,16 +110,6 @@ export function useHostComposerPlaceholder(...args: Parameters<ChatHost['useComp
116
110
  return useChatHost().useComposerPlaceholder(...args);
117
111
  }
118
112
 
119
- const NO_SEND_ACTIONS: readonly ComposerSendAction[] = [];
120
-
121
- const noSendActions = (): readonly ComposerSendAction[] => NO_SEND_ACTIONS;
122
-
123
- export function useHostComposerSendActions(scopeId: string, chatId: string): readonly ComposerSendAction[] {
124
- const useSendActions = useChatHost().useComposerSendActions ?? noSendActions;
125
-
126
- return useSendActions(scopeId, chatId);
127
- }
128
-
129
113
  const NO_STATUS: readonly ComposerStatusItem[] = [];
130
114
 
131
115
  const noStatus = (): readonly ComposerStatusItem[] => NO_STATUS;
@@ -12,9 +12,7 @@ import type {
12
12
  ChatUiLinkPayload,
13
13
  ChatUiLinkReading,
14
14
  ChatVisual,
15
- ModelSelection,
16
- ProviderPlatform,
17
- RuntimeMode
15
+ ProviderPlatform
18
16
  } from '@adecore/agent-contracts';
19
17
  import type { EditorEngine } from '@adecore/editor';
20
18
  import { isApplePlatform, syncAnimations } from '@adecore/ui';
@@ -26,6 +24,7 @@ import {
26
24
  createElement,
27
25
  useContext,
28
26
  useLayoutEffect,
27
+ useMemo,
29
28
  useState,
30
29
  type ComponentProps,
31
30
  type ComponentType,
@@ -33,13 +32,10 @@ import {
33
32
  type RefObject
34
33
  } from 'react';
35
34
  import type { Highlighter, ThemeRegistration } from 'shiki';
36
- import type { AccountRule } from './agents/accounts';
37
- import type { ReferableKind, Referables } from './chat/chat-references';
38
- import type { TimelineRow } from './chat/logic/timeline';
39
- import type { FindReveal } from './chat/ui/find-reveal';
40
- import type { PromptAction } from './prompts/logic/prompts';
41
- import type { HostPrompt, PromptViewProps } from './prompts/logic/subjects';
42
- import { PlainTextarea } from './ui/PlainTextarea';
35
+ import { PlainTextarea } from './PlainTextarea';
36
+ import type { HostPrompt, PromptAction, PromptViewProps } from './prompts';
37
+ import type { ReferableKind, Referables } from './references';
38
+ import type { TimelineRow } from './timeline-row';
43
39
 
44
40
  /* A color an account may wear, by the name the host stores it under. */
45
41
  export interface AccentChoice {
@@ -47,6 +43,17 @@ export interface AccentChoice {
47
43
  color: string;
48
44
  }
49
45
 
46
+ /* What a project says about the accounts of each CLI: the one its new chats start on, and those it never offers. */
47
+ export type AccountRule = Partial<Record<string, { default?: string; off?: readonly string[] }>>;
48
+
49
+ /* The line that always shows, the text of a message, or what shows only once a row is opened. */
50
+ export type ChatFindField = 'summary' | 'text' | 'output';
51
+
52
+ export interface FindReveal {
53
+ itemId: string;
54
+ field: ChatFindField;
55
+ }
56
+
50
57
  export interface ChatToast {
51
58
  /* A toast with the same id replaces the one that is up. */
52
59
  id?: string;
@@ -206,28 +213,6 @@ export interface ComposerHeaderSlotProps {
206
213
  focused: boolean;
207
214
  }
208
215
 
209
- /* What a send action of the app's gets: the message as it stands when a person picks the action. */
210
- export interface ComposerSendDraft {
211
- scopeId: string;
212
- chatId: string;
213
- /* The draft as Send would send it, trimmed and with its quote; empty when nothing is written. */
214
- text: string;
215
- provider: AgentKind;
216
- selection: ModelSelection;
217
- runtimeMode: RuntimeMode;
218
- }
219
-
220
- /* An action of the app's own in the menu beside the composer's send button, such as sending the draft later. */
221
- export interface ComposerSendAction {
222
- /* Unique among the actions of one composer. */
223
- id: string;
224
- label: string;
225
- icon?: LucideIcon;
226
- disabled?: boolean;
227
- /* Runs once a person picks it; the draft stays in the box, and the host shows a failure itself. */
228
- run(draft: ComposerSendDraft): void;
229
- }
230
-
231
216
  /* A row in the popover a status item opens. */
232
217
  export interface ComposerStatusDetail {
233
218
  icon: LucideIcon;
@@ -465,7 +450,25 @@ export interface UiModelViewProps {
465
450
  * Whatever an app leaves out keeps the default here, which is the chat without that part. One host may
466
451
  * serve several scopes, so a function that is about one host of chats is told its scope id.
467
452
  */
453
+ /* A CLI's mark, drawn in the current text color. */
454
+ export interface AgentMark {
455
+ /* Read by a screen reader. */
456
+ title: string;
457
+ /* The `d` of one SVG path; several shapes go in one path. */
458
+ path: string;
459
+ /* `0 0 24 24` when absent. */
460
+ viewBox?: string;
461
+ /* `evenodd` for a path whose holes are subpaths inside its shape; `nonzero` when absent. */
462
+ fillRule?: 'nonzero' | 'evenodd';
463
+ }
464
+
468
465
  export interface ChatHost {
466
+ /*
467
+ * The marks of the kinds the app adds, and any it draws differently. Every place the shared UI draws an agent's
468
+ * mark reads them; a kind with none keeps the built-in mark or the robot.
469
+ */
470
+ agentMarks?: Readonly<Partial<Record<AgentKind, AgentMark>>>;
471
+
469
472
  /* Commands of the host's own after `/`, which turn into the prompt instead of reaching the CLI. */
470
473
  useExpandingCommands?(): readonly { name: string; hint: string; expand(args: string): Promise<string> }[];
471
474
 
@@ -634,8 +637,6 @@ export interface ChatHost {
634
637
  useChatPlace(chatId: string): ChatPlace;
635
638
  /* What a chat may read besides its folder, named under an empty thread. */
636
639
  useContextSources(chatId: string): ReadonlyArray<{ title: string }>;
637
- /* Whether the folder a chat works in is the app's business only, so an empty thread does not name it. */
638
- useHidesFolder(chatId: string): boolean;
639
640
  /* Whether a chat before its first message opens on a greeting with the composer under it, rather than an empty thread over a docked composer. */
640
641
  useWelcome(chatId: string): boolean;
641
642
  tasks: {
@@ -664,8 +665,6 @@ export interface ChatHost {
664
665
  ComposerSlot: ComponentType<ComposerSlotProps> | null;
665
666
  /* The app's own bar at the top of the composer, inside its card, such as a switch between chats of one thing; left out, or a slot that renders nothing, draws none. */
666
667
  ComposerHeaderSlot?: ComponentType<ComposerHeaderSlotProps> | null;
667
- /* Actions of the app's own behind a chevron on the send button, in the order given; left out, or none, Send stands alone. */
668
- useComposerSendActions?(scopeId: string, chatId: string): readonly ComposerSendAction[];
669
668
  /* Items of the app's own on a line under the composer's card, such as where the chat works; left out, or none, draws no line. */
670
669
  useComposerStatus?(scopeId: string, chatId: string): readonly ComposerStatusItem[];
671
670
  /* The app's own chips for a chat's sub-agents over the composer; null draws the one flyout. */
@@ -696,6 +695,7 @@ const NO_CARDS: readonly ThreadCard[] = [];
696
695
  const DEFAULT_HOST: ChatHost = {
697
696
  accents: { all: [], featured: [], label: (id) => id, current: () => '' },
698
697
  isApplePlatform,
698
+ agentMarks: {},
699
699
  isAppShortcut: () => false,
700
700
  notify: () => undefined,
701
701
  actions: null,
@@ -717,7 +717,6 @@ const DEFAULT_HOST: ChatHost = {
717
717
  useMachineLabel: () => null,
718
718
  useChatPlace: () => NOWHERE,
719
719
  useContextSources: () => NO_SOURCES,
720
- useHidesFolder: () => false,
721
720
  useWelcome: () => false,
722
721
  tasks: { useTasks: () => undefined, useTask: () => null },
723
722
  confirm: { stopSubagents: (_scopeId, _chatId, run) => run(), stopTask: (_scopeId, _childId, _title, run) => run() },
@@ -735,25 +734,62 @@ const DEFAULT_HOST: ChatHost = {
735
734
 
736
735
  const ChatHostContext = createContext<ChatHost>(DEFAULT_HOST);
737
736
 
737
+ type PartOf<Member> = Member extends (...args: never[]) => unknown ? never : Member extends object ? Partial<Member> : never;
738
+
739
+ /* What a provider hands: any member of the host, and for a member that is a bundle of members, such as `attachments` or `prompts`, only some of its own. */
740
+ export type ChatHostLayer = { [Member in keyof ChatHost]?: ChatHost[Member] | PartOf<ChatHost[Member]> };
741
+
742
+ function isBundle(value: unknown): value is Record<string, unknown> {
743
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
744
+ }
745
+
746
+ function layered(parent: ChatHost, layer: ChatHostLayer): ChatHost {
747
+ const merged: Record<string, unknown> = { ...parent };
748
+
749
+ for (const [member, value] of Object.entries(layer)) {
750
+ const before = merged[member];
751
+ merged[member] = isBundle(before) && isBundle(value) ? { ...before, ...value } : value;
752
+ }
753
+
754
+ return merged as unknown as ChatHost;
755
+ }
756
+
738
757
  /*
739
758
  * Hands the views under it a host: `host` over the one of a provider above it, member by member, and
740
- * over the defaults at the top. A part of an app that loads later and adds hooks renders a provider of
759
+ * over the defaults at the top. A member that is a bundle on both sides, such as `attachments`, is merged one
760
+ * level down, so a layer overrides one of its members without copying the rest. A part of an app that loads later and adds hooks renders a provider of
741
761
  * its own around what it draws, so every view under it calls the same hooks from its first render on.
742
762
  * The host is read once, as the provider mounts, since a hook that changed under a mounted view would
743
763
  * break the order of its hooks: a provider that gets another `host` throws, and a new `key` remounts it.
764
+ * Only a dev server that replaces modules in place takes another `host`: re-running the module that makes it is
765
+ * how a change reaches a mounted view, and React Fast Refresh remounts what the new hooks would break.
744
766
  */
745
- export function ChatHostProvider({ host, children }: { host: Partial<ChatHost>; children?: ReactNode }) {
767
+ export function ChatHostProvider({ host, children }: { host: ChatHostLayer; children?: ReactNode }) {
746
768
  const parent = useContext(ChatHostContext);
747
- const [pinned] = useState(() => ({ host, value: { ...parent, ...host } }));
769
+ const [mounted] = useState(() => host);
748
770
 
749
- if (pinned.host !== host) {
771
+ if (mounted !== host && !replacementTaken.on) {
750
772
  throw new Error('A ChatHostProvider reads its host once: hand it the same object on every render, or a new key to mount it with another');
751
773
  }
752
774
 
775
+ // The compiler leaves this call uncached, and a new value on every render would redraw every consumer of the context.
776
+ const value = useMemo(() => layered(parent, host), [parent, host]);
777
+
753
778
  // Every shining live row steps on the spinners' clock, so the paints of several rows fall in one frame.
754
779
  useLayoutEffect(() => syncAnimations(['chat-shine']), []);
755
780
 
756
- return createElement(ChatHostContext.Provider, { value: pinned.value }, children);
781
+ return createElement(ChatHostContext.Provider, { value }, children);
782
+ }
783
+
784
+ /*
785
+ * Whether the module that makes a host may be replaced while the page runs, which only a dev server does. Vite
786
+ * leaves `import.meta.hot` in a dev page and drops it from a build, so a production page and a test still throw.
787
+ */
788
+ const replacementTaken = { on: (import.meta as ImportMeta & { hot?: unknown }).hot !== undefined };
789
+
790
+ /* For the tests of this package: stands in for a dev server that replaces modules, or for a build. */
791
+ export function takeHostReplacement(on: boolean): void {
792
+ replacementTaken.on = on;
757
793
  }
758
794
 
759
795
  /* The host of the nearest `ChatHostProvider`, or the defaults outside one. */
@@ -0,0 +1,62 @@
1
+ import type { AgentKind, ChatApprovalItem, ChatQuestionItem } from '@adecore/agent-contracts';
2
+ import type { ReactNode } from 'react';
3
+
4
+ export type PendingPrompt = ChatApprovalItem | ChatQuestionItem;
5
+
6
+ export type PromptAction =
7
+ | { kind: 'approve'; decision: 'allow' | 'allow-always' | 'deny'; message?: string }
8
+ | { kind: 'answer'; answers: Record<string, string> }
9
+ | { kind: 'dismiss' }
10
+ // A terminal's permission request, answered with one of the choices the host offered.
11
+ | { kind: 'choose'; choiceId: string };
12
+
13
+ export interface PromptAnswer {
14
+ choices: string[];
15
+ text: string;
16
+ custom: boolean;
17
+ }
18
+
19
+ export interface PromptDraft {
20
+ index: number;
21
+ answers: Record<string, PromptAnswer>;
22
+ reason: string;
23
+ showReason: boolean;
24
+ }
25
+
26
+ /*
27
+ * A prompt the app raises beside a chat's own requests, such as its own approval to operate
28
+ * something. The app draws it and answers it (`ChatHost.prompts`); the chat only orders it among the
29
+ * rest and keeps its draft.
30
+ */
31
+ export interface HostPrompt {
32
+ /* Unique across the prompts of a view, and stable while the prompt waits. */
33
+ id: string;
34
+ createdAt: number;
35
+ blocking: boolean;
36
+ /* The mark a pointer to it wears: a hand for a request, a question mark for anything else. */
37
+ asks: 'approval' | 'question';
38
+ /* What the app knows about it, for its own drawing and answering; the same object while nothing about it changed. */
39
+ data: unknown;
40
+ }
41
+
42
+ /* What a prompt card draws, whatever asked it. The chat's items pass through unchanged. */
43
+ export type PromptSubject =
44
+ | { kind: 'chat'; nodeId: string; item: PendingPrompt; source?: { label: string; provider?: AgentKind } }
45
+ | { kind: 'host'; nodeId: string; prompt: HostPrompt };
46
+
47
+ /* What a card is given to draw, the chat's and the app's alike. */
48
+ export interface PromptViewProps {
49
+ subject: PromptSubject;
50
+ draft: PromptDraft;
51
+ onDraft(draft: PromptDraft): void;
52
+ onAction(action: PromptAction): void;
53
+ more: number;
54
+ hasDraft: boolean;
55
+ denyReason: boolean;
56
+ disabled: boolean;
57
+ sending: boolean;
58
+ error: string | null;
59
+ top?: ReactNode;
60
+ /* Takes the person to whatever an app's own card is about. */
61
+ onReveal?: () => void;
62
+ }
@@ -0,0 +1,63 @@
1
+ /* Another chat a message may point at, under the name it has right now. */
2
+ export interface ProjectChat {
3
+ id: string;
4
+ title: string;
5
+ }
6
+
7
+ export type ReferableKind =
8
+ | 'project'
9
+ | 'canvas'
10
+ | 'design'
11
+ | 'chat'
12
+ | 'terminal'
13
+ | 'note'
14
+ | 'text'
15
+ | 'drawing'
16
+ | 'diagram'
17
+ | 'browser'
18
+ | 'device'
19
+ | 'file'
20
+ | 'database';
21
+
22
+ /* One place on the way to a reference, such as the project or the canvas it stands in. */
23
+ export interface ReferenceStep {
24
+ id: string;
25
+ name: string;
26
+ kind: ReferableKind;
27
+ }
28
+
29
+ /* The heading a reference is offered under when a host offers more than one project. */
30
+ interface ReferenceSection {
31
+ id: string;
32
+ name: string;
33
+ /* The project of the chat that asks, which comes first and says so. */
34
+ current?: boolean;
35
+ }
36
+
37
+ /* What a message may point at with `#`, under the name it has right now. */
38
+ export interface Referable {
39
+ id: string;
40
+ name: string;
41
+ kind: ReferableKind;
42
+ /* What tells it apart from another of the same name, such as the canvas it stands on; absent when its kind does. */
43
+ detail?: string;
44
+ /* `canvas` for what stands on the canvas the chat is a node of, `views` for a view of the project. */
45
+ group: 'canvas' | 'views';
46
+ /* Where it stands, outermost first; its chip draws these in front of its name. */
47
+ trail?: readonly ReferenceStep[];
48
+ section?: ReferenceSection;
49
+ /* What it comes down to in the prompt, for a thing from outside the project that nothing else can read. */
50
+ read?(): Promise<string>;
51
+ }
52
+
53
+ export interface Referables {
54
+ /* The canvas group first, then the views; never the chat that asks. */
55
+ items: readonly Referable[];
56
+ /* The machine only resolves chats, so nothing else is offered. */
57
+ chatsOnly: boolean;
58
+ }
59
+
60
+ /* What a host without views offers: its chats, which every machine takes. */
61
+ export function referablesOfChats(chats: readonly ProjectChat[]): Referables {
62
+ return { items: chats.map((chat) => ({ id: chat.id, name: chat.title, kind: 'chat', group: 'views' })), chatsOnly: true };
63
+ }
@@ -0,0 +1,85 @@
1
+ import type {
2
+ ChatApprovalItem,
3
+ ChatAssistantItem,
4
+ ChatCheckpointDiff,
5
+ ChatItem,
6
+ ChatNoteMessage,
7
+ ChatQuestionItem,
8
+ ChatSubagentItem,
9
+ ChatThinkingItem,
10
+ ChatToolItem,
11
+ ChatTurnItem,
12
+ ChatUserItem,
13
+ ChatVisual,
14
+ ChatWorkflow,
15
+ ModelSelection
16
+ } from '@adecore/agent-contracts';
17
+ import type { CommandLook, CommandLookSent, ThreadCard, ToolLook } from './host';
18
+
19
+ /* A look of the host's own: a program in a shell call, or an MCP server. */
20
+ export type Look = CommandLook | ToolLook;
21
+
22
+ /* A subagent's row: the work the thread kept of it, and the agents it opened in turn, each a row of its own under it. */
23
+ export interface SubagentBranch {
24
+ id: string;
25
+ item: ChatSubagentItem;
26
+ children: ChatItem[];
27
+ nested: SubagentBranch[];
28
+ expanded: boolean;
29
+ }
30
+
31
+ /* The branch the turn started on was not the one it ended on, so its diff also holds what came in with the move. */
32
+ export interface BaseMoved {
33
+ from: string;
34
+ to: string;
35
+ }
36
+
37
+ /*
38
+ * What the thread shows, row by row. Items are what the host knows; rows are what a reader
39
+ * wants: one line per tool call, runs of tool calls folded into a summary, past turns folded
40
+ * behind "Worked for 12s" and what the turn did, and the file changes of a turn gathered into one card.
41
+ */
42
+ export type TimelineRow =
43
+ | { kind: 'user'; id: string; item: ChatUserItem }
44
+ | { kind: 'turn-start'; id: string; turn: ChatTurnItem; label: string }
45
+ | { kind: 'assistant'; id: string; item: ChatAssistantItem }
46
+ // A subagent's `SubagentHandback` call, drawn as the report it carries rather than as a tool call.
47
+ | { kind: 'report'; id: string; text: string }
48
+ | { kind: 'thinking'; id: string; item: ChatThinkingItem }
49
+ | { kind: 'work'; id: string; tool: ChatToolItem }
50
+ // `look` is set when every call is a run of that look and the summary is its sentence.
51
+ | { kind: 'work-group'; id: string; tools: ChatToolItem[]; summary: string; expanded: boolean; look?: Look }
52
+ | { kind: 'work-live'; id: string; tool: ChatToolItem }
53
+ // The latest thought of a running turn, repeated over the call it led to; `at` is when that call began.
54
+ | { kind: 'live-thought'; id: string; item: ChatThinkingItem; at: number }
55
+ // A Workflow call the machine reports phases and agents for, drawn with them under it.
56
+ | { kind: 'workflow'; id: string; tool: ChatToolItem; workflow: ChatWorkflow }
57
+ | ({ kind: 'subagent' } & SubagentBranch)
58
+ | { kind: 'approval'; id: string; item: ChatApprovalItem }
59
+ | { kind: 'question'; id: string; item: ChatQuestionItem }
60
+ | { kind: 'note'; id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string; said?: true }
61
+ // A message another node sent the chat, drawn as said to it under the name of its sender.
62
+ | { kind: 'message'; id: string; message: ChatNoteMessage; createdAt: number }
63
+ // A message this chat's agent sent another node with a command of a look, drawn as said instead of as its call.
64
+ | { kind: 'sent'; id: string; tool: ChatToolItem; sent: CommandLookSent }
65
+ | { kind: 'compaction'; id: string; preTokens: number | null; postTokens?: number }
66
+ // The turn below ran on another model or effort than the turn before it.
67
+ | { kind: 'selection-switch'; id: string; from: ModelSelection; to: ModelSelection }
68
+ | {
69
+ kind: 'changed-files';
70
+ id: string;
71
+ turnId: string;
72
+ tools: ChatToolItem[];
73
+ diff: ChatCheckpointDiff | null;
74
+ checkpoint: boolean;
75
+ baseMoved?: BaseMoved;
76
+ // Set when `diff` holds back the diffs past its first few, which the host answers whole.
77
+ heldBack?: boolean;
78
+ }
79
+ | { kind: 'turn-fold'; id: string; turn: ChatTurnItem; label: string; work: string[]; hiddenCount: number; expanded: boolean; expandable: boolean }
80
+ | { kind: 'forks'; id: string; turnId: string }
81
+ | { kind: 'working'; id: string; startedAt: number; tool?: ChatToolItem }
82
+ // A card of the app's own (`thread-cards.ts`), never derived from an item.
83
+ | { kind: 'app-card'; id: string; card: ThreadCard }
84
+ // A page an agent published, placed by when it was published (`thread-cards.ts`), never derived from an item.
85
+ | { kind: 'visual'; id: string; visual: ChatVisual };
package/src/images.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { imageDocumentForDisplay, imageForDisplay } from './chat/image-display';
1
+ export { imageForDisplay } from './chat/image-display';
2
2
  export { DisplayImage } from './chat/ui/DisplayImage';