@flanksource/clicky-ui 0.3.71 → 0.3.73

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 (411) hide show
  1. package/dist/ai.cjs +5 -0
  2. package/dist/ai.js +3 -1
  3. package/dist/comment-anchoring.cjs +3 -0
  4. package/dist/comment-anchoring.js +2 -1
  5. package/dist/comments/CommentCapture.cjs +6 -8
  6. package/dist/comments/CommentCapture.cjs.map +1 -1
  7. package/dist/comments/CommentCapture.d.ts.map +1 -1
  8. package/dist/comments/CommentCapture.js +6 -8
  9. package/dist/comments/CommentCapture.js.map +1 -1
  10. package/dist/comments/CommentComposer.cjs +12 -8
  11. package/dist/comments/CommentComposer.cjs.map +1 -1
  12. package/dist/comments/CommentComposer.d.ts.map +1 -1
  13. package/dist/comments/CommentComposer.js +12 -8
  14. package/dist/comments/CommentComposer.js.map +1 -1
  15. package/dist/comments/CommentThread.cjs +2 -1
  16. package/dist/comments/CommentThread.cjs.map +1 -1
  17. package/dist/comments/CommentThread.d.ts +1 -1
  18. package/dist/comments/CommentThread.d.ts.map +1 -1
  19. package/dist/comments/CommentThread.js +2 -1
  20. package/dist/comments/CommentThread.js.map +1 -1
  21. package/dist/comments/CommentThreadList.cjs +5 -3
  22. package/dist/comments/CommentThreadList.cjs.map +1 -1
  23. package/dist/comments/CommentThreadList.d.ts +1 -1
  24. package/dist/comments/CommentThreadList.d.ts.map +1 -1
  25. package/dist/comments/CommentThreadList.js +5 -3
  26. package/dist/comments/CommentThreadList.js.map +1 -1
  27. package/dist/comments/anchoring/dom-anchor.cjs +32 -4
  28. package/dist/comments/anchoring/dom-anchor.cjs.map +1 -1
  29. package/dist/comments/anchoring/dom-anchor.d.ts +8 -4
  30. package/dist/comments/anchoring/dom-anchor.d.ts.map +1 -1
  31. package/dist/comments/anchoring/dom-anchor.js +31 -5
  32. package/dist/comments/anchoring/dom-anchor.js.map +1 -1
  33. package/dist/comments/anchoring/frame-anchor.cjs +74 -0
  34. package/dist/comments/anchoring/frame-anchor.cjs.map +1 -0
  35. package/dist/comments/anchoring/frame-anchor.d.ts +21 -0
  36. package/dist/comments/anchoring/frame-anchor.d.ts.map +1 -0
  37. package/dist/comments/anchoring/frame-anchor.js +70 -0
  38. package/dist/comments/anchoring/frame-anchor.js.map +1 -0
  39. package/dist/comments/comment-detail.d.ts +1 -0
  40. package/dist/comments/comment-detail.d.ts.map +1 -1
  41. package/dist/comments/comment-types.cjs.map +1 -1
  42. package/dist/comments/comment-types.d.ts +2 -0
  43. package/dist/comments/comment-types.d.ts.map +1 -1
  44. package/dist/comments/comment-types.js.map +1 -1
  45. package/dist/comments/gavel/CommentInbox.cjs +49 -59
  46. package/dist/comments/gavel/CommentInbox.cjs.map +1 -1
  47. package/dist/comments/gavel/CommentInbox.d.ts +12 -8
  48. package/dist/comments/gavel/CommentInbox.d.ts.map +1 -1
  49. package/dist/comments/gavel/CommentInbox.js +51 -61
  50. package/dist/comments/gavel/CommentInbox.js.map +1 -1
  51. package/dist/comments/gavel/CommentInboxThread.cjs.map +1 -1
  52. package/dist/comments/gavel/CommentInboxThread.d.ts +1 -3
  53. package/dist/comments/gavel/CommentInboxThread.d.ts.map +1 -1
  54. package/dist/comments/gavel/CommentInboxThread.js.map +1 -1
  55. package/dist/comments/gavel/comment-agent-assignment.cjs +41 -0
  56. package/dist/comments/gavel/comment-agent-assignment.cjs.map +1 -0
  57. package/dist/comments/gavel/comment-agent-assignment.d.ts +15 -0
  58. package/dist/comments/gavel/comment-agent-assignment.d.ts.map +1 -0
  59. package/dist/comments/gavel/comment-agent-assignment.js +39 -0
  60. package/dist/comments/gavel/comment-agent-assignment.js.map +1 -0
  61. package/dist/comments/gavel/gavel-projection.cjs +43 -13
  62. package/dist/comments/gavel/gavel-projection.cjs.map +1 -1
  63. package/dist/comments/gavel/gavel-projection.d.ts +3 -0
  64. package/dist/comments/gavel/gavel-projection.d.ts.map +1 -1
  65. package/dist/comments/gavel/gavel-projection.js +43 -14
  66. package/dist/comments/gavel/gavel-projection.js.map +1 -1
  67. package/dist/comments/gavel/inbox-model.cjs +3 -12
  68. package/dist/comments/gavel/inbox-model.cjs.map +1 -1
  69. package/dist/comments/gavel/inbox-model.d.ts +2 -2
  70. package/dist/comments/gavel/inbox-model.d.ts.map +1 -1
  71. package/dist/comments/gavel/inbox-model.js +4 -12
  72. package/dist/comments/gavel/inbox-model.js.map +1 -1
  73. package/dist/comments/gavel/inbox-prompt.cjs +1 -0
  74. package/dist/comments/gavel/inbox-prompt.cjs.map +1 -1
  75. package/dist/comments/gavel/inbox-prompt.d.ts.map +1 -1
  76. package/dist/comments/gavel/inbox-prompt.js +1 -0
  77. package/dist/comments/gavel/inbox-prompt.js.map +1 -1
  78. package/dist/comments/gavel/index.d.ts +1 -0
  79. package/dist/comments/gavel/index.d.ts.map +1 -1
  80. package/dist/comments-gavel.cjs +5 -1
  81. package/dist/comments-gavel.js +4 -3
  82. package/dist/comments.cjs +5 -0
  83. package/dist/comments.d.ts +1 -0
  84. package/dist/comments.d.ts.map +1 -1
  85. package/dist/comments.js +3 -1
  86. package/dist/components/AccordionList.cjs +2 -2
  87. package/dist/components/AccordionList.cjs.map +1 -1
  88. package/dist/components/AccordionList.js +2 -2
  89. package/dist/components/AccordionList.js.map +1 -1
  90. package/dist/components/examples/form-extensions/extension.d.ts +1 -1
  91. package/dist/components/examples/form-extensions/extension.d.ts.map +1 -1
  92. package/dist/components/json-schema-form-array-add-menu.cjs +44 -0
  93. package/dist/components/json-schema-form-array-add-menu.cjs.map +1 -0
  94. package/dist/components/json-schema-form-array-add-menu.d.ts +10 -0
  95. package/dist/components/json-schema-form-array-add-menu.d.ts.map +1 -0
  96. package/dist/components/json-schema-form-array-add-menu.js +44 -0
  97. package/dist/components/json-schema-form-array-add-menu.js.map +1 -0
  98. package/dist/components/json-schema-form-exclusive-key-select.cjs +28 -0
  99. package/dist/components/json-schema-form-exclusive-key-select.cjs.map +1 -0
  100. package/dist/components/json-schema-form-exclusive-key-select.d.ts +12 -0
  101. package/dist/components/json-schema-form-exclusive-key-select.d.ts.map +1 -0
  102. package/dist/components/json-schema-form-exclusive-key-select.js +28 -0
  103. package/dist/components/json-schema-form-exclusive-key-select.js.map +1 -0
  104. package/dist/components/json-schema-form-exclusive-keys.cjs +23 -0
  105. package/dist/components/json-schema-form-exclusive-keys.cjs.map +1 -0
  106. package/dist/components/json-schema-form-exclusive-keys.d.ts +8 -0
  107. package/dist/components/json-schema-form-exclusive-keys.d.ts.map +1 -0
  108. package/dist/components/json-schema-form-exclusive-keys.js +22 -0
  109. package/dist/components/json-schema-form-exclusive-keys.js.map +1 -0
  110. package/dist/components/json-schema-form-layout.cjs +18 -5
  111. package/dist/components/json-schema-form-layout.cjs.map +1 -1
  112. package/dist/components/json-schema-form-layout.d.ts +3 -1
  113. package/dist/components/json-schema-form-layout.d.ts.map +1 -1
  114. package/dist/components/json-schema-form-layout.js +19 -6
  115. package/dist/components/json-schema-form-layout.js.map +1 -1
  116. package/dist/components/json-schema-form-object-array-view.cjs +13 -7
  117. package/dist/components/json-schema-form-object-array-view.cjs.map +1 -1
  118. package/dist/components/json-schema-form-object-array-view.d.ts.map +1 -1
  119. package/dist/components/json-schema-form-object-array-view.js +13 -7
  120. package/dist/components/json-schema-form-object-array-view.js.map +1 -1
  121. package/dist/components/json-schema-form-object.cjs +6 -0
  122. package/dist/components/json-schema-form-object.cjs.map +1 -1
  123. package/dist/components/json-schema-form-object.d.ts.map +1 -1
  124. package/dist/components/json-schema-form-object.js +6 -0
  125. package/dist/components/json-schema-form-object.js.map +1 -1
  126. package/dist/components/json-schema-form-render.cjs +56 -35
  127. package/dist/components/json-schema-form-render.cjs.map +1 -1
  128. package/dist/components/json-schema-form-render.d.ts +1 -0
  129. package/dist/components/json-schema-form-render.d.ts.map +1 -1
  130. package/dist/components/json-schema-form-render.js +56 -35
  131. package/dist/components/json-schema-form-render.js.map +1 -1
  132. package/dist/components/json-schema-form-resolve.cjs +1 -0
  133. package/dist/components/json-schema-form-resolve.cjs.map +1 -1
  134. package/dist/components/json-schema-form-resolve.d.ts +2 -1
  135. package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
  136. package/dist/components/json-schema-form-resolve.js +1 -1
  137. package/dist/components/json-schema-form-resolve.js.map +1 -1
  138. package/dist/components/json-schema-form-runtime-types.d.ts +8 -0
  139. package/dist/components/json-schema-form-runtime-types.d.ts.map +1 -1
  140. package/dist/components/json-schema-form-section-actions.cjs +12 -0
  141. package/dist/components/json-schema-form-section-actions.cjs.map +1 -0
  142. package/dist/components/json-schema-form-section-actions.d.ts +8 -0
  143. package/dist/components/json-schema-form-section-actions.d.ts.map +1 -0
  144. package/dist/components/json-schema-form-section-actions.js +11 -0
  145. package/dist/components/json-schema-form-section-actions.js.map +1 -0
  146. package/dist/components/json-schema-form-sibling-prefix.cjs +23 -0
  147. package/dist/components/json-schema-form-sibling-prefix.cjs.map +1 -0
  148. package/dist/components/json-schema-form-sibling-prefix.d.ts +9 -0
  149. package/dist/components/json-schema-form-sibling-prefix.d.ts.map +1 -0
  150. package/dist/components/json-schema-form-sibling-prefix.js +23 -0
  151. package/dist/components/json-schema-form-sibling-prefix.js.map +1 -0
  152. package/dist/components/json-schema-form-sibling-select.cjs +25 -0
  153. package/dist/components/json-schema-form-sibling-select.cjs.map +1 -0
  154. package/dist/components/json-schema-form-sibling-select.d.ts +9 -0
  155. package/dist/components/json-schema-form-sibling-select.d.ts.map +1 -0
  156. package/dist/components/json-schema-form-sibling-select.js +25 -0
  157. package/dist/components/json-schema-form-sibling-select.js.map +1 -0
  158. package/dist/components/json-schema-form-table-array.cjs +4 -3
  159. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  160. package/dist/components/json-schema-form-table-array.js +4 -3
  161. package/dist/components/json-schema-form-table-array.js.map +1 -1
  162. package/dist/components/json-schema-form-tags-combobox.cjs +54 -24
  163. package/dist/components/json-schema-form-tags-combobox.cjs.map +1 -1
  164. package/dist/components/json-schema-form-tags-combobox.d.ts.map +1 -1
  165. package/dist/components/json-schema-form-tags-combobox.js +55 -25
  166. package/dist/components/json-schema-form-tags-combobox.js.map +1 -1
  167. package/dist/components.cjs +2 -0
  168. package/dist/components.d.ts +2 -1
  169. package/dist/components.d.ts.map +1 -1
  170. package/dist/components.js +2 -1
  171. package/dist/data/LogViewer.cjs +90 -19
  172. package/dist/data/LogViewer.cjs.map +1 -1
  173. package/dist/data/LogViewer.d.ts +9 -5
  174. package/dist/data/LogViewer.d.ts.map +1 -1
  175. package/dist/data/LogViewer.js +91 -20
  176. package/dist/data/LogViewer.js.map +1 -1
  177. package/dist/data/TaskProgress.cjs +5 -5
  178. package/dist/data/TaskProgress.cjs.map +1 -1
  179. package/dist/data/TaskProgress.js +5 -5
  180. package/dist/data/TaskProgress.js.map +1 -1
  181. package/dist/data/ai/SessionChatComposer.cjs +44 -22
  182. package/dist/data/ai/SessionChatComposer.cjs.map +1 -1
  183. package/dist/data/ai/SessionChatComposer.d.ts.map +1 -1
  184. package/dist/data/ai/SessionChatComposer.js +44 -22
  185. package/dist/data/ai/SessionChatComposer.js.map +1 -1
  186. package/dist/data/ai/SessionInspector.cjs +1 -1
  187. package/dist/data/ai/SessionInspector.cjs.map +1 -1
  188. package/dist/data/ai/SessionInspector.d.ts.map +1 -1
  189. package/dist/data/ai/SessionInspector.host-tabs.cjs +12 -0
  190. package/dist/data/ai/SessionInspector.host-tabs.cjs.map +1 -1
  191. package/dist/data/ai/SessionInspector.host-tabs.d.ts +4 -1
  192. package/dist/data/ai/SessionInspector.host-tabs.d.ts.map +1 -1
  193. package/dist/data/ai/SessionInspector.host-tabs.js +12 -1
  194. package/dist/data/ai/SessionInspector.host-tabs.js.map +1 -1
  195. package/dist/data/ai/SessionInspector.js +2 -2
  196. package/dist/data/ai/SessionInspector.js.map +1 -1
  197. package/dist/data/ai/SessionInspector.legacy.cjs +1 -1
  198. package/dist/data/ai/SessionInspector.legacy.cjs.map +1 -1
  199. package/dist/data/ai/SessionInspector.legacy.d.ts.map +1 -1
  200. package/dist/data/ai/SessionInspector.legacy.js +2 -2
  201. package/dist/data/ai/SessionInspector.legacy.js.map +1 -1
  202. package/dist/data/ai/SessionInspector.transcript.cjs +5 -19
  203. package/dist/data/ai/SessionInspector.transcript.cjs.map +1 -1
  204. package/dist/data/ai/SessionInspector.transcript.d.ts.map +1 -1
  205. package/dist/data/ai/SessionInspector.transcript.js +6 -20
  206. package/dist/data/ai/SessionInspector.transcript.js.map +1 -1
  207. package/dist/data/ai/SessionPicker.cjs +159 -0
  208. package/dist/data/ai/SessionPicker.cjs.map +1 -0
  209. package/dist/data/ai/SessionPicker.d.ts +39 -0
  210. package/dist/data/ai/SessionPicker.d.ts.map +1 -0
  211. package/dist/data/ai/SessionPicker.js +159 -0
  212. package/dist/data/ai/SessionPicker.js.map +1 -0
  213. package/dist/data/ai/SessionPicker.model.cjs +21 -0
  214. package/dist/data/ai/SessionPicker.model.cjs.map +1 -0
  215. package/dist/data/ai/SessionPicker.model.d.ts +26 -0
  216. package/dist/data/ai/SessionPicker.model.d.ts.map +1 -0
  217. package/dist/data/ai/SessionPicker.model.js +20 -0
  218. package/dist/data/ai/SessionPicker.model.js.map +1 -0
  219. package/dist/data/ai/SessionTail.cjs +25 -15
  220. package/dist/data/ai/SessionTail.cjs.map +1 -1
  221. package/dist/data/ai/SessionTail.d.ts.map +1 -1
  222. package/dist/data/ai/SessionTail.js +25 -15
  223. package/dist/data/ai/SessionTail.js.map +1 -1
  224. package/dist/data/ai/SessionViewer.input.cjs +59 -1
  225. package/dist/data/ai/SessionViewer.input.cjs.map +1 -1
  226. package/dist/data/ai/SessionViewer.input.d.ts +22 -0
  227. package/dist/data/ai/SessionViewer.input.d.ts.map +1 -1
  228. package/dist/data/ai/SessionViewer.input.js +58 -2
  229. package/dist/data/ai/SessionViewer.input.js.map +1 -1
  230. package/dist/data/ai/SessionViewer.rows.cjs +10 -3
  231. package/dist/data/ai/SessionViewer.rows.cjs.map +1 -1
  232. package/dist/data/ai/SessionViewer.rows.d.ts.map +1 -1
  233. package/dist/data/ai/SessionViewer.rows.js +11 -4
  234. package/dist/data/ai/SessionViewer.rows.js.map +1 -1
  235. package/dist/data/ai/SessionViewer.tool-details.cjs +35 -0
  236. package/dist/data/ai/SessionViewer.tool-details.cjs.map +1 -1
  237. package/dist/data/ai/SessionViewer.tool-details.d.ts +10 -1
  238. package/dist/data/ai/SessionViewer.tool-details.d.ts.map +1 -1
  239. package/dist/data/ai/SessionViewer.tool-details.js +35 -1
  240. package/dist/data/ai/SessionViewer.tool-details.js.map +1 -1
  241. package/dist/data/ai/SessionViewer.tool-row.cjs +5 -1
  242. package/dist/data/ai/SessionViewer.tool-row.cjs.map +1 -1
  243. package/dist/data/ai/SessionViewer.tool-row.d.ts.map +1 -1
  244. package/dist/data/ai/SessionViewer.tool-row.js +7 -3
  245. package/dist/data/ai/SessionViewer.tool-row.js.map +1 -1
  246. package/dist/data/ai/index.d.ts +2 -0
  247. package/dist/data/ai/index.d.ts.map +1 -1
  248. package/dist/data/git/GitChangeList.cjs +40 -7
  249. package/dist/data/git/GitChangeList.cjs.map +1 -1
  250. package/dist/data/git/GitChangeList.d.ts +3 -0
  251. package/dist/data/git/GitChangeList.d.ts.map +1 -1
  252. package/dist/data/git/GitChangeList.js +40 -7
  253. package/dist/data/git/GitChangeList.js.map +1 -1
  254. package/dist/data/git/pickers/GitFilePicker.cjs +19 -7
  255. package/dist/data/git/pickers/GitFilePicker.cjs.map +1 -1
  256. package/dist/data/git/pickers/GitFilePicker.d.ts +4 -2
  257. package/dist/data/git/pickers/GitFilePicker.d.ts.map +1 -1
  258. package/dist/data/git/pickers/GitFilePicker.js +19 -7
  259. package/dist/data/git/pickers/GitFilePicker.js.map +1 -1
  260. package/dist/data/git/pickers/GitPickers.cjs +3 -3
  261. package/dist/data/git/pickers/GitPickers.cjs.map +1 -1
  262. package/dist/data/git/pickers/GitPickers.js +3 -3
  263. package/dist/data/git/pickers/GitPickers.js.map +1 -1
  264. package/dist/data/git/pickers/GitPickersDemo.d.ts.map +1 -1
  265. package/dist/data/git/pickers/GitSourcePicker.cjs +11 -4
  266. package/dist/data/git/pickers/GitSourcePicker.cjs.map +1 -1
  267. package/dist/data/git/pickers/GitSourcePicker.d.ts +4 -2
  268. package/dist/data/git/pickers/GitSourcePicker.d.ts.map +1 -1
  269. package/dist/data/git/pickers/GitSourcePicker.js +11 -4
  270. package/dist/data/git/pickers/GitSourcePicker.js.map +1 -1
  271. package/dist/data/git/pickers/ReferencePicker.cjs +27 -3
  272. package/dist/data/git/pickers/ReferencePicker.cjs.map +1 -1
  273. package/dist/data/git/pickers/ReferencePicker.d.ts.map +1 -1
  274. package/dist/data/git/pickers/ReferencePicker.js +27 -3
  275. package/dist/data/git/pickers/ReferencePicker.js.map +1 -1
  276. package/dist/data/git/pickers/RepositoryCatalogPicker.cjs +2 -1
  277. package/dist/data/git/pickers/RepositoryCatalogPicker.cjs.map +1 -1
  278. package/dist/data/git/pickers/RepositoryCatalogPicker.d.ts +3 -2
  279. package/dist/data/git/pickers/RepositoryCatalogPicker.d.ts.map +1 -1
  280. package/dist/data/git/pickers/RepositoryCatalogPicker.js +2 -1
  281. package/dist/data/git/pickers/RepositoryCatalogPicker.js.map +1 -1
  282. package/dist/data/git/pickers/types.d.ts +7 -0
  283. package/dist/data/git/pickers/types.d.ts.map +1 -1
  284. package/dist/data/lint/LintList.cjs +89 -89
  285. package/dist/data/lint/LintList.cjs.map +1 -1
  286. package/dist/data/lint/LintList.d.ts +3 -2
  287. package/dist/data/lint/LintList.d.ts.map +1 -1
  288. package/dist/data/lint/LintList.js +90 -90
  289. package/dist/data/lint/LintList.js.map +1 -1
  290. package/dist/data/log-sections.cjs +152 -21
  291. package/dist/data/log-sections.cjs.map +1 -1
  292. package/dist/data/log-sections.d.ts +31 -6
  293. package/dist/data/log-sections.d.ts.map +1 -1
  294. package/dist/data/log-sections.js +151 -22
  295. package/dist/data/log-sections.js.map +1 -1
  296. package/dist/data/test-runner/TestDetailPanel.cjs +1 -1
  297. package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
  298. package/dist/data/test-runner/TestDetailPanel.js +1 -1
  299. package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
  300. package/dist/data/test-runner/TestFailureDetail.cjs +10 -8
  301. package/dist/data/test-runner/TestFailureDetail.cjs.map +1 -1
  302. package/dist/data/test-runner/TestFailureDetail.d.ts +3 -2
  303. package/dist/data/test-runner/TestFailureDetail.d.ts.map +1 -1
  304. package/dist/data/test-runner/TestFailureDetail.js +10 -8
  305. package/dist/data/test-runner/TestFailureDetail.js.map +1 -1
  306. package/dist/data/test-runner/TestTreeNode.cjs +9 -4
  307. package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
  308. package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
  309. package/dist/data/test-runner/TestTreeNode.js +9 -4
  310. package/dist/data/test-runner/TestTreeNode.js.map +1 -1
  311. package/dist/data/test-runner/attempts.cjs +2 -1
  312. package/dist/data/test-runner/attempts.cjs.map +1 -1
  313. package/dist/data/test-runner/attempts.d.ts.map +1 -1
  314. package/dist/data/test-runner/attempts.js +2 -1
  315. package/dist/data/test-runner/attempts.js.map +1 -1
  316. package/dist/data/test-runner/copy.cjs +1 -2
  317. package/dist/data/test-runner/copy.cjs.map +1 -1
  318. package/dist/data/test-runner/copy.d.ts.map +1 -1
  319. package/dist/data/test-runner/copy.js +1 -2
  320. package/dist/data/test-runner/copy.js.map +1 -1
  321. package/dist/data/test-runner/types.d.ts +3 -0
  322. package/dist/data/test-runner/types.d.ts.map +1 -1
  323. package/dist/data/traces/GoProfileView.cjs +10 -7
  324. package/dist/data/traces/GoProfileView.cjs.map +1 -1
  325. package/dist/data/traces/GoProfileView.d.ts.map +1 -1
  326. package/dist/data/traces/GoProfileView.js +10 -7
  327. package/dist/data/traces/GoProfileView.js.map +1 -1
  328. package/dist/data/traces/TraceEventStream.cjs +37 -7
  329. package/dist/data/traces/TraceEventStream.cjs.map +1 -1
  330. package/dist/data/traces/TraceEventStream.d.ts.map +1 -1
  331. package/dist/data/traces/TraceEventStream.js +37 -7
  332. package/dist/data/traces/TraceEventStream.js.map +1 -1
  333. package/dist/data/traces/TraceFeed.cjs +71 -106
  334. package/dist/data/traces/TraceFeed.cjs.map +1 -1
  335. package/dist/data/traces/TraceFeed.d.ts +3 -10
  336. package/dist/data/traces/TraceFeed.d.ts.map +1 -1
  337. package/dist/data/traces/TraceFeed.js +72 -107
  338. package/dist/data/traces/TraceFeed.js.map +1 -1
  339. package/dist/data/traces/trace-feed.cjs.map +1 -1
  340. package/dist/data/traces/trace-feed.d.ts +15 -0
  341. package/dist/data/traces/trace-feed.d.ts.map +1 -1
  342. package/dist/data/traces/trace-feed.js.map +1 -1
  343. package/dist/data/traces/use-trace-feed.cjs +100 -0
  344. package/dist/data/traces/use-trace-feed.cjs.map +1 -0
  345. package/dist/data/traces/use-trace-feed.d.ts +11 -0
  346. package/dist/data/traces/use-trace-feed.d.ts.map +1 -0
  347. package/dist/data/traces/use-trace-feed.js +100 -0
  348. package/dist/data/traces/use-trace-feed.js.map +1 -0
  349. package/dist/data/verification/adapters.cjs +1 -0
  350. package/dist/data/verification/adapters.cjs.map +1 -1
  351. package/dist/data/verification/adapters.d.ts.map +1 -1
  352. package/dist/data/verification/adapters.js +1 -0
  353. package/dist/data/verification/adapters.js.map +1 -1
  354. package/dist/data/version-info.cjs +3 -3
  355. package/dist/data/version-info.js +3 -3
  356. package/dist/data.cjs +2 -2
  357. package/dist/data.d.ts +1 -1
  358. package/dist/data.d.ts.map +1 -1
  359. package/dist/data.js +2 -2
  360. package/dist/hooks/event-hub.cjs +24 -2
  361. package/dist/hooks/event-hub.cjs.map +1 -1
  362. package/dist/hooks/event-hub.d.ts +2 -0
  363. package/dist/hooks/event-hub.d.ts.map +1 -1
  364. package/dist/hooks/event-hub.js +24 -2
  365. package/dist/hooks/event-hub.js.map +1 -1
  366. package/dist/hooks/event-stream.cjs +64 -0
  367. package/dist/hooks/event-stream.cjs.map +1 -0
  368. package/dist/hooks/event-stream.d.ts +13 -0
  369. package/dist/hooks/event-stream.d.ts.map +1 -0
  370. package/dist/hooks/event-stream.js +64 -0
  371. package/dist/hooks/event-stream.js.map +1 -0
  372. package/dist/hooks/log-tail-session.cjs +53 -0
  373. package/dist/hooks/log-tail-session.cjs.map +1 -0
  374. package/dist/hooks/log-tail-session.d.ts +31 -0
  375. package/dist/hooks/log-tail-session.d.ts.map +1 -0
  376. package/dist/hooks/log-tail-session.js +53 -0
  377. package/dist/hooks/log-tail-session.js.map +1 -0
  378. package/dist/hooks/tail-buffer.cjs +15 -0
  379. package/dist/hooks/tail-buffer.cjs.map +1 -0
  380. package/dist/hooks/tail-buffer.d.ts +11 -0
  381. package/dist/hooks/tail-buffer.d.ts.map +1 -0
  382. package/dist/hooks/tail-buffer.js +15 -0
  383. package/dist/hooks/tail-buffer.js.map +1 -0
  384. package/dist/hooks/use-live-snapshot.cjs +60 -0
  385. package/dist/hooks/use-live-snapshot.cjs.map +1 -0
  386. package/dist/hooks/use-live-snapshot.d.ts +9 -0
  387. package/dist/hooks/use-live-snapshot.d.ts.map +1 -0
  388. package/dist/hooks/use-live-snapshot.js +60 -0
  389. package/dist/hooks/use-live-snapshot.js.map +1 -0
  390. package/dist/hooks/use-log-tail.cjs +125 -112
  391. package/dist/hooks/use-log-tail.cjs.map +1 -1
  392. package/dist/hooks/use-log-tail.d.ts +2 -24
  393. package/dist/hooks/use-log-tail.d.ts.map +1 -1
  394. package/dist/hooks/use-log-tail.js +125 -112
  395. package/dist/hooks/use-log-tail.js.map +1 -1
  396. package/dist/hooks.cjs +6 -0
  397. package/dist/hooks.d.ts +3 -0
  398. package/dist/hooks.d.ts.map +1 -1
  399. package/dist/hooks.js +4 -1
  400. package/dist/index.cjs +14 -1
  401. package/dist/index.js +8 -2
  402. package/dist/runtime/barrels.json +7017 -6986
  403. package/dist/runtime/importmap.json +2129 -2115
  404. package/dist/styles.css +1 -1
  405. package/package.json +1 -1
  406. package/dist/comments/gavel/CommentInboxReview.cjs +0 -169
  407. package/dist/comments/gavel/CommentInboxReview.cjs.map +0 -1
  408. package/dist/comments/gavel/CommentInboxReview.d.ts +0 -20
  409. package/dist/comments/gavel/CommentInboxReview.d.ts.map +0 -1
  410. package/dist/comments/gavel/CommentInboxReview.js +0 -169
  411. package/dist/comments/gavel/CommentInboxReview.js.map +0 -1
