@flanksource/clicky-ui 0.2.19 → 0.2.21

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 (423) hide show
  1. package/dist/ai.cjs +26 -0
  2. package/dist/ai.cjs.map +1 -0
  3. package/dist/ai.d.ts +2 -0
  4. package/dist/ai.d.ts.map +1 -0
  5. package/dist/ai.js +26 -0
  6. package/dist/ai.js.map +1 -0
  7. package/dist/chat.cjs +7 -0
  8. package/dist/chat.cjs.map +1 -1
  9. package/dist/chat.js +7 -0
  10. package/dist/chat.js.map +1 -1
  11. package/dist/components/FilterBar.cjs +49 -18
  12. package/dist/components/FilterBar.cjs.map +1 -1
  13. package/dist/components/FilterBar.d.ts +0 -2
  14. package/dist/components/FilterBar.d.ts.map +1 -1
  15. package/dist/components/FilterBar.js +50 -19
  16. package/dist/components/FilterBar.js.map +1 -1
  17. package/dist/components/SearchInput.cjs +63 -0
  18. package/dist/components/SearchInput.cjs.map +1 -0
  19. package/dist/components/SearchInput.d.ts +31 -0
  20. package/dist/components/SearchInput.d.ts.map +1 -0
  21. package/dist/components/SearchInput.js +63 -0
  22. package/dist/components/SearchInput.js.map +1 -0
  23. package/dist/components/SegmentedControl.cjs +88 -0
  24. package/dist/components/SegmentedControl.cjs.map +1 -0
  25. package/dist/components/SegmentedControl.d.ts +38 -0
  26. package/dist/components/SegmentedControl.d.ts.map +1 -0
  27. package/dist/components/SegmentedControl.js +88 -0
  28. package/dist/components/SegmentedControl.js.map +1 -0
  29. package/dist/components/Switch.cjs +51 -0
  30. package/dist/components/Switch.cjs.map +1 -0
  31. package/dist/components/Switch.d.ts +23 -0
  32. package/dist/components/Switch.d.ts.map +1 -0
  33. package/dist/components/Switch.js +51 -0
  34. package/dist/components/Switch.js.map +1 -0
  35. package/dist/components/TimeRange.cjs +53 -45
  36. package/dist/components/TimeRange.cjs.map +1 -1
  37. package/dist/components/TimeRange.d.ts.map +1 -1
  38. package/dist/components/TimeRange.js +53 -45
  39. package/dist/components/TimeRange.js.map +1 -1
  40. package/dist/components/TreePickerField.cjs +5 -1
  41. package/dist/components/TreePickerField.cjs.map +1 -1
  42. package/dist/components/TreePickerField.d.ts.map +1 -1
  43. package/dist/components/TreePickerField.js +5 -1
  44. package/dist/components/TreePickerField.js.map +1 -1
  45. package/dist/components/filter-bar-utils.cjs +5 -0
  46. package/dist/components/filter-bar-utils.cjs.map +1 -1
  47. package/dist/components/filter-bar-utils.d.ts +2 -0
  48. package/dist/components/filter-bar-utils.d.ts.map +1 -1
  49. package/dist/components/filter-bar-utils.js +5 -0
  50. package/dist/components/filter-bar-utils.js.map +1 -1
  51. package/dist/components/json-schema-form-fields.cjs +8 -2
  52. package/dist/components/json-schema-form-fields.cjs.map +1 -1
  53. package/dist/components/json-schema-form-fields.d.ts.map +1 -1
  54. package/dist/components/json-schema-form-fields.js +8 -2
  55. package/dist/components/json-schema-form-fields.js.map +1 -1
  56. package/dist/components/json-schema-form-resolve.cjs +1 -1
  57. package/dist/components/json-schema-form-resolve.cjs.map +1 -1
  58. package/dist/components/json-schema-form-resolve.js +1 -1
  59. package/dist/components/json-schema-form-resolve.js.map +1 -1
  60. package/dist/components.cjs +15 -1
  61. package/dist/components.cjs.map +1 -1
  62. package/dist/components.d.ts +8 -1
  63. package/dist/components.d.ts.map +1 -1
  64. package/dist/components.js +15 -1
  65. package/dist/components.js.map +1 -1
  66. package/dist/data/Clicky.cjs +33 -44
  67. package/dist/data/Clicky.cjs.map +1 -1
  68. package/dist/data/Clicky.d.ts +0 -9
  69. package/dist/data/Clicky.d.ts.map +1 -1
  70. package/dist/data/Clicky.js +31 -42
  71. package/dist/data/Clicky.js.map +1 -1
  72. package/dist/data/DataTable.cjs +73 -50
  73. package/dist/data/DataTable.cjs.map +1 -1
  74. package/dist/data/DataTable.d.ts +4 -0
  75. package/dist/data/DataTable.d.ts.map +1 -1
  76. package/dist/data/DataTable.js +73 -50
  77. package/dist/data/DataTable.js.map +1 -1
  78. package/dist/data/Icon.cjs +2 -5
  79. package/dist/data/Icon.cjs.map +1 -1
  80. package/dist/data/Icon.d.ts +1 -21
  81. package/dist/data/Icon.d.ts.map +1 -1
  82. package/dist/data/Icon.js +3 -6
  83. package/dist/data/Icon.js.map +1 -1
  84. package/dist/data/MatrixTable.cjs +4 -4
  85. package/dist/data/MatrixTable.cjs.map +1 -1
  86. package/dist/data/MatrixTable.js +4 -4
  87. package/dist/data/MatrixTable.js.map +1 -1
  88. package/dist/data/RadialGauge.cjs +76 -0
  89. package/dist/data/RadialGauge.cjs.map +1 -0
  90. package/dist/data/RadialGauge.d.ts +24 -0
  91. package/dist/data/RadialGauge.d.ts.map +1 -0
  92. package/dist/data/RadialGauge.js +76 -0
  93. package/dist/data/RadialGauge.js.map +1 -0
  94. package/dist/data/StatusBreakdown.cjs +0 -4
  95. package/dist/data/StatusBreakdown.cjs.map +1 -1
  96. package/dist/data/StatusBreakdown.d.ts +0 -2
  97. package/dist/data/StatusBreakdown.d.ts.map +1 -1
  98. package/dist/data/StatusBreakdown.js +1 -5
  99. package/dist/data/StatusBreakdown.js.map +1 -1
  100. package/dist/data/Timeline.cjs +61 -0
  101. package/dist/data/Timeline.cjs.map +1 -0
  102. package/dist/data/Timeline.d.ts +36 -0
  103. package/dist/data/Timeline.d.ts.map +1 -0
  104. package/dist/data/Timeline.js +61 -0
  105. package/dist/data/Timeline.js.map +1 -0
  106. package/dist/data/TimeseriesCoreBars.cjs +2 -25
  107. package/dist/data/TimeseriesCoreBars.cjs.map +1 -1
  108. package/dist/data/TimeseriesCoreBars.d.ts +0 -19
  109. package/dist/data/TimeseriesCoreBars.d.ts.map +1 -1
  110. package/dist/data/TimeseriesCoreBars.js +2 -25
  111. package/dist/data/TimeseriesCoreBars.js.map +1 -1
  112. package/dist/data/TimeseriesCoreBars.model.cjs +27 -0
  113. package/dist/data/TimeseriesCoreBars.model.cjs.map +1 -0
  114. package/dist/data/TimeseriesCoreBars.model.d.ts +20 -0
  115. package/dist/data/TimeseriesCoreBars.model.d.ts.map +1 -0
  116. package/dist/data/TimeseriesCoreBars.model.js +27 -0
  117. package/dist/data/TimeseriesCoreBars.model.js.map +1 -0
  118. package/dist/data/TimeseriesPanel.axes.cjs.map +1 -1
  119. package/dist/data/TimeseriesPanel.axes.d.ts +1 -1
  120. package/dist/data/TimeseriesPanel.axes.d.ts.map +1 -1
  121. package/dist/data/TimeseriesPanel.axes.js.map +1 -1
  122. package/dist/data/TimeseriesPanel.cjs +4 -54
  123. package/dist/data/TimeseriesPanel.cjs.map +1 -1
  124. package/dist/data/TimeseriesPanel.d.ts +2 -138
  125. package/dist/data/TimeseriesPanel.d.ts.map +1 -1
  126. package/dist/data/TimeseriesPanel.js +2 -52
  127. package/dist/data/TimeseriesPanel.js.map +1 -1
  128. package/dist/data/TimeseriesPanel.model.cjs +53 -0
  129. package/dist/data/TimeseriesPanel.model.cjs.map +1 -0
  130. package/dist/data/TimeseriesPanel.model.d.ts +88 -0
  131. package/dist/data/TimeseriesPanel.model.d.ts.map +1 -0
  132. package/dist/data/TimeseriesPanel.model.js +53 -0
  133. package/dist/data/TimeseriesPanel.model.js.map +1 -0
  134. package/dist/data/Tree.cjs +1 -1
  135. package/dist/data/Tree.cjs.map +1 -1
  136. package/dist/data/Tree.js +1 -1
  137. package/dist/data/Tree.js.map +1 -1
  138. package/dist/data/ai/ChatFab.cjs +29 -0
  139. package/dist/data/ai/ChatFab.cjs.map +1 -0
  140. package/dist/data/ai/ChatFab.d.ts +12 -0
  141. package/dist/data/ai/ChatFab.d.ts.map +1 -0
  142. package/dist/data/ai/ChatFab.js +29 -0
  143. package/dist/data/ai/ChatFab.js.map +1 -0
  144. package/dist/data/ai/ChatWindow.cjs +178 -0
  145. package/dist/data/ai/ChatWindow.cjs.map +1 -0
  146. package/dist/data/ai/ChatWindow.d.ts +38 -0
  147. package/dist/data/ai/ChatWindow.d.ts.map +1 -0
  148. package/dist/data/ai/ChatWindow.js +156 -0
  149. package/dist/data/ai/ChatWindow.js.map +1 -0
  150. package/dist/data/ai/ChatWindowManager.cjs +139 -0
  151. package/dist/data/ai/ChatWindowManager.cjs.map +1 -0
  152. package/dist/data/ai/ChatWindowManager.d.ts +12 -0
  153. package/dist/data/ai/ChatWindowManager.d.ts.map +1 -0
  154. package/dist/data/ai/ChatWindowManager.js +139 -0
  155. package/dist/data/ai/ChatWindowManager.js.map +1 -0
  156. package/dist/data/ai/ContextBadges.cjs +74 -0
  157. package/dist/data/ai/ContextBadges.cjs.map +1 -0
  158. package/dist/data/ai/ContextBadges.d.ts +16 -0
  159. package/dist/data/ai/ContextBadges.d.ts.map +1 -0
  160. package/dist/data/ai/ContextBadges.js +74 -0
  161. package/dist/data/ai/ContextBadges.js.map +1 -0
  162. package/dist/data/ai/ThreadPicker.cjs +148 -0
  163. package/dist/data/ai/ThreadPicker.cjs.map +1 -0
  164. package/dist/data/ai/ThreadPicker.d.ts +37 -0
  165. package/dist/data/ai/ThreadPicker.d.ts.map +1 -0
  166. package/dist/data/ai/ThreadPicker.js +148 -0
  167. package/dist/data/ai/ThreadPicker.js.map +1 -0
  168. package/dist/data/ai/ToolPreferences.cjs +80 -0
  169. package/dist/data/ai/ToolPreferences.cjs.map +1 -0
  170. package/dist/data/ai/ToolPreferences.d.ts +19 -0
  171. package/dist/data/ai/ToolPreferences.d.ts.map +1 -0
  172. package/dist/data/ai/ToolPreferences.js +80 -0
  173. package/dist/data/ai/ToolPreferences.js.map +1 -0
  174. package/dist/data/ai/chat-window-context.cjs +78 -0
  175. package/dist/data/ai/chat-window-context.cjs.map +1 -0
  176. package/dist/data/ai/chat-window-context.d.ts +57 -0
  177. package/dist/data/ai/chat-window-context.d.ts.map +1 -0
  178. package/dist/data/ai/chat-window-context.js +78 -0
  179. package/dist/data/ai/chat-window-context.js.map +1 -0
  180. package/dist/data/ai/context.cjs +43 -0
  181. package/dist/data/ai/context.cjs.map +1 -0
  182. package/dist/data/ai/context.d.ts +35 -0
  183. package/dist/data/ai/context.d.ts.map +1 -0
  184. package/dist/data/ai/context.js +43 -0
  185. package/dist/data/ai/context.js.map +1 -0
  186. package/dist/data/ai/index.d.ts +10 -0
  187. package/dist/data/ai/index.d.ts.map +1 -0
  188. package/dist/data/cache-browser/CacheDetailPanel.cjs +15 -0
  189. package/dist/data/cache-browser/CacheDetailPanel.cjs.map +1 -1
  190. package/dist/data/cache-browser/CacheDetailPanel.d.ts.map +1 -1
  191. package/dist/data/cache-browser/CacheDetailPanel.js +15 -0
  192. package/dist/data/cache-browser/CacheDetailPanel.js.map +1 -1
  193. package/dist/data/cache-browser/cache-browser.fixtures.d.ts +10 -0
  194. package/dist/data/cache-browser/cache-browser.fixtures.d.ts.map +1 -0
  195. package/dist/data/cache-browser/download.cjs +13 -0
  196. package/dist/data/cache-browser/download.cjs.map +1 -0
  197. package/dist/data/cache-browser/download.d.ts +3 -0
  198. package/dist/data/cache-browser/download.d.ts.map +1 -0
  199. package/dist/data/cache-browser/download.js +13 -0
  200. package/dist/data/cache-browser/download.js.map +1 -0
  201. package/dist/data/chat/Chat.cjs +44 -3
  202. package/dist/data/chat/Chat.cjs.map +1 -1
  203. package/dist/data/chat/Chat.d.ts +5 -2
  204. package/dist/data/chat/Chat.d.ts.map +1 -1
  205. package/dist/data/chat/Chat.fixtures.cjs +86 -0
  206. package/dist/data/chat/Chat.fixtures.cjs.map +1 -0
  207. package/dist/data/chat/Chat.fixtures.d.ts +4 -0
  208. package/dist/data/chat/Chat.fixtures.d.ts.map +1 -1
  209. package/dist/data/chat/Chat.fixtures.js +86 -0
  210. package/dist/data/chat/Chat.fixtures.js.map +1 -0
  211. package/dist/data/chat/Chat.js +45 -4
  212. package/dist/data/chat/Chat.js.map +1 -1
  213. package/dist/data/chat/ContextUsage.cjs +99 -0
  214. package/dist/data/chat/ContextUsage.cjs.map +1 -0
  215. package/dist/data/chat/ContextUsage.d.ts +19 -0
  216. package/dist/data/chat/ContextUsage.d.ts.map +1 -0
  217. package/dist/data/chat/ContextUsage.js +99 -0
  218. package/dist/data/chat/ContextUsage.js.map +1 -0
  219. package/dist/data/chat/Conversation.cjs +47 -2
  220. package/dist/data/chat/Conversation.cjs.map +1 -1
  221. package/dist/data/chat/Conversation.d.ts +8 -2
  222. package/dist/data/chat/Conversation.d.ts.map +1 -1
  223. package/dist/data/chat/Conversation.js +47 -2
  224. package/dist/data/chat/Conversation.js.map +1 -1
  225. package/dist/data/chat/ModelSelector.cjs +28 -14
  226. package/dist/data/chat/ModelSelector.cjs.map +1 -1
  227. package/dist/data/chat/ModelSelector.d.ts +5 -4
  228. package/dist/data/chat/ModelSelector.d.ts.map +1 -1
  229. package/dist/data/chat/ModelSelector.js +28 -14
  230. package/dist/data/chat/ModelSelector.js.map +1 -1
  231. package/dist/data/chat/clickyOperationsToTools.cjs +21 -1
  232. package/dist/data/chat/clickyOperationsToTools.cjs.map +1 -1
  233. package/dist/data/chat/clickyOperationsToTools.d.ts +5 -4
  234. package/dist/data/chat/clickyOperationsToTools.d.ts.map +1 -1
  235. package/dist/data/chat/clickyOperationsToTools.js +21 -1
  236. package/dist/data/chat/clickyOperationsToTools.js.map +1 -1
  237. package/dist/data/chat/index.d.ts +4 -1
  238. package/dist/data/chat/index.d.ts.map +1 -1
  239. package/dist/data/chat/provider-icons.cjs +15 -0
  240. package/dist/data/chat/provider-icons.cjs.map +1 -0
  241. package/dist/data/chat/provider-icons.d.ts +7 -0
  242. package/dist/data/chat/provider-icons.d.ts.map +1 -0
  243. package/dist/data/chat/provider-icons.js +15 -0
  244. package/dist/data/chat/provider-icons.js.map +1 -0
  245. package/dist/data/chat/types.cjs.map +1 -1
  246. package/dist/data/chat/types.d.ts +41 -9
  247. package/dist/data/chat/types.d.ts.map +1 -1
  248. package/dist/data/chat/types.js.map +1 -1
  249. package/dist/data/clicky-parse.cjs +42 -0
  250. package/dist/data/clicky-parse.cjs.map +1 -0
  251. package/dist/data/clicky-parse.d.ts +11 -0
  252. package/dist/data/clicky-parse.d.ts.map +1 -0
  253. package/dist/data/clicky-parse.js +42 -0
  254. package/dist/data/clicky-parse.js.map +1 -0
  255. package/dist/data/diagnostics/FrameSourceWindow.cjs +0 -4
  256. package/dist/data/diagnostics/FrameSourceWindow.cjs.map +1 -1
  257. package/dist/data/diagnostics/FrameSourceWindow.d.ts +1 -11
  258. package/dist/data/diagnostics/FrameSourceWindow.d.ts.map +1 -1
  259. package/dist/data/diagnostics/FrameSourceWindow.js +1 -5
  260. package/dist/data/diagnostics/FrameSourceWindow.js.map +1 -1
  261. package/dist/data/diagnostics/FrameSourceWindow.utils.cjs +7 -0
  262. package/dist/data/diagnostics/FrameSourceWindow.utils.cjs.map +1 -0
  263. package/dist/data/diagnostics/FrameSourceWindow.utils.d.ts +12 -0
  264. package/dist/data/diagnostics/FrameSourceWindow.utils.d.ts.map +1 -0
  265. package/dist/data/diagnostics/FrameSourceWindow.utils.js +7 -0
  266. package/dist/data/diagnostics/FrameSourceWindow.utils.js.map +1 -0
  267. package/dist/data/diagnostics/JvmStackTrace.cjs +2 -1
  268. package/dist/data/diagnostics/JvmStackTrace.cjs.map +1 -1
  269. package/dist/data/diagnostics/JvmStackTrace.d.ts.map +1 -1
  270. package/dist/data/diagnostics/JvmStackTrace.js +2 -1
  271. package/dist/data/diagnostics/JvmStackTrace.js.map +1 -1
  272. package/dist/data/icon-fallback.cjs +12 -0
  273. package/dist/data/icon-fallback.cjs.map +1 -0
  274. package/dist/data/icon-fallback.d.ts +19 -0
  275. package/dist/data/icon-fallback.d.ts.map +1 -0
  276. package/dist/data/icon-fallback.js +12 -0
  277. package/dist/data/icon-fallback.js.map +1 -0
  278. package/dist/data/status-breakdown-utils.cjs +7 -0
  279. package/dist/data/status-breakdown-utils.cjs.map +1 -0
  280. package/dist/data/status-breakdown-utils.d.ts +4 -0
  281. package/dist/data/status-breakdown-utils.d.ts.map +1 -0
  282. package/dist/data/status-breakdown-utils.js +7 -0
  283. package/dist/data/status-breakdown-utils.js.map +1 -0
  284. package/dist/data/test-runner/TestRunSummary.cjs +36 -0
  285. package/dist/data/test-runner/TestRunSummary.cjs.map +1 -1
  286. package/dist/data/test-runner/TestRunSummary.d.ts +7 -1
  287. package/dist/data/test-runner/TestRunSummary.d.ts.map +1 -1
  288. package/dist/data/test-runner/TestRunSummary.js +36 -0
  289. package/dist/data/test-runner/TestRunSummary.js.map +1 -1
  290. package/dist/data/test-runner/TestRunner.cjs +5 -3
  291. package/dist/data/test-runner/TestRunner.cjs.map +1 -1
  292. package/dist/data/test-runner/TestRunner.d.ts +13 -1
  293. package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
  294. package/dist/data/test-runner/TestRunner.js +5 -3
  295. package/dist/data/test-runner/TestRunner.js.map +1 -1
  296. package/dist/data/version-info.cjs +3 -3
  297. package/dist/data/version-info.js +3 -3
  298. package/dist/data.cjs +19 -6
  299. package/dist/data.cjs.map +1 -1
  300. package/dist/data.d.ts +13 -5
  301. package/dist/data.d.ts.map +1 -1
  302. package/dist/data.js +18 -5
  303. package/dist/data.js.map +1 -1
  304. package/dist/index.cjs +51 -7
  305. package/dist/index.cjs.map +1 -1
  306. package/dist/index.js +50 -6
  307. package/dist/index.js.map +1 -1
  308. package/dist/layout/AppShell.cjs +179 -29
  309. package/dist/layout/AppShell.cjs.map +1 -1
  310. package/dist/layout/AppShell.d.ts +5 -5
  311. package/dist/layout/AppShell.d.ts.map +1 -1
  312. package/dist/layout/AppShell.js +179 -29
  313. package/dist/layout/AppShell.js.map +1 -1
  314. package/dist/layout/AppSidebar.cjs +239 -0
  315. package/dist/layout/AppSidebar.cjs.map +1 -0
  316. package/dist/layout/AppSidebar.d.ts +62 -0
  317. package/dist/layout/AppSidebar.d.ts.map +1 -0
  318. package/dist/layout/AppSidebar.js +239 -0
  319. package/dist/layout/AppSidebar.js.map +1 -0
  320. package/dist/overlay/DropdownMenu.cjs.map +1 -1
  321. package/dist/overlay/DropdownMenu.d.ts.map +1 -1
  322. package/dist/overlay/DropdownMenu.js.map +1 -1
  323. package/dist/overlay/Modal.cjs +4 -2
  324. package/dist/overlay/Modal.cjs.map +1 -1
  325. package/dist/overlay/Modal.d.ts +1 -1
  326. package/dist/overlay/Modal.d.ts.map +1 -1
  327. package/dist/overlay/Modal.js +4 -2
  328. package/dist/overlay/Modal.js.map +1 -1
  329. package/dist/overlay/Toast.cjs +89 -0
  330. package/dist/overlay/Toast.cjs.map +1 -0
  331. package/dist/overlay/Toast.d.ts +14 -0
  332. package/dist/overlay/Toast.d.ts.map +1 -0
  333. package/dist/overlay/Toast.js +89 -0
  334. package/dist/overlay/Toast.js.map +1 -0
  335. package/dist/overlay/toast-context.cjs +12 -0
  336. package/dist/overlay/toast-context.cjs.map +1 -0
  337. package/dist/overlay/toast-context.d.ts +24 -0
  338. package/dist/overlay/toast-context.d.ts.map +1 -0
  339. package/dist/overlay/toast-context.js +12 -0
  340. package/dist/overlay/toast-context.js.map +1 -0
  341. package/dist/rpc/AcceptPicker.cjs +81 -58
  342. package/dist/rpc/AcceptPicker.cjs.map +1 -1
  343. package/dist/rpc/AcceptPicker.d.ts.map +1 -1
  344. package/dist/rpc/AcceptPicker.js +81 -58
  345. package/dist/rpc/AcceptPicker.js.map +1 -1
  346. package/dist/rpc/CommandForm.cjs +5 -35
  347. package/dist/rpc/CommandForm.cjs.map +1 -1
  348. package/dist/rpc/CommandForm.d.ts +0 -3
  349. package/dist/rpc/CommandForm.d.ts.map +1 -1
  350. package/dist/rpc/CommandForm.js +2 -32
  351. package/dist/rpc/CommandForm.js.map +1 -1
  352. package/dist/rpc/CommandOutput.cjs +2 -1
  353. package/dist/rpc/CommandOutput.cjs.map +1 -1
  354. package/dist/rpc/CommandOutput.d.ts.map +1 -1
  355. package/dist/rpc/CommandOutput.js +2 -1
  356. package/dist/rpc/CommandOutput.js.map +1 -1
  357. package/dist/rpc/EntityExplorerApp.cjs +28 -83
  358. package/dist/rpc/EntityExplorerApp.cjs.map +1 -1
  359. package/dist/rpc/EntityExplorerApp.d.ts +1 -4
  360. package/dist/rpc/EntityExplorerApp.d.ts.map +1 -1
  361. package/dist/rpc/EntityExplorerApp.js +13 -68
  362. package/dist/rpc/EntityExplorerApp.js.map +1 -1
  363. package/dist/rpc/OperationCatalog.cjs +2 -2
  364. package/dist/rpc/OperationCatalog.cjs.map +1 -1
  365. package/dist/rpc/OperationCatalog.d.ts +1 -1
  366. package/dist/rpc/OperationCatalog.d.ts.map +1 -1
  367. package/dist/rpc/OperationCatalog.js +1 -1
  368. package/dist/rpc/OperationCatalog.js.map +1 -1
  369. package/dist/rpc/OperationCommandPage.cjs +6 -4
  370. package/dist/rpc/OperationCommandPage.cjs.map +1 -1
  371. package/dist/rpc/OperationCommandPage.d.ts.map +1 -1
  372. package/dist/rpc/OperationCommandPage.js +3 -1
  373. package/dist/rpc/OperationCommandPage.js.map +1 -1
  374. package/dist/rpc/RouterProvider.cjs +10 -0
  375. package/dist/rpc/RouterProvider.cjs.map +1 -0
  376. package/dist/rpc/RouterProvider.d.ts +10 -0
  377. package/dist/rpc/RouterProvider.d.ts.map +1 -0
  378. package/dist/rpc/RouterProvider.js +10 -0
  379. package/dist/rpc/RouterProvider.js.map +1 -0
  380. package/dist/rpc/apiClient.cjs +4 -4
  381. package/dist/rpc/apiClient.cjs.map +1 -1
  382. package/dist/rpc/apiClient.js +4 -4
  383. package/dist/rpc/apiClient.js.map +1 -1
  384. package/dist/rpc/command-form-utils.cjs +43 -0
  385. package/dist/rpc/command-form-utils.cjs.map +1 -0
  386. package/dist/rpc/command-form-utils.d.ts +5 -0
  387. package/dist/rpc/command-form-utils.d.ts.map +1 -0
  388. package/dist/rpc/command-form-utils.js +43 -0
  389. package/dist/rpc/command-form-utils.js.map +1 -0
  390. package/dist/rpc/commandHref.cjs +62 -0
  391. package/dist/rpc/commandHref.cjs.map +1 -0
  392. package/dist/rpc/commandHref.d.ts +7 -0
  393. package/dist/rpc/commandHref.d.ts.map +1 -0
  394. package/dist/rpc/commandHref.js +62 -0
  395. package/dist/rpc/commandHref.js.map +1 -0
  396. package/dist/rpc/formMetadata.cjs +1 -1
  397. package/dist/rpc/formMetadata.cjs.map +1 -1
  398. package/dist/rpc/formMetadata.js +1 -1
  399. package/dist/rpc/formMetadata.js.map +1 -1
  400. package/dist/rpc/router.cjs +83 -0
  401. package/dist/rpc/router.cjs.map +1 -0
  402. package/dist/rpc/router.d.ts +24 -0
  403. package/dist/rpc/router.d.ts.map +1 -0
  404. package/dist/rpc/router.js +83 -0
  405. package/dist/rpc/router.js.map +1 -0
  406. package/dist/rpc/rpc-story-fixtures/orders.fixture.d.ts +3 -0
  407. package/dist/rpc/rpc-story-fixtures/orders.fixture.d.ts.map +1 -0
  408. package/dist/rpc/rpc-story-fixtures/services.fixture.d.ts +3 -0
  409. package/dist/rpc/rpc-story-fixtures/services.fixture.d.ts.map +1 -0
  410. package/dist/rpc/rpc-story-fixtures/surface-fixture.d.ts +24 -0
  411. package/dist/rpc/rpc-story-fixtures/surface-fixture.d.ts.map +1 -0
  412. package/dist/rpc/rpc-story-fixtures/widgets.fixture.d.ts +3 -0
  413. package/dist/rpc/rpc-story-fixtures/widgets.fixture.d.ts.map +1 -0
  414. package/dist/rpc/rpc-story.fixtures.d.ts +16 -0
  415. package/dist/rpc/rpc-story.fixtures.d.ts.map +1 -0
  416. package/dist/rpc.cjs +17 -0
  417. package/dist/rpc.cjs.map +1 -1
  418. package/dist/rpc.d.ts +5 -0
  419. package/dist/rpc.d.ts.map +1 -1
  420. package/dist/rpc.js +18 -1
  421. package/dist/rpc.js.map +1 -1
  422. package/dist/styles.css +1 -1
  423. package/package.json +11 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Conversation.js","sources":["../../../src/data/chat/Conversation.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { Icon } from \"../Icon\";\nimport { UiArrowDown } from \"../../icons\";\nimport { Message, type MessageActionHandlers } from \"./Message\";\nimport type { UIMessage } from \"./types\";\n\nexport type ConversationProps = MessageActionHandlers & {\n messages: UIMessage[];\n /** Shown when there are no messages yet. */\n emptyState?: React.ReactNode;\n className?: string;\n};\n\n/** A scrollable message log that sticks to the bottom as new content streams\n * in, unless the user has scrolled up — in which case a jump-to-bottom button\n * appears. */\nexport function Conversation({ messages, emptyState, className, ...actions }: ConversationProps) {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [pinned, setPinned] = useState(true);\n\n const onScroll = () => {\n const el = scrollRef.current;\n if (!el) return;\n const distance = el.scrollHeight - el.scrollTop - el.clientHeight;\n setPinned(distance < 32);\n };\n\n useEffect(() => {\n const el = scrollRef.current;\n if (el && pinned) {\n el.scrollTop = el.scrollHeight;\n }\n });\n\n const scrollToBottom = () => {\n const el = scrollRef.current;\n if (el) el.scrollTo({ top: el.scrollHeight, behavior: \"smooth\" });\n };\n\n return (\n <div className=\"relative flex min-h-0 flex-1 flex-col\">\n <div\n ref={scrollRef}\n onScroll={onScroll}\n role=\"log\"\n className={cn(\"flex-1 overflow-y-auto\", className)}\n >\n {messages.length === 0 && emptyState ? (\n <div className=\"flex size-full flex-col items-center justify-center gap-3 p-8 text-center\">\n {emptyState}\n </div>\n ) : (\n <div className=\"flex flex-col gap-8 p-4\">\n {messages.map((message) => (\n <Message key={message.id} message={message} {...actions} />\n ))}\n </div>\n )}\n </div>\n\n {!pinned && messages.length > 0 && (\n <button\n type=\"button\"\n aria-label=\"Scroll to latest\"\n onClick={scrollToBottom}\n className=\"absolute bottom-3 left-1/2 flex size-8 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-md hover:text-foreground\"\n >\n <Icon icon={UiArrowDown} className=\"size-4\" />\n </button>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;AAiBO,SAAS,aAAa,EAAE,UAAU,YAAY,WAAW,GAAG,WAA8B;AAC/F,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,IAAI;AAEzC,QAAM,WAAW,MAAM;AACrB,UAAM,KAAK,UAAU;AACrB,QAAI,CAAC,GAAI;AACT,UAAM,WAAW,GAAG,eAAe,GAAG,YAAY,GAAG;AACrD,cAAU,WAAW,EAAE;AAAA,EACzB;AAEA,YAAU,MAAM;AACd,UAAM,KAAK,UAAU;AACrB,QAAI,MAAM,QAAQ;AAChB,SAAG,YAAY,GAAG;AAAA,IACpB;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB,MAAM;AAC3B,UAAM,KAAK,UAAU;AACrB,QAAI,OAAO,SAAS,EAAE,KAAK,GAAG,cAAc,UAAU,UAAU;AAAA,EAClE;AAEA,SACE,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,MAAK;AAAA,QACL,WAAW,GAAG,0BAA0B,SAAS;AAAA,QAEhD,UAAA,SAAS,WAAW,KAAK,aACxB,oBAAC,OAAA,EAAI,WAAU,6EACZ,UAAA,WAAA,CACH,IAEA,oBAAC,OAAA,EAAI,WAAU,2BACZ,UAAA,SAAS,IAAI,CAAC,YACb,oBAAC,SAAA,EAAyB,SAAmB,GAAG,QAAA,GAAlC,QAAQ,EAAmC,CAC1D,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,IAIH,CAAC,UAAU,SAAS,SAAS,KAC5B;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAW;AAAA,QACX,SAAS;AAAA,QACT,WAAU;AAAA,QAEV,UAAA,oBAAC,MAAA,EAAK,MAAM,aAAa,WAAU,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9C,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"Conversation.js","sources":["../../../src/data/chat/Conversation.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { Icon } from \"../Icon\";\nimport { UiArrowDown, UiCircleX, UiLoader } from \"../../icons\";\nimport { Message, type MessageActionHandlers } from \"./Message\";\nimport type { ChatStatus, UIMessage } from \"./types\";\n\nexport type ConversationProps = MessageActionHandlers & {\n messages: UIMessage[];\n /** Current chat status; used for transient pending/error affordances. */\n status?: ChatStatus | undefined;\n /** Last request error from the chat transport, if any. */\n error?: Error | undefined;\n /** Clears the visible transport error. */\n onClearError?: (() => void) | undefined;\n /** Shown when there are no messages yet. */\n emptyState?: React.ReactNode;\n className?: string;\n};\n\n/** A scrollable message log that sticks to the bottom as new content streams\n * in, unless the user has scrolled up — in which case a jump-to-bottom button\n * appears. */\nexport function Conversation({\n messages,\n status,\n error,\n onClearError,\n emptyState,\n className,\n ...actions\n}: ConversationProps) {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [pinned, setPinned] = useState(true);\n const isWaiting = status === \"submitted\" || (status === \"streaming\" && !hasVisibleAssistantResponse(messages));\n const errorText = error?.message || (status === \"error\" ? \"The assistant request failed.\" : undefined);\n\n const onScroll = () => {\n const el = scrollRef.current;\n if (!el) return;\n const distance = el.scrollHeight - el.scrollTop - el.clientHeight;\n setPinned(distance < 32);\n };\n\n useEffect(() => {\n const el = scrollRef.current;\n if (el && pinned) {\n el.scrollTop = el.scrollHeight;\n }\n });\n\n const scrollToBottom = () => {\n const el = scrollRef.current;\n if (el) el.scrollTo({ top: el.scrollHeight, behavior: \"smooth\" });\n };\n\n return (\n <div className=\"relative flex min-h-0 flex-1 flex-col\">\n <div\n ref={scrollRef}\n onScroll={onScroll}\n role=\"log\"\n className={cn(\"flex-1 overflow-y-auto\", className)}\n >\n {messages.length === 0 && emptyState ? (\n <div className=\"flex size-full flex-col items-center justify-center gap-3 p-8 text-center\">\n {emptyState}\n </div>\n ) : (\n <div className=\"flex flex-col gap-8 p-4\">\n {messages.map((message) => (\n <Message key={message.id} message={message} {...actions} />\n ))}\n {isWaiting && <LoadingIndicator />}\n {errorText && <ErrorNotice message={errorText} onClear={onClearError} />}\n </div>\n )}\n </div>\n\n {!pinned && messages.length > 0 && (\n <button\n type=\"button\"\n aria-label=\"Scroll to latest\"\n onClick={scrollToBottom}\n className=\"absolute bottom-3 left-1/2 flex size-8 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-md hover:text-foreground\"\n >\n <Icon icon={UiArrowDown} className=\"size-4\" />\n </button>\n )}\n </div>\n );\n}\n\nfunction hasVisibleAssistantResponse(messages: UIMessage[]) {\n const last = messages[messages.length - 1];\n if (last?.role !== \"assistant\") return false;\n return last.parts.some((part) => {\n if (part.type === \"step-start\") return false;\n if (part.type === \"text\" || part.type === \"reasoning\") return part.text.length > 0;\n return true;\n });\n}\n\nfunction LoadingIndicator() {\n return (\n <div className=\"flex w-full max-w-[95%] items-center gap-2 text-sm text-muted-foreground\">\n <Icon icon={UiLoader} className=\"size-4 shrink-0 animate-spin\" />\n <span>Waiting for response...</span>\n </div>\n );\n}\n\nfunction ErrorNotice({ message, onClear }: { message: string; onClear?: (() => void) | undefined }) {\n return (\n <div\n role=\"alert\"\n className=\"flex w-full max-w-[95%] items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive\"\n >\n <Icon icon={UiCircleX} className=\"mt-0.5 size-4 shrink-0\" />\n <div className=\"min-w-0 flex-1 whitespace-pre-wrap break-words\">{message}</div>\n {onClear && (\n <button type=\"button\" className=\"shrink-0 text-xs underline-offset-2 hover:underline\" onClick={onClear}>\n Dismiss\n </button>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAuBO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,YAAY,OAAuB,IAAI;AAC7C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,IAAI;AACzC,QAAM,YAAY,WAAW,eAAgB,WAAW,eAAe,CAAC,4BAA4B,QAAQ;AAC5G,QAAM,aAAY,+BAAO,aAAY,WAAW,UAAU,kCAAkC;AAE5F,QAAM,WAAW,MAAM;A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S,SAAS,SAAS,CAAC;AACzC,OAAI,6BAAM,UAAS,YAAa,QAAO;AACvC,SAAO,KAAK,MAAM,KAAK,CAAC,SAAS;AAC/B,QAAI,KAAK,SAAS,aAAc,QAAO;AACvC,QAAI,KAAK,SAAS,UAAU,KAAK,SAAS,YAAa,QAAO,KAAK,KAAK,SAAS;AACjF,WAAO;AAAA,EACT,CAAC;AACH;AAEA,SAAS,mBAAmB;AAC1B,SACE,qBAAC,OAAA,EAAI,WAAU,4EACb,UAAA;AAAA,IAAA,oBAAC,MAAA,EAAK,MAAM,UAAU,WAAU,gCAA+B;AAAA,IAC/D,oBAAC,UAAK,UAAA,0BAAA,CAAuB;AAAA,EAAA,GAC/B;AAEJ;AAEA,SAAS,YAAY,EAAE,SAAS,WAAoE;AAClG,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,oBAAC,MAAA,EAAK,MAAM,WAAW,WAAU,0BAAyB;AAAA,QAC1D,oBAAC,OAAA,EAAI,WAAU,kDAAkD,UAAA,SAAQ;AAAA,QACxE,+BACE,UAAA,EAAO,MAAK,UAAS,WAAU,uDAAsD,SAAS,SAAS,UAAA,UAAA,CAExG;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -1,33 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const select = require("../../components/select.cjs");
