@flanksource/clicky-ui 0.3.84 → 0.3.86

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 (219) hide show
  1. package/dist/components/Combobox.cjs +8 -6
  2. package/dist/components/Combobox.cjs.map +1 -1
  3. package/dist/components/Combobox.d.ts.map +1 -1
  4. package/dist/components/Combobox.js +8 -6
  5. package/dist/components/Combobox.js.map +1 -1
  6. package/dist/components/ComboboxMenu.cjs +7 -4
  7. package/dist/components/ComboboxMenu.cjs.map +1 -1
  8. package/dist/components/ComboboxMenu.d.ts +3 -2
  9. package/dist/components/ComboboxMenu.d.ts.map +1 -1
  10. package/dist/components/ComboboxMenu.js +7 -4
  11. package/dist/components/ComboboxMenu.js.map +1 -1
  12. package/dist/components/FilterBar.cjs +64 -47
  13. package/dist/components/FilterBar.cjs.map +1 -1
  14. package/dist/components/FilterBar.d.ts +20 -2
  15. package/dist/components/FilterBar.d.ts.map +1 -1
  16. package/dist/components/FilterBar.js +63 -46
  17. package/dist/components/FilterBar.js.map +1 -1
  18. package/dist/components/TimeRange.cjs +156 -128
  19. package/dist/components/TimeRange.cjs.map +1 -1
  20. package/dist/components/TimeRange.d.ts +8 -1
  21. package/dist/components/TimeRange.d.ts.map +1 -1
  22. package/dist/components/TimeRange.js +156 -128
  23. package/dist/components/TimeRange.js.map +1 -1
  24. package/dist/components/combobox-types.d.ts +5 -0
  25. package/dist/components/combobox-types.d.ts.map +1 -1
  26. package/dist/components/filter-bar-context.cjs.map +1 -1
  27. package/dist/components/filter-bar-context.d.ts +2 -0
  28. package/dist/components/filter-bar-context.d.ts.map +1 -1
  29. package/dist/components/filter-bar-context.js.map +1 -1
  30. package/dist/components/filter-bar-field-utils.cjs +18 -4
  31. package/dist/components/filter-bar-field-utils.cjs.map +1 -1
  32. package/dist/components/filter-bar-field-utils.d.ts +3 -2
  33. package/dist/components/filter-bar-field-utils.d.ts.map +1 -1
  34. package/dist/components/filter-bar-field-utils.js +19 -5
  35. package/dist/components/filter-bar-field-utils.js.map +1 -1
  36. package/dist/components/filter-bar-menu.cjs +189 -0
  37. package/dist/components/filter-bar-menu.cjs.map +1 -0
  38. package/dist/components/filter-bar-menu.d.ts +25 -0
  39. package/dist/components/filter-bar-menu.d.ts.map +1 -0
  40. package/dist/components/filter-bar-menu.js +189 -0
  41. package/dist/components/filter-bar-menu.js.map +1 -0
  42. package/dist/components/filter-bar-multi.cjs +1 -1
  43. package/dist/components/filter-bar-multi.cjs.map +1 -1
  44. package/dist/components/filter-bar-multi.js +2 -2
  45. package/dist/components/filter-bar-multi.js.map +1 -1
  46. package/dist/components/filter-bar-popup.cjs +37 -0
  47. package/dist/components/filter-bar-popup.cjs.map +1 -0
  48. package/dist/components/filter-bar-popup.d.ts +32 -0
  49. package/dist/components/filter-bar-popup.d.ts.map +1 -0
  50. package/dist/components/filter-bar-popup.js +37 -0
  51. package/dist/components/filter-bar-popup.js.map +1 -0
  52. package/dist/components/filter-bar-tree.cjs +1 -1
  53. package/dist/components/filter-bar-tree.cjs.map +1 -1
  54. package/dist/components/filter-bar-tree.js +2 -2
  55. package/dist/components/filter-bar-tree.js.map +1 -1
  56. package/dist/components/json-schema-form-table-array.cjs +5 -3
  57. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  58. package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
  59. package/dist/components/json-schema-form-table-array.js +5 -3
  60. package/dist/components/json-schema-form-table-array.js.map +1 -1
  61. package/dist/components.cjs +1 -1
  62. package/dist/components.js +1 -1
  63. package/dist/connections/ConnectionPicker.cjs +6 -2
  64. package/dist/connections/ConnectionPicker.cjs.map +1 -1
  65. package/dist/connections/ConnectionPicker.d.ts.map +1 -1
  66. package/dist/connections/ConnectionPicker.js +6 -2
  67. package/dist/connections/ConnectionPicker.js.map +1 -1
  68. package/dist/connections/CreateConnectionDialog.cjs +8 -21
  69. package/dist/connections/CreateConnectionDialog.cjs.map +1 -1
  70. package/dist/connections/CreateConnectionDialog.d.ts +2 -1
  71. package/dist/connections/CreateConnectionDialog.d.ts.map +1 -1
  72. package/dist/connections/CreateConnectionDialog.js +8 -21
  73. package/dist/connections/CreateConnectionDialog.js.map +1 -1
  74. package/dist/data/ExpandableMarkdown.cjs +59 -0
  75. package/dist/data/ExpandableMarkdown.cjs.map +1 -0
  76. package/dist/data/ExpandableMarkdown.d.ts +17 -0
  77. package/dist/data/ExpandableMarkdown.d.ts.map +1 -0
  78. package/dist/data/ExpandableMarkdown.js +59 -0
  79. package/dist/data/ExpandableMarkdown.js.map +1 -0
  80. package/dist/data/MultiGaugeBar.cjs +49 -21
  81. package/dist/data/MultiGaugeBar.cjs.map +1 -1
  82. package/dist/data/MultiGaugeBar.d.ts +5 -2
  83. package/dist/data/MultiGaugeBar.d.ts.map +1 -1
  84. package/dist/data/MultiGaugeBar.js +49 -21
  85. package/dist/data/MultiGaugeBar.js.map +1 -1
  86. package/dist/data/flow-node/BoxNode.cjs +45 -0
  87. package/dist/data/flow-node/BoxNode.cjs.map +1 -0
  88. package/dist/data/flow-node/BoxNode.d.ts +28 -0
  89. package/dist/data/flow-node/BoxNode.d.ts.map +1 -0
  90. package/dist/data/flow-node/BoxNode.js +45 -0
  91. package/dist/data/flow-node/BoxNode.js.map +1 -0
  92. package/dist/data/flow-node/FlowMetrics.cjs +208 -0
  93. package/dist/data/flow-node/FlowMetrics.cjs.map +1 -0
  94. package/dist/data/flow-node/FlowMetrics.d.ts +60 -0
  95. package/dist/data/flow-node/FlowMetrics.d.ts.map +1 -0
  96. package/dist/data/flow-node/FlowMetrics.js +206 -0
  97. package/dist/data/flow-node/FlowMetrics.js.map +1 -0
  98. package/dist/data/flow-node/WorkloadNode.cjs +63 -0
  99. package/dist/data/flow-node/WorkloadNode.cjs.map +1 -0
  100. package/dist/data/flow-node/WorkloadNode.d.ts +42 -0
  101. package/dist/data/flow-node/WorkloadNode.d.ts.map +1 -0
  102. package/dist/data/flow-node/WorkloadNode.js +63 -0
  103. package/dist/data/flow-node/WorkloadNode.js.map +1 -0
  104. package/dist/data/flow-node/index.d.ts +5 -0
  105. package/dist/data/flow-node/index.d.ts.map +1 -0
  106. package/dist/data/flow-node/latency.cjs +37 -0
  107. package/dist/data/flow-node/latency.cjs.map +1 -0
  108. package/dist/data/flow-node/latency.d.ts +13 -0
  109. package/dist/data/flow-node/latency.d.ts.map +1 -0
  110. package/dist/data/flow-node/latency.js +35 -0
  111. package/dist/data/flow-node/latency.js.map +1 -0
  112. package/dist/data/traces/index.d.ts +1 -0
  113. package/dist/data/traces/index.d.ts.map +1 -1
  114. package/dist/data/traces/otel/OtelTraceDetail.cjs +4 -7
  115. package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
  116. package/dist/data/traces/otel/OtelTraceDetail.js +4 -7
  117. package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
  118. package/dist/data/traces/otel/OtelTraceSearch.cjs +90 -56
  119. package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
  120. package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
  121. package/dist/data/traces/otel/OtelTraceSearch.js +91 -57
  122. package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
  123. package/dist/data/traces/otel/QueryBar.cjs +83 -10
  124. package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
  125. package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
  126. package/dist/data/traces/otel/QueryBar.js +83 -10
  127. package/dist/data/traces/otel/QueryBar.js.map +1 -1
  128. package/dist/data/traces/otel/TraceResults.cjs +81 -13
  129. package/dist/data/traces/otel/TraceResults.cjs.map +1 -1
  130. package/dist/data/traces/otel/TraceResults.d.ts +11 -3
  131. package/dist/data/traces/otel/TraceResults.d.ts.map +1 -1
  132. package/dist/data/traces/otel/TraceResults.js +81 -13
  133. package/dist/data/traces/otel/TraceResults.js.map +1 -1
  134. package/dist/data/traces/otel/api.cjs.map +1 -1
  135. package/dist/data/traces/otel/api.d.ts +14 -0
  136. package/dist/data/traces/otel/api.d.ts.map +1 -1
  137. package/dist/data/traces/otel/api.js.map +1 -1
  138. package/dist/data/traces/otel/query.cjs +2 -2
  139. package/dist/data/traces/otel/query.cjs.map +1 -1
  140. package/dist/data/traces/otel/query.d.ts +1 -1
  141. package/dist/data/traces/otel/query.d.ts.map +1 -1
  142. package/dist/data/traces/otel/query.js +2 -2
  143. package/dist/data/traces/otel/query.js.map +1 -1
  144. package/dist/data/version-info.cjs +3 -3
  145. package/dist/data/version-info.cjs.map +1 -1
  146. package/dist/data/version-info.js +3 -3
  147. package/dist/data/version-info.js.map +1 -1
  148. package/dist/data/workload-panel/MemoryStack.cjs +38 -1
  149. package/dist/data/workload-panel/MemoryStack.cjs.map +1 -1
  150. package/dist/data/workload-panel/MemoryStack.d.ts.map +1 -1
  151. package/dist/data/workload-panel/MemoryStack.js +38 -1
  152. package/dist/data/workload-panel/MemoryStack.js.map +1 -1
  153. package/dist/data.cjs +18 -1
  154. package/dist/data.d.ts +2 -0
  155. package/dist/data.d.ts.map +1 -1
  156. package/dist/data.js +8 -2
  157. package/dist/file-findings/AnnotatedCode.cjs +18 -2
  158. package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
  159. package/dist/file-findings/AnnotatedCode.d.ts +2 -0
  160. package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
  161. package/dist/file-findings/AnnotatedCode.js +18 -2
  162. package/dist/file-findings/AnnotatedCode.js.map +1 -1
  163. package/dist/file-findings/FileFindingsView.cjs.map +1 -1
  164. package/dist/file-findings/FileFindingsView.d.ts +2 -0
  165. package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
  166. package/dist/file-findings/FileFindingsView.js.map +1 -1
  167. package/dist/file-findings/file-review/FileReview.cjs +2 -1
  168. package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
  169. package/dist/file-findings/file-review/FileReview.d.ts +3 -1
  170. package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
  171. package/dist/file-findings/file-review/FileReview.js +2 -1
  172. package/dist/file-findings/file-review/FileReview.js.map +1 -1
  173. package/dist/index.cjs +18 -1
  174. package/dist/index.js +8 -2
  175. package/dist/profiles/editor/profileEditor.cjs +29 -30
  176. package/dist/profiles/editor/profileEditor.cjs.map +1 -1
  177. package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
  178. package/dist/profiles/editor/profileEditor.js +29 -30
  179. package/dist/profiles/editor/profileEditor.js.map +1 -1
  180. package/dist/profiles/editor/profileEditorPreview.cjs +44 -43
  181. package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
  182. package/dist/profiles/editor/profileEditorPreview.d.ts +10 -5
  183. package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
  184. package/dist/profiles/editor/profileEditorPreview.js +44 -43
  185. package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
  186. package/dist/profiles/editor/profileMappingPreview.cjs +153 -48
  187. package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
  188. package/dist/profiles/editor/profileMappingPreview.d.ts +16 -2
  189. package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
  190. package/dist/profiles/editor/profileMappingPreview.js +155 -50
  191. package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
  192. package/dist/profiles/editor/sampleError.cjs +29 -0
  193. package/dist/profiles/editor/sampleError.cjs.map +1 -0
  194. package/dist/profiles/editor/sampleError.d.ts +16 -0
  195. package/dist/profiles/editor/sampleError.d.ts.map +1 -0
  196. package/dist/profiles/editor/sampleError.js +27 -0
  197. package/dist/profiles/editor/sampleError.js.map +1 -0
  198. package/dist/profiles/query/profileSampleResult.cjs.map +1 -1
  199. package/dist/profiles/query/profileSampleResult.d.ts +2 -0
  200. package/dist/profiles/query/profileSampleResult.d.ts.map +1 -1
  201. package/dist/profiles/query/profileSampleResult.js.map +1 -1
  202. package/dist/profiles/wizard/profileWizardQueryStep.cjs +1 -0
  203. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  204. package/dist/profiles/wizard/profileWizardQueryStep.d.ts +2 -0
  205. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  206. package/dist/profiles/wizard/profileWizardQueryStep.js +1 -0
  207. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  208. package/dist/react-grab/core/index.js +1 -1
  209. package/dist/react-grab/{core-BERtFDWh.js → core-BK5CU6Lb.js} +2 -2
  210. package/dist/react-grab/index.js +1 -1
  211. package/dist/react-grab/{renderer-KT3FY3K2.js → renderer-DcHrsQ8k.js} +1 -1
  212. package/dist/rpc/apiClient.cjs +12 -15
  213. package/dist/rpc/apiClient.cjs.map +1 -1
  214. package/dist/rpc/apiClient.js +12 -15
  215. package/dist/rpc/apiClient.js.map +1 -1
  216. package/dist/runtime/barrels.json +6481 -6441
  217. package/dist/runtime/importmap.json +2198 -2190
  218. package/dist/styles.css +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TraceResults.js","names":[],"sources":["../../../../src/data/traces/otel/TraceResults.tsx"],"sourcesContent":["import { ago, niceStep } from \"./result-model\";\nimport { Badge } from \"../../Badge\";\nimport { DataTable, type DataTableColumn, type DataTableProps } from \"../../DataTable\";\nimport { duration, type SearchResult, type Summary } from \"./api\";\nimport { shortOperation } from \"./query\";\n\nconst startMs = (trace: Summary) => Date.parse(trace.startedAt);\nconst clock = (ms: number) => new Date(ms).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" });\n\n/** How many traces match, newest first; the table pages through them. */\nexport function ResultSummary({ result }: { result: SearchResult }) {\n return (\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-medium text-foreground\">{result.total.toLocaleString()}</span> {result.total === 1 ? \"trace matches\" : \"traces match\"} · newest first\n </p>\n );\n}\n\n/** Each trace by when it started and how long it took, dot size by span count. */\nexport function Scatter({ traces, onOpen }: { traces: Summary[]; onOpen: (id: string) => void }) {\n const starts = traces.map(startMs);\n const t0 = Math.min(...starts);\n const span = Math.max(...starts) - t0;\n const slowest = Math.max(...traces.map(trace => trace.durationMs)) || 1;\n const step = niceStep(slowest, 4);\n const top = Math.ceil((slowest * 1.05) / step) * step;\n const yTicks = Array.from({ length: Math.round(top / step) + 1 }, (_, i) => i * step);\n // Traces that all started together sit mid-axis under one tick.\n const xTicks = span === 0 ? [0.5] : [0, 0.25, 0.5, 0.75, 1];\n const x = (ms: number) => (span === 0 ? 0.5 : (ms - t0) / span);\n return (\n <figure className=\"rounded-lg border border-border p-density-2\" aria-label=\"Duration over time\">\n <figcaption className=\"mb-1 flex items-center gap-3 text-xs text-muted-foreground\">\n <span className=\"font-medium text-foreground\">Duration over time</span>\n <span>dot size = span count · click to open</span>\n </figcaption>\n <div className=\"relative ml-[4.5rem] mr-2 mt-3.5 h-[180px]\">\n {yTicks.map(y => (\n <div key={y} className=\"absolute inset-x-0 border-t border-border/60\" style={{ bottom: `${(y / top) * 100}%` }}>\n <span className=\"absolute right-full -translate-y-1/2 whitespace-nowrap pr-1.5 text-xs tabular-nums text-muted-foreground\">{y === 0 ? \"0\" : duration(y)}</span>\n </div>\n ))}\n {traces.map(trace => {\n const size = 6 + Math.log2(trace.spanCount) * 1.6;\n const label = `${shortOperation(trace.operation)}, ${duration(trace.durationMs)}, ${trace.spanCount} spans at ${clock(startMs(trace))}`;\n return (\n <button\n key={trace.traceId}\n type=\"button\"\n aria-label={label}\n title={label}\n onClick={() => onOpen(trace.traceId)}\n className={`absolute -translate-x-1/2 translate-y-1/2 rounded-full opacity-75 hover:ring-2 hover:ring-ring ${trace.errors > 0 ? \"bg-destructive\" : trace.spanCount > 1 ? \"bg-primary\" : \"bg-muted-foreground\"}`}\n style={{ left: `${x(startMs(trace)) * 100}%`, bottom: `${(trace.durationMs / top) * 100}%`, width: size, height: size }}\n />\n );\n })}\n </div>\n <div className=\"relative ml-[4.5rem] mr-2 mt-1 h-4 text-xs tabular-nums text-muted-foreground\">\n {xTicks.map((fraction, i) => (\n <span key={fraction} className={`absolute whitespace-nowrap ${xTicks.length > 1 && i === 0 ? \"\" : xTicks.length > 1 && i === xTicks.length - 1 ? \"-translate-x-full\" : \"-translate-x-1/2\"}`} style={{ left: `${fraction * 100}%` }}>\n {clock(t0 + fraction * span)}\n </span>\n ))}\n </div>\n </figure>\n );\n}\n\n/** The traces, newest first: what ran, when, how long against the slowest, and its span count. */\nexport function ResultTable({ traces, href, onOpen, now, tableProps = {} }: { traces: Summary[]; href: (id: string) => string; onOpen: (id: string) => void; now: number; tableProps?: Pick<DataTableProps<Summary>, \"externalFilters\" | \"externalSearch\" | \"externalTimeRange\" | \"pagination\" | \"infinite\" | \"loading\"> }) {\n const slowest = Math.max(1, ...traces.map(trace => trace.durationMs));\n const columns: DataTableColumn<Summary>[] = [\n {\n key: \"operation\",\n label: \"Trace\",\n grow: true,\n minWidth: 320,\n render: (_, trace) => (\n <span className=\"flex min-w-0 items-center gap-2\" title={trace.operation}>\n <span className=\"shrink-0 font-medium\">{shortOperation(trace.operation) || trace.traceId}</span>\n <code className=\"text-xs text-muted-foreground\">{trace.traceId.slice(0, 8)}</code>\n {trace.services.length > 1 && <span className=\"truncate text-xs text-muted-foreground\">{trace.services.join(\" → \")}</span>}\n {trace.errors > 0 && <Badge size=\"sm\" tone=\"danger\" variant=\"soft\">{trace.errors} {trace.errors === 1 ? \"error\" : \"errors\"}</Badge>}\n </span>\n ),\n },\n {\n key: \"startedAt\",\n label: \"Started\",\n render: (_, trace) => <span className=\"whitespace-nowrap tabular-nums\">{clock(startMs(trace))} <span className=\"text-muted-foreground\">{ago(now - startMs(trace))}</span></span>,\n },\n {\n key: \"durationMs\",\n label: \"Duration\",\n render: (_, trace) => (\n <span className=\"flex items-center gap-2\">\n <span className=\"relative h-1.5 w-24 rounded-full bg-muted\">\n <span className=\"absolute inset-y-0 left-0 rounded-full bg-primary\" style={{ width: `${(trace.durationMs / slowest) * 100}%` }} />\n </span>\n <span className=\"tabular-nums\">{duration(trace.durationMs)}</span>\n </span>\n ),\n },\n { key: \"spanCount\", label: \"Spans\", align: \"right\" },\n ];\n return (\n <div className=\"flex h-[28rem] min-h-0 flex-col\">\n <DataTable\n {...tableProps}\n data={traces}\n columns={columns}\n getRowId={trace => trace.traceId}\n autoFilter={false}\n getRowHref={trace => href(trace.traceId)}\n onRowClick={trace => onOpen(trace.traceId)}\n emptyMessage=\"No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces.\"\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAMA,IAAM,WAAW,UAAmB,KAAK,MAAM,MAAM,SAAS;AAC9D,IAAM,SAAS,OAAe,IAAI,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG;CAAE,MAAM;CAAW,QAAQ;CAAW,QAAQ;AAAU,CAAC;;AAG3H,SAAgB,cAAc,EAAE,UAAoC;CAClE,OACE,qBAAC,KAAD;EAAG,WAAU;EAAb,UAAA;GACE,oBAAC,QAAD;IAAM,WAAU;IAA+B,UAAA,OAAO,MAAM,eAAe;GAAQ,CAAA;GAAC;GAAE,OAAO,UAAU,IAAI,kBAAkB;GAAe;EAC3I;;AAEP;;AAGA,SAAgB,QAAQ,EAAE,QAAQ,UAA+D;CAC/F,MAAM,SAAS,OAAO,IAAI,OAAO;CACjC,MAAM,KAAK,KAAK,IAAI,GAAG,MAAM;CAC7B,MAAM,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;CACnC,MAAM,UAAU,KAAK,IAAI,GAAG,OAAO,KAAI,UAAS,MAAM,UAAU,CAAC,KAAK;CACtE,MAAM,OAAO,SAAS,SAAS,CAAC;CAChC,MAAM,MAAM,KAAK,KAAM,UAAU,OAAQ,IAAI,IAAI;CACjD,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,IAAI;CAEpF,MAAM,SAAS,SAAS,IAAI,CAAC,EAAG,IAAI;EAAC;EAAG;EAAM;EAAK;EAAM;CAAC;CAC1D,MAAM,KAAK,OAA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;KAAM,WAAU;KACd,UAAA,oBAAC,QAAD;MAAM,WAAU;MAAoD,OAAO,EAAE,OAAO,GAAI,MAAM,aAAa,UAAW,IAAI,GAAG;KAAI,CAAA;IAC7H,CAAA,GACN,oBAAC,QAAD;KAAM,WAAU;KAAgB,UAAA,SAAS,MAAM,UAAU;IAAQ,CAAA,CAC7D;;EAEV;EACA;GAAE,KAAK;GAAa,OAAO;GAAS,OAAO;EAAQ;CACrD;CACA,OACE,oBAAC,OAAD;EAAK,WAAU;EACb,UAAA,oBAAC,WAAD;GACE,GAAI;GACJ,MAAM;GACG;GACT,WAAU,UAAS,MAAM;GACzB,YAAY;GACZ,aAAY,UAAS,KAAK,MAAM,OAAO;GACvC,aAAY,UAAS,OAAO,MAAM,OAAO;GACzC,cAAa;EACd,CAAA;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"TraceResults.js","names":[],"sources":["../../../../src/data/traces/otel/TraceResults.tsx"],"sourcesContent":["import { ago, niceStep } from \"./result-model\";\nimport { Badge } from \"../../Badge\";\nimport { DataTable, type DataTableColumn, type DataTableMenuAction, type DataTableProps } from \"../../DataTable\";\nimport { UiFileSpreadsheet, UiJson } from \"../../../icons\";\nimport { downloadText } from \"../../../jvm/threads/download-text\";\nimport { TagActionsProvider } from \"../../cells/TagList\";\nimport { tagActionsFromRecord } from \"../../cells/tag-utils\";\nimport { duration, type Modes, type SearchResult, type Summary } from \"./api\";\nimport { shortOperation } from \"./query\";\n\nconst startMs = (trace: Summary) => Date.parse(trace.startedAt);\nconst clock = (ms: number) => new Date(ms).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" });\n\n/** How many traces match, newest first; the table pages through them. */\nexport function ResultSummary({ result }: { result: SearchResult }) {\n return (\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-medium text-foreground\">{result.total.toLocaleString()}</span> {result.total === 1 ? \"trace matches\" : \"traces match\"} · newest first\n </p>\n );\n}\n\n/** Each trace by when it started and how long it took, dot size by span count. */\nexport function Scatter({ traces, onOpen }: { traces: Summary[]; onOpen: (id: string) => void }) {\n const starts = traces.map(startMs);\n const t0 = Math.min(...starts);\n const span = Math.max(...starts) - t0;\n const slowest = Math.max(...traces.map(trace => trace.durationMs)) || 1;\n const step = niceStep(slowest, 4);\n const top = Math.ceil((slowest * 1.05) / step) * step;\n const yTicks = Array.from({ length: Math.round(top / step) + 1 }, (_, i) => i * step);\n // Traces that all started together sit mid-axis under one tick.\n const xTicks = span === 0 ? [0.5] : [0, 0.25, 0.5, 0.75, 1];\n const x = (ms: number) => (span === 0 ? 0.5 : (ms - t0) / span);\n return (\n <figure className=\"rounded-lg border border-border p-density-2\" aria-label=\"Duration over time\">\n <figcaption className=\"mb-1 flex items-center gap-3 text-xs text-muted-foreground\">\n <span className=\"font-medium text-foreground\">Duration over time</span>\n <span>dot size = span count · click to open</span>\n </figcaption>\n <div className=\"relative ml-[4.5rem] mr-2 mt-3.5 h-[180px]\">\n {yTicks.map(y => (\n <div key={y} className=\"absolute inset-x-0 border-t border-border/60\" style={{ bottom: `${(y / top) * 100}%` }}>\n <span className=\"absolute right-full -translate-y-1/2 whitespace-nowrap pr-1.5 text-xs tabular-nums text-muted-foreground\">{y === 0 ? \"0\" : duration(y)}</span>\n </div>\n ))}\n {traces.map(trace => {\n const size = 6 + Math.log2(trace.spanCount) * 1.6;\n const label = `${shortOperation(trace.operation)}, ${duration(trace.durationMs)}, ${trace.spanCount} spans at ${clock(startMs(trace))}`;\n return (\n <button\n key={trace.traceId}\n type=\"button\"\n aria-label={label}\n title={label}\n onClick={() => onOpen(trace.traceId)}\n className={`absolute -translate-x-1/2 translate-y-1/2 rounded-full opacity-75 hover:ring-2 hover:ring-ring ${trace.errors > 0 ? \"bg-destructive\" : trace.spanCount > 1 ? \"bg-primary\" : \"bg-muted-foreground\"}`}\n style={{ left: `${x(startMs(trace)) * 100}%`, bottom: `${(trace.durationMs / top) * 100}%`, width: size, height: size }}\n />\n );\n })}\n </div>\n <div className=\"relative ml-[4.5rem] mr-2 mt-1 h-4 text-xs tabular-nums text-muted-foreground\">\n {xTicks.map((fraction, i) => (\n <span key={fraction} className={`absolute whitespace-nowrap ${xTicks.length > 1 && i === 0 ? \"\" : xTicks.length > 1 && i === xTicks.length - 1 ? \"-translate-x-full\" : \"-translate-x-1/2\"}`} style={{ left: `${fraction * 100}%` }}>\n {clock(t0 + fraction * span)}\n </span>\n ))}\n </div>\n </figure>\n );\n}\n\nconst CSV_COLUMNS = [\"traceId\", \"operation\", \"service\", \"scope\", \"startedAt\", \"durationMs\", \"spanCount\", \"errors\", \"services\", \"tags\", \"processTags\"] as const;\n\n/** RFC 4180 CSV of the traces; a list cell joins its entries with `;`, a tag cell as `key=value`. */\nfunction tracesCsv(traces: Summary[]): string {\n const cell = (value: unknown) => {\n const text = Array.isArray(value) ? value.join(\";\")\n : value && typeof value === \"object\" ? Object.entries(value).map(([key, entry]) => `${key}=${entry}`).join(\";\")\n : value === undefined ? \"\" : String(value);\n return /[\",\\n\\r]/.test(text) ? `\"${text.replaceAll('\"', '\"\"')}\"` : text;\n };\n return [CSV_COLUMNS.join(\",\"), ...traces.map(trace => CSV_COLUMNS.map(column => cell(trace[column])).join(\",\"))].join(\"\\n\");\n}\n\n/** The column menu's downloads of the listed traces. */\nconst downloadActions = (traces: Summary[]): DataTableMenuAction[] => [\n { id: \"download-json\", label: \"JSON\", icon: UiJson, onSelect: () => downloadText(\"traces.json\", JSON.stringify(traces, null, 2)) },\n { id: \"download-csv\", label: \"CSV\", icon: UiFileSpreadsheet, onSelect: () => downloadText(\"traces.csv\", tracesCsv(traces)) },\n];\n\n/**\n * The traces, newest first: what ran, in which service and scope, its root span's tags, when, how long against the\n * slowest, and its span count. The root's process tags are a column the menu reveals. Given `attributeFilter`, including\n * or excluding a tag filters the search by that `key=value`, beside the attributes it already filters by.\n */\nexport function ResultTable({ traces, href, onOpen, now, attributeFilter, tableProps = {} }: {\n traces: Summary[]; href: (id: string) => string; onOpen: (id: string) => void; now: number;\n attributeFilter?: { attributes: Modes; onChange: (attributes: Modes) => void };\n tableProps?: Pick<DataTableProps<Summary>, \"externalFilters\" | \"externalSearch\" | \"externalTimeRange\" | \"pagination\" | \"infinite\" | \"loading\">;\n}) {\n const slowest = Math.max(1, ...traces.map(trace => trace.durationMs));\n const columns: DataTableColumn<Summary>[] = [\n {\n key: \"operation\",\n label: \"Trace\",\n grow: true,\n minWidth: 320,\n render: (_, trace) => (\n <span className=\"flex min-w-0 items-center gap-2\" title={trace.operation}>\n <span className=\"shrink-0 font-medium\">{shortOperation(trace.operation) || trace.traceId}</span>\n <code className=\"text-xs text-muted-foreground\">{trace.traceId.slice(0, 8)}</code>\n {trace.services.length > 1 && <span className=\"truncate text-xs text-muted-foreground\">{trace.services.join(\" → \")}</span>}\n {trace.errors > 0 && <Badge size=\"sm\" tone=\"danger\" variant=\"soft\">{trace.errors} {trace.errors === 1 ? \"error\" : \"errors\"}</Badge>}\n </span>\n ),\n },\n { key: \"service\", label: \"Service\" },\n { key: \"scope\", label: \"Scope\" },\n { key: \"tags\", label: \"Tags\", kind: \"tags\", minWidth: 240 },\n { key: \"processTags\", label: \"Process tags\", kind: \"tags\", minWidth: 240 },\n {\n key: \"startedAt\",\n label: \"Started\",\n render: (_, trace) => <span className=\"whitespace-nowrap tabular-nums\">{clock(startMs(trace))} <span className=\"text-muted-foreground\">{ago(now - startMs(trace))}</span></span>,\n },\n {\n key: \"durationMs\",\n label: \"Duration\",\n render: (_, trace) => (\n <span className=\"flex items-center gap-2\">\n <span className=\"relative h-1.5 w-24 rounded-full bg-muted\">\n <span className=\"absolute inset-y-0 left-0 rounded-full bg-primary\" style={{ width: `${(trace.durationMs / slowest) * 100}%` }} />\n </span>\n <span className=\"tabular-nums\">{duration(trace.durationMs)}</span>\n </span>\n ),\n },\n { key: \"spanCount\", label: \"Spans\", align: \"right\" },\n ];\n const table = (\n <DataTable\n {...tableProps}\n data={traces}\n columns={columns}\n defaultHiddenColumns={[\"processTags\"]}\n menuActions={downloadActions(traces)}\n getRowId={trace => trace.traceId}\n autoFilter={false}\n getRowHref={trace => href(trace.traceId)}\n onRowClick={trace => onOpen(trace.traceId)}\n emptyMessage=\"No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces.\"\n />\n );\n return (\n <div className=\"flex min-h-[28rem] min-w-0 flex-1 flex-col\">\n {attributeFilter\n ? <TagActionsProvider value={tagActionsFromRecord(attributeFilter.attributes, attributeFilter.onChange)}>{table}</TagActionsProvider>\n : table}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAM,WAAW,UAAmB,KAAK,MAAM,MAAM,SAAS;AAC9D,IAAM,SAAS,OAAe,IAAI,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG;CAAE,MAAM;CAAW,QAAQ;CAAW,QAAQ;AAAU,CAAC;;AAG3H,SAAgB,cAAc,EAAE,UAAoC;CAClE,OACE,qBAAC,KAAD;EAAG,WAAU;EAAb,UAAA;GACE,oBAAC,QAAD;IAAM,WAAU;IAA+B,UAAA,OAAO,MAAM,eAAe;GAAQ,CAAA;GAAC;GAAE,OAAO,UAAU,IAAI,kBAAkB;GAAe;EAC3I;;AAEP;;AAGA,SAAgB,QAAQ,EAAE,QAAQ,UAA+D;CAC/F,MAAM,SAAS,OAAO,IAAI,OAAO;CACjC,MAAM,KAAK,KAAK,IAAI,GAAG,MAAM;CAC7B,MAAM,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;CACnC,MAAM,UAAU,KAAK,IAAI,GAAG,OAAO,KAAI,UAAS,MAAM,UAAU,CAAC,KAAK;CACtE,MAAM,OAAO,SAAS,SAAS,CAAC;CAChC,MAAM,MAAM,KAAK,KAAM,UAAU,OAAQ,IAAI,IAAI;CACjD,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,IAAI;CAEpF,MAAM,SAAS,SAAS,IAAI,CAAC,EAAG,I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O,EAAE,OAAO,GAAI,MAAM,aAAa,UAAW,IAAI,GAAG;KAAI,CAAA;IAC7H,CAAA,GACN,oBAAC,QAAD;KAAM,WAAU;KAAgB,UAAA,SAAS,MAAM,UAAU;IAAQ,CAAA,CAC7D;;EAEV;EACA;GAAE,KAAK;GAAa,OAAO;GAAS,OAAO;EAAQ;CACrD;CACA,MAAM,QACF,oBAAC,WAAD;EACE,GAAI;EACJ,MAAM;EACG;EACT,sBAAsB,CAAC,aAAa;EACpC,aAAa,gBAAgB,MAAM;EACnC,WAAU,UAAS,MAAM;EACzB,YAAY;EACZ,aAAY,UAAS,KAAK,MAAM,OAAO;EACvC,aAAY,UAAS,OAAO,MAAM,OAAO;EACzC,cAAa;CACd,CAAA;CAEL,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,kBACG,oBAAC,oBAAD;GAAoB,OAAO,qBAAqB,gBAAgB,YAAY,gBAAgB,QAAQ;GAAI,UAAA;EAA0B,CAAA,IAClI;CACD,CAAA;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.cjs","names":[],"sources":["../../../../src/data/traces/otel/api.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../../components\";\n\nexport type Span = {\n traceId: string;\n spanId: string;\n parentId?: string;\n service: string;\n operation: string;\n kind?: string;\n startedAt: string;\n durationMs: number;\n status: string;\n attributes?: Record<string, unknown>;\n resource?: Record<string, unknown>;\n otlp?: Record<string, unknown>;\n};\nexport type Summary = {\n traceId: string;\n service: string;\n operation: string;\n startedAt: string;\n durationMs: number;\n spanCount: number;\n errors: number;\n services: string[];\n};\nexport interface Trace {\n summary: Summary;\n spans: Span[];\n missingParents: string[];\n}\n/** The traces of one root operation in the window (tracequery.OperationStats). */\nexport interface OperationStats {\n operation: string;\n count: number;\n singleSpan?: boolean;\n p50Ms: number;\n p95Ms: number;\n}\nexport interface SearchResult {\n traces: Summary[];\n total: number;\n services: string[];\n /** Every filter but the operation and span-count ones applied, by root operation: the root-operation filter's options. */\n rootOperations: OperationStats[];\n /** key=value suggestions from those traces' root spans, most frequent first. */\n attributes: { value: string; count: number }[];\n}\nexport interface Source {\n id: string;\n name: string;\n type: string;\n}\n/** A filter's values, each included or excluded (tracequery.Modes). */\nexport type Modes = Record<string, \"include\" | \"exclude\">;\nexport const MODE_FILTERS = [\"services\", \"operations\", \"statuses\", \"attributes\"] as const;\nexport type ModeFilter = (typeof MODE_FILTERS)[number];\nexport type SearchValues = Record<string, unknown> & {\n source?: string | undefined;\n run?: string | undefined;\n index?: string | undefined;\n format?: string | undefined;\n services?: Modes | undefined;\n /** Root operations. */\n operations?: Modes | undefined;\n statuses?: Modes | undefined;\n /** key, key=value or key=prefix* expressions. */\n attributes?: Modes | undefined;\n minSpans?: number | undefined;\n traceId?: string | undefined;\n lookback?: string | undefined;\n from?: string | undefined;\n until?: string | undefined;\n minDuration?: string | undefined;\n maxDuration?: string | undefined;\n limit?: number | undefined;\n /** Matching traces to skip, newest first: the page's start. */\n offset?: number | undefined;\n};\nexport interface SearchForm {\n schema: JsonSchemaObject;\n defaults: SearchValues;\n}\nexport function searchParams(value: SearchValues): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, item] of Object.entries(value))\n if (\n item !== undefined && item !== null && item !== \"\" &&\n !(typeof item === \"object\" && Object.keys(item).length === 0)\n )\n params.set(\n key,\n typeof item === \"object\" ? JSON.stringify(item) : String(item),\n );\n return params;\n}\n\nfunction parseModes(key: string, text: string): Modes {\n const value: unknown = JSON.parse(text);\n if (!value || typeof value !== \"object\" || Array.isArray(value) || Object.values(value).some(mode => mode !== \"include\" && mode !== \"exclude\"))\n throw new Error(`${key} must be a JSON object of values to include or exclude`);\n return value as Modes;\n}\n\nexport function readSearchValues(params: URLSearchParams = new URLSearchParams(window.location.search)): SearchValues {\n const result: SearchValues = {};\n for (const [key, value] of params) {\n if (key === \"span\") continue;\n if ((MODE_FILTERS as readonly string[]).includes(key)) result[key] = parseModes(key, value);\n else if (key === \"limit\" || key === \"offset\" || key === \"minSpans\") {\n if (!/^\\d+$/.test(value)) throw new Error(`${key} must be a whole number, not ${JSON.stringify(value)}`);\n result[key] = Number(value);\n } else result[key] = value;\n }\n return result;\n}\n\nexport const duration = (ms: number) =>\n ms >= 1000\n ? `${(ms / 1000).toFixed(2)} s`\n : ms >= 10\n ? `${ms.toFixed(0)} ms`\n : ms >= 1\n ? `${ms.toFixed(1)} ms`\n : `${(ms * 1000).toFixed(0)} µs`;\n"],"mappings":";AAuDA,IAAa,eAAe;CAAC;CAAY;CAAc;CAAY;AAAY;AA4B/E,SAAgB,aAAa,OAAsC;CACjE,MAAM,SAAS,IAAI,gBAAgB;CACnC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAK,GAC5C,IACE,SAAS,KAAA,KAAa,SAAS,QAAQ,SAAS,MAChD,EAAE,OAAO,SAAS,YAAY,OAAO,KAAK,IAAI,CAAC,CAAC,WAAW,IAE3D,OAAO,IACL,KACA,OAAO,SAAS,WAAW,KAAK,UAAU,IAAI,IAAI,OAAO,IAAI,CAC/D;CACJ,OAAO;AACT;AAEA,SAAS,WAAW,KAAa,MAAqB;CACpD,MAAM,QAAiB,KAAK,MAAM,IAAI;CACtC,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,KAAK,OAAO,OAAO,KAAK,CAAC,CAAC,MAAK,SAAQ,SAAS,aAAa,SAAS,SAAS,GAC3I,MAAM,IAAI,MAAM,GAAG,IAAI,uDAAuD;CAChF,OAAO;AACT;AAEA,SAAgB,iBAAiB,SAA0B,IAAI,gBAAgB,OAAO,SAAS,MAAM,GAAiB;CACpH,MAAM,SAAuB,CAAC;CAC9B,KAAK,MAAM,CAAC,KAAK,UAAU,QAAQ;EACjC,IAAI,QAAQ,QAAQ;EACpB,IAAK,aAAmC,SAAS,GAAG,GAAG,OAAO,OAAO,WAAW,KAAK,KAAK;OACrF,IAAI,QAAQ,WAAW,QAAQ,YAAY,QAAQ,YAAY;GAClE,IAAI,CAAC,QAAQ,KAAK,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,IAAI,+BAA+B,KAAK,UAAU,KAAK,GAAG;GACvG,OAAO,OAAO,OAAO,KAAK;EAC5B,OAAO,OAAO,OAAO;CACvB;CACA,OAAO;AACT;AAEA,IAAa,YAAY,OACvB,MAAM,MACF,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE,MAC1B,MAAM,KACJ,GAAG,GAAG,QAAQ,CAAC,EAAE,OACjB,MAAM,IACJ,GAAG,GAAG,QAAQ,CAAC,EAAE,OACjB,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE"}
1
+ {"version":3,"file":"api.cjs","names":[],"sources":["../../../../src/data/traces/otel/api.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../../components\";\n\nexport type Span = {\n traceId: string;\n spanId: string;\n parentId?: string;\n service: string;\n operation: string;\n kind?: string;\n startedAt: string;\n durationMs: number;\n status: string;\n attributes?: Record<string, unknown>;\n resource?: Record<string, unknown>;\n otlp?: Record<string, unknown>;\n};\nexport type Summary = {\n traceId: string;\n service: string;\n operation: string;\n startedAt: string;\n durationMs: number;\n spanCount: number;\n errors: number;\n services: string[];\n /** The AI conversation (gen_ai.conversation.id) the trace runs in, if any. */\n session?: string;\n /** The root span's instrumentation scope. */\n scope?: string;\n /** The root span's scalar span attributes, as text. */\n tags?: Record<string, string>;\n /** The root span's scalar resource (process) attributes, as text. */\n processTags?: Record<string, string>;\n};\nexport interface Trace {\n summary: Summary;\n spans: Span[];\n missingParents: string[];\n}\n/** The traces of one root operation in the window (tracequery.OperationStats). */\nexport interface OperationStats {\n operation: string;\n count: number;\n singleSpan?: boolean;\n p50Ms: number;\n p95Ms: number;\n}\nexport interface SearchResult {\n traces: Summary[];\n total: number;\n services: string[];\n /** Every filter but the operation and span-count ones applied, by root operation: the root-operation filter's options. */\n rootOperations: OperationStats[];\n /** key=value suggestions from those traces' root spans, most frequent first. */\n attributes: { value: string; count: number }[];\n /** Set when the attribute filter stopped at its span limit: only the newest `checkedTraces` of `candidateTraces` were checked. */\n truncated?: { spanLimit: number; checkedTraces: number; candidateTraces: number };\n}\nexport interface Source {\n id: string;\n name: string;\n type: string;\n}\n/** A filter's values, each included or excluded (tracequery.Modes). */\nexport type Modes = Record<string, \"include\" | \"exclude\">;\nexport const MODE_FILTERS = [\"services\", \"operations\", \"statuses\", \"attributes\"] as const;\nexport type ModeFilter = (typeof MODE_FILTERS)[number];\nexport type SearchValues = Record<string, unknown> & {\n source?: string | undefined;\n run?: string | undefined;\n index?: string | undefined;\n format?: string | undefined;\n services?: Modes | undefined;\n /** Root operations. */\n operations?: Modes | undefined;\n statuses?: Modes | undefined;\n /** key, key=value or key=prefix* expressions. */\n attributes?: Modes | undefined;\n minSpans?: number | undefined;\n traceId?: string | undefined;\n lookback?: string | undefined;\n from?: string | undefined;\n until?: string | undefined;\n minDuration?: string | undefined;\n maxDuration?: string | undefined;\n limit?: number | undefined;\n /** Matching traces to skip, newest first: the page's start. */\n offset?: number | undefined;\n};\nexport interface SearchForm {\n schema: JsonSchemaObject;\n defaults: SearchValues;\n}\nexport function searchParams(value: SearchValues): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, item] of Object.entries(value))\n if (\n item !== undefined && item !== null && item !== \"\" &&\n !(typeof item === \"object\" && Object.keys(item).length === 0)\n )\n params.set(\n key,\n typeof item === \"object\" ? JSON.stringify(item) : String(item),\n );\n return params;\n}\n\nfunction parseModes(key: string, text: string): Modes {\n const value: unknown = JSON.parse(text);\n if (!value || typeof value !== \"object\" || Array.isArray(value) || Object.values(value).some(mode => mode !== \"include\" && mode !== \"exclude\"))\n throw new Error(`${key} must be a JSON object of values to include or exclude`);\n return value as Modes;\n}\n\nexport function readSearchValues(params: URLSearchParams = new URLSearchParams(window.location.search)): SearchValues {\n const result: SearchValues = {};\n for (const [key, value] of params) {\n if (key === \"span\") continue;\n if ((MODE_FILTERS as readonly string[]).includes(key)) result[key] = parseModes(key, value);\n else if (key === \"limit\" || key === \"offset\" || key === \"minSpans\") {\n if (!/^\\d+$/.test(value)) throw new Error(`${key} must be a whole number, not ${JSON.stringify(value)}`);\n result[key] = Number(value);\n } else result[key] = value;\n }\n return result;\n}\n\nexport const duration = (ms: number) =>\n ms >= 1000\n ? `${(ms / 1000).toFixed(2)} s`\n : ms >= 10\n ? `${ms.toFixed(0)} ms`\n : ms >= 1\n ? `${ms.toFixed(1)} ms`\n : `${(ms * 1000).toFixed(0)} µs`;\n"],"mappings":";AAiEA,IAAa,eAAe;CAAC;CAAY;CAAc;CAAY;AAAY;AA4B/E,SAAgB,aAAa,OAAsC;CACjE,MAAM,SAAS,IAAI,gBAAgB;CACnC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAK,GAC5C,IACE,SAAS,KAAA,KAAa,SAAS,QAAQ,SAAS,MAChD,EAAE,OAAO,SAAS,YAAY,OAAO,KAAK,IAAI,CAAC,CAAC,WAAW,IAE3D,OAAO,IACL,KACA,OAAO,SAAS,WAAW,KAAK,UAAU,IAAI,IAAI,OAAO,IAAI,CAC/D;CACJ,OAAO;AACT;AAEA,SAAS,WAAW,KAAa,MAAqB;CACpD,MAAM,QAAiB,KAAK,MAAM,IAAI;CACtC,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,KAAK,OAAO,OAAO,KAAK,CAAC,CAAC,MAAK,SAAQ,SAAS,aAAa,SAAS,SAAS,GAC3I,MAAM,IAAI,MAAM,GAAG,IAAI,uDAAuD;CAChF,OAAO;AACT;AAEA,SAAgB,iBAAiB,SAA0B,IAAI,gBAAgB,OAAO,SAAS,MAAM,GAAiB;CACpH,MAAM,SAAuB,CAAC;CAC9B,KAAK,MAAM,CAAC,KAAK,UAAU,QAAQ;EACjC,IAAI,QAAQ,QAAQ;EACpB,IAAK,aAAmC,SAAS,GAAG,GAAG,OAAO,OAAO,WAAW,KAAK,KAAK;OACrF,IAAI,QAAQ,WAAW,QAAQ,YAAY,QAAQ,YAAY;GAClE,IAAI,CAAC,QAAQ,KAAK,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,IAAI,+BAA+B,KAAK,UAAU,KAAK,GAAG;GACvG,OAAO,OAAO,OAAO,KAAK;EAC5B,OAAO,OAAO,OAAO;CACvB;CACA,OAAO;AACT;AAEA,IAAa,YAAY,OACvB,MAAM,MACF,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE,MAC1B,MAAM,KACJ,GAAG,GAAG,QAAQ,CAAC,EAAE,OACjB,MAAM,IACJ,GAAG,GAAG,QAAQ,CAAC,EAAE,OACjB,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE"}
@@ -22,6 +22,14 @@ export type Summary = {
22
22
  spanCount: number;
23
23
  errors: number;
24
24
  services: string[];
25
+ /** The AI conversation (gen_ai.conversation.id) the trace runs in, if any. */
26
+ session?: string;
27
+ /** The root span's instrumentation scope. */
28
+ scope?: string;
29
+ /** The root span's scalar span attributes, as text. */
30
+ tags?: Record<string, string>;
31
+ /** The root span's scalar resource (process) attributes, as text. */
32
+ processTags?: Record<string, string>;
25
33
  };
26
34
  export interface Trace {
27
35
  summary: Summary;
@@ -47,6 +55,12 @@ export interface SearchResult {
47
55
  value: string;
48
56
  count: number;
49
57
  }[];
58
+ /** Set when the attribute filter stopped at its span limit: only the newest `checkedTraces` of `candidateTraces` were checked. */
59
+ truncated?: {
60
+ spanLimit: number;
61
+ checkedTraces: number;
62
+ candidateTraces: number;
63
+ };
50
64
  }
51
65
  export interface Source {
52
66
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/data/traces/otel/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,MAAM,IAAI,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE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AC;CAC7B,CAAC;AACF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;CACxB;AACD,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAYjE;AASD,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,eAA6D,GAAG,YAAY,CAWpH;AAED,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,WAOK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","names":[],"sources":["../../../../src/data/traces/otel/api.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../../components\";\n\nexport type Span = {\n traceId: string;\n spanId: string;\n parentId?: string;\n service: string;\n operation: string;\n kind?: string;\n startedAt: string;\n durationMs: number;\n status: string;\n attributes?: Record<string, unknown>;\n resource?: Record<string, unknown>;\n otlp?: Record<string, unknown>;\n};\nexport type Summary = {\n traceId: string;\n service: string;\n operation: string;\n startedAt: string;\n durationMs: number;\n spanCount: number;\n errors: number;\n services: string[];\n};\nexport interface Trace {\n summary: Summary;\n spans: Span[];\n missingParents: string[];\n}\n/** The traces of one root operation in the window (tracequery.OperationStats). */\nexport interface OperationStats {\n operation: string;\n count: number;\n singleSpan?: boolean;\n p50Ms: number;\n p95Ms: number;\n}\nexport interface SearchResult {\n traces: Summary[];\n total: number;\n services: string[];\n /** Every filter but the operation and span-count ones applied, by root operation: the root-operation filter's options. */\n rootOperations: OperationStats[];\n /** key=value suggestions from those traces' root spans, most frequent first. */\n attributes: { value: string; count: number }[];\n}\nexport interface Source {\n id: string;\n name: string;\n type: string;\n}\n/** A filter's values, each included or excluded (tracequery.Modes). */\nexport type Modes = Record<string, \"include\" | \"exclude\">;\nexport const MODE_FILTERS = [\"services\", \"operations\", \"statuses\", \"attributes\"] as const;\nexport type ModeFilter = (typeof MODE_FILTERS)[number];\nexport type SearchValues = Record<string, unknown> & {\n source?: string | undefined;\n run?: string | undefined;\n index?: string | undefined;\n format?: string | undefined;\n services?: Modes | undefined;\n /** Root operations. */\n operations?: Modes | undefined;\n statuses?: Modes | undefined;\n /** key, key=value or key=prefix* expressions. */\n attributes?: Modes | undefined;\n minSpans?: number | undefined;\n traceId?: string | undefined;\n lookback?: string | undefined;\n from?: string | undefined;\n until?: string | undefined;\n minDuration?: string | undefined;\n maxDuration?: string | undefined;\n limit?: number | undefined;\n /** Matching traces to skip, newest first: the page's start. */\n offset?: number | undefined;\n};\nexport interface SearchForm {\n schema: JsonSchemaObject;\n defaults: SearchValues;\n}\nexport function searchParams(value: SearchValues): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, item] of Object.entries(value))\n if (\n item !== undefined && item !== null && item !== \"\" &&\n !(typeof item === \"object\" && Object.keys(item).length === 0)\n )\n params.set(\n key,\n typeof item === \"object\" ? JSON.stringify(item) : String(item),\n );\n return params;\n}\n\nfunction parseModes(key: string, text: string): Modes {\n const value: unknown = JSON.parse(text);\n if (!value || typeof value !== \"object\" || Array.isArray(value) || Object.values(value).some(mode => mode !== \"include\" && mode !== \"exclude\"))\n throw new Error(`${key} must be a JSON object of values to include or exclude`);\n return value as Modes;\n}\n\nexport function readSearchValues(params: URLSearchParams = new URLSearchParams(window.location.search)): SearchValues {\n const result: SearchValues = {};\n for (const [key, value] of params) {\n if (key === \"span\") continue;\n if ((MODE_FILTERS as readonly string[]).includes(key)) result[key] = parseModes(key, value);\n else if (key === \"limit\" || key === \"offset\" || key === \"minSpans\") {\n if (!/^\\d+$/.test(value)) throw new Error(`${key} must be a whole number, not ${JSON.stringify(value)}`);\n result[key] = Number(value);\n } else result[key] = value;\n }\n return result;\n}\n\nexport const duration = (ms: number) =>\n ms >= 1000\n ? `${(ms / 1000).toFixed(2)} s`\n : ms >= 10\n ? `${ms.toFixed(0)} ms`\n : ms >= 1\n ? `${ms.toFixed(1)} ms`\n : `${(ms * 1000).toFixed(0)} µs`;\n"],"mappings":";AAuDA,IAAa,eAAe;CAAC;CAAY;CAAc;CAAY;AAA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,CAAC,EAAE,OACjB,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE"}
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../../../src/data/traces/otel/api.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../../components\";\n\nexport type Span = {\n traceId: string;\n spanId: string;\n parentId?: string;\n service: string;\n operation: string;\n kind?: string;\n startedAt: string;\n durationMs: number;\n status: string;\n attributes?: Record<string, unknown>;\n resource?: Record<string, unknown>;\n otlp?: Record<string, unknown>;\n};\nexport type Summary = {\n traceId: string;\n service: string;\n operation: string;\n startedAt: string;\n durationMs: number;\n spanCount: number;\n errors: number;\n services: string[];\n /** The AI conversation (gen_ai.conversation.id) the trace runs in, if any. */\n session?: string;\n /** The root span's instrumentation scope. */\n scope?: string;\n /** The root span's scalar span attributes, as text. */\n tags?: Record<string, string>;\n /** The root span's scalar resource (process) attributes, as text. */\n processTags?: Record<string, string>;\n};\nexport interface Trace {\n summary: Summary;\n spans: Span[];\n missingParents: string[];\n}\n/** The traces of one root operation in the window (tracequery.OperationStats). */\nexport interface OperationStats {\n operation: string;\n count: number;\n singleSpan?: boolean;\n p50Ms: number;\n p95Ms: number;\n}\nexport interface SearchResult {\n traces: Summary[];\n total: number;\n services: string[];\n /** Every filter but the operation and span-count ones applied, by root operation: the root-operation filter's options. */\n rootOperations: OperationStats[];\n /** key=value suggestions from those traces' root spans, most frequent first. */\n attributes: { value: string; count: number }[];\n /** Set when the attribute filter stopped at its span limit: only the newest `checkedTraces` of `candidateTraces` were checked. */\n truncated?: { spanLimit: number; checkedTraces: number; candidateTraces: number };\n}\nexport interface Source {\n id: string;\n name: string;\n type: string;\n}\n/** A filter's values, each included or excluded (tracequery.Modes). */\nexport type Modes = Record<string, \"include\" | \"exclude\">;\nexport const MODE_FILTERS = [\"services\", \"operations\", \"statuses\", \"attributes\"] as const;\nexport type ModeFilter = (typeof MODE_FILTERS)[number];\nexport type SearchValues = Record<string, unknown> & {\n source?: string | undefined;\n run?: string | undefined;\n index?: string | undefined;\n format?: string | undefined;\n services?: Modes | undefined;\n /** Root operations. */\n operations?: Modes | undefined;\n statuses?: Modes | undefined;\n /** key, key=value or key=prefix* expressions. */\n attributes?: Modes | undefined;\n minSpans?: number | undefined;\n traceId?: string | undefined;\n lookback?: string | undefined;\n from?: string | undefined;\n until?: string | undefined;\n minDuration?: string | undefined;\n maxDuration?: string | undefined;\n limit?: number | undefined;\n /** Matching traces to skip, newest first: the page's start. */\n offset?: number | undefined;\n};\nexport interface SearchForm {\n schema: JsonSchemaObject;\n defaults: SearchValues;\n}\nexport function searchParams(value: SearchValues): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, item] of Object.entries(value))\n if (\n item !== undefined && item !== null && item !== \"\" &&\n !(typeof item === \"object\" && Object.keys(item).length === 0)\n )\n params.set(\n key,\n typeof item === \"object\" ? JSON.stringify(item) : String(item),\n );\n return params;\n}\n\nfunction parseModes(key: string, text: string): Modes {\n const value: unknown = JSON.parse(text);\n if (!value || typeof value !== \"object\" || Array.isArray(value) || Object.values(value).some(mode => mode !== \"include\" && mode !== \"exclude\"))\n throw new Error(`${key} must be a JSON object of values to include or exclude`);\n return value as Modes;\n}\n\nexport function readSearchValues(params: URLSearchParams = new URLSearchParams(window.location.search)): SearchValues {\n const result: SearchValues = {};\n for (const [key, value] of params) {\n if (key === \"span\") continue;\n if ((MODE_FILTERS as readonly string[]).includes(key)) result[key] = parseModes(key, value);\n else if (key === \"limit\" || key === \"offset\" || key === \"minSpans\") {\n if (!/^\\d+$/.test(value)) throw new Error(`${key} must be a whole number, not ${JSON.stringify(value)}`);\n result[key] = Number(value);\n } else result[key] = value;\n }\n return result;\n}\n\nexport const duration = (ms: number) =>\n ms >= 1000\n ? `${(ms / 1000).toFixed(2)} s`\n : ms >= 10\n ? `${ms.toFixed(0)} ms`\n : ms >= 1\n ? `${ms.toFixed(1)} ms`\n : `${(ms * 1000).toFixed(0)} µs`;\n"],"mappings":";AAiEA,IAAa,eAAe;CAA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,IACJ,GAAG,GAAG,QAAQ,CAAC,EAAE,OACjB,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE"}
@@ -71,9 +71,9 @@ function durationOf(value) {
71
71
  ...bound(value.maxDuration, "max")
72
72
  };
