@ashlr/hub 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +3 -0
  3. package/dist/build-identity.json +2 -2
  4. package/dist/cli/activation.d.ts +41 -0
  5. package/dist/cli/activation.js +485 -0
  6. package/dist/cli/activation.js.map +1 -0
  7. package/dist/core/daemon/cutoff-checkpoint-scheduler.js +7 -0
  8. package/dist/core/daemon/cutoff-checkpoint-scheduler.js.map +1 -1
  9. package/dist/core/daemon/loop.d.ts +19 -0
  10. package/dist/core/daemon/loop.js +235 -5
  11. package/dist/core/daemon/loop.js.map +1 -1
  12. package/dist/core/daemon/overnight-status.d.ts +152 -0
  13. package/dist/core/daemon/overnight-status.js +275 -0
  14. package/dist/core/daemon/overnight-status.js.map +1 -0
  15. package/dist/core/daemon/post-merge-halt.d.ts +212 -0
  16. package/dist/core/daemon/post-merge-halt.js +503 -0
  17. package/dist/core/daemon/post-merge-halt.js.map +1 -0
  18. package/dist/core/daemon/run-window.d.ts +218 -0
  19. package/dist/core/daemon/run-window.js +420 -0
  20. package/dist/core/daemon/run-window.js.map +1 -0
  21. package/dist/core/fleet/external-skill-audit.js +1 -1
  22. package/dist/core/fleet/external-skill-audit.js.map +1 -1
  23. package/dist/core/fleet/generated-repair-resolution.d.ts +36 -0
  24. package/dist/core/fleet/generated-repair-resolution.js +245 -0
  25. package/dist/core/fleet/generated-repair-resolution.js.map +1 -0
  26. package/dist/core/local-runtime/llama/config.d.ts +28 -6
  27. package/dist/core/local-runtime/llama/config.js +28 -6
  28. package/dist/core/local-runtime/llama/config.js.map +1 -1
  29. package/dist/core/local-runtime/llama/port.d.ts +17 -0
  30. package/dist/core/local-runtime/llama/port.js +47 -0
  31. package/dist/core/local-runtime/llama/port.js.map +1 -0
  32. package/dist/core/local-runtime/llama/proxy-host.d.ts +54 -0
  33. package/dist/core/local-runtime/llama/proxy-host.js +159 -0
  34. package/dist/core/local-runtime/llama/proxy-host.js.map +1 -0
  35. package/dist/core/local-runtime/llama/proxy-process.d.ts +148 -0
  36. package/dist/core/local-runtime/llama/proxy-process.js +250 -0
  37. package/dist/core/local-runtime/llama/proxy-process.js.map +1 -0
  38. package/dist/core/local-runtime/llama/proxy-record.d.ts +40 -0
  39. package/dist/core/local-runtime/llama/proxy-record.js +133 -0
  40. package/dist/core/local-runtime/llama/proxy-record.js.map +1 -0
  41. package/dist/core/local-runtime/llama/proxy-supervisor.d.ts +118 -0
  42. package/dist/core/local-runtime/llama/proxy-supervisor.js +511 -0
  43. package/dist/core/local-runtime/llama/proxy-supervisor.js.map +1 -0
  44. package/dist/core/web/public/next/assets/App-Cgi6j1Gk.css +1 -0
  45. package/dist/core/web/public/next/assets/App-vtaHB9mp.js +7 -0
  46. package/dist/core/web/public/next/assets/App-vtaHB9mp.js.map +1 -0
  47. package/dist/core/web/public/next/assets/ApprovalsSection-B-bFJ0I9.js +2 -0
  48. package/dist/core/web/public/next/assets/ApprovalsSection-B-bFJ0I9.js.map +1 -0
  49. package/dist/core/web/public/next/assets/ApprovalsSection-Su-NUTis.css +1 -0
  50. package/dist/core/web/public/next/assets/AutonomySection-CHjxJt2z.css +1 -0
  51. package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js +2 -0
  52. package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js.map +1 -0
  53. package/dist/core/web/public/next/assets/ChatSection-BfnLe5dT.css +1 -0
  54. package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js +80 -0
  55. package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js.map +1 -0
  56. package/dist/core/web/public/next/assets/ConfirmDialog-Dd2APQhB.js +2 -0
  57. package/dist/core/web/public/next/assets/ConfirmDialog-Dd2APQhB.js.map +1 -0
  58. package/dist/core/web/public/next/assets/{ConfirmDialog-cYuivhCX.css → ConfirmDialog-Dx15x0Ho.css} +1 -1
  59. package/dist/core/web/public/next/assets/Dialog-CPM9JxBc.js +2 -0
  60. package/dist/core/web/public/next/assets/Dialog-CPM9JxBc.js.map +1 -0
  61. package/dist/core/web/public/next/assets/Dialog-tQ8kFulD.css +1 -0
  62. package/dist/core/web/public/next/assets/DiffViewer-B84qVef9.js +7 -0
  63. package/dist/core/web/public/next/assets/DiffViewer-B84qVef9.js.map +1 -0
  64. package/dist/core/web/public/next/assets/DiffViewer-C8HHTnVE.css +1 -0
  65. package/dist/core/web/public/next/assets/McpSection-CEUpV_5X.js +2 -0
  66. package/dist/core/web/public/next/assets/McpSection-CEUpV_5X.js.map +1 -0
  67. package/dist/core/web/public/next/assets/McpSection-D88QlDpG.css +1 -0
  68. package/dist/core/web/public/next/assets/Meter--h3MmZS-.js +2 -0
  69. package/dist/core/web/public/next/assets/Meter--h3MmZS-.js.map +1 -0
  70. package/dist/core/web/public/next/assets/Meter-CLcr-4wS.css +1 -0
  71. package/dist/core/web/public/next/assets/{MutationTokenDialog-jWLLCxWn.css → MutationTokenDialog-CrfJ0PdD.css} +1 -1
  72. package/dist/core/web/public/next/assets/MutationTokenDialog-DA8t97XT.js +2 -0
  73. package/dist/core/web/public/next/assets/MutationTokenDialog-DA8t97XT.js.map +1 -0
  74. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-Bq7Vyud0.js +7 -0
  75. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-Bq7Vyud0.js.map +1 -0
  76. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-CM_8pJs6.css +1 -0
  77. package/dist/core/web/public/next/assets/RouteErrorBoundary-Badio_uO.js +2 -0
  78. package/dist/core/web/public/next/assets/RouteErrorBoundary-Badio_uO.js.map +1 -0
  79. package/dist/core/web/public/next/assets/RouteErrorBoundary-ekyMXAK8.css +1 -0
  80. package/dist/core/web/public/next/assets/SettingsSection-BII7TTSD.css +1 -0
  81. package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js +2 -0
  82. package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js.map +1 -0
  83. package/dist/core/web/public/next/assets/UniverseConsoleApp-Dh7A-hLD.css +1 -0
  84. package/dist/core/web/public/next/assets/UniverseConsoleApp-_FSohAdN.js +2 -0
  85. package/dist/core/web/public/next/assets/UniverseConsoleApp-_FSohAdN.js.map +1 -0
  86. package/dist/core/web/public/next/assets/UniverseView-Bqa8DH57.css +1 -0
  87. package/dist/core/web/public/next/assets/UniverseView-DqcXbed4.js +9 -0
  88. package/dist/core/web/public/next/assets/UniverseView-DqcXbed4.js.map +1 -0
  89. package/dist/core/web/public/next/assets/UsageSection-Bq6Daaby.js +2 -0
  90. package/dist/core/web/public/next/assets/UsageSection-Bq6Daaby.js.map +1 -0
  91. package/dist/core/web/public/next/assets/UsageSection-DwgNOYvi.css +1 -0
  92. package/dist/core/web/public/next/assets/VerseConsoleApp-CMkCizvL.css +1 -0
  93. package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js +3 -0
  94. package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js.map +1 -0
  95. package/dist/core/web/public/next/assets/charts-CTZJ-JrH.js +2 -0
  96. package/dist/core/web/public/next/assets/charts-CTZJ-JrH.js.map +1 -0
  97. package/dist/core/web/public/next/assets/charts-CsrtT4rk.css +1 -0
  98. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js +2 -0
  99. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js.map +1 -0
  100. package/dist/core/web/public/next/assets/format-BNYWGJat.js +2 -0
  101. package/dist/core/web/public/next/assets/format-BNYWGJat.js.map +1 -0
  102. package/dist/core/web/public/next/assets/global-D6bTxIRn.js +2 -0
  103. package/dist/core/web/public/next/assets/global-D6bTxIRn.js.map +1 -0
  104. package/dist/core/web/public/next/assets/global-z-JfD3ow.css +1 -0
  105. package/dist/core/web/public/next/assets/icons-D9vlf85u.js +2 -0
  106. package/dist/core/web/public/next/assets/icons-D9vlf85u.js.map +1 -0
  107. package/dist/core/web/public/next/assets/index-CZamKRUg.js +11 -0
  108. package/dist/core/web/public/next/assets/index-CZamKRUg.js.map +1 -0
  109. package/dist/core/web/public/next/assets/queries-B8eBnFox.js +2 -0
  110. package/dist/core/web/public/next/assets/queries-B8eBnFox.js.map +1 -0
  111. package/dist/core/web/public/next/assets/use-guarded-action-bzrVVAYq.js +2 -0
  112. package/dist/core/web/public/next/assets/use-guarded-action-bzrVVAYq.js.map +1 -0
  113. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js +2 -0
  114. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js.map +1 -0
  115. package/dist/core/web/public/next/assets/workspace-model-v0a1gl-C.js +2 -0
  116. package/dist/core/web/public/next/assets/workspace-model-v0a1gl-C.js.map +1 -0
  117. package/dist/core/web/public/next/index.html +1 -1
  118. package/dist/release-dependency-inventory.json +1 -1
  119. package/node_modules/marked/README.md +8 -0
  120. package/node_modules/marked/bin/main.js +12 -11
  121. package/node_modules/marked/lib/marked.d.ts +88 -25
  122. package/node_modules/marked/lib/marked.esm.js +50 -44
  123. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  124. package/node_modules/marked/lib/marked.umd.js +50 -44
  125. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  126. package/node_modules/marked/man/marked.1 +1 -1
  127. package/node_modules/marked/package.json +21 -21
  128. package/package.json +13 -8
  129. package/dist/core/web/public/next/assets/App-BCKqSppK.css +0 -1
  130. package/dist/core/web/public/next/assets/App-CsbPYQqy.js +0 -16
  131. package/dist/core/web/public/next/assets/App-CsbPYQqy.js.map +0 -1
  132. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js +0 -2
  133. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js.map +0 -1
  134. package/dist/core/web/public/next/assets/ApprovalsSection-CRP59wSb.css +0 -1
  135. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js +0 -2
  136. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js.map +0 -1
  137. package/dist/core/web/public/next/assets/AutonomySection-DTN6m6QE.css +0 -1
  138. package/dist/core/web/public/next/assets/ChatSection-DiRvNX3Q.css +0 -1
  139. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js +0 -77
  140. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js.map +0 -1
  141. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js +0 -2
  142. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js.map +0 -1
  143. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js +0 -2
  144. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js.map +0 -1
  145. package/dist/core/web/public/next/assets/Dialog-DxN7RgB5.css +0 -1
  146. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js +0 -7
  147. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js.map +0 -1
  148. package/dist/core/web/public/next/assets/DiffViewer-hN7X6wGT.css +0 -1
  149. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js +0 -2
  150. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js.map +0 -1
  151. package/dist/core/web/public/next/assets/Epistemic-DiyMyeaN.css +0 -1
  152. package/dist/core/web/public/next/assets/Meter-CGBsbXUX.css +0 -1
  153. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js +0 -2
  154. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js.map +0 -1
  155. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js +0 -2
  156. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js.map +0 -1
  157. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js +0 -2
  158. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js.map +0 -1
  159. package/dist/core/web/public/next/assets/RefreshIndicator-O7jUBOmX.css +0 -1
  160. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-DLl4DbGG.css +0 -1
  161. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js +0 -7
  162. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js.map +0 -1
  163. package/dist/core/web/public/next/assets/RouteErrorBoundary-BIpdnxp-.css +0 -1
  164. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js +0 -2
  165. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js.map +0 -1
  166. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js +0 -2
  167. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js.map +0 -1
  168. package/dist/core/web/public/next/assets/SettingsSection-DGJMdUh2.css +0 -1
  169. package/dist/core/web/public/next/assets/Skeleton-D2JaTXyv.css +0 -1
  170. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js +0 -2
  171. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js.map +0 -1
  172. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js +0 -2
  173. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js.map +0 -1
  174. package/dist/core/web/public/next/assets/StatusBadge-TpDqZf6K.css +0 -1
  175. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js +0 -2
  176. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js.map +0 -1
  177. package/dist/core/web/public/next/assets/TableView-R6Yeztp1.css +0 -1
  178. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js +0 -2
  179. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js.map +0 -1
  180. package/dist/core/web/public/next/assets/UniverseConsoleApp-CiZZxRPV.css +0 -1
  181. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js +0 -9
  182. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js.map +0 -1
  183. package/dist/core/web/public/next/assets/UniverseView-gBxl6yum.css +0 -1
  184. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js +0 -2
  185. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js.map +0 -1
  186. package/dist/core/web/public/next/assets/UsageSection-UUYDidOg.css +0 -1
  187. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js +0 -3
  188. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js.map +0 -1
  189. package/dist/core/web/public/next/assets/VerseConsoleApp-mOAXvWa6.css +0 -1
  190. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js +0 -2
  191. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js.map +0 -1
  192. package/dist/core/web/public/next/assets/format-fggwu_Rs.js +0 -2
  193. package/dist/core/web/public/next/assets/format-fggwu_Rs.js.map +0 -1
  194. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js +0 -2
  195. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js.map +0 -1
  196. package/dist/core/web/public/next/assets/global-BeRYd1Bu.css +0 -1
  197. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js +0 -2
  198. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js.map +0 -1
  199. package/dist/core/web/public/next/assets/index-CpgkRaTi.js +0 -51
  200. package/dist/core/web/public/next/assets/index-CpgkRaTi.js.map +0 -1
  201. package/dist/core/web/public/next/assets/queries-856qUN3Y.js +0 -2
  202. package/dist/core/web/public/next/assets/queries-856qUN3Y.js.map +0 -1
  203. package/dist/core/web/public/next/assets/use-guarded-action-Bqa2v0a-.css +0 -1
  204. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js +0 -2
  205. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js.map +0 -1
  206. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js +0 -2
  207. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js.map +0 -1
  208. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js +0 -2
  209. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js.map +0 -1
  210. /package/node_modules/marked/{LICENSE.md → LICENSE} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"charts-CTZJ-JrH.js","names":[],"sources":["../../../../../../src/web-ui/components/charts/ChartContainer.module.css","../../../../../../src/web-ui/components/charts/ChartContainer.tsx","../../../../../../src/web-ui/components/charts/Legend.module.css","../../../../../../src/web-ui/components/charts/Legend.tsx","../../../../../../src/web-ui/components/charts/colors.ts","../../../../../../src/web-ui/components/charts/LineChart.module.css","../../../../../../src/web-ui/components/charts/LineChart.tsx","../../../../../../src/web-ui/components/charts/BarChart.module.css","../../../../../../src/web-ui/components/charts/BarChart.tsx","../../../../../../src/web-ui/components/charts/Sparkline.module.css","../../../../../../src/web-ui/components/charts/Sparkline.tsx","../../../../../../src/web-ui/components/charts/format.ts","../../../../../../src/web-ui/components/charts/StatTile.module.css","../../../../../../src/web-ui/components/charts/StatTile.tsx","../../../../../../src/web-ui/components/charts/TableView.module.css","../../../../../../src/web-ui/components/charts/TableView.tsx"],"sourcesContent":[".figure {\n margin: 0;\n border: 1px solid var(--border-subtle);\n border-radius: var(--radius-lg);\n background: var(--bg-surface);\n padding: var(--space-4);\n /* Fixed heights must include the axis-label band — this container instead\n grows with its content so a chart's x-axis labels never get clipped or\n forced into a nested scroll (dataviz anti-patterns). */\n}\n\n.caption {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--space-3);\n margin-bottom: var(--space-3);\n}\n\n.title {\n font-size: var(--text-sm-size);\n font-weight: var(--font-weight-semibold);\n color: var(--text-primary);\n}\n\n.description {\n font-size: var(--text-xs-size);\n color: var(--text-tertiary);\n}\n\n.plot {\n width: 100%;\n overflow-x: auto;\n}\n\n.tableDisclosure {\n margin-top: var(--space-3);\n border-top: 1px solid var(--border-subtle);\n padding-top: var(--space-2);\n}\n\n.tableDisclosure > summary {\n cursor: pointer;\n font-size: var(--text-xs-size);\n color: var(--text-secondary);\n list-style: none;\n}\n\n.tableDisclosure > summary::-webkit-details-marker {\n display: none;\n}\n\n.tableDisclosure > summary::before {\n content: '▸ ';\n}\n\n.tableDisclosure[open] > summary::before {\n content: '▾ ';\n}\n\n.tableBody {\n margin-top: var(--space-2);\n}\n\n.caveat {\n margin: 0 0 var(--space-3);\n padding: var(--space-2) var(--space-3);\n border-radius: var(--radius-md);\n background: var(--status-unknown-bg);\n color: var(--status-unknown-fg);\n font-size: var(--text-xs-size);\n line-height: var(--text-sm-line);\n}\n\n.empty {\n color: var(--text-tertiary);\n font-size: var(--text-sm-size);\n padding: var(--space-6) 0;\n text-align: center;\n}\n","/**\n * components/charts/ChartContainer.tsx — the figure every chart mounts\n * inside: title/description, the plot itself, an optional caveat banner\n * (epistemic-honesty-adjacent: for a chart built on data with a known,\n * disclosed limitation — see ProductionView's judge-verdict caveat), an\n * optional table-view twin (the WCAG-clean accessibility equivalent every\n * chart should ship per the dataviz skill), and an empty state that never\n * lies about missing data.\n */\nimport type { ReactNode } from 'react';\nimport './chart-tokens.css';\nimport styles from './ChartContainer.module.css';\n\nexport interface ChartContainerProps {\n title: string;\n description?: string;\n /** A short, honest note about a known limitation of the data behind this\n * chart (e.g. \"counts may include X, not yet separable\"). Never omit a\n * caveat to make a chart look cleaner than the data actually is. */\n caveat?: string;\n /** The chart itself (SVG + legend). */\n children: ReactNode;\n /** The accessibility twin — same data as a real HTML table. Omit only\n * when the chart already IS a table. */\n table?: ReactNode;\n /** When true, renders the empty state instead of `children`. */\n empty?: boolean;\n emptyMessage?: string;\n}\n\nexport function ChartContainer({\n title,\n description,\n caveat,\n children,\n table,\n empty,\n emptyMessage = 'No data for this window.',\n}: ChartContainerProps) {\n return (\n <figure className={styles.figure}>\n <figcaption className={styles.caption}>\n <span className={styles.title}>{title}</span>\n {description ? <span className={styles.description}>{description}</span> : null}\n </figcaption>\n {caveat ? (\n <p className={styles.caveat} role=\"note\">\n {caveat}\n </p>\n ) : null}\n {empty ? (\n <p className={styles.empty}>{emptyMessage}</p>\n ) : (\n <div className={styles.plot}>{children}</div>\n )}\n {table ? (\n <details className={styles.tableDisclosure}>\n <summary>View as table</summary>\n <div className={styles.tableBody}>{table}</div>\n </details>\n ) : null}\n </figure>\n );\n}\n",".legend {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-1) var(--space-4);\n margin: var(--space-2) 0 0;\n padding: 0;\n list-style: none;\n}\n\n.item {\n display: inline-flex;\n align-items: center;\n gap: var(--space-2);\n font-size: var(--text-xs-size);\n color: var(--text-secondary);\n}\n\n.swatch {\n width: 10px;\n height: 10px;\n border-radius: var(--radius-full);\n flex: none;\n}\n\n.swatchLine {\n width: 14px;\n height: 2px;\n border-radius: var(--radius-full);\n flex: none;\n}\n","/**\n * components/charts/Legend.tsx — the dependable identity channel. A legend\n * is always present for two or more series (never rely on color-matching\n * alone); a single series needs no legend box because the chart's own title\n * already names it (see marks-and-anatomy.md \"Labels & legend\").\n */\nimport styles from './Legend.module.css';\n\nexport interface LegendItem {\n label: string;\n color: string;\n /** 'line' for line charts (a short stroke key), 'swatch' for bar/area. */\n kind?: 'line' | 'swatch';\n}\n\nexport function Legend({ items }: { items: LegendItem[] }) {\n if (items.length < 2) return null;\n return (\n <ul className={styles.legend}>\n {items.map((it) => (\n <li key={it.label} className={styles.item}>\n <span\n className={it.kind === 'line' ? styles.swatchLine : styles.swatch}\n style={{ background: it.color }}\n aria-hidden=\"true\"\n />\n {it.label}\n </li>\n ))}\n </ul>\n );\n}\n","/**\n * components/charts/colors.ts — the one place a chart asks for a color.\n * Every function returns a `var(--chart-*)` reference into chart-tokens.css\n * (never a literal hex) so theming is automatic and colors can never drift\n * out of sync between light and dark. See chart-tokens.css's header comment\n * for the palette-selection rationale — an exhaustive permutation search\n * clears the CVD adjacent floor (worst ΔE 13.8 light / 14.5 dark, target\n * 8.0) without changing which hues are used, only their series order.\n */\n\nconst SERIES_SLOTS = 7;\n\n/** Fixed-order categorical color for series index `slot` (0-based). Color\n * follows the entity, never its row number — callers must assign a series\n * its slot once (e.g. by stable sort order) and keep it even if other\n * series are filtered out; never reassign slots to \"fill the gap\" left by\n * a removed series (see dataviz anti-patterns: \"recolor-on-filter\"). */\nexport function seriesColor(slot: number): string {\n const n = ((slot % SERIES_SLOTS) + SERIES_SLOTS) % SERIES_SLOTS;\n return `var(--chart-series-${n + 1})`;\n}\n\n/** The \"Other\"/overflow bucket color — never part of the identity rotation. */\nexport const CHART_NEUTRAL = 'var(--chart-neutral)';\n\n/** Default single hue for magnitude (sequential) and for a single nominal\n * series (one series needs no legend box — every bar takes the same hue). */\nexport const CHART_SEQUENTIAL = 'var(--chart-sequential)';\nexport const CHART_SEQUENTIAL_SOFT = 'var(--chart-sequential-soft)';\n\nexport const CHART_DIVERGING_POS = 'var(--chart-diverging-pos)';\nexport const CHART_DIVERGING_NEG = 'var(--chart-diverging-neg)';\nexport const CHART_DIVERGING_MID = 'var(--chart-diverging-mid)';\n\nexport const CHART_GRID = 'var(--chart-grid)';\nexport const CHART_AXIS = 'var(--chart-axis)';\n",".svg {\n display: block;\n width: 100%;\n height: auto;\n}\n\n.gridline {\n stroke: var(--chart-grid);\n stroke-width: 1;\n}\n\n.axis {\n stroke: var(--chart-axis);\n stroke-width: 1;\n}\n\n.axisLabel {\n font-size: var(--text-xs-size);\n fill: var(--text-tertiary);\n font-family: var(--font-ui);\n}\n\n.line {\n fill: none;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.area {\n opacity: 0.1;\n stroke: none;\n}\n\n.marker {\n stroke: var(--chart-surface);\n stroke-width: 2;\n}\n\n.endLabel {\n font-size: var(--text-xs-size);\n font-family: var(--font-ui);\n font-weight: var(--font-weight-medium);\n}\n\n.crosshairLine {\n stroke: var(--chart-axis);\n stroke-width: 1;\n pointer-events: none;\n}\n\n.overlay {\n fill: transparent;\n cursor: crosshair;\n}\n\n.wrap {\n position: relative;\n}\n\n.tooltip {\n position: absolute;\n pointer-events: none;\n background: var(--chart-tooltip-bg);\n border: 1px solid var(--chart-tooltip-border);\n border-radius: var(--radius-sm);\n box-shadow: var(--shadow-md);\n padding: var(--space-2);\n font-size: var(--text-xs-size);\n color: var(--text-primary);\n white-space: nowrap;\n z-index: var(--z-dropdown);\n transform: translate(-50%, -100%);\n margin-top: -10px;\n}\n\n.tooltipDate {\n color: var(--text-tertiary);\n margin-bottom: var(--space-1);\n}\n\n.tooltipRow {\n display: flex;\n align-items: center;\n gap: var(--space-1);\n}\n\n.tooltipKey {\n width: 12px;\n height: 2px;\n flex: none;\n}\n\n.tooltipValue {\n font-weight: var(--font-weight-semibold);\n font-variant-numeric: tabular-nums;\n}\n\n.tooltipGap {\n color: var(--text-tertiary);\n font-style: italic;\n}\n","/**\n * components/charts/LineChart.tsx — trend over time. A gap (`null` y) is\n * split into a separate path segment so it renders as a visible break in\n * the line, never as a straight line through a missing value and never as\n * a silent zero. Single series gets an optional soft area fill; two-plus\n * series always render a legend (never color-matching alone).\n */\nimport { useRef, useState } from 'react';\nimport type { Series } from './types.js';\nimport { seriesColor, CHART_GRID, CHART_AXIS } from './colors.js';\nimport { Legend } from './Legend.js';\nimport './chart-tokens.css';\nimport styles from './LineChart.module.css';\n\nconst VBOX_W = 640;\nconst PAD_L = 44;\nconst PAD_R = 12;\nconst PAD_T = 12;\nconst PAD_B = 24;\nconst TICKS_Y = 4;\n/* Direct end-of-line labels need a gutter of their own. They are drawn in USER\n units — the viewBox scales the font along with the geometry, so a reserve\n measured in user units holds at every rendered width — and `--text-xs-size`\n resolves to 12 user units here, where the UI sans averages a shade over 6\n units per character at medium weight. 6.4 rounds that up so the reserve errs\n wide rather than clipping. Without the reserve the label was drawn at\n `VBOX_W - PAD_R + 4` with only PAD_R (12u) of room and the svg's own\n `overflow: hidden` cropped it to its first glyph — \"Estimated spend\"\n rendered as a lone \"E\". */\nconst END_LABEL_CH = 6.4;\nconst END_LABEL_GAP = 4;\n/* Past this the gutter would cost more plot than the label is worth, so the\n label is dropped rather than shrinking the chart around it. Nothing is lost:\n Legend.tsx deliberately renders nothing below two series because the panel\n heading already names a lone series, and two-plus series always have the\n legend regardless. */\nconst END_LABEL_MAX = 150;\n\ninterface Run {\n x: number;\n y: number;\n}\n\nfunction splitRuns(points: Series['points']): Run[][] {\n const runs: Run[][] = [];\n let current: Run[] = [];\n for (const p of points) {\n if (p.y === null) {\n if (current.length) runs.push(current);\n current = [];\n continue;\n }\n current.push({ x: p.x, y: p.y });\n }\n if (current.length) runs.push(current);\n return runs;\n}\n\nfunction niceTicks(min: number, max: number, count: number): number[] {\n if (max <= min) return [min];\n const step = (max - min) / count;\n return Array.from({ length: count + 1 }, (_, i) => min + step * i);\n}\n\nexport function LineChart({\n series,\n height = 200,\n area = false,\n formatX = (x: number) => String(x),\n formatY = (y: number) => String(y),\n ariaLabel,\n}: {\n series: Series[];\n height?: number;\n area?: boolean;\n formatX?: (x: number) => string;\n formatY?: (y: number) => string;\n ariaLabel: string;\n}) {\n const svgRef = useRef<SVGSVGElement>(null);\n const [hoverX, setHoverX] = useState<number | null>(null);\n const [tooltipPos, setTooltipPos] = useState<{ left: number; top: number } | null>(null);\n\n const allX = series.flatMap((s) => s.points.map((p) => p.x));\n const knownY = series.flatMap((s) => s.points.map((p) => p.y)).filter((y): y is number => y !== null);\n if (allX.length === 0) {\n return <p>No data.</p>;\n }\n const xMin = Math.min(...allX);\n const xMax = Math.max(...allX);\n const yMin = Math.min(0, ...knownY);\n const yMax = Math.max(0.0001, ...knownY);\n const xRange = xMax - xMin || 1;\n const yRange = yMax - yMin || 1;\n\n /* Decided before the scales, because the reserved gutter is what plotW is\n measured against — and the gridlines and x-axis stop at the same edge. */\n const wantEndLabels = series.length >= 1 && series.length <= 4;\n const endLabelW = wantEndLabels\n ? Math.max(...series.map((s) => s.label.length)) * END_LABEL_CH\n : 0;\n const showEndLabels = wantEndLabels && endLabelW <= END_LABEL_MAX;\n const padR = PAD_R + (showEndLabels ? END_LABEL_GAP + endLabelW : 0);\n const showLegend = series.length >= 2;\n\n const plotW = VBOX_W - PAD_L - padR;\n const plotH = height - PAD_T - PAD_B;\n const xScale = (x: number) => PAD_L + ((x - xMin) / xRange) * plotW;\n const yScale = (y: number) => PAD_T + plotH - ((y - yMin) / yRange) * plotH;\n\n const yTicks = niceTicks(yMin, yMax, TICKS_Y);\n\n // Nearest-x lookup across a reference axis (the union of all distinct x\n // values, since series may not share every point).\n const xAxis = Array.from(new Set(allX)).sort((a, b) => a - b);\n\n function nearestX(clientX: number): number | null {\n const svg = svgRef.current;\n if (!svg) return null;\n const rect = svg.getBoundingClientRect();\n const svgX = ((clientX - rect.left) / rect.width) * VBOX_W;\n const dataX = xMin + ((svgX - PAD_L) / plotW) * xRange;\n let nearest = xAxis[0];\n let best = Infinity;\n for (const x of xAxis) {\n const d = Math.abs(x - dataX);\n if (d < best) {\n best = d;\n nearest = x;\n }\n }\n return nearest;\n }\n\n function handleMove(e: React.PointerEvent<SVGSVGElement>) {\n const x = nearestX(e.clientX);\n if (x === null) return;\n setHoverX(x);\n const svg = svgRef.current;\n if (svg) {\n const rect = svg.getBoundingClientRect();\n const px = (xScale(x) / VBOX_W) * rect.width;\n setTooltipPos({ left: px, top: 0 });\n }\n }\n\n const hoverPoints =\n hoverX !== null\n ? series.map((s) => ({\n series: s,\n point: s.points.find((p) => p.x === hoverX) ?? null,\n }))\n : null;\n\n return (\n <div className={styles.wrap}>\n <svg\n ref={svgRef}\n className={styles.svg}\n viewBox={`0 0 ${VBOX_W} ${height}`}\n role=\"img\"\n aria-label={ariaLabel}\n onPointerMove={handleMove}\n onPointerLeave={() => setHoverX(null)}\n >\n {yTicks.map((t, i) => (\n <g key={i}>\n <line\n x1={PAD_L}\n x2={VBOX_W - padR}\n y1={yScale(t)}\n y2={yScale(t)}\n className={styles.gridline}\n stroke={CHART_GRID}\n />\n <text x={PAD_L - 6} y={yScale(t)} dy=\"0.32em\" textAnchor=\"end\" className={styles.axisLabel}>\n {formatY(t)}\n </text>\n </g>\n ))}\n <line\n x1={PAD_L}\n x2={VBOX_W - padR}\n y1={height - PAD_B}\n y2={height - PAD_B}\n className={styles.axis}\n stroke={CHART_AXIS}\n />\n {xAxis.length > 1\n ? [xAxis[0], xAxis[xAxis.length - 1]].map((x, i) => (\n <text\n key={i}\n x={xScale(x)}\n y={height - 6}\n textAnchor={i === 0 ? 'start' : 'end'}\n className={styles.axisLabel}\n >\n {formatX(x)}\n </text>\n ))\n : null}\n\n {series.map((s, si) => {\n const color = seriesColor(si);\n const runs = splitRuns(s.points);\n return (\n <g key={s.id}>\n {area && series.length === 1\n ? runs.map((run, ri) => {\n const d =\n run.map((p, j) => `${j === 0 ? 'M' : 'L'}${xScale(p.x)},${yScale(p.y)}`).join(' ') +\n ` L${xScale(run[run.length - 1].x)},${yScale(yMin)} L${xScale(run[0].x)},${yScale(yMin)} Z`;\n return <path key={ri} d={d} fill={color} className={styles.area} />;\n })\n : null}\n {runs.map((run, ri) => (\n <path\n key={ri}\n d={run.map((p, j) => `${j === 0 ? 'M' : 'L'}${xScale(p.x)},${yScale(p.y)}`).join(' ')}\n stroke={color}\n className={styles.line}\n />\n ))}\n {showEndLabels && runs.length ? (\n (() => {\n const lastRun = runs[runs.length - 1];\n const last = lastRun[lastRun.length - 1];\n return (\n <text\n x={xScale(last.x) + END_LABEL_GAP}\n y={yScale(last.y)}\n dy=\"0.32em\"\n className={styles.endLabel}\n fill={color}\n >\n {s.label}\n </text>\n );\n })()\n ) : null}\n </g>\n );\n })}\n\n {hoverX !== null ? (\n <line\n x1={xScale(hoverX)}\n x2={xScale(hoverX)}\n y1={PAD_T}\n y2={height - PAD_B}\n className={styles.crosshairLine}\n />\n ) : null}\n {hoverX !== null\n ? series.map((s, si) => {\n const p = s.points.find((pt) => pt.x === hoverX);\n if (!p || p.y === null) return null;\n return (\n <circle\n key={s.id}\n cx={xScale(p.x)}\n cy={yScale(p.y)}\n r={4}\n fill={seriesColor(si)}\n className={styles.marker}\n />\n );\n })\n : null}\n\n <rect\n x={PAD_L}\n y={PAD_T}\n width={plotW}\n height={plotH}\n className={styles.overlay}\n onFocus={() => setHoverX(xAxis[xAxis.length - 1] ?? null)}\n />\n </svg>\n {hoverPoints && tooltipPos ? (\n <div className={styles.tooltip} style={{ left: tooltipPos.left, top: tooltipPos.top }}>\n <div className={styles.tooltipDate}>{formatX(hoverX as number)}</div>\n {hoverPoints.map(({ series: s, point }, i) => (\n <div className={styles.tooltipRow} key={s.id}>\n <span className={styles.tooltipKey} style={{ background: seriesColor(i) }} aria-hidden=\"true\" />\n {point && point.y !== null ? (\n <>\n <span className={styles.tooltipValue}>{formatY(point.y)}</span>\n {showLegend ? <span>{s.label}</span> : null}\n </>\n ) : (\n <span className={styles.tooltipGap}>no data{showLegend ? ` — ${s.label}` : ''}</span>\n )}\n </div>\n ))}\n </div>\n ) : null}\n {showLegend ? (\n <Legend items={series.map((s, i) => ({ label: s.label, color: seriesColor(i), kind: 'line' }))} />\n ) : null}\n </div>\n );\n}\n",".svg {\n display: block;\n overflow: visible;\n}\n\n.bar {\n transition: opacity var(--duration-fast) var(--ease-standard);\n}\n\n.bar:hover,\n.bar:focus-visible {\n opacity: 0.82;\n}\n\n.baseline {\n stroke: var(--chart-axis);\n stroke-width: 1;\n}\n\n.gridline {\n stroke: var(--chart-grid);\n stroke-width: 1;\n}\n\n.axisLabel {\n font-size: 10px;\n fill: var(--text-tertiary);\n font-family: var(--font-ui);\n}\n\n.valueLabel {\n font-size: 10px;\n fill: var(--text-secondary);\n font-family: var(--font-ui);\n font-variant-numeric: tabular-nums;\n}\n\n.categoryLabel {\n font-size: 10px;\n fill: var(--text-secondary);\n font-family: var(--font-ui);\n}\n\n.hitArea {\n fill: transparent;\n cursor: pointer;\n}\n\n.tooltip {\n position: absolute;\n pointer-events: none;\n background: var(--chart-tooltip-bg);\n border: 1px solid var(--chart-tooltip-border);\n border-radius: var(--radius-sm);\n box-shadow: var(--shadow-md);\n padding: var(--space-1) var(--space-2);\n font-size: var(--text-xs-size);\n color: var(--text-primary);\n white-space: nowrap;\n z-index: var(--z-dropdown);\n}\n\n.tooltipValue {\n font-weight: var(--font-weight-semibold);\n font-variant-numeric: tabular-nums;\n}\n\n.tooltipLabel {\n color: var(--text-tertiary);\n margin-left: var(--space-1);\n}\n\n.wrap {\n position: relative;\n}\n","/**\n * components/charts/BarChart.tsx — categorical magnitude comparison.\n * Single hue by default (nominal categories never get a value-ramp — see\n * dataviz anti-patterns \"a value-ramp on nominal categories\"). Vertical for\n * a handful of short-named categories, horizontal for many or long-named\n * ones (dataviz choosing-a-form.md). Null values render as an explicit\n * \"no data\" dash, never a silent zero-height bar indistinguishable from a\n * real zero.\n */\nimport { useId, useState } from 'react';\nimport type { CategoricalDatum } from './types.js';\nimport { CHART_SEQUENTIAL, CHART_AXIS, CHART_GRID } from './colors.js';\nimport './chart-tokens.css';\nimport styles from './BarChart.module.css';\n\nconst BAR_MAX = 24;\nconst GAP = 10;\n\nexport function BarChart({\n data,\n height = 160,\n orientation = 'vertical',\n color = CHART_SEQUENTIAL,\n formatValue = (v: number) => String(v),\n ariaLabel,\n}: {\n data: CategoricalDatum[];\n height?: number;\n orientation?: 'vertical' | 'horizontal';\n color?: string;\n formatValue?: (v: number) => string;\n ariaLabel: string;\n}) {\n const uid = useId();\n const [hover, setHover] = useState<number | null>(null);\n\n const known = data.map((d) => d.value).filter((v): v is number => v !== null);\n const maxVal = Math.max(0, ...known, 0.0001);\n const minVal = Math.min(0, ...known);\n const range = maxVal - minVal || 1;\n\n if (orientation === 'horizontal') {\n const LABEL_W = 120;\n const PAD_R = 48;\n const rowH = Math.min(BAR_MAX, Math.max(14, Math.floor((height - GAP) / data.length) - GAP));\n const plotW = 420;\n const svgH = data.length * (rowH + GAP) + GAP;\n const svgW = LABEL_W + plotW + PAD_R;\n\n return (\n <div className={styles.wrap}>\n <svg\n className={styles.svg}\n width={svgW}\n height={svgH}\n viewBox={`0 0 ${svgW} ${svgH}`}\n role=\"img\"\n aria-label={ariaLabel}\n >\n <line x1={LABEL_W} y1={0} x2={LABEL_W} y2={svgH} className={styles.baseline} stroke={CHART_AXIS} />\n {data.map((d, i) => {\n const y = GAP + i * (rowH + GAP);\n const barW = d.value !== null ? ((d.value - minVal) / range) * plotW : 0;\n return (\n <g key={d.label + i}>\n <text\n x={LABEL_W - 8}\n y={y + rowH / 2}\n dy=\"0.32em\"\n textAnchor=\"end\"\n className={styles.categoryLabel}\n >\n {d.label.length > 22 ? `${d.label.slice(0, 21)}…` : d.label}\n </text>\n {d.value === null ? (\n <line\n x1={LABEL_W + 4}\n y1={y + rowH / 2}\n x2={LABEL_W + 14}\n y2={y + rowH / 2}\n stroke={CHART_GRID}\n strokeWidth={2}\n strokeDasharray=\"2 2\"\n />\n ) : (\n <>\n <rect\n x={LABEL_W}\n y={y}\n width={Math.max(2, barW)}\n height={rowH}\n rx={4}\n fill={color}\n className={styles.bar}\n />\n <text\n x={LABEL_W + Math.max(2, barW) + 6}\n y={y + rowH / 2}\n dy=\"0.32em\"\n className={styles.valueLabel}\n >\n {formatValue(d.value)}\n </text>\n </>\n )}\n <rect\n className={styles.hitArea}\n x={0}\n y={y - GAP / 2}\n width={svgW}\n height={rowH + GAP}\n tabIndex={0}\n role=\"img\"\n aria-label={`${d.label}: ${d.value === null ? 'no data' : formatValue(d.value)}`}\n onPointerEnter={() => setHover(i)}\n onPointerLeave={() => setHover((h) => (h === i ? null : h))}\n onFocus={() => setHover(i)}\n onBlur={() => setHover((h) => (h === i ? null : h))}\n />\n </g>\n );\n })}\n </svg>\n {hover !== null ? (\n <div\n className={styles.tooltip}\n style={{ left: LABEL_W + 8, top: GAP + hover * (rowH + GAP) - 4 }}\n >\n <span className={styles.tooltipValue}>\n {data[hover].value === null ? 'no data' : formatValue(data[hover].value as number)}\n </span>\n <span className={styles.tooltipLabel}>{data[hover].label}</span>\n </div>\n ) : null}\n </div>\n );\n }\n\n // Vertical orientation.\n const barSlot = data.length ? Math.max(BAR_MAX, 0) : BAR_MAX;\n const barW = Math.min(BAR_MAX, barSlot);\n const PAD_T = 20;\n const PAD_B = 30;\n const plotH = height;\n const svgH = plotH + PAD_T + PAD_B;\n const svgW = data.length * (barW + GAP) + GAP;\n const zeroY = PAD_T + plotH - ((0 - minVal) / range) * plotH;\n\n return (\n <div className={styles.wrap}>\n <svg\n className={styles.svg}\n width={svgW}\n height={svgH}\n viewBox={`0 0 ${svgW} ${svgH}`}\n role=\"img\"\n aria-label={ariaLabel}\n >\n <line x1={0} y1={zeroY} x2={svgW} y2={zeroY} className={styles.baseline} stroke={CHART_AXIS} />\n {data.map((d, i) => {\n const x = GAP + i * (barW + GAP);\n const barH = d.value !== null ? (Math.abs(d.value - minVal) / range) * plotH : 0;\n const top = d.value !== null && d.value >= 0 ? zeroY - barH : zeroY;\n return (\n <g key={d.label + i}>\n {d.value === null ? (\n <line\n x1={x + barW / 2 - 5}\n y1={zeroY}\n x2={x + barW / 2 + 5}\n y2={zeroY}\n stroke={CHART_GRID}\n strokeWidth={2}\n strokeDasharray=\"2 2\"\n />\n ) : (\n <>\n <rect\n x={x}\n y={top}\n width={barW}\n height={Math.max(2, barH)}\n rx={4}\n fill={color}\n className={styles.bar}\n />\n <text x={x + barW / 2} y={top - 4} textAnchor=\"middle\" className={styles.valueLabel}>\n {formatValue(d.value)}\n </text>\n </>\n )}\n <text\n x={x + barW / 2}\n y={svgH - 8}\n textAnchor=\"middle\"\n className={styles.axisLabel}\n >\n {d.label.length > 10 ? `${d.label.slice(0, 9)}…` : d.label}\n </text>\n <rect\n className={styles.hitArea}\n x={x - GAP / 2}\n y={0}\n width={barW + GAP}\n height={svgH}\n tabIndex={0}\n role=\"img\"\n aria-label={`${d.label}: ${d.value === null ? 'no data' : formatValue(d.value)}`}\n onPointerEnter={() => setHover(i)}\n onPointerLeave={() => setHover((h) => (h === i ? null : h))}\n onFocus={() => setHover(i)}\n onBlur={() => setHover((h) => (h === i ? null : h))}\n />\n </g>\n );\n })}\n </svg>\n {hover !== null ? (\n <div\n className={styles.tooltip}\n style={{ left: GAP + hover * (barW + GAP), top: 0 }}\n id={`${uid}-tooltip`}\n >\n <span className={styles.tooltipValue}>\n {data[hover].value === null ? 'no data' : formatValue(data[hover].value as number)}\n </span>\n <span className={styles.tooltipLabel}>{data[hover].label}</span>\n </div>\n ) : null}\n </div>\n );\n}\n",".sparkline {\n display: block;\n overflow: visible;\n}\n\n.line {\n fill: none;\n stroke: var(--text-tertiary);\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.dot {\n fill: var(--chart-sequential);\n}\n","/**\n * components/charts/Sparkline.tsx — the 12-ish-point inline trend for a\n * stat tile (marks-and-anatomy.md \"Figures\" stat-tile contract). No axes,\n * no legend, no tooltip — it is a glance, not a chart; the real numbers\n * live in the stat tile's value and in the full chart elsewhere on the\n * view. Gaps (`null`) break the line rather than reading as a dip to zero.\n */\nimport './chart-tokens.css';\nimport styles from './Sparkline.module.css';\n\nexport function Sparkline({\n points,\n width = 72,\n height = 24,\n ariaLabel,\n}: {\n points: (number | null)[];\n width?: number;\n height?: number;\n ariaLabel: string;\n}) {\n const known = points.filter((p): p is number => p !== null);\n if (known.length < 2) {\n return (\n <svg width={width} height={height} viewBox={`0 0 ${width} ${height}`} role=\"img\" aria-label={ariaLabel} />\n );\n }\n const min = Math.min(...known, 0);\n const max = Math.max(...known, 0);\n const range = max - min || 1;\n const stepX = width / Math.max(1, points.length - 1);\n const yOf = (v: number) => height - ((v - min) / range) * (height - 2) - 1;\n\n // Split into contiguous runs so a null renders as a real gap, not a dip.\n const runs: { x: number; y: number }[][] = [];\n let current: { x: number; y: number }[] = [];\n points.forEach((v, i) => {\n if (v === null) {\n if (current.length) runs.push(current);\n current = [];\n return;\n }\n current.push({ x: i * stepX, y: yOf(v) });\n });\n if (current.length) runs.push(current);\n\n const lastKnownIndex = points.map((v) => v !== null).lastIndexOf(true);\n const lastPoint =\n lastKnownIndex >= 0 ? { x: lastKnownIndex * stepX, y: yOf(points[lastKnownIndex] as number) } : null;\n\n return (\n <svg width={width} height={height} viewBox={`0 0 ${width} ${height}`} role=\"img\" aria-label={ariaLabel}>\n {runs.map((run, i) => (\n <path\n key={i}\n className={styles.line}\n d={run.map((p, j) => `${j === 0 ? 'M' : 'L'}${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(' ')}\n />\n ))}\n {lastPoint ? <circle className={styles.dot} cx={lastPoint.x} cy={lastPoint.y} r={2} /> : null}\n </svg>\n );\n}\n","/**\n * components/charts/format.ts — number formatting shared by every chart and\n * stat tile. Proportional figures everywhere EXCEPT columns that must align\n * vertically (table cells, axis ticks) — see marks-and-anatomy.md \"Proportional\n * figures for big numbers; tabular only in columns.\" Callers apply\n * `font-variant-numeric: tabular-nums` via CSS where that applies; these\n * functions only produce the string.\n */\n\n/** Auto-compact a count: 1,284 / 12.9K / 4.2M. */\nexport function formatCompact(n: number): string {\n if (!Number.isFinite(n)) return '—';\n const abs = Math.abs(n);\n if (abs >= 1_000_000) return `${(n / 1_000_000).toFixed(abs >= 10_000_000 ? 0 : 1)}M`;\n if (abs >= 10_000) return `${Math.round(n / 1000)}K`;\n if (abs >= 1_000) return n.toLocaleString('en-US');\n return Number.isInteger(n) ? String(n) : n.toFixed(1);\n}\n\n/** Auto-compact USD: $4.20 / $1.2K / $4.2M. */\nexport function formatUsd(n: number): string {\n if (!Number.isFinite(n)) return '—';\n const abs = Math.abs(n);\n const sign = n < 0 ? '-' : '';\n if (abs >= 1_000_000) return `${sign}$${(abs / 1_000_000).toFixed(1)}M`;\n if (abs >= 1_000) return `${sign}$${(abs / 1_000).toFixed(1)}K`;\n return `${sign}$${abs.toFixed(2)}`;\n}\n\n/** Fraction (0..1) as a percentage. */\nexport function formatPercent(fraction: number, digits = 0): string {\n if (!Number.isFinite(fraction)) return '—';\n return `${(fraction * 100).toFixed(digits)}%`;\n}\n\n/** Signed delta for a stat tile: \"+12\" / \"-3\" / \"0\". */\nexport function formatSignedCompact(n: number): string {\n if (!Number.isFinite(n)) return '—';\n const s = formatCompact(Math.abs(n));\n if (n > 0) return `+${s}`;\n if (n < 0) return `-${s}`;\n return s;\n}\n\n/** YYYY-MM-DD -> short label, e.g. \"Aug 14\". Local-independent (UTC parse). */\nexport function formatDayLabel(day: string): string {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(day)) return day;\n const d = new Date(`${day}T00:00:00Z`);\n // Date normalizes impossible dates; compare the padded UTC date to reject rollover.\n if (Number.isNaN(d.getTime()) || d.toISOString().slice(0, 10) !== day) return day;\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' });\n}\n\n/** Epoch ms -> short label for axis ticks. */\nexport function formatTimeLabel(ms: number): string {\n const d = new Date(ms);\n if (Number.isNaN(d.getTime())) return '';\n return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });\n}\n",".tile {\n display: flex;\n flex-direction: column;\n gap: var(--space-1);\n padding: var(--space-4);\n border-radius: var(--radius-lg);\n border: 1px solid var(--border-subtle);\n background: var(--bg-surface);\n}\n\n.label {\n font-size: var(--text-xs-size);\n color: var(--text-tertiary);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n\n.row {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--space-2);\n}\n\n.value {\n font-size: var(--text-2xl-size);\n font-weight: var(--font-weight-semibold);\n color: var(--text-primary);\n}\n\n.trendRow {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-2);\n}\n\n.delta {\n font-size: var(--text-xs-size);\n font-variant-numeric: tabular-nums;\n}\n\n.deltaGood {\n color: var(--status-success-fg);\n}\n\n.deltaBad {\n color: var(--status-danger-fg);\n}\n\n.deltaNeutral {\n color: var(--text-tertiary);\n}\n\n.caption {\n font-size: var(--text-xs-size);\n color: var(--text-tertiary);\n}\n","/**\n * components/charts/StatTile.tsx — value + delta + optional sparkline, the\n * figure contract from marks-and-anatomy.md. Use for a single current value\n * (a one-bar bar chart is never the answer — this is). `value` takes a\n * ReactNode (not just a string) so callers can wrap a sourceQuality-bearing\n * field in <Epistemic/> and pass that straight through.\n */\nimport type { ReactNode } from 'react';\nimport { formatSignedCompact } from './format.js';\nimport { Sparkline } from './Sparkline.js';\nimport styles from './StatTile.module.css';\n\nexport interface StatTileDelta {\n /** Signed raw value, e.g. +12 or -3. */\n value: number;\n /** Whether a positive delta reads as good (green) or bad (red). Omit for\n * a neutral, non-judgmental delta (e.g. \"goals in flight\" — more isn't\n * inherently good or bad). */\n goodWhenPositive?: boolean;\n /** vs which period, e.g. \"vs yesterday\". */\n versus?: string;\n}\n\nexport function StatTile({\n label,\n value,\n caption,\n delta,\n trend,\n trendLabel,\n}: {\n label: string;\n value: ReactNode;\n caption?: ReactNode;\n delta?: StatTileDelta | null;\n trend?: (number | null)[];\n trendLabel?: string;\n}) {\n const deltaTone =\n delta == null || delta.goodWhenPositive === undefined\n ? styles.deltaNeutral\n : delta.value === 0\n ? styles.deltaNeutral\n : (delta.value > 0) === delta.goodWhenPositive\n ? styles.deltaGood\n : styles.deltaBad;\n\n return (\n <div className={styles.tile}>\n <span className={styles.label}>{label}</span>\n <div className={styles.row}>\n <span className={styles.value}>{value}</span>\n </div>\n <div className={styles.trendRow}>\n {caption ? <span className={styles.caption}>{caption}</span> : <span />}\n {trend ? <Sparkline points={trend} ariaLabel={trendLabel ?? `${label} trend`} /> : null}\n </div>\n {delta ? (\n <span className={`${styles.delta} ${deltaTone}`}>\n {formatSignedCompact(delta.value)}\n {delta.versus ? ` ${delta.versus}` : ''}\n </span>\n ) : null}\n </div>\n );\n}\n",".table {\n width: 100%;\n border-collapse: collapse;\n font-size: var(--text-xs-size);\n}\n\n.table th,\n.table td {\n text-align: left;\n padding: var(--space-1) var(--space-2);\n border-bottom: 1px solid var(--border-subtle);\n}\n\n.table th {\n color: var(--text-tertiary);\n font-weight: var(--font-weight-medium);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n font-size: var(--text-xs-size);\n}\n\n.numeric {\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n","/**\n * components/charts/TableView.tsx — the WCAG-clean accessibility twin every\n * chart should ship (dataviz skill: \"no table view / color-only encoding on\n * a continuous scale\" is an anti-pattern). Every value a chart's tooltip or\n * direct label shows must also be reachable here without hovering anything.\n */\nimport type { ReactNode } from 'react';\nimport styles from './TableView.module.css';\n\nexport interface TableColumn<T> {\n key: string;\n label: string;\n numeric?: boolean;\n render: (row: T) => ReactNode;\n}\n\nexport function TableView<T>({\n caption,\n columns,\n rows,\n rowKey,\n}: {\n caption: string;\n columns: TableColumn<T>[];\n rows: T[];\n rowKey: (row: T, index: number) => string;\n}) {\n return (\n <table className={styles.table}>\n <caption className=\"visually-hidden\">{caption}</caption>\n <thead>\n <tr>\n {columns.map((c) => (\n <th key={c.key} scope=\"col\" className={c.numeric ? styles.numeric : undefined}>\n {c.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr key={rowKey(row, i)}>\n {columns.map((c) => (\n <td key={c.key} className={c.numeric ? styles.numeric : undefined}>\n {c.render(row)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n"],"mappings":"yUC8BA,SAAgB,EAAe,CAC7B,QACA,cACA,SACA,WACA,QACA,QACA,eAAe,4BACO,CACtB,OACE,EAAA,EAAA,KAAA,CAAC,SAAD,CAAQ,UAAW,EAAO,OAA1B,SAAA,EACE,EAAA,EAAA,KAAA,CAAC,aAAD,CAAY,UAAW,EAAO,QAA9B,SAAA,EACE,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAO,MAAQ,SAAA,CAAY,CAAA,EAC3C,GAAc,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAO,YAAc,SAAA,CAAkB,CAAA,EAAI,IACjE,IACX,GACC,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,EAAO,OAAQ,KAAK,OAC/B,SAAA,CACA,CAAA,EACD,KACH,GACC,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,EAAO,MAAQ,SAAA,CAAgB,CA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AA,EAAA,IAAA,CAAC,KAAD,CAAA,SACG,EAAQ,IAAK,IACZ,EAAA,EAAA,IAAA,CAAC,KAAD,CAAgB,UAAW,EAAE,QAAU,EAAO,QAAU,IAAA,GACrD,SAAA,EAAE,OAAO,CAAG,CACX,EAFK,EAAE,GAEP,CACL,CACC,EANK,EAAO,EAAK,CAAC,CAMlB,CACL,CACI,CAAA,CACF,GAEX"}