@@ -0,0 +1,60 @@
1
+ import { useEventSourceFactory } from "./event-source.js";
2
+ import { subscribeJSON } from "./event-stream.js";
3
+ import { useEffect, useRef, useState } from "react";
4
+ // src/hooks/use-live-snapshot.ts
5
+ /** The latest snapshot for a URL. A suspended subscription retains its last frame. */
6
+ function useLiveSnapshot(url, merge) {
7
+ const factory = useEventSourceFactory();
8
+ const [snapshot, setSnapshot] = useState({ url: "" });
9
+ const [attempt, setAttempt] = useState(0);
10
+ const latest = useRef({ url: "" });
11
+ const mergeRef = useRef(merge);
12
+ useEffect(() => {
13
+ mergeRef.current = merge;
14
+ }, [merge]);
15
+ useEffect(() => {
16
+ if (!url) return;
17
+ const update = (value) => setSnapshot((previous) => ({
18
+ ...previous.url === url ? previous : { url },
19
+ ...value
20
+ }));
21
+ return subscribeJSON(factory, url, {
22
+ onOpen: () => update({
23
+ error: void 0,
24
+ ended: false
25
+ }),
26
+ onData: (change) => {
27
+ const previous = latest.current.url === url ? latest.current.data : void 0;
28
+ const data = mergeRef.current ? mergeRef.current(previous, change) : change;
29
+ latest.current = {
30
+ url,
31
+ data
32
+ };
33
+ setSnapshot(latest.current);
34
+ },
35
+ onError: (error, terminal) => update({
36
+ error,
37
+ ended: terminal
38
+ }),
39
+ onEnd: () => update({
40
+ error: void 0,
41
+ ended: true
42
+ })
43
+ });
44
+ }, [
45
+ factory,
46
+ url,
47
+ attempt
48
+ ]);
49
+ const value = url === null || snapshot.url === url ? snapshot : void 0;
50
+ return {
51
+ data: value?.data,
52
+ error: value?.error,
53
+ ended: value?.ended ?? false,
54
+ pending: !!url && value?.data === void 0 && !value?.ended,
55
+ refresh: () => setAttempt((previous) => previous + 1)
56
+ };
57
+ }
58
+ export { useLiveSnapshot };
59
+
60
+ //# sourceMappingURL=use-live-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-live-snapshot.js","names":[],"sources":["../../src/hooks/use-live-snapshot.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useEventSourceFactory } from \"./event-source\";\nimport { subscribeJSON } from \"./event-stream\";\n\ninterface LiveSnapshot<T> {\n url: string;\n data?: T;\n error?: Error | undefined;\n ended?: boolean;\n}\n\n/** The latest snapshot for a URL. A suspended subscription retains its last frame. */\nexport function useLiveSnapshot<T, Change = T>(url: string | null, merge?: (previous: T | undefined, change: Change) => T) {\n const factory = useEventSourceFactory();\n const [snapshot, setSnapshot] = useState<LiveSnapshot<T>>({ url: \"\" });\n const [attempt, setAttempt] = useState(0);\n const latest = useRef<Pick<LiveSnapshot<T>, \"url\" | \"data\">>({ url: \"\" });\n const mergeRef = useRef(merge);\n\n useEffect(() => {\n mergeRef.current = merge;\n }, [merge]);\n\n useEffect(() => {\n if (!url) return;\n const update = (value: Partial<LiveSnapshot<T>>) => setSnapshot(previous => ({ ...(previous.url === url ? previous : { url }), ...value }));\n return subscribeJSON<Change>(factory, url, {\n onOpen: () => update({ error: undefined, ended: false }),\n onData: change => {\n const previous = latest.current.url === url ? latest.current.data : undefined;\n const data = mergeRef.current ? mergeRef.current(previous, change) : change as unknown as T;\n latest.current = { url, data };\n setSnapshot(latest.current);\n },\n onError: (error, terminal) => update({ error, ended: terminal }),\n onEnd: () => update({ error: undefined, ended: true }),\n });\n }, [factory, url, attempt]);\n\n const value = url === null || snapshot.url === url ? snapshot : undefined;\n return { data: value?.data, error: value?.error, ended: value?.ended ?? false, pending: !!url && value?.data === undefined && !value?.ended, refresh: () => setAttempt(previous => previous + 1) };\n}\n"],"mappings":";;;;;AAYA,SAAgB,gBAA+B,KAAoB,OAAwD;CACzH,MAAM,UAAU,sBAAs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event_stream = require("./event-stream.cjs");
4
+ const require_log_tail_session = require("./log-tail-session.cjs");
5
+ const require_tail_buffer = require("./tail-buffer.cjs");
3
6
  let react = require("react");
