@adea-ai/ui 0.140.0 → 0.142.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 (455) hide show
  1. package/dist/components/composites/appearance-editor/appearance-editor.js +2 -2
  2. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  3. package/dist/components/composites/catalog-browser/catalog-browser-group.js +1 -1
  4. package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +56 -0
  5. package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -0
  6. package/dist/components/composites/chain-of-thought/chain-of-thought.js +117 -0
  7. package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -0
  8. package/dist/components/composites/chain-of-thought/index.d.ts +2 -0
  9. package/dist/components/composites/chain-of-thought/index.d.ts.map +1 -0
  10. package/dist/components/composites/chain-of-thought/index.js +2 -0
  11. package/dist/components/composites/chat/chat.d.ts +67 -0
  12. package/dist/components/composites/chat/chat.d.ts.map +1 -0
  13. package/dist/components/composites/chat/chat.js +179 -0
  14. package/dist/components/composites/chat/chat.js.map +1 -0
  15. package/dist/components/composites/chat/index.d.ts +2 -0
  16. package/dist/components/composites/chat/index.d.ts.map +1 -0
  17. package/dist/components/composites/chat/index.js +2 -0
  18. package/dist/components/composites/checkpoint/checkpoint-model.d.ts +34 -0
  19. package/dist/components/composites/checkpoint/checkpoint-model.d.ts.map +1 -0
  20. package/dist/components/composites/checkpoint/checkpoint-model.js +48 -0
  21. package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -0
  22. package/dist/components/composites/checkpoint/checkpoint.d.ts +48 -0
  23. package/dist/components/composites/checkpoint/checkpoint.d.ts.map +1 -0
  24. package/dist/components/composites/checkpoint/checkpoint.js +160 -0
  25. package/dist/components/composites/checkpoint/checkpoint.js.map +1 -0
  26. package/dist/components/composites/checkpoint/index.d.ts +3 -0
  27. package/dist/components/composites/checkpoint/index.d.ts.map +1 -0
  28. package/dist/components/composites/checkpoint/index.js +3 -0
  29. package/dist/components/composites/confirmation/confirmation-model.d.ts +45 -0
  30. package/dist/components/composites/confirmation/confirmation-model.d.ts.map +1 -0
  31. package/dist/components/composites/confirmation/confirmation-model.js +51 -0
  32. package/dist/components/composites/confirmation/confirmation-model.js.map +1 -0
  33. package/dist/components/composites/confirmation/confirmation.d.ts +72 -0
  34. package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -0
  35. package/dist/components/composites/confirmation/confirmation.js +300 -0
  36. package/dist/components/composites/confirmation/confirmation.js.map +1 -0
  37. package/dist/components/composites/confirmation/index.d.ts +3 -0
  38. package/dist/components/composites/confirmation/index.d.ts.map +1 -0
  39. package/dist/components/composites/confirmation/index.js +3 -0
  40. package/dist/components/composites/context/context-model.d.ts +69 -0
  41. package/dist/components/composites/context/context-model.d.ts.map +1 -0
  42. package/dist/components/composites/context/context-model.js +122 -0
  43. package/dist/components/composites/context/context-model.js.map +1 -0
  44. package/dist/components/composites/context/context.d.ts +38 -0
  45. package/dist/components/composites/context/context.d.ts.map +1 -0
  46. package/dist/components/composites/context/context.js +234 -0
  47. package/dist/components/composites/context/context.js.map +1 -0
  48. package/dist/components/composites/context/index.d.ts +3 -0
  49. package/dist/components/composites/context/index.d.ts.map +1 -0
  50. package/dist/components/composites/context/index.js +3 -0
  51. package/dist/components/composites/file-tree/build-file-tree.d.ts +138 -0
  52. package/dist/components/composites/file-tree/build-file-tree.d.ts.map +1 -0
  53. package/dist/components/composites/file-tree/build-file-tree.js +325 -0
  54. package/dist/components/composites/file-tree/build-file-tree.js.map +1 -0
  55. package/dist/components/composites/file-tree/file-tree.d.ts +74 -0
  56. package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -0
  57. package/dist/components/composites/file-tree/file-tree.js +389 -0
  58. package/dist/components/composites/file-tree/file-tree.js.map +1 -0
  59. package/dist/components/composites/file-tree/index.d.ts +3 -0
  60. package/dist/components/composites/file-tree/index.d.ts.map +1 -0
  61. package/dist/components/composites/file-tree/index.js +3 -0
  62. package/dist/components/composites/inline-citation/citation.d.ts +37 -0
  63. package/dist/components/composites/inline-citation/citation.d.ts.map +1 -0
  64. package/dist/components/composites/inline-citation/citation.js +52 -0
  65. package/dist/components/composites/inline-citation/citation.js.map +1 -0
  66. package/dist/components/composites/inline-citation/index.d.ts +3 -0
  67. package/dist/components/composites/inline-citation/index.d.ts.map +1 -0
  68. package/dist/components/composites/inline-citation/index.js +3 -0
  69. package/dist/components/composites/inline-citation/inline-citation.d.ts +64 -0
  70. package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -0
  71. package/dist/components/composites/inline-citation/inline-citation.js +272 -0
  72. package/dist/components/composites/inline-citation/inline-citation.js.map +1 -0
  73. package/dist/components/composites/message-scroller/index.d.ts +3 -0
  74. package/dist/components/composites/message-scroller/index.d.ts.map +1 -0
  75. package/dist/components/composites/message-scroller/index.js +3 -0
  76. package/dist/components/composites/message-scroller/message-scroller.d.ts +55 -0
  77. package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -0
  78. package/dist/components/composites/message-scroller/message-scroller.js +201 -0
  79. package/dist/components/composites/message-scroller/message-scroller.js.map +1 -0
  80. package/dist/components/composites/message-scroller/scroll-anchor.d.ts +66 -0
  81. package/dist/components/composites/message-scroller/scroll-anchor.d.ts.map +1 -0
  82. package/dist/components/composites/message-scroller/scroll-anchor.js +122 -0
  83. package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -0
  84. package/dist/components/composites/model-selector/index.d.ts +3 -0
  85. package/dist/components/composites/model-selector/index.d.ts.map +1 -0
  86. package/dist/components/composites/model-selector/index.js +3 -0
  87. package/dist/components/composites/model-selector/model-selector.d.ts +55 -0
  88. package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -0
  89. package/dist/components/composites/model-selector/model-selector.js +490 -0
  90. package/dist/components/composites/model-selector/model-selector.js.map +1 -0
  91. package/dist/components/composites/model-selector/models.d.ts +51 -0
  92. package/dist/components/composites/model-selector/models.d.ts.map +1 -0
  93. package/dist/components/composites/model-selector/models.js +71 -0
  94. package/dist/components/composites/model-selector/models.js.map +1 -0
  95. package/dist/components/composites/plan/index.d.ts +2 -0
  96. package/dist/components/composites/plan/index.d.ts.map +1 -0
  97. package/dist/components/composites/plan/index.js +2 -0
  98. package/dist/components/composites/plan/plan.d.ts +61 -0
  99. package/dist/components/composites/plan/plan.d.ts.map +1 -0
  100. package/dist/components/composites/plan/plan.js +130 -0
  101. package/dist/components/composites/plan/plan.js.map +1 -0
  102. package/dist/components/composites/queue/index.d.ts +2 -0
  103. package/dist/components/composites/queue/index.d.ts.map +1 -0
  104. package/dist/components/composites/queue/index.js +2 -0
  105. package/dist/components/composites/queue/queue.d.ts +77 -0
  106. package/dist/components/composites/queue/queue.d.ts.map +1 -0
  107. package/dist/components/composites/queue/queue.js +271 -0
  108. package/dist/components/composites/queue/queue.js.map +1 -0
  109. package/dist/components/composites/reasoning/index.d.ts +2 -0
  110. package/dist/components/composites/reasoning/index.d.ts.map +1 -0
  111. package/dist/components/composites/reasoning/index.js +2 -0
  112. package/dist/components/composites/reasoning/reasoning.d.ts +62 -0
  113. package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -0
  114. package/dist/components/composites/reasoning/reasoning.js +156 -0
  115. package/dist/components/composites/reasoning/reasoning.js.map +1 -0
  116. package/dist/components/composites/sources/index.d.ts +3 -0
  117. package/dist/components/composites/sources/index.d.ts.map +1 -0
  118. package/dist/components/composites/sources/index.js +3 -0
  119. package/dist/components/composites/sources/source.d.ts +46 -0
  120. package/dist/components/composites/sources/source.d.ts.map +1 -0
  121. package/dist/components/composites/sources/source.js +74 -0
  122. package/dist/components/composites/sources/source.js.map +1 -0
  123. package/dist/components/composites/sources/sources.d.ts +45 -0
  124. package/dist/components/composites/sources/sources.d.ts.map +1 -0
  125. package/dist/components/composites/sources/sources.js +175 -0
  126. package/dist/components/composites/sources/sources.js.map +1 -0
  127. package/dist/components/composites/stack-trace/index.d.ts +3 -0
  128. package/dist/components/composites/stack-trace/index.d.ts.map +1 -0
  129. package/dist/components/composites/stack-trace/index.js +3 -0
  130. package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +118 -0
  131. package/dist/components/composites/stack-trace/parse-stack-trace.d.ts.map +1 -0
  132. package/dist/components/composites/stack-trace/parse-stack-trace.js +376 -0
  133. package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -0
  134. package/dist/components/composites/stack-trace/stack-trace.d.ts +63 -0
  135. package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -0
  136. package/dist/components/composites/stack-trace/stack-trace.js +491 -0
  137. package/dist/components/composites/stack-trace/stack-trace.js.map +1 -0
  138. package/dist/components/composites/subagent/index.d.ts +2 -0
  139. package/dist/components/composites/subagent/index.d.ts.map +1 -0
  140. package/dist/components/composites/subagent/index.js +2 -0
  141. package/dist/components/composites/subagent/subagent.d.ts +55 -0
  142. package/dist/components/composites/subagent/subagent.d.ts.map +1 -0
  143. package/dist/components/composites/subagent/subagent.js +138 -0
  144. package/dist/components/composites/subagent/subagent.js.map +1 -0
  145. package/dist/components/composites/suggestion/index.d.ts +2 -0
  146. package/dist/components/composites/suggestion/index.d.ts.map +1 -0
  147. package/dist/components/composites/suggestion/index.js +2 -0
  148. package/dist/components/composites/suggestion/suggestion.d.ts +37 -0
  149. package/dist/components/composites/suggestion/suggestion.d.ts.map +1 -0
  150. package/dist/components/composites/suggestion/suggestion.js +100 -0
  151. package/dist/components/composites/suggestion/suggestion.js.map +1 -0
  152. package/dist/components/composites/task/index.d.ts +2 -0
  153. package/dist/components/composites/task/index.d.ts.map +1 -0
  154. package/dist/components/composites/task/index.js +2 -0
  155. package/dist/components/composites/task/task.d.ts +96 -0
  156. package/dist/components/composites/task/task.d.ts.map +1 -0
  157. package/dist/components/composites/task/task.js +311 -0
  158. package/dist/components/composites/task/task.js.map +1 -0
  159. package/dist/components/composites/terminal/ansi.d.ts +101 -0
  160. package/dist/components/composites/terminal/ansi.d.ts.map +1 -0
  161. package/dist/components/composites/terminal/ansi.js +544 -0
  162. package/dist/components/composites/terminal/ansi.js.map +1 -0
  163. package/dist/components/composites/terminal/index.d.ts +4 -0
  164. package/dist/components/composites/terminal/index.d.ts.map +1 -0
  165. package/dist/components/composites/terminal/index.js +4 -0
  166. package/dist/components/composites/terminal/terminal-model.d.ts +63 -0
  167. package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -0
  168. package/dist/components/composites/terminal/terminal-model.js +69 -0
  169. package/dist/components/composites/terminal/terminal-model.js.map +1 -0
  170. package/dist/components/composites/terminal/terminal.d.ts +88 -0
  171. package/dist/components/composites/terminal/terminal.d.ts.map +1 -0
  172. package/dist/components/composites/terminal/terminal.js +500 -0
  173. package/dist/components/composites/terminal/terminal.js.map +1 -0
  174. package/dist/components/composites/test-results/index.d.ts +3 -0
  175. package/dist/components/composites/test-results/index.d.ts.map +1 -0
  176. package/dist/components/composites/test-results/index.js +3 -0
  177. package/dist/components/composites/test-results/test-results-model.d.ts +154 -0
  178. package/dist/components/composites/test-results/test-results-model.d.ts.map +1 -0
  179. package/dist/components/composites/test-results/test-results-model.js +252 -0
  180. package/dist/components/composites/test-results/test-results-model.js.map +1 -0
  181. package/dist/components/composites/test-results/test-results.d.ts +60 -0
  182. package/dist/components/composites/test-results/test-results.d.ts.map +1 -0
  183. package/dist/components/composites/test-results/test-results.js +631 -0
  184. package/dist/components/composites/test-results/test-results.js.map +1 -0
  185. package/dist/components/composites/tool/format-tool-value.d.ts +37 -0
  186. package/dist/components/composites/tool/format-tool-value.d.ts.map +1 -0
  187. package/dist/components/composites/tool/format-tool-value.js +135 -0
  188. package/dist/components/composites/tool/format-tool-value.js.map +1 -0
  189. package/dist/components/composites/tool/index.d.ts +3 -0
  190. package/dist/components/composites/tool/index.d.ts.map +1 -0
  191. package/dist/components/composites/tool/index.js +3 -0
  192. package/dist/components/composites/tool/tool.d.ts +69 -0
  193. package/dist/components/composites/tool/tool.d.ts.map +1 -0
  194. package/dist/components/composites/tool/tool.js +214 -0
  195. package/dist/components/composites/tool/tool.js.map +1 -0
  196. package/dist/components/composites/update-dialog/update-dialog.js +1 -1
  197. package/dist/components/conversation/conversation-surface.d.ts +7 -0
  198. package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
  199. package/dist/components/conversation/conversation-surface.js +2 -0
  200. package/dist/components/conversation/conversation-surface.js.map +1 -1
  201. package/dist/components/conversation/scroll-follow-core.d.ts +24 -0
  202. package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
  203. package/dist/components/conversation/scroll-follow-core.js +23 -1
  204. package/dist/components/conversation/scroll-follow-core.js.map +1 -1
  205. package/dist/components/conversation/scroll-follow.d.ts +3 -0
  206. package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
  207. package/dist/components/conversation/scroll-follow.js +80 -1
  208. package/dist/components/conversation/scroll-follow.js.map +1 -1
  209. package/dist/components/ui/attachment/attachment.d.ts +58 -0
  210. package/dist/components/ui/attachment/attachment.d.ts.map +1 -0
  211. package/dist/components/ui/attachment/attachment.js +279 -0
  212. package/dist/components/ui/attachment/attachment.js.map +1 -0
  213. package/dist/components/ui/attachment/index.d.ts +2 -0
  214. package/dist/components/ui/attachment/index.d.ts.map +1 -0
  215. package/dist/components/ui/attachment/index.js +2 -0
  216. package/dist/components/ui/badge/badge.d.ts +1 -1
  217. package/dist/components/ui/bubble/bubble.d.ts +33 -0
  218. package/dist/components/ui/bubble/bubble.d.ts.map +1 -0
  219. package/dist/components/ui/bubble/bubble.js +95 -0
  220. package/dist/components/ui/bubble/bubble.js.map +1 -0
  221. package/dist/components/ui/bubble/index.d.ts +2 -0
  222. package/dist/components/ui/bubble/index.d.ts.map +1 -0
  223. package/dist/components/ui/bubble/index.js +2 -0
  224. package/dist/components/ui/button/button.d.ts +1 -1
  225. package/dist/components/ui/code-block/code-block.d.ts +56 -3
  226. package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
  227. package/dist/components/ui/code-block/code-block.js +231 -50
  228. package/dist/components/ui/code-block/code-block.js.map +1 -1
  229. package/dist/components/ui/code-block/index.d.ts +1 -1
  230. package/dist/components/ui/code-block/index.d.ts.map +1 -1
  231. package/dist/components/ui/code-block/index.js +2 -2
  232. package/dist/components/ui/field/number-field.d.ts +21 -4
  233. package/dist/components/ui/field/number-field.d.ts.map +1 -1
  234. package/dist/components/ui/field/number-field.js +22 -11
  235. package/dist/components/ui/field/number-field.js.map +1 -1
  236. package/dist/components/ui/marker/index.d.ts +2 -0
  237. package/dist/components/ui/marker/index.d.ts.map +1 -0
  238. package/dist/components/ui/marker/index.js +2 -0
  239. package/dist/components/ui/marker/marker.d.ts +35 -0
  240. package/dist/components/ui/marker/marker.d.ts.map +1 -0
  241. package/dist/components/ui/marker/marker.js +123 -0
  242. package/dist/components/ui/marker/marker.js.map +1 -0
  243. package/dist/components/ui/message/cite-ranges.d.ts +42 -0
  244. package/dist/components/ui/message/cite-ranges.d.ts.map +1 -0
  245. package/dist/components/ui/message/cite-ranges.js +105 -0
  246. package/dist/components/ui/message/cite-ranges.js.map +1 -0
  247. package/dist/components/ui/message/index.d.ts +4 -0
  248. package/dist/components/ui/message/index.d.ts.map +1 -0
  249. package/dist/components/ui/message/index.js +4 -0
  250. package/dist/components/ui/message/message.d.ts +95 -0
  251. package/dist/components/ui/message/message.d.ts.map +1 -0
  252. package/dist/components/ui/message/message.js +443 -0
  253. package/dist/components/ui/message/message.js.map +1 -0
  254. package/dist/components/ui/message/parse-message-text.d.ts +93 -0
  255. package/dist/components/ui/message/parse-message-text.d.ts.map +1 -0
  256. package/dist/components/ui/message/parse-message-text.js +365 -0
  257. package/dist/components/ui/message/parse-message-text.js.map +1 -0
  258. package/dist/components/ui/questionnaire/index.d.ts +2 -0
  259. package/dist/components/ui/questionnaire/index.d.ts.map +1 -0
  260. package/dist/components/ui/questionnaire/index.js +2 -0
  261. package/dist/components/ui/questionnaire/questionnaire.d.ts +83 -0
  262. package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -0
  263. package/dist/components/ui/questionnaire/questionnaire.js +470 -0
  264. package/dist/components/ui/questionnaire/questionnaire.js.map +1 -0
  265. package/dist/components/ui/status-chip/status-chip.d.ts +1 -1
  266. package/dist/components/ui/switch/switch.js +11 -11
  267. package/dist/components/ui/switch/switch.js.map +1 -1
  268. package/dist/components/ui/trace/index.d.ts +2 -0
  269. package/dist/components/ui/trace/index.d.ts.map +1 -0
  270. package/dist/components/ui/trace/index.js +2 -0
  271. package/dist/components/ui/trace/trace.d.ts +72 -0
  272. package/dist/components/ui/trace/trace.d.ts.map +1 -0
  273. package/dist/components/ui/trace/trace.js +340 -0
  274. package/dist/components/ui/trace/trace.js.map +1 -0
  275. package/dist/index.d.ts +26 -0
  276. package/dist/index.d.ts.map +1 -1
  277. package/dist/index.js +46 -5
  278. package/dist/r/attachment.json +25 -0
  279. package/dist/r/bubble.json +22 -0
  280. package/dist/r/chain-of-thought.json +26 -0
  281. package/dist/r/chat.json +24 -0
  282. package/dist/r/checkpoint.json +35 -0
  283. package/dist/r/confirmation.json +34 -0
  284. package/dist/r/context.json +33 -0
  285. package/dist/r/file-tree.json +32 -0
  286. package/dist/r/inline-citation.json +35 -0
  287. package/dist/r/marker.json +22 -0
  288. package/dist/r/message-scroller.json +31 -0
  289. package/dist/r/message.json +33 -0
  290. package/dist/r/model-selector.json +34 -0
  291. package/dist/r/plan.json +26 -0
  292. package/dist/r/questionnaire.json +28 -0
  293. package/dist/r/queue.json +26 -0
  294. package/dist/r/reasoning.json +26 -0
  295. package/dist/r/registry.json +811 -52
  296. package/dist/r/sources.json +32 -0
  297. package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +141 -0
  298. package/dist/r/src/components/composites/chain-of-thought/index.ts +11 -0
  299. package/dist/r/src/components/composites/chat/chat.tsx +190 -0
  300. package/dist/r/src/components/composites/chat/index.ts +11 -0
  301. package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +71 -0
  302. package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +214 -0
  303. package/dist/r/src/components/composites/checkpoint/index.ts +8 -0
  304. package/dist/r/src/components/composites/confirmation/confirmation-model.ts +83 -0
  305. package/dist/r/src/components/composites/confirmation/confirmation.tsx +311 -0
  306. package/dist/r/src/components/composites/confirmation/index.ts +9 -0
  307. package/dist/r/src/components/composites/context/context-model.ts +168 -0
  308. package/dist/r/src/components/composites/context/context.tsx +187 -0
  309. package/dist/r/src/components/composites/context/index.ts +18 -0
  310. package/dist/r/src/components/composites/file-tree/build-file-tree.ts +456 -0
  311. package/dist/r/src/components/composites/file-tree/file-tree.tsx +405 -0
  312. package/dist/r/src/components/composites/file-tree/index.ts +25 -0
  313. package/dist/r/src/components/composites/inline-citation/citation.ts +78 -0
  314. package/dist/r/src/components/composites/inline-citation/index.ts +9 -0
  315. package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +285 -0
  316. package/dist/r/src/components/composites/message-scroller/index.ts +2 -0
  317. package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +301 -0
  318. package/dist/r/src/components/composites/message-scroller/scroll-anchor.ts +170 -0
  319. package/dist/r/src/components/composites/model-selector/index.ts +14 -0
  320. package/dist/r/src/components/composites/model-selector/model-selector.tsx +420 -0
  321. package/dist/r/src/components/composites/model-selector/models.ts +103 -0
  322. package/dist/r/src/components/composites/plan/index.ts +1 -0
  323. package/dist/r/src/components/composites/plan/plan.tsx +155 -0
  324. package/dist/r/src/components/composites/queue/index.ts +10 -0
  325. package/dist/r/src/components/composites/queue/queue.tsx +264 -0
  326. package/dist/r/src/components/composites/reasoning/index.ts +1 -0
  327. package/dist/r/src/components/composites/reasoning/reasoning.tsx +176 -0
  328. package/dist/r/src/components/composites/sources/index.ts +11 -0
  329. package/dist/r/src/components/composites/sources/source.ts +116 -0
  330. package/dist/r/src/components/composites/sources/sources.tsx +163 -0
  331. package/dist/r/src/components/composites/stack-trace/index.ts +19 -0
  332. package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +507 -0
  333. package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +395 -0
  334. package/dist/r/src/components/composites/subagent/index.ts +1 -0
  335. package/dist/r/src/components/composites/subagent/subagent.tsx +159 -0
  336. package/dist/r/src/components/composites/suggestion/index.ts +1 -0
  337. package/dist/r/src/components/composites/suggestion/suggestion.tsx +140 -0
  338. package/dist/r/src/components/composites/task/index.ts +14 -0
  339. package/dist/r/src/components/composites/task/task.tsx +317 -0
  340. package/dist/r/src/components/composites/terminal/ansi.ts +674 -0
  341. package/dist/r/src/components/composites/terminal/index.ts +20 -0
  342. package/dist/r/src/components/composites/terminal/terminal-model.ts +111 -0
  343. package/dist/r/src/components/composites/terminal/terminal.tsx +574 -0
  344. package/dist/r/src/components/composites/test-results/index.ts +20 -0
  345. package/dist/r/src/components/composites/test-results/test-results-model.ts +368 -0
  346. package/dist/r/src/components/composites/test-results/test-results.tsx +586 -0
  347. package/dist/r/src/components/composites/tool/format-tool-value.ts +221 -0
  348. package/dist/r/src/components/composites/tool/index.ts +2 -0
  349. package/dist/r/src/components/composites/tool/tool.tsx +228 -0
  350. package/dist/r/src/components/conversation/conversation-surface.tsx +9 -0
  351. package/dist/r/src/components/conversation/scroll-follow-core.ts +31 -0
  352. package/dist/r/src/components/conversation/scroll-follow.ts +92 -0
  353. package/dist/r/src/components/ui/attachment/attachment.tsx +282 -0
  354. package/dist/r/src/components/ui/attachment/index.ts +10 -0
  355. package/dist/r/src/components/ui/bubble/bubble.tsx +86 -0
  356. package/dist/r/src/components/ui/bubble/index.ts +1 -0
  357. package/dist/r/src/components/ui/code-block/code-block.tsx +256 -26
  358. package/dist/r/src/components/ui/code-block/index.ts +9 -1
  359. package/dist/r/src/components/ui/field/number-field.tsx +51 -14
  360. package/dist/r/src/components/ui/marker/index.ts +1 -0
  361. package/dist/r/src/components/ui/marker/marker.tsx +90 -0
  362. package/dist/r/src/components/ui/message/cite-ranges.ts +144 -0
  363. package/dist/r/src/components/ui/message/index.ts +23 -0
  364. package/dist/r/src/components/ui/message/message.tsx +434 -0
  365. package/dist/r/src/components/ui/message/parse-message-text.ts +450 -0
  366. package/dist/r/src/components/ui/questionnaire/index.ts +10 -0
  367. package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +446 -0
  368. package/dist/r/src/components/ui/trace/index.ts +9 -0
  369. package/dist/r/src/components/ui/trace/trace.tsx +334 -0
  370. package/dist/r/src/styles/base.css +34 -0
  371. package/dist/r/stack-trace.json +32 -0
  372. package/dist/r/subagent.json +27 -0
  373. package/dist/r/suggestion.json +24 -0
  374. package/dist/r/task.json +28 -0
  375. package/dist/r/terminal.json +35 -0
  376. package/dist/r/test-results.json +33 -0
  377. package/dist/r/tool.json +31 -0
  378. package/dist/r/trace.json +25 -0
  379. package/package.json +6 -3
  380. package/registry.json +811 -52
  381. package/src/components/composites/chain-of-thought/chain-of-thought.tsx +141 -0
  382. package/src/components/composites/chain-of-thought/index.ts +11 -0
  383. package/src/components/composites/chat/chat.tsx +190 -0
  384. package/src/components/composites/chat/index.ts +11 -0
  385. package/src/components/composites/checkpoint/checkpoint-model.ts +71 -0
  386. package/src/components/composites/checkpoint/checkpoint.tsx +214 -0
  387. package/src/components/composites/checkpoint/index.ts +8 -0
  388. package/src/components/composites/confirmation/confirmation-model.ts +83 -0
  389. package/src/components/composites/confirmation/confirmation.tsx +311 -0
  390. package/src/components/composites/confirmation/index.ts +9 -0
  391. package/src/components/composites/context/context-model.ts +168 -0
  392. package/src/components/composites/context/context.tsx +187 -0
  393. package/src/components/composites/context/index.ts +18 -0
  394. package/src/components/composites/file-tree/build-file-tree.ts +456 -0
  395. package/src/components/composites/file-tree/file-tree.tsx +405 -0
  396. package/src/components/composites/file-tree/index.ts +25 -0
  397. package/src/components/composites/inline-citation/citation.ts +78 -0
  398. package/src/components/composites/inline-citation/index.ts +9 -0
  399. package/src/components/composites/inline-citation/inline-citation.tsx +285 -0
  400. package/src/components/composites/message-scroller/index.ts +2 -0
  401. package/src/components/composites/message-scroller/message-scroller.tsx +301 -0
  402. package/src/components/composites/message-scroller/scroll-anchor.ts +170 -0
  403. package/src/components/composites/model-selector/index.ts +14 -0
  404. package/src/components/composites/model-selector/model-selector.tsx +420 -0
  405. package/src/components/composites/model-selector/models.ts +103 -0
  406. package/src/components/composites/plan/index.ts +1 -0
  407. package/src/components/composites/plan/plan.tsx +155 -0
  408. package/src/components/composites/queue/index.ts +10 -0
  409. package/src/components/composites/queue/queue.tsx +264 -0
  410. package/src/components/composites/reasoning/index.ts +1 -0
  411. package/src/components/composites/reasoning/reasoning.tsx +176 -0
  412. package/src/components/composites/sources/index.ts +11 -0
  413. package/src/components/composites/sources/source.ts +116 -0
  414. package/src/components/composites/sources/sources.tsx +163 -0
  415. package/src/components/composites/stack-trace/index.ts +19 -0
  416. package/src/components/composites/stack-trace/parse-stack-trace.ts +507 -0
  417. package/src/components/composites/stack-trace/stack-trace.tsx +395 -0
  418. package/src/components/composites/subagent/index.ts +1 -0
  419. package/src/components/composites/subagent/subagent.tsx +159 -0
  420. package/src/components/composites/suggestion/index.ts +1 -0
  421. package/src/components/composites/suggestion/suggestion.tsx +140 -0
  422. package/src/components/composites/task/index.ts +14 -0
  423. package/src/components/composites/task/task.tsx +317 -0
  424. package/src/components/composites/terminal/ansi.ts +674 -0
  425. package/src/components/composites/terminal/index.ts +20 -0
  426. package/src/components/composites/terminal/terminal-model.ts +111 -0
  427. package/src/components/composites/terminal/terminal.tsx +574 -0
  428. package/src/components/composites/test-results/index.ts +20 -0
  429. package/src/components/composites/test-results/test-results-model.ts +368 -0
  430. package/src/components/composites/test-results/test-results.tsx +586 -0
  431. package/src/components/composites/tool/format-tool-value.ts +221 -0
  432. package/src/components/composites/tool/index.ts +2 -0
  433. package/src/components/composites/tool/tool.tsx +228 -0
  434. package/src/components/conversation/conversation-surface.tsx +9 -0
  435. package/src/components/conversation/scroll-follow-core.ts +31 -0
  436. package/src/components/conversation/scroll-follow.ts +92 -0
  437. package/src/components/ui/attachment/attachment.tsx +282 -0
  438. package/src/components/ui/attachment/index.ts +10 -0
  439. package/src/components/ui/bubble/bubble.tsx +86 -0
  440. package/src/components/ui/bubble/index.ts +1 -0
  441. package/src/components/ui/code-block/code-block.tsx +256 -26
  442. package/src/components/ui/code-block/index.ts +9 -1
  443. package/src/components/ui/field/number-field.tsx +51 -14
  444. package/src/components/ui/marker/index.ts +1 -0
  445. package/src/components/ui/marker/marker.tsx +90 -0
  446. package/src/components/ui/message/cite-ranges.ts +144 -0
  447. package/src/components/ui/message/index.ts +23 -0
  448. package/src/components/ui/message/message.tsx +434 -0
  449. package/src/components/ui/message/parse-message-text.ts +450 -0
  450. package/src/components/ui/questionnaire/index.ts +10 -0
  451. package/src/components/ui/questionnaire/questionnaire.tsx +446 -0
  452. package/src/components/ui/trace/index.ts +9 -0
  453. package/src/components/ui/trace/trace.tsx +334 -0
  454. package/src/index.ts +26 -0
  455. package/src/styles/base.css +34 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","names":["CircleAlert","Info","TriangleAlert","Show","splitProps","ComponentProps","JSX","Dynamic","cn","cva","VariantProps","ChatProps","header","Element","notices","composer","Chat","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_$spread","_$mergeProps","class","_$insert","children","ChatHeaderProps","Omit","title","subtitle","status","actions","ChatHeader","_el$6","_tmpl$4","_el$7","_el$8","_$createComponent","when","_el$9","_tmpl$2","_el$0","_tmpl$3","chatNoticeVariants","variants","tone","info","warning","danger","defaultVariants","ChatNoticeProps","description","action","live","ChatNotice","Glyph","_el$1","_tmpl$7","_el$10","_el$11","_el$12","role","_$memo","undefined","component","_el$13","_tmpl$5","_el$14","_tmpl$6","_$effect","_$className","ChatEmptyProps","suggestions","ChatEmpty","_el$15","_tmpl$9","_el$16","_el$17","_el$18","_tmpl$8","_$mergeProps","_$createComponent","_$memo","_$className"],"sources":["../../../../src/components/composites/chat/chat.tsx"],"sourcesContent":["import { CircleAlert, Info, TriangleAlert } from 'lucide-solid'\nimport { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * Chat.\n *\n * The frame a conversation lives in: a header, a strip for things the reader\n * must know before reading anything else, the thread, and the composer. It is a\n * layout and nothing more — the thread is a `MessageScroller`, the input is a\n * composer, and what happens in between is the host's — which is why it takes\n * slots instead of data.\n *\n * ## Why notices have their own row\n *\n * \"The connection dropped\", \"this transcript has a gap\", \"this session is\n * read-only\" are about the whole conversation, not about a turn, and they must\n * not scroll away with the turns. They sit between the header and the thread in\n * their own grid track, so a notice appearing never steals the thread's row and\n * collapses to zero height when there are none. Each notice states its cause in\n * words and carries its own remedy (`action`); one that reports a *change*\n * (`live`) is announced, one that describes a standing condition is not.\n *\n * ## Layout\n *\n * `h-full min-h-0`, so the thread scrolls inside the frame rather than the page\n * growing, and a `min-w-0` track, so a long unbroken token in a turn cannot widen\n * the whole conversation. Nothing here sets a width: the reading column is the\n * turn's, and the composer sets its own measure.\n */\nexport type ChatProps = ComponentProps<'section'> & {\n header?: JSX.Element\n /** `ChatNotice`s. The row collapses when this is empty. */\n notices?: JSX.Element\n /** The composer. */\n composer?: JSX.Element\n}\n\nexport function Chat(props: ChatProps) {\n const [local, rest] = splitProps(props, ['class', 'header', 'notices', 'composer', 'children'])\n return (\n <section\n data-slot=\"chat\"\n class={cn(\n 'grid h-full min-h-0 min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_auto_minmax(0,1fr)_auto] bg-background text-foreground',\n local.class\n )}\n {...rest}\n >\n <div class=\"row-start-1 min-w-0\">{local.header}</div>\n <div class=\"row-start-2 flex min-w-0 flex-col\">{local.notices}</div>\n <div class=\"row-start-3 flex min-h-0 min-w-0 flex-col\">{local.children}</div>\n <div class=\"row-start-4 min-w-0\">{local.composer}</div>\n </section>\n )\n}\n\nexport type ChatHeaderProps = Omit<ComponentProps<'header'>, 'title'> & {\n title: JSX.Element\n /** One line under the title: identity, scope, generation. */\n subtitle?: JSX.Element\n /** The conversation's state in words (a `StatusChip`). */\n status?: JSX.Element\n /** Host actions: rename, archive, hand off. */\n actions?: JSX.Element\n}\n\nexport function ChatHeader(props: ChatHeaderProps) {\n const [local, rest] = splitProps(props, ['class', 'title', 'subtitle', 'status', 'actions'])\n return (\n <header\n data-slot=\"chat-header\"\n class={cn(\n 'flex min-h-topbar min-w-0 items-center gap-3 border-b border-border px-4 py-2',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex min-w-0 flex-1 flex-col\">\n <h2 class=\"m-0 truncate text-sm font-semibold tracking-tight\">{local.title}</h2>\n <Show when={local.subtitle}>\n <p class=\"m-0 truncate text-xs text-muted-foreground\">{local.subtitle}</p>\n </Show>\n </div>\n <Show when={local.status}>{local.status}</Show>\n <Show when={local.actions}>\n <div class=\"flex shrink-0 items-center gap-1\">{local.actions}</div>\n </Show>\n </header>\n )\n}\n\nexport const chatNoticeVariants = cva(\n 'flex min-w-0 items-start gap-2.5 border-b px-4 py-2 text-sm',\n {\n variants: {\n tone: {\n info: 'border-border bg-muted/40',\n warning: 'border-warning/30 bg-warning-subtle',\n danger: 'border-destructive/30 bg-destructive-subtle',\n },\n },\n defaultVariants: { tone: 'info' },\n }\n)\n\nexport type ChatNoticeProps = Omit<ComponentProps<'div'>, 'title'> &\n VariantProps<typeof chatNoticeVariants> & {\n title: JSX.Element\n description?: JSX.Element\n /** The remedy: Reconnect, Jump to terminal. */\n action?: JSX.Element\n /** Announce it. Use for a change (connection lost), not a standing condition. */\n live?: 'polite' | 'assertive'\n }\n\nexport function ChatNotice(props: ChatNoticeProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'title',\n 'description',\n 'action',\n 'live',\n ])\n const Glyph = () =>\n local.tone === 'danger' ? CircleAlert : local.tone === 'warning' ? TriangleAlert : Info\n return (\n <div\n data-slot=\"chat-notice\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(chatNoticeVariants({ tone: local.tone }), local.class)}\n {...rest}\n >\n <span\n aria-hidden=\"true\"\n class={cn('mt-0.5 shrink-0 [&_svg]:size-4', {\n 'text-muted-foreground': (local.tone ?? 'info') === 'info',\n 'text-warning': local.tone === 'warning',\n 'text-destructive': local.tone === 'danger',\n })}\n >\n <Dynamic component={Glyph()} />\n </span>\n <div class=\"min-w-0 flex-1\">\n <p class=\"m-0 font-medium [overflow-wrap:anywhere]\">{local.title}</p>\n <Show when={local.description}>\n <p class=\"m-0 text-xs text-muted-foreground [overflow-wrap:anywhere]\">\n {local.description}\n </p>\n </Show>\n </div>\n <Show when={local.action}>\n <div class=\"flex shrink-0 items-center gap-1.5\">{local.action}</div>\n </Show>\n </div>\n )\n}\n\nexport type ChatEmptyProps = Omit<ComponentProps<'div'>, 'title'> & {\n title: JSX.Element\n description?: JSX.Element\n /** Prompt chips (`Suggestions`), shown only when the host has real ones. */\n suggestions?: JSX.Element\n}\n\n/** A conversation with no turns yet. Centred in the thread, never in a card. */\nexport function ChatEmpty(props: ChatEmptyProps) {\n const [local, rest] = splitProps(props, ['class', 'title', 'description', 'suggestions'])\n return (\n <div\n data-slot=\"chat-empty\"\n class={cn(\n 'mx-auto flex min-h-full w-full max-w-xl flex-col items-center justify-center gap-4 px-6 py-10 text-center',\n local.class\n )}\n {...rest}\n >\n <div class=\"flex flex-col gap-1\">\n <h3 class=\"m-0 text-base font-semibold tracking-tight text-balance\">{local.title}</h3>\n <Show when={local.description}>\n <p class=\"m-0 text-sm text-muted-foreground text-balance\">{local.description}</p>\n </Show>\n </div>\n <Show when={local.suggestions}>{local.suggestions}</Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwCA,SAAgBgB,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQf,WAAWa,OAAO;EAAC;EAAS;EAAU;EAAW;EAAY;CAAU,CAAC;CAC9F,cAAA;EAAA,IAAAG,OAAAC,OAAA,GAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAG,aAAAC,QAAAF,MAAAC,aAAAE,Q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GvD"}
@@ -0,0 +1,2 @@
1
+ export { Chat, ChatEmpty, ChatHeader, ChatNotice, chatNoticeVariants, type ChatEmptyProps, type ChatHeaderProps, type ChatNoticeProps, type ChatProps, } from './chat';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { Chat, ChatEmpty, ChatHeader, ChatNotice, chatNoticeVariants } from "./chat.js";
2
+ export { Chat, ChatEmpty, ChatHeader, ChatNotice, chatNoticeVariants };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Where a restore stands. `idle` is the resting state of a checkpoint that has
3
+ * not been restored from; the other three are only ever set because something
4
+ * happened — the host passes them, or the component sets them from the promise
5
+ * `onRestore` returned.
6
+ */
7
+ export type CheckpointState = 'idle' | 'restoring' | 'restored' | 'failed';
8
+ /** The checkpoint's name as drawn; a blank label is the honest generic word. */
9
+ export declare function checkpointLabel(label: string | undefined): string;
10
+ /**
11
+ * The sentence for the status region. `idle` says nothing, because a
12
+ * checkpoint that has not been touched makes no statement. A failure carries the
13
+ * host's text when there is one.
14
+ */
15
+ export declare function checkpointStatus(state: CheckpointState, error?: string, disabledReason?: string): string | undefined;
16
+ /**
17
+ * The confirmation dialog's words. The host's `consequence` is what actually
18
+ * names what will change, so it is used verbatim (bounded); without one the dialog
19
+ * says only what a restore always means and does not guess at the rest.
20
+ */
21
+ export declare function restoreDialogCopy(label: string | undefined, consequence: string | undefined): {
22
+ title: string;
23
+ description: string;
24
+ };
25
+ /**
26
+ * Whether the Restore control exists, and whether it can be used. It exists only
27
+ * when the host passed a handler — a checkpoint that cannot be restored must not
28
+ * look as if it can — and goes once the restore has succeeded.
29
+ */
30
+ export declare function restoreControl(hasHandler: boolean, state: CheckpointState, disabledReason: string | undefined): {
31
+ visible: boolean;
32
+ disabled: boolean;
33
+ };
34
+ //# sourceMappingURL=checkpoint-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-model.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/checkpoint/checkpoint-model.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAA;AAE1E,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,eAAe,EACtB,KAAK,CAAC,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,GAAG,SAAS,CAapB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAOxC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,eAAe,EACtB,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAKzC"}
@@ -0,0 +1,48 @@
1
+ import { boundText } from "../sources/source.js";
2
+ //#region src/components/composites/checkpoint/checkpoint-model.ts
3
+ /** The checkpoint's name as drawn; a blank label is the honest generic word. */
4
+ function checkpointLabel(label) {
5
+ return (label ? boundText(label, 80) : "") || "Checkpoint";
6
+ }
7
+ /**
8
+ * The sentence for the status region. `idle` says nothing, because a
9
+ * checkpoint that has not been touched makes no statement. A failure carries the
10
+ * host's text when there is one.
11
+ */
12
+ function checkpointStatus(state, error, disabledReason) {
13
+ switch (state) {
14
+ case "restoring": return "Restoring…";
15
+ case "restored": return "Restored";
16
+ case "failed": {
17
+ const detail = error ? boundText(error, 240) : "";
18
+ return detail ? `Restore failed: ${detail}` : "Restore failed";
19
+ }
20
+ case "idle": return disabledReason ? boundText(disabledReason, 240) : void 0;
21
+ }
22
+ }
23
+ /**
24
+ * The confirmation dialog's words. The host's `consequence` is what actually
25
+ * names what will change, so it is used verbatim (bounded); without one the dialog
26
+ * says only what a restore always means and does not guess at the rest.
27
+ */
28
+ function restoreDialogCopy(label, consequence) {
29
+ return {
30
+ title: `Restore to “${checkpointLabel(label)}”?`,
31
+ description: consequence ? boundText(consequence, 400) : "Restoring returns to this checkpoint."
32
+ };
33
+ }
34
+ /**
35
+ * Whether the Restore control exists, and whether it can be used. It exists only
36
+ * when the host passed a handler — a checkpoint that cannot be restored must not
37
+ * look as if it can — and goes once the restore has succeeded.
38
+ */
39
+ function restoreControl(hasHandler, state, disabledReason) {
40
+ return {
41
+ visible: hasHandler && state !== "restored",
42
+ disabled: state === "restoring" || disabledReason !== void 0
43
+ };
44
+ }
45
+ //#endregion
46
+ export { checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy };
47
+
48
+ //# sourceMappingURL=checkpoint-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-model.js","names":[],"sources":["../../../../src/components/composites/checkpoint/checkpoint-model.ts"],"sourcesContent":["import { boundText } from '../sources/source'\n\n/**\n * Where a restore stands. `idle` is the resting state of a checkpoint that has\n * not been restored from; the other three are only ever set because something\n * happened — the host passes them, or the component sets them from the promise\n * `onRestore` returned.\n */\nexport type CheckpointState = 'idle' | 'restoring' | 'restored' | 'failed'\n\n/** The checkpoint's name as drawn; a blank label is the honest generic word. */\nexport function checkpointLabel(label: string | undefined): string {\n return (label ? boundText(label, 80) : '') || 'Checkpoint'\n}\n\n/**\n * The sentence for the status region. `idle` says nothing, because a\n * checkpoint that has not been touched makes no statement. A failure carries the\n * host's text when there is one.\n */\nexport function checkpointStatus(\n state: CheckpointState,\n error?: string,\n disabledReason?: string\n): string | undefined {\n switch (state) {\n case 'restoring':\n return 'Restoring…'\n case 'restored':\n return 'Restored'\n case 'failed': {\n const detail = error ? boundText(error, 240) : ''\n return detail ? `Restore failed: ${detail}` : 'Restore failed'\n }\n case 'idle':\n return disabledReason ? boundText(disabledReason, 240) : undefined\n }\n}\n\n/**\n * The confirmation dialog's words. The host's `consequence` is what actually\n * names what will change, so it is used verbatim (bounded); without one the dialog\n * says only what a restore always means and does not guess at the rest.\n */\nexport function restoreDialogCopy(\n label: string | undefined,\n consequence: string | undefined\n): { title: string; description: string } {\n return {\n title: `Restore to “${checkpointLabel(label)}”?`,\n description: consequence\n ? boundText(consequence, 400)\n : 'Restoring returns to this checkpoint.',\n }\n}\n\n/**\n * Whether the Restore control exists, and whether it can be used. It exists only\n * when the host passed a handler — a checkpoint that cannot be restored must not\n * look as if it can — and goes once the restore has succeeded.\n */\nexport function restoreControl(\n hasHandler: boolean,\n state: CheckpointState,\n disabledReason: string | undefined\n): { visible: boolean; disabled: boolean } {\n return {\n visible: hasHandler && state !== 'restored',\n disabled: state === 'restoring' || disabledReason !== undefined,\n }\n}\n"],"mappings":";;;AAWA,SAAgB,gBAAgB,OAAmC;CACjE,QAAQ,QAAQ,UAAU,OAAO,EAAE,IAAI,OAAO;AAChD;;;;;;AAOA,SAAgB,iBACd,OACA,OACA,gBACoB;CACpB,QAAQ,OAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,UAAU;GACb,MAAM,SAAS,QAAQ,UAAU,OAAO,GAAG,IAAI;GAC/C,OAAO,SAAS,mBAAmB,WAAW;EAChD;EACA,KAAK,QACH,OAAO,iBAAiB,UAAU,gBAAgB,GAAG,IAAI,KAAA;CAC7D;AACF;;;;;;AAOA,SAAgB,kBACd,OACA,aACwC;CACxC,OAAO;EACL,OAAO,eAAe,gBAAgB,KAAK,EAAE;EAC7C,aAAa,cACT,UAAU,aAAa,GAAG,IAC1B;CACN;AACF;;;;;;AAOA,SAAgB,eACd,YACA,OACA,gBACyC;CACzC,OAAO;EACL,SAAS,cAAc,UAAU;EACjC,UAAU,UAAU,eAAe,mBAAmB,KAAA;CACxD;AACF"}
@@ -0,0 +1,48 @@
1
+ import { type ComponentProps } from 'solid-js';
2
+ import { type CheckpointState } from './checkpoint-model';
3
+ /**
4
+ * Checkpoint.
5
+ *
6
+ * A point in the conversation the host can name: a divider in the transcript with
7
+ * a label and a time. It always renders — as a `Marker`, the quietest thing in the
8
+ * column — and it is honest about what it is:
9
+ *
10
+ * - **Without `onRestore` it is only a marker.** Not a disabled button, not a
11
+ * greyed-out "Restore": nothing. Whether a checkpoint can be returned to is a
12
+ * fact about the host's storage and permissions, and a control that implies it
13
+ * can would be a claim nobody made.
14
+ * - **With `onRestore` it offers Restore, and Restore asks first.** An
15
+ * `AlertDialog` (Escape and the scrim do nothing; every exit is a named choice)
16
+ * states what will change in the host's own words (`consequence`) before the
17
+ * handler is called. A restore throws work away; the confirmation is the point.
18
+ *
19
+ * ## States
20
+ *
21
+ * `idle` → `restoring` → `restored`, or `failed` with `error`. Pass `state` to
22
+ * drive it from the host; omit it and the component follows the promise
23
+ * `onRestore` returns. The status sentence is a live region that exists from the
24
+ * start, so a change is announced. While restoring, the control stays focusable
25
+ * (`aria-disabled`, not `disabled`) so focus is not dropped when the dialog hands
26
+ * it back; once restored the control goes and focus moves to the status line.
27
+ *
28
+ * A restore that cannot happen now takes `disabledReason`, shown in words under
29
+ * the divider; the host decides, the component explains.
30
+ */
31
+ export type CheckpointProps = Omit<ComponentProps<'div'>, 'children' | 'onError'> & {
32
+ /** The checkpoint's name. Defaults to "Checkpoint". */
33
+ label?: string;
34
+ /** When it was taken, already formatted for the reader. */
35
+ time?: string;
36
+ state?: CheckpointState;
37
+ /** Supplying this is what makes the checkpoint restorable. */
38
+ onRestore?: () => void | Promise<void>;
39
+ /** What restoring will change, in the host's words. Shown in the confirmation. */
40
+ consequence?: string;
41
+ restoreLabel?: string;
42
+ /** Why Restore cannot be used right now. */
43
+ disabledReason?: string;
44
+ /** Why a restore failed. */
45
+ error?: string;
46
+ };
47
+ export declare function Checkpoint(props: CheckpointProps): import("solid-js").JSX.Element;
48
+ //# sourceMappingURL=checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAA;AAkBjB,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAA;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG;IAClF,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,kCAoIhD"}
@@ -0,0 +1,160 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "../../ui/alert-dialog/alert-dialog.js";
3
+ import { Button } from "../../ui/button/button.js";
4
+ import { Spinner } from "../../ui/spinner/spinner.js";
5
+ import { Marker } from "../../ui/marker/marker.js";
6
+ import { boundText } from "../sources/source.js";
7
+ import { settleDecision } from "../confirmation/confirmation-model.js";
8
+ import { checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy } from "./checkpoint-model.js";
9
+ import { className, createComponent, effect, insert, memo, mergeProps, setAttribute, spread, template, use } from "solid-js/web";
10
+ import { Flag } from "lucide-solid";
11
+ import { Show, createEffect, createMemo, createSignal, createUniqueId, on, splitProps } from "solid-js";
12
+ //#region src/components/composites/checkpoint/checkpoint.tsx
13
+ var _tmpl$ = /*#__PURE__*/ template(`<div data-slot=checkpoint><p role=status tabindex=-1>`);
14
+ function Checkpoint(props) {
15
+ const [local, rest] = splitProps(props, [
16
+ "class",
17
+ "label",
18
+ "time",
19
+ "state",
20
+ "onRestore",
21
+ "consequence",
22
+ "restoreLabel",
23
+ "disabledReason",
24
+ "error"
25
+ ]);
26
+ const reasonId = `${createUniqueId()}-status`;
27
+ const [followed, setFollowed] = createSignal("idle");
28
+ const [failure, setFailure] = createSignal(void 0);
29
+ const [confirming, setConfirming] = createSignal(false);
30
+ let inflight = false;
31
+ let root;
32
+ let status;
33
+ const state = () => local.state ?? followed();
34
+ const error = () => local.error ?? failure();
35
+ const control = () => restoreControl(local.onRestore !== void 0, state(), local.disabledReason);
36
+ const copy = () => restoreDialogCopy(local.label, local.consequence);
37
+ const statusText = () => checkpointStatus(state(), error(), local.disabledReason);
38
+ const restore = async () => {
39
+ if (inflight || control().disabled) return;
40
+ inflight = true;
41
+ setFailure(void 0);
42
+ setFollowed("restoring");
43
+ const result = await settleDecision(local.onRestore);
44
+ inflight = false;
45
+ if (result.ok) setFollowed("restored");
46
+ else {
47
+ setFailure(result.message);
48
+ setFollowed("failed");
49
+ }
50
+ };
51
+ createEffect(on(() => state() === "restored", (restored) => {
52
+ if (!restored) return;
53
+ const active = document.activeElement;
54
+ if (active === null || active === document.body || root?.contains(active)) status?.focus();
55
+ }, { defer: true }));
56
+ const restoreAction = createMemo(() => createComponent(Show, {
57
+ get when() {
58
+ return control().visible;
59
+ },
60
+ get children() {
61
+ return createComponent(AlertDialog, {
62
+ get open() {
63
+ return confirming();
64
+ },
65
+ onOpenChange: (open) => setConfirming(open && !control().disabled),
66
+ get children() {
67
+ return [createComponent(AlertDialogTrigger, {
68
+ as: Button,
69
+ variant: "ghost",
70
+ size: "2xs",
71
+ get ["aria-disabled"]() {
72
+ return control().disabled || void 0;
73
+ },
74
+ get ["aria-describedby"]() {
75
+ return statusText() ? reasonId : void 0;
76
+ },
77
+ get children() {
78
+ return [createComponent(Show, {
79
+ get when() {
80
+ return state() === "restoring";
81
+ },
82
+ get children() {
83
+ return createComponent(Spinner, {
84
+ size: "xs",
85
+ label: false
86
+ });
87
+ }
88
+ }), memo(() => memo(() => state() === "restoring")() ? "Restoring…" : local.restoreLabel ?? (state() === "failed" ? "Try again" : "Restore"))];
89
+ }
90
+ }), createComponent(AlertDialogContent, { get children() {
91
+ return [createComponent(AlertDialogHeader, { get children() {
92
+ return [createComponent(AlertDialogTitle, { get children() {
93
+ return copy().title;
94
+ } }), createComponent(AlertDialogDescription, {
95
+ "class": "[overflow-wrap:anywhere]",
96
+ get children() {
97
+ return copy().description;
98
+ }
99
+ })];
100
+ } }), createComponent(AlertDialogFooter, { get children() {
101
+ return [createComponent(AlertDialogCancel, {
102
+ as: Button,
103
+ variant: "ghost",
104
+ children: "Do not restore"
105
+ }), createComponent(AlertDialogAction, {
106
+ as: Button,
107
+ onClick: () => void restore(),
108
+ get children() {
109
+ return local.restoreLabel ?? "Restore";
110
+ }
111
+ })];
112
+ } })];
113
+ } })];
114
+ }
115
+ });
116
+ }
117
+ }));
118
+ return (() => {
119
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild;
120
+ use((element) => root = element, _el$);
121
+ spread(_el$, mergeProps({
122
+ get ["data-state"]() {
123
+ return state();
124
+ },
125
+ get ["class"]() {
126
+ return local.class;
127
+ }
128
+ }, rest), false, true);
129
+ insert(_el$, createComponent(Marker, {
130
+ variant: "rule",
131
+ get icon() {
132
+ return createComponent(Flag, {});
133
+ },
134
+ get tone() {
135
+ return state() === "failed" ? "danger" : "neutral";
136
+ },
137
+ get label() {
138
+ return checkpointLabel(local.label);
139
+ },
140
+ get description() {
141
+ return memo(() => !!local.time)() ? boundText(local.time, 60) : void 0;
142
+ },
143
+ get action() {
144
+ return restoreAction();
145
+ }
146
+ }), _el$2);
147
+ use((element) => status = element, _el$2);
148
+ setAttribute(_el$2, "id", reasonId);
149
+ insert(_el$2, statusText);
150
+ effect(() => className(_el$2, cn("m-0 text-center text-xs outline-none [overflow-wrap:anywhere]", {
151
+ "text-destructive": state() === "failed",
152
+ "text-muted-foreground": state() !== "failed"
153
+ })));
154
+ return _el$;
155
+ })();
156
+ }
157
+ //#endregion
158
+ export { Checkpoint };
159
+
160
+ //# sourceMappingURL=checkpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint.js","names":["Flag","createEffect","createMemo","createSignal","createUniqueId","on","Show","splitProps","ComponentProps","cn","Button","AlertDialog","AlertDialogAction","AlertDialogCancel","AlertDialogContent","AlertDialogDescription","AlertDialogFooter","AlertDialogHeader","AlertDialogTitle","AlertDialogTrigger","Marker","Spinner","settleDecision","boundText","checkpointLabel","checkpointStatus","restoreControl","restoreDialogCopy","CheckpointState","CheckpointProps","Omit","label","time","state","onRestore","Promise","consequence","restoreLabel","disabledReason","error","Checkpoint","props","local","rest","uid","reasonId","followed","setFollowed","failure","setFailure","undefined","confirming","setConfirming","inflight","root","HTMLDivElement","status","HTMLParagraphElement","control","copy","statusText","restore","disabled","result","ok","message","restored","active","document","activeElement","body","contains","focus","defer","restoreAction","_$createComponent","when","visible","children","open","onOpenChange","as","variant","size","aria-disabled","aria-describedby","_$memo","title","description","onClick","_el$","_tmpl$","_el$2","firstChild","_$use","element","_$spread","_$mergeProps","data-state","class","_$insert","icon","tone","action","_$setAttribute","_$effect","_$className","_$createComponent","_$memo","_$mergeProps","_$className"],"sources":["../../../../src/components/composites/checkpoint/checkpoint.tsx"],"sourcesContent":["import { Flag } from 'lucide-solid'\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n on,\n Show,\n splitProps,\n type ComponentProps,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from '../../ui/alert-dialog'\nimport { Marker } from '../../ui/marker'\nimport { Spinner } from '../../ui/spinner'\nimport { settleDecision } from '../confirmation/confirmation-model'\nimport { boundText } from '../sources/source'\nimport {\n checkpointLabel,\n checkpointStatus,\n restoreControl,\n restoreDialogCopy,\n type CheckpointState,\n} from './checkpoint-model'\n\n/**\n * Checkpoint.\n *\n * A point in the conversation the host can name: a divider in the transcript with\n * a label and a time. It always renders — as a `Marker`, the quietest thing in the\n * column — and it is honest about what it is:\n *\n * - **Without `onRestore` it is only a marker.** Not a disabled button, not a\n * greyed-out \"Restore\": nothing. Whether a checkpoint can be returned to is a\n * fact about the host's storage and permissions, and a control that implies it\n * can would be a claim nobody made.\n * - **With `onRestore` it offers Restore, and Restore asks first.** An\n * `AlertDialog` (Escape and the scrim do nothing; every exit is a named choice)\n * states what will change in the host's own words (`consequence`) before the\n * handler is called. A restore throws work away; the confirmation is the point.\n *\n * ## States\n *\n * `idle` → `restoring` → `restored`, or `failed` with `error`. Pass `state` to\n * drive it from the host; omit it and the component follows the promise\n * `onRestore` returns. The status sentence is a live region that exists from the\n * start, so a change is announced. While restoring, the control stays focusable\n * (`aria-disabled`, not `disabled`) so focus is not dropped when the dialog hands\n * it back; once restored the control goes and focus moves to the status line.\n *\n * A restore that cannot happen now takes `disabledReason`, shown in words under\n * the divider; the host decides, the component explains.\n */\nexport type CheckpointProps = Omit<ComponentProps<'div'>, 'children' | 'onError'> & {\n /** The checkpoint's name. Defaults to \"Checkpoint\". */\n label?: string\n /** When it was taken, already formatted for the reader. */\n time?: string\n state?: CheckpointState\n /** Supplying this is what makes the checkpoint restorable. */\n onRestore?: () => void | Promise<void>\n /** What restoring will change, in the host's words. Shown in the confirmation. */\n consequence?: string\n restoreLabel?: string\n /** Why Restore cannot be used right now. */\n disabledReason?: string\n /** Why a restore failed. */\n error?: string\n}\n\nexport function Checkpoint(props: CheckpointProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'time',\n 'state',\n 'onRestore',\n 'consequence',\n 'restoreLabel',\n 'disabledReason',\n 'error',\n ])\n const uid = createUniqueId()\n const reasonId = `${uid}-status`\n const [followed, setFollowed] = createSignal<CheckpointState>('idle')\n const [failure, setFailure] = createSignal<string | undefined>(undefined)\n const [confirming, setConfirming] = createSignal(false)\n let inflight = false\n let root: HTMLDivElement | undefined\n let status: HTMLParagraphElement | undefined\n\n const state = (): CheckpointState => local.state ?? followed()\n const error = () => local.error ?? failure()\n const control = () => restoreControl(local.onRestore !== undefined, state(), local.disabledReason)\n const copy = () => restoreDialogCopy(local.label, local.consequence)\n const statusText = () => checkpointStatus(state(), error(), local.disabledReason)\n\n const restore = async () => {\n if (inflight || control().disabled) return\n inflight = true\n setFailure(undefined)\n setFollowed('restoring')\n const result = await settleDecision(local.onRestore)\n inflight = false\n if (result.ok) {\n setFollowed('restored')\n } else {\n setFailure(result.message)\n setFollowed('failed')\n }\n }\n\n // The control is replaced by the status line on success; do not strand focus.\n createEffect(\n on(\n () => state() === 'restored',\n (restored) => {\n if (!restored) return\n const active = document.activeElement\n if (active === null || active === document.body || root?.contains(active)) {\n status?.focus()\n }\n },\n { defer: true }\n )\n )\n\n // Built once. `Marker` reads `action` twice (to test it, then to draw it), and a\n // JSX prop re-creates its component on every read: a second AlertDialog root\n // would portal a second, invisible-to-the-tree dialog when this one opens.\n const restoreAction = createMemo(() => (\n <Show when={control().visible}>\n <AlertDialog\n open={confirming()}\n onOpenChange={(open) => setConfirming(open && !control().disabled)}\n >\n <AlertDialogTrigger\n as={Button}\n variant=\"ghost\"\n size=\"2xs\"\n aria-disabled={control().disabled || undefined}\n aria-describedby={statusText() ? reasonId : undefined}\n >\n <Show when={state() === 'restoring'}>\n <Spinner size=\"xs\" label={false} />\n </Show>\n {state() === 'restoring'\n ? 'Restoring…'\n : (local.restoreLabel ?? (state() === 'failed' ? 'Try again' : 'Restore'))}\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{copy().title}</AlertDialogTitle>\n <AlertDialogDescription class=\"[overflow-wrap:anywhere]\">\n {copy().description}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel as={Button} variant=\"ghost\">\n Do not restore\n </AlertDialogCancel>\n <AlertDialogAction as={Button} onClick={() => void restore()}>\n {local.restoreLabel ?? 'Restore'}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </Show>\n ))\n\n return (\n <div\n ref={(element) => (root = element)}\n data-slot=\"checkpoint\"\n data-state={state()}\n class={local.class}\n {...rest}\n >\n <Marker\n variant=\"rule\"\n icon={<Flag />}\n tone={state() === 'failed' ? 'danger' : 'neutral'}\n label={checkpointLabel(local.label)}\n description={local.time ? boundText(local.time, 60) : undefined}\n action={restoreAction()}\n />\n {/* Always present, so a state change is a change to a live region rather than\n the arrival of one. Empty while idle, which takes no space. */}\n <p\n id={reasonId}\n ref={(element) => (status = element)}\n role=\"status\"\n tabindex=\"-1\"\n class={cn('m-0 text-center text-xs outline-none [overflow-wrap:anywhere]', {\n 'text-destructive': state() === 'failed',\n 'text-muted-foreground': state() !== 'failed',\n })}\n >\n {statusText()}\n </p>\n </div>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AAd,OALJnF,GAAG,iEAAiE;GACzE,oBAAoBwB,MAAM,MAAM;GAChC,yBAAyBA,MAAM,MAAM;EACvC,CAAC,CAAC,CAAA;EAAA,OAAAyD;CAAA,EAAA,CAAA;AAMV"}
@@ -0,0 +1,3 @@
1
+ export { Checkpoint, type CheckpointProps } from './checkpoint';
2
+ export { checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy, type CheckpointState, } from './checkpoint-model';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/checkpoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy } from "./checkpoint-model.js";
2
+ import { Checkpoint } from "./checkpoint.js";
3
+ export { Checkpoint, checkpointLabel, checkpointStatus, restoreControl, restoreDialogCopy };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Where a request for approval stands.
3
+ *
4
+ * - `requested`: waiting on the reader. The only state with live buttons.
5
+ * - `approved` / `denied`: settled; the record of the answer.
6
+ * - `expired`: nobody can answer it any more (the run moved on, a timeout).
7
+ * - `unavailable`: it is still open, but this client cannot answer it right now
8
+ * (offline, no authority, another client holds it). The buttons stay visible and
9
+ * disabled so the reader can see what was asked and why they cannot answer.
10
+ */
11
+ export type ConfirmationState = 'requested' | 'approved' | 'denied' | 'expired' | 'unavailable';
12
+ /** Whether the choice is still open, which is exactly when the buttons are drawn. */
13
+ export declare function isAwaitingAnswer(state: ConfirmationState): boolean;
14
+ /**
15
+ * The one line that replaces the buttons once the request settles. Who and when
16
+ * appear only if the host supplied them: "Approved" is a fact the state gives,
17
+ * "by Ana" is a fact only the host knows.
18
+ */
19
+ export declare function confirmationOutcome(state: ConfirmationState, by?: string, at?: string): string | undefined;
20
+ export type DecisionResult = {
21
+ ok: true;
22
+ } | {
23
+ ok: false;
24
+ message: string;
25
+ };
26
+ /**
27
+ * Run a host handler that may be synchronous, asynchronous, or throw, and report
28
+ * the outcome as data. A rejection's own message is shown (bounded) because the
29
+ * host usually knows why; a non-Error rejection gets a plain sentence instead of
30
+ * "[object Object]".
31
+ */
32
+ export declare function settleDecision(handler: (() => void | Promise<void>) | undefined): Promise<DecisionResult>;
33
+ /**
34
+ * Why a choice is not available, in words. A host `disabledReason` outranks the
35
+ * built-in sentence for a missing handler, and a request that is `unavailable`
36
+ * without a reason still says so rather than showing dead buttons.
37
+ */
38
+ export declare function decisionReason(options: {
39
+ state: ConfirmationState;
40
+ disabledReason?: string;
41
+ hasHandler: boolean;
42
+ unavailableFallback: string;
43
+ missingFallback: string;
44
+ }): string | undefined;
45
+ //# sourceMappingURL=confirmation-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-model.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/confirmation/confirmation-model.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAA;AAE/F,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAElE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,EAAE,CAAC,EAAE,MAAM,EACX,EAAE,CAAC,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAapB;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAI1E;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,GAChD,OAAO,CAAC,cAAc,CAAC,CAQzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,KAAK,EAAE,iBAAiB,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,MAAM,GAAG,SAAS,CAMrB"}
@@ -0,0 +1,51 @@
1
+ import { boundText } from "../sources/source.js";
2
+ //#region src/components/composites/confirmation/confirmation-model.ts
3
+ /** Whether the choice is still open, which is exactly when the buttons are drawn. */
4
+ function isAwaitingAnswer(state) {
5
+ return state === "requested" || state === "unavailable";
6
+ }
7
+ /**
8
+ * The one line that replaces the buttons once the request settles. Who and when
9
+ * appear only if the host supplied them: "Approved" is a fact the state gives,
10
+ * "by Ana" is a fact only the host knows.
11
+ */
12
+ function confirmationOutcome(state, by, at) {
13
+ const base = state === "approved" ? "Approved" : state === "denied" ? "Denied" : state === "expired" ? "Expired without an answer" : void 0;
14
+ if (base === void 0) return void 0;
15
+ const who = by ? boundText(by, 60) : "";
16
+ const when = at ? boundText(at, 40) : "";
17
+ return `${base}${who ? ` by ${who}` : ""}${when ? ` at ${when}` : ""}`;
18
+ }
19
+ var DEFAULT_FAILURE = "Your answer could not be sent. Try again.";
20
+ /**
21
+ * Run a host handler that may be synchronous, asynchronous, or throw, and report
22
+ * the outcome as data. A rejection's own message is shown (bounded) because the
23
+ * host usually knows why; a non-Error rejection gets a plain sentence instead of
24
+ * "[object Object]".
25
+ */
26
+ async function settleDecision(handler) {
27
+ try {
28
+ await handler?.();
29
+ return { ok: true };
30
+ } catch (error) {
31
+ return {
32
+ ok: false,
33
+ message: (error instanceof Error ? boundText(error.message, 200) : "") || DEFAULT_FAILURE
34
+ };
35
+ }
36
+ }
37
+ /**
38
+ * Why a choice is not available, in words. A host `disabledReason` outranks the
39
+ * built-in sentence for a missing handler, and a request that is `unavailable`
40
+ * without a reason still says so rather than showing dead buttons.
41
+ */
42
+ function decisionReason(options) {
43
+ const hostReason = options.disabledReason ? boundText(options.disabledReason, 240) : "";
44
+ if (hostReason) return hostReason;
45
+ if (options.state === "unavailable") return options.unavailableFallback;
46
+ if (!options.hasHandler) return options.missingFallback;
47
+ }
48
+ //#endregion
49
+ export { confirmationOutcome, decisionReason, isAwaitingAnswer, settleDecision };
50
+
51
+ //# sourceMappingURL=confirmation-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-model.js","names":[],"sources":["../../../../src/components/composites/confirmation/confirmation-model.ts"],"sourcesContent":["import { boundText } from '../sources/source'\n\n/**\n * Where a request for approval stands.\n *\n * - `requested`: waiting on the reader. The only state with live buttons.\n * - `approved` / `denied`: settled; the record of the answer.\n * - `expired`: nobody can answer it any more (the run moved on, a timeout).\n * - `unavailable`: it is still open, but this client cannot answer it right now\n * (offline, no authority, another client holds it). The buttons stay visible and\n * disabled so the reader can see what was asked and why they cannot answer.\n */\nexport type ConfirmationState = 'requested' | 'approved' | 'denied' | 'expired' | 'unavailable'\n\n/** Whether the choice is still open, which is exactly when the buttons are drawn. */\nexport function isAwaitingAnswer(state: ConfirmationState): boolean {\n return state === 'requested' || state === 'unavailable'\n}\n\n/**\n * The one line that replaces the buttons once the request settles. Who and when\n * appear only if the host supplied them: \"Approved\" is a fact the state gives,\n * \"by Ana\" is a fact only the host knows.\n */\nexport function confirmationOutcome(\n state: ConfirmationState,\n by?: string,\n at?: string\n): string | undefined {\n const base =\n state === 'approved'\n ? 'Approved'\n : state === 'denied'\n ? 'Denied'\n : state === 'expired'\n ? 'Expired without an answer'\n : undefined\n if (base === undefined) return undefined\n const who = by ? boundText(by, 60) : ''\n const when = at ? boundText(at, 40) : ''\n return `${base}${who ? ` by ${who}` : ''}${when ? ` at ${when}` : ''}`\n}\n\nexport type DecisionResult = { ok: true } | { ok: false; message: string }\n\nconst DEFAULT_FAILURE = 'Your answer could not be sent. Try again.'\n\n/**\n * Run a host handler that may be synchronous, asynchronous, or throw, and report\n * the outcome as data. A rejection's own message is shown (bounded) because the\n * host usually knows why; a non-Error rejection gets a plain sentence instead of\n * \"[object Object]\".\n */\nexport async function settleDecision(\n handler: (() => void | Promise<void>) | undefined\n): Promise<DecisionResult> {\n try {\n await handler?.()\n return { ok: true }\n } catch (error) {\n const message = error instanceof Error ? boundText(error.message, 200) : ''\n return { ok: false, message: message || DEFAULT_FAILURE }\n }\n}\n\n/**\n * Why a choice is not available, in words. A host `disabledReason` outranks the\n * built-in sentence for a missing handler, and a request that is `unavailable`\n * without a reason still says so rather than showing dead buttons.\n */\nexport function decisionReason(options: {\n state: ConfirmationState\n disabledReason?: string\n hasHandler: boolean\n unavailableFallback: string\n missingFallback: string\n}): string | undefined {\n const hostReason = options.disabledReason ? boundText(options.disabledReason, 240) : ''\n if (hostReason) return hostReason\n if (options.state === 'unavailable') return options.unavailableFallback\n if (!options.hasHandler) return options.missingFallback\n return undefined\n}\n"],"mappings":";;;AAeA,SAAgB,iBAAiB,OAAmC;CAClE,OAAO,UAAU,eAAe,UAAU;AAC5C;;;;;;AAOA,SAAgB,oBACd,OACA,IACA,IACoB;CACpB,MAAM,OACJ,UAAU,aACN,aACA,UAAU,WACR,WACA,UAAU,YACR,8BACA,KAAA;CACV,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,MAAM,MAAM,KAAK,UAAU,IAAI,EAAE,IAAI;CACrC,MAAM,OAAO,KAAK,UAAU,IAAI,EAAE,IAAI;CACtC,OAAO,GAAG,OAAO,MAAM,OAAO,QAAQ,KAAK,OAAO,OAAO,SAAS;AACpE;AAIA,IAAM,kBAAkB;;;;;;;AAQxB,eAAsB,eACpB,SACyB;CACzB,IAAI;EACF,MAAM,UAAU;EAChB,OAAO,EAAE,IAAI,KAAK;CACpB,SAAS,OAAO;EAEd,OAAO;GAAE,IAAI;GAAO,UADJ,iBAAiB,QAAQ,UAAU,MAAM,SAAS,GAAG,IAAI,OACjC;EAAgB;CAC1D;AACF;;;;;;AAOA,SAAgB,eAAe,SAMR;CACrB,MAAM,aAAa,QAAQ,iBAAiB,UAAU,QAAQ,gBAAgB,GAAG,IAAI;CACrF,IAAI,YAAY,OAAO;CACvB,IAAI,QAAQ,UAAU,eAAe,OAAO,QAAQ;CACpD,IAAI,CAAC,QAAQ,YAAY,OAAO,QAAQ;AAE1C"}
@@ -0,0 +1,72 @@
1
+ import { type ComponentProps, type JSX } from 'solid-js';
2
+ import { type ConfirmationState } from './confirmation-model';
3
+ /**
4
+ * Confirmation.
5
+ *
6
+ * The agent has stopped a tool and will not continue until the person approves or
7
+ * denies it. Like `Questionnaire`, this is one of the two elements in a transcript
8
+ * the reader *must* act on, so it is allowed a card surface — and the border is
9
+ * the focus ring's colour only while it is waiting. Once answered it drops to a
10
+ * hairline and a one-line record, because a settled decision should read as
11
+ * history, not as something still asking.
12
+ *
13
+ * ## It shows what is being approved, and nothing else
14
+ *
15
+ * `title` and `description` say what the tool wants to do; `details` is the
16
+ * evidence, rendered as `CodeBlock size="sm"` (a command, a request) or
17
+ * `DiffBlock` (a patch). Details are text: never interpreted, and a long one
18
+ * scrolls inside its block. Approve and Deny exist only while the request is
19
+ * open; afterwards they are replaced by the outcome, with *who* and *when* only if
20
+ * the host supplied them.
21
+ *
22
+ * ## The host owns authority
23
+ *
24
+ * Whether this client may answer is not decided here. No handler, or a host
25
+ * `disabledReason`, or the `unavailable` state, leaves the buttons visible and
26
+ * disabled with the reason beside them in words — never hidden, because a reader
27
+ * who cannot see the choice cannot tell whether the agent is waiting on them.
28
+ *
29
+ * ## Answering is a round trip
30
+ *
31
+ * `onApprove` / `onDeny` may return a promise. While one is pending both buttons
32
+ * refuse input (a synchronous guard as well as the signal, so a double click in
33
+ * one tick cannot submit twice) and the pressed one shows a spinner. A failure
34
+ * shows `error` (or the rejection's own message) and re-enables the buttons. The
35
+ * buttons use `aria-disabled` rather than `disabled`: a native disabled button
36
+ * drops focus, and the reader's place would be lost mid-decision. When the state
37
+ * settles, focus moves to the outcome line if it was in the card, so a keyboard
38
+ * user is not stranded on a control that no longer exists.
39
+ */
40
+ export type ConfirmationDetails = Readonly<{
41
+ kind: 'code';
42
+ code: string;
43
+ language?: string;
44
+ title?: string;
45
+ }> | Readonly<{
46
+ kind: 'diff';
47
+ patch: string;
48
+ title?: string;
49
+ }>;
50
+ export type ConfirmationProps = Omit<ComponentProps<'section'>, 'title' | 'onError'> & {
51
+ state?: ConfirmationState;
52
+ /** What the tool wants to do, as a short sentence. */
53
+ title: string;
54
+ description?: string;
55
+ details?: ConfirmationDetails;
56
+ onApprove?: () => void | Promise<void>;
57
+ onDeny?: () => void | Promise<void>;
58
+ approveLabel?: string;
59
+ denyLabel?: string;
60
+ /** Why the choice cannot be made right now; shown in words beside the buttons. */
61
+ disabledReason?: string;
62
+ /** A failed answer, in words. Overrides the rejection's own message. */
63
+ error?: string;
64
+ /** Who answered, once settled. Omit if unknown; nothing is assumed. */
65
+ resolvedBy?: string;
66
+ /** When it was answered, already formatted for the reader. Omit if unknown. */
67
+ resolvedAt?: string;
68
+ /** Extra content between the details and the buttons. */
69
+ children?: JSX.Element;
70
+ };
71
+ export declare function Confirmation(props: ConfirmationProps): JSX.Element;
72
+ //# sourceMappingURL=confirmation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/confirmation/confirmation.tsx"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAOjB,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAA;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,MAAM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