@@ -0,0 +1 @@
1
+ :root{--chart-series-1:var(--status-success-solid);--chart-series-2:var(--phase-2);--chart-series-3:var(--phase-5);--chart-series-4:var(--status-danger-solid);--chart-series-5:var(--phase-1);--chart-series-6:var(--phase-4);--chart-series-7:var(--phase-3);--chart-neutral:var(--status-neutral-solid);--chart-sequential:var(--accent-500);--chart-sequential-soft:var(--accent-300);--chart-diverging-pos:var(--accent-500);--chart-diverging-neg:var(--status-danger-solid);--chart-diverging-mid:var(--border-strong);--chart-grid:var(--border-subtle);--chart-axis:var(--border-strong);--chart-surface:var(--bg-surface);--chart-tooltip-bg:var(--bg-surface-raised);--chart-tooltip-border:var(--border-default)}._figure_1si9v_1{border:1px solid var(--border-subtle);border-radius:var(--radius-lg);background:var(--bg-surface);padding:var(--space-4);margin:0}._caption_1si9v_12{justify-content:space-between;align-items:baseline;gap:var(--space-3);margin-bottom:var(--space-3);display:flex}._title_1si9v_20{font-size:var(--text-sm-size);font-weight:var(--font-weight-semibold);color:var(--text-primary)}._description_1si9v_26{font-size:var(--text-xs-size);color:var(--text-tertiary)}._plot_1si9v_31{width:100%;overflow-x:auto}._tableDisclosure_1si9v_36{margin-top:var(--space-3);border-top:1px solid var(--border-subtle);padding-top:var(--space-2)}._tableDisclosure_1si9v_36>summary{cursor:pointer;font-size:var(--text-xs-size);color:var(--text-secondary);list-style:none}._tableDisclosure_1si9v_36>summary::-webkit-details-marker{display:none}._tableDisclosure_1si9v_36>summary:before{content:"▸ "}._tableDisclosure_1si9v_36[open]>summary:before{content:"▾ "}._tableBody_1si9v_61{margin-top:var(--space-2)}._caveat_1si9v_65{margin:0 0 var(--space-3);padding:var(--space-2) var(--space-3);border-radius:var(--radius-md);background:var(--status-unknown-bg);color:var(--status-unknown-fg);font-size:var(--text-xs-size);line-height:var(--text-sm-line)}._empty_1si9v_75{color:var(--text-tertiary);font-size:var(--text-sm-size);padding:var(--space-6) 0;text-align:center}._legend_4pgvn_1{gap:var(--space-1) var(--space-4);margin:var(--space-2) 0 0;flex-wrap:wrap;padding:0;list-style:none;display:flex}._item_4pgvn_10{align-items:center;gap:var(--space-2);font-size:var(--text-xs-size);color:var(--text-secondary);display:inline-flex}._swatch_4pgvn_18{border-radius:var(--radius-full);flex:none;width:10px;height:10px}._swatchLine_4pgvn_25{border-radius:var(--radius-full);flex:none;width:14px;height:2px}._svg_djmd1_1{width:100%;height:auto;display:block}._gridline_djmd1_7{stroke:var(--chart-grid);stroke-width:1px}._axis_djmd1_12{stroke:var(--chart-axis);stroke-width:1px}._axisLabel_djmd1_17{font-size:var(--text-xs-size);fill:var(--text-tertiary);font-family:var(--font-ui)}._line_djmd1_23{fill:none;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}._area_djmd1_30{opacity:.1;stroke:none}._marker_djmd1_35{stroke:var(--chart-surface);stroke-width:2px}._endLabel_djmd1_40{font-size:var(--text-xs-size);font-family:var(--font-ui);font-weight:var(--font-weight-medium)}._crosshairLine_djmd1_46{stroke:var(--chart-axis);stroke-width:1px;pointer-events:none}._overlay_djmd1_52{fill:#0000;cursor:crosshair}._wrap_djmd1_57{position:relative}._tooltip_djmd1_61{pointer-events:none;background:var(--chart-tooltip-bg);border:1px solid var(--chart-tooltip-border);border-radius:var(--radius-sm);box-shadow:var(--shadow-md);padding:var(--space-2);font-size:var(--text-xs-size);color:var(--text-primary);white-space:nowrap;z-index:var(--z-dropdown);margin-top:-10px;position:absolute;transform:translate(-50%,-100%)}._tooltipDate_djmd1_77{color:var(--text-tertiary);margin-bottom:var(--space-1)}._tooltipRow_djmd1_82{align-items:center;gap:var(--space-1);display:flex}._tooltipKey_djmd1_88{flex:none;width:12px;height:2px}._tooltipValue_djmd1_94{font-weight:var(--font-weight-semibold);font-variant-numeric:tabular-nums}._tooltipGap_djmd1_99{color:var(--text-tertiary);font-style:italic}._svg_o4jfa_1{display:block;overflow:visible}._bar_o4jfa_6{transition:opacity var(--duration-fast) var(--ease-standard)}._bar_o4jfa_6:hover,._bar_o4jfa_6:focus-visible{opacity:.82}._baseline_o4jfa_15{stroke:var(--chart-axis);stroke-width:1px}._gridline_o4jfa_20{stroke:var(--chart-grid);stroke-width:1px}._axisLabel_o4jfa_25{fill:var(--text-tertiary);font-size:10px;font-family:var(--font-ui)}._valueLabel_o4jfa_31{fill:var(--text-secondary);font-size:10px;font-family:var(--font-ui);font-variant-numeric:tabular-nums}._categoryLabel_o4jfa_38{fill:var(--text-secondary);font-size:10px;font-family:var(--font-ui)}._hitArea_o4jfa_44{fill:#0000;cursor:pointer}._tooltip_o4jfa_49{pointer-events:none;background:var(--chart-tooltip-bg);border:1px solid var(--chart-tooltip-border);border-radius:var(--radius-sm);box-shadow:var(--shadow-md);padding:var(--space-1) var(--space-2);font-size:var(--text-xs-size);color:var(--text-primary);white-space:nowrap;z-index:var(--z-dropdown);position:absolute}._tooltipValue_o4jfa_63{font-weight:var(--font-weight-semibold);font-variant-numeric:tabular-nums}._tooltipLabel_o4jfa_68{color:var(--text-tertiary);margin-left:var(--space-1)}._wrap_o4jfa_73{position:relative}._sparkline_gomyo_1{display:block;overflow:visible}._line_gomyo_6{fill:none;stroke:var(--text-tertiary);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}._dot_gomyo_14{fill:var(--chart-sequential)}._tile_rp7c9_1{gap:var(--space-1);padding:var(--space-4);border-radius:var(--radius-lg);border:1px solid var(--border-subtle);background:var(--bg-surface);flex-direction:column;display:flex}._label_rp7c9_11{font-size:var(--text-xs-size);color:var(--text-tertiary);text-transform:uppercase;letter-spacing:.04em}._row_rp7c9_18{justify-content:space-between;align-items:baseline;gap:var(--space-2);display:flex}._value_rp7c9_25{font-size:var(--text-2xl-size);font-weight:var(--font-weight-semibold);color:var(--text-primary)}._trendRow_rp7c9_31{justify-content:space-between;align-items:center;gap:var(--space-2);display:flex}._delta_rp7c9_38{font-size:var(--text-xs-size);font-variant-numeric:tabular-nums}._deltaGood_rp7c9_43{color:var(--status-success-fg)}._deltaBad_rp7c9_47{color:var(--status-danger-fg)}._deltaNeutral_rp7c9_51{color:var(--text-tertiary)}._caption_rp7c9_55{font-size:var(--text-xs-size);color:var(--text-tertiary)}._table_1ggl4_1{border-collapse:collapse;width:100%;font-size:var(--text-xs-size)}._table_1ggl4_1 th,._table_1ggl4_1 td{text-align:left;padding:var(--space-1) var(--space-2);border-bottom:1px solid var(--border-subtle)}._table_1ggl4_1 th{color:var(--text-tertiary);font-weight:var(--font-weight-medium);text-transform:uppercase;letter-spacing:.04em;font-size:var(--text-xs-size)}._numeric_1ggl4_22{text-align:right;font-variant-numeric:tabular-nums}
@@ -0,0 +1,2 @@
1
+ import{s as e}from"./format-BNYWGJat.js";function t(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function n(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function r(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null}function i(e,t){let n=r(e,t);return n===null?null:Math.max(0,Math.round(n))}function a(e,t){let n=e[t];return typeof n==`boolean`?n:null}function o(e,t){let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}var s=[`llama-server`,`ollama`,`vllm`,`unknown`],c=[`running`,`starting`,`stopping`,`stopped`,`unknown`],l=[`queued`,`running`,`finishing`],u=[`off`,`config`,`env`,`config+env`,`latch`,`unknown`];function d(e,t,n,r){let i=e[t];return typeof i==`string`&&n.includes(i)?i:r}function f(e){let r=t(e);return r?{capable:a(r,`capable`),refusal:n(r,`refusal`),slots:i(r,`slots`)}:{capable:null,refusal:null,slots:null}}var p={up:`running`,down:`stopped`,loading:`starting`,unknown:`unknown`};function m(e){let r=e.state;if(typeof r!=`string`||!(r in p))return null;let o=t(e.slots),s=n(e,`host`),c=i(e,`port`),l=o?i(o,`configured`):null,u=o?i(o,`busy`):null,d=o?n(o,`source`):null,f=d!==null&&d!==`unknown`,m=f?l:null,g=n(e,`parallelRefusal`),_=n(e,`runtimeKind`),v=i(e,`contextPerSlot`),y=i(e,`contextTotal`);return{kind:_===`ollama`?`ollama`:_===`unknown`?`unknown`:`llama-server`,state:p[r]??`unknown`,endpoint:s!==null&&c!==null?`${s}:${c}`:n(e,`origin`)??null,model:h(n(e,`modelName`))??h(n(e,`model`)),slotsTotal:m,slotsBusy:f?u:null,contextTokens:v??(m!==null&&m>0&&y!==null&&y>0?Math.floor(y/m):null),startedAt:n(e,`startedAt`),parallel:{capable:g===null?f&&m!==null?!0:null:!1,refusal:g,slots:m},reason:n(e,`lastError`),supervised:a(e,`managed`)??!1,sampledAt:n(e,`checkedAt`)}}function h(e){if(e===null||e.length===0)return null;let t=e.split(`/`).pop()??e;return t.length===0||/^sha256[-:][0-9a-f]{16,}$/i.test(t)?null:t}function g(e){let r=t(e);if(!r)return null;if(!(`kind`in r)&&`slots`in r&&`state`in r){let e=m(r);if(e!==null)return e}return{kind:d(r,`kind`,s,`unknown`),state:d(r,`state`,c,`unknown`),endpoint:n(r,`endpoint`),model:n(r,`model`),slotsTotal:i(r,`slotsTotal`),slotsBusy:i(r,`slotsBusy`),contextTokens:i(r,`contextTokens`),startedAt:n(r,`startedAt`),parallel:f(r.parallel),reason:n(r,`reason`),supervised:a(r,`supervised`)??!1,sampledAt:n(r,`sampledAt`)}}function _(e){let r=t(e);if(!r)return null;let a=n(r,`id`);return a===null?null:{id:a,task:n(r,`task`),repo:n(r,`repo`),engine:n(r,`engine`),model:n(r,`model`),state:d(r,`state`,l,`running`),startedAt:n(r,`startedAt`),slot:i(r,`slot`)}}function v(e){let r=t(e);return r?{agents:(Array.isArray(r.agents)?r.agents:[]).map(_).filter(e=>e!==null),queueDepth:i(r,`queueDepth`),slotsTotal:i(r,`slotsTotal`),slotsBusy:i(r,`slotsBusy`),notes:o(r,`notes`),sampledAt:n(r,`sampledAt`)}:null}function y(e){let r=t(e);if(!r)return null;let i=n(r,`engine`);return i===null?null:{engine:i,reason:n(r,`reason`)??`The dispatcher refuses this engine while local-only is on.`}}var b=new Set([`env`,`config+env`,`latch`,`unknown`]);function x(e){let r=t(e);if(!r)return null;let i=Array.isArray(r.refuses)?r.refuses:[],o=d(r,`source`,u,`unknown`);return{enabled:a(r,`enabled`)??!1,source:o,refuses:i.map(y).filter(e=>e!==null),mutable:b.has(o)?!1:a(r,`mutable`)??!1,detail:n(r,`detail`),sampledAt:n(r,`sampledAt`)??n(r,`checkedAt`)}}function S(e){switch(e){case`llama-server`:return`llama-server`;case`ollama`:return`Ollama`;case`vllm`:return`vLLM`;default:return`the serving runtime`}}function C(e){if(e===null)return{verdict:`unknown`,effectiveConcurrency:null,configuredSlots:null,overstated:!1,headline:`No serving runtime reported`,detail:`Nothing answered for the serving runtime, so how many agents can run at once is unknown. That is a missing reading, not an idle machine.`,tone:`unknown`};let t=e.slotsTotal??e.parallel.slots,n=S(e.kind);if(e.state!==`running`)return{verdict:`offline`,effectiveConcurrency:null,configuredSlots:t,overstated:!1,headline:e.state===`stopped`?`Not serving`:`Serving runtime is ${e.state}`,detail:e.state===`stopped`?`${n} is not running, so no local agent can take a turn. Start it before dispatching a fleet.`:`${n} is ${e.state}; capacity is not settled until it reports running.`,tone:e.state===`stopped`?`neutral`:`warning`};if(e.parallel.capable===!1){let e=t!==null&&t>1;return{verdict:`serialized`,effectiveConcurrency:1,configuredSlots:t,overstated:e,headline:`${n} serializes requests`,detail:e?`${n} has ${t} slots configured but runs one request at a time for this model, so the real capacity is one agent. The other ${t-1} would queue, and a queue looks like slowness rather than a wait.`:`${n} runs one request at a time for this model. A second agent waits for the first to finish.`,tone:`danger`}}return e.parallel.capable===null?{verdict:`unknown`,effectiveConcurrency:null,configuredSlots:t,overstated:!1,headline:`Batching not confirmed`,detail:`${n} is running${t===null?``:` with ${t} slots configured`}, but it has not reported whether it batches concurrent requests for this model. Until it does, this panel will not quote a concurrency it cannot stand behind.`,tone:`unknown`}:t===null?{verdict:`batched`,effectiveConcurrency:null,configuredSlots:null,overstated:!1,headline:`${n} batches concurrent requests`,detail:`${n} batches, but reported no slot count, so the ceiling on concurrent agents is unknown.`,tone:`unknown`}:{verdict:`batched`,effectiveConcurrency:t,configuredSlots:t,overstated:!1,headline:`${t} agent${t===1?``:`s`} in parallel`,detail:`${n} batches across ${t} slot${t===1?``:`s`} sharing one copy of the weights, so ${t} agent${t===1?``:`s`} can be mid-turn at once.`,tone:`success`}}var w=[{runtime:`Ollama`,perRequestSeconds:[3.7,7.6,11.4,15.2],wallSeconds:15.2,verdict:`staggered — the requests queued`},{runtime:`llama-server`,perRequestSeconds:[8.6,8.9,9,9],wallSeconds:9.1,verdict:`together — the requests batched`}];function T(e,t){if(e===null||t===null||t<=0)return{busy:e,total:t,percent:null,saturated:!1,label:e===null?`Slot occupancy is not reported.`:`${e} in flight; the number of slots is not known, so occupancy cannot be drawn.`};let n=Math.round(Math.min(e,t)/t*100),r=e>=t;return{busy:e,total:t,percent:n,saturated:r,label:r?`All ${t} slot${t===1?``:`s`} busy — new turns wait for one to free up.`:`${e} of ${t} slot${t===1?``:`s`} busy.`}}function E(e,t,n){if(e===null)return{state:`unknown`,headline:`Fleet not reported`,detail:`No fleet snapshot answered, so what is in flight cannot be listed. That is a missing reading, not an empty fleet.`,tone:`unknown`};let r=e.agents.filter(e=>e.state!==`queued`).length,i=e.queueDepth??e.agents.filter(e=>e.state===`queued`).length;return i>0?{state:`queued`,headline:`${i} waiting for a slot`,detail:n.verdict===`serialized`?`${r} turn${r===1?``:`s`} in flight and ${i} queued. This runtime serializes, so the queue drains one at a time — the wait is a wait, not slow inference.`:`${r} turn${r===1?``:`s`} in flight and ${i} queued behind ${t.total===null?`the available slots`:`${t.total} slots`}. Queued turns have not started; their wall time is queueing, not work.`,tone:`warning`}:r===0?{state:`idle`,headline:`Nothing in flight`,detail:`No agent is mid-turn. The fleet is idle, not stuck.`,tone:`neutral`}:t.saturated?{state:`saturated`,headline:`All slots busy · ${r} in flight`,detail:`Every slot is working and nothing is queued behind them. The next turn will wait, but none is waiting yet.`,tone:`running`}:{state:`working`,headline:`${r} in flight`,detail:t.label,tone:`running`}}var D=`Refused: local-only is on and this engine is not local.`;function O(e,t){let n=t.filter(e=>e.engine!==`local`),r=t.filter(e=>e.engine===`local`),i=new Map;for(let t of e?.refuses??[])i.set(t.engine,t.reason);return{blocked:n,allowed:r,refusalFor:e=>i.get(e)??D,summary:t.length===0?`No seats are configured, so there is nothing for this policy to block yet.`:n.length===0?`Every one of your ${t.length} seat${t.length===1?``:`s`} is local, so this policy would block nothing today.`:`${n.length} of ${t.length} seat${t.length===1?``:`s`} would become unreachable; ${r.length} local seat${r.length===1?``:`s`} would keep working.`}}function k(e){if(e===null)return null;if(e.detail!==null)return e.detail;switch(e.source){case`env`:case`config+env`:return`This policy is pinned by an environment variable on the server process, so it cannot be changed from here — restart the server without it to take the switch back.`;case`latch`:return`This process already observed a persisted local-only and has pinned it for its own lifetime, so turning it off takes effect for new dispatches but not for the seams that latched. Restart the server to clear it.`;case`config`:return`Stored in the hub config and applied on the next dispatch.`;case`off`:return`Not configured; cloud engines are reachable.`;default:return`The server did not say where this setting came from.`}}function A(t,n){if(!t)return`—`;let r=Date.parse(t);return Number.isNaN(r)?`—`:e(Math.max(0,n-r))}function j(t,n){if(!t)return`—`;let r=Date.parse(t);return Number.isNaN(r)?`—`:`up ${e(Math.max(0,n-r))}`}function M(e){return e===null||!Number.isFinite(e)?`—`:e>=1024?`${Math.round(e/1024)}k`:String(e)}function N(e){let t={running:0,finishing:1,queued:2};return[...e].sort((e,n)=>{let r=t[e.state]-t[n.state];if(r!==0)return r;let i=e.startedAt?Date.parse(e.startedAt):NaN,a=n.startedAt?Date.parse(n.startedAt):NaN;return Number.isNaN(i)&&Number.isNaN(a)?e.id.localeCompare(n.id):Number.isNaN(i)?1:Number.isNaN(a)?-1:i-a})}export{j as a,N as c,g as d,C as f,M as i,v as l,T as m,A as n,O as o,S as p,E as r,k as s,w as t,x as u};
2
+ //# sourceMappingURL=fleet-model-ClBbQ0Uj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-model-ClBbQ0Uj.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/autonomy/fleet-model.ts"],"sourcesContent":["/**\n * routes/verse/autonomy/fleet-model.ts — every derivation the local-fleet\n * surfaces make, as pure functions. No React, no I/O, so the rules that decide\n * what the operator is told are unit-testable without a DOM.\n *\n * The one rule this file exists to enforce:\n *\n * **A concurrency number the runtime will not honour is a lie, and the UI\n * must print the truth instead of the configuration.**\n *\n * That is not a hypothetical. Measured on this machine (docs/LOCAL-FLEET.md),\n * four concurrent Qwen3.8 requests to Ollama returned at 3.7 / 7.6 / 11.4 /\n * 15.2s — a four-second stagger, which is a queue. The same weights on\n * llama-server returned at 8.6 / 8.9 / 9.0 / 9.0s: continuous batching across\n * four slots sharing one 27 GB copy. Ollama's log calls it a refusal\n * (`model architecture does not currently support parallel requests`) and\n * `OLLAMA_NUM_PARALLEL` does not move it.\n *\n * So `runtimeCapacity()` never reports `slotsTotal` as capacity unless the\n * runtime says it batches. When a runtime that serializes is configured with\n * four slots, the capacity is ONE and `overstated` is true, and the panel says\n * so in words. A queue that looks like slowness is the exact failure this\n * surface is here to prevent.\n *\n * The bodies these functions narrow come from routes that are landing in\n * parallel (see fleet-contract.ts), so everything is projected STRUCTURALLY\n * rather than cast: a field-name drift degrades to an honest \"unknown\" at\n * render time instead of throwing.\n */\nimport { UNKNOWN, formatDuration } from './format.js';\nimport type {\n FleetAgent,\n FleetAgentState,\n FleetSnapshot,\n LocalOnlyPolicy,\n LocalOnlyRefusal,\n LocalOnlySource,\n ServingRuntimeKind,\n ServingRuntimeParallelism,\n ServingRuntimeSnapshot,\n ServingRuntimeState,\n} from './fleet-contract.js';\n\n// ---------------------------------------------------------------------------\n// Structural narrowing\n// ---------------------------------------------------------------------------\n\nfunction record(value: unknown): Record<string, unknown> | null {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction str(source: Record<string, unknown>, key: string): string | null {\n const v = source[key];\n return typeof v === 'string' && v.length > 0 ? v : null;\n}\n\nfunction num(source: Record<string, unknown>, key: string): number | null {\n const v = source[key];\n return typeof v === 'number' && Number.isFinite(v) ? v : null;\n}\n\n/** A count that is meaningful at zero — so 0 stays 0 and absent stays null. */\nfunction count(source: Record<string, unknown>, key: string): number | null {\n const v = num(source, key);\n return v === null ? null : Math.max(0, Math.round(v));\n}\n\nfunction bool(source: Record<string, unknown>, key: string): boolean | null {\n const v = source[key];\n return typeof v === 'boolean' ? v : null;\n}\n\nfunction strings(source: Record<string, unknown>, key: string): string[] {\n const v = source[key];\n return Array.isArray(v) ? v.filter((entry): entry is string => typeof entry === 'string') : [];\n}\n\nconst RUNTIME_KINDS: readonly ServingRuntimeKind[] = ['llama-server', 'ollama', 'vllm', 'unknown'];\nconst RUNTIME_STATES: readonly ServingRuntimeState[] = [\n 'running',\n 'starting',\n 'stopping',\n 'stopped',\n 'unknown',\n];\nconst AGENT_STATES: readonly FleetAgentState[] = ['queued', 'running', 'finishing'];\nconst LOCAL_ONLY_SOURCES: readonly LocalOnlySource[] = [\n 'off',\n 'config',\n 'env',\n 'config+env',\n 'latch',\n 'unknown',\n];\n\nfunction oneOf<T extends string>(\n source: Record<string, unknown>,\n key: string,\n allowed: readonly T[],\n fallback: T,\n): T {\n const v = source[key];\n return typeof v === 'string' && (allowed as readonly string[]).includes(v) ? (v as T) : fallback;\n}\n\nfunction projectParallelism(raw: unknown): ServingRuntimeParallelism {\n const r = record(raw);\n if (!r) return { capable: null, refusal: null, slots: null };\n return { capable: bool(r, 'capable'), refusal: str(r, 'refusal'), slots: count(r, 'slots') };\n}\n\n/**\n * Owner R's `LlamaRuntimeSnapshot` (`src/core/local-runtime/llama/types.ts`)\n * spells the same facts differently, and the route that serves it is not\n * written yet — so rather than betting on one envelope, this reads both.\n *\n * The mapping, with the two judgement calls stated:\n *\n * - `state: 'up' | 'down' | 'loading' | 'unknown'` → running / stopped /\n * starting / unknown.\n * - `contextPerSlot` wins over `contextTotal`. `-c 65536 --parallel 4` gives\n * each slot 16k, and the number an agent's turn actually runs in is the\n * per-slot one. Quoting the total would overstate every agent's context\n * fourfold — the same class of error as quoting slots as concurrency.\n * - `managed` → `supervised`. R is explicit that an unmanaged server may be\n * adopted but is \"never killed on a guess\", which is exactly the condition\n * under which this panel must not offer a stop button.\n */\nconst LLAMA_STATE: Readonly<Record<string, ServingRuntimeState>> = {\n up: 'running',\n down: 'stopped',\n loading: 'starting',\n unknown: 'unknown',\n};\n\nfunction projectLlamaShape(r: Record<string, unknown>): ServingRuntimeSnapshot | null {\n const rawState = r['state'];\n if (typeof rawState !== 'string' || !(rawState in LLAMA_STATE)) return null;\n const slots = record(r['slots']);\n const host = str(r, 'host');\n const port = count(r, 'port');\n const configured = slots ? count(slots, 'configured') : null;\n const busy = slots ? count(slots, 'busy') : null;\n // `slots.source` is R's own trust marker: 'unknown' means \"do not trust a\n // number\", so a slot count carrying it is dropped rather than quoted.\n const slotSource = slots ? str(slots, 'source') : null;\n const trusted = slotSource !== null && slotSource !== 'unknown';\n const total = trusted ? configured : null;\n\n const refusal = str(r, 'parallelRefusal');\n const identity = str(r, 'runtimeKind');\n const contextPerSlot = count(r, 'contextPerSlot');\n const contextTotal = count(r, 'contextTotal');\n\n return {\n // IDENTIFIED where the producer says so. A base URL pointed at Ollama's\n // /v1 answers /v1/models — enough to keep the engine routable — while\n // 404ing /health and /props, and asserting 'llama-server' for it would\n // hide the one fact that matters: that runtime serialises this model.\n kind: identity === 'ollama' ? 'ollama' : identity === 'unknown' ? 'unknown' : 'llama-server',\n state: LLAMA_STATE[rawState] ?? 'unknown',\n endpoint: host !== null && port !== null ? `${host}:${port}` : (str(r, 'origin') ?? null),\n // A digest is not a name. `modelName` falls back to `model_path`'s basename\n // at the producer, which for a blob out of Ollama's content-addressed store\n // is `sha256-…`: it identifies the machine's storage layout and names\n // nothing. Null renders as \"unknown\", which is the honest answer.\n model: humaneModelName(str(r, 'modelName')) ?? humaneModelName(str(r, 'model')),\n slotsTotal: total,\n slotsBusy: trusted ? busy : null,\n // PER-SLOT, or nothing. `-c 65536 --parallel 4` gives each agent 16k, so\n // the `-c` total is usable only divided by a slot count we trust.\n contextTokens:\n contextPerSlot ??\n (total !== null && total > 0 && contextTotal !== null && contextTotal > 0\n ? Math.floor(contextTotal / total)\n : null),\n startedAt: str(r, 'startedAt'),\n parallel: {\n // llama-server's slots ARE its continuous-batching slots: a count read\n // back off the live server (`/props.total_slots`, `/slots`) is a count\n // of requests it will run at the same time, which is what the\n // measurement in docs/LOCAL-FLEET.md showed. An untrusted or absent\n // reading claims nothing — `null`, not `true`.\n capable: refusal !== null ? false : trusted && total !== null ? true : null,\n // The runtime's own words when it refuses, carried verbatim as evidence.\n refusal,\n slots: total,\n },\n reason: str(r, 'lastError'),\n supervised: bool(r, 'managed') ?? false,\n sampledAt: str(r, 'checkedAt'),\n };\n}\n\n/** A displayable model name, or null for an absent or digest-shaped one. */\nfunction humaneModelName(raw: string | null): string | null {\n if (raw === null || raw.length === 0) return null;\n const base = raw.split('/').pop() ?? raw;\n if (base.length === 0) return null;\n if (/^sha256[-:][0-9a-f]{16,}$/i.test(base)) return null;\n return base;\n}\n\nexport function projectServingRuntime(raw: unknown): ServingRuntimeSnapshot | null {\n const r = record(raw);\n if (!r) return null;\n // A body already in this surface's own shape wins; otherwise try owner R's.\n if (!('kind' in r) && 'slots' in r && 'state' in r) {\n const llama = projectLlamaShape(r);\n if (llama !== null) return llama;\n }\n return {\n kind: oneOf(r, 'kind', RUNTIME_KINDS, 'unknown'),\n state: oneOf(r, 'state', RUNTIME_STATES, 'unknown'),\n endpoint: str(r, 'endpoint'),\n model: str(r, 'model'),\n slotsTotal: count(r, 'slotsTotal'),\n slotsBusy: count(r, 'slotsBusy'),\n contextTokens: count(r, 'contextTokens'),\n startedAt: str(r, 'startedAt'),\n parallel: projectParallelism(r['parallel']),\n reason: str(r, 'reason'),\n // A runtime this server cannot supervise must not be offered buttons, so\n // an unreported flag reads as NOT supervised. The conservative default is\n // \"no controls\" rather than controls that 404 on the first click.\n supervised: bool(r, 'supervised') ?? false,\n sampledAt: str(r, 'sampledAt'),\n };\n}\n\nfunction projectAgent(raw: unknown): FleetAgent | null {\n const r = record(raw);\n if (!r) return null;\n const id = str(r, 'id');\n if (id === null) return null;\n return {\n id,\n task: str(r, 'task'),\n repo: str(r, 'repo'),\n engine: str(r, 'engine'),\n model: str(r, 'model'),\n state: oneOf(r, 'state', AGENT_STATES, 'running'),\n startedAt: str(r, 'startedAt'),\n slot: count(r, 'slot'),\n };\n}\n\nexport function projectFleet(raw: unknown): FleetSnapshot | null {\n const r = record(raw);\n if (!r) return null;\n const rawAgents = Array.isArray(r['agents']) ? (r['agents'] as unknown[]) : [];\n return {\n agents: rawAgents.map(projectAgent).filter((a): a is FleetAgent => a !== null),\n queueDepth: count(r, 'queueDepth'),\n slotsTotal: count(r, 'slotsTotal'),\n slotsBusy: count(r, 'slotsBusy'),\n notes: strings(r, 'notes'),\n sampledAt: str(r, 'sampledAt'),\n };\n}\n\nfunction projectRefusal(raw: unknown): LocalOnlyRefusal | null {\n const r = record(raw);\n if (!r) return null;\n const engine = str(r, 'engine');\n if (engine === null) return null;\n return { engine, reason: str(r, 'reason') ?? 'The dispatcher refuses this engine while local-only is on.' };\n}\n\n/**\n * `source` is carried through as the resolver's own value — it is no longer\n * flattened onto a smaller union here.\n *\n * The flattening this replaced mapped `'latch'` onto `'config'`, which tells\n * an operator the mode is stored in the config and editable when in fact the\n * process has pinned it for its own lifetime. Only the separate `mutable`\n * flag kept that from reaching the screen as a working switch that silently\n * does nothing. An unrecognised value lands on `'unknown'`, which makes no\n * claim at all.\n */\n/** Sources that pin the mode to this server process, whatever the config says. */\nconst PINNED_SOURCES: ReadonlySet<LocalOnlySource> = new Set<LocalOnlySource>([\n 'env',\n 'config+env',\n 'latch',\n 'unknown',\n]);\n\nexport function projectLocalOnly(raw: unknown): LocalOnlyPolicy | null {\n const r = record(raw);\n if (!r) return null;\n const rawRefusals = Array.isArray(r['refuses']) ? (r['refuses'] as unknown[]) : [];\n const source = oneOf(r, 'source', LOCAL_ONLY_SOURCES, 'unknown');\n return {\n // An unreported `enabled` is NOT \"on\": claiming cloud is unreachable when\n // the server never said so is the one error this policy cannot afford.\n enabled: bool(r, 'enabled') ?? false,\n source,\n refuses: rawRefusals.map(projectRefusal).filter((x): x is LocalOnlyRefusal => x !== null),\n // A policy pinned by the server's own process — an env var, or a latch\n // this process already took — is never editable from here, whatever the\n // body claims: a write would be silently overridden on the next read.\n // `'unknown'` is treated as pinned too, because offering a switch for a\n // policy this client cannot identify is the more expensive mistake.\n mutable: PINNED_SOURCES.has(source) ? false : (bool(r, 'mutable') ?? false),\n detail: str(r, 'detail'),\n sampledAt: str(r, 'sampledAt') ?? str(r, 'checkedAt'),\n };\n}\n\n// ---------------------------------------------------------------------------\n// The capacity verdict — the point of this whole file\n// ---------------------------------------------------------------------------\n\nexport type CapacityVerdict = 'batched' | 'serialized' | 'unknown' | 'offline';\n\nexport interface RuntimeCapacity {\n verdict: CapacityVerdict;\n /**\n * How many agents can genuinely be in flight at once. `null` means it\n * cannot be known from this reading — which is NOT the same as 0 and must\n * never render as a number.\n */\n effectiveConcurrency: number | null;\n /** What the runtime was configured with, honoured or not. */\n configuredSlots: number | null;\n /**\n * True when the configured slot count is larger than what the runtime will\n * actually run in parallel. While this is true, the configured number must\n * not be presented as capacity anywhere on the screen.\n */\n overstated: boolean;\n headline: string;\n detail: string;\n tone: 'success' | 'warning' | 'danger' | 'neutral' | 'unknown';\n}\n\n/** Human name for a runtime, used in sentences. */\nexport function runtimeLabel(kind: ServingRuntimeKind): string {\n switch (kind) {\n case 'llama-server':\n return 'llama-server';\n case 'ollama':\n return 'Ollama';\n case 'vllm':\n return 'vLLM';\n default:\n return 'the serving runtime';\n }\n}\n\nexport function runtimeCapacity(runtime: ServingRuntimeSnapshot | null): RuntimeCapacity {\n if (runtime === null) {\n return {\n verdict: 'unknown',\n effectiveConcurrency: null,\n configuredSlots: null,\n overstated: false,\n headline: 'No serving runtime reported',\n detail:\n 'Nothing answered for the serving runtime, so how many agents can run at once is unknown. That is a missing reading, not an idle machine.',\n tone: 'unknown',\n };\n }\n\n const configured = runtime.slotsTotal ?? runtime.parallel.slots;\n const name = runtimeLabel(runtime.kind);\n\n if (runtime.state !== 'running') {\n return {\n verdict: 'offline',\n effectiveConcurrency: null,\n configuredSlots: configured,\n overstated: false,\n headline: runtime.state === 'stopped' ? 'Not serving' : `Serving runtime is ${runtime.state}`,\n detail:\n runtime.state === 'stopped'\n ? `${name} is not running, so no local agent can take a turn. Start it before dispatching a fleet.`\n : `${name} is ${runtime.state}; capacity is not settled until it reports running.`,\n tone: runtime.state === 'stopped' ? 'neutral' : 'warning',\n };\n }\n\n if (runtime.parallel.capable === false) {\n // The measured case. The configured number is real — it is simply not a\n // concurrency, and printing it as one is the failure mode this exists for.\n const overstated = configured !== null && configured > 1;\n return {\n verdict: 'serialized',\n effectiveConcurrency: 1,\n configuredSlots: configured,\n overstated,\n headline: `${name} serializes requests`,\n detail: overstated\n ? `${name} has ${configured} slots configured but runs one request at a time for this model, so the real capacity is one agent. The other ${configured - 1} would queue, and a queue looks like slowness rather than a wait.`\n : `${name} runs one request at a time for this model. A second agent waits for the first to finish.`,\n tone: 'danger',\n };\n }\n\n if (runtime.parallel.capable === null) {\n return {\n verdict: 'unknown',\n effectiveConcurrency: null,\n configuredSlots: configured,\n overstated: false,\n headline: 'Batching not confirmed',\n detail: `${name} is running${\n configured === null ? '' : ` with ${configured} slots configured`\n }, but it has not reported whether it batches concurrent requests for this model. Until it does, this panel will not quote a concurrency it cannot stand behind.`,\n tone: 'unknown',\n };\n }\n\n if (configured === null) {\n return {\n verdict: 'batched',\n effectiveConcurrency: null,\n configuredSlots: null,\n overstated: false,\n headline: `${name} batches concurrent requests`,\n detail: `${name} batches, but reported no slot count, so the ceiling on concurrent agents is unknown.`,\n tone: 'unknown',\n };\n }\n\n return {\n verdict: 'batched',\n effectiveConcurrency: configured,\n configuredSlots: configured,\n overstated: false,\n headline: `${configured} agent${configured === 1 ? '' : 's'} in parallel`,\n detail: `${name} batches across ${configured} slot${\n configured === 1 ? '' : 's'\n } sharing one copy of the weights, so ${configured} agent${\n configured === 1 ? '' : 's'\n } can be mid-turn at once.`,\n tone: 'success',\n };\n}\n\n/**\n * The measured comparison, kept as data so the panel renders it as evidence\n * rather than as an assertion in prose. Source: docs/LOCAL-FLEET.md, four\n * concurrent requests against the same Qwen3.8 GGUF on this machine.\n */\nexport interface ConcurrencyEvidenceRow {\n runtime: string;\n /** Per-request completion times, in seconds, in the order they returned. */\n perRequestSeconds: readonly number[];\n wallSeconds: number;\n verdict: string;\n}\n\nexport const CONCURRENCY_EVIDENCE: readonly ConcurrencyEvidenceRow[] = [\n {\n runtime: 'Ollama',\n perRequestSeconds: [3.7, 7.6, 11.4, 15.2],\n wallSeconds: 15.2,\n verdict: 'staggered — the requests queued',\n },\n {\n runtime: 'llama-server',\n perRequestSeconds: [8.6, 8.9, 9.0, 9.0],\n wallSeconds: 9.1,\n verdict: 'together — the requests batched',\n },\n] as const;\n\n// ---------------------------------------------------------------------------\n// Utilisation\n// ---------------------------------------------------------------------------\n\nexport interface SlotUtilisation {\n busy: number | null;\n total: number | null;\n /** 0–100, or null when either half is unknown. */\n percent: number | null;\n /** Every slot is taken: the next turn waits. */\n saturated: boolean;\n /** One line, safe to render on its own. */\n label: string;\n}\n\n/**\n * Slot occupancy.\n *\n * `total` is the EFFECTIVE concurrency, not the configured slot count — on a\n * runtime that serializes, one busy slot out of four configured is full, and\n * drawing it as 25% would tell the operator there is room when there is none.\n */\nexport function slotUtilisation(busy: number | null, effectiveTotal: number | null): SlotUtilisation {\n if (busy === null || effectiveTotal === null || effectiveTotal <= 0) {\n return {\n busy,\n total: effectiveTotal,\n percent: null,\n saturated: false,\n label:\n busy === null\n ? 'Slot occupancy is not reported.'\n : `${busy} in flight; the number of slots is not known, so occupancy cannot be drawn.`,\n };\n }\n const clamped = Math.min(busy, effectiveTotal);\n const percent = Math.round((clamped / effectiveTotal) * 100);\n const saturated = busy >= effectiveTotal;\n return {\n busy,\n total: effectiveTotal,\n percent,\n saturated,\n label: saturated\n ? `All ${effectiveTotal} slot${effectiveTotal === 1 ? '' : 's'} busy — new turns wait for one to free up.`\n : `${busy} of ${effectiveTotal} slot${effectiveTotal === 1 ? '' : 's'} busy.`,\n };\n}\n\n/**\n * What the operator is actually waiting on.\n *\n * Saturation alone is not bad news — a fleet at full occupancy is a fleet\n * working. Saturation WITH a queue is the thing to say plainly, because from\n * the outside it is indistinguishable from the machine being slow.\n */\nexport interface FleetPressure {\n state: 'idle' | 'working' | 'saturated' | 'queued' | 'unknown';\n headline: string;\n detail: string;\n tone: 'success' | 'running' | 'warning' | 'neutral' | 'unknown';\n}\n\nexport function fleetPressure(\n fleet: FleetSnapshot | null,\n utilisation: SlotUtilisation,\n capacity: RuntimeCapacity,\n): FleetPressure {\n if (fleet === null) {\n return {\n state: 'unknown',\n headline: 'Fleet not reported',\n detail:\n 'No fleet snapshot answered, so what is in flight cannot be listed. That is a missing reading, not an empty fleet.',\n tone: 'unknown',\n };\n }\n\n const running = fleet.agents.filter((a) => a.state !== 'queued').length;\n const queued = fleet.queueDepth ?? fleet.agents.filter((a) => a.state === 'queued').length;\n\n if (queued > 0) {\n return {\n state: 'queued',\n headline: `${queued} waiting for a slot`,\n detail:\n capacity.verdict === 'serialized'\n ? `${running} turn${running === 1 ? '' : 's'} in flight and ${queued} queued. This runtime serializes, so the queue drains one at a time — the wait is a wait, not slow inference.`\n : `${running} turn${running === 1 ? '' : 's'} in flight and ${queued} queued behind ${\n utilisation.total === null ? 'the available slots' : `${utilisation.total} slots`\n }. Queued turns have not started; their wall time is queueing, not work.`,\n tone: 'warning',\n };\n }\n\n if (running === 0) {\n return {\n state: 'idle',\n headline: 'Nothing in flight',\n detail: 'No agent is mid-turn. The fleet is idle, not stuck.',\n tone: 'neutral',\n };\n }\n\n if (utilisation.saturated) {\n return {\n state: 'saturated',\n headline: `All slots busy · ${running} in flight`,\n detail: `Every slot is working and nothing is queued behind them. The next turn will wait, but none is waiting yet.`,\n tone: 'running',\n };\n }\n\n return {\n state: 'working',\n headline: `${running} in flight`,\n detail: utilisation.label,\n tone: 'running',\n };\n}\n\n// ---------------------------------------------------------------------------\n// Local-only impact\n// ---------------------------------------------------------------------------\n\nexport interface SeatLike {\n id: string;\n engine: string;\n label: string;\n}\n\nexport interface LocalOnlyImpact {\n /** Seats that become unreachable while the policy is on. */\n blocked: SeatLike[];\n /** Seats unaffected — the local ones. */\n allowed: SeatLike[];\n /** The named refusal per blocked engine, from the server when it sent one. */\n refusalFor: (engine: string) => string;\n /** One line summarising the blast radius against the CURRENT seat roster. */\n summary: string;\n}\n\nconst DEFAULT_REFUSAL = 'Refused: local-only is on and this engine is not local.';\n\n/**\n * What local-only would block, measured against the seats that actually exist\n * on this machine right now.\n *\n * Deliberately computed from the live roster rather than from a fixed list of\n * cloud engines: the sentence \"this would block 3 of your 5 seats\" is only\n * trustworthy if the 5 is the operator's own number.\n */\nexport function localOnlyImpact(\n policy: LocalOnlyPolicy | null,\n seats: readonly SeatLike[],\n): LocalOnlyImpact {\n const blocked = seats.filter((s) => s.engine !== 'local');\n const allowed = seats.filter((s) => s.engine === 'local');\n const byEngine = new Map<string, string>();\n for (const refusal of policy?.refuses ?? []) byEngine.set(refusal.engine, refusal.reason);\n\n const summary =\n seats.length === 0\n ? 'No seats are configured, so there is nothing for this policy to block yet.'\n : blocked.length === 0\n ? `Every one of your ${seats.length} seat${seats.length === 1 ? '' : 's'} is local, so this policy would block nothing today.`\n : `${blocked.length} of ${seats.length} seat${seats.length === 1 ? '' : 's'} would become unreachable; ${allowed.length} local seat${allowed.length === 1 ? '' : 's'} would keep working.`;\n\n return {\n blocked,\n allowed,\n refusalFor: (engine: string) => byEngine.get(engine) ?? DEFAULT_REFUSAL,\n summary,\n };\n}\n\n/** Where the policy came from, as a sentence an operator can act on. */\nexport function localOnlySourceNote(policy: LocalOnlyPolicy | null): string | null {\n if (policy === null) return null;\n // The policy's own sentence, when it wrote one. It knows things this client\n // does not — e.g. that an env var tried and failed to clear a persisted\n // local-only — and a template would erase exactly that.\n if (policy.detail !== null) return policy.detail;\n switch (policy.source) {\n case 'env':\n case 'config+env':\n return 'This policy is pinned by an environment variable on the server process, so it cannot be changed from here — restart the server without it to take the switch back.';\n case 'latch':\n return 'This process already observed a persisted local-only and has pinned it for its own lifetime, so turning it off takes effect for new dispatches but not for the seams that latched. Restart the server to clear it.';\n case 'config':\n return 'Stored in the hub config and applied on the next dispatch.';\n case 'off':\n return 'Not configured; cloud engines are reachable.';\n default:\n return 'The server did not say where this setting came from.';\n }\n}\n\n// ---------------------------------------------------------------------------\n// Small formatters\n// ---------------------------------------------------------------------------\n\n/** \"4m 12s\" since an ISO instant, against a live clock. Absent stays absent. */\nexport function elapsedSince(iso: string | null, now: number): string {\n if (!iso) return UNKNOWN;\n const at = Date.parse(iso);\n if (Number.isNaN(at)) return UNKNOWN;\n return formatDuration(Math.max(0, now - at));\n}\n\n/** Uptime for the runtime header. Same rules, different words. */\nexport function formatUptime(startedAt: string | null, now: number): string {\n if (!startedAt) return UNKNOWN;\n const at = Date.parse(startedAt);\n if (Number.isNaN(at)) return UNKNOWN;\n return `up ${formatDuration(Math.max(0, now - at))}`;\n}\n\n/**\n * Context windows are quoted in powers of two everywhere the operator has\n * seen them (65536 is \"64k\"), so the divisor is 1024. Matching\n * `usage/local-model.ts`'s `formatContext` on purpose: two spellings of the\n * same number across two panels is how a UI starts to feel untrustworthy.\n */\nexport function formatContextTokens(tokens: number | null): string {\n if (tokens === null || !Number.isFinite(tokens)) return UNKNOWN;\n if (tokens >= 1024) return `${Math.round(tokens / 1024)}k`;\n return String(tokens);\n}\n\n/** Agent rows, ordered so the reader's first question is answered first. */\nexport function orderAgents(agents: readonly FleetAgent[]): FleetAgent[] {\n const rank: Record<FleetAgentState, number> = { running: 0, finishing: 1, queued: 2 };\n return [...agents].sort((a, b) => {\n const byState = rank[a.state] - rank[b.state];\n if (byState !== 0) return byState;\n // Longest-running first: the one most likely to be stuck is the one an\n // operator scanning this table is looking for.\n const at = a.startedAt ? Date.parse(a.startedAt) : Number.NaN;\n const bt = b.startedAt ? Date.parse(b.startedAt) : Number.NaN;\n if (Number.isNaN(at) && Number.isNaN(bt)) return a.id.localeCompare(b.id);\n if (Number.isNaN(at)) return 1;\n if (Number.isNaN(bt)) return -1;\n return at - bt;\n });\n}\n"],"mappings":"yCA+CA,SAAS,EAAO,EAAgD,CAC9D,OAAO,OAAO,GAAU,UAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,EACrE,EACD,IACN,CAEA,SAAS,EAAI,EAAiC,EAA4B,CACxE,IAAM,EAAI,EAAO,GACjB,OAAO,OAAO,GAAM,UAAY,EAAE,OAAS,EAAI,EAAI,IACrD,CAEA,SAAS,EAAI,EAAiC,EAA4B,CACxE,IAAM,EAAI,EAAO,GACjB,OAAO,OAAO,GAAM,UAAY,OAAO,SAAS,CAAC,EAAI,EAAI,IAC3D,CAGA,SAAS,EAAM,EAAiC,EAA4B,CAC1E,IAAM,EAAI,EAAI,EAAQ,CAAG,EACzB,OAAO,IAAM,KAAO,KAAO,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,CACtD,CAEA,SAAS,EAAK,EAAiC,EAA6B,CAC1E,IAAM,EAAI,EAAO,GACjB,OAAO,OAAO,GAAM,UAAY,EAAI,IACtC,CAEA,SAAS,EAAQ,EAAiC,EAAuB,CACvE,IAAM,EAAI,EAAO,GACjB,OAAO,MAAM,QAAQ,CAAC,EAAI,EAAE,OAAQ,GAA2B,OAAO,GAAU,QAAQ,EAA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OAAS,EAAK,EAAE,OACvC,GAAI,IAAY,EAAG,OAAO,EAG1B,IAAM,EAAK,EAAE,UAAY,KAAK,MAAM,EAAE,SAAS,EAAI,IAC7C,EAAK,EAAE,UAAY,KAAK,MAAM,EAAE,SAAS,EAAI,IAInD,OAHI,OAAO,MAAM,CAAE,GAAK,OAAO,MAAM,CAAE,EAAU,EAAE,GAAG,cAAc,EAAE,EAAE,EACpE,OAAO,MAAM,CAAE,EAAU,EACzB,OAAO,MAAM,CAAE,EAAU,GACtB,EAAK,CACd,CAAC,CACH"}
@@ -0,0 +1,2 @@
1
+ function e(e){return typeof e!=`number`||!Number.isFinite(e)?`—`:`$${e.toFixed(2)}`}function t(e){return typeof e!=`number`||!Number.isFinite(e)?`—`:String(e)}function n(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m ${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h ${String(n%60).padStart(2,`0`)}m`}function r(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`${n}s`;let r=Math.round(n/60);if(r<60)return`${r}m`;let i=Math.round(r/60);return i<24?`${i}h`:`${Math.round(i/24)}d`}function i(e){let t=r(e);return t===`—`?`—`:`${t} ago`}function a(e){if(!e)return`—`;let t=Date.parse(e);return Number.isNaN(t)?`—`:new Date(t).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function o(e=new Date){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function s(e,t=new Date){return e===o(t)||e===t.toISOString().slice(0,10)}function c(e,t=new Date){if(!e)return`—`;let n=Date.parse(e);if(Number.isNaN(n))return`—`;let r=new Date(n),i=r.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`});return o(r)===o(t)?i:`${r.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${i}`}function l(e){return typeof e!=`number`||!Number.isFinite(e)||e<=0?`—`:`every ${n(e).replace(/ 00[ms]$/,``)}`}function u(t,n,r,i=new Date){let a=typeof t==`number`&&Number.isFinite(t)?Math.max(0,t):null,o=typeof n==`number`&&Number.isFinite(n)?n:null,c=typeof r==`string`&&!s(r,i);if(o===0)return{state:`stopped`,percent:100,label:`${e(a)} spent today · budget $0.00`,note:`Daily budget is 0 — the loop is stopped, not unlimited.`};if(c)return{state:`unknown`,percent:null,label:`— spent today · budget ${e(o)}`,note:`Nothing has been recorded today — the last ledger day is ${r}.`};if(o===null||a===null)return{state:`unknown`,percent:null,label:o===null?`${e(a)} spent today · budget —`:`— spent today · budget ${e(o)}`,note:o===null?`Daily budget is not configured.`:`Today's spend is not observable right now.`};let l=a/o*100,u=Math.min(100,Math.round(l)),d=l>=100?`over`:l>=70?`warn`:`ok`;return{state:d,percent:u,label:`${e(a)} of ${e(o)} today · ${u}%`,note:d===`over`?`Daily budget reached — the loop idles until the date rolls over.`:d===`warn`?`${e(o-a)} left before the loop idles today.`:`${e(o-a)} left today.`}}function d(e,t){if(!e)return null;let n=Date.parse(e);return Number.isNaN(n)||typeof t!=`number`||!Number.isFinite(t)||t<=0?null:n+t}function f(e,t){if(e===null)return`—`;let r=e-t;return r>1e3?`in ${n(r)}`:r>-1e3?`due now`:`overdue by ${n(-r)}`}function p(e){if(!e)return{label:`no tick recorded`,tone:`unknown`};switch(e){case`ok`:return{label:`ok`,tone:`success`};case`kill-switch`:return{label:`refused — emergency stop engaged`,tone:`danger`};case`budget-exhausted`:return{label:`stopped — daily budget spent`,tone:`warning`};case`no-enrolled-repos`:return{label:`nothing to do — no repos enrolled`,tone:`warning`};case`no-backlog`:return{label:`nothing to do — backlog empty`,tone:`neutral`};case`dry-run`:return{label:`dry run`,tone:`neutral`};default:return{label:e,tone:`neutral`}}}export{a,l as c,e as d,s as f,r as i,i as l,f as n,t as o,d as p,p as r,n as s,u as t,c as u};
2
+ //# sourceMappingURL=format-BNYWGJat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-BNYWGJat.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/autonomy/format.ts"],"sourcesContent":["/**\n * routes/verse/autonomy/format.ts — the small pure functions the cockpit's\n * numerals go through. Kept framework-free so they unit-test without a DOM,\n * and kept in ONE place so \"unknown\" never renders as 0 in one panel and as\n * an em-dash in the next.\n *\n * The rule every function here obeys: absent is not zero. A null spend is\n * \"—\", a null budget is \"not configured\", and a budget of exactly 0 is\n * \"stopped\" — which is the single most misread number in the whole product.\n */\n\n/** What we render when a value genuinely is not known. */\nexport const UNKNOWN = '—';\n\nexport function formatUsd(value: number | null | undefined): string {\n if (typeof value !== 'number' || !Number.isFinite(value)) return UNKNOWN;\n return `$${value.toFixed(2)}`;\n}\n\nexport function formatCount(value: number | null | undefined): string {\n if (typeof value !== 'number' || !Number.isFinite(value)) return UNKNOWN;\n return String(value);\n}\n\n/** \"4m 12s\" / \"1h 06m\" / \"12s\" — for durations and countdowns alike. */\nexport function formatDuration(ms: number): string {\n const total = Math.max(0, Math.round(ms / 1000));\n if (total < 60) return `${total}s`;\n const minutes = Math.floor(total / 60);\n const seconds = total % 60;\n if (minutes < 60) return `${minutes}m ${String(seconds).padStart(2, '0')}s`;\n const hours = Math.floor(minutes / 60);\n return `${hours}h ${String(minutes % 60).padStart(2, '0')}m`;\n}\n\n/** Compact age for dense table cells: \"42s\", \"7m\", \"3h\", \"5d\". */\nexport function formatAge(iso: string | null | undefined): string {\n if (!iso) return UNKNOWN;\n const ms = Date.parse(iso);\n if (Number.isNaN(ms)) return UNKNOWN;\n const seconds = Math.max(0, Math.round((Date.now() - ms) / 1000));\n if (seconds < 60) return `${seconds}s`;\n const minutes = Math.round(seconds / 60);\n if (minutes < 60) return `${minutes}m`;\n const hours = Math.round(minutes / 60);\n if (hours < 24) return `${hours}h`;\n return `${Math.round(hours / 24)}d`;\n}\n\nexport function formatRelative(iso: string | null | undefined): string {\n const age = formatAge(iso);\n return age === UNKNOWN ? UNKNOWN : `${age} ago`;\n}\n\n/** Local wall-clock time, for the audit table's second column. */\nexport function formatClock(iso: string | null | undefined): string {\n if (!iso) return UNKNOWN;\n const ms = Date.parse(iso);\n if (Number.isNaN(ms)) return UNKNOWN;\n return new Date(ms).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit' });\n}\n\n/** The viewer's local calendar day as `YYYY-MM-DD` — NOT the UTC slice. */\nexport function localDateKey(at: Date = new Date()): string {\n const y = at.getFullYear();\n const m = String(at.getMonth() + 1).padStart(2, '0');\n const d = String(at.getDate()).padStart(2, '0');\n return `${y}-${m}-${d}`;\n}\n\n/**\n * Is `todayDate` still the current ledger day?\n *\n * The daemon stamps it in UTC (`resetDayIfNeeded` in core/daemon/state.ts is\n * `new Date().toISOString().slice(0, 10)`) but the operator reads the screen\n * in local time, and the two disagree for part of every day at any offset but\n * zero. Comparing against the local day alone would announce \"nothing has been\n * recorded today\" every evening west of UTC — a false alarm on the meter whose\n * whole purpose is to be trustworthy.\n *\n * So either spelling counts as current. That is deliberately conservative: it\n * can call a day current for a few hours after the UTC rollover, and it will\n * never call a genuinely current day stale. The case this exists for is a\n * ledger day weeks old, which neither spelling matches.\n */\nexport function isCurrentLedgerDay(todayDate: string, now: Date = new Date()): boolean {\n return todayDate === localDateKey(now) || todayDate === now.toISOString().slice(0, 10);\n}\n\n/**\n * Time-of-day for a row from today; date + time for anything older.\n *\n * `formatClock` alone is only honest inside a single-day window, and the\n * tables that use it are not one: the audit trail defaults to 200 rows and\n * offers 500, which on a real machine spans days. Two rows reading \"03:12:44\"\n * could be last night and last week, and the only date was in a hover title\n * that a touch viewport never fires.\n */\nexport function formatStamp(iso: string | null | undefined, now: Date = new Date()): string {\n if (!iso) return UNKNOWN;\n const ms = Date.parse(iso);\n if (Number.isNaN(ms)) return UNKNOWN;\n const at = new Date(ms);\n const clock = at.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit' });\n if (localDateKey(at) === localDateKey(now)) return clock;\n const day = at.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n return `${day} ${clock}`;\n}\n\n/** Human tick interval, e.g. \"every 15m\". */\nexport function formatInterval(intervalMs: number | null | undefined): string {\n if (typeof intervalMs !== 'number' || !Number.isFinite(intervalMs) || intervalMs <= 0) return UNKNOWN;\n // A configured interval is a round number far more often than not; \"every\n // 15m\" reads better than \"every 15m 00s\" and loses nothing when it isn't.\n return `every ${formatDuration(intervalMs).replace(/ 00[ms]$/, '')}`;\n}\n\nexport type BudgetState = 'stopped' | 'unknown' | 'ok' | 'warn' | 'over';\n\nexport interface BudgetMeter {\n state: BudgetState;\n /** 0-100, clamped. Null when there is nothing honest to draw. */\n percent: number | null;\n /** One line: \"$4.50 of $25.00 today · 18%\". */\n label: string;\n /** The plain-language verdict shown next to the meter. */\n note: string;\n}\n\nconst BUDGET_WARN_PERCENT = 70;\n\n/**\n * Today's spend against the configured daily cap, as ONE line.\n *\n * A cap of exactly 0 is the contract's guard rail: it means the loop is\n * stopped, and it must never render as an empty (i.e. \"plenty left\") meter.\n *\n * `todayDate` is the ledger day `spend.todayUsd` was counted for. It is NOT\n * optional decoration: the daemon writes the figure once per day and leaves it\n * there, so a machine that last ticked three weeks ago answers\n * `{todayUsd: 0, todayDate: \"2026-09-01\"}`. Rendering that as \"$0.00 of $50.00\n * today\" is a fabricated statement about today on the one number an operator\n * checks before walking away from an autonomous loop. Pass `null` only when\n * the source genuinely has no date to offer (the legacy daemon observation).\n */\nexport function budgetMeter(\n spentUsd: number | null | undefined,\n capUsd: number | null | undefined,\n todayDate?: string | null,\n now: Date = new Date(),\n): BudgetMeter {\n const spend = typeof spentUsd === 'number' && Number.isFinite(spentUsd) ? Math.max(0, spentUsd) : null;\n const cap = typeof capUsd === 'number' && Number.isFinite(capUsd) ? capUsd : null;\n // A cap of 0 is a statement about configuration, not about the ledger, so\n // it still reads true on a stale day and is checked first.\n const stale = typeof todayDate === 'string' && !isCurrentLedgerDay(todayDate, now);\n\n if (cap === 0) {\n return {\n state: 'stopped',\n percent: 100,\n label: `${formatUsd(spend)} spent today · budget $0.00`,\n note: 'Daily budget is 0 — the loop is stopped, not unlimited.',\n };\n }\n if (stale) {\n return {\n state: 'unknown',\n percent: null,\n label: `${UNKNOWN} spent today · budget ${formatUsd(cap)}`,\n note: `Nothing has been recorded today — the last ledger day is ${todayDate}.`,\n };\n }\n if (cap === null || spend === null) {\n return {\n state: 'unknown',\n percent: null,\n label: cap === null ? `${formatUsd(spend)} spent today · budget ${UNKNOWN}` : `${UNKNOWN} spent today · budget ${formatUsd(cap)}`,\n note: cap === null ? 'Daily budget is not configured.' : \"Today's spend is not observable right now.\",\n };\n }\n\n const raw = (spend / cap) * 100;\n const percent = Math.min(100, Math.round(raw));\n const state: BudgetState = raw >= 100 ? 'over' : raw >= BUDGET_WARN_PERCENT ? 'warn' : 'ok';\n return {\n state,\n percent,\n label: `${formatUsd(spend)} of ${formatUsd(cap)} today · ${percent}%`,\n note:\n state === 'over'\n ? 'Daily budget reached — the loop idles until the date rolls over.'\n : state === 'warn'\n ? `${formatUsd(cap - spend)} left before the loop idles today.`\n : `${formatUsd(cap - spend)} left today.`,\n };\n}\n\n/** Epoch ms of the next expected tick, or null when it cannot be derived. */\nexport function nextTickAt(lastTickAt: string | null | undefined, intervalMs: number | null | undefined): number | null {\n if (!lastTickAt) return null;\n const last = Date.parse(lastTickAt);\n if (Number.isNaN(last)) return null;\n if (typeof intervalMs !== 'number' || !Number.isFinite(intervalMs) || intervalMs <= 0) return null;\n return last + intervalMs;\n}\n\n/** \"in 4m 12s\" / \"due now\" / \"overdue by 2m 03s\". */\nexport function countdownLabel(nextAt: number | null, now: number): string {\n if (nextAt === null) return UNKNOWN;\n const delta = nextAt - now;\n if (delta > 1000) return `in ${formatDuration(delta)}`;\n if (delta > -1000) return 'due now';\n return `overdue by ${formatDuration(-delta)}`;\n}\n\n/** Last tick outcome, phrased the way a person would say it out loud. */\nexport function describeTickOutcome(reason: string | null | undefined): { label: string; tone: 'success' | 'warning' | 'danger' | 'neutral' | 'unknown' } {\n if (!reason) return { label: 'no tick recorded', tone: 'unknown' };\n switch (reason) {\n case 'ok':\n return { label: 'ok', tone: 'success' };\n case 'kill-switch':\n return { label: 'refused — emergency stop engaged', tone: 'danger' };\n case 'budget-exhausted':\n return { label: 'stopped — daily budget spent', tone: 'warning' };\n case 'no-enrolled-repos':\n return { label: 'nothing to do — no repos enrolled', tone: 'warning' };\n case 'no-backlog':\n return { label: 'nothing to do — backlog empty', tone: 'neutral' };\n case 'dry-run':\n return { label: 'dry run', tone: 'neutral' };\n default:\n return { label: reason, tone: 'neutral' };\n }\n}\n"],"mappings":"AAcA,SAAgB,EAAU,EAA0C,CAElE,OADI,OAAO,GAAU,UAAY,CAAC,OAAO,SAAS,CAAK,EAAG,IACnD,IAAI,EAAM,QAAQ,CAAC,GAC5B,CAEA,SAAgB,EAAY,EAA0C,CAEpE,OADI,OAAO,GAAU,UAAY,CAAC,OAAO,SAAS,CAAK,EAAG,IACnD,OAAO,CAAK,CACrB,CAGA,SAAgB,EAAe,EAAoB,CACjD,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,EAAK,GAAI,CAAC,EAC/C,GAAI,EAAQ,GAAI,MAAO,GAAG,EAAM,GAChC,IAAM,EAAU,KAAK,MAAM,EAAQ,EAAE,EAC/B,EAAU,EAAQ,GAGxB,OAFI,EAAU,GAAW,GAAG,EAAQ,IAAI,OAAO,CAAO,CAAC,CAAC,SAAS,EAAG,GAAG,EAAE,GAElE,GADO,KAAK,MAAM,EAAU,EACzB,EAAM,IAAI,OAAO,EAAU,EAAE,CAAC,CAAC,SAAS,EAAG,GAAG,EAAE,EAC5D,CAGA,SAAgB,EAAU,EAAwC,CAChE,GAAI,CAAC,EAAK,MAAA,IACV,IAAM,EAAK,KAAK,MAAM,CAAG,EACzB,GAAI,OAAO,MAAM,CAAE,EA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0;function d(){--s;let e=c.shift();e&&e()}function f(e){let t=()=>{let t=u;s+=1,s>l&&(l=s);let n=()=>{t===u&&d()},r;try{r=e()}catch(e){return n(),Promise.reject(e instanceof Error?e:Error(String(e)))}return r.then(e=>(n(),e),e=>{throw n(),e})};return s<4?t():new Promise((e,n)=>{c.push(()=>{t().then(e,n)})})}function ee(){u+=1,s=0,l=0;for(let e of c.splice(0))e()}function p(e){let t=o.get(e);return t||(t={snapshot:a,inFlight:null,fetcher:null,subscribers:new Set,issued:0,issuedAt:0,applied:0},o.set(e,t)),t}function m(e,t){e.snapshot={...e.snapshot,...t}}function h(e){let t=o.get(e);if(t)for(let e of t.subscribers)e()}function g(e,t){if(Object.is(e,t))return!0;if(typeof e!=typeof t||e===null||t===null||typeof e!=`object`||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>g(e,t[n]));let n=e,r=t,i=Object.keys(n);return i.length===Object.keys(r).length&&i.every(e=>Object.prototype.hasOwnProperty.call(r,e)&&g(n[e],r[e]))}function te(e,t){let n=p(e);return n.subscribers.add(t),()=>{n.subscribers.delete(t)}}function _(e){return p(e).snapshot}function ne(e,t){return e.snapshot.updatedAt===null||e.snapshot.status===`error`?!1:Date.now()-e.snapshot.updatedAt<t}function re(e,t){return e.inFlight===null?!1:t.joinWindowMs===void 0||Date.now()-e.issuedAt<t.joinWindowMs}function v(e,t,n){let r=p(e);if(r.fetcher=t,!n.force){if(re(r,n))return r.inFlight;if(n.maxAgeMs!==void 0&&ne(r,n.maxAgeMs))return Promise.resolve()}let i=r.issued+=1;r.issuedAt=Date.now(),m(r,{status:r.snapshot.data===void 0?`loading`:`refreshing`}),h(e);let a=f(t).then(e=>{if(i<r.applied)return;r.applied=i;let t=r.snapshot.data!==void 0&&g(r.snapshot.data,e);m(r,{data:t?r.snapshot.data:e,error:void 0,status:`success`,updatedAt:Date.now()})}).catch(e=>{i<r.applied||(r.applied=i,m(r,{error:e instanceof Error?e:Error(String(e)),status:`error`}))}).finally(()=>{r.issued===i&&(r.inFlight=null),h(e)});return r.inFlight=a,a}function ie(e,t){return v(e,t,{})}function ae(e,t,n){return v(e,t,{maxAgeMs:n})}function oe(e,t,n=!1){return v(e,t,n?{force:!0}:{joinWindowMs:250})}function se(e){let t=o.get(e);t&&t.fetcher&&ie(e,t.fetcher)}function y(e){for(let t of o.keys())t.startsWith(e)&&se(t)}function ce(e,t){t.snapshot=a,t.fetcher=null,t.inFlight=null,t.issued+=1,t.applied=t.issued,h(e)}function le(){ee();for(let[e,t]of[...o]){if(t.subscribers.size===0){o.delete(e);continue}ce(e,t)}}var b=`ashlr.verse.drafts.v1`,x=`ashlr.verse.sent.v1`,ue=40,S=65536;function C(e,t){let n={};try{let r=localStorage.getItem(e),i=r?JSON.parse(r):null;if(i&&typeof i==`object`&&!Array.isArray(i))for(let[e,r]of Object.entries(i)){let i=t(r);i!==null&&(n[e]=i)}}catch{}return n}function w(e,t){let n=Object.keys(t);for(let e of n.slice(0,Math.max(0,n.length-ue)))delete t[e];try{localStorage.setItem(e,JSON.stringify(t))}catch{}}var de=e=>typeof e==`string`&&e.length>0?e.slice(0,S):null,fe=e=>{if(!Array.isArray(e))return null;let t=e.filter(e=>typeof e==`string`&&e.length>0).slice(-25).map(e=>e.slice(0,S));return t.length>0?t:null};function pe(e){return e?C(b,de)[e]??``:``}function me(e,t){if(!e)return;let n=C(b,de);delete n[e],t.trim().length>0&&(n[e]=t.slice(0,S)),w(b,n)}function he(e){return e?C(x,fe)[e]??[]:[]}function ge(e,t){if(!e||t.trim().length===0)return;let n=C(x,fe),r=n[e]??[];delete n[e],n[e]=(r[r.length-1]===t?r:[...r,t.slice(0,S)]).slice(-25),w(x,n)}function _e(e){if(e)for(let[t,n]of[[b,de],[x,fe]]){let r=C(t,n);e in r&&(delete r[e],w(t,r))}}function ve(){for(let e of[b,x])try{localStorage.removeItem(e)}catch{}}var ye=4;function be(e){let t=e.trim();return t.length===0?0:Math.max(1,Math.ceil(t.length/ye))}function xe(e,t,n,r,i){let a=be(e);if(a===0)return null;let o=typeof n==`number`&&n>0?n:null;if(o===null)return null;let s=Math.min(999,Math.round(((typeof t==`number`&&Number.isFinite(t)?Math.max(0,t):0)+a)/o*100));return s<r?null:{draftTokens:a,projectedPercent:s,tone:s>=i?`danger`:`warn`}}var Se=`ashlr.readClientProof.v1`,Ce=/^[a-f0-9]{64}$/,T=12e5;function we(){let e=new Uint8Array(32);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function Te(){try{let e=sessionStorage.getItem(Se);if(e&&Ce.test(e))return e}catch{}let e=we();try{sessionStorage.setItem(Se,e)}catch{}return e}var E=Te(),D=null,O=null,Ee=!1,k=null,A=null,j=null,M={phase:`checking`,checked:!1,mutationTokenHeldUntil:null},N=new Set;function De(){for(let e of N)e()}function P(e){M={...M,...e},De()}function F(e){return N.add(e),()=>N.delete(e)}function I(){return M}function L(){return E}async function Oe(e){let t=e.trim();if(!/^[a-f0-9]{64}$/.test(t))throw Error(`That does not look like a read token — expected 64 hex characters.`);let n=await fetch(`/api/session`,{method:`POST`,credentials:`same-origin`,headers:{"x-ashlr-token":t,"x-ashlr-read-client":E}});if(n.status===204){k=t,P({phase:`authenticated`,checked:!0});return}throw n.status===401?Error(`Server rejected that token. Double-check the read token printed by this server at startup.`):Error(`Unexpected response establishing session (HTTP ${n.status}).`)}async function ke(){try{await fetch(`/api/session`,{method:`DELETE`,credentials:`same-origin`,headers:{"x-ashlr-read-client":E}})}catch{}k=null,j=null,Ae()}function Ae(){z(),le(),ve(),P({phase:`unauthenticated`,checked:!0})}function je(){if(M.phase===`authenticated`){if(k){Me();return}Ae()}}function Me(){if(A)return A;let e=k;return e?(A=(async()=>{try{return await Oe(e),y(``),!0}catch{return k=null,j=null,Ae(),!1}finally{A=null}})(),A):Promise.resolve(!1)}function Ne(e){P({phase:e?`authenticated`:`unauthenticated`,checked:!0})}function Pe(){let e=window.__ASHLR_TOKENS__;if(e&&typeof e==`object`){try{delete window.__ASHLR_TOKENS__}catch{window.__ASHLR_TOKENS__=void 0}typeof e.readToken==`string`&&(j={readToken:e.readToken,...typeof e.token==`string`?{token:e.token}:{}})}return j?{...j}:null}async function Fe(){let e=Pe();if(!e)return!1;try{await Oe(e.readToken)}catch{return j=null,!1}return e.token&&/^[a-f0-9]{64}$/.test(e.token.trim())&&R(e.token.trim(),{host:!0}),!0}function Ie(){return D}function Le(){return D!==null}function Re(){O&&clearTimeout(O),O=setTimeout(()=>{Ee&&D!==null?ze():z()},T)}function R(e,t={}){D=e,Ee=t.host===!0,P({mutationTokenHeldUntil:Date.now()+T}),Re()}function ze(){D!==null&&(P({mutationTokenHeldUntil:Date.now()+T}),Re())}function z(){D=null,Ee=!1,O&&=(clearTimeout(O),null),P({mutationTokenHeldUntil:null})}var Be=[`runs`,`swarms`,`inbox`,`daemon`,`daemon-observation`,`fleet-activity-ping`,`fleet-activity-observation`,`snapshot`,`session-expired`],Ve={runs:[`runs`],swarms:[`swarms`],inbox:[`inbox`],daemon:[`daemon`,`control-snapshot`,`verse-control`,`verse-usage-control`,`verse-caps`],"daemon-observation":[`daemon`,`control-snapshot`,`verse-control`,`verse-usage-control`,`verse-caps`],"fleet-activity-ping":[`fleet-activity`,`fleet`],"fleet-activity-observation":[`fleet-activity`,`fleet`],snapshot:[`dashboard-snapshot`,`agent-os-snapshot`],"session-expired":[]},He=new Map,B=null,V=null,H=0;function Ue(){return Math.min(1e3*2**H,15e3)}function U(){B&&=(B.close(),null),V&&=(clearTimeout(V),null)}function We(){V||=setTimeout(()=>{V=null,H+=1,Ge()},Ue())}function Ge(){if(r()){U();return}if(I().phase!==`authenticated`)return;U();let e=`/api/events?client=${encodeURIComponent(L())}`,t=new EventSource(e,{withCredentials:!0});B=t,t.onopen=()=>{H=0};for(let e of Be)t.addEventListener(e,t=>{let n=t,r;try{r=JSON.parse(n.data)}catch{r=void 0}for(let t of Ve[e])se(t);e===`inbox`&&(y(`inbox-list:`),y(`proposal-detail-`)),e===`session-expired`&&je();let i=He.get(e);if(i)for(let e of i)e(r)});t.onerror=()=>{t.close(),B===t&&(B=null),I().phase===`authenticated`&&We()}}F(()=>{I().phase===`authenticated`?(H=0,Ge()):U()});var Ke=`ashlr.theme.v1`;function qe(e){let t=document.documentElement;e===`system`?t.removeAttribute(`data-theme`):t.setAttribute(`data-theme`,e)}function Je(){try{let e=localStorage.getItem(Ke);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var W=Je();qe(W);var Ye=new Set;function Xe(){for(let e of Ye)e()}function Ze(e){return Ye.add(e),()=>Ye.delete(e)}function G(){return W}function K(e){W=e,qe(W);try{localStorage.setItem(Ke,W)}catch{}Xe()}function Qe(){K(W===`system`?`light`:W===`light`?`dark`:`system`)}var $e=`ashlr.verse.appearance.v1`,et=30,tt=78,q={h:245,s:72,l:58},nt=[{id:`indigo`,label:`Indigo`,h:245,s:72,l:58},{id:`blue`,label:`Blue`,h:212,s:80,l:50},{id:`cyan`,label:`Cyan`,h:190,s:80,l:40},{id:`teal`,label:`Teal`,h:168,s:70,l:38},{id:`green`,label:`Green`,h:145,s:60,l:38},{id:`amber`,label:`Amber`,h:38,s:80,l:42},{id:`rose`,label:`Rose`,h:348,s:72,l:50},{id:`violet`,label:`Violet`,h:278,s:66,l:55}];function rt(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}catch{return!1}}function it(){return{theme:`system`,accentH:q.h,accentS:q.s,accentL:q.l,density:`comfortable`,uiScale:`default`,displayFont:`grotesk`,radius:`default`,motion:`system`,reduceMotion:rt()}}function at(e){return e===`system`||e===`reduce`||e===`full`}function ot(e){return e===`reduce`||e!==`full`&&rt()}var st=(e,t,n)=>Math.min(n,Math.max(t,e));function ct(e){return e===`comfortable`||e===`compact`}function lt(e){return e==="default"||e===`large`||e===`xlarge`}function ut(e){return e===`grotesk`||e===`ui`||e===`mono`}function dt(e){return e===`sharp`||e==="default"||e===`soft`}function ft(e,t){let n={...e,...t},r=t.reduceMotion,i=at(t.motion)?t.motion:typeof r==`boolean`?r?`reduce`:`full`:at(e.motion)?e.motion:`system`;return{theme:n.theme===`light`||n.theme===`dark`?n.theme:`system`,accentH:Number.isFinite(n.accentH)?(Math.round(n.accentH)%360+360)%360:q.h,accentS:Number.isFinite(n.accentS)?st(Math.round(n.accentS),0,100):q.s,accentL:Number.isFinite(n.accentL)?st(Math.round(n.accentL),et,tt):q.l,density:ct(n.density)?n.density:`comfortable`,uiScale:lt(n.uiScale)?n.uiScale:`default`,displayFont:ut(n.displayFont)?n.displayFont:`grotesk`,radius:dt(n.radius)?n.radius:`default`,motion:i,reduceMotion:ot(i)}}function pt(){let e=it(),t={};try{let e=localStorage.getItem($e);if(e){let n=JSON.parse(e);n&&typeof n==`object`&&(t=n)}}catch{}let{reduceMotion:n,...r}=t;return ft(e,{...r,theme:G()})}function mt(e){try{let{theme:t,reduceMotion:n,...r}=e;localStorage.setItem($e,JSON.stringify(r))}catch{}}var ht={grotesk:null,ui:`var(--font-ui)`,mono:`var(--font-mono)`};function gt(e){if(typeof document>`u`)return;let t=document.documentElement;t.style.setProperty(`--accent-h`,String(e.accentH)),t.style.setProperty(`--accent-s`,`${e.accentS}%`),t.style.setProperty(`--accent-l`,`${e.accentL}%`);let n=ht[e.displayFont];n===null?t.style.removeProperty(`--font-display`):t.style.setProperty(`--font-display`,n),t.setAttribute(`data-density`,e.density),t.setAttribute(`data-ui-scale`,e.uiScale),t.setAttribute(`data-radius`,e.radius),e.motion===`system`?t.removeAttribute(`data-motion`):t.setAttribute(`data-motion`,e.motion)}var J=pt();gt(J);var _t=new Set;function vt(){for(let e of _t)e()}Ze(()=>{J.theme!==G()&&(J={...J,theme:G()},vt())});function yt(e){return _t.add(e),()=>_t.delete(e)}function bt(){return J}function xt(e){let t=ft(J,e),n=t.theme!==J.theme;J=t,gt(J),mt(J),n&&K(J.theme),vt()}function St(){try{localStorage.removeItem($e)}catch{}J=it(),gt(J),K(`system`),vt()}function Ct(e=J){let t=it();return e.theme===t.theme&&e.accentH===t.accentH&&e.accentS===t.accentS&&e.accentL===t.accentL&&e.density===t.density&&e.uiScale===t.uiScale&&e.displayFont===t.displayFont&&e.radius===t.radius&&e.motion===t.motion}function wt(e=J){return nt.find(t=>t.h===e.accentH&&t.s===e.accentS&&t.l===e.accentL)??null}var Tt={min:et,max:tt};function Et(e,t){let n=t?.freshMs??1e4,r=(0,i.useSyncExternalStore)((0,i.useCallback)(t=>te(e.key,t),[e.key]),()=>_(e.key),()=>_(e.key));return(0,i.useEffect)(()=>{ae(e.key,()=>e.fetch(),n)},[e.key,n]),r}function Dt(e){return(0,i.useCallback)(()=>{oe(e.key,()=>e.fetch())},[e])}function Ot(e){return(0,i.useCallback)(()=>{oe(e.key,()=>e.fetch(),!0)},[e])}function kt(){return(0,i.useSyncExternalStore)(F,()=>I().phase,()=>I().phase)}function At(){let e=(0,i.useSyncExternalStore)(F,()=>I().mutationTokenHeldUntil,()=>I().mutationTokenHeldUntil);return{hasHold:Le(),token:Ie(),heldUntil:e,setToken:R,touch:ze,clear:z}}function jt(){return{theme:(0,i.useSyncExternalStore)(Ze,G,G),set:K,cycle:Qe}}function Mt(){return{appearance:(0,i.useSyncExternalStore)(yt,bt,bt),set:xt,reset:St}}var Y={badge:`_badge_ytqgz_4`,dot:`_dot_ytqgz_17`,neutral:`_neutral_ytqgz_24`,info:`_info_ytqgz_32`,running:`_running_ytqgz_40`,pulse:`_pulse_ytqgz_1`,success:`_success_ytqgz_49`,warning:`_warning_ytqgz_57`,danger:`_danger_ytqgz_65`,unknown:`_unknown_ytqgz_73`,phaseDot:`_phaseDot_ytqgz_82`},X=t(),Nt={pending:`neutral`,queued:`neutral`,waiting:`neutral`,running:`running`,active:`running`,in_progress:`running`,building:`running`,applying:`running`,done:`success`,success:`success`,succeeded:`success`,applied:`success`,merged:`success`,ready:`success`,approved:`success`,ship:`success`,review:`warning`,degraded:`warning`,paused:`warning`,noise:`neutral`,failed:`danger`,error:`danger`,errored:`danger`,rejected:`danger`,harmful:`danger`,cancelled:`neutral`,canceled:`neutral`,unknown:`unknown`};function Pt(e){return e?Nt[e.toLowerCase()]??`neutral`:`unknown`}function Ft({status:e,tone:t,children:n}){let r=t??Pt(e);return(0,X.jsxs)(`span`,{className:`${Y.badge} ${Y[r]}`,children:[(0,X.jsx)(`span`,{className:Y.dot,"aria-hidden":`true`}),n??e]})}function It({index:e}){let t=(e%6+6)%6;return(0,X.jsx)(`span`,{className:Y.phaseDot,style:{background:`var(--phase-${t+1})`},"aria-hidden":`true`})}var Z=class extends Error{status;path;detail;constructor(e,t,n,r=null){super(e),this.status=t,this.path=n,this.detail=r,this.name=`ApiError`}},Lt=class extends Z{constructor(e){super(`This server was started without --allow-dispatch, so mutations are disabled.`,404,e),this.name=`DispatchDisabledError`}};async function Rt(e,t){let n=await fetch(e,{method:`GET`,credentials:`same-origin`,headers:{"x-ashlr-read-client":L()},signal:t});if(n.status===401)throw je(),new Z(`Read session expired.`,401,e);if(!n.ok)throw new Z(`GET ${e} failed (HTTP ${n.status}).`,n.status,e);return await n.json()}async function zt(e,t,n,r){let i=await fetch(e,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`,"x-ashlr-token":n},body:JSON.stringify(t??{}),signal:r});if(i.status===404)throw new Lt(e);if(i.status===401)throw new Z(`Mutation token was rejected.`,401,e);if(!i.ok){let t=``;try{let e=await i.json();t=typeof e.error==`string`&&e.error?e.error:typeof e.note==`string`?e.note:``}catch{}throw new Z(`POST ${e} failed (HTTP ${i.status})${t?`: ${t}`:``}.`,i.status,e,t||null)}if(i.status!==204)return await i.json()}function Bt(){return`/api/events?client=${encodeURIComponent(L())}`}var Vt={root:`_root_1lgxn_1`,spinner:`_spinner_1lgxn_9`,spin:`_spin_1lgxn_9`};function Ht({label:e=`Refreshing`}){return(0,X.jsxs)(`span`,{className:Vt.root,role:`status`,"aria-live":`polite`,children:[(0,X.jsx)(`span`,{className:Vt.spinner,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`visually-hidden`,children:e})]})}var Q={grid:`_grid_x7p2y_1`,card:`_card_x7p2y_10`,title:`_title_x7p2y_19`,stat:`_stat_x7p2y_25`,caption:`_caption_x7p2y_31`,line:`_line_x7p2y_37`,row:`_row_x7p2y_42`,cell:`_cell_x7p2y_51`};function Ut({width:e=`100%`}){return(0,X.jsx)(`div`,{className:`skeleton ${Q.line}`,style:{width:e}})}function Wt(){return(0,X.jsxs)(`div`,{className:Q.card,children:[(0,X.jsx)(`div`,{className:`skeleton ${Q.title}`}),(0,X.jsx)(`div`,{className:`skeleton ${Q.stat}`}),(0,X.jsx)(`div`,{className:`skeleton ${Q.caption}`})]})}function Gt(){return(0,X.jsxs)(`div`,{className:Q.row,children:[(0,X.jsx)(`div`,{className:`skeleton ${Q.cell}`,style:{width:`18%`}}),(0,X.jsx)(`div`,{className:`skeleton ${Q.cell}`,style:{width:`38%`}}),(0,X.jsx)(`div`,{className:`skeleton ${Q.cell}`,style:{width:`14%`}}),(0,X.jsx)(`div`,{className:`skeleton ${Q.cell}`,style:{width:`10%`}})]})}function Kt({count:e=4}){return(0,X.jsx)(`div`,{className:Q.grid,children:Array.from({length:e},(e,t)=>(0,X.jsx)(Wt,{},t))})}var qt={skipLink:`_skipLink_1uply_1`};function Jt(){return(0,X.jsx)(`button`,{type:`button`,className:qt.skipLink,onClick:()=>{let e=document.getElementById(`main-content`);e?.focus(),e?.scrollIntoView({block:`start`})},children:`Skip to content`})}var $={wrap:`_wrap_14qw9_1`,card:`_card_14qw9_10`,badge:`_badge_14qw9_19`,heading:`_heading_14qw9_24`,body:`_body_14qw9_31`,code:`_code_14qw9_38`,example:`_example_14qw9_49`,form:`_form_14qw9_56`,label:`_label_14qw9_63`,input:`_input_14qw9_68`,error:`_error_14qw9_82`,submit:`_submit_14qw9_87`,optional:`_optional_14qw9_107`},Yt=/^[a-f0-9]{64}$/;function Xt({onAuthenticated:e,heading:t=`Connect to ashlr serve`,command:n=`ashlr serve`,subject:r=`This dashboard`,mutationField:a=!1}){let[o,s]=(0,i.useState)(``),[c,l]=(0,i.useState)(``),[u,d]=(0,i.useState)(null),[f,ee]=(0,i.useState)(!1),p=(0,i.useRef)(null),m=(0,i.useId)(),h=(0,i.useId)(),g=(0,i.useId)(),te=(0,i.useRef)(e);te.current=e,(0,i.useEffect)(()=>{let e=!1;return Fe().then(t=>{t&&!e&&te.current?.()}),()=>{e=!0}},[]);async function _(t){t.preventDefault(),d(null);let n=c.trim();if(a&&n&&!Yt.test(n)){d(`That does not look like a mutation token — expected 64 hex characters (leave it empty to unlock later).`);return}ee(!0);try{await Oe(o),s(``),a&&n&&R(n),l(``),e?.()}catch(e){d(e instanceof Error?e.message:`Could not establish a session.`),p.current?.select()}finally{ee(!1)}}return(0,X.jsx)(`div`,{className:$.wrap,children:(0,X.jsxs)(`div`,{className:$.card,children:[(0,X.jsx)(`div`,{className:$.badge,"aria-hidden":`true`,children:`⛺`}),(0,X.jsx)(`h1`,{className:$.heading,children:t}),(0,X.jsxs)(`p`,{className:$.body,children:[r,` only ever talks to the ashlr server running on this machine (`,(0,X.jsx)(`code`,{children:`127.0.0.1`}),`, never a remote host). To read data, paste the`,` `,(0,X.jsx)(`strong`,{children:`read token`}),` printed in the terminal where you ran:`]}),(0,X.jsx)(`pre`,{className:$.code,children:n}),(0,X.jsxs)(`p`,{className:$.body,children:[`It looks like a 64-character hex string, printed once at startup — something like`,` `,(0,X.jsx)(`code`,{className:$.example,children:`a1b2c3…`}),`. This dialog never stores it: it is exchanged once for a short-lived session cookie, then discarded.`]}),(0,X.jsxs)(`form`,{onSubmit:_,className:$.form,noValidate:!0,children:[(0,X.jsx)(`label`,{htmlFor:m,className:$.label,children:`Read token`}),(0,X.jsx)(`input`,{ref:p,id:m,name:`read-token`,type:`password`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,inputMode:`text`,className:$.input,value:o,onChange:e=>s(e.target.value),"aria-invalid":u?!0:void 0,"aria-describedby":u?g:void 0,placeholder:`64 hex characters`,autoFocus:!0}),a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{htmlFor:h,className:$.label,children:[`Mutation token `,(0,X.jsx)(`span`,{className:$.optional,children:`optional — paste it now to enable sending`})]}),(0,X.jsx)(`input`,{id:h,name:`mutation-token`,type:`password`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,inputMode:`text`,className:$.input,value:c,onChange:e=>l(e.target.value),placeholder:`64 hex characters, printed under “Dispatch enabled”`})]}):null,u?(0,X.jsx)(`p`,{id:g,className:$.error,role:`alert`,children:u}):null,(0,X.jsx)(`button`,{type:`submit`,className:$.submit,disabled:f||o.trim().length===0,children:f?`Connecting…`:`Connect`})]})]})})}export{I as A,he as B,nt as C,Fe as D,Qe as E,F,y as G,me as H,ze as I,ie as K,xe as L,L as M,Le as N,z as O,Ne as P,_e as R,Tt as S,wt as T,_ as U,ge as V,se as W,At as _,Gt as a,Ot as b,Lt as c,Bt as d,It as f,kt as g,Mt as h,Ut as i,Ie as j,ke as k,Rt as l,Pt as m,Jt as n,Ht as o,Ft as p,Kt as r,Z as s,Xt as t,zt as u,Et as v,Ct as w,jt as x,Dt as y,pe as z};
2
+ //# sourceMappingURL=global-D6bTxIRn.js.map