4
+ const Combobox = require("../../components/Combobox.cjs");
5
5
  const utils = require("../../lib/utils.cjs");
6
+ const providerIcons = require("./provider-icons.cjs");
6
7
  function ModelSelector({ models, value, onChange, className }) {
7
8
  if (models.length === 0) return null;
9
+ const selected = models.find((m) => m.id === value);
10
+ const SelectedGlyph = providerIcons.providerIcon(selected == null ? void 0 : selected.provider);
8
11
  return /* @__PURE__ */ jsxRuntime.jsx(
9
- select.Select,
12
+ Combobox.Combobox,
10
13
  {
11
- "aria-label": "Model",
14
+ ariaLabel: "Model",
12
15
  value: value ?? "",
13
- onChange: (e) => onChange(e.target.value),
14
- className: utils.cn("h-8 text-xs", className),
15
- options: models.map((m) => ({
16
- value: m.id,
17
- label: m.reasoning ? `${m.label} ·🧠` : m.label,
18
- disabled: m.configured === false
19
- }))
16
+ onChange,
17
+ allowCustomValue: false,
18
+ required: true,
19
+ size: "sm",
20
+ className: utils.cn("w-48", className),
21
+ ...SelectedGlyph ? { prefix: /* @__PURE__ */ jsxRuntime.jsx(SelectedGlyph, { className: "size-4" }) } : {},
22
+ options: models.map((m) => {
23
+ const Icon = providerIcons.providerIcon(m.provider);
24
+ return {
25
+ value: m.id,
26
+ label: m.reasoning ? `${m.label} ·🧠` : m.label,
27
+ ...Icon ? { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }) } : {},
28
+ disabled: m.configured === false
29
+ };
30
+ })
20
31
  }