73
73
  }
74
- /** The request's minDuration and maxDuration for the duration control, a bare bound in seconds. */
74
+ /** The request's minDuration and maxDuration for the duration control, a bare bound in milliseconds. */
75
75
  function durationRequest(value) {
76
- const edge = (amount, unit) => amount?.trim() ? `${amount.trim()}${unit ?? "s"}` : void 0;
76
+ const edge = (amount, unit) => amount?.trim() ? `${amount.trim()}${unit ?? "ms"}` : void 0;
77
77
  return {
78
78
  minDuration: edge(value.min, value.minUnit),
79
79
  maxDuration: edge(value.max, value.maxUnit)
@@ -1 +1 @@
1
- {"version":3,"file":"query.cjs","names":[],"sources":["../../../../src/data/traces/otel/query.ts"],"sourcesContent":["import type { FilterBarDurationUnit, FilterBarDurationValue } from \"../../../components\";\nimport type { SearchValues } from \"./api\";\n\n// The pure side of the trace search bar: how its time range and duration\n// controls map onto the server's request (lookback, from/until and\n// minDuration/maxDuration), and how operations read.\n\n/** The server's minSpans that \"Hide single-span traces\" sets. */\nexport const MULTI_SPAN = 2;\n\nconst RELATIVE = /^now(?:-(\\d+)([smhdwMy]))?$/;\nconst UNIT_HOURS: Record<string, number> = { d: 24, w: 168, M: 720, y: 8760 };\nconst UNIT_MS: Record<string, number> = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5, M: 2592e6, y: 31536e6 };\n\n/** A relative offset as a Go duration: s, m and h as they are, longer units in hours. */\nfunction goDuration(count: number, unit: string): string {\n return unit in UNIT_HOURS ? `${count * UNIT_HOURS[unit]!}h` : `${count}${unit}`;\n}\n\n/** The time range control's value for a request: its lookback as now-<lookback>, or its from/until as they are. */\nexport function rangeOf(value: SearchValues): { from: string; to: string } {\n if (value.from || value.until) return { from: value.from ?? \"\", to: value.until ?? \"now\" };\n return { from: value.lookback ? `now-${value.lookback}` : \"\", to: \"now\" };\n}\n\n/** An instant of the range control as RFC3339: now-relative against now, or a date-time the browser reads. */\nfunction instant(text: string, now: number): string {\n const relative = RELATIVE.exec(text);\n if (relative) return new Date(now - (relative[1] ? Number(relative[1]) * UNIT_MS[relative[2]!]! : 0)).toISOString();\n const parsed = Date.parse(text);\n if (Number.isNaN(parsed)) throw new Error(`Could not read the time ${JSON.stringify(text)}: use now, an offset such as now-1h, or a date-time`);\n return new Date(parsed).toISOString();\n}\n\n/** The request's window for a range: a lookback when it ends now and starts now-relative, otherwise from/until as instants. */\nexport function windowOf(from: string, to: string, now: number): Pick<SearchValues, \"lookback\" | \"from\" | \"until\"> {\n const start = from.trim();\n const end = to.trim() || \"now\";\n const relative = RELATIVE.exec(start);\n if (end === \"now\" && (!start || (relative && relative[1]))) return { lookback: relative ? goDuration(Number(relative[1]), relative[2]!) : undefined, from: undefined, until: undefined };\n return { lookback: undefined, from: start ? instant(start, now) : undefined, until: end === \"now\" ? undefined : instant(end, now) };\n}\n\nconst DURATION = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h)$/;\n\nfunction bound(text: string | undefined, edge: \"min\" | \"max\"): FilterBarDurationValue {\n if (!text) return {};\n const match = DURATION.exec(text);\n if (!match) throw new Error(`${edge}Duration must be a number of ms, s, m or h, not ${JSON.stringify(text)}`);\n return { [edge]: match[1], [`${edge}Unit`]: match[2] as FilterBarDurationUnit };\n}\n\n/** The duration control's value for a request's minDuration and maxDuration. */\nexport function durationOf(value: SearchValues): FilterBarDurationValue {\n return { ...bound(value.minDuration, \"min\"), ...bound(value.maxDuration, \"max\") };\n}\n\n/** The request's minDuration and maxDuration for the duration control, a bare bound in seconds. */\nexport function durationRequest(value: FilterBarDurationValue): Pick<SearchValues, \"minDuration\" | \"maxDuration\"> {\n const edge = (amount: string | undefined, unit: FilterBarDurationUnit | undefined) => (amount?.trim() ? `${amount.trim()}${unit ?? \"s\"}` : undefined);\n return { minDuration: edge(value.min, value.minUnit), maxDuration: edge(value.max, value.maxUnit) };\n}\n\n/** `invoke_agent /abs/path/.captain/prompts/jira/x.prompt` reads `invoke_agent jira/x.prompt`. */\nexport const shortOperation = (operation: string) => operation.replace(/ \\/\\S*\\/prompts\\//, \" \");\n\n/** A W3C (32 hex) or Jaeger 64-bit (16 hex) trace ID. */\nexport const isTraceId = (text: string) => /^[0-9a-f]{16}([0-9a-f]{16})?$/i.test(text.trim());\n"],"mappings":";AAUA,IAAM,WAAW;AACjB,IAAM,aAAqC;CAAE,GAAG;CAAI,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;AAC5E,IAAM,UAAkC;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;CAAM,GAAG;CAAO,GAAG;CAAQ,GAAG;CAAQ,GAAG;AAAQ;;AAG9G,SAAS,WAAW,OAAe,MAAsB;CACvD,OAAO,QAAQ,aAAa,GAAG,QAAQ,WAAW,MAAO,KAAK,GAAG,QAAQ;AAC3E;;AAGA,SAAgB,QAAQ,OAAmD;CACzE,IAAI,MAAM,QAAQ,MAAM,OAAO,OAAO;EAAE,MAAM,MAAM,QAAQ;EAAI,IAAI,MAAM,SAAS;CAAM;CACzF,OAAO;EAAE,MAAM,MAAM,WAAW,OAAO,MAAM,aAAa;EAAI,IAAI;CAAM;AAC1E;;AAGA,SAAS,QAAQ,MAAc,KAAqB;CAClD,MAAM,WAAW,SAAS,KAAK,IAAI;CACnC,IAAI,UAAU,OAAO,IAAI,KAAK,OAAO,SAAS,KAAK,OAAO,SAAS,EAAE,IAAI,QAAQ,SAAS,MAAQ,EAAE,CAAC,CAAC,YAAY;CAClH,MAAM,SAAS,KAAK,MAAM,IAAI;CAC9B,IAAI,OAAO,MAAM,MAAM,GAAG,MAAM,IAAI,MAAM,2BAA2B,KAAK,UAAU,IAAI,EAAE,oDAAoD;CAC9I,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,YAAY;AACtC;;AAGA,SAAgB,SAAS,MAAc,IAAY,KAAgE;CACjH,MAAM,QAAQ,KAAK,KAAK;CACxB,MAAM,MAAM,GAAG,KAAK,KAAK;CACzB,MAAM,WAAW,SAAS,KAAK,KAAK;CACpC,IAAI,QAAQ,UAAU,CAAC,SAAU,YAAY,SAAS,KAAM,OAAO;EAAE,UAAU,WAAW,WAAW,OAAO,SAAS,EAAE,GAAG,SAAS,EAAG,IAAI,KAAA;EAAW,MAAM,KAAA;EAAW,OAAO,KAAA;CAAU;CACvL,OAAO;EAAE,UAAU,KAAA;EAAW,MAAM,QAAQ,QAAQ,OAAO,GAAG,IAAI,KAAA;EAAW,OAAO,QAAQ,QAAQ,KAAA,IAAY,QAAQ,KAAK,GAAG;CAAE;AACpI;AAEA,IAAM,WAAW;AAEjB,SAAS,MAAM,MAA0B,MAA6C;CACpF,IAAI,CAAC,MAAM,OAAO,CAAC;CACnB,MAAM,QAAQ,SAAS,KAAK,IAAI;CAChC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,GAAG,KAAK,kDAAkD,KAAK,UAAU,IAAI,GAAG;CAC5G,OAAO;GAAG,OAAO,MAAM;GAAK,GAAG,KAAK,QAAQ,MAAM;CAA4B;AAChF;;AAGA,SAAgB,WAAW,OAA6C;CACtE,OAAO;EAAE,GAAG,MAAM,MAAM,aAAa,KAAK;EAAG,GAAG,MAAM,MAAM,aAAa,KAAK;CAAE;AAClF;;AAGA,SAAgB,gBAAgB,OAAkF;CAChH,MAAM,QAAQ,QAA4B,SAA6C,QAAQ,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,QAAQ,QAAQ,KAAA;CAC3I,OAAO;EAAE,aAAa,KAAK,MAAM,KAAK,MAAM,OAAO;EAAG,aAAa,KAAK,MAAM,KAAK,MAAM,OAAO;CAAE;AACpG;;AAGA,IAAa,kBAAkB,cAAsB,UAAU,QAAQ,qBAAqB,GAAG"}
1
+ {"version":3,"file":"query.cjs","names":[],"sources":["../../../../src/data/traces/otel/query.ts"],"sourcesContent":["import type { FilterBarDurationUnit, FilterBarDurationValue } from \"../../../components\";\nimport type { SearchValues } from \"./api\";\n\n// The pure side of the trace search bar: how its time range and duration\n// controls map onto the server's request (lookback, from/until and\n// minDuration/maxDuration), and how operations read.\n\n/** The server's minSpans that \"Hide single-span traces\" sets. */\nexport const MULTI_SPAN = 2;\n\nconst RELATIVE = /^now(?:-(\\d+)([smhdwMy]))?$/;\nconst UNIT_HOURS: Record<string, number> = { d: 24, w: 168, M: 720, y: 8760 };\nconst UNIT_MS: Record<string, number> = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5, M: 2592e6, y: 31536e6 };\n\n/** A relative offset as a Go duration: s, m and h as they are, longer units in hours. */\nfunction goDuration(count: number, unit: string): string {\n return unit in UNIT_HOURS ? `${count * UNIT_HOURS[unit]!}h` : `${count}${unit}`;\n}\n\n/** The time range control's value for a request: its lookback as now-<lookback>, or its from/until as they are. */\nexport function rangeOf(value: SearchValues): { from: string; to: string } {\n if (value.from || value.until) return { from: value.from ?? \"\", to: value.until ?? \"now\" };\n return { from: value.lookback ? `now-${value.lookback}` : \"\", to: \"now\" };\n}\n\n/** An instant of the range control as RFC3339: now-relative against now, or a date-time the browser reads. */\nfunction instant(text: string, now: number): string {\n const relative = RELATIVE.exec(text);\n if (relative) return new Date(now - (relative[1] ? Number(relative[1]) * UNIT_MS[relative[2]!]! : 0)).toISOString();\n const parsed = Date.parse(text);\n if (Number.isNaN(parsed)) throw new Error(`Could not read the time ${JSON.stringify(text)}: use now, an offset such as now-1h, or a date-time`);\n return new Date(parsed).toISOString();\n}\n\n/** The request's window for a range: a lookback when it ends now and starts now-relative, otherwise from/until as instants. */\nexport function windowOf(from: string, to: string, now: number): Pick<SearchValues, \"lookback\" | \"from\" | \"until\"> {\n const start = from.trim();\n const end = to.trim() || \"now\";\n const relative = RELATIVE.exec(start);\n if (end === \"now\" && (!start || (relative && relative[1]))) return { lookback: relative ? goDuration(Number(relative[1]), relative[2]!) : undefined, from: undefined, until: undefined };\n return { lookback: undefined, from: start ? instant(start, now) : undefined, until: end === \"now\" ? undefined : instant(end, now) };\n}\n\nconst DURATION = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h)$/;\n\nfunction bound(text: string | undefined, edge: \"min\" | \"max\"): FilterBarDurationValue {\n if (!text) return {};\n const match = DURATION.exec(text);\n if (!match) throw new Error(`${edge}Duration must be a number of ms, s, m or h, not ${JSON.stringify(text)}`);\n return { [edge]: match[1], [`${edge}Unit`]: match[2] as FilterBarDurationUnit };\n}\n\n/** The duration control's value for a request's minDuration and maxDuration. */\nexport function durationOf(value: SearchValues): FilterBarDurationValue {\n return { ...bound(value.minDuration, \"min\"), ...bound(value.maxDuration, \"max\") };\n}\n\n/** The request's minDuration and maxDuration for the duration control, a bare bound in milliseconds. */\nexport function durationRequest(value: FilterBarDurationValue): Pick<SearchValues, \"minDuration\" | \"maxDuration\"> {\n const edge = (amount: string | undefined, unit: FilterBarDurationUnit | undefined) => (amount?.trim() ? `${amount.trim()}${unit ?? \"ms\"}` : undefined);\n return { minDuration: edge(value.min, value.minUnit), maxDuration: edge(value.max, value.maxUnit) };\n}\n\n/** `invoke_agent /abs/path/.captain/prompts/jira/x.prompt` reads `invoke_agent jira/x.prompt`. */\nexport const shortOperation = (operation: string) => operation.replace(/ \\/\\S*\\/prompts\\//, \" \");\n\n/** A W3C (32 hex) or Jaeger 64-bit (16 hex) trace ID. */\nexport const isTraceId = (text: string) => /^[0-9a-f]{16}([0-9a-f]{16})?$/i.test(text.trim());\n"],"mappings":";AAUA,IAAM,WAAW;AACjB,IAAM,aAAqC;CAAE,GAAG;CAAI,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;AAC5E,IAAM,UAAkC;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;CAAM,GAAG;CAAO,GAAG;CAAQ,GAAG;CAAQ,GAAG;AAAQ;;AAG9G,SAAS,WAAW,OAAe,MAAsB;CACvD,OAAO,QAAQ,aAAa,GAAG,QAAQ,WAAW,MAAO,KAAK,GAAG,QAAQ;AAC3E;;AAGA,SAAgB,QAAQ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AAU,IAAI,GAAG;CAC5G,OAAO;GAAG,OAAO,MAAM;GAAK,GAAG,KAAK,QAAQ,MAAM;CAA4B;AAChF;;AAGA,SAAgB,WAAW,OAA6C;CACtE,OAAO;EAAE,GAAG,MAAM,MAAM,aAAa,KAAK;EAAG,GAAG,MAAM,MAAM,aAAa,KAAK;CAAE;AAClF;;AAGA,SAAgB,gBAAgB,OAAkF;CAChH,MAAM,QAAQ,QAA4B,SAA6C,QAAQ,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,QAAQ,SAAS,KAAA;CAC5I,OAAO;EAAE,aAAa,KAAK,MAAM,KAAK,MAAM,OAAO;EAAG,aAAa,KAAK,MAAM,KAAK,MAAM,OAAO;CAAE;AACpG;;AAGA,IAAa,kBAAkB,cAAsB,UAAU,QAAQ,qBAAqB,GAAG"}
@@ -11,7 +11,7 @@ export declare function rangeOf(value: SearchValues): {
11
11
  export declare function windowOf(from: string, to: string, now: number): Pick<SearchValues, "lookback" | "from" | "until">;
12
12
  /** The duration control's value for a request's minDuration and maxDuration. */
13
13
  export declare function durationOf(value: SearchValues): FilterBarDurationValue;
14
- /** The request's minDuration and maxDuration for the duration control, a bare bound in seconds. */
14
+ /** The request's minDuration and maxDuration for the duration control, a bare bound in milliseconds. */
15
15
  export declare function durationRequest(value: FilterBarDurationValue): Pick<SearchValues, "minDuration" | "maxDuration">;
16
16
  /** `invoke_agent /abs/path/.captain/prompts/jira/x.prompt` reads `invoke_agent jira/x.prompt`. */
17
17
  export declare const shortOperation: (operation: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/data/traces/otel/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAM1C,iEAAiE;AACjE,eAAO,MAAM,UAAU,IAAI,CAAC;AAW5B,mHAAmH;AACnH,wBAA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gB,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,sBAAsB,CAEtE;AAED,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,aAAa,CAAC,CAGhH;AAED,kGAAkG;AAClG,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,WAAgD,CAAC;AAEjG,yDAAyD;AACzD,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,YAAuD,CAAC"}
@@ -71,9 +71,9 @@ function durationOf(value) {
71
71
  ...bound(value.maxDuration, "max")
72
72
  };
73
73
  }
74
- /** The request's minDuration and maxDuration for the duration control, a bare bound in seconds. */
74
+ /** The request's minDuration and maxDuration for the duration control, a bare bound in milliseconds. */
75
75
  function durationRequest(value) {
76
- const edge = (amount, unit) => amount?.trim() ? `${amount.trim()}${unit ?? "s"}` : void 0;
76
+ const edge = (amount, unit) => amount?.trim() ? `${amount.trim()}${unit ?? "ms"}` : void 0;
77
77
  return {
78
78
  minDuration: edge(value.min, value.minUnit),
79
79
  maxDuration: edge(value.max, value.maxUnit)
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","names":[],"sources":["../../../../src/data/traces/otel/query.ts"],"sourcesContent":["import type { FilterBarDurationUnit, FilterBarDurationValue } from \"../../../components\";\nimport type { SearchValues } from \"./api\";\n\n// The pure side of the trace search bar: how its time range and duration\n// controls map onto the server's request (lookback, from/until and\n// minDuration/maxDuration), and how operations read.\n\n/** The server's minSpans that \"Hide single-span traces\" sets. */\nexport const MULTI_SPAN = 2;\n\nconst RELATIVE = /^now(?:-(\\d+)([smhdwMy]))?$/;\nconst UNIT_HOURS: Record<string, number> = { d: 24, w: 168, M: 720, y: 8760 };\nconst UNIT_MS: Record<string, number> = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5, M: 2592e6, y: 31536e6 };\n\n/** A relative offset as a Go duration: s, m and h as they are, longer units in hours. */\nfunction goDuration(count: number, unit: string): string {\n return unit in UNIT_HOURS ? `${count * UNIT_HOURS[unit]!}h` : `${count}${unit}`;\n}\n\n/** The time range control's value for a request: its lookback as now-<lookback>, or its from/until as they are. */\nexport function rangeOf(value: SearchValues): { from: string; to: string } {\n if (value.from || value.until) return { from: value.from ?? \"\", to: value.until ?? \"now\" };\n return { from: value.lookback ? `now-${value.lookback}` : \"\", to: \"now\" };\n}\n\n/** An instant of the range control as RFC3339: now-relative against now, or a date-time the browser reads. */\nfunction instant(text: string, now: number): string {\n const relative = RELATIVE.exec(text);\n if (relative) return new Date(now - (relative[1] ? Number(relative[1]) * UNIT_MS[relative[2]!]! : 0)).toISOString();\n const parsed = Date.parse(text);\n if (Number.isNaN(parsed)) throw new Error(`Could not read the time ${JSON.stringify(text)}: use now, an offset such as now-1h, or a date-time`);\n return new Date(parsed).toISOString();\n}\n\n/** The request's window for a range: a lookback when it ends now and starts now-relative, otherwise from/until as instants. */\nexport function windowOf(from: string, to: string, now: number): Pick<SearchValues, \"lookback\" | \"from\" | \"until\"> {\n const start = from.trim();\n const end = to.trim() || \"now\";\n const relative = RELATIVE.exec(start);\n if (end === \"now\" && (!start || (relative && relative[1]))) return { lookback: relative ? goDuration(Number(relative[1]), relative[2]!) : undefined, from: undefined, until: undefined };\n return { lookback: undefined, from: start ? instant(start, now) : undefined, until: end === \"now\" ? undefined : instant(end, now) };\n}\n\nconst DURATION = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h)$/;\n\nfunction bound(text: string | undefined, edge: \"min\" | \"max\"): FilterBarDurationValue {\n if (!text) return {};\n const match = DURATION.exec(text);\n if (!match) throw new Error(`${edge}Duration must be a number of ms, s, m or h, not ${JSON.stringify(text)}`);\n return { [edge]: match[1], [`${edge}Unit`]: match[2] as FilterBarDurationUnit };\n}\n\n/** The duration control's value for a request's minDuration and maxDuration. */\nexport function durationOf(value: SearchValues): FilterBarDurationValue {\n return { ...bound(value.minDuration, \"min\"), ...bound(value.maxDuration, \"max\") };\n}\n\n/** The request's minDuration and maxDuration for the duration control, a bare bound in seconds. */\nexport function durationRequest(value: FilterBarDurationValue): Pick<SearchValues, \"minDuration\" | \"maxDuration\"> {\n const edge = (amount: string | undefined, unit: FilterBarDurationUnit | undefined) => (amount?.trim() ? `${amount.trim()}${unit ?? \"s\"}` : undefined);\n return { minDuration: edge(value.min, value.minUnit), maxDuration: edge(value.max, value.maxUnit) };\n}\n\n/** `invoke_agent /abs/path/.captain/prompts/jira/x.prompt` reads `invoke_agent jira/x.prompt`. */\nexport const shortOperation = (operation: string) => operation.replace(/ \\/\\S*\\/prompts\\//, \" \");\n\n/** A W3C (32 hex) or Jaeger 64-bit (16 hex) trace ID. */\nexport const isTraceId = (text: string) => /^[0-9a-f]{16}([0-9a-f]{16})?$/i.test(text.trim());\n"],"mappings":";AAUA,IAAM,WAAW;AACjB,IAAM,aAAqC;CAAE,GAAG;CAAI,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;AAC5E,IAAM,UAAkC;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;CAAM,GAAG;CAAO,GAAG;CAAQ,GAAG;CAAQ,GAAG;AAAQ;;AAG9G,SAAS,WAAW,OAAe,MAAsB;CACvD,OAAO,QAAQ,aAAa,GAAG,QAAQ,WAAW,MAAO,KAAK,GAAG,QAAQ;AAC3E;;AAGA,SAAgB,QAAQ,OAAmD;CACzE,IAAI,MAAM,QAAQ,MAAM,OAAO,OAAO;EAAE,MAAM,MAAM,QAAQ;EAAI,IAAI,MAAM,SAAS;CAAM;CACzF,OAAO;EAAE,MAAM,MAAM,WAAW,OAAO,MAAM,aAAa;EAAI,IAAI;CAAM;AAC1E;;AAGA,SAAS,QAAQ,MAAc,KAAqB;CAClD,MAAM,WAAW,SAAS,KAAK,IAAI;CACnC,IAAI,UAAU,OAAO,IAAI,KAAK,OAAO,SAAS,KAAK,OAAO,SAAS,EAAE,IAAI,QAAQ,SAAS,MAAQ,EAAE,CAAC,CAAC,YAAY;CAClH,MAAM,SAAS,KAAK,MA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AAa,KAAK,MAAM,KAAK,MAAM,OAAO;CAAE;AACpG;;AAGA,IAAa,kBAAkB,cAAsB,UAAU,QAAQ,qBAAqB,GAAG"}
1
+ {"version":3,"file":"query.js","names":[],"sources":["../../../../src/data/traces/otel/query.ts"],"sourcesContent":["import type { FilterBarDurationUnit, FilterBarDurationValue } from \"../../../components\";\nimport type { SearchValues } from \"./api\";\n\n// The pure side of the trace search bar: how its time range and duration\n// controls map onto the server's request (lookback, from/until and\n// minDuration/maxDuration), and how operations read.\n\n/** The server's minSpans that \"Hide single-span traces\" sets. */\nexport const MULTI_SPAN = 2;\n\nconst RELATIVE = /^now(?:-(\\d+)([smhdwMy]))?$/;\nconst UNIT_HOURS: Record<string, number> = { d: 24, w: 168, M: 720, y: 8760 };\nconst UNIT_MS: Record<string, number> = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5, M: 2592e6, y: 31536e6 };\n\n/** A relative offset as a Go duration: s, m and h as they are, longer units in hours. */\nfunction goDuration(count: number, unit: string): string {\n return unit in UNIT_HOURS ? `${count * UNIT_HOURS[unit]!}h` : `${count}${unit}`;\n}\n\n/** The time range control's value for a request: its lookback as now-<lookback>, or its from/until as they are. */\nexport function rangeOf(value: SearchValues): { from: string; to: string } {\n if (value.from || value.until) return { from: value.from ?? \"\", to: value.until ?? \"now\" };\n return { from: value.lookback ? `now-${value.lookback}` : \"\", to: \"now\" };\n}\n\n/** An instant of the range control as RFC3339: now-relative against now, or a date-time the browser reads. */\nfunction instant(text: string, now: number): string {\n const relative = RELATIVE.exec(text);\n if (relative) return new Date(now - (relative[1] ? Number(relative[1]) * UNIT_MS[relative[2]!]! : 0)).toISOString();\n const parsed = Date.parse(text);\n if (Number.isNaN(parsed)) throw new Error(`Could not read the time ${JSON.stringify(text)}: use now, an offset such as now-1h, or a date-time`);\n return new Date(parsed).toISOString();\n}\n\n/** The request's window for a range: a lookback when it ends now and starts now-relative, otherwise from/until as instants. */\nexport function windowOf(from: string, to: string, now: number): Pick<SearchValues, \"lookback\" | \"from\" | \"until\"> {\n const start = from.trim();\n const end = to.trim() || \"now\";\n const relative = RELATIVE.exec(start);\n if (end === \"now\" && (!start || (relative && relative[1]))) return { lookback: relative ? goDuration(Number(relative[1]), relative[2]!) : undefined, from: undefined, until: undefined };\n return { lookback: undefined, from: start ? instant(start, now) : undefined, until: end === \"now\" ? undefined : instant(end, now) };\n}\n\nconst DURATION = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h)$/;\n\nfunction bound(text: string | undefined, edge: \"min\" | \"max\"): FilterBarDurationValue {\n if (!text) return {};\n const match = DURATION.exec(text);\n if (!match) throw new Error(`${edge}Duration must be a number of ms, s, m or h, not ${JSON.stringify(text)}`);\n return { [edge]: match[1], [`${edge}Unit`]: match[2] as FilterBarDurationUnit };\n}\n\n/** The duration control's value for a request's minDuration and maxDuration. */\nexport function durationOf(value: SearchValues): FilterBarDurationValue {\n return { ...bound(value.minDuration, \"min\"), ...bound(value.maxDuration, \"max\") };\n}\n\n/** The request's minDuration and maxDuration for the duration control, a bare bound in milliseconds. */\nexport function durationRequest(value: FilterBarDurationValue): Pick<SearchValues, \"minDuration\" | \"maxDuration\"> {\n const edge = (amount: string | undefined, unit: FilterBarDurationUnit | undefined) => (amount?.trim() ? `${amount.trim()}${unit ?? \"ms\"}` : undefined);\n return { minDuration: edge(value.min, value.minUnit), maxDuration: edge(value.max, value.maxUnit) };\n}\n\n/** `invoke_agent /abs/path/.captain/prompts/jira/x.prompt` reads `invoke_agent jira/x.prompt`. */\nexport const shortOperation = (operation: string) => operation.replace(/ \\/\\S*\\/prompts\\//, \" \");\n\n/** A W3C (32 hex) or Jaeger 64-bit (16 hex) trace ID. */\nexport const isTraceId = (text: string) => /^[0-9a-f]{16}([0-9a-f]{16})?$/i.test(text.trim());\n"],"mappings":";AAUA,IAAM,WAAW;AACjB,IAAM,aAAqC;CAAE,GAAG;CAAI,GAAG;CAAK,GAAG;CAAK,GAAG;AAAK;AAC5E,IAAM,UAAkC;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AQ,KAAK,GAAG;CAAE;AACpI;AAEA,IAAM,WAAW;AAEjB,SAAS,MAAM,MAA0B,MAA6C;CACpF,IAAI,CAAC,MAAM,OAAO,CAAC;CACnB,MAAM,QAAQ,SAAS,KAAK,IAAI;CAChC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,GAAG,KAAK,kDAAkD,KAAK,UAAU,IAAI,GAAG;CAC5G,OAAO;GAAG,OAAO,MAAM;GAAK,GAAG,KAAK,QAAQ,MAAM;CAA4B;AAChF;;AAGA,SAAgB,WAAW,OAA6C;CACtE,OAAO;EAAE,GAAG,MAAM,MAAM,aAAa,KAAK;EAAG,GAAG,MAAM,MAAM,aAAa,KAAK;CAAE;AAClF;;AAGA,SAAgB,gBAAgB,OAAkF;CAChH,MAAM,QAAQ,QAA4B,SAA6C,QAAQ,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,QAAQ,SAAS,KAAA;CAC5I,OAAO;EAAE,aAAa,KAAK,MAAM,KAAK,MAAM,OAAO;EAAG,aAAa,KAAK,MAAM,KAAK,MAAM,OAAO;CAAE;AACpG;;AAGA,IAAa,kBAAkB,cAAsB,UAAU,QAAQ,qBAAqB,GAAG"}
@@ -14,9 +14,9 @@ function detectMode() {
14
14
  /** Resolve build + runtime version metadata. */
15
15
  function getVersionInfo() {
16
16
  return {
17
- commit: read(() => "0915ca6e7", ""),
18
- tag: read(() => "page-runtime@0.1.9", ""),
19
- date: read(() => "2026-12-01T16:51:05.321Z", ""),
17
+ commit: read(() => "78e346a1b", ""),
18
+ tag: read(() => "page-runtime-build@0.1.2", ""),
19
+ date: read(() => "2026-12-02T04:34:47.563Z", ""),
20
20
  dirty: read(() => true, false),
21
21
  mode: detectMode()
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"version-info.cjs","names":[],"sources":["../../src/data/version-info.ts"],"sourcesContent":["// Build-time constants injected by Vite `define` (see packages/ui/vite.config.ts).\n// They are absent in dev (Vite serves source without the library build), so every\n// read falls back to a runtime-safe default.\ndeclare const __CLICKY_COMMIT__: string;\ndeclare const __CLICKY_TAG__: string;\ndeclare const __CLICKY_DATE__: string;\ndeclare const __CLICKY_DIRTY__: boolean;\n\nfunction read<T>(getter: () => T, fallback: T): T {\n try {\n return getter();\n } catch {\n return fallback;\n }\n}\n\nexport type RuntimeMode = \"production\" | \"dev\" | \"storybook\";\n\nexport interface VersionInfo {\n commit: string;\n tag: string;\n date: string;\n dirty: boolean;\n mode: RuntimeMode;\n}\n\nfunction detectMode(): RuntimeMode {\n if (read(() => Boolean((import.meta as ImportMeta).env?.STORYBOOK), false)) return \"storybook\";\n if (read(() => Boolean((import.meta as ImportMeta).env?.DEV), false)) return \"dev\";\n return \"production\";\n}\n\n/** Resolve build + runtime version metadata. */\nexport function getVersionInfo(): VersionInfo {\n return {\n commit: read(() => __CLICKY_COMMIT__, \"\"),\n tag: read(() => __CLICKY_TAG__, \"\"),\n date: read(() => __CLICKY_DATE__, \"\"),\n dirty: read(() => __CLICKY_DIRTY__, false),\n mode: detectMode(),\n };\n}\n"],"mappings":";AAQA,SAAS,KAAQ,QAAiB,UAAgB;CAChD,IAAI;EACF,OAAO,OAAO;CAChB,QAAQ;EACN,OAAO;CACT;AACF;AAYA,SAAS,aAA0B;CACjC,IAAI,WAAW,QAAA,KAAA,CAAkD,GAAG,KAAK,GAAG,OAAO;CACnF,IAAI,WAAW,QAAA,KAA4C,GAAG,KAAK,GAAG,OAAO;CAC7E,OAAO;AACT;;AAGA,SAAgB,iBAA8B;CAC5C,OAAO;EACL,QAAQ,WAAA,aAA8B,EAAE;EACxC,KAAK,WAAA,sBAA2B,EAAE;EAClC,MAAM,WAAA,4BAA4B,EAAE;EACpC,OAAO,WAAA,MAA6B,KAAK;EACzC,MAAM,WAAW;CACnB;AACF"}
1
+ {"version":3,"file":"version-info.cjs","names":[],"sources":["../../src/data/version-info.ts"],"sourcesContent":["// Build-time constants injected by Vite `define` (see packages/ui/vite.config.ts).\n// They are absent in dev (Vite serves source without the library build), so every\n// read falls back to a runtime-safe default.\ndeclare const __CLICKY_COMMIT__: string;\ndeclare const __CLICKY_TAG__: string;\ndeclare const __CLICKY_DATE__: string;\ndeclare const __CLICKY_DIRTY__: boolean;\n\nfunction read<T>(getter: () => T, fallback: T): T {\n try {\n return getter();\n } catch {\n return fallback;\n }\n}\n\nexport type RuntimeMode = \"production\" | \"dev\" | \"storybook\";\n\nexport interface VersionInfo {\n commit: string;\n tag: string;\n date: string;\n dirty: boolean;\n mode: RuntimeMode;\n}\n\nfunction detectMode(): RuntimeMode {\n if (read(() => Boolean((import.meta as ImportMeta).env?.STORYBOOK), false)) return \"storybook\";\n if (read(() => Boolean((import.meta as ImportMeta).env?.DEV), false)) return \"dev\";\n return \"production\";\n}\n\n/** Resolve build + runtime version metadata. */\nexport function getVersionInfo(): VersionInfo {\n return {\n commit: read(() => __CLICKY_COMMIT__, \"\"),\n tag: read(() => __CLICKY_TAG__, \"\"),\n date: read(() => __CLICKY_DATE__, \"\"),\n dirty: read(() => __CLICKY_DIRTY__, false),\n mode: detectMode(),\n };\n}\n"],"mappings":";AAQA,SAAS,KAAQ,QAAiB,UAAgB;CAChD,IAAI;EACF,OAAO,OAAO;CAChB,QAAQ;EACN,OAAO;CACT;AACF;AAYA,SAAS,aAA0B;CACjC,IAAI,WAAW,QAAA,KAAA,CAAkD,GAAG,KAAK,GAAG,OAAO;CACnF,IAAI,WAAW,QAAA,KAA4C,GAAG,KAAK,GAAG,OAAO;CAC7E,OAAO;AACT;;AAGA,SAAgB,iBAA8B;CAC5C,OAAO;EACL,QAAQ,WAAA,aAA8B,EAAE;EACxC,KAAK,WAAA,4BAA2B,EAAE;EAClC,MAAM,WAAA,4BAA4B,EAAE;EACpC,OAAO,WAAA,MAA6B,KAAK;EACzC,MAAM,WAAW;CACnB;AACF"}
@@ -14,9 +14,9 @@ function detectMode() {
14
14
  /** Resolve build + runtime version metadata. */
15
15
  function getVersionInfo() {
16
16
  return {
17
- commit: read(() => "0915ca6e7", ""),
18
- tag: read(() => "page-runtime@0.1.9", ""),
19
- date: read(() => "2026-12-01T16:50:33.030Z", ""),
17
+ commit: read(() => "78e346a1b", ""),
18
+ tag: read(() => "page-runtime-build@0.1.2", ""),
19
+ date: read(() => "2026-12-02T04:34:14.657Z", ""),
20
20
  dirty: read(() => true, false),
21
21
  mode: detectMode()
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"version-info.js","names":[],"sources":["../../src/data/version-info.ts"],"sourcesContent":["// Build-time constants injected by Vite `define` (see packages/ui/vite.config.ts).\n// They are absent in dev (Vite serves source without the library build), so every\n// read falls back to a runtime-safe default.\ndeclare const __CLICKY_COMMIT__: string;\ndeclare const __CLICKY_TAG__: string;\ndeclare const __CLICKY_DATE__: string;\ndeclare const __CLICKY_DIRTY__: boolean;\n\nfunction read<T>(getter: () => T, fallback: T): T {\n try {\n return getter();\n } catch {\n return fallback;\n }\n}\n\nexport type RuntimeMode = \"production\" | \"dev\" | \"storybook\";\n\nexport interface VersionInfo {\n commit: string;\n tag: string;\n date: string;\n dirty: boolean;\n mode: RuntimeMode;\n}\n\nfunction detectMode(): RuntimeMode {\n if (read(() => Boolean((import.meta as ImportMeta).env?.STORYBOOK), false)) return \"storybook\";\n if (read(() => Boolean((import.meta as ImportMeta).env?.DEV), false)) return \"dev\";\n return \"production\";\n}\n\n/** Resolve build + runtime version metadata. */\nexport function getVersionInfo(): VersionInfo {\n return {\n commit: read(() => __CLICKY_COMMIT__, \"\"),\n tag: read(() => __CLICKY_TAG__, \"\"),\n date: read(() => __CLICKY_DATE__, \"\"),\n dirty: read(() => __CLICKY_DIRTY__, false),\n mode: detectMode(),\n };\n}\n"],"mappings":";AAQA,SAAS,KAAQ,QAAiB,UAAgB;CAChD,IAAI;EACF,OAAO,OAAO;CAChB,QAAQ;EACN,OAAO;CACT;AACF;AAYA,SAAS,aAA0B;CACjC,IAAI,WAAW,QAAA,KAAA,CAAkD,GAAG,KAAK,GAAG,OAAO;CACnF,IAAI,WAAW,QAAA,KAA4C,GAAG,KAAK,GAAG,OAAO;CAC7E,OAAO;AACT;;AAGA,SAAgB,iBAA8B;CAC5C,OAAO;EACL,QAAQ,WAAA,aAA8B,EAAE;EACxC,KAAK,WAAA,sBAA2B,EAAE;EAClC,MAAM,WAAA,4BAA4B,EAAE;EACpC,OAAO,WAAA,MAA6B,KAAK;EACzC,MAAM,WAAW;CACnB;AACF"}
1
+ {"version":3,"file":"version-info.js","names":[],"sources":["../../src/data/version-info.ts"],"sourcesContent":["// Build-time constants injected by Vite `define` (see packages/ui/vite.config.ts).\n// They are absent in dev (Vite serves source without the library build), so every\n// read falls back to a runtime-safe default.\ndeclare const __CLICKY_COMMIT__: string;\ndeclare const __CLICKY_TAG__: string;\ndeclare const __CLICKY_DATE__: string;\ndeclare const __CLICKY_DIRTY__: boolean;\n\nfunction read<T>(getter: () => T, fallback: T): T {\n try {\n return getter();\n } catch {\n return fallback;\n }\n}\n\nexport type RuntimeMode = \"production\" | \"dev\" | \"storybook\";\n\nexport interface VersionInfo {\n commit: string;\n tag: string;\n date: string;\n dirty: boolean;\n mode: RuntimeMode;\n}\n\nfunction detectMode(): RuntimeMode {\n if (read(() => Boolean((import.meta as ImportMeta).env?.STORYBOOK), false)) return \"storybook\";\n if (read(() => Boolean((import.meta as ImportMeta).env?.DEV), false)) return \"dev\";\n return \"production\";\n}\n\n/** Resolve build + runtime version metadata. */\nexport function getVersionInfo(): VersionInfo {\n return {\n commit: read(() => __CLICKY_COMMIT__, \"\"),\n tag: read(() => __CLICKY_TAG__, \"\"),\n date: read(() => __CLICKY_DATE__, \"\"),\n dirty: read(() => __CLICKY_DIRTY__, false),\n mode: detectMode(),\n };\n}\n"],"mappings":";AAQA,SAAS,KAAQ,QAAiB,UAAgB;CAChD,IAAI;EACF,OAAO,OAAO;CAChB,QAAQ;EACN,OAAO;CACT;AACF;AAYA,SAAS,aAA0B;CACjC,IAAI,WAAW,QAAA,KAAA,CAAkD,GAAG,KAAK,GAAG,OAAO;CACnF,IAAI,WAAW,QAAA,KAA4C,GAAG,KAAK,GAAG,OAAO;CAC7E,OAAO;AACT;;AAGA,SAAgB,iBAA8B;CAC5C,OAAO;EACL,QAAQ,WAAA,aAA8B,EAAE;EACxC,KAAK,WAAA,4BAA2B,EAAE;EAClC,MAAM,WAAA,4BAA4B,EAAE;EACpC,OAAO,WAAA,MAA6B,KAAK;EACzC,MAAM,WAAW;CACnB;AACF"}
@@ -2,17 +2,51 @@ const require_ProgressBar = require("../ProgressBar.cjs");
2
2
  const require_format = require("../../lib/format.cjs");
3
3
  const require_utils = require("../../lib/utils.cjs");
4
4
  const require_model = require("./model.cjs");
5
+ let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  // src/data/workload-panel/MemoryStack.tsx
8
+ var LABEL_INSET_PX = 8;
9
+ /**
10
+ * Whether the usage label fits inside the filled part of the bar. When it doesn't, the label is
11
+ * pushed past the filled end so it stays readable on the track instead of spilling out in white.
12
+ * Unmeasurable layouts (no layout engine) count as fitting.
13
+ */
14
+ function useLabelFit(usedFraction) {
15
+ const barRef = (0, react.useRef)(null);
16
+ const labelRef = (0, react.useRef)(null);
17
+ const [fits, setFits] = (0, react.useState)(true);
18
+ (0, react.useLayoutEffect)(() => {
19
+ const bar = barRef.current;
20
+ const labelEl = labelRef.current;
21
+ if (!bar || !labelEl) return;
22
+ const measure = () => {
23
+ const needed = labelEl.offsetWidth + 16;
24
+ setFits(needed === 16 || needed <= bar.offsetWidth * usedFraction);
25
+ };
26
+ measure();
27
+ if (typeof ResizeObserver === "undefined") return;
28
+ const observer = new ResizeObserver(measure);
29
+ observer.observe(bar);
30
+ return () => observer.disconnect();
31
+ }, [usedFraction]);
32
+ return {
33
+ barRef,
34
+ labelRef,
35
+ fits
36
+ };
37
+ }
7
38
  function WorkloadMemoryStack({ label, memory, jvm, part = "all", className }) {
8
39
  const { segments, usage, scale } = require_model.memorySegments({
9
40
  memory,
10
41
  jvm,
11
42
  part
12
43
  });
44
+ const usedFraction = scale > 0 ? Math.min(usage / scale, 1) : 0;
45
+ const { barRef, labelRef, fits } = useLabelFit(usedFraction);
13
46
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14
47
  className: require_utils.cn("flex min-w-0 items-center gap-3 py-1 text-xs tabular-nums", className),
15
48
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
49
+ ref: barRef,
16
50
  className: "relative min-w-0 flex-1",
17
51
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProgressBar.ProgressBar, {
18
52
  label,
@@ -22,7 +56,10 @@ function WorkloadMemoryStack({ label, memory, jvm, part = "all", className }) {
22
56
  height: "h-6",
23
57
  className: "rounded-md"
24
58
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
25
- className: "pointer-events-none absolute inset-y-0 left-2 flex items-center font-medium text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]",
59
+ ref: labelRef,
60
+ "data-fits": fits,
61
+ className: require_utils.cn("pointer-events-none absolute inset-y-0 flex items-center whitespace-nowrap font-medium", fits ? "left-2 text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]" : "text-foreground"),
62
+ style: fits ? void 0 : { left: `calc(${usedFraction * 100}% + ${LABEL_INSET_PX}px)` },
26
63
  children: require_format.formatBytes(usage)
27
64
  })]
28
65
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryStack.cjs","names":["memorySegments","cn","ProgressBar","formatBytes","memoryRegions","nativeMemoryRegion"],"sources":["../../../src/data/workload-panel/MemoryStack.tsx"],"sourcesContent":["import { ProgressBar } from \"../ProgressBar\";\nimport { formatBytes } from \"../../lib/format\";\nimport { cn } from \"../../lib/utils\";\nimport { memoryRegions, memorySegments, nativeMemoryRegion } from \"./model\";\nimport type {\n WorkloadJvmStatistics,\n WorkloadMemoryPart,\n WorkloadResourceStatistics,\n} from \"./types\";\n\nexport interface WorkloadMemoryStackProps {\n label: string;\n memory: WorkloadResourceStatistics;\n jvm: Pick<WorkloadJvmStatistics, \"heap\" | \"regions\">;\n part?: WorkloadMemoryPart;\n className?: string;\n}\n\nexport function WorkloadMemoryStack({\n label,\n memory,\n jvm,\n part = \"all\",\n className,\n}: WorkloadMemoryStackProps) {\n const { segments, usage, scale } = memorySegments({ memory, jvm, part });\n return (\n <div\n className={cn(\n \"flex min-w-0 items-center gap-3 py-1 text-xs tabular-nums\",\n className,\n )}\n >\n <div className=\"relative min-w-0 flex-1\">\n <ProgressBar\n label={label}\n segments={segments}\n total={scale}\n formatValue={formatBytes}\n height=\"h-6\"\n className=\"rounded-md\"\n />\n <span className=\"pointer-events-none absolute inset-y-0 left-2 flex items-center font-medium text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]\">\n {formatBytes(usage)}\n </span>\n </div>\n <span className=\"shrink-0 text-muted-foreground\">\n {formatBytes(scale)}\n </span>\n </div>\n );\n}\n\nexport function WorkloadMemoryLegend() {\n return (\n <div className=\"flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted-foreground\">\n {[...memoryRegions, nativeMemoryRegion].map(({ label, color }) => (\n <span key={label} className=\"inline-flex items-center gap-1.5\">\n <span\n className=\"h-2.5 w-2.5 rounded-sm\"\n style={{ backgroundColor: color }}\n />\n {label}\n </span>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,oBAAoB,EAClC,OACA,QACA,KACA,OAAO,OACP,aAC2B;CAC3B,MAAM,EAAE,UAAU,OAAO,UAAUA,cAAAA,eAAe;EAAE;EAAQ;EAAK;CAAK,CAAC;CACvE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,WAAWC,cAAAA,GACT,6DACA,SACF;EAJF,UAAA,CAME,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,aAAD;IACS;IACG;IACV,OAAO;IACP,aAAaC,eAAAA;IACb,QAAO;IACP,WAAU;GACX,CAAA,GACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IACb,UAAAA,eAAAA,YAAY,KAAK;GACd,CAAA,CACH;EACL,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GACb,UAAAA,eAAAA,YAAY,KAAK;EACd,CAAA,CACH;;AAET;AAEA,SAAgB,uBAAuB;CACrC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACZ,UAAA,CAAC,GAAGC,cAAAA,eAAeC,cAAAA,kBAAkB,CAAC,CAAC,KAAK,EAAE,OAAO,YACpD,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;GAAkB,WAAU;GAA5B,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,MAAM;GACjC,CAAA,GACA,KACG;EANK,GAAA,KAML,CACP;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"MemoryStack.cjs","names":["useRef","useState","memorySegments","cn","ProgressBar","formatBytes","memoryRegions","nativeMemoryRegion"],"sources":["../../../src/data/workload-panel/MemoryStack.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\";\nimport { ProgressBar } from \"../ProgressBar\";\nimport { formatBytes } from \"../../lib/format\";\nimport { cn } from \"../../lib/utils\";\nimport { memoryRegions, memorySegments, nativeMemoryRegion } from \"./model\";\nimport type {\n WorkloadJvmStatistics,\n WorkloadMemoryPart,\n WorkloadResourceStatistics,\n} from \"./types\";\n\nconst LABEL_INSET_PX = 8;\n\n/**\n * Whether the usage label fits inside the filled part of the bar. When it doesn't, the label is\n * pushed past the filled end so it stays readable on the track instead of spilling out in white.\n * Unmeasurable layouts (no layout engine) count as fitting.\n */\nfunction useLabelFit(usedFraction: number) {\n const barRef = useRef<HTMLDivElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const [fits, setFits] = useState(true);\n useLayoutEffect(() => {\n const bar = barRef.current;\n const labelEl = labelRef.current;\n if (!bar || !labelEl) return;\n const measure = () => {\n const needed = labelEl.offsetWidth + LABEL_INSET_PX * 2;\n setFits(needed === LABEL_INSET_PX * 2 || needed <= bar.offsetWidth * usedFraction);\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(bar);\n return () => observer.disconnect();\n }, [usedFraction]);\n return { barRef, labelRef, fits };\n}\n\nexport interface WorkloadMemoryStackProps {\n label: string;\n memory: WorkloadResourceStatistics;\n jvm: Pick<WorkloadJvmStatistics, \"heap\" | \"regions\">;\n part?: WorkloadMemoryPart;\n className?: string;\n}\n\nexport function WorkloadMemoryStack({\n label,\n memory,\n jvm,\n part = \"all\",\n className,\n}: WorkloadMemoryStackProps) {\n const { segments, usage, scale } = memorySegments({ memory, jvm, part });\n const usedFraction = scale > 0 ? Math.min(usage / scale, 1) : 0;\n const { barRef, labelRef, fits } = useLabelFit(usedFraction);\n return (\n <div\n className={cn(\n \"flex min-w-0 items-center gap-3 py-1 text-xs tabular-nums\",\n className,\n )}\n >\n <div ref={barRef} className=\"relative min-w-0 flex-1\">\n <ProgressBar\n label={label}\n segments={segments}\n total={scale}\n formatValue={formatBytes}\n height=\"h-6\"\n className=\"rounded-md\"\n />\n <span\n ref={labelRef}\n data-fits={fits}\n className={cn(\n \"pointer-events-none absolute inset-y-0 flex items-center whitespace-nowrap font-medium\",\n fits\n ? \"left-2 text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]\"\n : \"text-foreground\",\n )}\n style={fits ? undefined : { left: `calc(${usedFraction * 100}% + ${LABEL_INSET_PX}px)` }}\n >\n {formatBytes(usage)}\n </span>\n </div>\n <span className=\"shrink-0 text-muted-foreground\">\n {formatBytes(scale)}\n </span>\n </div>\n );\n}\n\nexport function WorkloadMemoryLegend() {\n return (\n <div className=\"flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted-foreground\">\n {[...memoryRegions, nativeMemoryRegion].map(({ label, color }) => (\n <span key={label} className=\"inline-flex items-center gap-1.5\">\n <span\n className=\"h-2.5 w-2.5 rounded-sm\"\n style={{ backgroundColor: color }}\n />\n {label}\n </span>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAWA,IAAM,iBAAiB;;;;;;AAOvB,SAAS,YAAY,cAAsB;CACzC,MAAM,UAAA,GAASA,MAAAA,OAAAA,CAAuB,IAAI;CAC1C,MAAM,YAAA,GAAWA,MAAAA,OAAAA,CAAwB,IAAI;CAC7C,MAAM,CAAC,MAAM,YAAA,GAAWC,MAAAA,SAAAA,CAAS,IAAI;CACrC,CAAA,GAAA,MAAA,gBAAA,OAAsB;EACpB,MAAM,MAAM,OAAO;EACnB,MAAM,UAAU,SAAS;EACzB,IAAI,CAAC,OAAO,CAAC,SAAS;EACtB,MAAM,gBAAgB;GACpB,MAAM,SAAS,QAAQ,cAAc;GACrC,QAAQ,WAAW,MAAsB,UAAU,IAAI,cAAc,YAAY;EACnF;EACA,QAAQ;EACR,IAAI,OAAO,mBAAmB,aAAa;EAC3C,MAAM,WAAW,IAAI,eAAe,OAAO;EAC3C,SAAS,QAAQ,GAAG;EACpB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,YAAY,CAAC;CACjB,OAAO;EAAE;EAAQ;EAAU;CAAK;AAClC;AAUA,SAAgB,oBAAoB,EAClC,OACA,QACA,KACA,OAAO,OACP,aAC2B;CAC3B,MAAM,EAAE,UAAU,OAAO,UAAUC,cAAAA,eAAe;EAAE;EAAQ;EAAK;CAAK,CAAC;CACvE,MAAM,eAAe,QAAQ,IAAI,KAAK,IAAI,QAAQ,OAAO,CAAC,IAAI;CAC9D,MAAM,EAAE,QAAQ,UAAU,SAAS,YAAY,YAAY;CAC3D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EACE,WAAWC,cAAAA,GACT,6DACA,SACF;EAJF,UAAA,CAME,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,KAAK;GAAQ,WAAU;GAA5B,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,aAAD;IACS;IACG;IACV,OAAO;IACP,aAAaC,eAAAA;IACb,QAAO;IACP,WAAU;GACX,CAAA,GACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IACE,KAAK;IACL,aAAW;IACX,WAAWF,cAAAA,GACT,0FACA,OACI,4DACA,iBACN;IACA,OAAO,OAAO,KAAA,IAAY,EAAE,MAAM,QAAQ,eAAe,IAAI,MAAM,eAAe,KAAK;IAEtF,UAAAE,eAAAA,YAAY,KAAK;GACd,CAAA,CACH;EACL,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAU;GACb,UAAAA,eAAAA,YAAY,KAAK;EACd,CAAA,CACH;;AAET;AAEA,SAAgB,uBAAuB;CACrC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACZ,UAAA,CAAC,GAAGC,cAAAA,eAAeC,cAAAA,kBAAkB,CAAC,CAAC,KAAK,EAAE,OAAO,YACpD,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;GAAkB,WAAU;GAA5B,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,MAAM;GACjC,CAAA,GACA,KACG;EANK,GAAA,KAML,CACP;CACE,CAAA;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryStack.d.ts","sourceRoot":"","sources":["../../../src/data/workload-panel/MemoryStack.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,0BAA0B,CAAC;IACnC,GAAG,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAY,EACZ,SAAS,GACV,EAAE,wBAAwB,+BA2B1B;AAED,wBAAgB,oBAAoB,gCAcnC"}
1
+ {"version":3,"file":"MemoryStack.d.ts","sourceRoot":"","sources":["../../../src/data/workload-panel/MemoryStack.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AA8BjB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,0BAA0B,CAAC;IACnC,GAAG,EAAE,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAY,EACZ,SAAS,GACV,EAAE,wBAAwB,+BAuC1B;AAED,wBAAgB,oBAAoB,gCAcnC"}
@@ -2,17 +2,51 @@ import { ProgressBar } from "../ProgressBar.js";
2
2
  import { formatBytes } from "../../lib/format.js";
3
3
  import { cn } from "../../lib/utils.js";
4
4
  import { memoryRegions, memorySegments, nativeMemoryRegion } from "./model.js";
5
+ import { useLayoutEffect, useRef, useState } from "react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  // src/data/workload-panel/MemoryStack.tsx
8
+ var LABEL_INSET_PX = 8;
9
+ /**
10
+ * Whether the usage label fits inside the filled part of the bar. When it doesn't, the label is
11
+ * pushed past the filled end so it stays readable on the track instead of spilling out in white.
12
+ * Unmeasurable layouts (no layout engine) count as fitting.
13
+ */
14
+ function useLabelFit(usedFraction) {
15
+ const barRef = useRef(null);
16
+ const labelRef = useRef(null);
17
+ const [fits, setFits] = useState(true);
18
+ useLayoutEffect(() => {
19
+ const bar = barRef.current;
20
+ const labelEl = labelRef.current;
21
+ if (!bar || !labelEl) return;
22
+ const measure = () => {
23
+ const needed = labelEl.offsetWidth + 16;
24
+ setFits(needed === 16 || needed <= bar.offsetWidth * usedFraction);
25
+ };
26
+ measure();
27
+ if (typeof ResizeObserver === "undefined") return;
28
+ const observer = new ResizeObserver(measure);
29
+ observer.observe(bar);
30
+ return () => observer.disconnect();
31
+ }, [usedFraction]);
32
+ return {
33
+ barRef,
34
+ labelRef,
35
+ fits
36
+ };
37
+ }
7
38
  function WorkloadMemoryStack({ label, memory, jvm, part = "all", className }) {
8
39
  const { segments, usage, scale } = memorySegments({
9
40
  memory,
10
41
  jvm,
11
42
  part
12
43
  });
44
+ const usedFraction = scale > 0 ? Math.min(usage / scale, 1) : 0;
45
+ const { barRef, labelRef, fits } = useLabelFit(usedFraction);
13
46
  return /* @__PURE__ */ jsxs("div", {
14
47
  className: cn("flex min-w-0 items-center gap-3 py-1 text-xs tabular-nums", className),
15
48
  children: [/* @__PURE__ */ jsxs("div", {
49
+ ref: barRef,
16
50
  className: "relative min-w-0 flex-1",
17
51
  children: [/* @__PURE__ */ jsx(ProgressBar, {
18
52
  label,
@@ -22,7 +56,10 @@ function WorkloadMemoryStack({ label, memory, jvm, part = "all", className }) {
22
56
  height: "h-6",
23
57
  className: "rounded-md"
24
58
  }), /* @__PURE__ */ jsx("span", {
25
- className: "pointer-events-none absolute inset-y-0 left-2 flex items-center font-medium text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]",
59
+ ref: labelRef,
60
+ "data-fits": fits,
61
+ className: cn("pointer-events-none absolute inset-y-0 flex items-center whitespace-nowrap font-medium", fits ? "left-2 text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]" : "text-foreground"),
62
+ style: fits ? void 0 : { left: `calc(${usedFraction * 100}% + ${LABEL_INSET_PX}px)` },
26
63
  children: formatBytes(usage)
27
64
  })]
28
65
  }), /* @__PURE__ */ jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"MemoryStack.js","names":[],"sources":["../../../src/data/workload-panel/MemoryStack.tsx"],"sourcesContent":["import { ProgressBar } from \"../ProgressBar\";\nimport { formatBytes } from \"../../lib/format\";\nimport { cn } from \"../../lib/utils\";\nimport { memoryRegions, memorySegments, nativeMemoryRegion } from \"./model\";\nimport type {\n WorkloadJvmStatistics,\n WorkloadMemoryPart,\n WorkloadResourceStatistics,\n} from \"./types\";\n\nexport interface WorkloadMemoryStackProps {\n label: string;\n memory: WorkloadResourceStatistics;\n jvm: Pick<WorkloadJvmStatistics, \"heap\" | \"regions\">;\n part?: WorkloadMemoryPart;\n className?: string;\n}\n\nexport function WorkloadMemoryStack({\n label,\n memory,\n jvm,\n part = \"all\",\n className,\n}: WorkloadMemoryStackProps) {\n const { segments, usage, scale } = memorySegments({ memory, jvm, part });\n return (\n <div\n className={cn(\n \"flex min-w-0 items-center gap-3 py-1 text-xs tabular-nums\",\n className,\n )}\n >\n <div className=\"relative min-w-0 flex-1\">\n <ProgressBar\n label={label}\n segments={segments}\n total={scale}\n formatValue={formatBytes}\n height=\"h-6\"\n className=\"rounded-md\"\n />\n <span className=\"pointer-events-none absolute inset-y-0 left-2 flex items-center font-medium text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]\">\n {formatBytes(usage)}\n </span>\n </div>\n <span className=\"shrink-0 text-muted-foreground\">\n {formatBytes(scale)}\n </span>\n </div>\n );\n}\n\nexport function WorkloadMemoryLegend() {\n return (\n <div className=\"flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted-foreground\">\n {[...memoryRegions, nativeMemoryRegion].map(({ label, color }) => (\n <span key={label} className=\"inline-flex items-center gap-1.5\">\n <span\n className=\"h-2.5 w-2.5 rounded-sm\"\n style={{ backgroundColor: color }}\n />\n {label}\n </span>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,oBAAoB,EAClC,OACA,QACA,KACA,OAAO,OACP,aAC2B;CAC3B,MAAM,EAAE,UAAU,OAAO,UAAU,eAAe;EAAE;EAAQ;EAAK;CAAK,CAAC;CACvE,OACE,qBAAC,OAAD;EACE,WAAW,GACT,6DACA,SACF;EAJF,UAAA,CAME,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,aAAD;IACS;IACG;IACV,OAAO;IACP,aAAa;IACb,QAAO;IACP,WAAU;GACX,CAAA,GACD,oBAAC,QAAD;IAAM,WAAU;IACb,UAAA,YAAY,KAAK;GACd,CAAA,CACH;EACL,CAAA,GAAA,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA,YAAY,KAAK;EACd,CAAA,CACH;;AAET;AAEA,SAAgB,uBAAuB;CACrC,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,CAAC,GAAG,eAAe,kBAAkB,CAAC,CAAC,KAAK,EAAE,OAAO,YACpD,qBAAC,QAAD;GAAkB,WAAU;GAA5B,UAAA,CACE,oBAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,MAAM;GACjC,CAAA,GACA,KACG;EANK,GAAA,KAML,CACP;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"MemoryStack.js","names":[],"sources":["../../../src/data/workload-panel/MemoryStack.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\";\nimport { ProgressBar } from \"../ProgressBar\";\nimport { formatBytes } from \"../../lib/format\";\nimport { cn } from \"../../lib/utils\";\nimport { memoryRegions, memorySegments, nativeMemoryRegion } from \"./model\";\nimport type {\n WorkloadJvmStatistics,\n WorkloadMemoryPart,\n WorkloadResourceStatistics,\n} from \"./types\";\n\nconst LABEL_INSET_PX = 8;\n\n/**\n * Whether the usage label fits inside the filled part of the bar. When it doesn't, the label is\n * pushed past the filled end so it stays readable on the track instead of spilling out in white.\n * Unmeasurable layouts (no layout engine) count as fitting.\n */\nfunction useLabelFit(usedFraction: number) {\n const barRef = useRef<HTMLDivElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const [fits, setFits] = useState(true);\n useLayoutEffect(() => {\n const bar = barRef.current;\n const labelEl = labelRef.current;\n if (!bar || !labelEl) return;\n const measure = () => {\n const needed = labelEl.offsetWidth + LABEL_INSET_PX * 2;\n setFits(needed === LABEL_INSET_PX * 2 || needed <= bar.offsetWidth * usedFraction);\n };\n measure();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(bar);\n return () => observer.disconnect();\n }, [usedFraction]);\n return { barRef, labelRef, fits };\n}\n\nexport interface WorkloadMemoryStackProps {\n label: string;\n memory: WorkloadResourceStatistics;\n jvm: Pick<WorkloadJvmStatistics, \"heap\" | \"regions\">;\n part?: WorkloadMemoryPart;\n className?: string;\n}\n\nexport function WorkloadMemoryStack({\n label,\n memory,\n jvm,\n part = \"all\",\n className,\n}: WorkloadMemoryStackProps) {\n const { segments, usage, scale } = memorySegments({ memory, jvm, part });\n const usedFraction = scale > 0 ? Math.min(usage / scale, 1) : 0;\n const { barRef, labelRef, fits } = useLabelFit(usedFraction);\n return (\n <div\n className={cn(\n \"flex min-w-0 items-center gap-3 py-1 text-xs tabular-nums\",\n className,\n )}\n >\n <div ref={barRef} className=\"relative min-w-0 flex-1\">\n <ProgressBar\n label={label}\n segments={segments}\n total={scale}\n formatValue={formatBytes}\n height=\"h-6\"\n className=\"rounded-md\"\n />\n <span\n ref={labelRef}\n data-fits={fits}\n className={cn(\n \"pointer-events-none absolute inset-y-0 flex items-center whitespace-nowrap font-medium\",\n fits\n ? \"left-2 text-white [text-shadow:0_0_2px_rgb(0_0_0/0.45)]\"\n : \"text-foreground\",\n )}\n style={fits ? undefined : { left: `calc(${usedFraction * 100}% + ${LABEL_INSET_PX}px)` }}\n >\n {formatBytes(usage)}\n </span>\n </div>\n <span className=\"shrink-0 text-muted-foreground\">\n {formatBytes(scale)}\n </span>\n </div>\n );\n}\n\nexport function WorkloadMemoryLegend() {\n return (\n <div className=\"flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted-foreground\">\n {[...memoryRegions, nativeMemoryRegion].map(({ label, color }) => (\n <span key={label} className=\"inline-flex items-center gap-1.5\">\n <span\n className=\"h-2.5 w-2.5 rounded-sm\"\n style={{ backgroundColor: color }}\n />\n {label}\n </span>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAWA,IAAM,iBAAiB;;;;;;AAOvB,SAAS,YAAY,cAAsB;CACzC,MAAM,SAAS,OAAuB,IAAI;CAC1C,MAAM,WAAW,OAAwB,IAAI;CAC7C,MAAM,CAAC,MAAM,WAAW,SAAS,IAAI;CACrC,sBAAsB;EACpB,MAAM,MAAM,OAAO;EACnB,MAAM,UAAU,SAAS;EACzB,IAAI,CAAC,OAAO,CAAC,SAAS;EACtB,MAAM,gBAAgB;GACpB,MAAM,SAAS,QAAQ,cAAc;GACrC,QAAQ,WAAW,MAAsB,UAAU,IAAI,cAAc,YAAY;EACnF;EACA,QAAQ;EACR,IAAI,OAAO,mBAAmB,aAAa;EAC3C,MAAM,WAAW,IAAI,eAAe,OAAO;EAC3C,SAAS,QAAQ,GAAG;EACpB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,YAAY,CAAC;CACjB,OAAO;EAAE;EAAQ;EAAU;CAAK;AAClC;AAUA,SAAgB,oBAAoB,EAClC,OACA,QACA,KACA,OAAO,OACP,aAC2B;CAC3B,MAAM,EAAE,UAAU,OAAO,UAAU,eAAe;EAAE;EAAQ;EAAK;CAAK,CAAC;CACvE,MAAM,eAAe,QAAQ,IAAI,KAAK,IAAI,QAAQ,OAAO,CAAC,IAAI;CAC9D,MAAM,EAAE,QAAQ,UAAU,SAAS,YAAY,YAAY;CAC3D,OACE,qBAAC,OAAD;EACE,WAAW,GACT,6DACA,SACF;EAJF,UAAA,CAME,qBAAC,OAAD;G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