@ashlr/hub 3.11.0 → 3.11.2
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.
- package/CHANGELOG.md +96 -0
- package/dist/authority-surface.json +12 -7
- package/dist/build-identity.json +2 -2
- package/dist/core/universe/builtins/preparation/manifest.json +1 -1
- package/dist/core/universe/builtins/preparation/preparation-bridge.mjs +5 -4
- package/dist/core/universe/builtins/preparation/preparation-verification-fixtures.mjs +4 -3
- package/dist/core/universe/campaign.js +9 -1
- package/dist/core/universe/campaign.js.map +1 -1
- package/dist/core/universe/runner.d.ts +3 -0
- package/dist/core/universe/runner.js +7 -3
- package/dist/core/universe/runner.js.map +1 -1
- package/dist/core/verse/compaction-point.d.ts +55 -0
- package/dist/core/verse/compaction-point.js +75 -0
- package/dist/core/verse/compaction-point.js.map +1 -0
- package/dist/core/verse/context-math.d.ts +1 -38
- package/dist/core/verse/context-math.js +5 -59
- package/dist/core/verse/context-math.js.map +1 -1
- package/dist/core/web/public/next/assets/{ActionMenu-CQvNJvHY.js → ActionMenu-_DhtX2gO.js} +2 -2
- package/dist/core/web/public/next/assets/{ActionMenu-CQvNJvHY.js.map → ActionMenu-_DhtX2gO.js.map} +1 -1
- package/dist/core/web/public/next/assets/Advanced-CAAfaBke.js +2 -0
- package/dist/core/web/public/next/assets/{Advanced-DEM93sKI.js.map → Advanced-CAAfaBke.js.map} +1 -1
- package/dist/core/web/public/next/assets/App-BAywyjE8.js +7 -0
- package/dist/core/web/public/next/assets/{App-CimXmK0L.js.map → App-BAywyjE8.js.map} +1 -1
- package/dist/core/web/public/next/assets/AppsSection-CUypKeog.js +2 -0
- package/dist/core/web/public/next/assets/{AppsSection-D6U-dSj6.js.map → AppsSection-CUypKeog.js.map} +1 -1
- package/dist/core/web/public/next/assets/{AreaTrend-LD9lCPkT.js → AreaTrend-CblDqC8Q.js} +2 -2
- package/dist/core/web/public/next/assets/{AreaTrend-LD9lCPkT.js.map → AreaTrend-CblDqC8Q.js.map} +1 -1
- package/dist/core/web/public/next/assets/AutonomySection-D3d8lYO3.js +2 -0
- package/dist/core/web/public/next/assets/{AutonomySection-3V9pUyxm.js.map → AutonomySection-D3d8lYO3.js.map} +1 -1
- package/dist/core/web/public/next/assets/BranchBar-DU0jAV1E.js +2 -0
- package/dist/core/web/public/next/assets/{BranchBar-U8UdpfEB.js.map → BranchBar-DU0jAV1E.js.map} +1 -1
- package/dist/core/web/public/next/assets/{BudgetControl-DOTlMSmW.js → BudgetControl-Mm1ZL4u6.js} +2 -2
- package/dist/core/web/public/next/assets/{BudgetControl-DOTlMSmW.js.map → BudgetControl-Mm1ZL4u6.js.map} +1 -1
- package/dist/core/web/public/next/assets/{BurnDown-x4PWH9JF.js → BurnDown-C1fgcFqo.js} +2 -2
- package/dist/core/web/public/next/assets/{BurnDown-x4PWH9JF.js.map → BurnDown-C1fgcFqo.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Button-DYv_KKxr.js → Button-DqgLUZvd.js} +2 -2
- package/dist/core/web/public/next/assets/{Button-DYv_KKxr.js.map → Button-DqgLUZvd.js.map} +1 -1
- package/dist/core/web/public/next/assets/CapacityStrip-nWFHvqFB.js +2 -0
- package/dist/core/web/public/next/assets/CapacityStrip-nWFHvqFB.js.map +1 -0
- package/dist/core/web/public/next/assets/ChatSection-DUZNpiVr.js +3 -0
- package/dist/core/web/public/next/assets/ChatSection-DUZNpiVr.js.map +1 -0
- package/dist/core/web/public/next/assets/{CloudBudgetForm-DJeJvBEu.js → CloudBudgetForm-2OW38o_C.js} +2 -2
- package/dist/core/web/public/next/assets/{CloudBudgetForm-DJeJvBEu.js.map → CloudBudgetForm-2OW38o_C.js.map} +1 -1
- package/dist/core/web/public/next/assets/CommandPalette-C5w2o1-r.js +2 -0
- package/dist/core/web/public/next/assets/{CommandPalette-FiD4N8XD.js.map → CommandPalette-C5w2o1-r.js.map} +1 -1
- package/dist/core/web/public/next/assets/CommandSection-Bx2knNqY.js +2 -0
- package/dist/core/web/public/next/assets/{CommandSection-DN8KwH-X.js.map → CommandSection-Bx2knNqY.js.map} +1 -1
- package/dist/core/web/public/next/assets/ConfirmDialog-B7ZwCQOX.js +2 -0
- package/dist/core/web/public/next/assets/ConfirmDialog-B7ZwCQOX.js.map +1 -0
- package/dist/core/web/public/next/assets/ConfirmDialog-Dx15x0Ho.css +1 -0
- package/dist/core/web/public/next/assets/Dialog-BpgcEW6b.js +2 -0
- package/dist/core/web/public/next/assets/Dialog-BpgcEW6b.js.map +1 -0
- package/dist/core/web/public/next/assets/Dialog-tQ8kFulD.css +1 -0
- package/dist/core/web/public/next/assets/{DiffPane-DLJ3gGGK.js → DiffPane-DpqRUtCx.js} +2 -2
- package/dist/core/web/public/next/assets/{DiffPane-DLJ3gGGK.js.map → DiffPane-DpqRUtCx.js.map} +1 -1
- package/dist/core/web/public/next/assets/{DiffViewer-B7NWPjIO.js → DiffViewer-CoV5-nUf.js} +2 -2
- package/dist/core/web/public/next/assets/{DiffViewer-B7NWPjIO.js.map → DiffViewer-CoV5-nUf.js.map} +1 -1
- package/dist/core/web/public/next/assets/DockHost-C0Pq7Jak.js +2 -0
- package/dist/core/web/public/next/assets/{DockHost-DvR-hPhZ.js.map → DockHost-C0Pq7Jak.js.map} +1 -1
- package/dist/core/web/public/next/assets/{EmptyState-DhNgDDrF.js → EmptyState-DYW29ncw.js} +2 -2
- package/dist/core/web/public/next/assets/{EmptyState-DhNgDDrF.js.map → EmptyState-DYW29ncw.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Epistemic-uARPnx9x.js → Epistemic-DVx6oHzp.js} +2 -2
- package/dist/core/web/public/next/assets/{Epistemic-uARPnx9x.js.map → Epistemic-DVx6oHzp.js.map} +1 -1
- package/dist/core/web/public/next/assets/FleetSection-DSETviPK.js +3 -0
- package/dist/core/web/public/next/assets/{FleetSection-D_zRBCub.js.map → FleetSection-DSETviPK.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Funnel-CL8uHONq.js → Funnel-DxiGqJrt.js} +2 -2
- package/dist/core/web/public/next/assets/{Funnel-CL8uHONq.js.map → Funnel-DxiGqJrt.js.map} +1 -1
- package/dist/core/web/public/next/assets/GearTray-C3I89sIt.js +2 -0
- package/dist/core/web/public/next/assets/{GearTray-C7k4l_BW.js.map → GearTray-C3I89sIt.js.map} +1 -1
- package/dist/core/web/public/next/assets/{GrowthSection-DwdNSGj8.js → GrowthSection-C3m2bPEz.js} +2 -2
- package/dist/core/web/public/next/assets/{GrowthSection-DwdNSGj8.js.map → GrowthSection-C3m2bPEz.js.map} +1 -1
- package/dist/core/web/public/next/assets/HandoffDialog-Bjb96a0N.js +2 -0
- package/dist/core/web/public/next/assets/{HandoffDialog-FPVOqOMN.js.map → HandoffDialog-Bjb96a0N.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Input-B9-VLcHS.js → Input-ekTehVaH.js} +2 -2
- package/dist/core/web/public/next/assets/{Input-B9-VLcHS.js.map → Input-ekTehVaH.js.map} +1 -1
- package/dist/core/web/public/next/assets/LeaderCard-85VBbbaZ.js +2 -0
- package/dist/core/web/public/next/assets/{LeaderCard-4R0BhDzT.js.map → LeaderCard-85VBbbaZ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MatrixHeatmap-DiuushcS.js → MatrixHeatmap-Bo8j0QPC.js} +2 -2
- package/dist/core/web/public/next/assets/{MatrixHeatmap-DiuushcS.js.map → MatrixHeatmap-Bo8j0QPC.js.map} +1 -1
- package/dist/core/web/public/next/assets/McpSection-DvHFaVyp.js +2 -0
- package/dist/core/web/public/next/assets/{McpSection-CJ__OJKl.js.map → McpSection-DvHFaVyp.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MessageMarkdown-qWKyJvAQ.js → MessageMarkdown-fsY_ltVa.js} +3 -3
- package/dist/core/web/public/next/assets/{MessageMarkdown-qWKyJvAQ.js.map → MessageMarkdown-fsY_ltVa.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MessageMarkdownRenderer-x05TrsrW.js → MessageMarkdownRenderer-DDdtu82l.js} +2 -2
- package/dist/core/web/public/next/assets/{MessageMarkdownRenderer-x05TrsrW.js.map → MessageMarkdownRenderer-DDdtu82l.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Meter-D-hncpkO.js → Meter-CeGDXdDM.js} +2 -2
- package/dist/core/web/public/next/assets/{Meter-D-hncpkO.js.map → Meter-CeGDXdDM.js.map} +1 -1
- package/dist/core/web/public/next/assets/MindSection-CDVhHvXl.js +2 -0
- package/dist/core/web/public/next/assets/{MindSection-BjXHkQPS.js.map → MindSection-CDVhHvXl.js.map} +1 -1
- package/dist/core/web/public/next/assets/MutationTokenDialog-CrfJ0PdD.css +1 -0
- package/dist/core/web/public/next/assets/MutationTokenDialog-DTQzEOHR.js +2 -0
- package/dist/core/web/public/next/assets/MutationTokenDialog-DTQzEOHR.js.map +1 -0
- package/dist/core/web/public/next/assets/NeedsYouDrawer-6AuN0BF3.js +2 -0
- package/dist/core/web/public/next/assets/{NeedsYouDrawer-rSd1ZHAR.js.map → NeedsYouDrawer-6AuN0BF3.js.map} +1 -1
- package/dist/core/web/public/next/assets/{NeedsYouList-CG-nB1tr.js → NeedsYouList-ChnRmbSk.js} +2 -2
- package/dist/core/web/public/next/assets/{NeedsYouList-CG-nB1tr.js.map → NeedsYouList-ChnRmbSk.js.map} +1 -1
- package/dist/core/web/public/next/assets/NewChatDialog-B06E7sqg.js +3 -0
- package/dist/core/web/public/next/assets/{NewChatDialog-BeDQ1eW3.js.map → NewChatDialog-B06E7sqg.js.map} +1 -1
- package/dist/core/web/public/next/assets/OnboardingFlow-C2M3zov9.js +2 -0
- package/dist/core/web/public/next/assets/{OnboardingFlow-CkTZtt-m.js.map → OnboardingFlow-C2M3zov9.js.map} +1 -1
- package/dist/core/web/public/next/assets/PreviewPane-Bd6HsX1k.js +2 -0
- package/dist/core/web/public/next/assets/{PreviewPane-kzbbSK4u.js.map → PreviewPane-Bd6HsX1k.js.map} +1 -1
- package/dist/core/web/public/next/assets/ProviderLogo-Bz7KR5j3.js +2 -0
- package/dist/core/web/public/next/assets/ProviderLogo-Bz7KR5j3.js.map +1 -0
- package/dist/core/web/public/next/assets/{RailStatus-D-t2gPae.js → RailStatus-CctCuuLy.js} +2 -2
- package/dist/core/web/public/next/assets/{RailStatus-D-t2gPae.js.map → RailStatus-CctCuuLy.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RefreshIndicator-BLnr9IOM.js → RefreshIndicator-CKY5BGdD.js} +2 -2
- package/dist/core/web/public/next/assets/{RefreshIndicator-BLnr9IOM.js.map → RefreshIndicator-CKY5BGdD.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-CM_8pJs6.css → ResourcePoolConsoleApp-BX9JLkT4.css} +1 -1
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-BeG0gBif.js → ResourcePoolConsoleApp-CspIsW_G.js} +5 -5
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-BeG0gBif.js.map → ResourcePoolConsoleApp-CspIsW_G.js.map} +1 -1
- package/dist/core/web/public/next/assets/ResourcesChrome-B7fHZ6zX.js +3 -0
- package/dist/core/web/public/next/assets/ResourcesChrome-B7fHZ6zX.js.map +1 -0
- package/dist/core/web/public/next/assets/ResourcesChrome-uZEqC2EM.css +1 -0
- package/dist/core/web/public/next/assets/ResourcesDrawer-B7-N9n7-.js +2 -0
- package/dist/core/web/public/next/assets/ResourcesDrawer-B7-N9n7-.js.map +1 -0
- package/dist/core/web/public/next/assets/RouteErrorBoundary-C_B11J0s.js +2 -0
- package/dist/core/web/public/next/assets/RouteErrorBoundary-C_B11J0s.js.map +1 -0
- package/dist/core/web/public/next/assets/RouteErrorBoundary-DdxhTdZ6.css +1 -0
- package/dist/core/web/public/next/assets/{RunInCloudAction-C3LBp7C4.js → RunInCloudAction-_juw4EXd.js} +2 -2
- package/dist/core/web/public/next/assets/{RunInCloudAction-C3LBp7C4.js.map → RunInCloudAction-_juw4EXd.js.map} +1 -1
- package/dist/core/web/public/next/assets/SeatSelector-D_YXvkPy.js +3 -0
- package/dist/core/web/public/next/assets/{SeatSelector-DpvvbjNm.js.map → SeatSelector-D_YXvkPy.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Segmented-BL40udoO.js → Segmented-DnKP6rr7.js} +2 -2
- package/dist/core/web/public/next/assets/{Segmented-BL40udoO.js.map → Segmented-DnKP6rr7.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Select-FWLnAw_j.js → Select-DlbUupTX.js} +2 -2
- package/dist/core/web/public/next/assets/{Select-FWLnAw_j.js.map → Select-DlbUupTX.js.map} +1 -1
- package/dist/core/web/public/next/assets/SessionGate-DnuTZACL.js +2 -0
- package/dist/core/web/public/next/assets/SessionGate-DnuTZACL.js.map +1 -0
- package/dist/core/web/public/next/assets/SessionGate-DvMpXNpJ.css +1 -0
- package/dist/core/web/public/next/assets/SessionInsightChip-C33-k-Q5.js +2 -0
- package/dist/core/web/public/next/assets/{SessionInsightChip-CWye87Ju.js.map → SessionInsightChip-C33-k-Q5.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SessionSearch-YvCHFUuN.js → SessionSearch-DhhR9Csg.js} +2 -2
- package/dist/core/web/public/next/assets/{SessionSearch-YvCHFUuN.js.map → SessionSearch-DhhR9Csg.js.map} +1 -1
- package/dist/core/web/public/next/assets/SettingsSection-C0xQvCz3.js +2 -0
- package/dist/core/web/public/next/assets/SettingsSection-C0xQvCz3.js.map +1 -0
- package/dist/core/web/public/next/assets/Sheet-BvNYOYv5.js +2 -0
- package/dist/core/web/public/next/assets/{Sheet-DZKcQXQg.js.map → Sheet-BvNYOYv5.js.map} +1 -1
- package/dist/core/web/public/next/assets/ShortcutsOverlay-1nUBVO-Z.js +2 -0
- package/dist/core/web/public/next/assets/{ShortcutsOverlay-BpDimdPq.js.map → ShortcutsOverlay-1nUBVO-Z.js.map} +1 -1
- package/dist/core/web/public/next/assets/Sidebar-YrVvvBNM.js +3 -0
- package/dist/core/web/public/next/assets/{Sidebar-BoBzBEFX.js.map → Sidebar-YrVvvBNM.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Slider-DUMo9HDD.js → Slider-B2c-dbQb.js} +2 -2
- package/dist/core/web/public/next/assets/{Slider-DUMo9HDD.js.map → Slider-B2c-dbQb.js.map} +1 -1
- package/dist/core/web/public/next/assets/{StatusBadge-BwnBNFQr.js → StatusBadge-Q9YYkijx.js} +2 -2
- package/dist/core/web/public/next/assets/{StatusBadge-BwnBNFQr.js.map → StatusBadge-Q9YYkijx.js.map} +1 -1
- package/dist/core/web/public/next/assets/{StepBand-PDXMIlRk.js → StepBand-Ci-C0GUG.js} +2 -2
- package/dist/core/web/public/next/assets/{StepBand-PDXMIlRk.js.map → StepBand-Ci-C0GUG.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Surface-B3TZVoER.js → Surface-DBovMq4P.js} +2 -2
- package/dist/core/web/public/next/assets/{Surface-B3TZVoER.js.map → Surface-DBovMq4P.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Swimlane-DR4OgON_.js → Swimlane-Cdc4TqDe.js} +2 -2
- package/dist/core/web/public/next/assets/{Swimlane-DR4OgON_.js.map → Swimlane-Cdc4TqDe.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Switch-CcR5Llk5.js → Switch-CUrvzO2k.js} +2 -2
- package/dist/core/web/public/next/assets/{Switch-CcR5Llk5.js.map → Switch-CUrvzO2k.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Tag-_-K1h7Hk.js → Tag-Bv8u6APt.js} +2 -2
- package/dist/core/web/public/next/assets/{Tag-_-K1h7Hk.js.map → Tag-Bv8u6APt.js.map} +1 -1
- package/dist/core/web/public/next/assets/TerminalPane-BE4Xlqi5.js +7 -0
- package/dist/core/web/public/next/assets/{TerminalPane-_1aH4ndN.js.map → TerminalPane-BE4Xlqi5.js.map} +1 -1
- package/dist/core/web/public/next/assets/UniverseConsoleApp-BGwejf0m.js +2 -0
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-BUsq-inZ.js.map → UniverseConsoleApp-BGwejf0m.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-Dh7A-hLD.css → UniverseConsoleApp-DfuT-wFw.css} +1 -1
- package/dist/core/web/public/next/assets/{UniverseView-Dogy_dsB.js → UniverseView-CgKa-WXC.js} +4 -4
- package/dist/core/web/public/next/assets/{UniverseView-Dogy_dsB.js.map → UniverseView-CgKa-WXC.js.map} +1 -1
- package/dist/core/web/public/next/assets/UsageSection-CazsHm1f.js +2 -0
- package/dist/core/web/public/next/assets/{UsageSection-DiX_dTyo.js.map → UsageSection-CazsHm1f.js.map} +1 -1
- package/dist/core/web/public/next/assets/VerseConsoleApp-CTF3Shs0.js +3 -0
- package/dist/core/web/public/next/assets/VerseConsoleApp-CTF3Shs0.js.map +1 -0
- package/dist/core/web/public/next/assets/Workspace-CgdyXiEV.js +10 -0
- package/dist/core/web/public/next/assets/Workspace-CgdyXiEV.js.map +1 -0
- package/dist/core/web/public/next/assets/Workspace-Dwri2jFJ.css +1 -0
- package/dist/core/web/public/next/assets/actions-MtxBGS5B.js +2 -0
- package/dist/core/web/public/next/assets/{actions-s2lfm_5k.js.map → actions-MtxBGS5B.js.map} +1 -1
- package/dist/core/web/public/next/assets/budget-queries-CP7hgR-p.js +2 -0
- package/dist/core/web/public/next/assets/{budget-queries-wUshcovN.js.map → budget-queries-CP7hgR-p.js.map} +1 -1
- package/dist/core/web/public/next/assets/{capacity-strip-model-Bj_9ztzs.js → capacity-strip-model-fHfu5cph.js} +2 -2
- package/dist/core/web/public/next/assets/{capacity-strip-model-Bj_9ztzs.js.map → capacity-strip-model-fHfu5cph.js.map} +1 -1
- package/dist/core/web/public/next/assets/{charts-CMSgAUKn.js → charts-Bis9WSiS.js} +2 -2
- package/dist/core/web/public/next/assets/{charts-CMSgAUKn.js.map → charts-Bis9WSiS.js.map} +1 -1
- package/dist/core/web/public/next/assets/cloud-queries-BsOepFz6.js +2 -0
- package/dist/core/web/public/next/assets/{cloud-queries-CnV1yaNG.js.map → cloud-queries-BsOepFz6.js.map} +1 -1
- package/dist/core/web/public/next/assets/{cloud.module-CiwatLj3.js → cloud.module-DoFnr8ZH.js} +2 -2
- package/dist/core/web/public/next/assets/{cloud.module-CiwatLj3.js.map → cloud.module-DoFnr8ZH.js.map} +1 -1
- package/dist/core/web/public/next/assets/{command-bus-DqimKCUY.js → command-bus-CMvbYP5K.js} +2 -2
- package/dist/core/web/public/next/assets/{command-bus-DqimKCUY.js.map → command-bus-CMvbYP5K.js.map} +1 -1
- package/dist/core/web/public/next/assets/command-catalog-Bb_PxC5w.js +2 -0
- package/dist/core/web/public/next/assets/command-catalog-Bb_PxC5w.js.map +1 -0
- package/dist/core/web/public/next/assets/compaction-point-VL9oegWS.js +2 -0
- package/dist/core/web/public/next/assets/compaction-point-VL9oegWS.js.map +1 -0
- package/dist/core/web/public/next/assets/{composer-keys-DBRymxQn.js → composer-keys-su0g1h9o.js} +2 -2
- package/dist/core/web/public/next/assets/{composer-keys-DBRymxQn.js.map → composer-keys-su0g1h9o.js.map} +1 -1
- package/dist/core/web/public/next/assets/context-model-Ci3Ch9t5.js +2 -0
- package/dist/core/web/public/next/assets/{context-model-Dwd49-dp.js.map → context-model-Ci3Ch9t5.js.map} +1 -1
- package/dist/core/web/public/next/assets/context-model-CjiJTnf1.js +2 -0
- package/dist/core/web/public/next/assets/{context-model-MT17V86_.js.map → context-model-CjiJTnf1.js.map} +1 -1
- package/dist/core/web/public/next/assets/context-queries-BDXT6LQ3.js +2 -0
- package/dist/core/web/public/next/assets/{context-queries-xVKIeynP.js.map → context-queries-BDXT6LQ3.js.map} +1 -1
- package/dist/core/web/public/next/assets/control-queries-Dv-h1Clu.js +2 -0
- package/dist/core/web/public/next/assets/{control-queries-DOZR-D8G.js.map → control-queries-Dv-h1Clu.js.map} +1 -1
- package/dist/core/web/public/next/assets/{dock-icons-8EtARwUm.js → dock-icons-t--Eugrd.js} +2 -2
- package/dist/core/web/public/next/assets/{dock-icons-8EtARwUm.js.map → dock-icons-t--Eugrd.js.map} +1 -1
- package/dist/core/web/public/next/assets/{dock-store-BA1cHOYA.js → dock-store-qIu7kSQE.js} +2 -2
- package/dist/core/web/public/next/assets/{dock-store-BA1cHOYA.js.map → dock-store-qIu7kSQE.js.map} +1 -1
- package/dist/core/web/public/next/assets/{fleet-model-CNe8Wh-s.js → fleet-model-IRbwfhkR.js} +2 -2
- package/dist/core/web/public/next/assets/{fleet-model-CNe8Wh-s.js.map → fleet-model-IRbwfhkR.js.map} +1 -1
- package/dist/core/web/public/next/assets/fleet-queries-7FVNByX1.js +2 -0
- package/dist/core/web/public/next/assets/{fleet-queries-BSdRlUwJ.js.map → fleet-queries-7FVNByX1.js.map} +1 -1
- package/dist/core/web/public/next/assets/focus-trap-QqQxQdvH.js +2 -0
- package/dist/core/web/public/next/assets/focus-trap-QqQxQdvH.js.map +1 -0
- package/dist/core/web/public/next/assets/{format-B8DAVcn2.js → format-CaMmVQCn.js} +2 -2
- package/dist/core/web/public/next/assets/{format-B8DAVcn2.js.map → format-CaMmVQCn.js.map} +1 -1
- package/dist/core/web/public/next/assets/git-model-B4S_GUNA.js +5 -0
- package/dist/core/web/public/next/assets/{git-model-CivuBY_D.js.map → git-model-B4S_GUNA.js.map} +1 -1
- package/dist/core/web/public/next/assets/global-BkNl4e6E.js +2 -0
- package/dist/core/web/public/next/assets/global-BkNl4e6E.js.map +1 -0
- package/dist/core/web/public/next/assets/global-BlI2BYa1.css +1 -0
- package/dist/core/web/public/next/assets/guarded-action-DHiL8tY5.js +3 -0
- package/dist/core/web/public/next/assets/guarded-action-DHiL8tY5.js.map +1 -0
- package/dist/core/web/public/next/assets/guarded-runners-DmGEkM2P.js +2 -0
- package/dist/core/web/public/next/assets/guarded-runners-DmGEkM2P.js.map +1 -0
- package/dist/core/web/public/next/assets/icon-base-NtFmP2yB.js +2 -0
- package/dist/core/web/public/next/assets/icon-base-NtFmP2yB.js.map +1 -0
- package/dist/core/web/public/next/assets/icons-C5EFt_Ts.js +2 -0
- package/dist/core/web/public/next/assets/icons-C5EFt_Ts.js.map +1 -0
- package/dist/core/web/public/next/assets/{index-oAAq8XJa.js → index-DbDw9UAs.js} +3 -3
- package/dist/core/web/public/next/assets/{index-oAAq8XJa.js.map → index-DbDw9UAs.js.map} +1 -1
- package/dist/core/web/public/next/assets/{live-model-DCw_IFRI.js → live-model-DEwrl7_A.js} +2 -2
- package/dist/core/web/public/next/assets/{live-model-DCw_IFRI.js.map → live-model-DEwrl7_A.js.map} +1 -1
- package/dist/core/web/public/next/assets/{mind.module-vnuJcwvD.js → mind.module-CLhqMQak.js} +2 -2
- package/dist/core/web/public/next/assets/{mind.module-vnuJcwvD.js.map → mind.module-CLhqMQak.js.map} +1 -1
- package/dist/core/web/public/next/assets/mutations-Kvzsg-iK.js +2 -0
- package/dist/core/web/public/next/assets/{mutations-Dpsql5t7.js.map → mutations-Kvzsg-iK.js.map} +1 -1
- package/dist/core/web/public/next/assets/nav-C0IunEYF.js +2 -0
- package/dist/core/web/public/next/assets/nav-C0IunEYF.js.map +1 -0
- package/dist/core/web/public/next/assets/overnight-queries-C_AfcL7q.js +2 -0
- package/dist/core/web/public/next/assets/{overnight-queries-X-44Gsw5.js.map → overnight-queries-C_AfcL7q.js.map} +1 -1
- package/dist/core/web/public/next/assets/preloaded-CctOitLu.js +2 -0
- package/dist/core/web/public/next/assets/preloaded-CctOitLu.js.map +1 -0
- package/dist/core/web/public/next/assets/primitives-CbAGCNKt.js +1 -0
- package/dist/core/web/public/next/assets/{queries-BA4rNGD-.js → queries-THD05gHP.js} +2 -2
- package/dist/core/web/public/next/assets/{queries-BA4rNGD-.js.map → queries-THD05gHP.js.map} +1 -1
- package/dist/core/web/public/next/assets/reasoning-pref-BVPu0SME.js +2 -0
- package/dist/core/web/public/next/assets/{reasoning-pref-B9-DJUXP.js.map → reasoning-pref-BVPu0SME.js.map} +1 -1
- package/dist/core/web/public/next/assets/reveal-anchor-wCT5b4m3.js +2 -0
- package/dist/core/web/public/next/assets/reveal-anchor-wCT5b4m3.js.map +1 -0
- package/dist/core/web/public/next/assets/seat-subscription-CR_VylsK.js +2 -0
- package/dist/core/web/public/next/assets/{seat-subscription-CH6fW4fJ.js.map → seat-subscription-CR_VylsK.js.map} +1 -1
- package/dist/core/web/public/next/assets/{section-visibility-qFqc_d4Z.js → section-visibility-B0xXUQJ0.js} +2 -2
- package/dist/core/web/public/next/assets/{section-visibility-qFqc_d4Z.js.map → section-visibility-B0xXUQJ0.js.map} +1 -1
- package/dist/core/web/public/next/assets/{sidebar-model-M1GaQU5l.js → sidebar-model-C5wVXGpb.js} +2 -2
- package/dist/core/web/public/next/assets/{sidebar-model-M1GaQU5l.js.map → sidebar-model-C5wVXGpb.js.map} +1 -1
- package/dist/core/web/public/next/assets/slots-DDd8cEoh.js +3 -0
- package/dist/core/web/public/next/assets/{slots-Ds9ZIqUL.js.map → slots-DDd8cEoh.js.map} +1 -1
- package/dist/core/web/public/next/assets/surface-data-BFxAlefI.js +2 -0
- package/dist/core/web/public/next/assets/{surface-data-J52iIGMD.js.map → surface-data-BFxAlefI.js.map} +1 -1
- package/dist/core/web/public/next/assets/surface-prefetch-CHusyO9q.js +2 -0
- package/dist/core/web/public/next/assets/{surface-prefetch-CgZ-LEJK.js.map → surface-prefetch-CHusyO9q.js.map} +1 -1
- package/dist/core/web/public/next/assets/{tasks-model-ent8f0jZ.js → tasks-model-DvkWveXs.js} +2 -2
- package/dist/core/web/public/next/assets/{tasks-model-ent8f0jZ.js.map → tasks-model-DvkWveXs.js.map} +1 -1
- package/dist/core/web/public/next/assets/{terminal-icons-DJTK7QpR.js → terminal-icons-Dp6pJgV2.js} +2 -2
- package/dist/core/web/public/next/assets/{terminal-icons-DJTK7QpR.js.map → terminal-icons-Dp6pJgV2.js.map} +1 -1
- package/dist/core/web/public/next/assets/{usage-queries-Bn8ccqyN.js → usage-queries-CUTmnegA.js} +2 -2
- package/dist/core/web/public/next/assets/{usage-queries-Bn8ccqyN.js.map → usage-queries-CUTmnegA.js.map} +1 -1
- package/dist/core/web/public/next/assets/use-guarded-action-UCX2u1t1.js +2 -0
- package/dist/core/web/public/next/assets/{use-guarded-action-C2HlSzkz.js.map → use-guarded-action-UCX2u1t1.js.map} +1 -1
- package/dist/core/web/public/next/assets/{use-ticker-BNc1H4ZC.js → use-ticker-OXAjob3y.js} +2 -2
- package/dist/core/web/public/next/assets/{use-ticker-BNc1H4ZC.js.map → use-ticker-OXAjob3y.js.map} +1 -1
- package/dist/core/web/public/next/assets/use-token-gate-CDDRAoKH.js +2 -0
- package/dist/core/web/public/next/assets/{use-token-gate-B3IJL6bf.js.map → use-token-gate-CDDRAoKH.js.map} +1 -1
- package/dist/core/web/public/next/assets/useChartWidth-BW6SwYIK.css +1 -0
- package/dist/core/web/public/next/assets/useChartWidth-D9M7kUw7.js +2 -0
- package/dist/core/web/public/next/assets/{useChartWidth-lZ9PrQn0.js.map → useChartWidth-D9M7kUw7.js.map} +1 -1
- package/dist/core/web/public/next/assets/{useSeatsRefresh-CG4jczeL.js → useSeatsRefresh-B2dCVcj9.js} +2 -2
- package/dist/core/web/public/next/assets/{useSeatsRefresh-CG4jczeL.js.map → useSeatsRefresh-B2dCVcj9.js.map} +1 -1
- package/dist/core/web/public/next/assets/useVerseTranscript-BL3CljSI.js +2 -0
- package/dist/core/web/public/next/assets/useVerseTranscript-BL3CljSI.js.map +1 -0
- package/dist/core/web/public/next/assets/verse-icons-DASWdYuE.js +2 -0
- package/dist/core/web/public/next/assets/verse-icons-DASWdYuE.js.map +1 -0
- package/dist/core/web/public/next/assets/verse-model-BQ0Y2CSr.js +2 -0
- package/dist/core/web/public/next/assets/verse-model-BQ0Y2CSr.js.map +1 -0
- package/dist/core/web/public/next/assets/verse-store-b_Lek_c5.js +3 -0
- package/dist/core/web/public/next/assets/verse-store-b_Lek_c5.js.map +1 -0
- package/dist/core/web/public/next/assets/verse-ui-store-D7YXi63q.js +3 -0
- package/dist/core/web/public/next/assets/{verse-ui-store-zafyzXKD.js.map → verse-ui-store-D7YXi63q.js.map} +1 -1
- package/dist/core/web/public/next/assets/{viewport-BEqGUoTA.js → viewport-BYGH5EgA.js} +2 -2
- package/dist/core/web/public/next/assets/{viewport-BEqGUoTA.js.map → viewport-BYGH5EgA.js.map} +1 -1
- package/dist/core/web/public/next/assets/warmup-AsqwWCUi.js +3 -0
- package/dist/core/web/public/next/assets/{warmup-BR6pxAKs.js.map → warmup-AsqwWCUi.js.map} +1 -1
- package/dist/core/web/public/next/assets/{workspace-model-D_tWD5Wt.js → workspace-model-CXorJr0G.js} +2 -2
- package/dist/core/web/public/next/assets/{workspace-model-D_tWD5Wt.js.map → workspace-model-CXorJr0G.js.map} +1 -1
- package/dist/core/web/public/next/index.html +1 -1
- package/dist/release-dependency-inventory.json +1 -1
- package/package.json +5 -2
- package/dist/cli/activation.d.ts +0 -41
- package/dist/cli/activation.js +0 -485
- package/dist/cli/activation.js.map +0 -1
- package/dist/core/fleet/generated-repair-resolution.d.ts +0 -36
- package/dist/core/fleet/generated-repair-resolution.js +0 -245
- package/dist/core/fleet/generated-repair-resolution.js.map +0 -1
- package/dist/core/local-runtime/llama/port.d.ts +0 -17
- package/dist/core/local-runtime/llama/port.js +0 -47
- package/dist/core/local-runtime/llama/port.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-host.d.ts +0 -54
- package/dist/core/local-runtime/llama/proxy-host.js +0 -159
- package/dist/core/local-runtime/llama/proxy-host.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-process.d.ts +0 -148
- package/dist/core/local-runtime/llama/proxy-process.js +0 -250
- package/dist/core/local-runtime/llama/proxy-process.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-record.d.ts +0 -40
- package/dist/core/local-runtime/llama/proxy-record.js +0 -133
- package/dist/core/local-runtime/llama/proxy-record.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-supervisor.d.ts +0 -118
- package/dist/core/local-runtime/llama/proxy-supervisor.js +0 -511
- package/dist/core/local-runtime/llama/proxy-supervisor.js.map +0 -1
- package/dist/core/web/public/next/assets/Advanced-DEM93sKI.js +0 -2
- package/dist/core/web/public/next/assets/App-CimXmK0L.js +0 -7
- package/dist/core/web/public/next/assets/AppsSection-D6U-dSj6.js +0 -2
- package/dist/core/web/public/next/assets/AutonomySection-3V9pUyxm.js +0 -2
- package/dist/core/web/public/next/assets/BranchBar-U8UdpfEB.js +0 -2
- package/dist/core/web/public/next/assets/CapacityStrip-C667yQe8.js +0 -2
- package/dist/core/web/public/next/assets/CapacityStrip-C667yQe8.js.map +0 -1
- package/dist/core/web/public/next/assets/ChatSection-CCcIPpOq.js +0 -3
- package/dist/core/web/public/next/assets/ChatSection-CCcIPpOq.js.map +0 -1
- package/dist/core/web/public/next/assets/CommandPalette-FiD4N8XD.js +0 -2
- package/dist/core/web/public/next/assets/CommandSection-DN8KwH-X.js +0 -2
- package/dist/core/web/public/next/assets/DockHost-DvR-hPhZ.js +0 -2
- package/dist/core/web/public/next/assets/FleetSection-D_zRBCub.js +0 -3
- package/dist/core/web/public/next/assets/GearTray-C7k4l_BW.js +0 -2
- package/dist/core/web/public/next/assets/HandoffDialog-FPVOqOMN.js +0 -2
- package/dist/core/web/public/next/assets/LeaderCard-4R0BhDzT.js +0 -2
- package/dist/core/web/public/next/assets/McpSection-CJ__OJKl.js +0 -2
- package/dist/core/web/public/next/assets/MindSection-BjXHkQPS.js +0 -2
- package/dist/core/web/public/next/assets/MutationTokenDialog-Cum_DqQZ.css +0 -1
- package/dist/core/web/public/next/assets/MutationTokenDialog-SkRxqV_I.js +0 -2
- package/dist/core/web/public/next/assets/MutationTokenDialog-SkRxqV_I.js.map +0 -1
- package/dist/core/web/public/next/assets/NeedsYouDrawer-rSd1ZHAR.js +0 -2
- package/dist/core/web/public/next/assets/NewChatDialog-BeDQ1eW3.js +0 -3
- package/dist/core/web/public/next/assets/OnboardingFlow-CkTZtt-m.js +0 -2
- package/dist/core/web/public/next/assets/PreviewPane-kzbbSK4u.js +0 -2
- package/dist/core/web/public/next/assets/ResourcesChrome-B3Z3O98t.css +0 -1
- package/dist/core/web/public/next/assets/ResourcesChrome-BzV6bkIa.js +0 -3
- package/dist/core/web/public/next/assets/ResourcesChrome-BzV6bkIa.js.map +0 -1
- package/dist/core/web/public/next/assets/ResourcesDrawer-o4ILHdep.js +0 -2
- package/dist/core/web/public/next/assets/ResourcesDrawer-o4ILHdep.js.map +0 -1
- package/dist/core/web/public/next/assets/RouteErrorBoundary-6RMd_aZg.css +0 -1
- package/dist/core/web/public/next/assets/RouteErrorBoundary-C5SxA2Dg.js +0 -2
- package/dist/core/web/public/next/assets/RouteErrorBoundary-C5SxA2Dg.js.map +0 -1
- package/dist/core/web/public/next/assets/SeatSelector-DpvvbjNm.js +0 -3
- package/dist/core/web/public/next/assets/SessionInsightChip-CWye87Ju.js +0 -2
- package/dist/core/web/public/next/assets/SettingsSection-Dr18upeE.js +0 -2
- package/dist/core/web/public/next/assets/SettingsSection-Dr18upeE.js.map +0 -1
- package/dist/core/web/public/next/assets/Sheet-DZKcQXQg.js +0 -2
- package/dist/core/web/public/next/assets/ShortcutsOverlay-BpDimdPq.js +0 -2
- package/dist/core/web/public/next/assets/Sidebar-BoBzBEFX.js +0 -3
- package/dist/core/web/public/next/assets/TerminalPane-_1aH4ndN.js +0 -7
- package/dist/core/web/public/next/assets/UniverseConsoleApp-BUsq-inZ.js +0 -2
- package/dist/core/web/public/next/assets/UsageSection-DiX_dTyo.js +0 -2
- package/dist/core/web/public/next/assets/VerseConsoleApp-WVeyJnW7.js +0 -3
- package/dist/core/web/public/next/assets/VerseConsoleApp-WVeyJnW7.js.map +0 -1
- package/dist/core/web/public/next/assets/Workspace-BYW9dm90.css +0 -1
- package/dist/core/web/public/next/assets/Workspace-BbxZHwQd.js +0 -10
- package/dist/core/web/public/next/assets/Workspace-BbxZHwQd.js.map +0 -1
- package/dist/core/web/public/next/assets/actions-s2lfm_5k.js +0 -2
- package/dist/core/web/public/next/assets/budget-queries-wUshcovN.js +0 -2
- package/dist/core/web/public/next/assets/cloud-queries-CnV1yaNG.js +0 -2
- package/dist/core/web/public/next/assets/command-catalog-BdtDH93o.js +0 -2
- package/dist/core/web/public/next/assets/command-catalog-BdtDH93o.js.map +0 -1
- package/dist/core/web/public/next/assets/context-model-Dwd49-dp.js +0 -2
- package/dist/core/web/public/next/assets/context-model-MT17V86_.js +0 -2
- package/dist/core/web/public/next/assets/context-queries-xVKIeynP.js +0 -2
- package/dist/core/web/public/next/assets/control-queries-DOZR-D8G.js +0 -2
- package/dist/core/web/public/next/assets/dock-panes-UKS-mXhr.js +0 -2
- package/dist/core/web/public/next/assets/dock-panes-UKS-mXhr.js.map +0 -1
- package/dist/core/web/public/next/assets/fleet-queries-BSdRlUwJ.js +0 -2
- package/dist/core/web/public/next/assets/git-model-CivuBY_D.js +0 -5
- package/dist/core/web/public/next/assets/global-Di2PUgj4.js +0 -2
- package/dist/core/web/public/next/assets/global-Di2PUgj4.js.map +0 -1
- package/dist/core/web/public/next/assets/global-_tOCFt9y.css +0 -1
- package/dist/core/web/public/next/assets/guarded-action-CvOHcqyH.js +0 -2
- package/dist/core/web/public/next/assets/guarded-action-CvOHcqyH.js.map +0 -1
- package/dist/core/web/public/next/assets/icons-B_yuAgdN.js +0 -2
- package/dist/core/web/public/next/assets/icons-B_yuAgdN.js.map +0 -1
- package/dist/core/web/public/next/assets/mutations-Dpsql5t7.js +0 -2
- package/dist/core/web/public/next/assets/overnight-queries-X-44Gsw5.js +0 -2
- package/dist/core/web/public/next/assets/primitives-BDIcUvob.js +0 -1
- package/dist/core/web/public/next/assets/reasoning-pref-B9-DJUXP.js +0 -2
- package/dist/core/web/public/next/assets/seat-subscription-CH6fW4fJ.js +0 -2
- package/dist/core/web/public/next/assets/slots-Ds9ZIqUL.js +0 -3
- package/dist/core/web/public/next/assets/surface-data-J52iIGMD.js +0 -2
- package/dist/core/web/public/next/assets/surface-prefetch-CgZ-LEJK.js +0 -2
- package/dist/core/web/public/next/assets/use-guarded-action-C2HlSzkz.js +0 -2
- package/dist/core/web/public/next/assets/use-token-gate-B3IJL6bf.js +0 -2
- package/dist/core/web/public/next/assets/useActivity-Bk3XgXjL.js +0 -2
- package/dist/core/web/public/next/assets/useActivity-Bk3XgXjL.js.map +0 -1
- package/dist/core/web/public/next/assets/useChartWidth-BAtVgn2n.css +0 -1
- package/dist/core/web/public/next/assets/useChartWidth-lZ9PrQn0.js +0 -2
- package/dist/core/web/public/next/assets/verse-model-D7NZQFAR.js +0 -2
- package/dist/core/web/public/next/assets/verse-model-D7NZQFAR.js.map +0 -1
- package/dist/core/web/public/next/assets/verse-queries-DvIJcn6Z.js +0 -2
- package/dist/core/web/public/next/assets/verse-queries-DvIJcn6Z.js.map +0 -1
- package/dist/core/web/public/next/assets/verse-store-DjBWj04q.js +0 -3
- package/dist/core/web/public/next/assets/verse-store-DjBWj04q.js.map +0 -1
- package/dist/core/web/public/next/assets/verse-ui-store-zafyzXKD.js +0 -3
- package/dist/core/web/public/next/assets/warmup-BR6pxAKs.js +0 -3
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,s as t}from"./index-oAAq8XJa.js";import{c as n,k as r,s as i}from"./global-Di2PUgj4.js";import{r as a}from"./verse-queries-DvIJcn6Z.js";import{v as o}from"./format-B8DAVcn2.js";var s=t(e(),1);function c(){let[e,t]=(0,s.useState)({open:!1,reason:``}),n=(0,s.useRef)(null),i=(0,s.useCallback)((e,i)=>r()?i():(n.current?.cancel(),new Promise((r,a)=>{n.current={run:()=>{i().then(r,a)},cancel:()=>r(null)},t({open:!0,reason:e})})),[]),a=(0,s.useCallback)(()=>{t({open:!1,reason:``});let e=n.current;e&&setTimeout(()=>{n.current===e&&(n.current=null,e.cancel())},0)},[]),o=(0,s.useCallback)(()=>{let e=n.current;n.current=null,e?.run()},[]);return{run:i,dialog:{open:e.open,reason:e.reason,onClose:a,onUnlocked:o}}}function l(e){return e instanceof n?"This server is read-only (started without dispatch — run `ashlr verse`), or older than this console.":e instanceof a?`Unlock actions with the mutation token first.`:e instanceof i?e.status===401?"The mutation token was rejected. Unlock again with the token `ashlr verse` printed.":e.code===`VERSE_SESSION_NOT_FOUND`?`This chat no longer exists on the server — it may have been deleted. Refresh the chat list.`:e.detail?o(e.detail):e.status===404?"This server does not have that route yet — update Ashlr and restart `ashlr verse`.":e.status===409?`A turn is already running in this chat. Wait for it or stop it first.`:o(e.message):e instanceof Error&&e.message?o(e.message):`Something went wrong.`}export{c as n,l as t};
|
|
2
|
-
//# sourceMappingURL=use-token-gate-B3IJL6bf.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,s as t}from"./index-oAAq8XJa.js";import{l as n,s as r}from"./global-Di2PUgj4.js";import{a as i}from"./workbench-types-DzN-5trg.js";import{t as a}from"./section-visibility-qFqc_d4Z.js";var o=t(e(),1),s=5e3,c=3e4,l=(e,t)=>n(e,t),u={status:`idle`,data:null,updatedAt:null},d=null,f=null,p=null,m=0,h=new Set,g=new Set;function _(e){u=e;for(let e of[...h])e()}function v(){return typeof document<`u`&&document.visibilityState===`hidden`}function y(){if(f&&clearTimeout(f),f=null,m===0)return;let e=Math.max(a,v()?c:s);f=setTimeout(()=>{b()},e)}function b(){if(p)return p;u.status===`idle`&&_({...u,status:`loading`});let e=d?`${i}?since=${encodeURIComponent(d)}`:i;return p=(async()=>{try{let t=await l(e),n=d===null;if(d=typeof t.cursor==`string`?t.cursor:null,_({status:`ready`,data:t,updatedAt:Date.now()}),!n&&Array.isArray(t.completions)&&t.completions.length>0)for(let e of[...g])try{e(t.completions)}catch{}}catch(e){e instanceof r&&e.status===404?_({status:`unavailable`,data:null,updatedAt:u.updatedAt}):e instanceof r&&e.status===400&&d?(d=null,_({...u,status:u.data?`stale`:`loading`})):_({...u,status:u.data?`stale`:`unavailable`})}finally{p=null,y()}})(),p}function x(){!v()&&m>0?b():y()}function S(){m+=1,m===1&&(typeof document<`u`&&document.addEventListener(`visibilitychange`,x),b())}function C(){m=Math.max(0,m-1),!(m>0)&&(f&&clearTimeout(f),f=null,typeof document<`u`&&document.removeEventListener(`visibilitychange`,x))}function w(e){return h.add(e),S(),()=>{h.delete(e),C()}}function T(){return u}function E(){return(0,o.useSyncExternalStore)(w,T,T)}function D(e){return g.add(e),()=>g.delete(e)}export{E as i,D as n,b as r,T as t};
|
|
2
|
-
//# sourceMappingURL=useActivity-Bk3XgXjL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useActivity-Bk3XgXjL.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/shell/useActivity.ts"],"sourcesContent":["/**\n * routes/verse/shell/useActivity.ts — the shell's one CURSOR loop over\n * GET /api/verse/activity (unit C1; route: core/verse/activity-api.ts).\n *\n * The rail badges, the palette's \"Needs you\" and running chats, the Needs-you\n * drawer and the in-app \"Finished / Failed\" toasts all read this ONE store,\n * so the whole shell costs one request per tick however many things show a\n * count. (The chat list polls the same route WITHOUT a cursor for its\n * present-tense view — chat/use-chat-activity.ts, C2.)\n *\n * CADENCE. Every 5 s while the window is visible, every 30 s while it is\n * hidden (the badges still need to be right when it comes back, and the tab\n * title count; C8's Rust owns native notifications). Never under the 2 s\n * floor (section-visibility MIN_POLL_INTERVAL_MS). Polls only while\n * something is subscribed.\n *\n * HONESTY. A 404 means the activity module is not in this build →\n * `unavailable`, and every badge renders \"unknown\" (no dot), never zero. A\n * failed poll keeps the last good data and says `stale` — a badge that\n * flashes to 0 on one dropped request would read as a false all-clear.\n *\n * COMPLETIONS arrive once per cursor; `onActivityCompletions` listeners get\n * each batch exactly once. The first poll of a page carries none (history is\n * not news).\n */\nimport { useSyncExternalStore } from 'react';\nimport type { VerseActivityCompletion, VerseActivityResponse } from '../../../../core/verse/workbench-types.js';\nimport { VERSE_ACTIVITY_PATH } from '../../../../core/verse/workbench-types.js';\nimport { ApiError, apiGet } from '../../../data/client.js';\nimport { MIN_POLL_INTERVAL_MS } from './section-visibility.js';\n\nexport const ACTIVITY_POLL_VISIBLE_MS = 5_000;\nexport const ACTIVITY_POLL_HIDDEN_MS = 30_000;\n\nexport type ActivityStatus = 'idle' | 'loading' | 'ready' | 'stale' | 'unavailable';\n\nexport interface ActivityState {\n status: ActivityStatus;\n data: VerseActivityResponse | null;\n /** ms epoch of the last successful poll. */\n updatedAt: number | null;\n}\n\ntype Fetcher = (path: string, signal?: AbortSignal) => Promise<VerseActivityResponse>;\n\nlet fetcher: Fetcher = (path, signal) => apiGet<VerseActivityResponse>(path, signal);\nlet snapshot: ActivityState = { status: 'idle', data: null, updatedAt: null };\nlet cursor: string | null = null;\nlet timer: ReturnType<typeof setTimeout> | null = null;\nlet inFlight: Promise<void> | null = null;\nlet subscribers = 0;\nconst listeners = new Set<() => void>();\nconst completionListeners = new Set<(batch: VerseActivityCompletion[]) => void>();\n\nfunction emit(next: ActivityState): void {\n snapshot = next;\n for (const l of [...listeners]) l();\n}\n\nfunction hidden(): boolean {\n return typeof document !== 'undefined' && document.visibilityState === 'hidden';\n}\n\nfunction schedule(): void {\n if (timer) clearTimeout(timer);\n timer = null;\n if (subscribers === 0) return;\n const every = Math.max(MIN_POLL_INTERVAL_MS, hidden() ? ACTIVITY_POLL_HIDDEN_MS : ACTIVITY_POLL_VISIBLE_MS);\n timer = setTimeout(() => {\n void refreshActivity();\n }, every);\n}\n\n/** Poll now (joins one already running). Resolves when it has settled; never rejects. */\nexport function refreshActivity(): Promise<void> {\n if (inFlight) return inFlight;\n if (snapshot.status === 'idle') emit({ ...snapshot, status: 'loading' });\n const path = cursor ? `${VERSE_ACTIVITY_PATH}?since=${encodeURIComponent(cursor)}` : VERSE_ACTIVITY_PATH;\n inFlight = (async () => {\n try {\n const data = await fetcher(path);\n const firstPoll = cursor === null;\n cursor = typeof data.cursor === 'string' ? data.cursor : null;\n emit({ status: 'ready', data, updatedAt: Date.now() });\n if (!firstPoll && Array.isArray(data.completions) && data.completions.length > 0) {\n for (const l of [...completionListeners]) {\n try { l(data.completions); } catch { /* a listener must not stop the loop */ }\n }\n }\n } catch (err) {\n if (err instanceof ApiError && err.status === 404) {\n emit({ status: 'unavailable', data: null, updatedAt: snapshot.updatedAt });\n } else if (err instanceof ApiError && err.status === 400 && cursor) {\n // A cursor the server no longer accepts: start over rather than stall.\n cursor = null;\n emit({ ...snapshot, status: snapshot.data ? 'stale' : 'loading' });\n } else {\n emit({ ...snapshot, status: snapshot.data ? 'stale' : 'unavailable' });\n }\n } finally {\n inFlight = null;\n schedule();\n }\n })();\n return inFlight;\n}\n\nfunction onVisibility(): void {\n // Back in view: catch up now rather than up to 30 s late.\n if (!hidden() && subscribers > 0) void refreshActivity();\n else schedule();\n}\n\nfunction start(): void {\n subscribers += 1;\n if (subscribers === 1) {\n if (typeof document !== 'undefined') document.addEventListener('visibilitychange', onVisibility);\n void refreshActivity();\n }\n}\n\nfunction stop(): void {\n subscribers = Math.max(0, subscribers - 1);\n if (subscribers > 0) return;\n if (timer) clearTimeout(timer);\n timer = null;\n if (typeof document !== 'undefined') document.removeEventListener('visibilitychange', onVisibility);\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener);\n start();\n return () => {\n listeners.delete(listener);\n stop();\n };\n}\n\nexport function getActivityState(): ActivityState {\n return snapshot;\n}\n\n/** The shell's activity. Subscribing starts the poll; the last unsubscribe stops it. */\nexport function useActivity(): ActivityState {\n return useSyncExternalStore(subscribe, getActivityState, getActivityState);\n}\n\n/** Each batch of newly finished turns, exactly once. Returns the unsubscribe. */\nexport function onActivityCompletions(listener: (batch: VerseActivityCompletion[]) => void): () => void {\n completionListeners.add(listener);\n return () => completionListeners.delete(listener);\n}\n\n/** Test seam: inject the fetch, clear state (and any timer). */\nexport function resetActivityForTest(next?: Fetcher): void {\n if (timer) clearTimeout(timer);\n timer = null;\n inFlight = null;\n cursor = null;\n subscribers = 0;\n listeners.clear();\n completionListeners.clear();\n fetcher = next ?? ((path, signal) => apiGet<VerseActivityResponse>(path, signal));\n snapshot = { status: 'idle', data: null, updatedAt: null };\n}\n"],"mappings":"q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Q,cAAe,KAAM,KAAM,UAAW,EAAS,SAAU,CAAC,EAChE,aAAe,GAAY,EAAI,SAAW,KAAO,GAE1D,EAAS,KACT,EAAK,CAAE,GAAG,EAAU,OAAQ,EAAS,KAAO,QAAU,SAAU,CAAC,GAEjE,EAAK,CAAE,GAAG,EAAU,OAAQ,EAAS,KAAO,QAAU,aAAc,CAAC,CAEzE,QAAU,CACR,EAAW,KACX,EAAS,CACX,CACF,EAAA,CAAG,EACI,CACT,CAEA,SAAS,GAAqB,CAExB,CAAC,EAAO,GAAK,EAAc,EAAG,EAAqB,EAClD,EAAS,CAChB,CAEA,SAAS,GAAc,CACrB,GAAe,EACX,IAAgB,IACd,OAAO,SAAa,KAAa,SAAS,iBAAiB,mBAAoB,CAAY,EAC/F,EAAqB,EAEzB,CAEA,SAAS,GAAa,CACpB,EAAc,KAAK,IAAI,EAAG,EAAc,CAAC,EACrC,IAAc,KACd,GAAO,aAAa,CAAK,EAC7B,EAAQ,KACJ,OAAO,SAAa,KAAa,SAAS,oBAAoB,mBAAoB,CAAY,EACpG,CAEA,SAAS,EAAU,EAAkC,CAGnD,OAFA,EAAU,IAAI,CAAQ,EACtB,EAAM,MACO,CACX,EAAU,OAAO,CAAQ,EACzB,EAAK,CACP,CACF,CAEA,SAAgB,GAAkC,CAChD,OAAO,CACT,CAGA,SAAgB,GAA6B,CAC3C,OAAA,EAAO,EAAA,qBAAA,CAAqB,EAAW,EAAkB,CAAgB,CAC3E,CAGA,SAAgB,EAAsB,EAAkE,CAEtG,OADA,EAAoB,IAAI,CAAQ,MACnB,EAAoB,OAAO,CAAQ,CAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--chart-series-1:var(--data-cat-1);--chart-series-2:var(--data-cat-2);--chart-series-3:var(--data-cat-3);--chart-series-4:var(--data-cat-4);--chart-series-5:var(--data-cat-5);--chart-series-6:var(--data-cat-6);--chart-neutral:var(--status-neutral-solid);--chart-seq-1:var(--data-seq-1);--chart-seq-2:var(--data-seq-2);--chart-seq-3:var(--data-seq-3);--chart-seq-4:var(--data-seq-4);--chart-seq-5:var(--data-seq-5);--chart-seq-6:var(--data-seq-6);--chart-seq-7:var(--data-seq-7);--chart-sequential:var(--chart-seq-5);--chart-sequential-soft:var(--chart-seq-3);--chart-diverging-pos:var(--chart-seq-5);--chart-diverging-neg:var(--status-danger-solid);--chart-diverging-mid:var(--border-strong);--chart-unknown:var(--status-unknown-solid);--chart-unknown-hatch:repeating-linear-gradient(135deg, var(--chart-unknown) 0 1px, transparent 1px 5px);--chart-queued-outline:var(--status-neutral-solid);--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);--chart-heat-0:var(--chart-grid);--chart-heat-1:var(--chart-seq-2);--chart-heat-2:var(--chart-seq-3);--chart-heat-3:var(--chart-seq-5);--chart-heat-4:var(--chart-seq-7);--chart-track:var(--chart-seq-1);--chart-quantity-ink:var(--gray-950)}._table_x2yvy_1{border-collapse:collapse;width:100%;font-size:var(--text-xs-size)}._table_x2yvy_1 th,._table_x2yvy_1 td{text-align:left;padding:var(--space-1) var(--space-2);border-bottom:1px solid var(--border-subtle)}._table_x2yvy_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_x2yvy_22{text-align:right;font-variant-numeric:tabular-nums}._empty_x2yvy_27{color:var(--text-tertiary);text-align:center}._plotWrap_11912_3{width:100%;min-width:0;position:relative}._svg_11912_9{max-width:100%;display:block;overflow:visible}._grid_11912_15{stroke:var(--chart-grid);stroke-width:1px;shape-rendering:crispedges}._axis_11912_21{stroke:var(--chart-axis);stroke-width:1px;shape-rendering:crispedges}._tick_11912_27{font-family:var(--font-ui);font-size:var(--text-xs-size);fill:var(--text-tertiary);font-variant-numeric:tabular-nums}._label_11912_34{font-family:var(--font-ui);font-size:var(--text-xs-size);fill:var(--text-secondary)}._labelStrong_11912_40{font-family:var(--font-ui);font-size:var(--text-xs-size);font-weight:var(--font-weight-medium);fill:var(--text-primary)}._line_11912_47{fill:none;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}._wash_11912_54{stroke:none;opacity:.1}._reference_11912_59{fill:none;stroke:var(--text-tertiary);stroke-width:1px;stroke-dasharray:4 3}._projection_11912_66{fill:none;stroke-width:2px;stroke-dasharray:5 4;stroke-linecap:round}._marker_11912_73{stroke:var(--chart-surface);stroke-width:2px}._crosshair_11912_78{stroke:var(--chart-axis);stroke-width:1px;pointer-events:none}._hit_11912_84{fill:#0000;cursor:default}._hit_11912_84:focus{outline:none}._hit_11912_84:focus-visible{stroke:var(--border-focus);stroke-width:2px}._focusable_11912_98:focus{outline:none}._focusable_11912_98:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;border-radius:var(--radius-sm)}._track_11912_108{fill:var(--chart-track)}._trackEmpty_11912_122{fill:var(--meter-track)}._noData_11912_126{fill:none;stroke:var(--chart-grid);stroke-width:1px;stroke-dasharray:2 2}._tooltip_11912_133{z-index:var(--z-dropdown);pointer-events:none;padding:var(--space-2);border:1px solid var(--chart-tooltip-border);border-radius:var(--radius-sm);background:var(--chart-tooltip-bg);box-shadow:var(--shadow-md);color:var(--text-primary);font-size:var(--text-xs-size);white-space:nowrap;position:absolute;transform:translate(-50%,calc(-100% - 8px))}._tooltipTitle_11912_148{color:var(--text-tertiary);margin-bottom:var(--space-1)}._tooltipRow_11912_153{align-items:center;gap:var(--space-2);display:flex}._tooltipKey_11912_159{border-radius:2px;flex:none;width:8px;height:8px}._tooltipValue_11912_166{padding-left:var(--space-3);font-weight:var(--font-weight-semibold);font-variant-numeric:tabular-nums;margin-left:auto}._tooltipMuted_11912_173{color:var(--text-tertiary);font-style:italic}._legend_11912_178{gap:var(--space-1) var(--space-3);margin:var(--space-2) 0 0;font-size:var(--text-xs-size);color:var(--text-secondary);flex-wrap:wrap;padding:0;list-style:none;display:flex}._legendItem_11912_189{align-items:center;gap:var(--space-1);display:inline-flex}._swatch_11912_195{border-radius:2px;flex:none;width:10px;height:10px}._swatchLine_11912_202{flex:none;width:12px;height:2px}._swatchEmpty_11912_208{border:1px dashed var(--chart-axis);border-radius:2px;flex:none;width:10px;height:10px}._note_11912_216{margin:var(--space-2) 0 0;font-size:var(--text-xs-size);color:var(--text-tertiary)}._srOnly_11912_222{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:no-preference){._animated_11912_235{transition:opacity .12s}}._monogram_11912_241{font-family:var(--font-display);font-size:var(--text-2xs-size);font-weight:var(--font-weight-semibold);fill:var(--text-secondary)}._unknownMark_11912_249{stroke:var(--chart-unknown);stroke-width:1px}._swatchHatch_11912_255{border:1px solid var(--chart-unknown);background:var(--chart-unknown-hatch);border-radius:2px;flex:none;width:10px;height:10px}._halo_11912_266{paint-order:stroke;stroke:var(--chart-surface);stroke-width:3px;stroke-linejoin:round}._frame_it6x9_1{border:1px solid var(--border-subtle);border-radius:var(--radius-lg);background:var(--bg-surface);min-width:0;padding:var(--card-pad,var(--space-4));margin:0}._header_it6x9_11{justify-content:space-between;align-items:flex-start;gap:var(--space-3);margin-bottom:var(--space-3);flex-wrap:wrap;display:flex}._actions_it6x9_20{align-items:center;gap:var(--space-2);flex:none;margin-left:auto;display:inline-flex}._menuWrap_it6x9_28{display:inline-flex;position:relative}._more_it6x9_34{width:calc(var(--control-h-xs,20px) + 4px);height:calc(var(--control-h-xs,20px) + 4px);border-radius:var(--radius-sm);color:var(--text-tertiary);cursor:pointer;transition:background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);background:0 0;border:1px solid #0000;justify-content:center;align-items:center;padding:0;display:inline-flex}._more_it6x9_34:hover,._more_it6x9_34[aria-expanded=true]{background:var(--bg-hover);color:var(--text-primary)}._more_it6x9_34:focus-visible{outline:2px solid var(--border-focus);outline-offset:1px}._menu_it6x9_28{top:calc(100% + var(--space-1));z-index:var(--z-dropdown);min-width:176px;padding:var(--space-1);border:1px solid var(--border-default);border-radius:var(--radius-md);background:var(--bg-surface-raised);box-shadow:var(--shadow-menu);flex-direction:column;display:flex;position:absolute;right:0}._menuItem_it6x9_75{align-items:center;gap:var(--space-2);padding:var(--space-1) var(--space-2);border-radius:var(--radius-sm);color:var(--text-primary);font:inherit;font-size:var(--text-xs-size);line-height:var(--text-xs-line);text-align:left;cursor:pointer;background:0 0;border:0;display:flex}._menuItem_it6x9_75:hover,._menuItem_it6x9_75:focus-visible{background:var(--bg-hover);outline:none}._check_it6x9_97{width:1em;color:var(--text-secondary)}._hint_it6x9_102{padding:0 var(--space-1);border:1px solid var(--border-subtle);border-radius:var(--radius-xs,3px);color:var(--text-tertiary);font-family:var(--font-mono);font-size:var(--text-2xs-size);margin-left:auto}._heading_it6x9_112{flex-direction:column;gap:2px;min-width:0;display:flex}._title_it6x9_119{font-size:var(--text-sm-size);font-weight:var(--font-weight-semibold);color:var(--text-primary)}._description_it6x9_125{font-size:var(--text-xs-size);color:var(--text-tertiary)}._plot_it6x9_130{width:100%;min-width:0;position:relative}._table_it6x9_136{max-height:360px;overflow:auto}._caveat_it6x9_141{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)}._state_it6x9_151{padding:var(--space-6) var(--space-3);text-align:center;color:var(--text-tertiary);font-size:var(--text-sm-size);margin:0}._dark_it6x9_159{gap:var(--space-1);flex-direction:column;align-items:center;display:flex}._darkTitle_it6x9_166{color:var(--text-secondary);font-weight:var(--font-weight-semibold);margin:0}._darkBody_it6x9_172{font-size:var(--text-xs-size);max-width:44ch;margin:0}._unknown_it6x9_178{color:var(--status-unknown-fg)}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,s as n}from"./index-oAAq8XJa.js";import{d as r,f as i}from"./colors-BZ3a9wFf.js";import{a,c as o,n as s}from"./format-DKrNjdwD.js";var c=n(e(),1),l=t();function u(e,t,n=4,r={}){if(!Number.isFinite(e)||!Number.isFinite(t))return[0];if(t<e&&([e,t]=[t,e]),t===e){if(t===0)return[0,1];let i=Math.abs(t)*.5;return u(Math.min(0,e-i),t+i,n,r)}let i=(t-e)/Math.max(1,n),a=10**Math.floor(Math.log10(i)),o=i/a,s=(o<=1?1:o<=2?2:o<=2.5?a>=10?2.5:2:o<=5?5:10)*a;r.integer&&s<1&&(s=1),r.minStep!==void 0&&Number.isFinite(r.minStep)&&s<r.minStep&&(s=r.minStep);let c=Math.floor(e/s)*s,l=Math.ceil(t/s)*s,d=Math.round((l-c)/s),f=Math.max(0,-Math.floor(Math.log10(s))+1),p=[];for(let e=0;e<=d;e++)p.push(Number((c+e*s).toFixed(f))||0);return p}function d(e){return e.every(e=>Number.isInteger(e))}function f(e,t){return new Set(t).size===t.length&&e.every((e,n)=>{if(e===0)return!0;let r=/\d[\d,]*(?:\.\d+)?/.exec(t[n]??``);if(!r)return!0;let i=Number(r[0].replace(/,/g,``));if(!Number.isFinite(i)||i===0)return!1;let a=i/Math.abs(e),o=10**Math.round(Math.log10(a));return Math.abs(a/o-1)<1e-6})}function p(e,t,n={}){let r=Math.max(1,n.count??4),i=n.integer===!0,s=n.format,c=(n,r,i)=>{let c=u(e,t,n,{integer:r,minStep:i}),l=c.length>1?c[1]-c[0]:1;if(s)return{ticks:c,labels:c.map(e=>s(e)),step:l};let d=o(c,l);return{ticks:c,labels:c.map(e=>a(e,l,d)),step:l}},l=c(r,i);if(!n.format||f(l.ticks,l.labels)||!Number.isFinite(e)||!Number.isFinite(t)||!(l.step>0))return l;let d=(e,t)=>{for(let n=r;n>=1;n--){let r=c(n,e,t);if(f(r.ticks,r.labels))return r}return null},p=d(i);if(p)return p;let m=Math.max(Math.abs(e),Math.abs(t),1);for(let e=Math.floor(Math.log10(l.step))+1;10**e<=m*10;e++){let t=d(i,Number((10**e).toPrecision(1)));if(t)return t}return d(!0)??l}function m(e){let t=t=>{let n=e(t).trim();if(!n.endsWith(`%`))return null;let r=Number(n.slice(0,-1).replace(/[,\s+]/g,``));return Number.isFinite(r)?r:null};return t(50)===50?100:t(.5)===50?1:null}function h(e){return Number.isFinite(e)&&e>=9466848e5}function g(e){return e.some(h)}function _(e){return g(e)?h:Number.isFinite}var ee=6e5;function te(e,t,n,r=`center`){if(t<e&&([e,t]=[t,e]),t-e>=n)return[e,t];if(r===`end`)return[t-n,t];let i=(e+t)/2;return[i-n/2,i+n/2]}var v=12*.6;function y(e){return Number.isFinite(e)&&e>0?e:1}function b(e=1){return v*y(e)}function x(e,t=v){return e.length*t}var S=7;function C(e,t,n,r=1){let i=y(r),a=Math.max(0,...e.map(e=>e.length));return Math.min(n*i,Math.max(t,a*S*i+10))}function w(e,t,n){let r=n.gap??8,i=e.map((e,t)=>({s:e,i:t})).sort((e,t)=>t.s.priority-e.s.priority||e.i-t.i),a=[];for(let{s:e,i:o}of i){let i=e.variants[Math.min(t,e.variants.length-1)]??``;if(!i)continue;let s=x(i,n.charPx);if(s>n.max-n.min)continue;let c=e.anchor===`start`?e.x:e.anchor===`end`?e.x-s:e.x-s/2,l=e.x,u=e.anchor;c<n.min?(c=n.min,l=n.min,u=`start`):c+s>n.max&&(c=n.max-s,l=n.max,u=`end`);let d=c+s;a.some(e=>e.text===i||c<e.right+r&&e.left<d+r)||a.push({left:c,right:d,text:i,i:o,label:{key:e.key,text:i,x:l,anchor:u}})}return a.sort((e,t)=>e.i-t.i).map(e=>e.label)}function T(e,t){if(e.length===0)return[];let n=Math.max(1,...e.map(e=>e.variants.length)),r=new Set(e.filter(e=>e.required!==!1).map(e=>e.key)),i=[],a=-1;for(let o=0;o<n;o++){let n=w(e,o,t),s=n.filter(e=>r.has(e.key)).length;if(s>a&&(i=n,a=s),a===r.size)break}return i}function E(e,t,n,r){if(e.length===0)return new Map;if((e.length-1)*t>r-n+1e-9)return null;let i=e.map((e,t)=>({...e,i:t})).sort((e,t)=>e.y-t.y||e.i-t.i),a=e=>{let i=e.reduce((e,t)=>e+t.y,0)/e.length,a=(e.length-1)*t;return{members:e,top:D(i-a/2,n,r-a)}},o=i.map(e=>a([e]));for(let e=!0;e;){e=!1;for(let n=0;n+1<o.length;n++){let r=o[n],i=o[n+1];if(r.top+r.members.length*t>i.top+1e-9){o=[...o.slice(0,n),a([...r.members,...i.members]),...o.slice(n+2)],e=!0;break}}}let s=new Map;for(let e of o)e.members.forEach((n,r)=>s.set(n.key,e.top+r*t));return s}function ne(e,t,n,r){let i=t-e;return i===0?()=>(n+r)/2:t=>n+(t-e)/i*(r-n)}function re(e,t){if(e<=0)return[];if(t<=1)return[e-1];if(e<=t)return Array.from({length:e},(e,t)=>t);let n=Math.ceil((e-1)/(t-1)),r=[];for(let t=e-1;t>=0;t-=n)r.push(t);return r.reverse()}function D(e,t,n){return Math.min(n,Math.max(t,e))}function ie(e){let t=[],n=[];for(let r of e){if(r.y===null||!Number.isFinite(r.y)){n.length&&t.push(n),n=[];continue}n.push({x:r.x,y:r.y})}return n.length&&t.push(n),t}function O(e){return e.map((e,t)=>`${t===0?`M`:`L`}${A(e.x)},${A(e.y)}`).join(` `)}function k(e,t){if(e.length===0)return``;let n=[...t].reverse();return`${O(e)} ${n.map(e=>`L${A(e.x)},${A(e.y)}`).join(` `)} Z`}function A(e){return Math.round(e*10)/10}function j(e){let t=0,n=!1,r=0,i=[];return e.forEach((e,a)=>{if(e===null||!Number.isFinite(e)){n=!0;return}r++;let o=Math.max(0,e);o>0&&i.push({index:a,value:o,y0:t,y1:t+o}),t+=o}),{segments:i,total:t,incomplete:n,unknown:r===0&&e.length>0}}function M(e,t,n,r,i=4){if(r<=0||n<=0)return``;let a=Math.max(0,Math.min(i,n/2,r));return[`M${A(e)},${A(t+r)}`,`L${A(e)},${A(t+a)}`,`Q${A(e)},${A(t)} ${A(e+a)},${A(t)}`,`L${A(e+n-a)},${A(t)}`,`Q${A(e+n)},${A(t)} ${A(e+n)},${A(t+a)}`,`L${A(e+n)},${A(t+r)}`,`Z`].join(` `)}function N(e,t,n,r,i=4){if(r<=0||n<=0)return``;let a=Math.max(0,Math.min(i,r/2,n));return[`M${A(e)},${A(t)}`,`L${A(e+n-a)},${A(t)}`,`Q${A(e+n)},${A(t)} ${A(e+n)},${A(t+a)}`,`L${A(e+n)},${A(t+r-a)}`,`Q${A(e+n)},${A(t+r)} ${A(e+n-a)},${A(t+r)}`,`L${A(e)},${A(t+r)}`,`Z`].join(` `)}function P(e){let t=e[0]??null;return e.map((n,r)=>{let i=r>0?e[r-1]??null:null;return{value:n,ofFirst:n!==null&&t!==null&&t>0?n/t:null,ofPrevious:r>0&&n!==null&&i!==null&&i>0?n/i:null}})}var F=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function I(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let t=Date.parse(`${e}T00:00:00Z`);return Number.isFinite(t)&&new Date(t).toISOString().slice(0,10)===e?t:null}function L(e,t=1){let n=new Map,r=1/0,i=-1/0;for(let t of e){let e=I(t.day);e===null||e<9466848e5||(n.set(t.day,t.value),r=Math.min(r,e),i=Math.max(i,e))}if(!Number.isFinite(r))return{cells:[],weeks:0,months:[]};let a=864e5,o=(new Date(r).getUTCDay()-t+7)%7,s=r-o*a,c=(new Date(i).getUTCDay()-t+7)%7,l=i+(6-c)*a,u=[],d=[],f=-1;for(let e=s,t=0;e<=l;e+=a,t++){let a=new Date(e).toISOString().slice(0,10),o=Math.floor(t/7),s=t%7,c=e<r||e>i;u.push({day:a,value:c?null:n.has(a)?n.get(a):null,week:o,weekday:s,outside:c});let l=new Date(e).getUTCMonth();!c&&l!==f&&(d.push({week:o,label:F[l]}),f=l)}return{cells:u,weeks:Math.floor((l-s)/a/7)+1,months:d}}function R(e,t,n=4){return e===null||!Number.isFinite(e)?null:e<=0||t<=0?0:D(Math.ceil(e/t*n),1,n)}function z(e,t,n={}){let r=t!==null&&Number.isFinite(t)?t:null,i=e.filter(e=>e.remaining!==null&&Number.isFinite(e.remaining)&&Number.isFinite(e.t)).sort((e,t)=>e.t-t.t),a=i.length?i[i.length-1]:null,o=i.slice(-(n.window??6));if(!a||o.length<2)return{slopePerMs:null,exhaustAt:null,reserveAt:null,remainingAtReset:null,from:a};let s=o.length,c=o.reduce((e,t)=>e+t.t,0)/s,l=o.reduce((e,t)=>e+t.remaining,0)/s,u=0,d=0;for(let e of o)u+=(e.t-c)*(e.remaining-l),d+=(e.t-c)**2;let f=d===0?0:u/d,p=e=>{if(a.remaining<=e)return a.t;if(f>=0||r===null)return null;let t=a.t+(e-a.remaining)/f;return t<=r?t:null},m=n.reserve??null;return{slopePerMs:f,exhaustAt:p(0),reserveAt:m===null?null:p(m),remainingAtReset:r===null?null:Math.max(0,a.remaining+f*Math.max(0,r-a.t)),from:a}}function B(e,t,n,r){return{x:e+n*Math.cos(r),y:t-n*Math.sin(r)}}function V(e,t,n,r,i){let a=D(r,0,1),o=D(i,0,1);if(o<=a)return``;let s=B(e,t,n,Math.PI*(1-a)),c=B(e,t,n,Math.PI*(1-o));return`M${A(s.x)},${A(s.y)} A${n},${n} 0 0 1 ${A(c.x)},${A(c.y)}`}function H(e,t,n){return e===null||!Number.isFinite(e)?`unknown`:e>=n?`danger`:e>=t?`warn`:`ok`}function U(e=typeof document>`u`?null:document.documentElement){return!e||typeof getComputedStyle!=`function`?1:y(Number.parseFloat(getComputedStyle(e).getPropertyValue(`--ui-text-scale`)))}var W=new Set,G=null,K=null;function q(){let e=U();if(e!==G){G=e;for(let e of W)e()}}function J(){G=U();let e=document.documentElement,t=typeof MutationObserver>`u`?null:new MutationObserver(q);t?.observe(e,{attributes:!0,attributeFilter:[`data-ui-scale`,`style`]});let n=typeof requestAnimationFrame==`function`,r=0,i=()=>{if(!n)return q();cancelAnimationFrame(r),r=requestAnimationFrame(q)};return window.addEventListener(`resize`,i),()=>{t?.disconnect(),n&&cancelAnimationFrame(r),window.removeEventListener(`resize`,i)}}function ae(e){return W.add(e),W.size===1&&typeof document<`u`&&(K=J()),()=>{W.delete(e),!(W.size>0)&&(K?.(),K=null,G=null)}}function oe(){return G??U()}function se(){return(0,c.useSyncExternalStore)(ae,oe,()=>1)}var Y={table:`_table_x2yvy_1`,numeric:`_numeric_x2yvy_22`,empty:`_empty_x2yvy_27`};function ce({caption:e,columns:t,rows:n,rowKey:r,emptyMessage:i=`No rows.`}){return(0,l.jsxs)(`table`,{className:Y.table,children:[(0,l.jsx)(`caption`,{className:`visually-hidden`,children:e}),(0,l.jsx)(`thead`,{children:(0,l.jsx)(`tr`,{children:t.map(e=>(0,l.jsx)(`th`,{scope:`col`,className:e.numeric?Y.numeric:void 0,children:e.label},e.key))})}),(0,l.jsxs)(`tbody`,{children:[n.length===0?(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:Math.max(1,t.length),className:Y.empty,children:i})}):null,n.map((e,n)=>(0,l.jsx)(`tr`,{children:t.map(t=>(0,l.jsx)(`td`,{className:t.numeric?Y.numeric:void 0,children:t.render(e)},t.key))},r(e,n)))]})]})}var X={plotWrap:`_plotWrap_11912_3`,svg:`_svg_11912_9`,grid:`_grid_11912_15`,axis:`_axis_11912_21`,tick:`_tick_11912_27`,label:`_label_11912_34`,labelStrong:`_labelStrong_11912_40`,line:`_line_11912_47`,wash:`_wash_11912_54`,reference:`_reference_11912_59`,projection:`_projection_11912_66`,marker:`_marker_11912_73`,crosshair:`_crosshair_11912_78`,hit:`_hit_11912_84`,focusable:`_focusable_11912_98`,track:`_track_11912_108`,trackEmpty:`_trackEmpty_11912_122`,noData:`_noData_11912_126`,tooltip:`_tooltip_11912_133`,tooltipTitle:`_tooltipTitle_11912_148`,tooltipRow:`_tooltipRow_11912_153`,tooltipKey:`_tooltipKey_11912_159`,tooltipValue:`_tooltipValue_11912_166`,tooltipMuted:`_tooltipMuted_11912_173`,legend:`_legend_11912_178`,legendItem:`_legendItem_11912_189`,swatch:`_swatch_11912_195`,swatchLine:`_swatchLine_11912_202`,swatchEmpty:`_swatchEmpty_11912_208`,note:`_note_11912_216`,srOnly:`_srOnly_11912_222`,animated:`_animated_11912_235`,monogram:`_monogram_11912_241`,unknownMark:`_unknownMark_11912_249`,swatchHatch:`_swatchHatch_11912_255`,halo:`_halo_11912_266`};function le({items:e,min:t=2}){return e.length<t?null:(0,l.jsx)(`ul`,{className:X.legend,children:e.map(e=>(0,l.jsxs)(`li`,{className:X.legendItem,children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,className:e.kind===`line`?X.swatchLine:e.kind===`empty`?X.swatchEmpty:e.kind===`hatch`?X.swatchHatch:X.swatch,style:e.kind===`empty`||e.kind===`hatch`?void 0:{background:e.color}}),e.label]},e.label))})}function ue({left:e,top:t,title:n,rows:r}){return(0,l.jsxs)(`div`,{className:X.tooltip,style:{left:e,top:t},role:`presentation`,children:[(0,l.jsx)(`div`,{className:X.tooltipTitle,children:n}),r.map(e=>(0,l.jsxs)(`div`,{className:X.tooltipRow,children:[e.color?(0,l.jsx)(`span`,{className:X.tooltipKey,style:{background:e.color},"aria-hidden":`true`}):null,(0,l.jsx)(`span`,{children:e.label}),e.value===null?(0,l.jsx)(`span`,{className:`${X.tooltipValue} ${X.tooltipMuted}`,children:`no data`}):(0,l.jsx)(`span`,{className:X.tooltipValue,children:e.value})]},e.key))]})}function de(e,t,n=70){return Math.min(Math.max(e,Math.min(n,t/2)),Math.max(t-n,t/2))}function fe({id:e}){let{size:t,angle:n,strokeWidth:i,stroke:a}=r;return(0,l.jsx)(`pattern`,{id:e,width:t,height:t,patternUnits:`userSpaceOnUse`,patternTransform:`rotate(${n})`,children:(0,l.jsx)(`line`,{x1:0,y1:0,x2:0,y2:t,stroke:a,strokeWidth:i})})}var pe={claude:`C`,codex:`X`,grok:`G`,local:`L`};function me({engine:e,x:t,y:n,height:r}){return(0,l.jsxs)(`g`,{"data-engine":e,"aria-hidden":`true`,children:[(0,l.jsx)(`rect`,{x:t,y:n,width:2,height:r,rx:1,fill:i(e)}),(0,l.jsx)(`text`,{className:X.monogram,x:t+6,y:n+r/2,dy:`0.34em`,children:pe[e]})]})}function he(){return(0,l.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,"aria-hidden":`true`,focusable:`false`,children:[(0,l.jsx)(`circle`,{cx:3.5,cy:8,r:1.4,fill:`currentColor`}),(0,l.jsx)(`circle`,{cx:8,cy:8,r:1.4,fill:`currentColor`}),(0,l.jsx)(`circle`,{cx:12.5,cy:8,r:1.4,fill:`currentColor`})]})}var Z={frame:`_frame_it6x9_1`,header:`_header_it6x9_11`,actions:`_actions_it6x9_20`,menuWrap:`_menuWrap_it6x9_28`,more:`_more_it6x9_34`,menu:`_menu_it6x9_28`,menuItem:`_menuItem_it6x9_75`,check:`_check_it6x9_97`,hint:`_hint_it6x9_102`,heading:`_heading_it6x9_112`,title:`_title_it6x9_119`,description:`_description_it6x9_125`,plot:`_plot_it6x9_130`,table:`_table_it6x9_136`,caveat:`_caveat_it6x9_141`,state:`_state_it6x9_151`,dark:`_dark_it6x9_159`,darkTitle:`_darkTitle_it6x9_166`,darkBody:`_darkBody_it6x9_172`,unknown:`_unknown_it6x9_178`};function ge(e){return s(e.slice(0,10))}function _e({status:e}){switch(e.kind){case`loading`:return(0,l.jsx)(`p`,{className:Z.state,"aria-busy":`true`,children:`Loading…`});case`empty`:return(0,l.jsx)(`p`,{className:Z.state,children:e.message??`Nothing happened in this window.`});case`dark`:return(0,l.jsxs)(`div`,{className:`${Z.state} ${Z.dark}`,children:[(0,l.jsxs)(`p`,{className:Z.darkTitle,children:[e.subject??`Fleet`,` dark since `,ge(e.since)]}),(0,l.jsx)(`p`,{className:Z.darkBody,children:e.detail??`No runs or proposals have been recorded since then.`})]});case`unknown`:return(0,l.jsxs)(`p`,{className:`${Z.state} ${Z.unknown}`,role:`note`,children:[`Unknown — `,e.reason??`the data source could not be read.`,` Nothing is shown rather than a guess.`]})}}function Q(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable}var $=[{view:`chart`,label:`Show as chart`,hint:null},{view:`table`,label:`Show as table`,hint:`T`}];function ve({title:e,view:t,onPick:n}){let[r,i]=(0,c.useState)(!1),[a,o]=(0,c.useState)(0),s=(0,c.useRef)(null),u=(0,c.useRef)(null),d=(0,c.useId)(),f=(0,c.useCallback)(e=>{i(!1),e&&s.current?.focus()},[]);(0,c.useEffect)(()=>{if(!r)return;let e=e=>{let t=e.target;t&&(u.current?.contains(t)||s.current?.contains(t))||i(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),(0,c.useEffect)(()=>{r&&u.current?.querySelectorAll(`[role="menuitemradio"]`)[a]?.focus()},[r,a]);function p(e){o(e),i(!0)}function m(e){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),p(e.key===`ArrowUp`?$.length-1:0))}function h(e){e.key===`ArrowDown`?(e.preventDefault(),o(e=>(e+1)%$.length)):e.key===`ArrowUp`?(e.preventDefault(),o(e=>(e-1+$.length)%$.length)):e.key===`Home`?(e.preventDefault(),o(0)):e.key===`End`?(e.preventDefault(),o($.length-1)):e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f(!0)):e.key===`Tab`&&f(!1)}return(0,l.jsxs)(`span`,{className:Z.menuWrap,children:[(0,l.jsx)(`button`,{ref:s,type:`button`,className:Z.more,"aria-label":`${e}: view options`,"aria-haspopup":`menu`,"aria-expanded":r,"aria-controls":r?d:void 0,title:`View options (T toggles the table)`,onClick:()=>r?f(!1):p(Math.max(0,$.findIndex(e=>e.view===t))),onKeyDown:m,children:(0,l.jsx)(he,{})}),r?(0,l.jsx)(`div`,{ref:u,id:d,role:`menu`,"aria-label":`${e} view`,className:Z.menu,onKeyDown:h,children:$.map((e,r)=>(0,l.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":t===e.view,tabIndex:r===a?0:-1,className:Z.menuItem,onClick:()=>{n(e.view),f(!0)},children:[(0,l.jsx)(`span`,{className:Z.check,"aria-hidden":`true`,children:t===e.view?`✓`:``}),(0,l.jsx)(`span`,{children:e.label}),e.hint?(0,l.jsx)(`kbd`,{className:Z.hint,children:e.hint}):null]},e.view))}):null]})}function ye({title:e,description:t,caveat:n,status:r={kind:`ready`},defaultView:i=`chart`,hideToggle:a=!1,actions:o,children:s,table:u,footer:d}){let[f,p]=(0,c.useState)(i),m=(0,c.useId)(),h=r.kind===`ready`,g=h&&!a;function _(e){g&&!e.defaultPrevented&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`t`||Q(e.target)||(e.preventDefault(),p(e=>e===`chart`?`table`:`chart`)))}return(0,l.jsxs)(`figure`,{className:Z.frame,"aria-labelledby":m,"data-chart-card":``,"data-view":f,onKeyDown:_,children:[(0,l.jsxs)(`figcaption`,{className:Z.header,children:[(0,l.jsxs)(`span`,{className:Z.heading,children:[(0,l.jsx)(`span`,{id:m,className:Z.title,children:e}),t?(0,l.jsx)(`span`,{className:Z.description,children:t}):null]}),o||g?(0,l.jsxs)(`span`,{className:Z.actions,children:[o,g?(0,l.jsx)(ve,{title:e,view:f,onPick:p}):null]}):null]}),n?(0,l.jsx)(`p`,{className:Z.caveat,role:`note`,children:n}):null,h?f===`table`?(0,l.jsx)(`div`,{className:Z.table,children:u}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:Z.plot,children:s}),d]}):(0,l.jsx)(_e,{status:r})]})}function be(e,t,n=640){let[r,i]=(0,c.useState)(null),[a,o]=(0,c.useState)(null);return(0,c.useLayoutEffect)(()=>{e.current!==a&&o(e.current)}),(0,c.useLayoutEffect)(()=>{if(t!==void 0)return;let e=a;if(!e)return;let n=()=>{let t=Math.floor(e.getBoundingClientRect().width);t>0&&i(e=>e===t?e:t)};if(n(),typeof ResizeObserver>`u`)return;let r=0,o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=requestAnimationFrame(n)});return o.observe(e),()=>{cancelAnimationFrame(r),o.disconnect()}},[a,t]),Math.max(280,t??r??n)}export{B as A,g as C,ne as D,O as E,j as F,re as I,C as L,N as M,M as N,u as O,ie as P,_ as R,h as S,T,te as _,me as a,H as b,X as c,ee as d,d as f,E as g,L as h,ue as i,z as j,m as k,ce as l,p as m,ye as n,fe as o,k as p,le as r,de as s,be as t,se as u,P as v,b as w,R as x,V as y};
|
|
2
|
-
//# sourceMappingURL=useChartWidth-lZ9PrQn0.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./index-oAAq8XJa.js";import{K as t,W as n,q as r,tt as i}from"./global-Di2PUgj4.js";import{t as a}from"./VerseConsoleApp-WVeyJnW7.js";var o=e({CODEX_EXPANSIVE_METERING_NOTE:()=>y,ENGINE_LABEL:()=>c,ENGINE_ORDER:()=>s,SEAT_CAPACITY_WORD:()=>S,WINDOW_SOURCE_TEXT:()=>_,firstRunnableModel:()=>b,formatDuration:()=>k,formatElapsed:()=>O,formatRelative:()=>A,groupSeats:()=>E,groupSessions:()=>D,isAbsolutePath:()=>P,isVerseEngine:()=>l,modelLabel:()=>p,modelOptionFor:()=>m,prettyJson:()=>N,projectName:()=>u,seatById:()=>d,seatCapacity:()=>T,seatLabel:()=>f,seatPillLabel:()=>F,seatUnavailableReason:()=>x,seatWindowLabel:()=>w,sessionContextBudget:()=>g,summarizeToolInput:()=>j,truncate:()=>M,windowSourceText:()=>v}),s=[`claude`,`codex`,`grok`,`local`],c={claude:`Claude`,codex:`Codex`,grok:`Grok`,local:`Local`};function l(e){return s.includes(e)}function u(e,t=[]){let n=t.find(t=>t.path===e);return n?n.name:e.split(/[\\/]/).filter(Boolean).at(-1)??e}function d(e,t){return e.find(e=>e.id===t)}function f(e,t){return d(e,t.seatId)?.label??c[t.engine]}function p(e,t){return d(e,t.seatId)?.models.find(e=>e.id===t.model)?.label??t.model}function m(e,n){let r=d(e,n.seatId);if(!r)return null;let i=r.models.find(e=>e.id===n.model);if(i)return i;let a=t(n.model);return r.models.find(e=>t(e.id)===a)??null}function h(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}function g(e,t){let a=t.usage,o=t.contextMode??`standard`,s=m(e,t),c={contextTokens:typeof a.contextTokens==`number`&&Number.isFinite(a.contextTokens)?Math.max(0,a.contextTokens):0,exact:a.contextTokensExact!==!1,mode:o,option:s},l=n(s,o),u=h(a.contextWindow);if(u!==null&&(t.engine===`local`||a.contextWindowSource===`runtime`)){let e=h(a.autoCompactAt??null)??i({engine:t.engine,runtimeWindow:u,budget:t.engine===`local`?null:l,autocompactWindow:t.engine===`claude`?r(s,o):null,maxOutputTokens:s?.maxOutputTokens??null}),n=t.engine===`local`?a.contextWindowSource??null:`runtime`;return{...c,contextWindow:u,autoCompactAt:e,source:n}}if(l)return{...c,contextWindow:l.contextWindow,autoCompactAt:l.autoCompactAt,source:s?.windowSource??`fallback`};if(u!==null)return{...c,contextWindow:u,autoCompactAt:h(a.autoCompactAt??null),source:a.contextWindowSource??null};let f=h(d(e,t.seatId)?.contextWindow??null);return{...c,contextWindow:f,autoCompactAt:null,source:f===null?null:`fallback`}}var _={runtime:`reported by the CLI on the last turn`,"provider-catalog":`from this seat's own model catalog`,"cli-catalog":`from the pinned CLI's built-in model table`,documented:`from the provider's published model table`,fallback:`a default estimate — the CLI has not reported the real window yet`};function v(e,t){return t===`local`?`${e===`runtime`?`measured from the local model server`:e===`fallback`?`a default estimate — the model server did not report one`:_[e]}; Verse passes this window to Claude Code for this chat`:_[e]}var y=`OpenAI reportedly also counts requests above 272k tokens at about 2× against plan limits, so a turn near the expansive limit may cost roughly twice that.`;function b(e){return e.models.find(e=>!e.unavailableReason)??null}function x(e){return e.health.state===`unavailable`?e.health.summary??`seat unavailable`:null}var S={ready:`usable`,tight:`tight`,blocked:`blocked`,unread:`no reading`},C=85;function w(e){let t={five_hour:`5-hour window`,seven_day:`weekly window`,codex:`weekly window`};if(t[e])return t[e];let n=/^seven_day_(.+)$/.exec(e);return n?`weekly ${n[1].replace(/_/g,` `)} window`:`${e.replace(/_/g,` `)} window`}function T(e){let t=x(e);if(t!==null)return{cls:`blocked`,usedPercent:null,text:t};let n=e.health.windows.filter(e=>typeof e.usedPercent==`number`&&Number.isFinite(e.usedPercent));if(n.length===0)return{cls:`unread`,usedPercent:null,text:`no capacity reading`};let r=n.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e),i=Math.max(0,Math.min(100,r.usedPercent)),o=w(r.id);return i>=100?{cls:`blocked`,usedPercent:null,text:`${o} limit reached`}:{cls:i>=C?`tight`:`ready`,usedPercent:i,text:`${a(i)} of ${o} used`}}function E(e){return s.map(t=>({engine:t,seats:e.filter(e=>e.engine===t)})).filter(e=>e.seats.length>0)}function D(e,t,n=``){let r=n.trim().toLowerCase(),i=r?e.filter(e=>e.title.toLowerCase().includes(r)||e.projectPath.toLowerCase().includes(r)||e.model.toLowerCase().includes(r)||e.seatId.toLowerCase().includes(r)):[...e],a=new Map;for(let e of i){let t=a.get(e.projectPath)??[];t.push(e),a.set(e.projectPath,t)}let o=[];for(let[e,n]of a)n.sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)),o.push({projectPath:e,name:u(e,t),enrolled:t.find(t=>t.path===e)?.enrolled??!1,sessions:n});return o.sort((e,t)=>t.sessions[0].updatedAt.localeCompare(e.sessions[0].updatedAt)),o}function O(e){if(!Number.isFinite(e)||e<0)return`0s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function k(e){return!Number.isFinite(e)||e<0?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:O(e)}function A(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.round((t-n)/1e3);if(r<0||r<60)return`now`;let i=Math.floor(r/60);if(i<60)return`${i}m`;let a=Math.floor(i/60);if(a<24)return`${a}h`;let o=Math.floor(a/24);return o<7?`${o}d`:new Date(n).toLocaleDateString([],{month:`short`,day:`numeric`})}function j(e){if(e==null)return``;if(typeof e==`string`)return M(e,96);if(typeof e!=`object`)return M(String(e),96);let t=e;for(let e of[`command`,`cmd`,`file_path`,`path`,`pattern`,`query`,`url`,`description`,`prompt`,`text`]){let n=t[e];if(typeof n==`string`&&n.trim())return M(n.trim().replace(/\s+/g,` `),96)}let n=Object.keys(t);if(n.length===0)return``;let r=t[n[0]],i=typeof r==`string`?r:JSON.stringify(r);return M(`${n[0]}: ${i??``}`.replace(/\s+/g,` `),96)}function M(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function N(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function P(e){return/^(?:\/|~(?:\/|$)|[a-zA-Z]:[\\/]|\\\\)/.test(e)&&![...e].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)>=127&&e.charCodeAt(0)<=159)}function F(e,t){let n=f(e,t),r=p(e,t);return!r||n.toLowerCase().includes(r.toLowerCase())?n:`${n} · ${r}`}export{j as C,g as S,v as T,d as _,b as a,x as b,A as c,P as d,l as f,u as g,N as h,_ as i,E as l,m,c as n,k as o,p,S as r,O as s,y as t,D as u,T as v,o as w,w as x,F as y};
|
|
2
|
-
//# sourceMappingURL=verse-model-D7NZQFAR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verse-model-D7NZQFAR.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/verse-model.ts"],"sourcesContent":["/**\n * routes/verse/verse-model.ts — small pure helpers shared by the Verse\n * components (labels, grouping, health → tone). No React, no I/O.\n */\nimport type { VerseEngine, VerseModelOption, VerseProject, VerseSeat, VerseSeatHealth, VerseSession } from '../../data/api-types.js';\nimport type { VerseContextMode, VerseWindowSource } from '../../../core/verse/types.js';\nimport type { Tone } from '../../components/primitives/StatusBadge.js';\n// context-math is PURE and browser-safe by contract (its only import is\n// type-only), so a value import here does not drag node into the bundle.\nimport { budgetFor, canonicalModelId, claudeAutocompactFlag, reconcileAutoCompactAt } from '../../../core/verse/context-math.js';\nimport { usedPercentText } from './percent-text.js';\n\nexport const ENGINE_ORDER: readonly VerseEngine[] = ['claude', 'codex', 'grok', 'local'];\n\nexport const ENGINE_LABEL: Record<VerseEngine, string> = {\n claude: 'Claude',\n codex: 'Codex',\n grok: 'Grok',\n local: 'Local',\n};\n\nexport function isVerseEngine(value: string): value is VerseEngine {\n return (ENGINE_ORDER as readonly string[]).includes(value);\n}\n\nexport function projectName(path: string, projects: readonly VerseProject[] = []): string {\n const known = projects.find((p) => p.path === path);\n if (known) return known.name;\n return path.split(/[\\\\/]/).filter(Boolean).at(-1) ?? path;\n}\n\nexport function seatById(seats: readonly VerseSeat[], seatId: string): VerseSeat | undefined {\n return seats.find((s) => s.id === seatId);\n}\n\nexport function seatLabel(seats: readonly VerseSeat[], session: Pick<VerseSession, 'seatId' | 'engine'>): string {\n return seatById(seats, session.seatId)?.label ?? ENGINE_LABEL[session.engine];\n}\n\nexport function modelLabel(seats: readonly VerseSeat[], session: Pick<VerseSession, 'seatId' | 'model'>): string {\n const seat = seatById(seats, session.seatId);\n return seat?.models.find((m) => m.id === session.model)?.label ?? session.model;\n}\n\n/**\n * The seat's catalog entry for a session's model. Exact id first; then the\n * canonical form, because a session created before the alias fix stores\n * `claude-opus-5.5` while today's catalog lists `claude-opus-5-5` (context-math\n * `VERSE_MODEL_ID_ALIASES`) — the record keeps its id, the lookup must not miss.\n */\nexport function modelOptionFor(seats: readonly VerseSeat[], session: Pick<VerseSession, 'seatId' | 'model'>): VerseModelOption | null {\n const seat = seatById(seats, session.seatId);\n if (!seat) return null;\n const exact = seat.models.find((m) => m.id === session.model);\n if (exact) return exact;\n const canonical = canonicalModelId(session.model);\n return seat.models.find((m) => canonicalModelId(m.id) === canonical) ?? null;\n}\n\n/** Everything the meter, the composer's cost hint and the advice banners read. */\nexport interface SessionContextBudget {\n /** Live occupancy as stored — UNCLAMPED; only the drawing clamps. */\n contextTokens: number;\n contextWindow: number | null;\n autoCompactAt: number | null;\n /** False when `contextTokens` is an upper bound (codex before its rollout is read). */\n exact: boolean;\n /** Where `contextWindow` came from; null when nothing on the record says. */\n source: VerseWindowSource | null;\n mode: VerseContextMode;\n /** The catalog option the session's model maps to on its seat, when listed. */\n option: VerseModelOption | null;\n}\n\nfunction positive(value: number | null | undefined): number | null {\n return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null;\n}\n\n/**\n * The window a session is measured against, and where it compacts.\n *\n * Precedence (docs/VERSE-CONTEXT.md, \"honesty rules\"):\n *\n * 0. LOCAL — the window STORED on the record, whatever its source. Verse\n * SETS a local seat's window: the claude adapter passes the stored\n * `usage.contextWindow` as `CLAUDE_CODE_MAX_CONTEXT_TOKENS`, and the\n * engine refreshes that stored value from live discovery before each\n * turn. The seat's CURRENT option can differ (another dispatch lane,\n * another resident num_ctx), and drawing it measured the chat against a\n * window the CLI was never told — \"past the 66k window\" for a chat the\n * CLI compacts at 229k. The meter and the CLI must quote one number.\n * 1. RUNTIME — the CLI reported the window for this session's last turn\n * (`usage.contextWindowSource === 'runtime'`). Nothing outranks what the\n * CLI said it is actually running with (e.g. Claude Code clamping a 1M\n * model to 200k when long-context credit runs out).\n * 2. CATALOG — the seat's CURRENT option for the session's model, in the\n * session's mode. Current rather than stored so a corrected catalog (a\n * fixed window table, a mode switch) shows up without waiting for a turn.\n * 3. STORED — whatever the record carries (every pre-3.9 session).\n * 4. The seat's default window, marked `fallback`.\n *\n * A compaction point is only ever DERIVED from a window it belongs to: a\n * runtime window without a stored point is reconciled with context-math's\n * per-engine formula, never paired with a catalog point for another window.\n */\nexport function sessionContextBudget(\n seats: readonly VerseSeat[],\n session: Pick<VerseSession, 'seatId' | 'model' | 'usage' | 'engine' | 'contextMode'>,\n): SessionContextBudget {\n const usage = session.usage;\n // No UI-side legacy rule: the engine materialises a pre-3.9 Claude\n // record's mode (and its budget) on startup and on every touch, so every\n // record reaching the browser already names the mode it runs in.\n const mode: VerseContextMode = session.contextMode ?? 'standard';\n const option = modelOptionFor(seats, session);\n const base = {\n contextTokens: typeof usage.contextTokens === 'number' && Number.isFinite(usage.contextTokens) ? Math.max(0, usage.contextTokens) : 0,\n exact: usage.contextTokensExact !== false,\n mode,\n option,\n };\n const catalog = budgetFor(option, mode);\n\n const stored = positive(usage.contextWindow);\n if (stored !== null && (session.engine === 'local' || usage.contextWindowSource === 'runtime')) {\n const storedPoint = positive(usage.autoCompactAt ?? null);\n const autoCompactAt = storedPoint ?? reconcileAutoCompactAt({\n engine: session.engine,\n runtimeWindow: stored,\n // A local window is the whole budget (no --autocompact); pairing it\n // with the seat's current option would borrow another window's point.\n budget: session.engine === 'local' ? null : catalog,\n autocompactWindow: session.engine === 'claude' ? claudeAutocompactFlag(option, mode) : null,\n maxOutputTokens: option?.maxOutputTokens ?? null,\n });\n const source = session.engine === 'local' ? usage.contextWindowSource ?? null : 'runtime';\n return { ...base, contextWindow: stored, autoCompactAt, source };\n }\n if (catalog) {\n return { ...base, contextWindow: catalog.contextWindow, autoCompactAt: catalog.autoCompactAt, source: option?.windowSource ?? 'fallback' };\n }\n if (stored !== null) {\n return { ...base, contextWindow: stored, autoCompactAt: positive(usage.autoCompactAt ?? null), source: usage.contextWindowSource ?? null };\n }\n const seatWindow = positive(seatById(seats, session.seatId)?.contextWindow ?? null);\n return { ...base, contextWindow: seatWindow, autoCompactAt: null, source: seatWindow !== null ? 'fallback' : null };\n}\n\n/** Context window for a session — see {@link sessionContextBudget} for the precedence. */\nexport function contextWindowFor(\n seats: readonly VerseSeat[],\n session: Pick<VerseSession, 'seatId' | 'model' | 'usage' | 'engine' | 'contextMode'>,\n): number | null {\n return sessionContextBudget(seats, session).contextWindow;\n}\n\n/** Plain words for a window's provenance — the meter's tooltip and the resources panel share them. */\nexport const WINDOW_SOURCE_TEXT: Record<VerseWindowSource, string> = {\n runtime: 'reported by the CLI on the last turn',\n 'provider-catalog': \"from this seat's own model catalog\",\n 'cli-catalog': \"from the pinned CLI's built-in model table\",\n documented: \"from the provider's published model table\",\n fallback: 'a default estimate — the CLI has not reported the real window yet',\n};\n\n/**\n * The same provenance, per engine. On a LOCAL seat nothing is \"reported by\n * the CLI\": Verse measures the window from the model server (llama-server\n * slot, Ollama residency/defaults) and TELLS Claude Code to use it, so the\n * sentence names both halves.\n */\nexport function windowSourceText(source: VerseWindowSource, engine: VerseEngine | null | undefined): string {\n if (engine !== 'local') return WINDOW_SOURCE_TEXT[source];\n const from = source === 'runtime' ? 'measured from the local model server'\n : source === 'fallback' ? 'a default estimate — the model server did not report one'\n : WINDOW_SOURCE_TEXT[source];\n return `${from}; Verse passes this window to Claude Code for this chat`;\n}\n\n/**\n * The one sentence about Codex's surcharge above its standard window, for\n * every surface that prices Expansive on codex (the mode menu, the\n * \"Expansive could help\" chip, the new-chat mode selector, the handoff\n * dialog). Worded as REPORTED because that is all it is: the sources\n * docs/VERSE-CONTEXT.md §2.3 cites say GPT-5.6-class requests above 272k\n * count about 2× against plan limits, and Verse has no reading of its own\n * that confirms the multiplier. It multiplies the size ratio the copy quotes\n * (the ratio of the two compaction points), which is why it says \"twice that\".\n */\nexport const CODEX_EXPANSIVE_METERING_NOTE =\n 'OpenAI reportedly also counts requests above 272k tokens at about 2× against plan limits, so a turn near the expansive limit may cost roughly twice that.';\n\n/** The first model on a seat that can actually run (skips ones listed with an `unavailableReason`). */\nexport function firstRunnableModel(seat: VerseSeat): VerseModelOption | null {\n return seat.models.find((m) => !m.unavailableReason) ?? null;\n}\n\nexport function healthTone(state: VerseSeatHealth['state']): Tone {\n switch (state) {\n case 'ready':\n return 'success';\n case 'degraded':\n return 'warning';\n case 'unavailable':\n return 'danger';\n default:\n return 'unknown';\n }\n}\n\nexport function seatUnavailableReason(seat: VerseSeat): string | null {\n if (seat.health.state !== 'unavailable') return null;\n return seat.health.summary ?? 'seat unavailable';\n}\n\n// ---------------------------------------------------------------------------\n// Seat capacity — \"which account can I actually use right now\", at the point\n// the choice is made\n// ---------------------------------------------------------------------------\n\n/**\n * The four answers a picker needs. Same vocabulary as the Usage section's\n * `CapacityClass` so the two surfaces never use different words for one state.\n */\nexport type SeatCapacityClass = 'ready' | 'tight' | 'blocked' | 'unread';\n\n/** Word, never colour alone (DESIGN-V2 §6). */\nexport const SEAT_CAPACITY_WORD: Record<SeatCapacityClass, string> = {\n ready: 'usable',\n tight: 'tight',\n blocked: 'blocked',\n unread: 'no reading',\n};\n\n/** Above this share of the binding window a seat is worth flagging. */\nconst TIGHT_PERCENT = 85;\n\nexport interface SeatCapacityNote {\n cls: SeatCapacityClass;\n /**\n * The binding window's percent when it is a real measurement. Null for an\n * unread seat AND at the 100 ceiling, where the upstream value may be the\n * provider's \"limit reached\" sentinel rather than a reading\n * (docs/VERSE-TELEMETRY-V2.md) — and \"limit reached\" is true under either.\n */\n usedPercent: number | null;\n /** One short phrase for an option label, a pill title, a menu row. */\n text: string;\n}\n\n/** `seven_day_fable` → `weekly (fable)`; `five_hour` → `5-hour`. */\nexport function seatWindowLabel(id: string): string {\n const known: Record<string, string> = {\n five_hour: '5-hour window',\n seven_day: 'weekly window',\n codex: 'weekly window',\n };\n if (known[id]) return known[id];\n const perModel = /^seven_day_(.+)$/.exec(id);\n if (perModel) return `weekly ${perModel[1]!.replace(/_/g, ' ')} window`;\n return `${id.replace(/_/g, ' ')} window`;\n}\n\n/**\n * What a seat's own health says about whether a turn sent to it will land.\n *\n * This exists because the seat picker showed NOTHING: it annotated an option\n * only when `health.state === 'unavailable'`, and Claude's `health` is\n * `unknown` by construction (docs/VERSE-TELEMETRY-V2.md). So a Claude seat\n * whose binding weekly window reads 100% used appeared as an ordinary,\n * enabled, unannotated choice, and the exhaustion was discovered at turn time\n * — exactly the failure the Usage section was built to prevent.\n *\n * A `blocked` seat is MARKED, never disabled: a used-up window can coexist\n * with a spendable credit balance, so refusing the choice would be a stronger\n * claim than the data supports.\n */\nexport function seatCapacity(seat: VerseSeat): SeatCapacityNote {\n const reason = seatUnavailableReason(seat);\n if (reason !== null) return { cls: 'blocked', usedPercent: null, text: reason };\n\n const measured = seat.health.windows.filter(\n (w): w is { id: string; usedPercent: number; resetsAt: string | null } =>\n typeof w.usedPercent === 'number' && Number.isFinite(w.usedPercent),\n );\n // No window reported a number. That is an unanswered question, not a zero —\n // an empty meter would read \"plenty left\".\n if (measured.length === 0) return { cls: 'unread', usedPercent: null, text: 'no capacity reading' };\n\n const binding = measured.reduce((a, b) => (b.usedPercent > a.usedPercent ? b : a));\n const pct = Math.max(0, Math.min(100, binding.usedPercent));\n const where = seatWindowLabel(binding.id);\n if (pct >= 100) return { cls: 'blocked', usedPercent: null, text: `${where} limit reached` };\n return {\n cls: pct >= TIGHT_PERCENT ? 'tight' : 'ready',\n usedPercent: pct,\n text: `${usedPercentText(pct)} of ${where} used`,\n };\n}\n\n/** Seats grouped in the fixed engine order; empty engines are omitted. */\nexport function groupSeats(seats: readonly VerseSeat[]): Array<{ engine: VerseEngine; seats: VerseSeat[] }> {\n return ENGINE_ORDER.map((engine) => ({ engine, seats: seats.filter((s) => s.engine === engine) })).filter((g) => g.seats.length > 0);\n}\n\nexport interface SessionGroup {\n projectPath: string;\n name: string;\n enrolled: boolean;\n sessions: VerseSession[];\n}\n\n/** Sidebar grouping: by project, most recently touched project first, sessions newest first. */\nexport function groupSessions(sessions: readonly VerseSession[], projects: readonly VerseProject[], query = ''): SessionGroup[] {\n const q = query.trim().toLowerCase();\n const filtered = q\n ? sessions.filter((s) =>\n s.title.toLowerCase().includes(q) ||\n s.projectPath.toLowerCase().includes(q) ||\n s.model.toLowerCase().includes(q) ||\n s.seatId.toLowerCase().includes(q))\n : [...sessions];\n const byProject = new Map<string, VerseSession[]>();\n for (const s of filtered) {\n const list = byProject.get(s.projectPath) ?? [];\n list.push(s);\n byProject.set(s.projectPath, list);\n }\n const groups: SessionGroup[] = [];\n for (const [projectPath, list] of byProject) {\n list.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));\n groups.push({\n projectPath,\n name: projectName(projectPath, projects),\n enrolled: projects.find((p) => p.path === projectPath)?.enrolled ?? false,\n sessions: list,\n });\n }\n groups.sort((a, b) => b.sessions[0]!.updatedAt.localeCompare(a.sessions[0]!.updatedAt));\n return groups;\n}\n\nexport function formatElapsed(ms: number): string {\n if (!Number.isFinite(ms) || ms < 0) return '0s';\n const s = Math.floor(ms / 1000);\n if (s < 60) return `${s}s`;\n const m = Math.floor(s / 60);\n if (m < 60) return `${m}m ${s % 60}s`;\n const h = Math.floor(m / 60);\n return `${h}h ${m % 60}m`;\n}\n\nexport function formatDuration(ms: number): string {\n if (!Number.isFinite(ms) || ms < 0) return '—';\n if (ms < 1000) return `${Math.round(ms)}ms`;\n if (ms < 60_000) return `${(ms / 1000).toFixed(1)}s`;\n return formatElapsed(ms);\n}\n\n/**\n * Sidebar rows carry a right-aligned relative time. Short by design — the\n * row has ~5ch for it — and it degrades to a date rather than \"412d\".\n * `now` is injectable so the format is testable without faking the clock.\n */\nexport function formatRelative(iso: string, now: number = Date.now()): string {\n const then = Date.parse(iso);\n if (!Number.isFinite(then)) return '';\n const seconds = Math.round((now - then) / 1000);\n if (seconds < 0) return 'now';\n if (seconds < 60) return 'now';\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h`;\n const days = Math.floor(hours / 24);\n if (days < 7) return `${days}d`;\n return new Date(then).toLocaleDateString([], { month: 'short', day: 'numeric' });\n}\n\nexport function formatClock(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return '';\n return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });\n}\n\n/** One-line description of a tool call for a collapsed card header. */\nexport function summarizeToolInput(input: unknown): string {\n if (input === null || input === undefined) return '';\n if (typeof input === 'string') return truncate(input, 96);\n if (typeof input !== 'object') return truncate(String(input), 96);\n const record = input as Record<string, unknown>;\n const preferred = ['command', 'cmd', 'file_path', 'path', 'pattern', 'query', 'url', 'description', 'prompt', 'text'];\n for (const key of preferred) {\n const v = record[key];\n if (typeof v === 'string' && v.trim()) return truncate(v.trim().replace(/\\s+/g, ' '), 96);\n }\n const keys = Object.keys(record);\n if (keys.length === 0) return '';\n const first = record[keys[0]!];\n const rendered = typeof first === 'string' ? first : JSON.stringify(first);\n return truncate(`${keys[0]}: ${rendered ?? ''}`.replace(/\\s+/g, ' '), 96);\n}\n\nexport function truncate(value: string, max: number): string {\n return value.length > max ? `${value.slice(0, max - 1)}…` : value;\n}\n\n/** Pretty JSON for tool cards; falls back to String() for non-serializable input. */\nexport function prettyJson(value: unknown): string {\n if (typeof value === 'string') return value;\n try {\n return JSON.stringify(value, null, 2) ?? '';\n } catch {\n return String(value);\n }\n}\n\n/**\n * Accepts POSIX/Windows absolute paths and `~/...`. The server rewrites the\n * home directory as `~` in every outbound payload (sanitizePublicJson) and\n * expands it again on the way in, so a `~/` project from bootstrap is valid.\n */\nexport function isAbsolutePath(value: string): boolean {\n return /^(?:\\/|~(?:\\/|$)|[a-zA-Z]:[\\\\/]|\\\\\\\\)/.test(value) &&\n ![...value].some((c) => c.charCodeAt(0) < 32 || (c.charCodeAt(0) >= 127 && c.charCodeAt(0) <= 159));\n}\n\n/**\n * Seat pill text: \"<seat> · <model>\", collapsing to just the seat when the\n * model label is already contained in it (local seats expose one model whose\n * name is the seat name), so the pill never reads \"Qwen3-Coder · Qwen3-Coder\".\n */\nexport function seatPillLabel(seats: readonly VerseSeat[], ref: Pick<VerseSession, 'seatId' | 'engine' | 'model'>): string {\n const seat = seatLabel(seats, ref);\n const model = modelLabel(seats, ref);\n if (!model || seat.toLowerCase().includes(model.toLowerCase())) return seat;\n return `${seat} · ${model}`;\n}\n"],"mappings":"guBAYa,EAAuC,CAAC,SAAU,QAAS,OAAQ,OAAO,EAE1E,EAA4C,CACvD,OAAQ,SACR,MAAO,QACP,KAAM,OACN,MAAO,OACT,EAEA,SAAgB,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2PUgj4.js";import{a as o,g as s,o as c}from"./workbench-types-DzN-5trg.js";var l=`verse-bootstrap`,u=`verse-sessions`,d={key:l,fetch:e=>r(`/api/verse/bootstrap`,e)},f={key:u,fetch:e=>r(`/api/verse/sessions`,e)};function p(e,t=``){return`/api/verse/sessions/${encodeURIComponent(e)}${t}`}function m(e,t){return r(p(e),t)}var h=class extends Error{constructor(){super(`Unlock actions with the mutation token before chatting.`),this.name=`VerseMutationLockedError`}};async function g(n,r){let i=e();if(!i)throw new h;let o=await a(n,r,i);return t(),o}function _(){n(u),n(l)}async function v(e){let t=await g(`/api/verse/sessions`,e);return _(),t}async function y(e,t){let r={text:t},i=await g(p(e,`/turns`),r);return n(u),i}async function b(e){await g(p(e,`/cancel`),{}),n(u)}async function x(e){await g(p(e,`/delete`),{}),_()}async function S(e,t){let r=await g(p(e,`/rename`),{title:t});return n(u),r}var C=`verse-workspaces`,w=`verse-autonomy-scope`,T={key:C,fetch:e=>r(`/api/verse/workspaces`,e)},E={key:w,fetch:e=>r(`/api/verse/autonomy-scope`,e)};function D(e,t){return r(p(e,`/roots`),t)}function O(){n(C),n(w),n(l)}async function k(e){let t=await g(`/api/verse/workspaces`,e);return O(),t}async function A(e,t){let n=await g(`/api/verse/workspaces/${encodeURIComponent(e)}/update`,t);return O(),n}async function j(e){await g(`/api/verse/workspaces/${encodeURIComponent(e)}/delete`,{}),O()}async function M(e,t){await g(`/api/verse/workspaces/priority`,{path:e,priority:t}),O()}async function N(e){await g(`/api/verse/workspaces/focus`,{sectionId:e}),O()}var P=`verse-activity`,F=`verse-session-meta`;async function I(e,t){try{return await r(e,t)}catch(e){if(e instanceof i&&e.status===404)return null;throw e}}var L={key:P,fetch:e=>I(o,e)},R={key:F,fetch:e=>I(s,e)};async function z(e,t){let r={};typeof t.pinned==`boolean`&&(r.pinned=t.pinned),typeof t.archived==`boolean`&&(r.archived=t.archived);let i=await g(`${s}/${encodeURIComponent(e)}`,r);return n(F),i}async function B(t,n){let r=e();if(!r)return!1;let i={sessionId:t,turnCount:n};try{return await a(c,i,r),!0}catch{return!1}}export{p as C,R as S,T,z as _,v as a,E as b,j as c,_ as d,B as f,M as g,N as h,b as i,m as l,y as m,u as n,k as o,S as p,h as r,x as s,l as t,D as u,A as v,f as w,d as x,L as y};
|
|
2
|
-
//# sourceMappingURL=verse-queries-DvIJcn6Z.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verse-queries-DvIJcn6Z.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/verse-queries.ts"],"sourcesContent":["/**\n * routes/verse/verse-queries.ts — every /api/verse/* call the Verse console\n * makes. Reads are QueryDefs consumed through useQuery (cache-backed, so a\n * sidebar refresh never blanks the list); writes are wrapped like\n * data/mutations.ts's helpers — they pull the held mutation token from\n * auth-store, touch the hold on success, and invalidate the cache keys they\n * obviously affect. Nothing here ever sees launcher commands or env: the\n * server strips those before any payload leaves it (docs/VERSE-CONTRACT-V1).\n */\nimport type {\n VerseAutonomyScopeView,\n VerseBootstrap,\n VerseCreateSessionRequest,\n VerseRootPriority,\n VerseSession,\n VerseSessionDetail,\n VerseSessionRootsResponse,\n VerseTurnRequest,\n VerseTurnResponse,\n VerseWorkspace,\n VerseWorkspaceCreateRequest,\n VerseWorkspacesResponse,\n VerseWorkspaceUpdateRequest,\n} from '../../data/api-types.js';\nimport type {\n VerseActivityResponse,\n VerseActivitySeenRequest,\n VerseSessionMeta,\n VerseSessionMetaResponse,\n VerseSessionMetaUpdate,\n} from '../../../core/verse/workbench-types.js';\nimport { VERSE_ACTIVITY_PATH, VERSE_ACTIVITY_SEEN_PATH, VERSE_SESSION_META_PATH } from '../../../core/verse/workbench-types.js';\nimport { getMutationToken, touchMutationHold } from '../../data/auth-store.js';\nimport { ApiError, apiGet, apiPost } from '../../data/client.js';\nimport { invalidate } from '../../data/cache.js';\nimport type { QueryDef } from '../../data/queries.js';\n\nexport const VERSE_BOOTSTRAP_KEY = 'verse-bootstrap';\nexport const VERSE_SESSIONS_KEY = 'verse-sessions';\n\nexport const verseBootstrapQuery: QueryDef<VerseBootstrap> = {\n key: VERSE_BOOTSTRAP_KEY,\n fetch: (signal) => apiGet<VerseBootstrap>('/api/verse/bootstrap', signal),\n};\n\nexport const verseSessionsQuery: QueryDef<VerseSession[]> = {\n key: VERSE_SESSIONS_KEY,\n fetch: (signal) => apiGet<VerseSession[]>('/api/verse/sessions', signal),\n};\n\nexport function verseSessionPath(sessionId: string, suffix = ''): string {\n return `/api/verse/sessions/${encodeURIComponent(sessionId)}${suffix}`;\n}\n\nexport function fetchVerseSessionDetail(sessionId: string, signal?: AbortSignal): Promise<VerseSessionDetail> {\n return apiGet<VerseSessionDetail>(verseSessionPath(sessionId), signal);\n}\n\nexport class VerseMutationLockedError extends Error {\n constructor() {\n super('Unlock actions with the mutation token before chatting.');\n this.name = 'VerseMutationLockedError';\n }\n}\n\nasync function post<T>(path: string, body: unknown): Promise<T> {\n const token = getMutationToken();\n if (!token) throw new VerseMutationLockedError();\n const result = await apiPost<T>(path, body, token);\n touchMutationHold();\n return result;\n}\n\n/** Sidebar + resources panel both read these; refresh them after any write. */\nexport function invalidateVerseLists(): void {\n invalidate(VERSE_SESSIONS_KEY);\n invalidate(VERSE_BOOTSTRAP_KEY);\n}\n\nexport async function createVerseSession(req: VerseCreateSessionRequest): Promise<VerseSession> {\n const session = await post<VerseSession>('/api/verse/sessions', req);\n invalidateVerseLists();\n return session;\n}\n\nexport async function sendVerseTurn(sessionId: string, text: string): Promise<VerseTurnResponse> {\n const body: VerseTurnRequest = { text };\n const response = await post<VerseTurnResponse>(verseSessionPath(sessionId, '/turns'), body);\n invalidate(VERSE_SESSIONS_KEY);\n return response;\n}\n\nexport async function cancelVerseTurn(sessionId: string): Promise<void> {\n await post<{ ok: true }>(verseSessionPath(sessionId, '/cancel'), {});\n invalidate(VERSE_SESSIONS_KEY);\n}\n\nexport async function deleteVerseSession(sessionId: string): Promise<void> {\n await post<{ ok: true }>(verseSessionPath(sessionId, '/delete'), {});\n invalidateVerseLists();\n}\n\nexport async function renameVerseSession(sessionId: string, title: string): Promise<VerseSession> {\n const session = await post<VerseSession>(verseSessionPath(sessionId, '/rename'), { title });\n invalidate(VERSE_SESSIONS_KEY);\n return session;\n}\n\n// ---------------------------------------------------------------------------\n// Workspaces (V2.2)\n// ---------------------------------------------------------------------------\n\nexport const VERSE_WORKSPACES_KEY = 'verse-workspaces';\nexport const VERSE_AUTONOMY_SCOPE_KEY = 'verse-autonomy-scope';\n\nexport const verseWorkspacesQuery: QueryDef<VerseWorkspacesResponse> = {\n key: VERSE_WORKSPACES_KEY,\n fetch: (signal) => apiGet<VerseWorkspacesResponse>('/api/verse/workspaces', signal),\n};\n\n/**\n * Enrolled repos, ordered by section focus and priority. Kept on its own key\n * from `verseScopeQuery` (which is the raw registry) so a re-rank refreshes\n * the ORDER without re-reading enrollment — and so it is obvious in the cache\n * that these are two different facts.\n */\nexport const verseAutonomyScopeQuery: QueryDef<VerseAutonomyScopeView> = {\n key: VERSE_AUTONOMY_SCOPE_KEY,\n fetch: (signal) => apiGet<VerseAutonomyScopeView>('/api/verse/autonomy-scope', signal),\n};\n\n/**\n * Per-root identity for one session: branch, dirty state, remote, whether the\n * engine can reach each root and whether the autonomous lane would.\n *\n * Deliberately NOT cached by session id alone at module scope — a branch goes\n * stale the moment a turn commits, so the panel refetches it per open.\n */\nexport function fetchVerseSessionRoots(sessionId: string, signal?: AbortSignal): Promise<VerseSessionRootsResponse> {\n return apiGet<VerseSessionRootsResponse>(verseSessionPath(sessionId, '/roots'), signal);\n}\n\nfunction invalidateWorkspaces(): void {\n invalidate(VERSE_WORKSPACES_KEY);\n invalidate(VERSE_AUTONOMY_SCOPE_KEY);\n invalidate(VERSE_BOOTSTRAP_KEY);\n}\n\nexport async function createVerseWorkspace(req: VerseWorkspaceCreateRequest): Promise<VerseWorkspace> {\n const workspace = await post<VerseWorkspace>('/api/verse/workspaces', req);\n invalidateWorkspaces();\n return workspace;\n}\n\nexport async function updateVerseWorkspace(id: string, patch: VerseWorkspaceUpdateRequest): Promise<VerseWorkspace> {\n const workspace = await post<VerseWorkspace>(`/api/verse/workspaces/${encodeURIComponent(id)}/update`, patch);\n invalidateWorkspaces();\n return workspace;\n}\n\nexport async function deleteVerseWorkspace(id: string): Promise<void> {\n await post<{ ok: true }>(`/api/verse/workspaces/${encodeURIComponent(id)}/delete`, {});\n invalidateWorkspaces();\n}\n\nexport async function setVerseRootPriority(path: string, priority: VerseRootPriority): Promise<void> {\n await post<unknown>('/api/verse/workspaces/priority', { path, priority });\n invalidateWorkspaces();\n}\n\nexport async function setVerseFocusSection(sectionId: string | null): Promise<void> {\n await post<unknown>('/api/verse/workspaces/focus', { sectionId });\n invalidateWorkspaces();\n}\n\n// ---------------------------------------------------------------------------\n// 3.10 — activity + per-chat meta (C1's routes; C2's sidebar reads them)\n// ---------------------------------------------------------------------------\n//\n// Both route families are mounted lazily (C0's mount table): on a build where\n// C1's module has not landed they answer a plain 404. That is \"this server\n// has no activity yet\", not an error the sidebar should paint red — so a 404\n// reads as `null` and every consumer falls back to what the session list\n// alone can say (running dot from `status`, no pins, no unread).\n\nexport const VERSE_ACTIVITY_KEY = 'verse-activity';\nexport const VERSE_SESSION_META_KEY = 'verse-session-meta';\n\nasync function getOrNull<T>(path: string, signal?: AbortSignal): Promise<T | null> {\n try {\n return await apiGet<T>(path, signal);\n } catch (err) {\n if (err instanceof ApiError && err.status === 404) return null;\n throw err;\n }\n}\n\n/**\n * The poll-shaped read (no `since`): running chats with their live line and\n * the Needs-you items. Completions are C1's concern (its cursor loop feeds\n * the rail and the native notifications); the sidebar needs only the present.\n */\nexport const verseActivityQuery: QueryDef<VerseActivityResponse | null> = {\n key: VERSE_ACTIVITY_KEY,\n fetch: (signal) => getOrNull<VerseActivityResponse>(VERSE_ACTIVITY_PATH, signal),\n};\n\nexport const verseSessionMetaQuery: QueryDef<VerseSessionMetaResponse | null> = {\n key: VERSE_SESSION_META_KEY,\n fetch: (signal) => getOrNull<VerseSessionMetaResponse>(VERSE_SESSION_META_PATH, signal),\n};\n\n/** Pin / archive one chat. Unknown keys are a 400 on the server, so only the two known ones are ever sent. */\nexport async function setVerseSessionMeta(sessionId: string, update: VerseSessionMetaUpdate): Promise<VerseSessionMeta> {\n const body: VerseSessionMetaUpdate = {};\n if (typeof update.pinned === 'boolean') body.pinned = update.pinned;\n if (typeof update.archived === 'boolean') body.archived = update.archived;\n const meta = await post<VerseSessionMeta>(`${VERSE_SESSION_META_PATH}/${encodeURIComponent(sessionId)}`, body);\n invalidate(VERSE_SESSION_META_KEY);\n return meta;\n}\n\n/**\n * \"The operator has read this chat up to `turnCount`.\" Best-effort and SILENT:\n * it runs only when a token is already held (opening a chat must never raise\n * the token dialog), and a failure is swallowed — the sidebar keeps its own\n * optimistic read state, so the unread dot clears either way.\n */\nexport async function markVerseSessionSeen(sessionId: string, turnCount: number): Promise<boolean> {\n const token = getMutationToken();\n if (!token) return false;\n const body: VerseActivitySeenRequest = { sessionId, turnCount };\n try {\n // apiPost, not post(): reading a chat is not operator ACTIVITY, so it\n // must not extend the mutation hold the way a real write does.\n await apiPost<unknown>(VERSE_ACTIVITY_SEEN_PATH, body, token);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":"6IAqCA,IAAa,EAAsB,kBACtB,EAAqB,iBAErB,EAAgD,CAC3D,IAAK,EACL,MAAQ,GAAW,EAAuB,uBAAwB,CAAM,CAC1E,EAEa,EAA+C,CAC1D,IAAK,EACL,MAAQ,GAAW,EAAuB,sBAAuB,CAAM,CACzE,EAEA,SAAgB,EAAiB,EAAmB,EAAS,GAAY,CACvE,MAAO,uBAAuB,mBAAmB,CAAS,IAAI,GAChE,CAEA,SAAgB,EAAwB,EAAmB,EAAmD,CAC5G,OAAO,EAA2B,EAAiB,CAAS,EAAG,CAAM,CACvE,CAEA,IAAa,EAAb,cAA8C,KAAM,CAClD,aAAc,CACZ,MAAM,yDAAyD,EAC/D,KAAK,KAAO,0BACd,CACF,EAEA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O,MAAO,GACnB,IAAM,EAAiC,CAAE,YAAW,WAAU,EAC9D,GAAI,CAIF,OADA,MAAM,EAAiB,EAA0B,EAAM,CAAK,EACrD,EACT,MAAQ,CACN,MAAO,EACT,CACF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{tt as e}from"./global-Di2PUgj4.js";var t=[`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],n=new Set([`thinking-delta`,`thinking-progress`,`progress`,`status`]);function r(e){return n.has(e.type)}var i=65536,a=12e3,o=[`This conversation is about to continue in a fresh session that has none of its context.`,`Write the handoff note that new session should start from. Do not edit files or run commands for this — only write the note.`,``,`Cover, concretely:`,`- The goal, and what "done" looks like.`,`- Decisions made so far, each with the reason it was made.`,`- Current state: what is finished, what is half-done, what is untested.`,`- Files changed and anything not yet committed.`,`- How to verify the work (exact commands).`,`- Open questions, risks, and approaches already tried that did not work.`,``,`Keep it under 600 words. Prefer file paths and commands over prose.`].join(`
|
|
2
|
-
`),s=65536,c=139264,l=6144,u={turnId:null,startedAt:null,progress:null,thinking:null,notice:null,settledTurnId:null},d={session:null,events:[],lastSeq:0,loaded:!1,loadError:null,stream:`idle`,live:u},f=new Map,p=new Map,m=new Map,h=new Map,g=new Set,_=new Map,v=new Set;function y(e){if(e!==null){let t=_.get(e);if(t)for(let e of[...t])e()}else for(let e of[..._.values()])for(let t of[...e])t();for(let e of[...g])e()}function b(e){return g.add(e),()=>g.delete(e)}function ee(e,t){let n=_.get(e);return n||(n=new Set,_.set(e,n)),n.add(t),()=>{let n=_.get(e);n&&(n.delete(t),n.size===0&&_.delete(e))}}function x(e){return v.add(e),()=>v.delete(e)}function S(e){return{sessionId:e.sessionId,session:e.session,events:e.events,lastSeq:e.lastSeq,loaded:e.loaded,loadError:e.loadError,stream:e.stream}}function C(e){let t=f.get(e);return t||(t={sessionId:e,...d},f.set(e,t),p.set(e,S(t))),t}function w(e,t,n){f.set(e,t);let r=p.get(e);(!r||n||r.session!==t.session||r.loaded!==t.loaded||r.loadError!==t.loadError||r.stream!==t.stream)&&p.set(e,S(t))}function T(e,t,n=!1){w(e,{...C(e),...t},n),y(e)}var E={sessionId:``,...d},te=S(E);function ne(e){return e?C(e):E}function re(e){return e?(C(e),p.get(e)):te}function D(e){return e?C(e).live:u}var O={items:[],live:!1,usage:null,segments:[]};function k(e){if(!e)return O;let t=C(e),n=h.get(e);if(n&&n.events===t.events)return n.transcript;let r=n?.cache??ce(),i=le(t.events,{cache:r,thinkingStats:m.get(e)});return h.set(e,{events:t.events,transcript:i,cache:r}),i}function A(e,t,n){let r=C(e),i=ae(r.events,n),a=P(t,i),o=r.session&&se(r.session,a)?r.session:a,s=i!==r.events,c=s||o!==r.session?H(r.live,i,o):r.live;(s||o!==r.session||!r.loaded||r.loadError!==null||c!==r.live)&&(w(e,{...r,session:o,events:i,lastSeq:i.length?Math.max(r.lastSeq,i[i.length-1].seq):r.lastSeq,loaded:!0,loadError:null,live:c},s),y(e))}function j(e,t){T(e,{loadError:t,loaded:!0})}function M(e,t){C(e).stream!==t&&T(e,{stream:t})}function N(e,t,n){T(e,{session:P(t,C(e).events,n)})}function P(e,t,n){if(e.status!==`running`)return e;let r=-1,i=n??null;if(!n){for(let e of t)(e.type===`user-message`||e.type===`turn-started`)&&(r=e.seq,i=e.turnId);if(i===null)return e}let a=null,o=null;for(let e of t)e.seq<=r||(e.type===`error`&&e.turnId===i&&(o=e.message),(e.type===`turn-done`||e.type===`cancelled`)&&e.turnId===i&&(a=e));if(!a)return e;let s=a.type===`turn-done`&&!a.ok&&o!==null;return{...e,status:s?`error`:`idle`,lastError:s?o:null,updatedAt:a.at>e.updatedAt?a.at:e.updatedAt}}function F(e,t){let n=C(e);n.session&&n.session.status!==t&&T(e,{session:{...n.session,status:t}})}function I(e,t){let n=C(e),i=n.events,a=!1,o=n.lastSeq,s=n.session,c=n.live,l=0,u=!1,d=!1,f=!1,p=Date.now();for(let n of t){if(r(n)){let e=B(c,n,p);e!==c&&(c=e,f=!0);continue}if(!Number.isFinite(n.seq))continue;let t=i.length>0?i[i.length-1].seq:-1/0;if(n.seq>t)a||=(i=i.slice(),!0),i.push(n);else{let e=J(i,n.seq);if(e.found)continue;a||=(i=i.slice(),!0),i.splice(e.index,0,n)}l+=1,o=Math.max(o,n.seq),n.type!==`text-delta`&&(d=!0),(n.type===`turn-done`||n.type===`cancelled`||n.type===`error`)&&(u=!0),s&&=L(s,n);let m=V(c,n,p,e);m!==c&&(c=m)}return l===0&&!f?{applied:0,settled:!1,liveChanged:!1}:(w(e,{...n,events:i,lastSeq:o,session:s,live:c},d),y(e),{applied:l,settled:u,liveChanged:f})}function L(e,t){switch(t.type){case`turn-started`:return{...e,status:`running`,lastError:null,updatedAt:t.at};case`usage`:return{...e,usage:ie(e,t.usage),updatedAt:t.at};case`context`:return{...e,usage:G(e,t),updatedAt:t.at};case`compaction`:return{...e,compactionCount:(e.compactionCount??0)+1,updatedAt:t.at};case`turn-done`:return{...e,status:t.ok?`idle`:e.lastError?`error`:`idle`,turnCount:e.turnCount+1,nativeSessionId:t.nativeSessionId??e.nativeSessionId,updatedAt:t.at};case`error`:return{...e,status:`error`,lastError:t.message,updatedAt:t.at};case`cancelled`:return{...e,status:`idle`,updatedAt:t.at};default:return e}}function R(e,t){let n=Date.parse(e);return Number.isFinite(n)?n:t}function z(e,t,n){return e.turnId===t?e:{...u,turnId:t,startedAt:n,settledTurnId:e.settledTurnId}}function B(e,t,n){if(t.turnId!==null&&t.turnId===e.settledTurnId)return e;let r=t.turnId===null?e:z(e,t.turnId,n);switch(t.type){case`thinking-delta`:{if(t.text.length===0)return r;let e=r.thinking&&r.thinking.turnId===t.turnId?{...r.thinking,text:r.thinking.text+t.text}:{turnId:t.turnId,text:t.text,startedAt:n,estimatedTokens:null};return{...r,thinking:e,notice:null}}case`thinking-progress`:{let e=r.thinking&&r.thinking.turnId===t.turnId?{...r.thinking,estimatedTokens:t.estimatedTokens}:{turnId:t.turnId,text:``,startedAt:n,estimatedTokens:t.estimatedTokens};return{...r,thinking:e}}case`progress`:return{...r,progress:{phase:t.phase,tool:typeof t.tool==`string`&&t.tool.length>0?t.tool:null,elapsedMs:t.elapsedMs,outTokens:t.outTokens??null,tokPerSec:t.tokPerSec??null,receivedAt:n}};case`status`:return{...r,notice:{kind:t.kind,message:t.message,at:t.at,receivedAt:n}};default:return r}}function V(e,t,n,r){switch(t.type){case`turn-started`:return t.turnId===e.settledTurnId?e:e.turnId===t.turnId?{...e,startedAt:R(t.at,e.startedAt??n)}:{...u,turnId:t.turnId,startedAt:R(t.at,n),settledTurnId:e.settledTurnId};case`thinking`:{let i=e.thinking&&e.thinking.turnId===t.turnId?e.thinking:null;if(i){let e=m.get(r);e||(e=new Map,m.set(r,e)),e.set(t.seq,{durationMs:typeof t.durationMs==`number`?t.durationMs:Math.max(0,n-i.startedAt),estimatedTokens:i.estimatedTokens})}return i||e.notice?{...e,thinking:i?null:e.thinking,notice:null}:e}case`text-delta`:case`assistant-message`:case`tool-use`:case`tool-result`:return e.notice&&(t.turnId===e.turnId||e.turnId===null)?{...e,notice:null}:e;case`turn-done`:case`cancelled`:return{...u,settledTurnId:t.turnId};default:return e}}function H(e,t,n){let r=null,i=e.settledTurnId;for(let e=t.length-1;e>=0;--e){let n=t[e];if(n.type===`turn-done`||n.type===`cancelled`){i=n.turnId;break}if(n.type===`turn-started`){r=n;break}}return r?n&&n.status!==`running`?e.turnId===null?e:{...u,settledTurnId:e.settledTurnId}:e.turnId===r.turnId?e:{...u,turnId:r.turnId,startedAt:R(r.at,Date.now()),settledTurnId:e.settledTurnId}:e.turnId!==null&&e.turnId===i?{...u,settledTurnId:i}:e.settledTurnId===i?e:{...e,settledTurnId:i}}function ie(e,t){let n=e.usage,r={...n,inputTokens:n.inputTokens+t.inputTokens,outputTokens:n.outputTokens+t.outputTokens,cacheReadTokens:n.cacheReadTokens+t.cacheReadTokens,cacheCreationTokens:n.cacheCreationTokens+t.cacheCreationTokens,contextTokens:t.contextTokens},i=typeof t.contextWindow==`number`&&t.contextWindow>0?t.contextWindow:null,a=t.contextWindowSource!==void 0||e.engine!==`local`;return i!==null&&a&&(r.contextWindow=i),t.contextWindowSource!==void 0&&(r.contextWindowSource=t.contextWindowSource),t.autoCompactAt!==void 0&&(r.autoCompactAt=t.autoCompactAt),t.contextTokensExact===!1?r.contextTokensExact=!1:t.contextWindowSource!==void 0&&delete r.contextTokensExact,r}var U=new Set([`runtime`,`provider-catalog`,`cli-catalog`,`documented`,`fallback`]);function W(e){return typeof e==`string`&&U.has(e)?e:null}function G(t,n){let r=t.usage,i={...r,contextTokens:Math.max(0,Math.floor(n.contextTokens)),contextTokensExact:n.exact},a=typeof n.contextWindow==`number`&&n.contextWindow>0?n.contextWindow:null,o=W(n.contextWindowSource);return a===null||t.engine===`local`&&o===null?(n.autoCompactAt!==void 0&&n.autoCompactAt!==null&&(i.autoCompactAt=n.autoCompactAt),i):(i.contextWindow=a,i.contextWindowSource=o??`runtime`,n.autoCompactAt===void 0?a!==r.contextWindow&&(i.autoCompactAt=e({engine:t.engine,runtimeWindow:a,budget:r.contextWindow?{contextWindow:r.contextWindow,autoCompactAt:r.autoCompactAt??null}:null})):i.autoCompactAt=n.autoCompactAt,i)}function K(e){let t=null;for(let n of e)(n.type===`usage`||n.type===`turn-done`||n.type===`cancelled`||n.type===`context`&&n.turnId!==null)&&typeof n.at==`string`&&(t===null||n.at>t)&&(t=n.at);return t}function q(e){let t=f.delete(e);p.delete(e),h.delete(e),m.delete(e);for(let t of[...v])t({kind:`forget`,sessionId:e});t&&y(e)}function J(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1,a=e[i].seq;if(a===t)return{found:!0,index:i};a<t?n=i+1:r=i}return{found:!1,index:n}}function Y(e){let t=!0;for(let n=0;n<e.length;n+=1){let r=e[n].seq;if(!Number.isFinite(r)||n>0&&r<=e[n-1].seq){t=!1;break}}if(t)return e.slice();let n=new Map;for(let t of e)Number.isFinite(t.seq)&&!n.has(t.seq)&&n.set(t.seq,t);return[...n.values()].sort((e,t)=>e.seq-t.seq)}function ae(e,t){if(t.length===0)return e;let n=Y(t);if(n.length===0)return e;if(e.length===0)return n;if(n[0].seq>e[e.length-1].seq)return e.concat(n);let r=[],i=0,a=0,o=0;for(;a<e.length||o<n.length;){let t=e[a],s=n[o];s===void 0||t!==void 0&&t.seq<s.seq?(r.push(t),a+=1):t===void 0||s.seq<t.seq?(r.push(s),i+=1,o+=1):(r.push(t),a+=1,o+=1)}return i===0?e:r}function oe(e,t){if(Object.is(e,t))return!0;if(!e||!t||typeof e!=`object`||typeof t!=`object`||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.is(e[r],t[r]))return!1;return!0}function se(e,t){if(e===t)return!0;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>oe(e[n],t[n]))}function X(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):null}function ce(){return{segments:new Map}}function Z(e,t,n,r){let i=[],a=new Map,o=[],s=[],c=null,l=null,u=null,d=()=>{c&&=(i.push({kind:`assistant`,key:c.key,turnId:c.turnId,at:c.at,text:c.text,streaming:!1}),null)};for(let f=t;f<n;f+=1){let t=e[f];switch(t.type){case`user-message`:d(),i.push({kind:`user`,key:`u-${t.seq}`,turnId:t.turnId,at:t.at,text:t.text});break;case`turn-started`:l=!0;break;case`text-delta`:c&&c.turnId!==t.turnId&&d(),c||={turnId:t.turnId,at:t.at,text:``,key:`d-${t.seq}`},c.text+=t.text;break;case`assistant-message`:c=null,i.push({kind:`assistant`,key:`a-${t.seq}`,turnId:t.turnId,at:t.at,text:t.text,streaming:!1});break;case`thinking`:{d();let e=r?.get(t.seq);i.push({kind:`thinking`,key:`t-${t.seq}`,turnId:t.turnId,at:t.at,text:t.text,redacted:t.redacted===!0,durationMs:typeof t.durationMs==`number`&&Number.isFinite(t.durationMs)&&t.durationMs>=0?t.durationMs:e?.durationMs??null,estimatedTokens:e?.estimatedTokens??null,thinkingKind:t.kind??null});break}case`tool-use`:d(),a.set(t.toolUseId,i.length),s.push(t.toolUseId),i.push({kind:`tool`,key:`tu-${t.seq}`,turnId:t.turnId,at:t.at,toolUseId:t.toolUseId,name:t.name,input:t.input,result:null,durationMs:null});break;case`tool-result`:{let e=a.get(t.toolUseId),n=e===void 0?void 0:i[e];n&&n.kind===`tool`?i[e]={...n,result:{output:t.output,isError:t.isError},durationMs:X(n.at,t.at)}:(o.push(t.toolUseId),i.push({kind:`tool`,key:`tr-${t.seq}`,turnId:t.turnId,at:t.at,toolUseId:t.toolUseId,name:`tool`,input:null,result:{output:t.output,isError:t.isError},durationMs:null}));break}case`usage`:u=t.usage;break;case`compaction`:i.push({kind:`compaction`,key:`k-${t.seq}`,turnId:t.turnId,at:t.at,trigger:t.trigger,preTokens:t.preTokens,postTokens:t.postTokens,durationMs:t.durationMs});break;case`error`:d(),i.push({kind:`error`,key:`e-${t.seq}`,turnId:t.turnId,at:t.at,message:t.message,code:typeof t.code==`string`&&t.code?t.code:null});break;case`cancelled`:d(),l=!1,i.push({kind:`cancelled`,key:`c-${t.seq}`,turnId:t.turnId,at:t.at});break;case`turn-done`:d(),l=!1,i.push({kind:`turn-done`,key:`td-${t.seq}`,turnId:t.turnId,at:t.at,ok:t.ok,durationMs:t.durationMs});break;case`recovered`:i.push({kind:`recovered`,key:`r-${t.seq}`,turnId:t.turnId,at:t.at,how:t.how,message:t.message});break;case`history-truncated`:i.push({kind:`truncated`,key:`h-${t.seq}`,turnId:null,at:t.at,droppedBefore:t.droppedBefore})}}return{items:i,pending:c,liveEffect:l,usage:u,orphanResults:o,toolUseIds:s}}function Q(e,t,n){let r=t.pending;return r?{key:e,items:[...t.items,{kind:`assistant`,key:r.key,turnId:r.turnId,at:r.at,text:r.text,streaming:n}]}:{key:e,items:t.items}}function le(e,t={}){let{cache:n,thinkingStats:r}=t;if(e.length===0)return{items:[],live:!1,usage:null,segments:[]};let i=[0];for(let t=1;t<e.length;t+=1)e[t].type===`user-message`&&i.push(t);let a=[],o=new Set;for(let t=0;t<i.length;t+=1){let s=i[t],c=t+1<i.length?i[t+1]:e.length,l=e[s].seq,u=e[c-1].seq,d=c-s,f=`s-${l}`;o.add(f);let p=n?.segments.get(f);if(p&&p.firstSeq===l&&p.lastSeq===u&&p.count===d){a.push({key:f,build:p.build,cached:p});continue}let m=Z(e,s,c,r),h={firstSeq:l,lastSeq:u,count:d,build:m,finalized:null};n?.segments.set(f,h),a.push({key:f,build:m,cached:h})}if(n)for(let e of[...n.segments.keys()])o.has(e)||n.segments.delete(e);if(a.length>1){let t=new Set;for(let n of a){if(n.build.orphanResults.some(e=>t.has(e)))return $(e,r);for(let e of n.build.toolUseIds)t.add(e)}}let s=!1,c=null;for(let e of a)e.build.liveEffect!==null&&(s=e.build.liveEffect),e.build.usage!==null&&(c=e.build.usage);let l=[],u=[];for(let e=0;e<a.length;e+=1){let t=a[e],n=e===a.length-1&&s,r;t.cached?.finalized&&t.cached.finalized.streaming===n?r=t.cached.finalized.segment:(r=Q(t.key,t.build,n),t.cached&&(t.cached.finalized={streaming:n,segment:r})),l.push(r);for(let e of r.items)u.push(e)}return{items:u,live:s,usage:c,segments:l}}function $(e,t){let n=Z(e,0,e.length,t),r=n.liveEffect??!1,i=Q(`s-${e[0].seq}`,n,r);return{items:i.items,live:r,usage:n.usage,segments:[i]}}function ue(e){let t=[],n=[],r=()=>{if(n.length===0)return;let e=n.length;for(;e>0&&n[e-1].kind===`thinking`;)--e;let r=n.slice(0,e),i=n.slice(e);if(r.filter(e=>e.kind===`tool`).length>=2)t.push(de(r));else for(let e of r)t.push(e);for(let e of i)t.push(e);n=[]};for(let i of e){if((i.kind===`tool`||i.kind===`thinking`)&&(n.length===0||n[0].turnId===i.turnId)){n.push(i);continue}r(),i.kind===`tool`||i.kind===`thinking`?n.push(i):t.push(i)}return r(),t}function de(e){let t=new Map,n=0,r=!1;for(let i of e)i.kind===`tool`&&(t.set(i.name,(t.get(i.name)??0)+1),i.result===null?r=!0:i.result.isError&&(n+=1));let i=[...t.values()].reduce((e,t)=>e+t,0),a=[...t.entries()].map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `),o=X(e[0].at,e[e.length-1].at);return{kind:`toolGroup`,key:`g-${e[0].key}`,turnId:e[0].turnId,at:e[0].at,items:e,toolCount:i,summary:a,errorCount:n,pending:r,spanMs:o}}function fe(e){return e==null||!Number.isFinite(e)?`—`:Math.round(e)<1e3?String(Math.round(e)):Math.round(e/1e3)<1e3?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}export{c as C,l as S,x as _,re as a,o as b,ue as c,j as d,N as f,b as g,ee as h,D as i,K as l,M as m,q as n,ne as o,F as p,fe as r,k as s,I as t,A as u,t as v,s as w,i as x,a as y};
|
|
3
|
-
//# sourceMappingURL=verse-store-DjBWj04q.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verse-store-DjBWj04q.js","names":[],"sources":["../../../../../../src/core/verse/types.ts","../../../../../../src/web-ui/routes/verse/verse-store.ts"],"sourcesContent":["/**\n * Ashlr Verse — interactive multi-turn session contract (V1).\n *\n * A Verse session binds one project directory to one execution seat\n * (engine + account + model). Each user turn spawns ONE vendor CLI process\n * that resumes the vendor-native conversation by id, streams normalized\n * events, and exits. No long-lived stdin is held between turns.\n *\n * Seats:\n * claude -> `claude -p ... --output-format stream-json` via a native-profile launcher (account pinned by CLAUDE_CONFIG_DIR)\n * local -> the plain `claude` binary with ANTHROPIC_BASE_URL pointed at Ollama (Anthropic-compatible API); model = Ollama tag\n * codex -> `codex exec --json` / `codex exec resume <threadId> --json` via a native-profile launcher (CODEX_HOME pinned)\n * grok -> `grok -p ... --output-format streaming-messages-json` via a native-profile launcher (GROK_HOME pinned)\n *\n * Nothing in this module reads secrets. Account identity is pinned by the\n * launcher command recorded in ~/.ashlr/account-connections/connections.json.\n */\n\nexport type VerseEngine = 'claude' | 'codex' | 'grok' | 'local';\n\nexport type VerseSessionStatus = 'idle' | 'running' | 'error';\n\n/** One selectable execution seat shown in the model/account picker. */\nexport interface VerseSeat {\n /** Stable id, e.g. `claude`, `codex-personal`, `grok`, `local:qwen3-coder-next:ctx64k`. */\n id: string;\n engine: VerseEngine;\n /** Human label, e.g. \"Claude Code\", \"Personal Codex\", \"Grok\", \"Qwen3-Coder-Next (local)\". */\n label: string;\n /** Account id from connections.json for native seats; `local` for Ollama seats. */\n accountId: string;\n /** Models this seat can run. First entry is the default. */\n models: VerseModelOption[];\n /** Best-known context window in tokens for the default model (null when unknown). */\n contextWindow: number | null;\n /** Latest health/usage evidence, if any. Never an admission input in V1. */\n health: VerseSeatHealth;\n /**\n * V2.1 ADDITIVE. The subscription capacity behind this seat, so the seat\n * list can render a meter without a second request.\n *\n * Absent (`undefined`) for LOCAL seats: an Ollama tag has no subscription\n * and no provider window. Its real constraint is machine memory, which is\n * reported by `VerseBootstrap.localRuntime`, not by a quota. Absent on a\n * native seat means the server could not build a record for that account\n * at all — `health.state` says what it does know.\n */\n capacity?: VerseSeatCapacity;\n /**\n * V3.9 ADDITIVE. The version of the CLI binary this seat is PINNED to (its\n * native-profile launcher execs one exact file). Absent when unknown and on\n * local seats. A pinned binary never updates itself, so a model that needs a\n * newer CLI is listed with `unavailableReason` rather than silently failing.\n */\n cliVersion?: string;\n /**\n * V3.9 ADDITIVE. Plain-language facts about this seat's context setup the UI\n * must show rather than imply (binary skew, catalog not yet fetched, …).\n * Absent when there is nothing to say, so ordinary seats keep their shape.\n */\n notes?: string[];\n}\n\n/**\n * Where a context-window figure came from, so nothing on screen implies more\n * certainty than it has (docs/VERSE-CONTEXT.md §1).\n *\n * - `runtime` — the CLI reported it for THIS turn (claude/grok\n * `result.modelUsage.<m>.contextWindow`, codex rollout\n * `token_count.info.model_context_window`, Ollama\n * `/api/ps`). Wins over everything else.\n * - `provider-catalog` — the seat's own served catalog on disk (codex/grok\n * `native-state/models_cache.json`).\n * - `cli-catalog` — read out of the pinned CLI binary's embedded catalog\n * and recorded here with the version it was read from.\n * - `documented` — the provider's published model table.\n * - `fallback` — a named default; the UI marks it as an estimate.\n */\nexport type VerseWindowSource = 'runtime' | 'provider-catalog' | 'cli-catalog' | 'documented' | 'fallback';\n\n/**\n * How much context a session is allowed to accumulate before the CLI compacts.\n *\n * - `standard` — the default. Evidence-based budget per engine: Claude 1M\n * models compact near 400k instead of ~967k; Codex, Grok and\n * local run their native windows.\n * - `expansive` — opt-in. Claude runs its full native window (CLI `auto`),\n * Codex raises `model_context_window` to the model's catalog\n * maximum (872k on GPT-6 / GPT-5.6). Costs more usage per turn,\n * buys simultaneous visibility for coupled, cross-cutting work.\n *\n * A mode that does not exist for a model (Grok, local, 200k Claude models,\n * GPT-5.5) is simply absent from that model's option — never faked.\n */\nexport type VerseContextMode = 'standard' | 'expansive';\n\nexport const VERSE_CONTEXT_MODES: readonly VerseContextMode[] = ['standard', 'expansive'];\n\n/** One mode's budget for a model on a seat. */\nexport interface VerseContextBudget {\n /** The window the CLI measures against in this mode (the meter's denominator). */\n contextWindow: number;\n /** Token count at which the CLI auto-compacts in this mode; null when unknown. */\n autoCompactAt: number | null;\n /**\n * The RAW window value the CLI must be TOLD to reach this budget, when that\n * differs from `contextWindow` — codex measures against 95% of the window it\n * is configured with, so expansive GPT-6 is `providerWindow: 872_000`\n * (`-c model_context_window=872000`) but `contextWindow: 828_400`.\n */\n providerWindow?: number | null;\n}\n\nexport interface VerseModelOption {\n id: string;\n label: string;\n /** Standard-mode window the CLI measures against (codex: the 95% effective window). */\n contextWindow: number | null;\n /**\n * V3.9 ADDITIVE — every field below is optional so records and fixtures\n * written before it keep validating. Absent means \"not known\", never zero.\n */\n /** Standard-mode auto-compaction point. */\n autoCompactAt?: number | null;\n /** Present ONLY when this model on this seat has a real expansive mode. */\n expansive?: VerseContextBudget | null;\n /** The CLI's default max output for this model, when known. */\n maxOutputTokens?: number | null;\n windowSource?: VerseWindowSource;\n /** Minimum CLI version that knows this model id (e.g. '2.1.280'); null when any. */\n minCliVersion?: string | null;\n /**\n * Why this model cannot run on this seat right now, in plain language (e.g.\n * \"needs Claude Code 2.1.280; this seat runs 2.1.257\"). Null/absent = runnable.\n * Listed rather than hidden so the operator learns WHY a model is missing.\n */\n unavailableReason?: string | null;\n}\n\nexport interface VerseSeatHealth {\n state: 'ready' | 'degraded' | 'unavailable' | 'unknown';\n /** e.g. \"5h window 72% used, resets 14:00\" — plain text, already sanitized. */\n summary: string | null;\n windows: Array<{ id: string; usedPercent: number | null; resetsAt: string | null }>;\n observedAt: string | null;\n}\n\n// ---------------------------------------------------------------------------\n// Seat capacity (V2.1, additive) — see docs/VERSE-TELEMETRY-V2.md, which is\n// the authority for every honesty rule encoded in these shapes.\n//\n// This file is imported by the BROWSER bundle, so it may not import\n// `core/verse/accounts.ts` (node:fs). The shapes below therefore restate the\n// provider-record shapes structurally. `seats.ts` assigns the account record's\n// values straight into them, so a divergence in `core/verse/accounts.ts` stops\n// `seats.ts` compiling — that assignment is the drift guard.\n// ---------------------------------------------------------------------------\n\n/** One provider-reported quota window, as carried on a seat. */\nexport interface VerseSeatWindow {\n id: string;\n /** Provider-reported percent, or null for NO SIGNAL — which is not zero. */\n usedPercent: number | null;\n /**\n * Machine-readable reset instant. STRUCTURALLY ALWAYS NULL for Claude: that\n * provider publishes only a sentence, which lives in `resetDescription` and\n * is rendered verbatim. The server never synthesizes an instant from it.\n * (3.10.1: the Command burn-down chart may place the reset on its time axis\n * via `resetInstantFromWords` in web-ui command-model, but only for the\n * collector's exact \"Mon D at H:MMam (Area/Zone)\" form and only when the\n * result lands within one window of now; anything else stays words.)\n */\n resetsAt: string | null;\n /** The provider's own reset wording, verbatim (\"resets Sep 25 at 7pm (America/New_York)\"). */\n resetDescription: string | null;\n /**\n * TRUE only when the provider explicitly FLAGGED the limit. Such a window's\n * `usedPercent` is the SENTINEL 100 — a denial, not a measurement — and must\n * be labelled \"limit reached\", never \"100% used\".\n */\n limitReached: boolean;\n /** False when `usedPercent` is a flagged sentinel rather than a reading. */\n measured: boolean;\n}\n\n/**\n * Codex credits, INDEPENDENT of the window: a fully used weekly window with a\n * spendable balance is not blocked. `null` is \"no signal\", never \"no credits\".\n */\nexport interface VerseSeatCredits {\n hasCredits: boolean;\n unlimited: boolean;\n /** Provider-reported decimal string, kept verbatim — never rounded. */\n balance: string | null;\n}\n\n/**\n * The coarse \"can I use this seat right now\" verdict. Deliberately coarse: the\n * exact numbers are in `windows`, and a verdict that pretended to more\n * precision than the providers give would be a lie.\n *\n * - `ready` — a reading exists and the binding window has headroom.\n * - `tight` — the binding window is at/above the warn threshold, OR it is\n * spent while Codex credits remain spendable (not blocked).\n * - `exhausted` — the binding window is spent and nothing else is left.\n * - `signed-out` — the account is not authenticated; reconnect it.\n * - `unknown` — NO window carried a percent. Not zero, not healthy.\n */\nexport type VerseSeatUsability = 'ready' | 'tight' | 'exhausted' | 'signed-out' | 'unknown';\n\n/**\n * Where a seat's windows came from, so nothing implies freshness it lacks.\n * Mirrors `VerseEvidenceSource` in `core/verse/accounts.ts`.\n */\nexport type VerseSeatEvidenceSource = 'collector' | 'shared-evidence' | 'baseline' | 'none';\n\n/** Everything the seat list needs to draw a capacity meter honestly. */\nexport interface VerseSeatCapacity {\n /** e.g. \"max\", \"pro\", \"SuperGrok\". Null when the provider gave none. */\n planType: string | null;\n /**\n * THE CONSTRAINT THAT ACTUALLY BLOCKS WORK: the window with the highest\n * `usedPercent`. Null when no window carried a percent at all.\n */\n binding: VerseSeatWindow | null;\n /** Every window the provider reported, in provider order. */\n windows: VerseSeatWindow[];\n /** Codex only; null for every other provider and when no signal exists. */\n credits: VerseSeatCredits | null;\n usability: VerseSeatUsability;\n observedAt: string | null;\n evidenceSource: VerseSeatEvidenceSource;\n /** Plain-language provider facts the UI must show instead of implying a fault. */\n notes: string[];\n}\n\nexport interface VerseProject {\n path: string;\n name: string;\n /** From ~/.ashlr/enrollment.json when present. */\n enrolled: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Workspaces (V2.2, ADDITIVE) — see docs/VERSE-WORKSPACES.md §1.\n//\n// A session bound to ONE directory cannot express \"this service plus the\n// shared library it depends on\", which is most real work. A workspace is a\n// NAMED set of roots with exactly one marked primary.\n//\n// `VerseSession.projectPath` keeps its meaning — it IS the primary root — so\n// every session record, adapter and test written before workspaces existed\n// still loads and still runs. Nothing rewrites saved chat history.\n//\n// ENROLLMENT IS NOT PART OF THIS SHAPE ON PURPOSE. A workspace says what a\n// session may REACH; `~/.ashlr/enrollment.json` says what the AUTONOMOUS lane\n// may mutate, and the two are deliberately separate registries. Membership in\n// a workspace grants no enrollment: `enrolled` below is READ from the\n// registry per root and is never written by anything in this feature.\n// ---------------------------------------------------------------------------\n\n/** One directory in a workspace. Exactly one root in a workspace is primary. */\nexport interface VerseWorkspaceRoot {\n /** Absolute, physically resolved path (symlinks followed). */\n path: string;\n /** Display name; defaults to the basename. */\n name: string;\n /**\n * The session's cwd and the value `projectPath` carries. Exactly one root\n * per workspace has this set.\n */\n primary: boolean;\n}\n\n/**\n * A named set of roots.\n *\n * ONE TYPE, TWO USES, DELIBERATELY. An interactive session binds to a\n * workspace to decide what it can reach; the autonomous lane reads the same\n * workspace as a SECTION — \"these repositories collaborate, work on them\n * together\" — when `section` is true. They were not split because the thing\n * being named is identical in both: a set of directories that belong to one\n * piece of work. Two registries of named repo groups would drift.\n *\n * What is NOT on this type is priority. A repo may belong to several\n * workspaces, so a per-membership rank would give one repo several\n * contradictory ranks. Priority is therefore an attribute OF THE REPO, held\n * once per path in the same registry — see `VerseRootPriority`.\n */\nexport interface VerseWorkspace {\n id: string;\n name: string;\n /** Primary first, then the extras in the order they were added. */\n roots: VerseWorkspaceRoot[];\n /**\n * Offer this workspace to the autonomous lane as a section.\n *\n * GRANTS NOTHING. The fleet still reaches only what\n * `~/.ashlr/enrollment.json` permits; a section can group and order those\n * repos and nothing else. A member that is not enrolled stays unreachable.\n */\n section: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\n/**\n * Relative standing of one repository in the autonomous lane's attention.\n *\n * ORDERING ONLY, NEVER ADMISSION. `critical` on an unenrolled repo is still\n * refused by `assertMayMutate`; `low` on an enrolled one is still permitted.\n * An ordinal rather than a number because the operator's judgement here is\n * \"this matters more than that\", and a 0-100 score would invent a precision\n * nobody holds.\n *\n * Absent means `normal`, which is how every repo already behaves — so a\n * registry with no priorities at all reproduces today's flat list exactly.\n */\nexport type VerseRootPriority = 'critical' | 'high' | 'normal' | 'low';\n\nexport const VERSE_ROOT_PRIORITIES: readonly VerseRootPriority[] =\n ['critical', 'high', 'normal', 'low'];\n\nexport const VERSE_DEFAULT_ROOT_PRIORITY: VerseRootPriority = 'normal';\n\n/** Sort weight; lower sorts first. Never a budget, never a multiplier. */\nexport const VERSE_ROOT_PRIORITY_RANK: Record<VerseRootPriority, number> = {\n critical: 0,\n high: 1,\n normal: 2,\n low: 3,\n};\n\n/** One enrolled repository as the autonomy scope view ranks it. */\nexport interface VerseAutonomyScopeEntry {\n path: string;\n name: string;\n priority: VerseRootPriority;\n /** Sections (workspaces with `section: true`) this repo belongs to. */\n sections: Array<{ id: string; name: string }>;\n /** True when a focus section is set and this repo is outside it. */\n outsideFocus: boolean;\n}\n\n/**\n * The autonomous lane's scope, ORDERED.\n *\n * Built by INTERSECTING section membership with the enrollment registry, so\n * it can only ever be a subset of what enrollment already allows. Sections\n * add ordering and grouping; they never add reach.\n */\nexport interface VerseAutonomyScopeView {\n focusSectionId: string | null;\n focusSectionName: string | null;\n /** Enrolled repos, most important first. */\n entries: VerseAutonomyScopeEntry[];\n /**\n * Paths a section names that are NOT enrolled. Listed so the blast radius\n * is legible in both directions — these are exactly the repos a section\n * does NOT give the fleet.\n */\n unenrolledSectionRoots: string[];\n}\n\n/**\n * Per-root git identity. A turn that edits two repos produces two diffs, so\n * the transcript has to be able to attribute each file to the right one.\n *\n * `remote` is the canonical `owner/repo` for a GitHub origin and null for\n * anything else — deliberately NOT the raw remote URL, which can carry a\n * token in its userinfo and would then reach an API response.\n */\nexport interface VerseRootGit {\n branch: string;\n /** Count of porcelain entries; 0 is clean. */\n dirty: number;\n ahead: number;\n behind: number;\n remote: string | null;\n}\n\n/** A root as the client sees it: identity, reachability and honest scope. */\nexport interface VerseRootStatus {\n path: string;\n name: string;\n primary: boolean;\n exists: boolean;\n /**\n * Read live from the enrollment registry. FALSE means the interactive lane\n * still works on this root while the autonomous lane refuses it — being in\n * a workspace never changes this.\n */\n enrolled: boolean;\n /** Null when the root is not a git repository, or git is unavailable. */\n git: VerseRootGit | null;\n /**\n * False when the session's engine has no way to be granted this root (Grok's\n * CLI exposes `--cwd` and nothing else). The root is still listed, because\n * hiding it would misrepresent what the workspace is.\n */\n reachable: boolean;\n}\n\n/** GET /api/verse/sessions/:id/roots */\nexport interface VerseSessionRootsResponse {\n sessionId: string;\n workspaceId: string | null;\n workspaceName: string | null;\n roots: VerseRootStatus[];\n /**\n * Plain-language facts the UI must show rather than imply: an unreachable\n * root on a Grok seat, or a root the autonomous lane will refuse.\n */\n notes: string[];\n}\n\n/** GET /api/verse/workspaces */\nexport interface VerseWorkspacesResponse {\n workspaces: VerseWorkspace[];\n /** Live per-root facts, keyed by workspace id, so one read draws the list. */\n status: Record<string, VerseRootStatus[]>;\n /** Per-repo priority, keyed by canonical path. Absent key means `normal`. */\n priorities: Record<string, VerseRootPriority>;\n focusSectionId: string | null;\n}\n\n/** POST /api/verse/workspaces */\nexport interface VerseWorkspaceCreateRequest {\n name: string;\n /** Absolute paths. The first is the primary. */\n roots: string[];\n /** Also offer this set to the autonomous lane as a section. Default false. */\n section?: boolean;\n}\n\n/** POST /api/verse/workspaces/:id/update */\nexport interface VerseWorkspaceUpdateRequest {\n name?: string;\n /** When present, replaces the root set wholesale. First entry is primary. */\n roots?: string[];\n section?: boolean;\n}\n\n/** POST /api/verse/workspaces/priority */\nexport interface VerseRootPriorityRequest {\n path: string;\n priority: VerseRootPriority;\n}\n\n/** POST /api/verse/workspaces/focus — `sectionId: null` clears the focus. */\nexport interface VerseFocusSectionRequest {\n sectionId: string | null;\n}\n\n/** Hard cap on roots per workspace — a blast radius, not a UI limit. */\nexport const VERSE_MAX_WORKSPACE_ROOTS = 8;\n\n/**\n * Every root a session can reach, primary first.\n *\n * Pure and total: a record written before workspaces existed has no\n * `extraRoots` and yields exactly `[projectPath]`, which is what every caller\n * assumed before this existed.\n */\nexport function verseSessionRoots(\n session: Pick<VerseSession, 'projectPath' | 'extraRoots'>,\n): string[] {\n const out = [session.projectPath];\n for (const root of session.extraRoots ?? []) {\n if (typeof root === 'string' && root.length > 0 && !out.includes(root)) out.push(root);\n }\n return out;\n}\n\nexport interface VerseUsage {\n inputTokens: number;\n outputTokens: number;\n cacheReadTokens: number;\n cacheCreationTokens: number;\n /**\n * Prompt size of the most recent assistant call = live context occupancy.\n * Stored UNCLAMPED: a reading above the window is information (the CLI is\n * about to compact or overflow), and only the UI decides how to draw it.\n */\n contextTokens: number;\n contextWindow: number | null;\n /** V3.9 ADDITIVE. Where `contextWindow` came from; absent on old records. */\n contextWindowSource?: VerseWindowSource;\n /** V3.9 ADDITIVE. Auto-compaction point for the session's current mode. */\n autoCompactAt?: number | null;\n /**\n * V3.9 ADDITIVE. False when `contextTokens` is an UPPER BOUND rather than a\n * measurement (codex before its rollout is readable: the turn total sums\n * every model call). Absent means exact.\n */\n contextTokensExact?: boolean;\n}\n\nexport interface VerseSession {\n id: string;\n title: string;\n /**\n * The PRIMARY root: the process cwd and the folder every pre-workspace\n * client already reads. Unchanged in meaning, which is why no session\n * record ever has to be rewritten.\n */\n projectPath: string;\n /**\n * V2.2 ADDITIVE. Roots BEYOND the primary, pinned at creation time.\n *\n * Absent on every record written before workspaces existed, and absent on\n * a single-root session today — so the on-disk shape of an ordinary chat\n * does not change at all.\n *\n * PINNED, not referenced: a session keeps the roots it was created with\n * even if the named workspace is later edited or deleted, for the same\n * reason `launch.anthropicBaseUrl` is pinned — a conversation must not\n * silently gain reach because config moved underneath it.\n */\n extraRoots?: string[];\n /** V2.2 ADDITIVE. Provenance of the pinned roots; absent for an ad-hoc set. */\n workspaceId?: string;\n workspaceName?: string;\n engine: VerseEngine;\n accountId: string;\n seatId: string;\n model: string;\n /** Vendor conversation id used for resume (claude/grok: our uuid; codex: thread id from output). */\n nativeSessionId: string | null;\n createdAt: string;\n updatedAt: string;\n status: VerseSessionStatus;\n turnCount: number;\n usage: VerseUsage;\n lastError: string | null;\n /**\n * V3.9 ADDITIVE. The session's context budget. Every record written by 3.9+\n * carries it explicitly, so ABSENT means a pre-3.9 record: the engine\n * materializes it on first touch — `expansive` for a Claude 1M model (that\n * is the native ~967k compaction those chats always ran with, so upgrading\n * never forces a paid compaction), `standard` otherwise (= native).\n * Changeable mid-session (POST /sessions/:id/context-mode): it changes CLI\n * flags, not prompt content — but switching DOWN below the current\n * occupancy makes the CLI compact on its next turn.\n */\n contextMode?: VerseContextMode;\n /** V3.9 ADDITIVE. Native compactions observed so far (claude/grok compact_boundary, codex rollout `compacted`). */\n compactionCount?: number;\n /** V3.9 ADDITIVE. Set when this session was started as a handoff from another. */\n handoffFrom?: { sessionId: string; title: string };\n /**\n * V3.9 ADDITIVE. Shared project memory was offered to this session's CLI at\n * creation. Pinned, like the roots: a conversation must not silently gain a\n * writable directory because a preference moved underneath it.\n */\n memoryEnabled?: boolean;\n /**\n * V3.10 ADDITIVE (contract: unit C0; written by C3's engine). The operator's\n * per-chat effort and permission choices, applied from the NEXT turn — a\n * running turn keeps the argv it was launched with. Absent (every record\n * before 3.10, and any key never set) = the engine default: permission mode\n * `accept-edits`, effort = the CLI's own default.\n *\n * A MODEL change is deliberately NOT stored here: it rewrites `model` above,\n * which every launch already reads — one field, one truth.\n */\n controls?: VerseSessionControls;\n}\n\n/**\n * V3.10. Permission modes a chat can run in (SPEC-310C §0.6), in picker order.\n * - `plan` — the CLI plans and edits nothing.\n * - `accept-edits` — the default: edits applied without asking.\n * - `auto` — the CLI's own auto mode.\n * - `bypass` — every check skipped. Shown red and confirmed PER CHAT:\n * never a default, never inherited by a new chat.\n * Adapters map these to each CLI's spelling (claude `acceptEdits` /\n * `bypassPermissions`, grok `dontAsk`, …). An engine that cannot honour one\n * reports it unavailable WITH a reason rather than approximating it. The\n * in-page \"Ask\" mode (answering permission prompts in the UI) is 3.11.\n */\nexport const VERSE_PERMISSION_MODES = ['plan', 'accept-edits', 'auto', 'bypass'] as const;\nexport type VersePermissionMode = (typeof VERSE_PERMISSION_MODES)[number];\nexport const VERSE_DEFAULT_PERMISSION_MODE: VersePermissionMode = 'accept-edits';\n\n/**\n * V3.10. Reasoning effort, the union across engines — claude `--effort`\n * (low · medium · high · xhigh · max) and codex `model_reasoning_effort`\n * (minimal · low · medium · high · xhigh). Each seat offers only the subset\n * its CLI accepts; the rest come back unavailable with a reason.\n */\nexport const VERSE_EFFORTS = ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'] as const;\nexport type VerseEffort = (typeof VERSE_EFFORTS)[number];\n\n/** V3.10. `VerseSession.controls` — absent key = engine default (see there). */\nexport interface VerseSessionControls {\n effort?: VerseEffort;\n permissionMode?: VersePermissionMode;\n}\n\n/** Normalized event stream. `seq` is monotonic per session and is the SSE id. */\nexport type VerseEvent =\n | { seq: number; at: string; type: 'user-message'; turnId: string; text: string }\n | { seq: number; at: string; type: 'turn-started'; turnId: string; pid: number | null }\n | { seq: number; at: string; type: 'text-delta'; turnId: string; text: string }\n | { seq: number; at: string; type: 'assistant-message'; turnId: string; text: string }\n /**\n * Reasoning the CLI chose to show. V3.10 ADDITIVE optional fields (absent on\n * older records = unknown, never \"false\"/\"0\"):\n * - `redacted` the CLI sent a signature-only / redacted block, so `text` is\n * empty but the model DID think (the UI says \"Thought 12s\").\n * - `durationMs` wall time the block took to stream, when measured.\n * - `kind` see VerseThinkingKind.\n */\n | {\n seq: number;\n at: string;\n type: 'thinking';\n turnId: string;\n text: string;\n redacted?: boolean;\n durationMs?: number;\n kind?: VerseThinkingKind;\n }\n | { seq: number; at: string; type: 'tool-use'; turnId: string; toolUseId: string; name: string; input: unknown }\n | { seq: number; at: string; type: 'tool-result'; turnId: string; toolUseId: string; output: string; isError: boolean }\n | { seq: number; at: string; type: 'usage'; turnId: string; usage: VerseUsage }\n | { seq: number; at: string; type: 'turn-done'; turnId: string; ok: boolean; nativeSessionId: string | null; durationMs: number }\n /**\n * `code` (V3.10 ADDITIVE, optional) is a stable machine key for errors the UI\n * or engine acts on — see VERSE_ERROR_CODES. Absent = uncategorised.\n */\n | { seq: number; at: string; type: 'error'; turnId: string | null; message: string; code?: string }\n | { seq: number; at: string; type: 'cancelled'; turnId: string }\n /**\n * V3.9. The CLI compacted its own conversation. Token counts are the CLI's\n * own (`compact_metadata.pre_tokens/post_tokens` on claude/grok). Codex\n * rollouts mark only THAT a compaction happened, so its counts are the last\n * `token_count` reading before the marker and the first one after it —\n * measured, but by Verse, not stated by the CLI; its `durationMs` is null.\n * Any count may be null when no reading brackets the compaction.\n */\n | {\n seq: number;\n at: string;\n type: 'compaction';\n turnId: string | null;\n trigger: 'auto' | 'manual';\n preTokens: number | null;\n postTokens: number | null;\n durationMs: number | null;\n }\n /**\n * V3.9. A context-occupancy READING that is not a usage delta — e.g. codex's\n * rollout `token_count` (exact last-call prompt size and the window the CLI\n * measured it against), polled mid-turn and read again after it. Replaces\n * the session's `contextTokens`; never summed. The engine fills\n * `autoCompactAt` for the window in force.\n */\n | {\n seq: number;\n at: string;\n type: 'context';\n turnId: string | null;\n contextTokens: number;\n contextWindow: number | null;\n exact: boolean;\n autoCompactAt?: number | null;\n /**\n * Where `contextWindow` came from. A CLI reading is `runtime`; the event\n * the engine writes after a MODE SWITCH carries the new budget's catalog\n * source, so a client never relabels a catalog figure as a measurement.\n * Absent on events from before this field existed (treat as `runtime`).\n */\n contextWindowSource?: VerseWindowSource;\n }\n // ── V3.10 TRANSIENT events ────────────────────────────────────────────────\n // Never written to the session log; fanned out to live SSE listeners only\n // (see VERSE_TRANSIENT_EVENT_TYPES for the wire rules). A reload therefore\n // never shows them — everything they convey is either ephemeral (a spinner)\n // or re-stated by a persisted event at turn end (`thinking`, `usage`).\n /** A chunk of streamed reasoning text for the in-flight thinking block. */\n | { seq: number; at: string; type: 'thinking-delta'; turnId: string; text: string }\n /**\n * The CLI reports reasoning volume without text (claude\n * `system/thinking_tokens`). An ESTIMATE, rate-limited by the adapter.\n */\n | { seq: number; at: string; type: 'thinking-progress'; turnId: string; estimatedTokens: number }\n /**\n * What the running turn is doing right now. `tool` names the running tool\n * when phase is `tool`. `outTokens`/`tokPerSec` are absent when unmeasured.\n */\n | {\n seq: number;\n at: string;\n type: 'progress';\n turnId: string;\n phase: VerseProgressPhase;\n tool?: string;\n elapsedMs: number;\n outTokens?: number;\n tokPerSec?: number;\n }\n /** A human-readable notice about the turn's plumbing (API retry, preflight, no-output watchdog). */\n | { seq: number; at: string; type: 'status'; turnId: string | null; kind: VerseStatusKind; message: string }\n // ── V3.10 PERSISTED events ────────────────────────────────────────────────\n /**\n * The engine recovered from a lost native conversation (e.g. the vendor\n * thread vanished) by starting a new native session seeded with the handoff\n * note (`how: 'handoff'`) or a bare new session (`new-native-session`).\n */\n | { seq: number; at: string; type: 'recovered'; turnId: string | null; how: VerseRecoveryHow; message: string }\n /**\n * The log hit its cap and events with `seq < droppedBefore` were dropped at\n * a TURN boundary (never mid-turn). `turnId` is always null — it is present\n * only so code reading `event.turnId` across the union keeps typechecking.\n */\n | { seq: number; at: string; type: 'history-truncated'; turnId: null; droppedBefore: number };\n\nexport type VerseEventType = VerseEvent['type'];\n\n/** V3.10. `summary` = vendor-summarised reasoning, `raw` = verbatim, `progress` = a heading/placeholder only. */\nexport type VerseThinkingKind = 'summary' | 'raw' | 'progress';\n\n/** V3.10. Phase of a running turn, carried by the transient `progress` event. */\nexport type VerseProgressPhase = 'thinking' | 'tool' | 'writing' | 'waiting';\n\n/** V3.10. What a transient `status` notice is about. */\nexport type VerseStatusKind = 'retry' | 'preflight' | 'watchdog';\n\n/** V3.10. How a `recovered` event restored the conversation. */\nexport type VerseRecoveryHow = 'new-native-session' | 'handoff';\n\n/**\n * V3.10. Known `error.code` values. `code` stays `string` on the wire so an\n * older client never rejects a newer code; these are the ones Verse acts on.\n * - `native-thread-missing` — the vendor conversation to resume no longer exists.\n * - `session-in-use` — the CLI refused because the native session id is locked.\n */\nexport const VERSE_ERROR_CODES = ['native-thread-missing', 'session-in-use'] as const;\nexport type VerseErrorCode = (typeof VERSE_ERROR_CODES)[number];\n\n/**\n * V3.10. Event types that are NEVER persisted — emitted to live SSE listeners\n * only. Wire rules (A5 server, A6 client):\n * - a transient event carries `seq` = the session's LAST PERSISTED seq (the\n * counter does not advance), so the stored log stays gap-free and a server\n * restart can never reissue a seq a client already saw;\n * - its SSE frame has NO `id:` line, so the browser's Last-Event-ID resume\n * cursor only ever points at persisted events;\n * - clients must not dedupe, store or resume by a transient event's seq.\n * Browser-safe (plain Set), imported by the web bundle.\n */\nconst TRANSIENT_EVENT_TYPE_LIST = [\n 'thinking-delta',\n 'thinking-progress',\n 'progress',\n 'status',\n] as const satisfies readonly VerseEventType[];\n\nexport const VERSE_TRANSIENT_EVENT_TYPES: ReadonlySet<VerseEventType> = new Set<VerseEventType>(TRANSIENT_EVENT_TYPE_LIST);\n\nexport type VerseTransientEventType = (typeof TRANSIENT_EVENT_TYPE_LIST)[number];\nexport type VerseTransientEvent = Extract<VerseEvent, { type: VerseTransientEventType }>;\nexport type VersePersistedEvent = Exclude<VerseEvent, { type: VerseTransientEventType }>;\n\n/** V3.10. Type guard over VERSE_TRANSIENT_EVENT_TYPES. */\nexport function isTransientVerseEvent(event: VerseEvent): event is VerseTransientEvent {\n return VERSE_TRANSIENT_EVENT_TYPES.has(event.type);\n}\n\n/**\n * Which endpoint a LOCAL seat sends its turns to.\n *\n * - `ollama` — the historical lane: the plain `claude` binary with\n * ANTHROPIC_BASE_URL pointed straight at Ollama's\n * Anthropic-compatible endpoint on :11434. Ollama\n * serialises this model architecture, so a fleet of local\n * agents on this lane is a queue (docs/LOCAL-FLEET.md).\n * - `llama-server` — the same binary pointed at the local Anthropic\n * normalising proxy that fronts llama-server. That proxy\n * is the ONLY way to reach llama-server's parallel slots\n * and the prompt-cache fix, because Qwen3.8's chat\n * template rejects Claude Code's request shape unless the\n * proxy rewrites it on the way through.\n *\n * DISPATCH ONLY. Model DISCOVERY stays on Ollama in both lanes — llama-server\n * implements neither `/api/tags` nor `/api/show`, which is where every local\n * seat's identity, context window and `tools` capability comes from.\n */\nexport type VerseLocalDispatch = 'ollama' | 'llama-server';\n\n/** What a client is told about this machine's local serving situation. */\nexport interface VerseLocalRuntimeSummary {\n /** Ollama reachable? Drives the local seats and an inline hint when false. */\n ollama: { reachable: boolean; baseUrl: string; models: string[] };\n /**\n * Where local seats DISPATCH turns, reported only when that is NOT the\n * default Ollama lane.\n *\n * Absent means `ollama`, i.e. exactly what every existing client already\n * assumes — so opting in is visible on the wire and NOT opting in changes no\n * payload at all.\n */\n dispatch?: { lane: VerseLocalDispatch; baseUrl: string };\n}\n\n/** GET /api/verse/bootstrap */\nexport interface VerseBootstrap {\n seats: VerseSeat[];\n projects: VerseProject[];\n sessions: VerseSession[];\n /** Whether POST routes are enabled on this server (`ashlr serve --allow-dispatch` / `ashlr verse`). */\n dispatchEnabled: boolean;\n localRuntime: VerseLocalRuntimeSummary;\n}\n\n/**\n * GET /api/verse/seats (V2.1)\n *\n * WHY THIS ROUTE EXISTS: `bootstrap` is a MOUNT-TIME snapshot. A client that\n * opened the app before the collector's first cycle finished would show\n * \"unknown\" forever. This is the same seat list, cheap enough to poll, and it\n * always reflects the collector's CURRENT state rather than a cached one.\n */\nexport interface VerseSeatsResponse {\n /** When this body was built. */\n sampledAt: string;\n seats: VerseSeat[];\n localRuntime: VerseBootstrap['localRuntime'];\n}\n\n/**\n * POST /api/verse/sessions\n *\n * Two spellings, never mixed (the API rejects the mix rather than silently\n * preferring one):\n * - `workspaceId` alone — the named workspace supplies primary and extras.\n * - `projectPath` (+ optional `extraRoots`) — an ad-hoc set, which is also\n * exactly the pre-workspace request shape.\n */\nexport interface VerseCreateSessionRequest {\n projectPath: string;\n seatId: string;\n model?: string;\n title?: string;\n /** V2.2 ADDITIVE. Absolute paths beyond the primary. */\n extraRoots?: string[];\n /** V2.2 ADDITIVE. Bind to a named workspace instead of naming paths. */\n workspaceId?: string;\n /**\n * SERVER-FILLED. The API resolves this from the registry once `workspaceId`\n * is validated, and never reads it off the request body — so a session can\n * not be labelled with a workspace name that is not the one it was built\n * from.\n */\n workspaceName?: string;\n /**\n * V3.9 ADDITIVE. Absent → the seat's preferred mode (preferences.json), else\n * `standard`. `expansive` on a model with no expansive budget is rejected.\n */\n contextMode?: VerseContextMode;\n /**\n * V3.9 ADDITIVE. Start this session as a handoff from an existing one. The\n * server resolves the source's title itself (never from the body) and pins\n * `handoffFrom`; the handoff TEXT is sent by the client as turn 1, after the\n * operator has read it — nothing is spent on their behalf.\n */\n handoffFromSessionId?: string;\n}\n\n/** POST /api/verse/sessions/:id/turns */\nexport interface VerseTurnRequest {\n text: string;\n}\nexport interface VerseTurnResponse {\n turnId: string;\n session: VerseSession;\n}\n\n/** GET /api/verse/sessions/:id */\nexport interface VerseSessionDetail {\n session: VerseSession;\n events: VerseEvent[];\n}\n\n/** Adapter input: how to launch one turn. Pure data, produced by the engine, consumed by the spawner. */\nexport interface VerseTurnLaunch {\n argv: string[];\n cwd: string;\n /** Extra env layered over a minimal base (PATH/HOME/TMPDIR/LANG). Never contains secrets. */\n env: Record<string, string>;\n /** Text written to stdin (codex); null when the prompt is in argv. */\n stdin: string | null;\n}\n\nexport const VERSE_MAX_TURN_TEXT_BYTES = 64 * 1024;\nexport const VERSE_MAX_EVENTS_PER_SESSION = 20_000;\nexport const VERSE_TURN_TIMEOUT_MS = 30 * 60 * 1000;\n/**\n * LAST-RESORT fallbacks, used only when neither the runtime, the seat's own\n * catalog, nor the verified per-model table (core/verse/model-windows.ts) knows\n * the model. Each mirrors what the CLI ITSELF assumes for an unknown id, so the\n * meter never claims more than the CLI will allow:\n *\n * - claude 200_000 — Claude Code's `Mg()` default for an unrecognized model.\n * Every KNOWN Claude id carries its real window (1M for the 5.x family,\n * Opus 4.8 and Sonnet 5) in the per-model table instead.\n * - codex 258_400 — 272_000 × the 95% `effective_context_window_percent`\n * every codex catalog entry carries; the figure codex's own rollouts report\n * as `model_context_window` (65,440 of 65,440 observed events).\n * - grok 500_000 — `context_window` for every grok-4.x id in the seat catalog.\n * - local 65_536 — the num_ctx the default local tag pins.\n */\nexport const VERSE_DEFAULT_CONTEXT_WINDOWS: Record<string, number> = {\n claude: 200_000,\n codex: 258_400,\n grok: 500_000,\n local: 65_536,\n};\n\n// ---------------------------------------------------------------------------\n// V3.9 context orchestration — request/response shapes (docs/VERSE-CONTEXT.md)\n// ---------------------------------------------------------------------------\n\n/** GET /api/verse/preferences — the operator's standing context choices. */\nexport interface VersePreferences {\n version: 1;\n /** Per-seat default context mode for NEW sessions. Absent = `standard`. */\n seats: Record<string, { contextMode?: VerseContextMode }>;\n /** Shared project memory. On by default; listed canonical paths opt out. */\n memory: { enabled: boolean; disabledProjects: string[] };\n /**\n * V3.10 ADDITIVE. Stream vendor-summarised reasoning on non-local seats\n * (claude `--thinking-display summarized`). Absent = on (Mason's default).\n */\n thinkingDisplay?: boolean;\n}\n\n/**\n * POST /api/verse/preferences — exactly ONE of the three forms per request, so\n * a body can never change more than the operator clicked.\n */\nexport type VersePreferencesUpdate =\n | { seatId: string; contextMode: VerseContextMode }\n | { memoryEnabled: boolean }\n | { projectPath: string; memoryEnabled: boolean };\n\n/** POST /api/verse/sessions/:id/context-mode */\nexport interface VerseContextModeRequest {\n mode: VerseContextMode;\n}\n\n/** POST /api/verse/sessions/:id/handoff-preview */\nexport interface VerseHandoffPreviewRequest {\n /**\n * Include the latest assistant message verbatim (capped) as the agent's own\n * summary — used after \"Ask this seat to summarize\" produced one.\n */\n includeLastAssistant?: boolean;\n /** Optional operator focus line, e.g. \"finish the migration of X\". ≤ 500 chars. */\n focus?: string;\n}\n\n/** Deterministic, zero-spend handoff note built from the session's event log. */\nexport interface VerseHandoffPreview {\n sourceSessionId: string;\n sourceTitle: string;\n /** The exact text to send as turn 1 of the new session. ≤ VERSE_HANDOFF_MAX_CHARS. */\n text: string;\n stats: {\n chars: number;\n /** chars / 4, rounded up — the same estimator the fit badges use. */\n estTokens: number;\n turnsCovered: number;\n filesTouched: number;\n /** Sections dropped to respect the cap, by name; empty when nothing was cut. */\n truncated: string[];\n };\n}\n\nexport const VERSE_HANDOFF_MAX_CHARS = 12_000;\n\n/**\n * The canned turn behind \"Ask this seat to summarize first\". Shared by the UI\n * (which sends it as an ordinary turn through the normal spend chokepoint) and\n * the handoff builder (which must NOT carry it into the new session as the\n * operator's \"latest ask\" — the new chat would otherwise be told to write a\n * handoff note instead of continuing the work).\n *\n * Written so the reply is useful as turn 1 of a session that has NONE of this\n * context. It asks for no tool use on purpose: a summary that starts editing\n * files is not a summary, and a read-only turn is also the cheapest one.\n */\nexport const VERSE_HANDOFF_SUMMARY_REQUEST = [\n 'This conversation is about to continue in a fresh session that has none of its context.',\n 'Write the handoff note that new session should start from. Do not edit files or run commands for this — only write the note.',\n '',\n 'Cover, concretely:',\n '- The goal, and what \"done\" looks like.',\n '- Decisions made so far, each with the reason it was made.',\n '- Current state: what is finished, what is half-done, what is untested.',\n '- Files changed and anything not yet committed.',\n '- How to verify the work (exact commands).',\n '- Open questions, risks, and approaches already tried that did not work.',\n '',\n 'Keep it under 600 words. Prefer file paths and commands over prose.',\n].join('\\n');\n\n/** GET /api/verse/context-fit — how big the reachable code is, in tokens. */\nexport interface VerseContextFitRoot {\n path: string;\n /** Tracked text files counted (git ls-files, binaries and >1 MB files skipped). */\n files: number;\n bytes: number;\n estTokens: number;\n /** True when the scan hit its file or time cap; estTokens is then a floor. */\n truncated: boolean;\n}\n\nexport interface VerseContextFit {\n roots: VerseContextFitRoot[];\n totalEstTokens: number;\n /** Always 'bytes/4' today; named so a better estimator can be introduced honestly. */\n estimator: 'bytes/4';\n sampledAt: string;\n}\n\n/**\n * Per-model verdict for a working set (see context-math.ts `fitVerdict`):\n * fits in standard, tight in standard, fits only in expansive, or too big for\n * any single context (split the work).\n */\nexport type VerseFitVerdict = 'fits' | 'tight' | 'expansive' | 'split';\n\n/** GET /api/verse/search?q=&limit= — keyword search over past sessions. Zero spend. */\nexport interface VerseSearchHit {\n sessionId: string;\n title: string;\n projectPath: string;\n engine: VerseEngine;\n seq: number;\n at: string;\n kind: 'user' | 'assistant';\n /** ≤ 240 chars around the first match, whitespace-collapsed. */\n snippet: string;\n score: number;\n}\n\nexport interface VerseSearchResponse {\n query: string;\n hits: VerseSearchHit[];\n /** Sessions actually scanned (the scan is bounded; see session-search.ts). */\n scannedSessions: number;\n truncated: boolean;\n}\n\n/** GET/POST /api/verse/memory — shared project memory for one project. */\nexport interface VerseProjectMemory {\n projectPath: string;\n enabled: boolean;\n /** Contents of MEMORY.md ('' when absent). */\n content: string;\n bytes: number;\n updatedAt: string | null;\n /** Other files the agents created in the memory directory (names only). */\n files: string[];\n /**\n * Present (true) only when `content` as SENT differs from the bytes on disk:\n * the public-JSON sanitizer rewrote the home path to `~` or replaced a\n * secret-looking value with `[REDACTED]`. The file itself is untouched; a\n * save that would write placeholders over real values is refused (409\n * VERSE_MEMORY_REDACTED), so the editor must say so before the operator types.\n */\n contentSanitized?: boolean;\n}\n\n/** POST /api/verse/memory */\nexport interface VerseProjectMemoryWrite {\n projectPath: string;\n content: string;\n}\n\nexport const VERSE_MEMORY_MAX_BYTES = 64 * 1024;\n\n/**\n * POST /api/verse/memory's own JSON body cap: JSON escaping can double the\n * content (every newline becomes `\\\\n`), plus room for the other fields. Every\n * other route keeps the 64 KiB default. Shared so the browser's pre-check can\n * never refuse a save the server would accept.\n */\nexport const VERSE_MEMORY_BODY_MAX_BYTES = 2 * VERSE_MEMORY_MAX_BYTES + 8 * 1024;\n\n/** Cap on the memory block appended to each session's system prompt. */\nexport const VERSE_MEMORY_BLOCK_MAX_BYTES = 6 * 1024;\n","/**\n * routes/verse/verse-store.ts — per-session transcript state for the Verse\n * console. Framework-free (useSyncExternalStore glue lives in\n * useVerseSession.ts, the live stream in session-stream.ts), same split as\n * data/cache.ts + data/hooks.ts.\n *\n * One entry per session id holds the ordered, seq-deduplicated event log,\n * the latest session record we know of, the stream connection state, and —\n * V3.10 — the LIVE state of a running turn (reasoning streaming in, what the\n * turn is doing, retry/watchdog notices), which is fed by transient events\n * that are never persisted and never enter the event log.\n * Snapshots are replaced wholesale on every change (Object.is semantics —\n * see DESIGN.md §3 for the bug that rule prevents).\n *\n * V3.10 DATA PATH. The previous store merged every event with a Map + spread\n * + sort and told every subscriber about it: replaying 5k events took 2.45 s\n * and 10k took 17 s, and every streamed token re-rendered the whole Chat\n * section. Now:\n *\n * - `applyVerseEvents` applies a BATCH: an event past the newest seq is a\n * plain append (one array copy per batch, not per event), an older one\n * is binary-searched (duplicate → dropped, gap → inserted in place);\n * - subscribers are per session (`subscribeVerseSession`) and read one of\n * three snapshots that change independently:\n * · the HEAD (`getVerseSessionHead`) — session record, stream state\n * and the event log as of the last STRUCTURAL event. A text-delta\n * alone does not republish it, so the sidebar, header and resources\n * panel do not re-render per token;\n * · the TRANSCRIPT (`getVerseTranscript`) — derived lazily, per turn\n * segment, with unchanged turns returned as the same objects so the\n * renderer can skip them;\n * · the LIVE state (`getVerseLive`) — transient signals only.\n * - the stream (session-stream.ts) calls `applyVerseEvents` once per\n * animation frame, so a burst of frames costs one render.\n *\n * `buildTranscript()` derives what the transcript renders from the raw\n * events: streamed `text-delta`s accumulate into a provisional assistant\n * bubble until the matching `assistant-message` arrives and replaces it;\n * `tool-use` and `tool-result` pair up by toolUseId into one card.\n */\nimport type { VerseEvent, VerseSession, VerseUsage } from '../../data/api-types.js';\nimport {\n isTransientVerseEvent,\n type VerseProgressPhase,\n type VerseRecoveryHow,\n type VerseStatusKind,\n type VerseThinkingKind,\n type VerseTransientEvent,\n type VerseWindowSource,\n} from '../../../core/verse/types.js';\nimport { reconcileAutoCompactAt } from '../../../core/verse/context-math.js';\n\nexport type VerseStreamState = 'idle' | 'connecting' | 'open' | 'reconnecting' | 'closed';\n\n// ---------------------------------------------------------------------------\n// Live (transient) state\n// ---------------------------------------------------------------------------\n\n/** The reasoning block currently streaming in (`thinking-delta` / `thinking-progress`). */\nexport interface VerseLiveThinking {\n turnId: string;\n /** Streamed text so far; empty when the CLI reports only a token estimate. */\n text: string;\n /** Client clock (ms) when this block's first signal arrived. */\n startedAt: number;\n /** Latest `thinking-progress` estimate; null when the CLI sent none (unknown, never 0). */\n estimatedTokens: number | null;\n}\n\nexport interface VerseLiveProgress {\n phase: VerseProgressPhase;\n tool: string | null;\n /** Server-measured turn wall time when the frame was sent. */\n elapsedMs: number;\n outTokens: number | null;\n tokPerSec: number | null;\n /** Client clock (ms) the frame arrived, so elapsed can keep counting between frames. */\n receivedAt: number;\n}\n\nexport interface VerseLiveNotice {\n kind: VerseStatusKind;\n message: string;\n at: string;\n receivedAt: number;\n}\n\nexport interface VerseLiveState {\n /** The running turn these signals belong to; null when none is running. */\n turnId: string | null;\n /** Client clock (ms) the running turn started, from its `turn-started` stamp when parseable. */\n startedAt: number | null;\n progress: VerseLiveProgress | null;\n thinking: VerseLiveThinking | null;\n /** The latest plumbing notice (API retry, preflight, no-output watchdog); cleared when output resumes. */\n notice: VerseLiveNotice | null;\n /** Last turn that settled, so a late transient frame for it cannot resurrect the live line. */\n settledTurnId: string | null;\n}\n\n/** What this tab measured about a reasoning block while it streamed — keyed by the persisted `thinking` event's seq. */\nexport interface VerseThinkingStat {\n durationMs: number | null;\n estimatedTokens: number | null;\n}\n\nconst EMPTY_LIVE: VerseLiveState = {\n turnId: null,\n startedAt: null,\n progress: null,\n thinking: null,\n notice: null,\n settledTurnId: null,\n};\n\n// ---------------------------------------------------------------------------\n// Entries, heads and subscriptions\n// ---------------------------------------------------------------------------\n\nexport interface VerseSessionState {\n sessionId: string;\n session: VerseSession | null;\n events: VerseEvent[];\n /** Highest PERSISTED seq held — the resume cursor. Transient frames never move it. */\n lastSeq: number;\n loaded: boolean;\n loadError: string | null;\n stream: VerseStreamState;\n /** V3.10 transient signals of the running turn. */\n live: VerseLiveState;\n}\n\n/**\n * Everything about a session EXCEPT its live signals, republished only on\n * structural change. `events` is the log as of the last non-`text-delta`\n * event: streamed tokens reach the transcript through its own subscription,\n * so a consumer of the head (session record, meters, activity stats) never\n * re-renders per token. Code that needs every delta reads\n * `getVerseSessionState` or `getVerseTranscript` instead.\n */\nexport type VerseSessionHead = Omit<VerseSessionState, 'live'>;\n\nconst EMPTY: Omit<VerseSessionState, 'sessionId'> = {\n session: null,\n events: [],\n lastSeq: 0,\n loaded: false,\n loadError: null,\n stream: 'idle',\n live: EMPTY_LIVE,\n};\n\nconst sessions = new Map<string, VerseSessionState>();\nconst heads = new Map<string, VerseSessionHead>();\nconst thinkingStats = new Map<string, Map<number, VerseThinkingStat>>();\nconst transcriptMemo = new Map<string, { events: readonly VerseEvent[]; transcript: Transcript; cache: TranscriptCache }>();\nconst listeners = new Set<() => void>();\nconst sessionListeners = new Map<string, Set<() => void>>();\n\nexport type VerseStoreLifecycle = { kind: 'reset' } | { kind: 'forget'; sessionId: string };\nconst lifecycleListeners = new Set<(event: VerseStoreLifecycle) => void>();\n\nfunction notify(sessionId: string | null): void {\n if (sessionId !== null) {\n const scoped = sessionListeners.get(sessionId);\n if (scoped) for (const l of [...scoped]) l();\n } else {\n for (const set of [...sessionListeners.values()]) for (const l of [...set]) l();\n }\n for (const l of [...listeners]) l();\n}\n\n/** Every change to every session. Prefer `subscribeVerseSession` in components. */\nexport function subscribeVerseStore(listener: () => void): () => void {\n listeners.add(listener);\n return () => listeners.delete(listener);\n}\n\n/** Changes to ONE session only — what a component showing that session subscribes to. */\nexport function subscribeVerseSession(sessionId: string, listener: () => void): () => void {\n let set = sessionListeners.get(sessionId);\n if (!set) {\n set = new Set();\n sessionListeners.set(sessionId, set);\n }\n set.add(listener);\n return () => {\n const current = sessionListeners.get(sessionId);\n if (!current) return;\n current.delete(listener);\n if (current.size === 0) sessionListeners.delete(sessionId);\n };\n}\n\n/**\n * Reset / forget notifications, so the live-stream registry can close the\n * connection of a chat that was deleted or of a store that was cleared on\n * logout (and so tests never inherit a previous test's stream).\n */\nexport function subscribeVerseStoreLifecycle(listener: (event: VerseStoreLifecycle) => void): () => void {\n lifecycleListeners.add(listener);\n return () => lifecycleListeners.delete(listener);\n}\n\nfunction headOf(state: VerseSessionState): VerseSessionHead {\n return {\n sessionId: state.sessionId,\n session: state.session,\n events: state.events,\n lastSeq: state.lastSeq,\n loaded: state.loaded,\n loadError: state.loadError,\n stream: state.stream,\n };\n}\n\nfunction entryFor(sessionId: string): VerseSessionState {\n let e = sessions.get(sessionId);\n if (!e) {\n e = { sessionId, ...EMPTY };\n sessions.set(sessionId, e);\n heads.set(sessionId, headOf(e));\n }\n return e;\n}\n\n/**\n * Store `next` and republish the head when anything it carries changed.\n * `structural` = the event log gained something other than a text-delta.\n */\nfunction commit(sessionId: string, next: VerseSessionState, structural: boolean): void {\n sessions.set(sessionId, next);\n const head = heads.get(sessionId);\n if (\n !head || structural || head.session !== next.session || head.loaded !== next.loaded ||\n head.loadError !== next.loadError || head.stream !== next.stream\n ) {\n heads.set(sessionId, headOf(next));\n }\n}\n\nfunction patch(sessionId: string, delta: Partial<VerseSessionState>, structural = false): void {\n const current = entryFor(sessionId);\n commit(sessionId, { ...current, ...delta }, structural);\n notify(sessionId);\n}\n\nconst NONE: VerseSessionState = { sessionId: '', ...EMPTY };\nconst NONE_HEAD: VerseSessionHead = headOf(NONE);\n\n/** Stable reference until the entry changes, so useSyncExternalStore is happy. */\nexport function getVerseSessionState(sessionId: string | null): VerseSessionState {\n if (!sessionId) return NONE;\n return entryFor(sessionId);\n}\n\n/** The head snapshot (see VerseSessionHead) — stable across text-deltas. */\nexport function getVerseSessionHead(sessionId: string | null): VerseSessionHead {\n if (!sessionId) return NONE_HEAD;\n entryFor(sessionId);\n return heads.get(sessionId)!;\n}\n\n/** Live signals of the running turn; the same object until one of them changes. */\nexport function getVerseLive(sessionId: string | null): VerseLiveState {\n if (!sessionId) return EMPTY_LIVE;\n return entryFor(sessionId).live;\n}\n\nconst EMPTY_TRANSCRIPT: Transcript = { items: [], live: false, usage: null, segments: [] };\n\n/**\n * The derived transcript, rebuilt only when the event log changed and then\n * only for the turn segments that changed (see buildTranscript's cache).\n */\nexport function getVerseTranscript(sessionId: string | null): Transcript {\n if (!sessionId) return EMPTY_TRANSCRIPT;\n const entry = entryFor(sessionId);\n const memo = transcriptMemo.get(sessionId);\n if (memo && memo.events === entry.events) return memo.transcript;\n const cache = memo?.cache ?? createTranscriptCache();\n const transcript = buildTranscript(entry.events, { cache, thinkingStats: thinkingStats.get(sessionId) });\n transcriptMemo.set(sessionId, { events: entry.events, transcript, cache });\n return transcript;\n}\n\n/** Merge a fetched detail (session + full event log) into the entry. Events\n * already known (same seq) are kept once; the union stays sorted by seq. The\n * detail fetch can race a live stream, so a `turn-done` that streamed in\n * meanwhile wins over the older `running` snapshot. A refetch that brings\n * nothing new changes nothing — no re-render. */\nexport function seedVerseSession(sessionId: string, session: VerseSession, events: readonly VerseEvent[]): void {\n const current = entryFor(sessionId);\n const merged = mergeEvents(current.events, events);\n const settled = settledStatus(session, merged);\n const nextSession = current.session && sameSession(current.session, settled) ? current.session : settled;\n const eventsChanged = merged !== current.events;\n const live = eventsChanged || nextSession !== current.session ? liveFromLog(current.live, merged, nextSession) : current.live;\n if (!eventsChanged && nextSession === current.session && current.loaded && current.loadError === null && live === current.live) return;\n commit(sessionId, {\n ...current,\n session: nextSession,\n events: merged,\n lastSeq: merged.length ? Math.max(current.lastSeq, merged[merged.length - 1]!.seq) : current.lastSeq,\n loaded: true,\n loadError: null,\n live,\n }, eventsChanged);\n notify(sessionId);\n}\n\nexport function setVerseLoadError(sessionId: string, message: string): void {\n patch(sessionId, { loadError: message, loaded: true });\n}\n\nexport function setVerseStreamState(sessionId: string, stream: VerseStreamState): void {\n if (entryFor(sessionId).stream === stream) return;\n patch(sessionId, { stream });\n}\n\n/**\n * Replace the session record (after a turn POST / rename / list refresh).\n * `turnId` is the turn the snapshot claims is running (POST …/turns returns\n * it): when the log already holds that turn's `turn-done`/`cancelled` — a\n * spawn failure settles in the same tick as the 202 — the snapshot is stale\n * and must not drag the composer back to running.\n */\nexport function setVerseSession(sessionId: string, session: VerseSession, turnId?: string): void {\n const current = entryFor(sessionId);\n patch(sessionId, { session: settledStatus(session, current.events, turnId) });\n}\n\n/**\n * Reconcile a `running` snapshot against the event log. Without a `turnId`\n * the running turn is the last `user-message`/`turn-started` in the log; a\n * later `turn-done`/`cancelled` means the server already settled it. With a\n * `turnId`, only that turn's terminal event counts (its `user-message` may\n * not have streamed in yet, so a previous turn's `turn-done` proves nothing).\n * Status follows the same rules applyVerseEvent uses: cancelled → idle,\n * `turn-done ok:false` → error only when an `error` event was logged for it.\n */\nexport function settledStatus(session: VerseSession, events: readonly VerseEvent[], turnId?: string): VerseSession {\n if (session.status !== 'running') return session;\n let anchorSeq = -1;\n let anchorTurn: string | null = turnId ?? null;\n if (!turnId) {\n for (const e of events) {\n if (e.type === 'user-message' || e.type === 'turn-started') {\n anchorSeq = e.seq;\n anchorTurn = e.turnId;\n }\n }\n if (anchorTurn === null) return session;\n }\n let terminal: Extract<VerseEvent, { type: 'turn-done' | 'cancelled' }> | null = null;\n let lastError: string | null = null;\n for (const e of events) {\n if (e.seq <= anchorSeq) continue;\n if (e.type === 'error' && e.turnId === anchorTurn) lastError = e.message;\n if ((e.type === 'turn-done' || e.type === 'cancelled') && e.turnId === anchorTurn) terminal = e;\n }\n if (!terminal) return session;\n const failed = terminal.type === 'turn-done' && !terminal.ok && lastError !== null;\n return {\n ...session,\n status: failed ? 'error' : 'idle',\n lastError: failed ? lastError : null,\n updatedAt: terminal.at > session.updatedAt ? terminal.at : session.updatedAt,\n };\n}\n\n/** Optimistic status flip (e.g. right after POST …/turns returns 202). */\nexport function setVerseSessionStatus(sessionId: string, status: VerseSession['status']): void {\n const current = entryFor(sessionId);\n if (!current.session || current.session.status === status) return;\n patch(sessionId, { session: { ...current.session, status } });\n}\n\nexport interface VerseApplyResult {\n /** Persisted events newly added to the log (duplicates excluded). */\n applied: number;\n /** A newly added event settled a turn (`turn-done` / `cancelled` / `error`) — the lists may be stale. */\n settled: boolean;\n /** A transient frame changed the live state. */\n liveChanged: boolean;\n}\n\n/**\n * Apply a BATCH of live events in arrival order, then notify once.\n *\n * Persisted events: duplicates (a stream that replays from the start, or a\n * resume that overlaps the detail fetch) are dropped by seq; an event past\n * the newest seq is appended; an older unseen one is inserted in place.\n * Session-level side effects: `usage` and `context` update the live context\n * meter, `compaction` counts a native compaction, `turn-started` flips\n * status to running, `turn-done`/`cancelled`/`error` settle it, and a codex\n * `turn-done.nativeSessionId` is captured.\n *\n * Transient events (VERSE_TRANSIENT_EVENT_TYPES) never enter the log and\n * never move `lastSeq`: they carry the last PERSISTED seq, so deduping them\n * by seq would drop every one of them. They only update `live`.\n */\nexport function applyVerseEvents(sessionId: string, incoming: readonly VerseEvent[]): VerseApplyResult {\n const current = entryFor(sessionId);\n let events: VerseEvent[] = current.events;\n let copied = false;\n let lastSeq = current.lastSeq;\n let session = current.session;\n let live = current.live;\n let applied = 0;\n let settled = false;\n let structural = false;\n let liveChanged = false;\n const now = Date.now();\n\n for (const event of incoming) {\n if (isTransientVerseEvent(event)) {\n const next = applyTransient(live, event, now);\n if (next !== live) {\n live = next;\n liveChanged = true;\n }\n continue;\n }\n if (!Number.isFinite(event.seq)) continue;\n const tail = events.length > 0 ? events[events.length - 1]!.seq : -Infinity;\n if (event.seq > tail) {\n if (!copied) {\n events = events.slice();\n copied = true;\n }\n events.push(event);\n } else {\n const at = seqIndex(events, event.seq);\n if (at.found) continue;\n if (!copied) {\n events = events.slice();\n copied = true;\n }\n events.splice(at.index, 0, event);\n }\n applied += 1;\n lastSeq = Math.max(lastSeq, event.seq);\n if (event.type !== 'text-delta') structural = true;\n if (event.type === 'turn-done' || event.type === 'cancelled' || event.type === 'error') settled = true;\n if (session) session = sessionAfter(session, event);\n const nextLive = livePersisted(live, event, now, sessionId);\n if (nextLive !== live) live = nextLive;\n }\n\n if (applied === 0 && !liveChanged) return { applied: 0, settled: false, liveChanged: false };\n commit(sessionId, { ...current, events, lastSeq, session, live }, structural);\n notify(sessionId);\n return { applied, settled, liveChanged };\n}\n\n/**\n * Apply one live event (the single-event form of applyVerseEvents). Returns\n * true when the log gained the event, or — for a transient frame — when the\n * live state changed.\n */\nexport function applyVerseEvent(sessionId: string, event: VerseEvent): boolean {\n const result = applyVerseEvents(sessionId, [event]);\n return result.applied > 0 || result.liveChanged;\n}\n\n/** A persisted event's effect on the session record (the old applyVerseEvent switch). */\nfunction sessionAfter(session: VerseSession, event: VerseEvent): VerseSession {\n switch (event.type) {\n case 'turn-started':\n return { ...session, status: 'running', lastError: null, updatedAt: event.at };\n case 'usage':\n return { ...session, usage: applyUsageFrame(session, event.usage), updatedAt: event.at };\n case 'context':\n return { ...session, usage: applyContextReading(session, event), updatedAt: event.at };\n case 'compaction':\n // Counted exactly as the server counts it (session-engine), so a reload\n // shows the same number the live stream did. Occupancy is NOT touched\n // here: the next `usage`/`context` reading is the measurement.\n return { ...session, compactionCount: (session.compactionCount ?? 0) + 1, updatedAt: event.at };\n case 'turn-done':\n return {\n ...session,\n status: event.ok ? 'idle' : session.lastError ? 'error' : 'idle',\n turnCount: session.turnCount + 1,\n nativeSessionId: event.nativeSessionId ?? session.nativeSessionId,\n updatedAt: event.at,\n };\n case 'error':\n return { ...session, status: 'error', lastError: event.message, updatedAt: event.at };\n case 'cancelled':\n return { ...session, status: 'idle', updatedAt: event.at };\n default:\n return session;\n }\n}\n\nfunction stampMs(at: string, fallback: number): number {\n const parsed = Date.parse(at);\n return Number.isFinite(parsed) ? parsed : fallback;\n}\n\n/** Enter (or stay in) the live context of `turnId`. */\nfunction liveForTurn(live: VerseLiveState, turnId: string, startedAt: number): VerseLiveState {\n if (live.turnId === turnId) return live;\n return { ...EMPTY_LIVE, turnId, startedAt, settledTurnId: live.settledTurnId };\n}\n\nfunction applyTransient(live: VerseLiveState, event: VerseTransientEvent, now: number): VerseLiveState {\n // A frame for a turn that already settled (late delivery after turn-done)\n // must not bring the live line back.\n if (event.turnId !== null && event.turnId === live.settledTurnId) return live;\n const base = event.turnId !== null ? liveForTurn(live, event.turnId, now) : live;\n switch (event.type) {\n case 'thinking-delta': {\n if (event.text.length === 0) return base;\n const block = base.thinking && base.thinking.turnId === event.turnId\n ? { ...base.thinking, text: base.thinking.text + event.text }\n : { turnId: event.turnId, text: event.text, startedAt: now, estimatedTokens: null };\n return { ...base, thinking: block, notice: null };\n }\n case 'thinking-progress': {\n const block = base.thinking && base.thinking.turnId === event.turnId\n ? { ...base.thinking, estimatedTokens: event.estimatedTokens }\n : { turnId: event.turnId, text: '', startedAt: now, estimatedTokens: event.estimatedTokens };\n return { ...base, thinking: block };\n }\n case 'progress':\n return {\n ...base,\n progress: {\n phase: event.phase,\n tool: typeof event.tool === 'string' && event.tool.length > 0 ? event.tool : null,\n elapsedMs: event.elapsedMs,\n outTokens: event.outTokens ?? null,\n tokPerSec: event.tokPerSec ?? null,\n receivedAt: now,\n },\n };\n case 'status':\n return { ...base, notice: { kind: event.kind, message: event.message, at: event.at, receivedAt: now } };\n default:\n return base;\n }\n}\n\n/** A persisted event's effect on the live state. */\nfunction livePersisted(live: VerseLiveState, event: VerseEvent, now: number, sessionId: string): VerseLiveState {\n switch (event.type) {\n case 'turn-started':\n if (event.turnId === live.settledTurnId) return live;\n return live.turnId === event.turnId\n ? { ...live, startedAt: stampMs(event.at, live.startedAt ?? now) }\n : { ...EMPTY_LIVE, turnId: event.turnId, startedAt: stampMs(event.at, now), settledTurnId: live.settledTurnId };\n case 'thinking': {\n // The persisted block supersedes the streamed one. What this tab\n // measured while it streamed (duration, the CLI's token estimate) is\n // kept beside the log, by seq, so the finished block can still say\n // \"Thought 12s · ~1.8k tok\" — the event itself is immutable.\n const streamed = live.thinking && live.thinking.turnId === event.turnId ? live.thinking : null;\n if (streamed) {\n let stats = thinkingStats.get(sessionId);\n if (!stats) {\n stats = new Map();\n thinkingStats.set(sessionId, stats);\n }\n stats.set(event.seq, {\n durationMs: typeof event.durationMs === 'number' ? event.durationMs : Math.max(0, now - streamed.startedAt),\n estimatedTokens: streamed.estimatedTokens,\n });\n }\n return streamed || live.notice ? { ...live, thinking: streamed ? null : live.thinking, notice: null } : live;\n }\n case 'text-delta':\n case 'assistant-message':\n case 'tool-use':\n case 'tool-result':\n // Output resumed: a retry went through, the watchdog's silence ended.\n return live.notice && (event.turnId === live.turnId || live.turnId === null) ? { ...live, notice: null } : live;\n case 'turn-done':\n case 'cancelled':\n return { ...EMPTY_LIVE, settledTurnId: event.turnId };\n default:\n return live;\n }\n}\n\n/**\n * Live state implied by a freshly merged log: a chat opened (or reloaded)\n * mid-turn still shows its live line, timed from the turn's own stamp; a\n * log whose last turn is settled shows none.\n */\nfunction liveFromLog(live: VerseLiveState, events: readonly VerseEvent[], session: VerseSession | null): VerseLiveState {\n let openTurn: Extract<VerseEvent, { type: 'turn-started' }> | null = null;\n let settledTurnId: string | null = live.settledTurnId;\n for (let i = events.length - 1; i >= 0; i -= 1) {\n const e = events[i]!;\n if (e.type === 'turn-done' || e.type === 'cancelled') {\n settledTurnId = e.turnId;\n break;\n }\n if (e.type === 'turn-started') {\n openTurn = e;\n break;\n }\n }\n if (!openTurn) {\n if (live.turnId !== null && live.turnId === settledTurnId) return { ...EMPTY_LIVE, settledTurnId };\n // No turn-started in the log yet (the POST just went out): keep whatever\n // the stream already told us; nothing in the log contradicts it.\n return live.settledTurnId === settledTurnId ? live : { ...live, settledTurnId };\n }\n if (session && session.status !== 'running') return live.turnId === null ? live : { ...EMPTY_LIVE, settledTurnId: live.settledTurnId };\n if (live.turnId === openTurn.turnId) return live;\n return { ...EMPTY_LIVE, turnId: openTurn.turnId, startedAt: stampMs(openTurn.at, Date.now()), settledTurnId: live.settledTurnId };\n}\n\n/**\n * Fold one `usage` frame into the session record. The frame carries THIS\n * turn's counts; the record keeps the session totals (server: session-engine\n * applyUsage). Occupancy and the window are live values, not sums.\n *\n * V3.9 fields are adopted only when the frame carries them (spread-when-\n * present), so a pre-3.9 server's frames leave the record's shape unchanged.\n * The one exception is a local seat: Verse SETS that window\n * (`CLAUDE_CODE_MAX_CONTEXT_TOKENS`), so a window a frame reports without\n * provenance is not allowed to replace it — the server ignores runtime\n * windows on local for the same reason.\n */\nexport function applyUsageFrame(session: VerseSession, frame: VerseUsage): VerseUsage {\n const prev = session.usage;\n const next: VerseUsage = {\n ...prev,\n inputTokens: prev.inputTokens + frame.inputTokens,\n outputTokens: prev.outputTokens + frame.outputTokens,\n cacheReadTokens: prev.cacheReadTokens + frame.cacheReadTokens,\n cacheCreationTokens: prev.cacheCreationTokens + frame.cacheCreationTokens,\n contextTokens: frame.contextTokens,\n };\n const frameWindow = typeof frame.contextWindow === 'number' && frame.contextWindow > 0 ? frame.contextWindow : null;\n const trusted = frame.contextWindowSource !== undefined || session.engine !== 'local';\n if (frameWindow !== null && trusted) next.contextWindow = frameWindow;\n if (frame.contextWindowSource !== undefined) next.contextWindowSource = frame.contextWindowSource;\n if (frame.autoCompactAt !== undefined) next.autoCompactAt = frame.autoCompactAt;\n // The server marks an EXACT reading by OMITTING the key (it only writes\n // `false`), so a resolved frame without it must clear an earlier \"≤\" — a\n // frame from a pre-3.9 server (no V3.9 fields at all) leaves it alone.\n if (frame.contextTokensExact === false) next.contextTokensExact = false;\n else if (frame.contextWindowSource !== undefined) delete next.contextTokensExact;\n return next;\n}\n\n/** The provenance values a frame may carry; anything else is ignored, never stored. */\nconst WINDOW_SOURCES: ReadonlySet<string> = new Set<VerseWindowSource>(['runtime', 'provider-catalog', 'cli-catalog', 'documented', 'fallback']);\n\nfunction frameWindowSource(value: unknown): VerseWindowSource | null {\n return typeof value === 'string' && WINDOW_SOURCES.has(value) ? (value as VerseWindowSource) : null;\n}\n\n/**\n * Apply a `context` reading: it REPLACES occupancy (never summed). When it\n * names a window, the window's provenance is the one the EVENT states\n * (`contextWindowSource`, V3.9): the engine also emits a `context` event\n * after a MODE SWITCH, carrying the new mode's CATALOG budget, and stamping\n * that 'runtime' made the tooltip say \"reported by the CLI on the last turn\"\n * for a number no CLI reported — and pinned it ahead of later catalog\n * corrections (sessionContextBudget precedence 1). Only an event from a\n * server that predates the field (no source at all) is taken as a runtime\n * reading, which is what every such event was.\n *\n * The engine fills `autoCompactAt` for the window in force; a frame without\n * it (an older server) is reconciled from the previous budget rather than\n * left pointing at a compaction point that belonged to a different window.\n */\nexport function applyContextReading(\n session: VerseSession,\n event: Extract<VerseEvent, { type: 'context' }>,\n): VerseUsage {\n const prev = session.usage;\n const next: VerseUsage = {\n ...prev,\n contextTokens: Math.max(0, Math.floor(event.contextTokens)),\n contextTokensExact: event.exact,\n };\n const window = typeof event.contextWindow === 'number' && event.contextWindow > 0 ? event.contextWindow : null;\n const stated = frameWindowSource(event.contextWindowSource);\n // Local windows are SET by Verse (CLAUDE_CODE_MAX_CONTEXT_TOKENS), not\n // measured: a window without provenance is not allowed to move one (see\n // applyUsageFrame). A V3.9 event that states its source is the engine's\n // own record of the window it just launched with, so it is adopted.\n if (window === null || (session.engine === 'local' && stated === null)) {\n if (event.autoCompactAt !== undefined && event.autoCompactAt !== null) next.autoCompactAt = event.autoCompactAt;\n return next;\n }\n next.contextWindow = window;\n next.contextWindowSource = stated ?? 'runtime';\n if (event.autoCompactAt !== undefined) {\n next.autoCompactAt = event.autoCompactAt;\n } else if (window !== prev.contextWindow) {\n next.autoCompactAt = reconcileAutoCompactAt({\n engine: session.engine,\n runtimeWindow: window,\n budget: prev.contextWindow ? { contextWindow: prev.contextWindow, autoCompactAt: prev.autoCompactAt ?? null } : null,\n });\n }\n return next;\n}\n\n/**\n * When this chat last talked to its provider — the newest `usage`,\n * `turn-done`, `cancelled` or TURN-attributed `context` event — or null when\n * the log holds none (no turn yet, or the log is not loaded).\n *\n * WHY NOT `session.updatedAt`: the idle-cache advice (\"the prompt cache has\n * likely expired\") asks how long the PROVIDER has gone without a request,\n * and `updatedAt` moves on things that never reach a provider: a rename, a\n * context-mode switch (whose `context` event has `turnId: null`), a reload's\n * record save. Measured from `updatedAt`, one rename silenced the warning\n * for another hour while the cache stayed cold.\n */\nexport function lastTurnActivityAt(events: readonly VerseEvent[]): string | null {\n let latest: string | null = null;\n for (const e of events) {\n const turnActivity = e.type === 'usage' || e.type === 'turn-done' || e.type === 'cancelled' ||\n (e.type === 'context' && e.turnId !== null);\n if (turnActivity && typeof e.at === 'string' && (latest === null || e.at > latest)) latest = e.at;\n }\n return latest;\n}\n\nexport function forgetVerseSession(sessionId: string): void {\n const existed = sessions.delete(sessionId);\n heads.delete(sessionId);\n transcriptMemo.delete(sessionId);\n thinkingStats.delete(sessionId);\n for (const l of [...lifecycleListeners]) l({ kind: 'forget', sessionId });\n if (existed) notify(sessionId);\n}\n\n/** Test/logout hygiene. */\nexport function resetVerseStore(): void {\n sessions.clear();\n heads.clear();\n transcriptMemo.clear();\n thinkingStats.clear();\n for (const l of [...lifecycleListeners]) l({ kind: 'reset' });\n notify(null);\n}\n\n/** Position of `seq` in a seq-sorted log (binary search). */\nfunction seqIndex(events: readonly VerseEvent[], seq: number): { found: boolean; index: number } {\n let lo = 0;\n let hi = events.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n const s = events[mid]!.seq;\n if (s === seq) return { found: true, index: mid };\n if (s < seq) lo = mid + 1;\n else hi = mid;\n }\n return { found: false, index: lo };\n}\n\n/** Sorted by seq, one event per seq (first occurrence wins), non-finite seqs dropped. */\nfunction normalizeEvents(events: readonly VerseEvent[]): VerseEvent[] {\n let ascending = true;\n for (let i = 0; i < events.length; i += 1) {\n const seq = events[i]!.seq;\n if (!Number.isFinite(seq) || (i > 0 && seq <= events[i - 1]!.seq)) {\n ascending = false;\n break;\n }\n }\n if (ascending) return events.slice();\n const bySeq = new Map<number, VerseEvent>();\n for (const e of events) if (Number.isFinite(e.seq) && !bySeq.has(e.seq)) bySeq.set(e.seq, e);\n return [...bySeq.values()].sort((a, b) => a.seq - b.seq);\n}\n\n/**\n * Union of two logs by seq, existing events winning. Returns `existing`\n * itself when `incoming` adds nothing, so a refetch that brought no news is\n * not a change. Linear in the two lengths (both are seq-sorted).\n */\nfunction mergeEvents(existing: VerseEvent[], incomingRaw: readonly VerseEvent[]): VerseEvent[] {\n if (incomingRaw.length === 0) return existing;\n const incoming = normalizeEvents(incomingRaw);\n if (incoming.length === 0) return existing;\n if (existing.length === 0) return incoming;\n if (incoming[0]!.seq > existing[existing.length - 1]!.seq) return existing.concat(incoming);\n const out: VerseEvent[] = [];\n let added = 0;\n let i = 0;\n let j = 0;\n while (i < existing.length || j < incoming.length) {\n const a = existing[i];\n const b = incoming[j];\n if (b === undefined || (a !== undefined && a.seq < b.seq)) {\n out.push(a!);\n i += 1;\n } else if (a === undefined || b.seq < a.seq) {\n out.push(b);\n added += 1;\n j += 1;\n } else {\n out.push(a);\n i += 1;\n j += 1;\n }\n }\n return added === 0 ? existing : out;\n}\n\nfunction shallowEqualValue(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) !== Array.isArray(b)) return false;\n const ka = Object.keys(a as object);\n const kb = Object.keys(b as object);\n if (ka.length !== kb.length) return false;\n for (const k of ka) {\n if (!Object.is((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k])) return false;\n }\n return true;\n}\n\n/** Same record, one level deep — a refetched but unchanged session must not re-render its chat. */\nfunction sameSession(a: VerseSession, b: VerseSession): boolean {\n if (a === b) return true;\n const ka = Object.keys(a) as Array<keyof VerseSession>;\n if (ka.length !== Object.keys(b).length) return false;\n return ka.every((k) => shallowEqualValue(a[k], b[k]));\n}\n\n// ---------------------------------------------------------------------------\n// Transcript derivation\n// ---------------------------------------------------------------------------\n\nexport type TranscriptItem =\n | { kind: 'user'; key: string; turnId: string; at: string; text: string }\n | { kind: 'assistant'; key: string; turnId: string; at: string; text: string; streaming: boolean }\n | {\n kind: 'thinking';\n key: string;\n turnId: string;\n at: string;\n text: string;\n /** V3.10: the CLI sent a signature-only / redacted block — the model thought, the text is withheld. */\n redacted: boolean;\n /** Streaming wall time: the event's own figure, else what this tab measured; null = unknown. */\n durationMs: number | null;\n /** The CLI's reasoning-token estimate this tab saw while it streamed; null = unknown. */\n estimatedTokens: number | null;\n thinkingKind: VerseThinkingKind | null;\n }\n | {\n kind: 'tool';\n key: string;\n turnId: string;\n at: string;\n toolUseId: string;\n name: string;\n input: unknown;\n result: { output: string; isError: boolean } | null;\n /** tool-use → tool-result wall time; null while pending or unstamped. */\n durationMs: number | null;\n }\n | { kind: 'error'; key: string; turnId: string | null; at: string; message: string; code: string | null }\n | {\n /** V3.9: the CLI compacted its own context. Counts are null when the CLI does not report them (codex). */\n kind: 'compaction';\n key: string;\n turnId: string | null;\n at: string;\n trigger: 'auto' | 'manual';\n preTokens: number | null;\n postTokens: number | null;\n durationMs: number | null;\n }\n | { kind: 'cancelled'; key: string; turnId: string; at: string }\n | { kind: 'turn-done'; key: string; turnId: string; at: string; ok: boolean; durationMs: number }\n /** V3.10: the engine restored a lost native conversation. */\n | { kind: 'recovered'; key: string; turnId: string | null; at: string; how: VerseRecoveryHow; message: string }\n /** V3.10: the log hit its cap and dropped everything before `droppedBefore` (at a turn boundary). */\n | { kind: 'truncated'; key: string; turnId: null; at: string; droppedBefore: number };\n\n/**\n * One turn's worth of items — the log cut at each `user-message`. Unchanged\n * segments come back as the SAME object from a cached build, which is what\n * lets the renderer skip every finished turn while one is streaming.\n */\nexport interface TranscriptSegment {\n key: string;\n items: TranscriptItem[];\n}\n\nexport interface Transcript {\n items: TranscriptItem[];\n /** True while a turn is open (started and not yet done/cancelled). */\n live: boolean;\n /** Most recent usage frame seen in the log, if any. */\n usage: VerseUsage | null;\n /** `items`, cut into turn segments. Absent on a hand-built transcript (treated as one segment). */\n segments?: TranscriptSegment[];\n}\n\n/** Wall time between two ISO stamps; null when either is unparseable. */\nfunction spanMs(from: string, to: string): number | null {\n const a = Date.parse(from);\n const b = Date.parse(to);\n return Number.isFinite(a) && Number.isFinite(b) ? Math.max(0, b - a) : null;\n}\n\ninterface PendingText {\n turnId: string;\n at: string;\n text: string;\n key: string;\n}\n\ninterface SegmentBuild {\n /** Items without the trailing streamed text, which depends on whether the WHOLE log is live. */\n items: TranscriptItem[];\n pending: PendingText | null;\n /** The last live-flag change in this segment: true (started), false (ended) or null (none). */\n liveEffect: boolean | null;\n usage: VerseUsage | null;\n /** tool-results in this segment whose tool-use is not in it. */\n orphanResults: string[];\n toolUseIds: string[];\n}\n\ninterface CachedSegment {\n firstSeq: number;\n lastSeq: number;\n count: number;\n build: SegmentBuild;\n /** The finished segment per trailing-streaming flag it was finalized with. */\n finalized: { streaming: boolean; segment: TranscriptSegment } | null;\n}\n\nexport interface TranscriptCache {\n segments: Map<string, CachedSegment>;\n}\n\nexport function createTranscriptCache(): TranscriptCache {\n return { segments: new Map() };\n}\n\nexport interface BuildTranscriptOptions {\n /** Reuse segments from a previous build of the same session's log. */\n cache?: TranscriptCache;\n /** Measured figures for reasoning blocks this tab watched stream, by the persisted event's seq. */\n thinkingStats?: ReadonlyMap<number, VerseThinkingStat>;\n}\n\n/**\n * The original single-pass derivation over `events[from, to)`. A whole log\n * run through it in one range is exactly the pre-3.10 buildTranscript; cut\n * at `user-message` boundaries (where it flushes anyway) the pieces\n * concatenate to the same items.\n */\nfunction buildSegment(\n events: readonly VerseEvent[],\n from: number,\n to: number,\n stats: ReadonlyMap<number, VerseThinkingStat> | undefined,\n): SegmentBuild {\n const items: TranscriptItem[] = [];\n const toolIndex = new Map<string, number>();\n const orphanResults: string[] = [];\n const toolUseIds: string[] = [];\n let pending: PendingText | null = null;\n let liveEffect: boolean | null = null;\n let usage: VerseUsage | null = null;\n\n const flushPending = () => {\n if (!pending) return;\n items.push({ kind: 'assistant', key: pending.key, turnId: pending.turnId, at: pending.at, text: pending.text, streaming: false });\n pending = null;\n };\n\n for (let i = from; i < to; i += 1) {\n const e = events[i]!;\n switch (e.type) {\n case 'user-message':\n flushPending();\n items.push({ kind: 'user', key: `u-${e.seq}`, turnId: e.turnId, at: e.at, text: e.text });\n break;\n case 'turn-started':\n liveEffect = true;\n break;\n case 'text-delta':\n if (pending && pending.turnId !== e.turnId) flushPending();\n if (!pending) pending = { turnId: e.turnId, at: e.at, text: '', key: `d-${e.seq}` };\n pending.text += e.text;\n break;\n case 'assistant-message':\n // The complete message supersedes whatever deltas streamed before it.\n pending = null;\n items.push({ kind: 'assistant', key: `a-${e.seq}`, turnId: e.turnId, at: e.at, text: e.text, streaming: false });\n break;\n case 'thinking': {\n flushPending();\n const measured = stats?.get(e.seq);\n items.push({\n kind: 'thinking',\n key: `t-${e.seq}`,\n turnId: e.turnId,\n at: e.at,\n text: e.text,\n redacted: e.redacted === true,\n durationMs: typeof e.durationMs === 'number' && Number.isFinite(e.durationMs) && e.durationMs >= 0\n ? e.durationMs\n : measured?.durationMs ?? null,\n estimatedTokens: measured?.estimatedTokens ?? null,\n thinkingKind: e.kind ?? null,\n });\n break;\n }\n case 'tool-use':\n flushPending();\n toolIndex.set(e.toolUseId, items.length);\n toolUseIds.push(e.toolUseId);\n items.push({\n kind: 'tool',\n key: `tu-${e.seq}`,\n turnId: e.turnId,\n at: e.at,\n toolUseId: e.toolUseId,\n name: e.name,\n input: e.input,\n result: null,\n durationMs: null,\n });\n break;\n case 'tool-result': {\n const idx = toolIndex.get(e.toolUseId);\n const existing = idx === undefined ? undefined : items[idx];\n if (existing && existing.kind === 'tool') {\n items[idx!] = { ...existing, result: { output: e.output, isError: e.isError }, durationMs: spanMs(existing.at, e.at) };\n } else {\n orphanResults.push(e.toolUseId);\n items.push({\n kind: 'tool',\n key: `tr-${e.seq}`,\n turnId: e.turnId,\n at: e.at,\n toolUseId: e.toolUseId,\n name: 'tool',\n input: null,\n result: { output: e.output, isError: e.isError },\n durationMs: null,\n });\n }\n break;\n }\n case 'usage':\n usage = e.usage;\n break;\n case 'compaction':\n // Deliberately NO flushPending: CLIs compact between model calls, and\n // flushing a streamed bubble here would leave it in the list when the\n // complete `assistant-message` arrives — the same reply twice.\n items.push({\n kind: 'compaction',\n key: `k-${e.seq}`,\n turnId: e.turnId,\n at: e.at,\n trigger: e.trigger,\n preTokens: e.preTokens,\n postTokens: e.postTokens,\n durationMs: e.durationMs,\n });\n break;\n case 'error':\n flushPending();\n items.push({ kind: 'error', key: `e-${e.seq}`, turnId: e.turnId, at: e.at, message: e.message, code: typeof e.code === 'string' && e.code ? e.code : null });\n break;\n case 'cancelled':\n flushPending();\n liveEffect = false;\n items.push({ kind: 'cancelled', key: `c-${e.seq}`, turnId: e.turnId, at: e.at });\n break;\n case 'turn-done':\n flushPending();\n liveEffect = false;\n items.push({ kind: 'turn-done', key: `td-${e.seq}`, turnId: e.turnId, at: e.at, ok: e.ok, durationMs: e.durationMs });\n break;\n case 'recovered':\n // Like compaction, no flush: recovery happens before the new native\n // session produces anything, never in the middle of a reply.\n items.push({ kind: 'recovered', key: `r-${e.seq}`, turnId: e.turnId, at: e.at, how: e.how, message: e.message });\n break;\n case 'history-truncated':\n items.push({ kind: 'truncated', key: `h-${e.seq}`, turnId: null, at: e.at, droppedBefore: e.droppedBefore });\n break;\n default:\n break;\n }\n }\n return { items, pending, liveEffect, usage, orphanResults, toolUseIds };\n}\n\nfunction finalizeSegment(key: string, build: SegmentBuild, streaming: boolean): TranscriptSegment {\n const p = build.pending;\n if (!p) return { key, items: build.items };\n return {\n key,\n items: [...build.items, { kind: 'assistant', key: p.key, turnId: p.turnId, at: p.at, text: p.text, streaming }],\n };\n}\n\n// `VerseEvent[]` (not readonly) is the published signature: callers type\n// their fixture arrays as `Parameters<typeof buildTranscript>[0]` and push.\nexport function buildTranscript(events: VerseEvent[], options: BuildTranscriptOptions = {}): Transcript {\n const { cache, thinkingStats: stats } = options;\n if (events.length === 0) return { items: [], live: false, usage: null, segments: [] };\n\n // Cut at every user-message: a new ask always opens a new turn, and the\n // derivation flushes its streamed text there, so nothing spans the cut.\n const starts: number[] = [0];\n for (let i = 1; i < events.length; i += 1) if (events[i]!.type === 'user-message') starts.push(i);\n\n const builds: Array<{ key: string; build: SegmentBuild; cached: CachedSegment | null }> = [];\n const seenKeys = new Set<string>();\n for (let s = 0; s < starts.length; s += 1) {\n const from = starts[s]!;\n const to = s + 1 < starts.length ? starts[s + 1]! : events.length;\n const firstSeq = events[from]!.seq;\n const lastSeq = events[to - 1]!.seq;\n const count = to - from;\n const key = `s-${firstSeq}`;\n seenKeys.add(key);\n const hit = cache?.segments.get(key);\n if (hit && hit.firstSeq === firstSeq && hit.lastSeq === lastSeq && hit.count === count) {\n builds.push({ key, build: hit.build, cached: hit });\n continue;\n }\n const build = buildSegment(events, from, to, stats);\n const entry: CachedSegment = { firstSeq, lastSeq, count, build, finalized: null };\n cache?.segments.set(key, entry);\n builds.push({ key, build, cached: entry });\n }\n if (cache) for (const key of [...cache.segments.keys()]) if (!seenKeys.has(key)) cache.segments.delete(key);\n\n // A tool-result whose tool-use sits in an EARLIER segment would have\n // updated that earlier card in the single-pass derivation. It never\n // happens in a real log (a result follows its call inside one turn); if it\n // does, derive the whole log in one pass rather than render it differently.\n if (builds.length > 1) {\n const earlier = new Set<string>();\n for (const b of builds) {\n if (b.build.orphanResults.some((id) => earlier.has(id))) return singlePass(events, stats);\n for (const id of b.build.toolUseIds) earlier.add(id);\n }\n }\n\n let live = false;\n let usage: VerseUsage | null = null;\n for (const b of builds) {\n if (b.build.liveEffect !== null) live = b.build.liveEffect;\n if (b.build.usage !== null) usage = b.build.usage;\n }\n\n const segments: TranscriptSegment[] = [];\n const items: TranscriptItem[] = [];\n for (let s = 0; s < builds.length; s += 1) {\n const b = builds[s]!;\n // Deltas still arriving for an open turn render as a streaming bubble;\n // every earlier segment's trailing text was flushed by the next ask.\n const streaming = s === builds.length - 1 ? live : false;\n let segment: TranscriptSegment;\n if (b.cached?.finalized && b.cached.finalized.streaming === streaming) {\n segment = b.cached.finalized.segment;\n } else {\n segment = finalizeSegment(b.key, b.build, streaming);\n if (b.cached) b.cached.finalized = { streaming, segment };\n }\n segments.push(segment);\n for (const item of segment.items) items.push(item);\n }\n return { items, live, usage, segments };\n}\n\nfunction singlePass(events: readonly VerseEvent[], stats: ReadonlyMap<number, VerseThinkingStat> | undefined): Transcript {\n const build = buildSegment(events, 0, events.length, stats);\n const live = build.liveEffect ?? false;\n const segment = finalizeSegment(`s-${events[0]!.seq}`, build, live);\n return { items: segment.items, live, usage: build.usage, segments: [segment] };\n}\n\n// ---------------------------------------------------------------------------\n// Render-time grouping\n// ---------------------------------------------------------------------------\n\nexport type ToolGroupMember = Extract<TranscriptItem, { kind: 'tool' | 'thinking' }>;\n\nexport interface ToolGroupItem {\n kind: 'toolGroup';\n key: string;\n turnId: string;\n at: string;\n items: ToolGroupMember[];\n /** Tool calls only (thinking blocks are not counted). */\n toolCount: number;\n /** \"Read ×6, Edit ×4\" — names in first-seen order. */\n summary: string;\n errorCount: number;\n /** A member is still waiting for its result. */\n pending: boolean;\n /** Wall time between the first and last member, when both have parseable timestamps. */\n spanMs: number | null;\n}\n\nexport type TranscriptRenderItem = TranscriptItem | ToolGroupItem;\n\n/**\n * Fold runs of consecutive tool calls from the same turn that hold two or\n * more calls into one `toolGroup`, so an agentic turn reads as \"N tool calls\"\n * with a single disclosure instead of a wall of cards. A single call (with\n * whatever reasoning surrounds it) stays as it is.\n * Pure over buildTranscript()'s output (the index-based tool-result pairing\n * there is untouched).\n *\n * Reasoning INTERLEAVED between tool calls folds with them (it explains the\n * next call). Reasoning that ENDS a run — the model's last thought before it\n * answers or before the next ask — is lifted out and rendered on its own, so\n * the part worth reading is never two disclosures deep. A run of reasoning\n * alone never folds.\n */\nexport function groupTranscriptItems(items: readonly TranscriptItem[]): TranscriptRenderItem[] {\n const out: TranscriptRenderItem[] = [];\n let run: ToolGroupMember[] = [];\n\n const flush = () => {\n if (run.length === 0) return;\n let end = run.length;\n while (end > 0 && run[end - 1]!.kind === 'thinking') end -= 1;\n const folded = run.slice(0, end);\n const trailing = run.slice(end);\n // Only a run with two or more CALLS is worth a disclosure: \"1 tool\" hiding\n // a single call plus the reasoning before it is a click for nothing.\n if (folded.filter((m) => m.kind === 'tool').length >= 2) out.push(makeToolGroup(folded));\n else for (const member of folded) out.push(member);\n for (const thought of trailing) out.push(thought);\n run = [];\n };\n\n for (const item of items) {\n if ((item.kind === 'tool' || item.kind === 'thinking') && (run.length === 0 || run[0]!.turnId === item.turnId)) {\n run.push(item);\n continue;\n }\n flush();\n if (item.kind === 'tool' || item.kind === 'thinking') run.push(item);\n else out.push(item);\n }\n flush();\n return out;\n}\n\nfunction makeToolGroup(members: ToolGroupMember[]): ToolGroupItem {\n const counts = new Map<string, number>();\n let errorCount = 0;\n let pending = false;\n for (const m of members) {\n if (m.kind !== 'tool') continue;\n counts.set(m.name, (counts.get(m.name) ?? 0) + 1);\n if (m.result === null) pending = true;\n else if (m.result.isError) errorCount += 1;\n }\n const toolCount = [...counts.values()].reduce((a, b) => a + b, 0);\n const summary = [...counts.entries()].map(([name, n]) => (n > 1 ? `${name} ×${n}` : name)).join(', ');\n const span = spanMs(members[0]!.at, members[members.length - 1]!.at);\n return {\n kind: 'toolGroup',\n key: `g-${members[0]!.key}`,\n turnId: members[0]!.turnId,\n at: members[0]!.at,\n items: members,\n toolCount,\n summary,\n errorCount,\n pending,\n spanMs: span,\n };\n}\n\n/**\n * \"123k\" / \"1.2M\" — compact token counts for the meter and usage rows.\n *\n * The unit is chosen AFTER rounding: choosing it first printed 999,500–\n * 999,999 as \"1000k\" (and 999.5–999.9 as \"1000\"), a band a 1M Claude chat in\n * Expansive can actually reach.\n */\nexport function formatTokens(n: number | null | undefined): string {\n if (n === null || n === undefined || !Number.isFinite(n)) return '—';\n if (Math.round(n) < 1000) return String(Math.round(n));\n if (Math.round(n / 1000) < 1000) return `${Math.round(n / 1000)}k`;\n return `${(n / 1_000_000).toFixed(1).replace(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