21
32
  );
22
33
  }
23
34
  function EffortSelector({ efforts, value, onChange, className }) {
24
35
  return /* @__PURE__ */ jsxRuntime.jsx(
25
- select.Select,
36
+ Combobox.Combobox,
26
37
  {
27
- "aria-label": "Reasoning effort",
38
+ ariaLabel: "Reasoning effort",
28
39
  value: value ?? "",
29
- onChange: (e) => onChange(e.target.value),
30
- className: utils.cn("h-8 w-auto text-xs", className),
40
+ onChange,
41
+ allowCustomValue: false,
42
+ required: true,
43
+ size: "sm",
44
+ className: utils.cn("w-36", className),
31
45
  options: [
32
46
  { value: "", label: "No reasoning" },
33
47
  ...efforts.map((e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSelector.cjs","sources":["../../../src/data/chat/ModelSelector.tsx"],"sourcesContent":["import { Select } from \"../../components/select\";\nimport { cn } from \"../../lib/utils\";\nimport type { ChatModel } from \"./types\";\n\nexport type ModelSelectorProps = {\n models: ChatModel[];\n /** Currently selected model id. */\n value?: string | undefined;\n onChange: (id: string) => void;\n className?: string;\n};\n\n/** A model picker driven by the backend model menu. Models whose provider is\n * not configured are disabled rather than hidden, so the menu communicates\n * what would be available with the right API key. */\nexport function ModelSelector({ models, value, onChange, className }: ModelSelectorProps) {\n if (models.length === 0) return null;\n return (\n <Select\n aria-label=\"Model\"\n value={value ?? \"\"}\n onChange={(e) => onChange(e.target.value)}\n className={cn(\"h-8 text-xs\", className)}\n options={models.map((m) => ({\n value: m.id,\n label: m.reasoning ? `${m.label} ·🧠` : m.label,\n disabled: m.configured === false,\n }))}\n />\n );\n}\n\nexport type EffortSelectorProps = {\n efforts: string[];\n value?: string | undefined;\n onChange: (effort: string) => void;\n className?: string;\n};\n\n/** Reasoning-effort picker, shown only for reasoning-capable models. The empty\n * value means \"no extended thinking\". */\nexport function EffortSelector({ efforts, value, onChange, className }: EffortSelectorProps) {\n return (\n <Select\n aria-label=\"Reasoning effort\"\n value={value ?? \"\"}\n onChange={(e) => onChange(e.target.value)}\n className={cn(\"h-8 w-auto text-xs\", className)}\n options={[\n { value: \"\", label: \"No reasoning\" },\n ...efforts.map((e) => ({ value: e, label: `${e[0]?.toUpperCase()}${e.slice(1)} reasoning` })),\n ]}\n />\n );\n}\n"],"names":["jsx","Select","cn"],"mappings":";;;;;AAeO,SAAS,cAAc,EAAE,QAAQ,OAAO,UAAU,aAAiC;AACxF,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,SACEA,2BAAAA;AAAAA,IAACC,OAAAA;AAAAA,IAAA;AAAA,MACC,cAAW;AAAA,MACX,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,MACxC,WAAWC,MAAAA,GAAG,eAAe,SAAS;AAAA,MACtC,SAAS,OAAO,IAAI,CAAC,OAAO;AAAA,QAC1B,OAAO,EAAE;AAAA,QACT,OAAO,EAAE,YAAY,GAAG,EAAE,KAAK,SAAS,EAAE;AAAA,QAC1C,UAAU,EAAE,eAAe;AAAA,MAAA,EAC3B;AAAA,IAAA;AAAA,EAAA;AAGR;AAWO,SAAS,eAAe,EAAE,SAAS,OAAO,UAAU,aAAkC;AAC3F,SACEF,2BAAAA;AAAAA,IAACC,OAAAA;AAAAA,IAAA;AAAA,MACC,cAAW;AAAA,MACX,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,MACxC,WAAWC,MAAAA,GAAG,sBAAsB,SAAS;AAAA,MAC7C,SAAS;AAAA,QACP,EAAE,OAAO,IAAI,OAAO,eAAA;AAAA,QACpB,GAAG,QAAQ,IAAI,CAAC;;AAAO,mBAAE,OAAO,GAAG,OAAO,IAAG,OAAE,CAAC,MAAH,mBAAM,aAAa,GAAG,EAAE,MAAM,CAAC,CAAC;SAAe;AAAA,MAAA;AAAA,IAC9F;AAAA,EAAA;AAGN;;;"}
1
+ {"version":3,"file":"ModelSelector.cjs","sources":["../../../src/data/chat/ModelSelector.tsx"],"sourcesContent":["import { Combobox } from \"../../components/Combobox\";\nimport { cn } from \"../../lib/utils\";\nimport { providerIcon } from \"./provider-icons\";\nimport type { ChatModel } from \"./types\";\n\nexport type ModelSelectorProps = {\n models: ChatModel[];\n /** Currently selected model id. */\n value?: string | undefined;\n onChange: (id: string) => void;\n className?: string;\n};\n\n/** A searchable model picker driven by the backend model menu, showing each\n * provider's brand icon. Models whose provider is not configured are disabled\n * rather than hidden, so the menu communicates what would be available with the\n * right API key. */\nexport function ModelSelector({ models, value, onChange, className }: ModelSelectorProps) {\n if (models.length === 0) return null;\n const selected = models.find((m) => m.id === value);\n const SelectedGlyph = providerIcon(selected?.provider);\n return (\n <Combobox\n ariaLabel=\"Model\"\n value={value ?? \"\"}\n onChange={onChange}\n allowCustomValue={false}\n required\n size=\"sm\"\n className={cn(\"w-48\", className)}\n {...(SelectedGlyph ? { prefix: <SelectedGlyph className=\"size-4\" /> } : {})}\n options={models.map((m) => {\n const Icon = providerIcon(m.provider);\n return {\n value: m.id,\n label: m.reasoning ? `${m.label} ·🧠` : m.label,\n ...(Icon ? { icon: <Icon className=\"size-4\" /> } : {}),\n disabled: m.configured === false,\n };\n })}\n />\n );\n}\n\nexport type EffortSelectorProps = {\n efforts: string[];\n value?: string | undefined;\n onChange: (effort: string) => void;\n className?: string;\n};\n\n/** Reasoning-effort picker, shown only for reasoning-capable models. The empty\n * value means \"no extended thinking\". Strict: only the listed options commit. */\nexport function EffortSelector({ efforts, value, onChange, className }: EffortSelectorProps) {\n return (\n <Combobox\n ariaLabel=\"Reasoning effort\"\n value={value ?? \"\"}\n onChange={onChange}\n allowCustomValue={false}\n required\n size=\"sm\"\n className={cn(\"w-36\", className)}\n options={[\n { value: \"\", label: \"No reasoning\" },\n ...efforts.map((e) => ({ value: e, label: `${e[0]?.toUpperCase()}${e.slice(1)} reasoning` })),\n ]}\n />\n );\n}\n"],"names":["providerIcon","jsx","Combobox","cn"],"mappings":";;;;;;AAiBO,SAAS,cAAc,EAAE,QAAQ,OAAO,UAAU,aAAiC;AACxF,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,QAAM,WAAW,OAAO,KAAK,CAAC,MAAM,EAAE,OAAO,KAAK;AAClD,QAAM,gBAAgBA,cAAAA,aAAa,qCAAU,QAAQ;AACrD,SACEC,2BAAAA;AAAAA,IAACC,SAAAA;AAAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,SAAS;AAAA,MAChB;AAAA,MACA,kBAAkB;AAAA,MAClB,UAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAWC,MAAAA,GAAG,QAAQ,SAAS;AAAA,MAC9B,GAAI,gBAAgB,EAAE,QAAQF,+BAAC,iBAAc,WAAU,UAAS,EAAA,IAAO,CAAA;AAAA,MACxE,SAAS,OAAO,IAAI,CAAC,MAAM;AACzB,cAAM,OAAOD,cAAAA,aAAa,EAAE,QAAQ;AACpC,eAAO;AAAA,UACL,OAAO,EAAE;AAAA,UACT,OAAO,EAAE,YAAY,GAAG,EAAE,KAAK,SAAS,EAAE;AAAA,UAC1C,GAAI,OAAO,EAAE,MAAMC,+BAAC,QAAK,WAAU,UAAS,EAAA,IAAO,CAAA;AAAA,UACnD,UAAU,EAAE,eAAe;AAAA,QAAA;AAAA,MAE/B,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;AAWO,SAAS,eAAe,EAAE,SAAS,OAAO,UAAU,aAAkC;AAC3F,SACEA,2BAAAA;AAAAA,IAACC,SAAAA;AAAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO,SAAS;AAAA,MAChB;AAAA,MACA,kBAAkB;AAAA,MAClB,UAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAWC,MAAAA,GAAG,QAAQ,SAAS;AAAA,MAC/B,SAAS;AAAA,QACP,EAAE,OAAO,IAAI,OAAO,eAAA;AAAA,QACpB,GAAG,QAAQ,IAAI,CAAC;;AAAO,mBAAE,OAAO,GAAG,OAAO,IAAG,OAAE,CAAC,MAAH,mBAAM,aAAa,GAAG,EAAE,MAAM,CAAC,CAAC;SAAe;AAAA,MAAA;AAAA,IAC9F;AAAA,EAAA;AAGN;;;"}
@@ -6,9 +6,10 @@ export type ModelSelectorProps = {
6
6
  onChange: (id: string) => void;
7
7
  className?: string;
8
8
  };
9
- /** A model picker driven by the backend model menu. Models whose provider is
10
- * not configured are disabled rather than hidden, so the menu communicates
11
- * what would be available with the right API key. */
9
+ /** A searchable model picker driven by the backend model menu, showing each
10
+ * provider's brand icon. Models whose provider is not configured are disabled
11
+ * rather than hidden, so the menu communicates what would be available with the
12
+ * right API key. */
12
13
  export declare function ModelSelector({ models, value, onChange, className }: ModelSelectorProps): import("react/jsx-runtime").JSX.Element | null;
13
14
  export type EffortSelectorProps = {
14
15
  efforts: string[];
@@ -17,6 +18,6 @@ export type EffortSelectorProps = {
17
18
  className?: string;
18
19
  };
19
20
  /** Reasoning-effort picker, shown only for reasoning-capable models. The empty
20
- * value means "no extended thinking". */
21
+ * value means "no extended thinking". Strict: only the listed options commit. */
21
22
  export declare function EffortSelector({ efforts, value, onChange, className }: EffortSelectorProps): import("react/jsx-runtime").JSX.Element;
22
23
  //# sourceMappingURL=ModelSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../../src/data/chat/ModelSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;sDAEsD;AACtD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kBAAkB,kDAevF;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;0CAC0C;AAC1C,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,mBAAmB,2CAa1F"}
1
+ {"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../../src/data/chat/ModelSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;qBAGqB;AACrB,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kBAAkB,kDAyBvF;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;kFACkF;AAClF,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,mBAAmB,2CAgB1F"}
@@ -1,31 +1,45 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Select } from "../../components/select.js";
2
+ import { Combobox } from "../../components/Combobox.js";
3
3
  import { cn } from "../../lib/utils.js";
4
+ import { providerIcon } from "./provider-icons.js";
4
5
  function ModelSelector({ models, value, onChange, className }) {
5
6
  if (models.length === 0) return null;
7
+ const selected = models.find((m) => m.id === value);
8
+ const SelectedGlyph = providerIcon(selected == null ? void 0 : selected.provider);
6
9
  return /* @__PURE__ */ jsx(
7
- Select,
10
+ Combobox,
8
11
  {
9
- "aria-label": "Model",
12
+ ariaLabel: "Model",
10
13
  value: value ?? "",
11
- onChange: (e) => onChange(e.target.value),
12
- className: cn("h-8 text-xs", className),
13
- options: models.map((m) => ({
14
- value: m.id,
15
- label: m.reasoning ? `${m.label} ·🧠` : m.label,
16
- disabled: m.configured === false
17
- }))
14
+ onChange,
15
+ allowCustomValue: false,
16
+ required: true,
17
+ size: "sm",
18
+ className: cn("w-48", className),
19
+ ...SelectedGlyph ? { prefix: /* @__PURE__ */ jsx(SelectedGlyph, { className: "size-4" }) } : {},
20
+ options: models.map((m) => {
21
+ const Icon = providerIcon(m.provider);
22
+ return {
23
+ value: m.id,
24
+ label: m.reasoning ? `${m.label} ·🧠` : m.label,
25
+ ...Icon ? { icon: /* @__PURE__ */ jsx(Icon, { className: "size-4" }) } : {},
26
+ disabled: m.configured === false
27
+ };
28
+ })
18
29
  }
19
30
  );
20
31
  }
21
32
  function EffortSelector({ efforts, value, onChange, className }) {
22
33
  return /* @__PURE__ */ jsx(
23
- Select,
34
+ Combobox,
24
35
  {
25
- "aria-label": "Reasoning effort",
36
+ ariaLabel: "Reasoning effort",
26
37
  value: value ?? "",
27
- onChange: (e) => onChange(e.target.value),
28
- className: cn("h-8 w-auto text-xs", className),
38
+ onChange,
39
+ allowCustomValue: false,
40
+ required: true,
41
+ size: "sm",
42
+ className: cn("w-36", className),
29
43
  options: [
30
44
  { value: "", label: "No reasoning" },
31
45
  ...efforts.map((e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSelector.js","sources":["../../../src/data/chat/ModelSelector.tsx"],"sourcesContent":["import { Select } from \"../../components/select\";\nimport { cn } from \"../../lib/utils\";\nimport type { ChatModel } from \"./types\";\n\nexport type ModelSelectorProps = {\n models: ChatModel[];\n /** Currently selected model id. */\n value?: string | undefined;\n onChange: (id: string) => void;\n className?: string;\n};\n\n/** A model picker driven by the backend model menu. Models whose provider is\n * not configured are disabled rather than hidden, so the menu communicates\n * what would be available with the right API key. */\nexport function ModelSelector({ models, value, onChange, className }: ModelSelectorProps) {\n if (models.length === 0) return null;\n return (\n <Select\n aria-label=\"Model\"\n value={value ?? \"\"}\n onChange={(e) => onChange(e.target.value)}\n className={cn(\"h-8 text-xs\", className)}\n options={models.map((m) => ({\n value: m.id,\n label: m.reasoning ? `${m.label} ·🧠` : m.label,\n disabled: m.configured === false,\n }))}\n />\n );\n}\n\nexport type EffortSelectorProps = {\n efforts: string[];\n value?: string | undefined;\n onChange: (effort: string) => void;\n className?: string;\n};\n\n/** Reasoning-effort picker, shown only for reasoning-capable models. The empty\n * value means \"no extended thinking\". */\nexport function EffortSelector({ efforts, value, onChange, className }: EffortSelectorProps) {\n return (\n <Select\n aria-label=\"Reasoning effort\"\n value={value ?? \"\"}\n onChange={(e) => onChange(e.target.value)}\n className={cn(\"h-8 w-auto text-xs\", className)}\n options={[\n { value: \"\", label: \"No reasoning\" },\n ...efforts.map((e) => ({ value: e, label: `${e[0]?.toUpperCase()}${e.slice(1)} reasoning` })),\n ]}\n />\n );\n}\n"],"names":[],"mappings":";;;AAeO,SAAS,cAAc,EAAE,QAAQ,OAAO,UAAU,aAAiC;AACxF,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAW;AAAA,MACX,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,MACxC,WAAW,GAAG,eAAe,SAAS;AAAA,MACtC,SAAS,OAAO,IAAI,CAAC,OAAO;AAAA,QAC1B,OAAO,EAAE;AAAA,QACT,OAAO,EAAE,YAAY,GAAG,EAAE,KAAK,SAAS,EAAE;AAAA,QAC1C,UAAU,EAAE,eAAe;AAAA,MAAA,EAC3B;AAAA,IAAA;AAAA,EAAA;AAGR;AAWO,SAAS,eAAe,EAAE,SAAS,OAAO,UAAU,aAAkC;AAC3F,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAW;AAAA,MACX,OAAO,SAAS;AAAA,MAChB,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,MACxC,WAAW,GAAG,sBAAsB,SAAS;AAAA,MAC7C,SAAS;AAAA,QACP,EAAE,OAAO,IAAI,OAAO,eAAA;AAAA,QACpB,GAAG,QAAQ,IAAI,CAAC;;AAAO,mBAAE,OAAO,GAAG,OAAO,IAAG,OAAE,CAAC,MAAH,mBAAM,aAAa,GAAG,EAAE,MAAM,CAAC,CAAC;SAAe;AAAA,MAAA;AAAA,IAC9F;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"ModelSelector.js","sources":["../../../src/data/chat/ModelSelector.tsx"],"sourcesContent":["import { Combobox } from \"../../components/Combobox\";\nimport { cn } from \"../../lib/utils\";\nimport { providerIcon } from \"./provider-icons\";\nimport type { ChatModel } from \"./types\";\n\nexport type ModelSelectorProps = {\n models: ChatModel[];\n /** Currently selected model id. */\n value?: string | undefined;\n onChange: (id: string) => void;\n className?: string;\n};\n\n/** A searchable model picker driven by the backend model menu, showing each\n * provider's brand icon. Models whose provider is not configured are disabled\n * rather than hidden, so the menu communicates what would be available with the\n * right API key. */\nexport function ModelSelector({ models, value, onChange, className }: ModelSelectorProps) {\n if (models.length === 0) return null;\n const selected = models.find((m) => m.id === value);\n const SelectedGlyph = providerIcon(selected?.provider);\n return (\n <Combobox\n ariaLabel=\"Model\"\n value={value ?? \"\"}\n onChange={onChange}\n allowCustomValue={false}\n required\n size=\"sm\"\n className={cn(\"w-48\", className)}\n {...(SelectedGlyph ? { prefix: <SelectedGlyph className=\"size-4\" /> } : {})}\n options={models.map((m) => {\n const Icon = providerIcon(m.provider);\n return {\n value: m.id,\n label: m.reasoning ? `${m.label} ·🧠` : m.label,\n ...(Icon ? { icon: <Icon className=\"size-4\" /> } : {}),\n disabled: m.configured === false,\n };\n })}\n />\n );\n}\n\nexport type EffortSelectorProps = {\n efforts: string[];\n value?: string | undefined;\n onChange: (effort: string) => void;\n className?: string;\n};\n\n/** Reasoning-effort picker, shown only for reasoning-capable models. The empty\n * value means \"no extended thinking\". Strict: only the listed options commit. */\nexport function EffortSelector({ efforts, value, onChange, className }: EffortSelectorProps) {\n return (\n <Combobox\n ariaLabel=\"Reasoning effort\"\n value={value ?? \"\"}\n onChange={onChange}\n allowCustomValue={false}\n required\n size=\"sm\"\n className={cn(\"w-36\", className)}\n options={[\n { value: \"\", label: \"No reasoning\" },\n ...efforts.map((e) => ({ value: e, label: `${e[0]?.toUpperCase()}${e.slice(1)} reasoning` })),\n ]}\n />\n );\n}\n"],"names":[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AC;SAAe;AAAA,MAAA;AAAA,IAC9F;AAAA,EAAA;AAGN;"}
@@ -14,12 +14,32 @@ function operationToTool(operation) {
14
14
  if (!operation.operationId) {
15
15
  return null;
16
16
  }
17
+ const meta = operation["x-clicky"];
18
+ const description = operation.description ?? operation.summary;
17
19
  return {
18
20
  name: operation.operationId,
19
- description: operation.description ?? operation.summary,
21
+ label: toolLabel(operation),
22
+ ...(meta == null ? void 0 : meta.surface) ? { group: meta.surface } : {},
23
+ ...description ? { description } : {},
20
24
  inputSchema: buildInputSchema(operation)
21
25
  };
22
26
  }
27
+ function toolLabel(operation) {
28
+ var _a, _b;
29
+ const meta = operation["x-clicky"];
30
+ const short = ((_a = meta == null ? void 0 : meta.actionName) == null ? void 0 : _a.trim()) || ((_b = meta == null ? void 0 : meta.verb) == null ? void 0 : _b.trim());
31
+ if (short && short !== "action") {
32
+ return short.charAt(0).toUpperCase() + short.slice(1);
33
+ }
34
+ if (operation.summary) {
35
+ return operation.summary;
36
+ }
37
+ return humanize(operation.operationId ?? "");
38
+ }
39
+ function humanize(operationId) {
40
+ const spaced = operationId.replace(/[_-]+/g, " ").replace(/([a-z\d])([A-Z])/g, "$1 $2");
41
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
42
+ }
23
43
  function buildInputSchema(operation) {
24
44
  const properties = {};
25
45
  const required = [];
@@ -1 +1 @@
1
- {"version":3,"file":"clickyOperationsToTools.cjs","sources":["../../../src/data/chat/clickyOperationsToTools.ts"],"sourcesContent":["import type {\n OpenAPIOperation,\n OpenAPIParameter,\n OpenAPISchema,\n ResolvedOperation,\n} from \"../../rpc/types\";\nimport type { ChatToolInputSchema, ChatToolMeta, JSONSchemaProperty } from \"./types\";\n\n/** Converts a clicky RPC operation catalog into AI-tool metadata for display\n * and request scoping. Execution stays in the Go backend; this maps an\n * operation's `operationId` → tool name, `summary`/`description` → description,\n * and `parameters` + `requestBody` → a JSON-Schema input. Operations without an\n * `operationId` are skipped (a tool needs a stable name). */\nexport function clickyOperationsToTools(operations: ResolvedOperation[]): ChatToolMeta[] {\n const tools: ChatToolMeta[] = [];\n for (const resolved of operations) {\n const tool = operationToTool(resolved.operation);\n if (tool) {\n tools.push(tool);\n }\n }\n return tools;\n}\n\nexport function operationToTool(operation: OpenAPIOperation): ChatToolMeta | null {\n if (!operation.operationId) {\n return null;\n }\n return {\n name: operation.operationId,\n description: operation.description ?? operation.summary,\n inputSchema: buildInputSchema(operation),\n };\n}\n\nfunction buildInputSchema(operation: OpenAPIOperation): ChatToolInputSchema {\n const properties: Record<string, JSONSchemaProperty> = {};\n const required: string[] = [];\n\n for (const param of operation.parameters ?? []) {\n properties[param.name] = parameterToProperty(param);\n if (param.required) {\n required.push(param.name);\n }\n }\n\n const body = requestBodySchema(operation);\n if (body?.properties) {\n for (const [name, schema] of Object.entries(body.properties)) {\n properties[name] = schemaToProperty(schema);\n }\n }\n\n return { type: \"object\", properties, required };\n}\n\nfunction parameterToProperty(param: OpenAPIParameter): JSONSchemaProperty {\n const prop = schemaToProperty(param.schema);\n if (param.description && !prop.description) {\n prop.description = param.description;\n }\n return prop;\n}\n\nfunction schemaToProperty(schema: OpenAPISchema | undefined): JSONSchemaProperty {\n if (!schema) {\n return { type: \"string\" };\n }\n const prop: JSONSchemaProperty = { type: schema.type ?? \"string\" };\n if (schema.description !== undefined) {\n prop.description = schema.description;\n }\n if (schema.enum !== undefined) {\n prop.enum = schema.enum;\n }\n if (schema.default !== undefined) {\n prop.default = schema.default;\n }\n return prop;\n}\n\nfunction requestBodySchema(operation: OpenAPIOperation): OpenAPISchema | undefined {\n const content = operation.requestBody?.content;\n if (!content) {\n return undefined;\n }\n return content[\"application/json\"]?.schema ?? Object.values(content)[0]?.schema;\n}\n"],"names":[],"mappings":";;AAaO,SAAS,wBAAwB,YAAiD;AACvF,QAAM,QAAwB,CAAA;AAC9B,aAAW,YAAY,YAAY;AACjC,UAAM,OAAO,gBAAgB,SAAS,SAAS;AAC/C,QAAI,MAAM;AACR,YAAM,KA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;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,WAAwD;;AACjF,QAAM,WAAU,eAAU,gBAAV,mBAAuB;AACvC,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,WAAO,aAAQ,kBAAkB,MAA1B,mBAA6B,aAAU,YAAO,OAAO,OAAO,EAAE,CAAC,MAAxB,mBAA2B;AAC3E;;;"}
1
+ {"version":3,"file":"clickyOperationsToTools.cjs","sources":["../../../src/data/chat/clickyOperationsToTools.ts"],"sourcesContent":["import type {\n OpenAPIOperation,\n OpenAPIParameter,\n OpenAPISchema,\n ResolvedOperation,\n} from \"../../rpc/types\";\nimport type { ChatToolInputSchema, JSONSchemaProperty, ToolMeta } from \"./types\";\n\n/** Converts a clicky RPC operation catalog into AI-tool metadata for display\n * and request scoping. Execution stays in the Go backend; this maps an\n * operation's `operationId` → tool name, a short `x-clicky` verb/action →\n * label, the `x-clicky` surface → group, `summary`/`description` → description,\n * and `parameters` + `requestBody` → a JSON-Schema input. Operations without an\n * `operationId` are skipped (a tool needs a stable name). */\nexport function clickyOperationsToTools(operations: ResolvedOperation[]): ToolMeta[] {\n const tools: ToolMeta[] = [];\n for (const resolved of operations) {\n const tool = operationToTool(resolved.operation);\n if (tool) {\n tools.push(tool);\n }\n }\n return tools;\n}\n\nexport function operationToTool(operation: OpenAPIOperation): ToolMeta | null {\n if (!operation.operationId) {\n return null;\n }\n const meta = operation[\"x-clicky\"];\n const description = operation.description ?? operation.summary;\n return {\n name: operation.operationId,\n label: toolLabel(operation),\n ...(meta?.surface ? { group: meta.surface } : {}),\n ...(description ? { description } : {}),\n inputSchema: buildInputSchema(operation),\n };\n}\n\n/** A concise popover label: the clicky action/verb (capitalized) when present,\n * else the operation summary, else a humanized operationId. Mirrors the intent\n * of rpc/clickyMetadata.ts `surfaceActionLabel`. */\nfunction toolLabel(operation: OpenAPIOperation): string {\n const meta = operation[\"x-clicky\"];\n const short = meta?.actionName?.trim() || meta?.verb?.trim();\n if (short && short !== \"action\") {\n return short.charAt(0).toUpperCase() + short.slice(1);\n }\n if (operation.summary) {\n return operation.summary;\n }\n return humanize(operation.operationId ?? \"\");\n}\n\nfunction humanize(operationId: string): string {\n const spaced = operationId.replace(/[_-]+/g, \" \").replace(/([a-z\\d])([A-Z])/g, \"$1 $2\");\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction buildInputSchema(operation: OpenAPIOperation): ChatToolInputSchema {\n const properties: Record<string, JSONSchemaProperty> = {};\n const required: string[] = [];\n\n for (const param of operation.parameters ?? []) {\n properties[param.name] = parameterToProperty(param);\n if (param.required) {\n required.push(param.name);\n }\n }\n\n const body = requestBodySchema(operation);\n if (body?.properties) {\n for (const [name, schema] of Object.entries(body.properties)) {\n properties[name] = schemaToProperty(schema);\n }\n }\n\n return { type: \"object\", properties, required };\n}\n\nfunction parameterToProperty(param: OpenAPIParameter): JSONSchemaProperty {\n const prop = schemaToProperty(param.schema);\n if (param.description && !prop.description) {\n prop.description = param.description;\n }\n return prop;\n}\n\nfunction schemaToProperty(schema: OpenAPISchema | undefined): JSONSchemaProperty {\n if (!schema) {\n return { type: \"string\" };\n }\n const prop: JSONSchemaProperty = { type: schema.type ?? \"string\" };\n if (schema.description !== undefined) {\n prop.description = schema.description;\n }\n if (schema.enum !== undefined) {\n prop.enum = schema.enum;\n }\n if (schema.default !== undefined) {\n prop.default = schema.default;\n }\n return prop;\n}\n\nfunction requestBodySchema(operation: OpenAPIOperation): OpenAPISchema | undefined {\n const content = operation.requestBody?.content;\n if (!content) {\n return undefined;\n }\n return content[\"application/json\"]?.schema ?? Object.values(content)[0]?.schema;\n}\n"],"names":[],"mappings":";;AAcO,SAAS,wBAAwB,YAA6C;AACnF,QAAM,QAAoB,CAAA;AAC1B,aAAW,YAAY,YAAY;AACjC,UAAM,OAAO,gBAAgB,SAAS,SAAS;AAC/C,QAAI,MAAM;AACR,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,SAAO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,KAAK,UAAU,GAAG;AAC5D,iBAAW,IAAI,IAAI,iBAAiB,MAAM;AAAA,IAC5C;AAAA,EACF;AAEA,SAAO,EAAE,MAAM,UAAU,YAAY,SAAA;AACvC;AAEA,SAAS,oBAAoB,OAA6C;AACxE,QAAM,OAAO,iBAAiB,MAAM,MAAM;AAC1C,MAAI,MAAM,eAAe,CAAC,KAAK,aAAa;AAC1C,SAAK,cAAc,MAAM;AAAA,EAC3B;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,QAAuD;AAC/E,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,MAAM,SAAA;AAAA,EACjB;AACA,QAAM,OAA2B,EAAE,MAAM,OAAO,QAAQ,SAAA;AACxD,MAAI,OAAO,gBAAgB,QAAW;AACpC,SAAK,cAAc,OAAO;AAAA,EAC5B;AACA,MAAI,OAAO,SAAS,QAAW;AAC7B,SAAK,OAAO,OAAO;AAAA,EACrB;AACA,MAAI,OAAO,YAAY,QAAW;AAChC,SAAK,UAAU,OAAO;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,WAAwD;;AACjF,QAAM,WAAU,eAAU,gBAAV,mBAAuB;AACvC,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,WAAO,aAAQ,kBAAkB,MAA1B,mBAA6B,aAAU,YAAO,OAAO,OAAO,EAAE,CAAC,MAAxB,mBAA2B;AAC3E;;;"}
@@ -1,10 +1,11 @@
1
1
  import { OpenAPIOperation, ResolvedOperation } from '../../rpc/types';
2
- import { ChatToolMeta } from './types';
2
+ import { ToolMeta } from './types';
3
3
  /** Converts a clicky RPC operation catalog into AI-tool metadata for display
4
4
  * and request scoping. Execution stays in the Go backend; this maps an
5
- * operation's `operationId` → tool name, `summary`/`description` → description,
5
+ * operation's `operationId` → tool name, a short `x-clicky` verb/action
6
+ * label, the `x-clicky` surface → group, `summary`/`description` → description,
6
7
  * and `parameters` + `requestBody` → a JSON-Schema input. Operations without an
7
8
  * `operationId` are skipped (a tool needs a stable name). */
8
- export declare function clickyOperationsToTools(operations: ResolvedOperation[]): ChatToolMeta[];
9
- export declare function operationToTool(operation: OpenAPIOperation): ChatToolMeta | null;
9
+ export declare function clickyOperationsToTools(operations: ResolvedOperation[]): ToolMeta[];
10
+ export declare function operationToTool(operation: OpenAPIOperation): ToolMeta | null;
10
11
  //# sourceMappingURL=clickyOperationsToTools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clickyOperationsToTools.d.ts","sourceRoot":"","sources":["../../../src/data/chat/clickyOperationsToTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAGhB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAuB,YAAY,EAAsB,MAAM,SAAS,CAAC;AAErF;;;;8DAI8D;AAC9D,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,CASvF;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,gBAAgB,GAAG,YAAY,GAAG,IAAI,CAShF"}
1
+ {"version":3,"file":"clickyOperationsToTools.d.ts","sourceRoot":"","sources":["../../../src/data/chat/clickyOperationsToTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAGhB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAA2C,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjF;;;;;8DAK8D;AAC9D,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,QAAQ,EAAE,CASnF;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,gBAAgB,GAAG,QAAQ,GAAG,IAAI,CAa5E"}
@@ -12,12 +12,32 @@ function operationToTool(operation) {
12
12
  if (!operation.operationId) {
13
13
  return null;
14
14
  }
15
+ const meta = operation["x-clicky"];
16
+ const description = operation.description ?? operation.summary;
15
17
  return {
16
18
  name: operation.operationId,
17
- description: operation.description ?? operation.summary,
19
+ label: toolLabel(operation),
20
+ ...(meta == null ? void 0 : meta.surface) ? { group: meta.surface } : {},
21
+ ...description ? { description } : {},
18
22
  inputSchema: buildInputSchema(operation)
19
23
  };
20
24
  }
25
+ function toolLabel(operation) {
26
+ var _a, _b;
27
+ const meta = operation["x-clicky"];
28
+ const short = ((_a = meta == null ? void 0 : meta.actionName) == null ? void 0 : _a.trim()) || ((_b = meta == null ? void 0 : meta.verb) == null ? void 0 : _b.trim());
29
+ if (short && short !== "action") {
30
+ return short.charAt(0).toUpperCase() + short.slice(1);
31
+ }
32
+ if (operation.summary) {
33
+ return operation.summary;
34
+ }
35
+ return humanize(operation.operationId ?? "");
36
+ }
37
+ function humanize(operationId) {
38
+ const spaced = operationId.replace(/[_-]+/g, " ").replace(/([a-z\d])([A-Z])/g, "$1 $2");
39
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
40
+ }
21
41
  function buildInputSchema(operation) {
22
42
  const properties = {};
23
43
  const required = [];
@@ -1 +1 @@
1
- {"version":3,"file":"clickyOperationsToTools.js","sources":["../../../src/data/chat/clickyOperationsToTools.ts"],"sourcesContent":["import type {\n OpenAPIOperation,\n OpenAPIParameter,\n OpenAPISchema,\n ResolvedOperation,\n} from \"../../rpc/types\";\nimport type { ChatToolInputSchema, ChatToolMeta, JSONSchemaProperty } from \"./types\";\n\n/** Converts a clicky RPC operation catalog into AI-tool metadata for display\n * and request scoping. Execution stays in the Go backend; this maps an\n * operation's `operationId` → tool name, `summary`/`description` → description,\n * and `parameters` + `requestBody` → a JSON-Schema input. Operations without an\n * `operationId` are skipped (a tool needs a stable name). */\nexport function clickyOperationsToTools(operations: ResolvedOperation[]): ChatToolMeta[] {\n const tools: ChatToolMeta[] = [];\n for (const resolved of operations) {\n const tool = operationToTool(resolved.operation);\n if (tool) {\n tools.push(tool);\n }\n }\n return tools;\n}\n\nexport function operationToTool(operation: OpenAPIOperation): ChatToolMeta | null {\n if (!operation.operationId) {\n return null;\n }\n return {\n name: operation.operationId,\n description: operation.description ?? operation.summary,\n inputSchema: buildInputSchema(operation),\n };\n}\n\nfunction buildInputSchema(operation: OpenAPIOperation): ChatToolInputSchema {\n const properties: Record<string, JSONSchemaProperty> = {};\n const required: string[] = [];\n\n for (const param of operation.parameters ?? []) {\n properties[param.name] = parameterToProperty(param);\n if (param.required) {\n required.push(param.name);\n }\n }\n\n const body = requestBodySchema(operation);\n if (body?.properties) {\n for (const [name, schema] of Object.entries(body.properties)) {\n properties[name] = schemaToProperty(schema);\n }\n }\n\n return { type: \"object\", properties, required };\n}\n\nfunction parameterToProperty(param: OpenAPIParameter): JSONSchemaProperty {\n const prop = schemaToProperty(param.schema);\n if (param.description && !prop.description) {\n prop.description = param.description;\n }\n return prop;\n}\n\nfunction schemaToProperty(schema: OpenAPISchema | undefined): JSONSchemaProperty {\n if (!schema) {\n return { type: \"string\" };\n }\n const prop: JSONSchemaProperty = { type: schema.type ?? \"string\" };\n if (schema.description !== undefined) {\n prop.description = schema.description;\n }\n if (schema.enum !== undefined) {\n prop.enum = schema.enum;\n }\n if (schema.default !== undefined) {\n prop.default = schema.default;\n }\n return prop;\n}\n\nfunction requestBodySchema(operation: OpenAPIOperation): OpenAPISchema | undefined {\n const content = operation.requestBody?.content;\n if (!content) {\n return undefined;\n }\n return content[\"application/json\"]?.schema ?? Object.values(content)[0]?.schema;\n}\n"],"names":[],"mappings":"AAaO,SAAS,wBAAwB,YAAiD;AACvF,QAAM,QAAwB,CAAA;AAC9B,aAAW,YAAY,YAAY;AACjC,UAAM,OAAO,gBAAgB,SAAS,SAAS;AAC/C,QAAI,MAAM;AACR,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,gBAAgB,WAAkD;AAChF,MAAI,CAAC,UAAU,aAAa;AAC1B,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,MAAM,UAAU;AAAA,IAChB,aAAa,UAAU,eAAe,UAAU;AAAA,IAChD,aA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AO,EAAE,CAAC,MAAxB,mBAA2B;AAC3E;"}
1
+ {"version":3,"file":"clickyOperationsToTools.js","sources":["../../../src/data/chat/clickyOperationsToTools.ts"],"sourcesContent":["import type {\n OpenAPIOperation,\n OpenAPIParameter,\n OpenAPISchema,\n ResolvedOperation,\n} from \"../../rpc/types\";\nimport type { ChatToolInputSchema, JSONSchemaProperty, ToolMeta } from \"./types\";\n\n/** Converts a clicky RPC operation catalog into AI-tool metadata for display\n * and request scoping. Execution stays in the Go backend; this maps an\n * operation's `operationId` → tool name, a short `x-clicky` verb/action →\n * label, the `x-clicky` surface → group, `summary`/`description` → description,\n * and `parameters` + `requestBody` → a JSON-Schema input. Operations without an\n * `operationId` are skipped (a tool needs a stable name). */\nexport function clickyOperationsToTools(operations: ResolvedOperation[]): ToolMeta[] {\n const tools: ToolMeta[] = [];\n for (const resolved of operations) {\n const tool = operationToTool(resolved.operation);\n if (tool) {\n tools.push(tool);\n }\n }\n return tools;\n}\n\nexport function operationToTool(operation: OpenAPIOperation): ToolMeta | null {\n if (!operation.operationId) {\n return null;\n }\n const meta = operation[\"x-clicky\"];\n const description = operation.description ?? operation.summary;\n return {\n name: operation.operationId,\n label: toolLabel(operation),\n ...(meta?.surface ? { group: meta.surface } : {}),\n ...(description ? { description } : {}),\n inputSchema: buildInputSchema(operation),\n };\n}\n\n/** A concise popover label: the clicky action/verb (capitalized) when present,\n * else the operation summary, else a humanized operationId. Mirrors the intent\n * of rpc/clickyMetadata.ts `surfaceActionLabel`. */\nfunction toolLabel(operation: OpenAPIOperation): string {\n const meta = operation[\"x-clicky\"];\n const short = meta?.actionName?.trim() || meta?.verb?.trim();\n if (short && short !== \"action\") {\n return short.charAt(0).toUpperCase() + short.slice(1);\n }\n if (operation.summary) {\n return operation.summary;\n }\n return humanize(operation.operationId ?? \"\");\n}\n\nfunction humanize(operationId: string): string {\n const spaced = operationId.replace(/[_-]+/g, \" \").replace(/([a-z\\d])([A-Z])/g, \"$1 $2\");\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction buildInputSchema(operation: OpenAPIOperation): ChatToolInputSchema {\n const properties: Record<string, JSONSchemaProperty> = {};\n const required: string[] = [];\n\n for (const param of operation.parameters ?? []) {\n properties[param.name] = parameterToProperty(param);\n if (param.required) {\n required.push(param.name);\n }\n }\n\n const body = requestBodySchema(operation);\n if (body?.properties) {\n for (const [name, schema] of Object.entries(body.properties)) {\n properties[name] = schemaToProperty(schema);\n }\n }\n\n return { type: \"object\", properties, required };\n}\n\nfunction parameterToProperty(param: OpenAPIParameter): JSONSchemaProperty {\n const prop = schemaToProperty(param.schema);\n if (param.description && !prop.description) {\n prop.description = param.description;\n }\n return prop;\n}\n\nfunction schemaToProperty(schema: OpenAPISchema | undefined): JSONSchemaProperty {\n if (!schema) {\n return { type: \"string\" };\n }\n const prop: JSONSchemaProperty = { type: schema.type ?? \"string\" };\n if (schema.description !== undefined) {\n prop.description = schema.description;\n }\n if (schema.enum !== undefined) {\n prop.enum = schema.enum;\n }\n if (schema.default !== undefined) {\n prop.default = schema.default;\n }\n return prop;\n}\n\nfunction requestBodySchema(operation: OpenAPIOperation): OpenAPISchema | undefined {\n const content = operation.requestBody?.content;\n if (!content) {\n return undefined;\n }\n return content[\"application/json\"]?.schema ?? Object.values(content)[0]?.schema;\n}\n"],"names":[],"mappings":"AAcO,SAAS,wBAAwB,YAA6C;AACnF,QAAM,QAAoB,CAAA;AAC1B,aAAW,YAAY,YAAY;AACjC,UAAM,OAAO,gBAAgB,SAAS,SAAS;AAC/C,QAAI,MAAM;AACR,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,gBAAgB,WAA8C;AAC5E,MAAI,CAAC,UAAU,aAAa;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,OAAO,UAAU,UAAU;AACjC,QAAM,cAAc,UAAU,eAAe,UAAU;AACvD,SAAO;AAAA,IACL,MAAM,UAAU;AAAA,IAChB,OAAO,UAAU,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C,MAAI,MAAM,eAAe,CAAC,KAAK,aAAa;AAC1C,SAAK,cAAc,MAAM;AAAA,EAC3B;AACA,SAAO;AACT;AAEA,SAAS,iBAAiB,QAAuD;AAC/E,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,MAAM,SAAA;AAAA,EACjB;AACA,QAAM,OAA2B,EAAE,MAAM,OAAO,QAAQ,SAAA;AACxD,MAAI,OAAO,gBAAgB,QAAW;AACpC,SAAK,cAAc,OAAO;AAAA,EAC5B;AACA,MAAI,OAAO,SAAS,QAAW;AAC7B,SAAK,OAAO,OAAO;AAAA,EACrB;AACA,MAAI,OAAO,YAAY,QAAW;AAChC,SAAK,UAAU,OAAO;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,WAAwD;AA5F5E;AA6FL,QAAM,WAAU,eAAU,gBAAV,mBAAuB;AACvC,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,WAAO,aAAQ,kBAAkB,MAA1B,mBAA6B,aAAU,YAAO,OAAO,OAAO,EAAE,CAAC,MAAxB,mBAA2B;AAC3E;"}
@@ -7,7 +7,10 @@ export { PromptInput, type PromptInputProps } from './PromptInput';
7
7
  export { ToolCall, type ToolCallProps } from './ToolCall';
8
8
  export { Suggestions, type SuggestionsProps } from './Suggestion';
9
9
  export { ModelSelector, type ModelSelectorProps, EffortSelector, type EffortSelectorProps, } from './ModelSelector';
10
+ export { providerIcon, type ProviderGlyph } from './provider-icons';
11
+ export { ContextUsage, type ContextUsageProps } from './ContextUsage';
10
12
  export { AttachmentButton, type AttachmentButtonProps, AttachmentList, type AttachmentListProps, } from './Attachment';
11
13
  export { clickyOperationsToTools, operationToTool, } from './clickyOperationsToTools';
12
- export { isDynamicToolPart, isTypedToolPart, isReasoningPart, isFilePart, toolPartName, suggestionLabel, suggestionPrompt, type AnyToolPart, type ChatModel, type ChatStatus, type ChatToolInputSchema, type ChatToolMeta, type DynamicToolUIPart, type FileUIPart, type JSONSchemaProperty, type ReasoningUIPart, type Suggestion, type ToolUIPart, type UIMessage, } from './types';
14
+ export { mockChatTransport, MOCK_MODELS } from './Chat.fixtures';
15
+ export { isDynamicToolPart, isTypedToolPart, isReasoningPart, isFilePart, toolPartName, suggestionLabel, suggestionPrompt, type AnyToolPart, type ChatModel, type ChatMessageMetadata, type ChatUsageSummary, type ChatStatus, type ChatToolInputSchema, type ToolMeta, type DynamicToolUIPart, type FileUIPart, type JSONSchemaProperty, type ReasoningUIPart, type Suggestion, type ToolUIPart, type UIMessage, } from './types';
13
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/chat/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO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AE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,uBAAuB,EACvB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,SAAS,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const mi = require("@flanksource/icons/mi");
4
+ const PROVIDER_ICONS = {
5
+ anthropic: mi.Anthropic,
6
+ openai: mi.Openai,
7
+ google: mi.Google,
8
+ googleai: mi.Gemini,
9
+ gemini: mi.Gemini
10
+ };
11
+ function providerIcon(provider) {
12
+ return provider ? PROVIDER_ICONS[provider.toLowerCase()] : void 0;
13
+ }
14
+ exports.providerIcon = providerIcon;
15
+ //# sourceMappingURL=provider-icons.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-icons.cjs","sources":["../../../src/data/chat/provider-icons.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport { Anthropic, Gemini, Google, Openai } from \"@flanksource/icons/mi\";\n\nexport type ProviderGlyph = ComponentType<{ className?: string }>;\n\n// Maps a backend provider id to its brand glyph. googleai surfaces as the Gemini\n// mark (the model family), plain google as the Google mark.\nconst PROVIDER_ICONS: Record<string, ProviderGlyph> = {\n anthropic: Anthropic,\n openai: Openai,\n google: Google,\n googleai: Gemini,\n gemini: Gemini,\n};\n\n/** The brand glyph for a chat model's provider, or undefined when unknown. */\nexport function providerIcon(provider?: string): ProviderGlyph | undefined {\n return provider ? PROVIDER_ICONS[provider.toLowerCase()] : undefined;\n}\n"],"names":["Anthropic","Openai","Google","Gemini"],"mappings":";;;AAOA,MAAM,iBAAgD;AAAA,EACpD,WAAWA,GAAAA;AAAAA,EACX,QAAQC,GAAAA;AAAAA,EACR,QAAQC,GAAAA;AAAAA,EACR,UAAUC,GAAAA;AAAAA,EACV,QAAQA,GAAAA;AACV;AAGO,SAAS,aAAa,UAA8C;AACzE,SAAO,WAAW,eAAe,SAAS,YAAA,CAAa,IAAI;AAC7D;;"}
@@ -0,0 +1,7 @@
1
+ import { ComponentType } from 'react';
2
+ export type ProviderGlyph = ComponentType<{
3
+ className?: string;
4
+ }>;
5
+ /** The brand glyph for a chat model's provider, or undefined when unknown. */
6
+ export declare function providerIcon(provider?: string): ProviderGlyph | undefined;
7
+ //# sourceMappingURL=provider-icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-icons.d.ts","sourceRoot":"","sources":["../../../src/data/chat/provider-icons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAYlE,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEzE"}
@@ -0,0 +1,15 @@
1
+ import { Gemini, Google, Openai, Anthropic } from "@flanksource/icons/mi";
2
+ const PROVIDER_ICONS = {
3
+ anthropic: Anthropic,
4
+ openai: Openai,
5
+ google: Google,
6
+ googleai: Gemini,
7
+ gemini: Gemini
8
+ };
9
+ function providerIcon(provider) {
10
+ return provider ? PROVIDER_ICONS[provider.toLowerCase()] : void 0;
11
+ }
12
+ export {
13
+ providerIcon
14
+ };
15
+ //# sourceMappingURL=provider-icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-icons.js","sources":["../../../src/data/chat/provider-icons.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport { Anthropic, Gemini, Google, Openai } from \"@flanksource/icons/mi\";\n\nexport type ProviderGlyph = ComponentType<{ className?: string }>;\n\n// Maps a backend provider id to its brand glyph. googleai surfaces as the Gemini\n// mark (the model family), plain google as the Google mark.\nconst PROVIDER_ICONS: Record<string, ProviderGlyph> = {\n anthropic: Anthropic,\n openai: Openai,\n google: Google,\n googleai: Gemini,\n gemini: Gemini,\n};\n\n/** The brand glyph for a chat model's provider, or undefined when unknown. */\nexport function providerIcon(provider?: string): ProviderGlyph | undefined {\n return provider ? PROVIDER_ICONS[provider.toLowerCase()] : undefined;\n}\n"],"names":[],"mappings":";AAOA,MAAM,iBAAgD;AAAA,EACpD,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,QAAQ;AACV;AAGO,SAAS,aAAa,UAA8C;AACzE,SAAO,WAAW,eAAe,SAAS,YAAA,CAAa,IAAI;AAC7D;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\n\nexport type { UIMessage, ToolUIPart, DynamicToolUIPart, ChatStatus, ReasoningUIPart, FileUIPart };\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n reasoning: boolean;\n configured?: boolean;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: { type: string }): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** AI-tool metadata derived from a clicky RPC operation. The Go backend owns\n * execution; the client uses this only for display and to scope which tools a\n * request may call (passed in the transport `body`). */\nexport interface ChatToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable description shown in tool pickers / tool-call headers. */\n description?: string | undefined;\n /** JSON-Schema for the tool's input, assembled from the operation's\n * parameters + request body. */\n inputSchema: ChatToolInputSchema;\n}\n\nexport interface ChatToolInputSchema {\n type: \"object\";\n properties: Record<string, JSONSchemaProperty>;\n required: string[];\n}\n\nexport interface JSONSchemaProperty {\n type?: string;\n description?: string;\n enum?: unknown[];\n default?: unknown;\n}\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: { type: string }): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n"],"names":[],"mappings":";;AA0BO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAAiD;AAC/E,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAkCO,SAAS,kBAAkB,MAAmD;AACnF,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;;;;;;;;"}
1
+ {"version":3,"file":"types.cjs","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\n\nexport type { UIMessage, ToolUIPart, DynamicToolUIPart, ChatStatus, ReasoningUIPart, FileUIPart };\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n reasoning: boolean;\n configured?: boolean;\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n usage?: {\n inputTokens?: number;\n outputTokens?: number;\n totalTokens?: number;\n };\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n messageCount: number;\n modelLabel?: string;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: { type: string }): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n}\n\nexport interface ChatToolInputSchema {\n type: \"object\";\n properties: Record<string, JSONSchemaProperty>;\n required: string[];\n}\n\nexport interface JSONSchemaProperty {\n type?: string;\n description?: string;\n enum?: unknown[];\n default?: unknown;\n}\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: { type: string }): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n"],"names":[],"mappings":";;AAsDO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAAiD;AAC/E,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAwCO,SAAS,kBAAkB,MAAmD;AACnF,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;;;;;;;;"}
@@ -8,6 +8,32 @@ export interface ChatModel {
8
8
  label: string;
9
9
  reasoning: boolean;
10
10
  configured?: boolean;
11
+ /** Max context tokens — the denominator for a usage gauge. */
12
+ contextWindow?: number;
13
+ }
14
+ /** Per-message metadata the backend rides on the SSE `finish` part
15
+ * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */
16
+ export interface ChatMessageMetadata {
17
+ usage?: {
18
+ inputTokens?: number;
19
+ outputTokens?: number;
20
+ totalTokens?: number;
21
+ };
22
+ /** This turn's cost in USD. */
23
+ cost?: number;
24
+ /** Cumulative thread cost in USD (when the turn is persisted to a thread). */
25
+ threadCostUsd?: number;
26
+ /** This turn's input-token count, ≈ current context-window occupancy. */
27
+ contextTokens?: number;
28
+ }
29
+ /** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the
30
+ * model's context window, plus cumulative cost. */
31
+ export interface ChatUsageSummary {
32
+ usedTokens: number;
33
+ maxTokens: number;
34
+ cost?: number;
35
+ messageCount: number;
36
+ modelLabel?: string;
11
37
  }
12
38
  /** A suggested prompt shown on the empty state. A bare string is both the label
13
39
  * and the submitted text; the object form separates them. */
@@ -31,17 +57,23 @@ export declare function isFilePart(part: {
31
57
  * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations
32
58
  * surface as dynamic tools, so the chat UI renders both shapes. */
33
59
  export type AnyToolPart = ToolUIPart | DynamicToolUIPart;
34
- /** AI-tool metadata derived from a clicky RPC operation. The Go backend owns
35
- * execution; the client uses this only for display and to scope which tools a
36
- * request may call (passed in the transport `body`). */
37
- export interface ChatToolMeta {
60
+ /** Tool metadata shared by the chat shell. It both configures the
61
+ * tool-preferences popover (`name`/`label`/`group`) and carries the schema
62
+ * derived from a clicky RPC operation (`description`/`inputSchema`). The Go
63
+ * backend owns execution; the client uses this only for display and to scope
64
+ * which tools a request may call (passed in the transport `body`). */
65
+ export interface ToolMeta {
38
66
  /** Stable tool name sent to the model (the operation id). */
39
67
  name: string;
40
- /** Human-readable description shown in tool pickers / tool-call headers. */
41
- description?: string | undefined;
42
- /** JSON-Schema for the tool's input, assembled from the operation's
43
- * parameters + request body. */
44
- inputSchema: ChatToolInputSchema;
68
+ /** Human-readable label shown in the tool-preferences popover. */
69
+ label: string;
70
+ /** Bucket heading in the popover the clicky surface for RPC operations. */
71
+ group?: string;
72
+ /** Description shown in tool pickers / tool-call headers. */
73
+ description?: string;
74
+ /** JSON-Schema for the tool's input, assembled from an operation's
75
+ * parameters + request body. Omitted for hand-authored tools. */
76
+ inputSchema?: ChatToolInputSchema;
45
77
  }
46
78
  export interface ChatToolInputSchema {
47
79
  type: "object";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/data/chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,IAAI,CAAC;AAEZ,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;AAElG;iFACiF;AACjF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;8DAC8D;AAC9D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,wCAAwC;AACxC,wBAAgB,eAAe,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAErD;AAED,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAEtD;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,IAAI,eAAe,CAE/E;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,IAAI,UAAU,CAErE;AAED;;oEAEoE;AACpE,MA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AAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,IAAI,UAAU,CAErE;AAED;;oEAEoE;AACpE,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,iBAAiB,CAAC;AAEzD;;;;uEAIuE;AACvE,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;sEACkE;IAClE,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC/C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,IAAI,iBAAiB,CAEnF;AAED,mDAAmD;AACnD,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,IAAI,UAAU,CAE1E;AAED;0CAC0C;AAC1C,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAKtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\n\nexport type { UIMessage, ToolUIPart, DynamicToolUIPart, ChatStatus, ReasoningUIPart, FileUIPart };\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n reasoning: boolean;\n configured?: boolean;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: { type: string }): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** AI-tool metadata derived from a clicky RPC operation. The Go backend owns\n * execution; the client uses this only for display and to scope which tools a\n * request may call (passed in the transport `body`). */\nexport interface ChatToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable description shown in tool pickers / tool-call headers. */\n description?: string | undefined;\n /** JSON-Schema for the tool's input, assembled from the operation's\n * parameters + request body. */\n inputSchema: ChatToolInputSchema;\n}\n\nexport interface ChatToolInputSchema {\n type: \"object\";\n properties: Record<string, JSONSchemaProperty>;\n required: string[];\n}\n\nexport interface JSONSchemaProperty {\n type?: string;\n description?: string;\n enum?: unknown[];\n default?: unknown;\n}\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: { type: string }): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n"],"names":[],"mappings":"AA0BO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAAiD;AAC/E,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAkCO,SAAS,kBAAkB,MAAmD;AACnF,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;"}
1
+ {"version":3,"file":"types.js","sources":["../../../src/data/chat/types.ts"],"sourcesContent":["import type {\n UIMessage,\n ToolUIPart,\n DynamicToolUIPart,\n ChatStatus,\n ReasoningUIPart,\n FileUIPart,\n} from \"ai\";\n\nexport type { UIMessage, ToolUIPart, DynamicToolUIPart, ChatStatus, ReasoningUIPart, FileUIPart };\n\n/** A selectable chat model, as served by the backend's GET /api/chat/models.\n * `configured` is false for catalogued models whose provider has no API key. */\nexport interface ChatModel {\n id: string;\n provider: string;\n label: string;\n reasoning: boolean;\n configured?: boolean;\n /** Max context tokens — the denominator for a usage gauge. */\n contextWindow?: number;\n}\n\n/** Per-message metadata the backend rides on the SSE `finish` part\n * (`messageMetadata`), applied by the AI SDK to the assistant `UIMessage`. */\nexport interface ChatMessageMetadata {\n usage?: {\n inputTokens?: number;\n outputTokens?: number;\n totalTokens?: number;\n };\n /** This turn's cost in USD. */\n cost?: number;\n /** Cumulative thread cost in USD (when the turn is persisted to a thread). */\n threadCostUsd?: number;\n /** This turn's input-token count, ≈ current context-window occupancy. */\n contextTokens?: number;\n}\n\n/** A flattened usage snapshot a chat surfaces for a gauge: tokens used out of the\n * model's context window, plus cumulative cost. */\nexport interface ChatUsageSummary {\n usedTokens: number;\n maxTokens: number;\n cost?: number;\n messageCount: number;\n modelLabel?: string;\n}\n\n/** A suggested prompt shown on the empty state. A bare string is both the label\n * and the submitted text; the object form separates them. */\nexport type Suggestion = string | { label: string; prompt: string };\n\n/** The label shown for a suggestion. */\nexport function suggestionLabel(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.label;\n}\n\n/** The text submitted when a suggestion is clicked. */\nexport function suggestionPrompt(s: Suggestion): string {\n return typeof s === \"string\" ? s : s.prompt;\n}\n\n/** Returns true for an assistant reasoning (\"thinking\") part. */\nexport function isReasoningPart(part: { type: string }): part is ReasoningUIPart {\n return part.type === \"reasoning\";\n}\n\n/** Returns true for a file/attachment part. */\nexport function isFilePart(part: { type: string }): part is FileUIPart {\n return part.type === \"file\";\n}\n\n/** A tool part as it appears in an assistant UIMessage — either a typed\n * `tool-<name>` part or the generic `dynamic-tool` part. clicky operations\n * surface as dynamic tools, so the chat UI renders both shapes. */\nexport type AnyToolPart = ToolUIPart | DynamicToolUIPart;\n\n/** Tool metadata shared by the chat shell. It both configures the\n * tool-preferences popover (`name`/`label`/`group`) and carries the schema\n * derived from a clicky RPC operation (`description`/`inputSchema`). The Go\n * backend owns execution; the client uses this only for display and to scope\n * which tools a request may call (passed in the transport `body`). */\nexport interface ToolMeta {\n /** Stable tool name sent to the model (the operation id). */\n name: string;\n /** Human-readable label shown in the tool-preferences popover. */\n label: string;\n /** Bucket heading in the popover — the clicky surface for RPC operations. */\n group?: string;\n /** Description shown in tool pickers / tool-call headers. */\n description?: string;\n /** JSON-Schema for the tool's input, assembled from an operation's\n * parameters + request body. Omitted for hand-authored tools. */\n inputSchema?: ChatToolInputSchema;\n}\n\nexport interface ChatToolInputSchema {\n type: \"object\";\n properties: Record<string, JSONSchemaProperty>;\n required: string[];\n}\n\nexport interface JSONSchemaProperty {\n type?: string;\n description?: string;\n enum?: unknown[];\n default?: unknown;\n}\n\n/** Returns true for a `dynamic-tool` part (clicky operations surface this way). */\nexport function isDynamicToolPart(part: { type: string }): part is DynamicToolUIPart {\n return part.type === \"dynamic-tool\";\n}\n\n/** Returns true for a typed `tool-<name>` part. */\nexport function isTypedToolPart(part: { type: string }): part is ToolUIPart {\n return part.type.startsWith(\"tool-\");\n}\n\n/** The display name of a tool part: the explicit `toolName` for dynamic tools,\n * otherwise the suffix after `tool-`. */\nexport function toolPartName(part: AnyToolPart): string {\n if (isDynamicToolPart(part)) {\n return part.toolName;\n }\n return part.type.slice(\"tool-\".length);\n}\n"],"names":[],"mappings":"AAsDO,SAAS,gBAAgB,GAAuB;AACrD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,iBAAiB,GAAuB;AACtD,SAAO,OAAO,MAAM,WAAW,IAAI,EAAE;AACvC;AAGO,SAAS,gBAAgB,MAAiD;AAC/E,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,WAAW,MAA4C;AACrE,SAAO,KAAK,SAAS;AACvB;AAwCO,SAAS,kBAAkB,MAAmD;AACnF,SAAO,KAAK,SAAS;AACvB;AAGO,SAAS,gBAAgB,MAA4C;AAC1E,SAAO,KAAK,KAAK,WAAW,OAAO;AACrC;AAIO,SAAS,aAAa,MAA2B;AACtD,MAAI,kBAAkB,IAAI,GAAG;AAC3B,WAAO,KAAK;AAAA,EACd;AACA,SAAO,KAAK,KAAK,MAAM,QAAQ,MAAM;AACvC;"}