4
7
  // src/hooks/use-log-tail.ts
5
8
  /**
@@ -61,160 +64,170 @@ function appendTailEvent(buffer, event, maxRows) {
61
64
  lastSequence: event.sequence
62
65
  };
63
66
  const incomingClickyRows = event.rows ? event.rows.map(() => void 0) : [event.clickyRow];
64
- const merged = buffer.rows.concat(incoming);
65
- const mergedClickyRows = buffer.clickyRows.concat(incomingClickyRows);
66
- const overflow = Math.max(0, merged.length - Math.max(1, maxRows));
67
+ const { rows, dropped } = require_tail_buffer.appendTailRows(buffer.rows, incoming, { limit: maxRows });
67
68
  return {
68
- rows: overflow > 0 ? merged.slice(overflow) : merged,
69
- clickyRows: overflow > 0 ? mergedClickyRows.slice(overflow) : mergedClickyRows,
69
+ rows,
70
+ clickyRows: buffer.clickyRows.concat(incomingClickyRows).slice(dropped),
70
71
  lastSequence: event.sequence,
71
- dropped: buffer.dropped + overflow
72
+ dropped: buffer.dropped + dropped
72
73
  };
73
74
  }
74
75
  var DEFAULT_BASE = "/api/v1";
75
76
  var DEFAULT_MAX_ROWS = 5e3;
76
- function hasEventSource() {
77
- return typeof globalThis !== "undefined" && typeof globalThis.EventSource !== "undefined";
78
- }
77
+ var emptyLogTailSnapshot = {
78
+ request: null,
79
+ buffer: emptyLogTailBuffer,
80
+ status: "idle",
81
+ error: null,
82
+ session: null
83
+ };
79
84
  function useLogTail(options) {
80
85
  const { profile, params, basePath = DEFAULT_BASE, following: wantFollow = false, maxRows = DEFAULT_MAX_ROWS, onEvent } = options;
81
- const [buffer, setBuffer] = (0, react.useState)(emptyLogTailBuffer);
82
- const [status, setStatus] = (0, react.useState)("idle");
83
- const [error, setError] = (0, react.useState)(null);
84
- const [session, setSession] = (0, react.useState)(null);
85
- const maxRowsRef = (0, react.useRef)(maxRows);
86
- maxRowsRef.current = maxRows;
87
- const onEventRef = (0, react.useRef)(onEvent);
88
- onEventRef.current = onEvent;
86
+ const [snapshot, setSnapshot] = (0, react.useState)(emptyLogTailSnapshot);
89
87
  const eventSourceFactory = require_event_source.useEventSourceFactory();
90
- const eventSourceFactoryRef = (0, react.useRef)(eventSourceFactory);
91
- eventSourceFactoryRef.current = eventSourceFactory;
88
+ const streamOptions = (0, react.useRef)({
89
+ maxRows,
90
+ onEvent,
91
+ eventSourceFactory
92
+ });
93
+ (0, react.useEffect)(() => {
94
+ streamOptions.current = {
95
+ maxRows,
96
+ onEvent,
97
+ eventSourceFactory
98
+ };
99
+ }, [
100
+ maxRows,
101
+ onEvent,
102
+ eventSourceFactory
103
+ ]);
92
104
  const paramsQuery = encodeTailParams(params);
105
+ const key = wantFollow ? JSON.stringify([
106
+ basePath,
107
+ profile,
108
+ paramsQuery
109
+ ]) : null;
110
+ const { request, buffer, error, session } = snapshot;
111
+ if (key !== (request?.key ?? null)) setSnapshot(key === null ? {
112
+ ...snapshot,
113
+ request: null
114
+ } : {
115
+ ...emptyLogTailSnapshot,
116
+ request: {
117
+ key,
118
+ basePath,
119
+ profile,
120
+ paramsQuery
121
+ },
122
+ status: "starting"
123
+ });
93
124
  (0, react.useEffect)(() => {
94
- if (!wantFollow) return;
95
- setBuffer(emptyLogTailBuffer);
96
- setError(null);
97
- setSession(null);
98
- if (!hasEventSource()) {
99
- setStatus("failed");
100
- setError({
101
- scope: "start",
102
- message: `cannot follow ${profile}: this browser has no EventSource, and session events are served only as SSE`
103
- });
104
- return;
105
- }
106
- setStatus("starting");
107
- let cancelled = false;
108
- const aborter = new AbortController();
109
- let source;
125
+ if (!request) return;
126
+ const update = (fields) => {
127
+ setSnapshot((current) => current.request === request ? {
128
+ ...current,
129
+ ...fields
130
+ } : current);
131
+ };
110
132
  let ended = false;
111
133
  let delivered = null;
112
134
  const deliver = (event) => {
113
135
  if (delivered !== null && event.sequence <= delivered) return;
114
136
  delivered = event.sequence;
115
137
  try {
116
- onEventRef.current?.(event);
138
+ streamOptions.current.onEvent?.(event);
117
139
  } catch (cause) {
118
- setError({
140
+ update({ error: {
119
141
  scope: "stream",
120
142
  message: `onEvent threw on sequence ${event.sequence}: ${String(cause)}`
121
- });
143
+ } });
122
144
  }
123
145
  };
124
146
  const apply = (event) => {
125
- if (event.error) setError({
147
+ const { maxRows: limit } = streamOptions.current;
148
+ if (event.error) update({ error: {
126
149
  scope: "stream",
127
150
  message: event.error
128
- });
151
+ } });
129
152
  deliver(event);
130
- setBuffer((prev) => appendTailEvent(prev, event, maxRowsRef.current));
153
+ setSnapshot((current) => {
154
+ if (current.request !== request) return current;
155
+ const next = appendTailEvent(current.buffer, event, limit);
156
+ return next === current.buffer ? current : {
157
+ ...current,
158
+ buffer: next
159
+ };
160
+ });
131
161
  };
132
162
  const readFrame = (label, e) => {
133
163
  try {
134
164
  return JSON.parse(e.data);
135
165
  } catch (cause) {
136
- setError({
166
+ update({ error: {
137
167
  scope: "stream",
138
168
  message: `unparseable ${label} frame: ${String(cause)}`
139
- });
169
+ } });
140
170
  return;
141
171
  }
142
172
  };
143
173
  const settle = (info) => {
144
- setSession(info);
145
- if (!isTerminalSessionState(info.state)) return;
146
- ended = true;
147
- setStatus(info.state);
148
- if (info.state === "failed") setError({
149
- scope: "session",
150
- message: info.error || `session ${info.id} failed without reporting a reason`
174
+ ended = isTerminalSessionState(info.state);
175
+ if (info.state === "failed") update({
176
+ session: info,
177
+ status: info.state,
178
+ error: {
179
+ scope: "session",
180
+ message: info.error || `session ${info.id} failed without reporting a reason`
181
+ }
151
182
  });
183
+ else update(ended ? {
184
+ session: info,
185
+ status: info.state
186
+ } : { session: info });
152
187
  };
153
- const subscribe = (id) => {
154
- const es = eventSourceFactoryRef.current(`${basePath}/sessions/${encodeURIComponent(id)}/events`);
155
- source = es;
156
- setStatus("streaming");
157
- es.addEventListener("event", (e) => {
158
- const frame = readFrame("event", e);
159
- if (frame) apply(frame);
160
- });
161
- es.addEventListener("done", (e) => {
162
- const info = readFrame("done", e);
163
- if (info) settle(info);
164
- es.close();
188
+ const subscribe = (info) => {
189
+ update({
190
+ session: info,
191
+ status: "streaming"
165
192
  });
166
- es.onerror = () => {
167
- if (!ended) setStatus("connection lost — retrying");
168
- };
169
- };
170
- const start = async () => {
171
- let info;
172
- try {
173
- const res = await fetch(`${basePath}/profile/${encodeURIComponent(profile)}/sessions?follow=true${paramsQuery}`, {
174
- method: "POST",
175
- headers: { Accept: "application/json" },
176
- signal: aborter.signal
177
- });
178
- if (cancelled) return;
179
- if (!res.ok) {
180
- const detail = (await res.text()).trim() || "no detail";
181
- setStatus("failed");
182
- setError({
183
- scope: "start",
184
- httpStatus: res.status,
185
- message: res.status === 409 ? `the server is already running as many follow sessions as it allows (HTTP 409): ${detail}` : `could not start a follow session for ${profile} (HTTP ${res.status}): ${detail}`
186
- });
187
- return;
193
+ return require_event_stream.subscribeJSON(streamOptions.current.eventSourceFactory, `${request.basePath}/sessions/${encodeURIComponent(info.id)}/events`, {
194
+ messageEvent: "event",
195
+ endEvent: "done",
196
+ onOpen: () => update({ status: "streaming" }),
197
+ onData: apply,
198
+ onInvalidMessage: (error) => update({ error: {
199
+ scope: "stream",
200
+ message: error.message
201
+ } }),
202
+ onEnd: (event) => {
203
+ const info = readFrame("done", event);
204
+ if (info) settle(info);
205
+ else update({ status: "failed" });
206
+ },
207
+ onError: (error, terminal) => {
208
+ if (ended) return;
209
+ update(terminal ? {
210
+ status: "failed",
211
+ error: {
212
+ scope: "stream",
213
+ message: error.message
214
+ }
215
+ } : { status: "connection lost — retrying" });
188
216
  }
189
- info = await res.json();
190
- } catch (cause) {
191
- if (cancelled) return;
192
- setStatus("failed");
193
- setError({
194
- scope: "start",
195
- message: `could not reach ${basePath} to start a follow session for ${profile}: ${String(cause)}`
196
- });
197
- return;
198
- }
199
- if (cancelled) return;
200
- setSession(info);
201
- subscribe(info.id);
202
- };
203
- start();
204
- return () => {
205
- cancelled = true;
206
- aborter.abort();
207
- source?.close();
217
+ });
208
218
  };
209
- }, [
210
- profile,
211
- paramsQuery,
212
- basePath,
213
- wantFollow
214
- ]);
215
- (0, react.useEffect)(() => {
216
- if (!wantFollow) setStatus((prev) => isTerminalTailStatus(prev) ? prev : "idle");
217
- }, [wantFollow]);
219
+ return require_log_tail_session.openLogTailSession({
220
+ basePath: request.basePath,
221
+ profile: request.profile,
222
+ paramsQuery: request.paramsQuery,
223
+ onStart: subscribe,
224
+ onError: (error) => update({
225
+ status: "failed",
226
+ error
227
+ })
228
+ });
229
+ }, [request]);
230
+ const status = request === null && !isTerminalTailStatus(snapshot.status) ? "idle" : snapshot.status;
218
231
  return {
219
232
  rows: buffer.rows,
220
233
  clickyRows: buffer.clickyRows,
@@ -1 +1 @@
1
- {"version":3,"file":"use-log-tail.cjs","names":["isSessionTerminal","isSessionState","useState","useRef","useEventSourceFactory"],"sources":["../../src/hooks/use-log-tail.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { ClickyRow } from \"../data/Clicky\";\nimport { isSessionState, isSessionTerminal, type SessionState } from \"../rpc/sessionTypes\";\nimport { useEventSourceFactory, type EventSourceLike } from \"./event-source\";\n\n// use-log-tail is the clicky-ui client for a *follow* session: the server opens\n// a live source for a query profile and streams rows out of it until someone\n// closes it. The resource underneath is unforgiving. A follow session holds a\n// websocket to Loki, or a log stream to a kubelet, for as long as it exists,\n// and the server caps how many may run at once (ErrMaxSessions, surfaced as\n// HTTP 409). The server owns that slot's release: a view session ends shortly\n// after its last subscriber disconnects, so every exit path — unmount and a\n// parameter change included — only has to abort the start request and close\n// the EventSource.\n//\n// Events travel over SSE only. The events route serves SSE (or ndjson on\n// request) and resumes through Last-Event-ID; there is no JSON-array polling\n// shape to fall back to, so a browser without EventSource fails loudly.\n//\n// Each SSE frame carries an `id:`, so a reconnecting EventSource sends\n// Last-Event-ID and the server resumes from that sequence — re-delivering\n// frames the client may already hold. Sequences are the server's, not a client\n// index: they do not start at 1 and they do not reset, so the accumulator\n// dedupes against the highest sequence it has applied rather than against a\n// position in an array.\n\n/** The sessions API's state, under the name this hook has always exported. */\nexport type LogSessionState = SessionState;\n\n/** SessionInfo as returned by POST /profile/{name}/sessions and the `done` frame. */\nexport interface LogSessionInfo {\n id: string;\n profile: string;\n kind: string;\n state: LogSessionState;\n params?: Record<string, unknown>;\n error?: string;\n eventCount: number;\n startedAt: string;\n stoppedAt?: string;\n}\n\n/**\n * One `event:` frame. It carries either a single `row` or a batch under `rows`\n * — never both — plus an `error` when the source failed mid-stream without the\n * session itself ending.\n *\n * `clickyRow` is the presented row — `{cells, detail?}`, built by the exact\n * function that fills in `node.rows[n]` of the list's own\n * `application/json+clicky` document — riding next to the raw `row` on a\n * trace/follow session's per-row events. A plain log tail (or a top-session\n * snapshot event) never sets it; only a reader that reconciles rows against a\n * presented table, i.e. OperationCatalog's follow mode, depends on it.\n */\nexport interface LogTailEvent {\n sessionId: string;\n sequence: number;\n time?: string;\n row?: Record<string, unknown>;\n rows?: Record<string, unknown>[];\n /** The presented ClickyRow for `row`, when the profile sends one. */\n clickyRow?: ClickyRow;\n error?: string;\n}\n\n/**\n * Where a failure came from, because the three are not interchangeable to a\n * reader: `start` means the session never existed (409 is the cap), `stream`\n * means the session is alive but something in it went wrong, and `session`\n * means the server ended it.\n */\nexport interface LogTailError {\n scope: \"start\" | \"stream\" | \"session\";\n message: string;\n /** HTTP status when a request produced the failure. 409 is the session cap. */\n httpStatus?: number;\n}\n\n/** Renderable transport/session state. The terminal values are the server's own. */\nexport type LogTailStatus =\n | \"idle\"\n | \"starting\"\n | \"streaming\"\n | \"connection lost — retrying\"\n | \"completed\"\n | \"failed\"\n | \"stopped\"\n | \"interrupted\";\n\n/**\n * `stopping` is a stop in flight: the source may still flush rows, so the tail\n * keeps reading until the done frame.\n */\nexport function isTerminalSessionState(state: LogSessionState | undefined): boolean {\n return state !== undefined && isSessionTerminal(state);\n}\n\nfunction isTerminalTailStatus(status: LogTailStatus): boolean {\n return isSessionState(status) && isSessionTerminal(status);\n}\n\nexport interface LogTailBuffer {\n /** Rows in arrival order, oldest first — the order this surface tails in. */\n rows: Record<string, unknown>[];\n /**\n * Each entry's presented ClickyRow, index-aligned with `rows` (same length,\n * same order) — `undefined` where the event carried none. Additive: a plain\n * log tail never reads this and `rows` itself is unchanged, so existing\n * `useLogTail` consumers keep working exactly as before.\n */\n clickyRows: (ClickyRow | undefined)[];\n /** Highest sequence applied, or null before the first frame. Never assumed to start at 1. */\n lastSequence: number | null;\n /** Rows evicted by the cap. Kept so the UI can say so instead of quietly shortening history. */\n dropped: number;\n}\n\nexport const emptyLogTailBuffer: LogTailBuffer = {\n rows: [],\n clickyRows: [],\n lastSequence: null,\n dropped: 0,\n};\n\n/**\n * Renders profile parameters as the tail of a session request's query string,\n * `\"\"` when there are none, and each entry already `&`-prefixed so it appends\n * to a query that always begins with `?follow=true`.\n *\n * Keys are sorted so two callers passing the same parameters in a different\n * order produce the same string — the effect that opens the session depends on\n * it, and an unstable spelling would tear down a live tail and start a new one\n * on a render that changed nothing.\n *\n * A null or undefined value is omitted rather than sent as the text \"null\": the\n * server reads every query key as a supplied parameter, so spelling an absent\n * one out states a filter the caller did not ask for.\n */\nexport function encodeTailParams(params: Record<string, unknown> | undefined): string {\n if (!params) return \"\";\n const query = new URLSearchParams();\n for (const key of Object.keys(params).sort()) {\n const value = params[key];\n if (value === undefined || value === null) continue;\n query.append(key, String(value));\n }\n const encoded = query.toString();\n return encoded === \"\" ? \"\" : `&${encoded}`;\n}\n\n/**\n * Applies one frame to the buffer, dropping anything at or below the highest\n * sequence already seen. A watermark is enough — and cheaper than remembering\n * every id — because SSE is ordered within a connection and the only source of\n * duplicates is a reconnect, whose replay starts at Last-Event-ID and so can\n * only re-deliver frames the buffer has already passed.\n *\n * Returns the buffer unchanged when the frame adds nothing, so React can bail\n * out of the render.\n */\nexport function appendTailEvent(\n buffer: LogTailBuffer,\n event: LogTailEvent,\n maxRows: number,\n): LogTailBuffer {\n if (buffer.lastSequence !== null && event.sequence <= buffer.lastSequence) return buffer;\n const incoming = event.rows ?? (event.row ? [event.row] : []);\n if (incoming.length === 0) return { ...buffer, lastSequence: event.sequence };\n\n // A batched `rows` frame has no per-item clickyRow equivalent — only the\n // single-`row` shape trace/follow sessions use ever carries one — so a\n // batch pads with `undefined` to stay index-aligned with `rows`.\n const incomingClickyRows: (ClickyRow | undefined)[] = event.rows\n ? event.rows.map(() => undefined)\n : [event.clickyRow];\n\n const merged = buffer.rows.concat(incoming);\n const mergedClickyRows = buffer.clickyRows.concat(incomingClickyRows);\n const overflow = Math.max(0, merged.length - Math.max(1, maxRows));\n return {\n rows: overflow > 0 ? merged.slice(overflow) : merged,\n clickyRows: overflow > 0 ? mergedClickyRows.slice(overflow) : mergedClickyRows,\n lastSequence: event.sequence,\n dropped: buffer.dropped + overflow,\n };\n}\n\nexport interface UseLogTailOptions {\n /** Query profile to follow, e.g. \"k8s-pod-logs\". */\n profile: string;\n /** Profile parameters, sent as the session request's query string. */\n params?: Record<string, unknown> | undefined;\n /** Base path of the session API, e.g. \"/api/v1\". */\n basePath?: string | undefined;\n /** Start/stop is the caller's: flipping this to false closes the stream; the server reaps the unsubscribed session. */\n following?: boolean | undefined;\n /** Rows kept in memory; older ones are evicted and counted in `droppedRows`. */\n maxRows?: number | undefined;\n /**\n * Called once per applied `event` frame, in sequence order, before the frame\n * reaches the buffer — so a reducer sees every row even after `maxRows` starts\n * evicting. A replayed sequence is not delivered again, and `done` frames are\n * never delivered. The latest callback is always used; changing its identity\n * does not restart the session. A throw is reported as a `stream` error.\n */\n onEvent?: ((event: LogTailEvent) => void) | undefined;\n}\n\nexport interface UseLogTailResult {\n /** Accumulated rows, oldest first. */\n rows: Record<string, unknown>[];\n /** Each row's presented ClickyRow, index-aligned with `rows`; `undefined`\n * where the event carried none (a plain log tail, or a top-session\n * snapshot event). */\n clickyRows: (ClickyRow | undefined)[];\n status: LogTailStatus;\n error: LogTailError | null;\n sessionId: string | null;\n /** True while the caller wants rows and the session has not reached a terminal state. */\n following: boolean;\n /** Rows the cap evicted; non-zero means the tail no longer holds the whole run. */\n droppedRows: number;\n /** Highest sequence applied — the resume point a reconnect would ask for. */\n lastSequence: number | null;\n /** Latest SessionInfo the server sent, for eventCount / startedAt / state. */\n session: LogSessionInfo | null;\n}\n\nconst DEFAULT_BASE = \"/api/v1\";\nconst DEFAULT_MAX_ROWS = 5_000;\n\nfunction hasEventSource(): boolean {\n return typeof globalThis !== \"undefined\" && typeof globalThis.EventSource !== \"undefined\";\n}\n\nexport function useLogTail(options: UseLogTailOptions): UseLogTailResult {\n const {\n profile,\n params,\n basePath = DEFAULT_BASE,\n following: wantFollow = false,\n maxRows = DEFAULT_MAX_ROWS,\n onEvent,\n } = options;\n\n const [buffer, setBuffer] = useState<LogTailBuffer>(emptyLogTailBuffer);\n const [status, setStatus] = useState<LogTailStatus>(\"idle\");\n const [error, setError] = useState<LogTailError | null>(null);\n const [session, setSession] = useState<LogSessionInfo | null>(null);\n\n // The cap is read when a frame lands rather than closed over, so changing how\n // much history to keep never tears down a live session to do it.\n const maxRowsRef = useRef(maxRows);\n maxRowsRef.current = maxRows;\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n\n const eventSourceFactory = useEventSourceFactory();\n const eventSourceFactoryRef = useRef(eventSourceFactory);\n eventSourceFactoryRef.current = eventSourceFactory;\n\n // Profile parameters travel in the query string because that is where the\n // session endpoint reads them from: it builds its params by walking\n // r.URL.Query() and never looks at the body, so a posted body is a filter the\n // server silently ignores — the tail would run the profile's defaults while\n // the reader believed they were following what they had filtered to.\n //\n // Serialized here rather than in the effect so it is also the effect's\n // dependency: two renders with equal parameters must not restart the session.\n const paramsQuery = encodeTailParams(params);\n\n useEffect(() => {\n if (!wantFollow) return;\n\n // Each start is a distinct server session replaying from its own first\n // sequence, so the previous run's rows cannot be continued — carrying them\n // over would interleave two unrelated sequence spaces in one list.\n setBuffer(emptyLogTailBuffer);\n setError(null);\n setSession(null);\n\n // Checked before the session exists: a session nobody can subscribe to\n // would hold a server slot until the reaper noticed.\n if (!hasEventSource()) {\n setStatus(\"failed\");\n setError({\n scope: \"start\",\n message: `cannot follow ${profile}: this browser has no EventSource, and session events are served only as SSE`,\n });\n return;\n }\n setStatus(\"starting\");\n\n let cancelled = false;\n const aborter = new AbortController();\n let source: EventSourceLike | undefined;\n let ended = false;\n // onEvent's own watermark, tracked here rather than read from the buffer:\n // the buffer only dedupes inside a state updater, which React may run twice,\n // so a callback there would double-count. Same rule as appendTailEvent.\n let delivered: number | null = null;\n\n const deliver = (event: LogTailEvent) => {\n if (delivered !== null && event.sequence <= delivered) return;\n delivered = event.sequence;\n try {\n onEventRef.current?.(event);\n } catch (cause) {\n setError({ scope: \"stream\", message: `onEvent threw on sequence ${event.sequence}: ${String(cause)}` });\n }\n };\n\n const apply = (event: LogTailEvent) => {\n // An event-level error does not end the session, so it is reported beside\n // the rows rather than in place of them. Set before delivery so a reducer\n // that throws on the same frame is the error left standing.\n if (event.error) setError({ scope: \"stream\", message: event.error });\n deliver(event);\n setBuffer((prev) => appendTailEvent(prev, event, maxRowsRef.current));\n };\n\n // Unlike the task stream this does not skip what it cannot parse: a tail\n // that silently discards frames is indistinguishable from a quiet log\n // source, which is the one thing a reader must never be left guessing at.\n const readFrame = (label: string, e: MessageEvent): unknown => {\n try {\n return JSON.parse(e.data as string);\n } catch (cause) {\n setError({ scope: \"stream\", message: `unparseable ${label} frame: ${String(cause)}` });\n return undefined;\n }\n };\n\n const settle = (info: LogSessionInfo) => {\n setSession(info);\n if (!isTerminalSessionState(info.state)) return;\n ended = true;\n setStatus(info.state as LogTailStatus);\n if (info.state === \"failed\") {\n setError({\n scope: \"session\",\n message: info.error || `session ${info.id} failed without reporting a reason`,\n });\n }\n };\n\n const subscribe = (id: string) => {\n const es = eventSourceFactoryRef.current(`${basePath}/sessions/${encodeURIComponent(id)}/events`);\n source = es;\n setStatus(\"streaming\");\n es.addEventListener(\"event\", (e) => {\n const frame = readFrame(\"event\", e as MessageEvent);\n if (frame) apply(frame as LogTailEvent);\n });\n es.addEventListener(\"done\", (e) => {\n const info = readFrame(\"done\", e as MessageEvent);\n if (info) settle(info as LogSessionInfo);\n es.close();\n });\n // A dropped connection is not a failure: EventSource reconnects with\n // Last-Event-ID and the server replays. It is reported through `status`\n // only, so a blip never leaves a sticky error the reader has to dismiss —\n // and never after the session ended, where it would overwrite the reason\n // it ended with a reconnect that is not going to happen.\n es.onerror = () => {\n if (!ended) setStatus(\"connection lost — retrying\");\n };\n };\n\n const start = async () => {\n let info: LogSessionInfo;\n try {\n const res = await fetch(\n `${basePath}/profile/${encodeURIComponent(profile)}/sessions?follow=true${paramsQuery}`,\n { method: \"POST\", headers: { Accept: \"application/json\" }, signal: aborter.signal },\n );\n if (cancelled) return;\n if (!res.ok) {\n const detail = (await res.text()).trim() || \"no detail\";\n setStatus(\"failed\");\n setError({\n scope: \"start\",\n httpStatus: res.status,\n message:\n res.status === 409\n ? `the server is already running as many follow sessions as it allows (HTTP 409): ${detail}`\n : `could not start a follow session for ${profile} (HTTP ${res.status}): ${detail}`,\n });\n return;\n }\n info = (await res.json()) as LogSessionInfo;\n } catch (cause) {\n // Our own abort on unmount or a parameter change: nothing is left to report to.\n if (cancelled) return;\n setStatus(\"failed\");\n setError({\n scope: \"start\",\n message: `could not reach ${basePath} to start a follow session for ${profile}: ${String(cause)}`,\n });\n return;\n }\n\n // The caller stopped following while the POST was in flight. If the\n // session was created, nothing ever subscribes, so the server ends it.\n if (cancelled) return;\n setSession(info);\n subscribe(info.id);\n };\n\n void start();\n // Aborting the start and closing the stream is the whole release: a view\n // session without a subscriber ends server-side.\n return () => {\n cancelled = true;\n aborter.abort();\n source?.close();\n };\n }, [profile, paramsQuery, basePath, wantFollow]);\n\n // Stopping returns the surface to idle, but a session that ended on its own\n // keeps its terminal status so the reason it ended stays on screen.\n useEffect(() => {\n if (!wantFollow) setStatus((prev) => (isTerminalTailStatus(prev) ? prev : \"idle\"));\n }, [wantFollow]);\n\n return {\n rows: buffer.rows,\n clickyRows: buffer.clickyRows,\n status,\n error,\n sessionId: session?.id ?? null,\n following: wantFollow && !isTerminalTailStatus(status),\n droppedRows: buffer.dropped,\n lastSequence: buffer.lastSequence,\n session,\n };\n}\n"],"mappings":";;;;;;;;AA6FA,SAAgB,uBAAuB,OAA6C;CAClF,OAAO,UAAU,KAAA,KAAaA,qBAAAA,kBAAkB,KAAK;AACvD;AAEA,SAAS,qBAAqB,QAAgC;CAC5D,OAAOC,qBAAAA,eAAe,MAAM,KAAKD,qBAAAA,kBAAkB,MAAM;AAC3D;AAkBA,IAAa,qBAAoC;CAC/C,MAAM,CAAC;CACP,YAAY,CAAC;CACb,cAAc;CACd,SAAS;AACX;;;;;;;;;;;;;;;AAgBA,SAAgB,iBAAiB,QAAqD;CACpF,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,QAAQ,IAAI,gBAAgB;CAClC,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,GAAG;EAC5C,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM;EAC3C,MAAM,OAAO,KAAK,OAAO,KAAK,CAAC;CACjC;CACA,MAAM,UAAU,MAAM,SAAS;CAC/B,OAAO,YAAY,KAAK,KAAK,IAAI;AACnC;;;;;;;;;;;AAYA,SAAgB,gBACd,QACA,OACA,SACe;CACf,IAAI,OAAO,iBAAiB,QAAQ,MAAM,YAAY,OAAO,cAAc,OAAO;CAClF,MAAM,WAAW,MAAM,SAAS,MAAM,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;CAC3D,IAAI,SAAS,WAAW,GAAG,OAAO;EAAE,GAAG;EAAQ,cAAc,MAAM;CAAS;CAK5E,MAAM,qBAAgD,MAAM,OACxD,MAAM,KAAK,UAAU,KAAA,CAAS,IAC9B,CAAC,MAAM,SAAS;CAEpB,MAAM,SAAS,OAAO,KAAK,OAAO,QAAQ;CAC1C,MAAM,mBAAmB,OAAO,WAAW,OAAO,kBAAkB;CACpE,MAAM,WAAW,KAAK,IAA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AAW,SAAS,MAAM;EAC1B,WAAW,cAAc,CAAC,qBAAqB,MAAM;EACrD,aAAa,OAAO;EACpB,cAAc,OAAO;EACrB;CACF;AACF"}
1
+ {"version":3,"file":"use-log-tail.cjs","names":["isSessionTerminal","isSessionState","appendTailRows","useState","useEventSourceFactory","useRef","subscribeJSON","openLogTailSession"],"sources":["../../src/hooks/use-log-tail.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { ClickyRow } from \"../data/Clicky\";\nimport { isSessionState, isSessionTerminal, type SessionState } from \"../rpc/sessionTypes\";\nimport { useEventSourceFactory } from \"./event-source\";\nimport { subscribeJSON } from \"./event-stream\";\nimport { openLogTailSession, type LogSessionInfo, type LogTailError } from \"./log-tail-session\";\nimport { appendTailRows } from \"./tail-buffer\";\n\nexport type { LogSessionInfo, LogTailError } from \"./log-tail-session\";\n\n// use-log-tail is the clicky-ui client for a *follow* session: the server opens\n// a live source for a query profile and streams rows out of it until someone\n// closes it. The resource underneath is unforgiving. A follow session holds a\n// websocket to Loki, or a log stream to a kubelet, for as long as it exists,\n// and the server caps how many may run at once (ErrMaxSessions, surfaced as\n// HTTP 409). The server owns that slot's release: a view session ends shortly\n// after its last subscriber disconnects, so every exit path — unmount and a\n// parameter change included — only has to abort the start request and close\n// the EventSource.\n//\n// Events travel over SSE only. The events route serves SSE (or ndjson on\n// request) and resumes through Last-Event-ID; there is no JSON-array polling\n// shape to fall back to, so a browser without EventSource fails loudly.\n//\n// Each SSE frame carries an `id:`, so a reconnecting EventSource sends\n// Last-Event-ID and the server resumes from that sequence — re-delivering\n// frames the client may already hold. Sequences are the server's, not a client\n// index: they do not start at 1 and they do not reset, so the accumulator\n// dedupes against the highest sequence it has applied rather than against a\n// position in an array.\n\n/** The sessions API's state, under the name this hook has always exported. */\nexport type LogSessionState = SessionState;\n\n/**\n * One `event:` frame. It carries either a single `row` or a batch under `rows`\n * — never both — plus an `error` when the source failed mid-stream without the\n * session itself ending.\n *\n * `clickyRow` is the presented row — `{cells, detail?}`, built by the exact\n * function that fills in `node.rows[n]` of the list's own\n * `application/json+clicky` document — riding next to the raw `row` on a\n * trace/follow session's per-row events. A plain log tail (or a top-session\n * snapshot event) never sets it; only a reader that reconciles rows against a\n * presented table, i.e. OperationCatalog's follow mode, depends on it.\n */\nexport interface LogTailEvent {\n sessionId: string;\n sequence: number;\n time?: string;\n row?: Record<string, unknown>;\n rows?: Record<string, unknown>[];\n /** The presented ClickyRow for `row`, when the profile sends one. */\n clickyRow?: ClickyRow;\n error?: string;\n}\n\n/** Renderable transport/session state. The terminal values are the server's own. */\nexport type LogTailStatus =\n | \"idle\"\n | \"starting\"\n | \"streaming\"\n | \"connection lost — retrying\"\n | \"completed\"\n | \"failed\"\n | \"stopped\"\n | \"interrupted\";\n\n/**\n * `stopping` is a stop in flight: the source may still flush rows, so the tail\n * keeps reading until the done frame.\n */\nexport function isTerminalSessionState(state: LogSessionState | undefined): boolean {\n return state !== undefined && isSessionTerminal(state);\n}\n\nfunction isTerminalTailStatus(status: LogTailStatus): boolean {\n return isSessionState(status) && isSessionTerminal(status);\n}\n\nexport interface LogTailBuffer {\n /** Rows in arrival order, oldest first — the order this surface tails in. */\n rows: Record<string, unknown>[];\n /**\n * Each entry's presented ClickyRow, index-aligned with `rows` (same length,\n * same order) — `undefined` where the event carried none. Additive: a plain\n * log tail never reads this and `rows` itself is unchanged, so existing\n * `useLogTail` consumers keep working exactly as before.\n */\n clickyRows: (ClickyRow | undefined)[];\n /** Highest sequence applied, or null before the first frame. Never assumed to start at 1. */\n lastSequence: number | null;\n /** Rows evicted by the cap. Kept so the UI can say so instead of quietly shortening history. */\n dropped: number;\n}\n\nexport const emptyLogTailBuffer: LogTailBuffer = {\n rows: [],\n clickyRows: [],\n lastSequence: null,\n dropped: 0,\n};\n\n/**\n * Renders profile parameters as the tail of a session request's query string,\n * `\"\"` when there are none, and each entry already `&`-prefixed so it appends\n * to a query that always begins with `?follow=true`.\n *\n * Keys are sorted so two callers passing the same parameters in a different\n * order produce the same string — the effect that opens the session depends on\n * it, and an unstable spelling would tear down a live tail and start a new one\n * on a render that changed nothing.\n *\n * A null or undefined value is omitted rather than sent as the text \"null\": the\n * server reads every query key as a supplied parameter, so spelling an absent\n * one out states a filter the caller did not ask for.\n */\nexport function encodeTailParams(params: Record<string, unknown> | undefined): string {\n if (!params) return \"\";\n const query = new URLSearchParams();\n for (const key of Object.keys(params).sort()) {\n const value = params[key];\n if (value === undefined || value === null) continue;\n query.append(key, String(value));\n }\n const encoded = query.toString();\n return encoded === \"\" ? \"\" : `&${encoded}`;\n}\n\n/**\n * Applies one frame to the buffer, dropping anything at or below the highest\n * sequence already seen. A watermark is enough — and cheaper than remembering\n * every id — because SSE is ordered within a connection and the only source of\n * duplicates is a reconnect, whose replay starts at Last-Event-ID and so can\n * only re-deliver frames the buffer has already passed.\n *\n * Returns the buffer unchanged when the frame adds nothing, so React can bail\n * out of the render.\n */\nexport function appendTailEvent(\n buffer: LogTailBuffer,\n event: LogTailEvent,\n maxRows: number,\n): LogTailBuffer {\n if (buffer.lastSequence !== null && event.sequence <= buffer.lastSequence) return buffer;\n const incoming = event.rows ?? (event.row ? [event.row] : []);\n if (incoming.length === 0) return { ...buffer, lastSequence: event.sequence };\n\n // A batched `rows` frame has no per-item clickyRow equivalent — only the\n // single-`row` shape trace/follow sessions use ever carries one — so a\n // batch pads with `undefined` to stay index-aligned with `rows`.\n const incomingClickyRows: (ClickyRow | undefined)[] = event.rows\n ? event.rows.map(() => undefined)\n : [event.clickyRow];\n\n const { rows, dropped } = appendTailRows(buffer.rows, incoming, { limit: maxRows });\n return {\n rows,\n clickyRows: buffer.clickyRows.concat(incomingClickyRows).slice(dropped),\n lastSequence: event.sequence,\n dropped: buffer.dropped + dropped,\n };\n}\n\nexport interface UseLogTailOptions {\n /** Query profile to follow, e.g. \"k8s-pod-logs\". */\n profile: string;\n /** Profile parameters, sent as the session request's query string. */\n params?: Record<string, unknown> | undefined;\n /** Base path of the session API, e.g. \"/api/v1\". */\n basePath?: string | undefined;\n /** Start/stop is the caller's: flipping this to false closes the stream; the server reaps the unsubscribed session. */\n following?: boolean | undefined;\n /** Rows kept in memory; older ones are evicted and counted in `droppedRows`. */\n maxRows?: number | undefined;\n /**\n * Called once per applied `event` frame, in sequence order, before the frame\n * reaches the buffer — so a reducer sees every row even after `maxRows` starts\n * evicting. A replayed sequence is not delivered again, and `done` frames are\n * never delivered. The latest callback is always used; changing its identity\n * does not restart the session. A throw is reported as a `stream` error.\n */\n onEvent?: ((event: LogTailEvent) => void) | undefined;\n}\n\nexport interface UseLogTailResult {\n /** Accumulated rows, oldest first. */\n rows: Record<string, unknown>[];\n /** Each row's presented ClickyRow, index-aligned with `rows`; `undefined`\n * where the event carried none (a plain log tail, or a top-session\n * snapshot event). */\n clickyRows: (ClickyRow | undefined)[];\n status: LogTailStatus;\n error: LogTailError | null;\n sessionId: string | null;\n /** True while the caller wants rows and the session has not reached a terminal state. */\n following: boolean;\n /** Rows the cap evicted; non-zero means the tail no longer holds the whole run. */\n droppedRows: number;\n /** Highest sequence applied — the resume point a reconnect would ask for. */\n lastSequence: number | null;\n /** Latest SessionInfo the server sent, for eventCount / startedAt / state. */\n session: LogSessionInfo | null;\n}\n\nconst DEFAULT_BASE = \"/api/v1\";\nconst DEFAULT_MAX_ROWS = 5_000;\n\ninterface LogTailSnapshot {\n request: { key: string; basePath: string; profile: string; paramsQuery: string } | null;\n buffer: LogTailBuffer;\n status: LogTailStatus;\n error: LogTailError | null;\n session: LogSessionInfo | null;\n}\n\nconst emptyLogTailSnapshot: LogTailSnapshot = {\n request: null,\n buffer: emptyLogTailBuffer,\n status: \"idle\",\n error: null,\n session: null,\n};\n\nexport function useLogTail(options: UseLogTailOptions): UseLogTailResult {\n const {\n profile,\n params,\n basePath = DEFAULT_BASE,\n following: wantFollow = false,\n maxRows = DEFAULT_MAX_ROWS,\n onEvent,\n } = options;\n\n const [snapshot, setSnapshot] = useState(emptyLogTailSnapshot);\n\n const eventSourceFactory = useEventSourceFactory();\n const streamOptions = useRef({ maxRows, onEvent, eventSourceFactory });\n useEffect(() => {\n streamOptions.current = { maxRows, onEvent, eventSourceFactory };\n }, [maxRows, onEvent, eventSourceFactory]);\n\n // Profile parameters travel in the query string because that is where the\n // session endpoint reads them from: it builds its params by walking\n // r.URL.Query() and never looks at the body, so a posted body is a filter the\n // server silently ignores — the tail would run the profile's defaults while\n // the reader believed they were following what they had filtered to.\n //\n // Serialized here rather than in the effect so it is also the effect's\n // dependency: two renders with equal parameters must not restart the session.\n const paramsQuery = encodeTailParams(params);\n const key = wantFollow ? JSON.stringify([basePath, profile, paramsQuery]) : null;\n const { request, buffer, error, session } = snapshot;\n if (key !== (request?.key ?? null)) {\n setSnapshot(key === null ? { ...snapshot, request: null } : {\n ...emptyLogTailSnapshot,\n request: { key, basePath, profile, paramsQuery },\n status: \"starting\",\n });\n }\n\n useEffect(() => {\n if (!request) return;\n const update = (fields: Partial<Omit<LogTailSnapshot, \"request\">>) => {\n setSnapshot(current => current.request === request ? { ...current, ...fields } : current);\n };\n\n let ended = false;\n // onEvent's own watermark, tracked here rather than read from the buffer:\n // the buffer only dedupes inside a state updater, which React may run twice,\n // so a callback there would double-count. Same rule as appendTailEvent.\n let delivered: number | null = null;\n\n const deliver = (event: LogTailEvent) => {\n if (delivered !== null && event.sequence <= delivered) return;\n delivered = event.sequence;\n try {\n streamOptions.current.onEvent?.(event);\n } catch (cause) {\n update({ error: { scope: \"stream\", message: `onEvent threw on sequence ${event.sequence}: ${String(cause)}` } });\n }\n };\n\n const apply = (event: LogTailEvent) => {\n const { maxRows: limit } = streamOptions.current;\n // An event-level error does not end the session, so it is reported beside\n // the rows rather than in place of them. Set before delivery so a reducer\n // that throws on the same frame is the error left standing.\n if (event.error) update({ error: { scope: \"stream\", message: event.error } });\n deliver(event);\n setSnapshot(current => {\n if (current.request !== request) return current;\n const next = appendTailEvent(current.buffer, event, limit);\n return next === current.buffer ? current : { ...current, buffer: next };\n });\n };\n\n // Unlike the task stream this does not skip what it cannot parse: a tail\n // that silently discards frames is indistinguishable from a quiet log\n // source, which is the one thing a reader must never be left guessing at.\n const readFrame = (label: string, e: MessageEvent): unknown => {\n try {\n return JSON.parse(e.data as string);\n } catch (cause) {\n update({ error: { scope: \"stream\", message: `unparseable ${label} frame: ${String(cause)}` } });\n return undefined;\n }\n };\n\n const settle = (info: LogSessionInfo) => {\n ended = isTerminalSessionState(info.state);\n if (info.state === \"failed\") {\n update({\n session: info,\n status: info.state,\n error: { scope: \"session\", message: info.error || `session ${info.id} failed without reporting a reason` },\n });\n } else {\n update(ended ? { session: info, status: info.state as LogTailStatus } : { session: info });\n }\n };\n\n const subscribe = (info: LogSessionInfo) => {\n update({ session: info, status: \"streaming\" });\n return subscribeJSON<LogTailEvent>(streamOptions.current.eventSourceFactory, `${request.basePath}/sessions/${encodeURIComponent(info.id)}/events`, {\n messageEvent: \"event\",\n endEvent: \"done\",\n onOpen: () => update({ status: \"streaming\" }),\n onData: apply,\n onInvalidMessage: error => update({ error: { scope: \"stream\", message: error.message } }),\n onEnd: event => {\n const info = readFrame(\"done\", event as MessageEvent);\n if (info) settle(info as LogSessionInfo);\n else update({ status: \"failed\" });\n },\n onError: (error, terminal) => {\n if (ended) return;\n update(terminal ? { status: \"failed\", error: { scope: \"stream\", message: error.message } } : { status: \"connection lost — retrying\" });\n },\n });\n };\n\n return openLogTailSession({\n basePath: request.basePath,\n profile: request.profile,\n paramsQuery: request.paramsQuery,\n onStart: subscribe,\n onError: error => update({ status: \"failed\", error }),\n });\n }, [request]);\n\n // Stopping returns the surface to idle, but a session that ended on its own\n // keeps its terminal status so the reason it ended stays on screen.\n const status = request === null && !isTerminalTailStatus(snapshot.status) ? \"idle\" : snapshot.status;\n\n return {\n rows: buffer.rows,\n clickyRows: buffer.clickyRows,\n status,\n error,\n sessionId: session?.id ?? null,\n following: wantFollow && !isTerminalTailStatus(status),\n droppedRows: buffer.dropped,\n lastSequence: buffer.lastSequence,\n session,\n };\n}\n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C5C,QAAQ;IACR,mBAAkB,UAAS,OAAO,EAAE,OAAO;KAAE,OAAO;KAAU,SAAS,MAAM;IAAQ,EAAE,CAAC;IACxF,QAAO,UAAS;KACd,MAAM,OAAO,UAAU,QAAQ,KAAqB;KACpD,IAAI,MAAM,OAAO,IAAsB;UAClC,OAAO,EAAE,QAAQ,SAAS,CAAC;IAClC;IACA,UAAU,OAAO,aAAa;KAC5B,IAAI,OAAO;KACX,OAAO,WAAW;MAAE,QAAQ;MAAU,OAAO;OAAE,OAAO;OAAU,SAAS,MAAM;MAAQ;KAAE,IAAI,EAAE,QAAQ,6BAA6B,CAAC;IACvI;GACF,CAAC;EACH;EAEA,OAAOC,yBAAAA,mBAAmB;GACxB,UAAU,QAAQ;GAClB,SAAS,QAAQ;GACjB,aAAa,QAAQ;GACrB,SAAS;GACT,UAAS,UAAS,OAAO;IAAE,QAAQ;IAAU;GAAM,CAAC;EACtD,CAAC;CACH,GAAG,CAAC,OAAO,CAAC;CAIZ,MAAM,SAAS,YAAY,QAAQ,CAAC,qBAAqB,SAAS,MAAM,IAAI,SAAS,SAAS;CAE9F,OAAO;EACL,MAAM,OAAO;EACb,YAAY,OAAO;EACnB;EACA;EACA,WAAW,SAAS,MAAM;EAC1B,WAAW,cAAc,CAAC,qBAAqB,MAAM;EACrD,aAAa,OAAO;EACpB,cAAc,OAAO;EACrB;CACF;AACF"}
@@ -1,19 +1,9 @@
1
1
  import { ClickyRow } from '../data/Clicky.js';
2
2
  import { SessionState } from '../rpc/sessionTypes.js';
3
+ import { LogSessionInfo, LogTailError } from './log-tail-session.js';
4
+ export type { LogSessionInfo, LogTailError } from './log-tail-session.js';
3
5
  /** The sessions API's state, under the name this hook has always exported. */
4
6
  export type LogSessionState = SessionState;
5
- /** SessionInfo as returned by POST /profile/{name}/sessions and the `done` frame. */
6
- export interface LogSessionInfo {
7
- id: string;
8
- profile: string;
9
- kind: string;
10
- state: LogSessionState;
11
- params?: Record<string, unknown>;
12
- error?: string;
13
- eventCount: number;
14
- startedAt: string;
15
- stoppedAt?: string;
16
- }
17
7
  /**
18
8
  * One `event:` frame. It carries either a single `row` or a batch under `rows`
19
9
  * — never both — plus an `error` when the source failed mid-stream without the
@@ -36,18 +26,6 @@ export interface LogTailEvent {
36
26
  clickyRow?: ClickyRow;
37
27
  error?: string;
38
28
  }
39
- /**
40
- * Where a failure came from, because the three are not interchangeable to a
41
- * reader: `start` means the session never existed (409 is the cap), `stream`
42
- * means the session is alive but something in it went wrong, and `session`
43
- * means the server ended it.
44
- */
45
- export interface LogTailError {
46
- scope: "start" | "stream" | "session";
47
- message: string;
48
- /** HTTP status when a request produced the failure. 409 is the session cap. */
49
- httpStatus?: number;
50
- }
51
29
  /** Renderable transport/session state. The terminal values are the server's own. */
52
30
  export type LogTailStatus = "idle" | "starting" | "streaming" | "connection lost — retrying" | "completed" | "failed" | "stopped" | "interrupted";
53
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-log-tail.d.ts","sourceRoot":"","sources":["../../src/hooks/use-log-tail.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAqC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAwB3F,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YA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