@ashlr/hub 3.11.2 → 3.11.3
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 +8 -0
- package/dist/build-identity.json +2 -2
- package/dist/core/web/public/next/assets/{ActionMenu-_DhtX2gO.js → ActionMenu-FxXeRbPx.js} +2 -2
- package/dist/core/web/public/next/assets/{ActionMenu-_DhtX2gO.js.map → ActionMenu-FxXeRbPx.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Advanced-CAAfaBke.js → Advanced-D_eS4472.js} +2 -2
- package/dist/core/web/public/next/assets/{Advanced-CAAfaBke.js.map → Advanced-D_eS4472.js.map} +1 -1
- package/dist/core/web/public/next/assets/{App-BAywyjE8.js → App-Cj4zKbG3.js} +2 -2
- package/dist/core/web/public/next/assets/{App-BAywyjE8.js.map → App-Cj4zKbG3.js.map} +1 -1
- package/dist/core/web/public/next/assets/{AppsSection-CUypKeog.js → AppsSection-Ddu_RCQE.js} +2 -2
- package/dist/core/web/public/next/assets/{AppsSection-CUypKeog.js.map → AppsSection-Ddu_RCQE.js.map} +1 -1
- package/dist/core/web/public/next/assets/{AreaTrend-CblDqC8Q.js → AreaTrend-CDxrQU4b.js} +2 -2
- package/dist/core/web/public/next/assets/{AreaTrend-CblDqC8Q.js.map → AreaTrend-CDxrQU4b.js.map} +1 -1
- package/dist/core/web/public/next/assets/AutonomySection-DuQkHGD_.js +2 -0
- package/dist/core/web/public/next/assets/{AutonomySection-D3d8lYO3.js.map → AutonomySection-DuQkHGD_.js.map} +1 -1
- package/dist/core/web/public/next/assets/{BranchBar-DU0jAV1E.js → BranchBar-CLsvOcyK.js} +2 -2
- package/dist/core/web/public/next/assets/{BranchBar-DU0jAV1E.js.map → BranchBar-CLsvOcyK.js.map} +1 -1
- package/dist/core/web/public/next/assets/{BudgetControl-Mm1ZL4u6.js → BudgetControl-TL3FeZ1D.js} +2 -2
- package/dist/core/web/public/next/assets/{BudgetControl-Mm1ZL4u6.js.map → BudgetControl-TL3FeZ1D.js.map} +1 -1
- package/dist/core/web/public/next/assets/{BurnDown-C1fgcFqo.js → BurnDown-sFXkUGdB.js} +2 -2
- package/dist/core/web/public/next/assets/{BurnDown-C1fgcFqo.js.map → BurnDown-sFXkUGdB.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Button-DqgLUZvd.js → Button-HHXgoXGr.js} +2 -2
- package/dist/core/web/public/next/assets/{Button-DqgLUZvd.js.map → Button-HHXgoXGr.js.map} +1 -1
- package/dist/core/web/public/next/assets/{CapacityStrip-nWFHvqFB.js → CapacityStrip-qReu0RaF.js} +2 -2
- package/dist/core/web/public/next/assets/{CapacityStrip-nWFHvqFB.js.map → CapacityStrip-qReu0RaF.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ChatSection-DUZNpiVr.js → ChatSection-DZuZfTaC.js} +3 -3
- package/dist/core/web/public/next/assets/{ChatSection-DUZNpiVr.js.map → ChatSection-DZuZfTaC.js.map} +1 -1
- package/dist/core/web/public/next/assets/{CloudBudgetForm-2OW38o_C.js → CloudBudgetForm-DJbiT1wi.js} +2 -2
- package/dist/core/web/public/next/assets/{CloudBudgetForm-2OW38o_C.js.map → CloudBudgetForm-DJbiT1wi.js.map} +1 -1
- package/dist/core/web/public/next/assets/{CommandPalette-C5w2o1-r.js → CommandPalette-zYLFZRnj.js} +2 -2
- package/dist/core/web/public/next/assets/{CommandPalette-C5w2o1-r.js.map → CommandPalette-zYLFZRnj.js.map} +1 -1
- package/dist/core/web/public/next/assets/{CommandSection-Bx2knNqY.js → CommandSection-rIeMK5Ch.js} +2 -2
- package/dist/core/web/public/next/assets/{CommandSection-Bx2knNqY.js.map → CommandSection-rIeMK5Ch.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ConfirmDialog-B7ZwCQOX.js → ConfirmDialog-DLrLKM0c.js} +2 -2
- package/dist/core/web/public/next/assets/{ConfirmDialog-B7ZwCQOX.js.map → ConfirmDialog-DLrLKM0c.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Dialog-BpgcEW6b.js → Dialog-BS9Dxi3G.js} +2 -2
- package/dist/core/web/public/next/assets/{Dialog-BpgcEW6b.js.map → Dialog-BS9Dxi3G.js.map} +1 -1
- package/dist/core/web/public/next/assets/{DiffPane-DpqRUtCx.js → DiffPane-TOmUf3b2.js} +2 -2
- package/dist/core/web/public/next/assets/{DiffPane-DpqRUtCx.js.map → DiffPane-TOmUf3b2.js.map} +1 -1
- package/dist/core/web/public/next/assets/{DiffViewer-CoV5-nUf.js → DiffViewer-BpH56302.js} +2 -2
- package/dist/core/web/public/next/assets/{DiffViewer-CoV5-nUf.js.map → DiffViewer-BpH56302.js.map} +1 -1
- package/dist/core/web/public/next/assets/{DockHost-C0Pq7Jak.js → DockHost-DzkzR-HD.js} +2 -2
- package/dist/core/web/public/next/assets/{DockHost-C0Pq7Jak.js.map → DockHost-DzkzR-HD.js.map} +1 -1
- package/dist/core/web/public/next/assets/{EmptyState-DYW29ncw.js → EmptyState-BqR5YAmf.js} +2 -2
- package/dist/core/web/public/next/assets/{EmptyState-DYW29ncw.js.map → EmptyState-BqR5YAmf.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Epistemic-DVx6oHzp.js → Epistemic-dhvDTwAZ.js} +2 -2
- package/dist/core/web/public/next/assets/{Epistemic-DVx6oHzp.js.map → Epistemic-dhvDTwAZ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{FleetSection-DSETviPK.js → FleetSection-ViAb549H.js} +3 -3
- package/dist/core/web/public/next/assets/{FleetSection-DSETviPK.js.map → FleetSection-ViAb549H.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Funnel-DxiGqJrt.js → Funnel-D2u7Wlzc.js} +2 -2
- package/dist/core/web/public/next/assets/{Funnel-DxiGqJrt.js.map → Funnel-D2u7Wlzc.js.map} +1 -1
- package/dist/core/web/public/next/assets/{GearTray-C3I89sIt.js → GearTray-Cb2npoxM.js} +2 -2
- package/dist/core/web/public/next/assets/{GearTray-C3I89sIt.js.map → GearTray-Cb2npoxM.js.map} +1 -1
- package/dist/core/web/public/next/assets/{GrowthSection-C3m2bPEz.js → GrowthSection-C5aDPs8B.js} +2 -2
- package/dist/core/web/public/next/assets/{GrowthSection-C3m2bPEz.js.map → GrowthSection-C5aDPs8B.js.map} +1 -1
- package/dist/core/web/public/next/assets/{HandoffDialog-Bjb96a0N.js → HandoffDialog-BF3AYg-X.js} +2 -2
- package/dist/core/web/public/next/assets/{HandoffDialog-Bjb96a0N.js.map → HandoffDialog-BF3AYg-X.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Input-ekTehVaH.js → Input-B5dmGLZx.js} +2 -2
- package/dist/core/web/public/next/assets/{Input-ekTehVaH.js.map → Input-B5dmGLZx.js.map} +1 -1
- package/dist/core/web/public/next/assets/{LeaderCard-85VBbbaZ.js → LeaderCard-DZrmjDbI.js} +2 -2
- package/dist/core/web/public/next/assets/{LeaderCard-85VBbbaZ.js.map → LeaderCard-DZrmjDbI.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MatrixHeatmap-Bo8j0QPC.js → MatrixHeatmap-BgEUs2Eu.js} +2 -2
- package/dist/core/web/public/next/assets/{MatrixHeatmap-Bo8j0QPC.js.map → MatrixHeatmap-BgEUs2Eu.js.map} +1 -1
- package/dist/core/web/public/next/assets/McpSection-DZkiOuoq.js +2 -0
- package/dist/core/web/public/next/assets/{McpSection-DvHFaVyp.js.map → McpSection-DZkiOuoq.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MessageMarkdown-fsY_ltVa.js → MessageMarkdown-BauY8ZTY.js} +3 -3
- package/dist/core/web/public/next/assets/{MessageMarkdown-fsY_ltVa.js.map → MessageMarkdown-BauY8ZTY.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MessageMarkdownRenderer-DDdtu82l.js → MessageMarkdownRenderer-DLBNLfsn.js} +2 -2
- package/dist/core/web/public/next/assets/{MessageMarkdownRenderer-DDdtu82l.js.map → MessageMarkdownRenderer-DLBNLfsn.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Meter-CeGDXdDM.js → Meter-DNeocJnD.js} +2 -2
- package/dist/core/web/public/next/assets/{Meter-CeGDXdDM.js.map → Meter-DNeocJnD.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MindSection-CDVhHvXl.js → MindSection-BvJXFjyX.js} +2 -2
- package/dist/core/web/public/next/assets/{MindSection-CDVhHvXl.js.map → MindSection-BvJXFjyX.js.map} +1 -1
- package/dist/core/web/public/next/assets/{MutationTokenDialog-DTQzEOHR.js → MutationTokenDialog-mxrw0Yvy.js} +2 -2
- package/dist/core/web/public/next/assets/{MutationTokenDialog-DTQzEOHR.js.map → MutationTokenDialog-mxrw0Yvy.js.map} +1 -1
- package/dist/core/web/public/next/assets/{NeedsYouDrawer-6AuN0BF3.js → NeedsYouDrawer-CO-Balfp.js} +2 -2
- package/dist/core/web/public/next/assets/{NeedsYouDrawer-6AuN0BF3.js.map → NeedsYouDrawer-CO-Balfp.js.map} +1 -1
- package/dist/core/web/public/next/assets/{NeedsYouList-ChnRmbSk.js → NeedsYouList-CzDZbzRD.js} +2 -2
- package/dist/core/web/public/next/assets/{NeedsYouList-ChnRmbSk.js.map → NeedsYouList-CzDZbzRD.js.map} +1 -1
- package/dist/core/web/public/next/assets/{NewChatDialog-B06E7sqg.js → NewChatDialog-B8eJjlFf.js} +2 -2
- package/dist/core/web/public/next/assets/{NewChatDialog-B06E7sqg.js.map → NewChatDialog-B8eJjlFf.js.map} +1 -1
- package/dist/core/web/public/next/assets/{OnboardingFlow-C2M3zov9.js → OnboardingFlow-Cij6KWat.js} +2 -2
- package/dist/core/web/public/next/assets/{OnboardingFlow-C2M3zov9.js.map → OnboardingFlow-Cij6KWat.js.map} +1 -1
- package/dist/core/web/public/next/assets/{PreviewPane-Bd6HsX1k.js → PreviewPane-BS-CleCd.js} +2 -2
- package/dist/core/web/public/next/assets/{PreviewPane-Bd6HsX1k.js.map → PreviewPane-BS-CleCd.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ProviderLogo-Bz7KR5j3.js → ProviderLogo-C5mBg8i0.js} +2 -2
- package/dist/core/web/public/next/assets/{ProviderLogo-Bz7KR5j3.js.map → ProviderLogo-C5mBg8i0.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RailStatus-CctCuuLy.js → RailStatus-cPRyOmrk.js} +2 -2
- package/dist/core/web/public/next/assets/{RailStatus-CctCuuLy.js.map → RailStatus-cPRyOmrk.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RefreshIndicator-CKY5BGdD.js → RefreshIndicator-CMwSCiz5.js} +2 -2
- package/dist/core/web/public/next/assets/{RefreshIndicator-CKY5BGdD.js.map → RefreshIndicator-CMwSCiz5.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-CspIsW_G.js → ResourcePoolConsoleApp-BFi1opsC.js} +2 -2
- package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-CspIsW_G.js.map → ResourcePoolConsoleApp-BFi1opsC.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ResourcesChrome-B7fHZ6zX.js → ResourcesChrome-BJCauW_t.js} +3 -3
- package/dist/core/web/public/next/assets/{ResourcesChrome-B7fHZ6zX.js.map → ResourcesChrome-BJCauW_t.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ResourcesDrawer-B7-N9n7-.js → ResourcesDrawer-BDecg6nO.js} +2 -2
- package/dist/core/web/public/next/assets/{ResourcesDrawer-B7-N9n7-.js.map → ResourcesDrawer-BDecg6nO.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RouteErrorBoundary-C_B11J0s.js → RouteErrorBoundary-DYtwc2ja.js} +2 -2
- package/dist/core/web/public/next/assets/{RouteErrorBoundary-C_B11J0s.js.map → RouteErrorBoundary-DYtwc2ja.js.map} +1 -1
- package/dist/core/web/public/next/assets/{RunInCloudAction-_juw4EXd.js → RunInCloudAction-BEGEEM8O.js} +2 -2
- package/dist/core/web/public/next/assets/{RunInCloudAction-_juw4EXd.js.map → RunInCloudAction-BEGEEM8O.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SeatSelector-D_YXvkPy.js → SeatSelector-CYHRR7Wp.js} +2 -2
- package/dist/core/web/public/next/assets/{SeatSelector-D_YXvkPy.js.map → SeatSelector-CYHRR7Wp.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Segmented-DnKP6rr7.js → Segmented-BE53BenI.js} +2 -2
- package/dist/core/web/public/next/assets/{Segmented-DnKP6rr7.js.map → Segmented-BE53BenI.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Select-DlbUupTX.js → Select-BwSGkHCS.js} +2 -2
- package/dist/core/web/public/next/assets/{Select-DlbUupTX.js.map → Select-BwSGkHCS.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SessionGate-DnuTZACL.js → SessionGate-e0dFJm9d.js} +2 -2
- package/dist/core/web/public/next/assets/{SessionGate-DnuTZACL.js.map → SessionGate-e0dFJm9d.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SessionInsightChip-C33-k-Q5.js → SessionInsightChip-CxlSyueJ.js} +2 -2
- package/dist/core/web/public/next/assets/{SessionInsightChip-C33-k-Q5.js.map → SessionInsightChip-CxlSyueJ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SessionSearch-DhhR9Csg.js → SessionSearch-_yp7S2TP.js} +2 -2
- package/dist/core/web/public/next/assets/{SessionSearch-DhhR9Csg.js.map → SessionSearch-_yp7S2TP.js.map} +1 -1
- package/dist/core/web/public/next/assets/{SettingsSection-C0xQvCz3.js → SettingsSection-wGnpWeGW.js} +2 -2
- package/dist/core/web/public/next/assets/{SettingsSection-C0xQvCz3.js.map → SettingsSection-wGnpWeGW.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Sheet-BvNYOYv5.js → Sheet-DVP2Mgy6.js} +2 -2
- package/dist/core/web/public/next/assets/{Sheet-BvNYOYv5.js.map → Sheet-DVP2Mgy6.js.map} +1 -1
- package/dist/core/web/public/next/assets/{ShortcutsOverlay-1nUBVO-Z.js → ShortcutsOverlay-BcIcoClX.js} +2 -2
- package/dist/core/web/public/next/assets/{ShortcutsOverlay-1nUBVO-Z.js.map → ShortcutsOverlay-BcIcoClX.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Sidebar-YrVvvBNM.js → Sidebar-DjQOqPbm.js} +3 -3
- package/dist/core/web/public/next/assets/{Sidebar-YrVvvBNM.js.map → Sidebar-DjQOqPbm.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Slider-B2c-dbQb.js → Slider-BypUWjpH.js} +2 -2
- package/dist/core/web/public/next/assets/{Slider-B2c-dbQb.js.map → Slider-BypUWjpH.js.map} +1 -1
- package/dist/core/web/public/next/assets/{StatusBadge-Q9YYkijx.js → StatusBadge-HCZp416_.js} +2 -2
- package/dist/core/web/public/next/assets/{StatusBadge-Q9YYkijx.js.map → StatusBadge-HCZp416_.js.map} +1 -1
- package/dist/core/web/public/next/assets/{StepBand-Ci-C0GUG.js → StepBand-Duz1PUes.js} +2 -2
- package/dist/core/web/public/next/assets/{StepBand-Ci-C0GUG.js.map → StepBand-Duz1PUes.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Surface-DBovMq4P.js → Surface-B75lVfzm.js} +2 -2
- package/dist/core/web/public/next/assets/{Surface-DBovMq4P.js.map → Surface-B75lVfzm.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Swimlane-Cdc4TqDe.js → Swimlane-DGcIcnNA.js} +2 -2
- package/dist/core/web/public/next/assets/{Swimlane-Cdc4TqDe.js.map → Swimlane-DGcIcnNA.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Switch-CUrvzO2k.js → Switch-iveI-8NY.js} +2 -2
- package/dist/core/web/public/next/assets/{Switch-CUrvzO2k.js.map → Switch-iveI-8NY.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Tag-Bv8u6APt.js → Tag-DH15CUJp.js} +2 -2
- package/dist/core/web/public/next/assets/{Tag-Bv8u6APt.js.map → Tag-DH15CUJp.js.map} +1 -1
- package/dist/core/web/public/next/assets/{TerminalPane-BE4Xlqi5.js → TerminalPane-MQT-veKZ.js} +2 -2
- package/dist/core/web/public/next/assets/{TerminalPane-BE4Xlqi5.js.map → TerminalPane-MQT-veKZ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-BGwejf0m.js → UniverseConsoleApp-C8yQ0AaR.js} +2 -2
- package/dist/core/web/public/next/assets/{UniverseConsoleApp-BGwejf0m.js.map → UniverseConsoleApp-C8yQ0AaR.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UniverseView-CgKa-WXC.js → UniverseView-_nPURPqe.js} +2 -2
- package/dist/core/web/public/next/assets/{UniverseView-CgKa-WXC.js.map → UniverseView-_nPURPqe.js.map} +1 -1
- package/dist/core/web/public/next/assets/{UsageSection-CazsHm1f.js → UsageSection-CqxRGJ40.js} +2 -2
- package/dist/core/web/public/next/assets/{UsageSection-CazsHm1f.js.map → UsageSection-CqxRGJ40.js.map} +1 -1
- package/dist/core/web/public/next/assets/{VerseConsoleApp-CTF3Shs0.js → VerseConsoleApp-DTjDpGCd.js} +3 -3
- package/dist/core/web/public/next/assets/{VerseConsoleApp-CTF3Shs0.js.map → VerseConsoleApp-DTjDpGCd.js.map} +1 -1
- package/dist/core/web/public/next/assets/{Workspace-CgdyXiEV.js → Workspace-DfcFGzME.js} +5 -5
- package/dist/core/web/public/next/assets/{Workspace-CgdyXiEV.js.map → Workspace-DfcFGzME.js.map} +1 -1
- package/dist/core/web/public/next/assets/{actions-MtxBGS5B.js → actions-tWevL9HV.js} +2 -2
- package/dist/core/web/public/next/assets/{actions-MtxBGS5B.js.map → actions-tWevL9HV.js.map} +1 -1
- package/dist/core/web/public/next/assets/{budget-queries-CP7hgR-p.js → budget-queries-V3wcJVK_.js} +2 -2
- package/dist/core/web/public/next/assets/{budget-queries-CP7hgR-p.js.map → budget-queries-V3wcJVK_.js.map} +1 -1
- package/dist/core/web/public/next/assets/{capacity-strip-model-fHfu5cph.js → capacity-strip-model-BDbmQ3e3.js} +2 -2
- package/dist/core/web/public/next/assets/{capacity-strip-model-fHfu5cph.js.map → capacity-strip-model-BDbmQ3e3.js.map} +1 -1
- package/dist/core/web/public/next/assets/{charts-Bis9WSiS.js → charts-CfAjuKMv.js} +2 -2
- package/dist/core/web/public/next/assets/{charts-Bis9WSiS.js.map → charts-CfAjuKMv.js.map} +1 -1
- package/dist/core/web/public/next/assets/{cloud-queries-BsOepFz6.js → cloud-queries-Br_r0UAz.js} +2 -2
- package/dist/core/web/public/next/assets/{cloud-queries-BsOepFz6.js.map → cloud-queries-Br_r0UAz.js.map} +1 -1
- package/dist/core/web/public/next/assets/{cloud.module-DoFnr8ZH.js → cloud.module-ascz58c3.js} +2 -2
- package/dist/core/web/public/next/assets/{cloud.module-DoFnr8ZH.js.map → cloud.module-ascz58c3.js.map} +1 -1
- package/dist/core/web/public/next/assets/{command-bus-CMvbYP5K.js → command-bus-xYZoK9nQ.js} +2 -2
- package/dist/core/web/public/next/assets/{command-bus-CMvbYP5K.js.map → command-bus-xYZoK9nQ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{context-model-Ci3Ch9t5.js → context-model-BC-HOmPo.js} +2 -2
- package/dist/core/web/public/next/assets/{context-model-Ci3Ch9t5.js.map → context-model-BC-HOmPo.js.map} +1 -1
- package/dist/core/web/public/next/assets/{context-model-CjiJTnf1.js → context-model-CIBmSugV.js} +2 -2
- package/dist/core/web/public/next/assets/{context-model-CjiJTnf1.js.map → context-model-CIBmSugV.js.map} +1 -1
- package/dist/core/web/public/next/assets/{context-queries-BDXT6LQ3.js → context-queries-CrPcHWTz.js} +2 -2
- package/dist/core/web/public/next/assets/{context-queries-BDXT6LQ3.js.map → context-queries-CrPcHWTz.js.map} +1 -1
- package/dist/core/web/public/next/assets/{control-queries-Dv-h1Clu.js → control-queries-CmgBgKV7.js} +2 -2
- package/dist/core/web/public/next/assets/{control-queries-Dv-h1Clu.js.map → control-queries-CmgBgKV7.js.map} +1 -1
- package/dist/core/web/public/next/assets/{dock-icons-t--Eugrd.js → dock-icons-CUh8dOxJ.js} +2 -2
- package/dist/core/web/public/next/assets/{dock-icons-t--Eugrd.js.map → dock-icons-CUh8dOxJ.js.map} +1 -1
- package/dist/core/web/public/next/assets/{dock-store-qIu7kSQE.js → dock-store-B2vlxqPu.js} +2 -2
- package/dist/core/web/public/next/assets/{dock-store-qIu7kSQE.js.map → dock-store-B2vlxqPu.js.map} +1 -1
- package/dist/core/web/public/next/assets/{fleet-model-IRbwfhkR.js → fleet-model-7i-FbzKI.js} +2 -2
- package/dist/core/web/public/next/assets/{fleet-model-IRbwfhkR.js.map → fleet-model-7i-FbzKI.js.map} +1 -1
- package/dist/core/web/public/next/assets/{fleet-queries-7FVNByX1.js → fleet-queries-DzGoqq8X.js} +2 -2
- package/dist/core/web/public/next/assets/{fleet-queries-7FVNByX1.js.map → fleet-queries-DzGoqq8X.js.map} +1 -1
- package/dist/core/web/public/next/assets/{focus-trap-QqQxQdvH.js → focus-trap-HtcoXeEq.js} +2 -2
- package/dist/core/web/public/next/assets/{focus-trap-QqQxQdvH.js.map → focus-trap-HtcoXeEq.js.map} +1 -1
- package/dist/core/web/public/next/assets/{format-CaMmVQCn.js → format-BkWdOQDL.js} +2 -2
- package/dist/core/web/public/next/assets/{format-CaMmVQCn.js.map → format-BkWdOQDL.js.map} +1 -1
- package/dist/core/web/public/next/assets/{git-model-B4S_GUNA.js → git-model-bk_RXh3y.js} +2 -2
- package/dist/core/web/public/next/assets/{git-model-B4S_GUNA.js.map → git-model-bk_RXh3y.js.map} +1 -1
- package/dist/core/web/public/next/assets/{global-BkNl4e6E.js → global-oEl9Qj8u.js} +2 -2
- package/dist/core/web/public/next/assets/{global-BkNl4e6E.js.map → global-oEl9Qj8u.js.map} +1 -1
- package/dist/core/web/public/next/assets/{guarded-action-DHiL8tY5.js → guarded-action-OzqcPjmh.js} +3 -3
- package/dist/core/web/public/next/assets/{guarded-action-DHiL8tY5.js.map → guarded-action-OzqcPjmh.js.map} +1 -1
- package/dist/core/web/public/next/assets/{guarded-runners-DmGEkM2P.js → guarded-runners-LHLXmXIk.js} +2 -2
- package/dist/core/web/public/next/assets/{guarded-runners-DmGEkM2P.js.map → guarded-runners-LHLXmXIk.js.map} +1 -1
- package/dist/core/web/public/next/assets/{icon-base-NtFmP2yB.js → icon-base-DvM1eI5V.js} +2 -2
- package/dist/core/web/public/next/assets/{icon-base-NtFmP2yB.js.map → icon-base-DvM1eI5V.js.map} +1 -1
- package/dist/core/web/public/next/assets/{icons-C5EFt_Ts.js → icons-DEQa2rTx.js} +2 -2
- package/dist/core/web/public/next/assets/{icons-C5EFt_Ts.js.map → icons-DEQa2rTx.js.map} +1 -1
- package/dist/core/web/public/next/assets/{index-DbDw9UAs.js → index-BVxOlseC.js} +3 -3
- package/dist/core/web/public/next/assets/{index-DbDw9UAs.js.map → index-BVxOlseC.js.map} +1 -1
- package/dist/core/web/public/next/assets/{live-model-DEwrl7_A.js → live-model-bmsJgnYD.js} +2 -2
- package/dist/core/web/public/next/assets/{live-model-DEwrl7_A.js.map → live-model-bmsJgnYD.js.map} +1 -1
- package/dist/core/web/public/next/assets/{mind.module-CLhqMQak.js → mind.module-gTGAuJt1.js} +2 -2
- package/dist/core/web/public/next/assets/{mind.module-CLhqMQak.js.map → mind.module-gTGAuJt1.js.map} +1 -1
- package/dist/core/web/public/next/assets/{mutations-Kvzsg-iK.js → mutations-C5S7okTW.js} +2 -2
- package/dist/core/web/public/next/assets/{mutations-Kvzsg-iK.js.map → mutations-C5S7okTW.js.map} +1 -1
- package/dist/core/web/public/next/assets/{nav-C0IunEYF.js → nav-NVtnuG7A.js} +2 -2
- package/dist/core/web/public/next/assets/{nav-C0IunEYF.js.map → nav-NVtnuG7A.js.map} +1 -1
- package/dist/core/web/public/next/assets/{overnight-queries-C_AfcL7q.js → overnight-queries-DGm3qL1b.js} +2 -2
- package/dist/core/web/public/next/assets/{overnight-queries-C_AfcL7q.js.map → overnight-queries-DGm3qL1b.js.map} +1 -1
- package/dist/core/web/public/next/assets/{preloaded-CctOitLu.js → preloaded-Cwf9rsnZ.js} +2 -2
- package/dist/core/web/public/next/assets/{preloaded-CctOitLu.js.map → preloaded-Cwf9rsnZ.js.map} +1 -1
- package/dist/core/web/public/next/assets/primitives-DyCKYSBG.js +1 -0
- package/dist/core/web/public/next/assets/{queries-THD05gHP.js → queries-CYisSAAB.js} +2 -2
- package/dist/core/web/public/next/assets/{queries-THD05gHP.js.map → queries-CYisSAAB.js.map} +1 -1
- package/dist/core/web/public/next/assets/{reasoning-pref-BVPu0SME.js → reasoning-pref-BUcFF_5G.js} +2 -2
- package/dist/core/web/public/next/assets/{reasoning-pref-BVPu0SME.js.map → reasoning-pref-BUcFF_5G.js.map} +1 -1
- package/dist/core/web/public/next/assets/{reveal-anchor-wCT5b4m3.js → reveal-anchor-D-tV8xau.js} +2 -2
- package/dist/core/web/public/next/assets/{reveal-anchor-wCT5b4m3.js.map → reveal-anchor-D-tV8xau.js.map} +1 -1
- package/dist/core/web/public/next/assets/{seat-subscription-CR_VylsK.js → seat-subscription-B-f9ViU2.js} +2 -2
- package/dist/core/web/public/next/assets/{seat-subscription-CR_VylsK.js.map → seat-subscription-B-f9ViU2.js.map} +1 -1
- package/dist/core/web/public/next/assets/{section-visibility-B0xXUQJ0.js → section-visibility-Yctxu-if.js} +2 -2
- package/dist/core/web/public/next/assets/{section-visibility-B0xXUQJ0.js.map → section-visibility-Yctxu-if.js.map} +1 -1
- package/dist/core/web/public/next/assets/{sidebar-model-C5wVXGpb.js → sidebar-model-DQ-FyBHW.js} +2 -2
- package/dist/core/web/public/next/assets/{sidebar-model-C5wVXGpb.js.map → sidebar-model-DQ-FyBHW.js.map} +1 -1
- package/dist/core/web/public/next/assets/{slots-DDd8cEoh.js → slots-BhP8b8tf.js} +3 -3
- package/dist/core/web/public/next/assets/{slots-DDd8cEoh.js.map → slots-BhP8b8tf.js.map} +1 -1
- package/dist/core/web/public/next/assets/{surface-data-BFxAlefI.js → surface-data-DTI7LjvH.js} +2 -2
- package/dist/core/web/public/next/assets/{surface-data-BFxAlefI.js.map → surface-data-DTI7LjvH.js.map} +1 -1
- package/dist/core/web/public/next/assets/surface-prefetch-CdUEBFrl.js +2 -0
- package/dist/core/web/public/next/assets/{surface-prefetch-CHusyO9q.js.map → surface-prefetch-CdUEBFrl.js.map} +1 -1
- package/dist/core/web/public/next/assets/{tasks-model-DvkWveXs.js → tasks-model-BKDNqmmt.js} +2 -2
- package/dist/core/web/public/next/assets/{tasks-model-DvkWveXs.js.map → tasks-model-BKDNqmmt.js.map} +1 -1
- package/dist/core/web/public/next/assets/{terminal-icons-Dp6pJgV2.js → terminal-icons-D2xe-aM1.js} +2 -2
- package/dist/core/web/public/next/assets/{terminal-icons-Dp6pJgV2.js.map → terminal-icons-D2xe-aM1.js.map} +1 -1
- package/dist/core/web/public/next/assets/{usage-queries-CUTmnegA.js → usage-queries-BZuAANlI.js} +2 -2
- package/dist/core/web/public/next/assets/{usage-queries-CUTmnegA.js.map → usage-queries-BZuAANlI.js.map} +1 -1
- package/dist/core/web/public/next/assets/{use-guarded-action-UCX2u1t1.js → use-guarded-action-Cf4MeNBa.js} +2 -2
- package/dist/core/web/public/next/assets/{use-guarded-action-UCX2u1t1.js.map → use-guarded-action-Cf4MeNBa.js.map} +1 -1
- package/dist/core/web/public/next/assets/{use-ticker-OXAjob3y.js → use-ticker-D9yi49my.js} +2 -2
- package/dist/core/web/public/next/assets/{use-ticker-OXAjob3y.js.map → use-ticker-D9yi49my.js.map} +1 -1
- package/dist/core/web/public/next/assets/{use-token-gate-CDDRAoKH.js → use-token-gate-DqrSXdX6.js} +2 -2
- package/dist/core/web/public/next/assets/{use-token-gate-CDDRAoKH.js.map → use-token-gate-DqrSXdX6.js.map} +1 -1
- package/dist/core/web/public/next/assets/{useChartWidth-D9M7kUw7.js → useChartWidth-owwodNVz.js} +2 -2
- package/dist/core/web/public/next/assets/{useChartWidth-D9M7kUw7.js.map → useChartWidth-owwodNVz.js.map} +1 -1
- package/dist/core/web/public/next/assets/{useSeatsRefresh-B2dCVcj9.js → useSeatsRefresh-DgFy-Ph4.js} +2 -2
- package/dist/core/web/public/next/assets/{useSeatsRefresh-B2dCVcj9.js.map → useSeatsRefresh-DgFy-Ph4.js.map} +1 -1
- package/dist/core/web/public/next/assets/{useVerseTranscript-BL3CljSI.js → useVerseTranscript-CDYrrWOO.js} +2 -2
- package/dist/core/web/public/next/assets/{useVerseTranscript-BL3CljSI.js.map → useVerseTranscript-CDYrrWOO.js.map} +1 -1
- package/dist/core/web/public/next/assets/{verse-icons-DASWdYuE.js → verse-icons-F9VwX07_.js} +2 -2
- package/dist/core/web/public/next/assets/{verse-icons-DASWdYuE.js.map → verse-icons-F9VwX07_.js.map} +1 -1
- package/dist/core/web/public/next/assets/{verse-model-BQ0Y2CSr.js → verse-model-DyCwZF-M.js} +2 -2
- package/dist/core/web/public/next/assets/{verse-model-BQ0Y2CSr.js.map → verse-model-DyCwZF-M.js.map} +1 -1
- package/dist/core/web/public/next/assets/{verse-ui-store-D7YXi63q.js → verse-ui-store-62DxpVHS.js} +3 -3
- package/dist/core/web/public/next/assets/{verse-ui-store-D7YXi63q.js.map → verse-ui-store-62DxpVHS.js.map} +1 -1
- package/dist/core/web/public/next/assets/{viewport-BYGH5EgA.js → viewport-nTubFCwf.js} +2 -2
- package/dist/core/web/public/next/assets/{viewport-BYGH5EgA.js.map → viewport-nTubFCwf.js.map} +1 -1
- package/dist/core/web/public/next/assets/{warmup-AsqwWCUi.js → warmup-HG5vYbsN.js} +3 -3
- package/dist/core/web/public/next/assets/{warmup-AsqwWCUi.js.map → warmup-HG5vYbsN.js.map} +1 -1
- package/dist/core/web/public/next/assets/{workspace-model-CXorJr0G.js → workspace-model-CbhdPhei.js} +2 -2
- package/dist/core/web/public/next/assets/{workspace-model-CXorJr0G.js.map → workspace-model-CbhdPhei.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 +1 -1
- package/dist/core/web/public/next/assets/AutonomySection-D3d8lYO3.js +0 -2
- package/dist/core/web/public/next/assets/McpSection-DvHFaVyp.js +0 -2
- package/dist/core/web/public/next/assets/primitives-CbAGCNKt.js +0 -1
- package/dist/core/web/public/next/assets/surface-prefetch-CHusyO9q.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-model-Ci3Ch9t5.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/context/context-model.ts"],"sourcesContent":["/**\n * routes/verse/context/context-model.ts — the pure half of the context\n * components (handoff dialog, memory panel, session search). No React, no\n * I/O, so every rule the components render is pinned by a plain unit test.\n *\n * Every number shown here comes from context-math.ts (the one module the\n * server and the browser share), so \"compacts ≈367k\" in the handoff dialog is\n * the same figure the meter and the seat picker show.\n */\nimport type { VerseEngine, VerseModelOption, VerseSeat, VerseSession } from '../../../data/api-types.js';\nimport type {\n VerseContextMode,\n VerseFitVerdict,\n VersePreferences,\n VerseSearchHit,\n} from '../../../../core/verse/types.js';\nimport { VERSE_MEMORY_BLOCK_MAX_BYTES, VERSE_MEMORY_BODY_MAX_BYTES } from '../../../../core/verse/types.js';\nimport {\n budgetFor,\n canonicalModelId,\n estimateTokensFromChars,\n fitVerdict,\n hasExpansiveMode,\n sessionOverheadTokens,\n} from '../../../../core/verse/context-math.js';\nimport { formatRelative } from '../verse-model.js';\nimport { asClause, percentText, tidyProse } from '../autonomy/format.js';\nimport { formatTokens } from '../verse-store.js';\n\n// ---------------------------------------------------------------------------\n// Handoff\n// ---------------------------------------------------------------------------\n\n// The canned \"Ask this seat to summarize first\" turn is\n// VERSE_HANDOFF_SUMMARY_REQUEST in core/verse/types.ts, not a copy here: the\n// handoff builder on the server matches that exact text to keep it OUT of the\n// new session's \"latest requests\" (otherwise the new chat is told to write\n// another handoff note). A local copy that drifted by one character would\n// silently defeat that filter.\n\n/** Mirrors session-engine's TITLE_MAX so a title we send is never cut by the server instead. */\nexport const TITLE_MAX_CHARS = 120;\n\nconst PART_SUFFIX = /\\s·\\spart\\s(\\d+)$/;\n\n/**\n * Title for the session a handoff continues in: \"Fix the login bug · part 2\".\n * A continuation of a continuation counts up rather than stacking suffixes, so\n * the sidebar reads \"part 3\", never \"part 2 · part 2\".\n */\nexport function handoffTitle(sourceTitle: string): string {\n const collapsed = sourceTitle.replace(/\\s+/g, ' ').trim();\n const match = PART_SUFFIX.exec(collapsed);\n const base = (match ? collapsed.slice(0, match.index) : collapsed) || 'Untitled chat';\n const next = match ? Number.parseInt(match[1]!, 10) + 1 : 2;\n const suffix = ` · part ${next}`;\n const room = TITLE_MAX_CHARS - suffix.length;\n const clipped = base.length > room ? `${base.slice(0, room - 1).trimEnd()}…` : base;\n return `${clipped}${suffix}`;\n}\n\n/**\n * A seat's catalog entry for a model id. Exact id first, then canonical — a\n * session created before the alias fix stores `claude-opus-5.5` while the\n * catalog now lists `claude-opus-5-5` (context-math VERSE_MODEL_ID_ALIASES).\n */\nexport function modelOption(seat: VerseSeat | null | undefined, modelId: string): VerseModelOption | null {\n if (!seat) return null;\n const exact = seat.models.find((m) => m.id === modelId);\n if (exact) return exact;\n const canonical = canonicalModelId(modelId);\n return seat.models.find((m) => canonicalModelId(m.id) === canonical) ?? null;\n}\n\n/**\n * Why a seat+model cannot take a new session right now; null when it can.\n *\n * The seat's own reason is embedded as a clause: its closing period is\n * dropped (no \"exhausted..\") and any ISO instant in it — a health summary\n * saying when usage resets — is read as the viewer's local time.\n */\nexport function targetUnavailableReason(\n seat: VerseSeat | null | undefined,\n option: VerseModelOption | null,\n now: number = Date.now(),\n): string | null {\n if (!seat) return 'Pick a seat to continue on.';\n if (seat.health.state === 'unavailable') {\n return `${seat.label} is unavailable: ${asClause(tidyProse(seat.health.summary ?? 'no reason given', now))}.`;\n }\n if (!option) return 'Pick a model on this seat.';\n if (option.unavailableReason) {\n return `${option.label} cannot run on ${seat.label}: ${asClause(tidyProse(option.unavailableReason, now))}.`;\n }\n return null;\n}\n\nexport interface HandoffTarget {\n seatId: string;\n model: string;\n}\n\n/**\n * Where a handoff lands by default: the SAME seat and model (the common case\n * is \"same agent, fresh context\"). When that model can no longer run there,\n * the seat's first runnable model; when the seat itself is gone or\n * unavailable, the first runnable model on any available seat, in the seat\n * list's own order.\n */\nexport function defaultHandoffTarget(seats: readonly VerseSeat[], source: Pick<VerseSession, 'seatId' | 'model'>): HandoffTarget | null {\n const own = seats.find((s) => s.id === source.seatId);\n if (own && own.health.state !== 'unavailable') {\n const same = modelOption(own, source.model);\n if (same && !same.unavailableReason) return { seatId: own.id, model: same.id };\n const runnable = own.models.find((m) => !m.unavailableReason);\n if (runnable) return { seatId: own.id, model: runnable.id };\n }\n for (const seat of seats) {\n if (seat.health.state === 'unavailable') continue;\n const runnable = seat.models.find((m) => !m.unavailableReason);\n if (runnable) return { seatId: seat.id, model: runnable.id };\n }\n return null;\n}\n\n/**\n * The mode a handoff starts in. Only a mode that EXISTS for the target model\n * is ever returned (a mode with no budget would be refused by the server).\n *\n * 1. Same seat and model as the source → keep the source's mode. \"Continue in\n * a fresh chat\" means the same settings with a clean context; an operator\n * who chose expansive for this work chose it for the work.\n * 2. Otherwise the target seat's standing preference (preferences.json).\n * 3. Otherwise standard.\n */\nexport function defaultHandoffMode(input: {\n option: VerseModelOption | null;\n target: HandoffTarget | null;\n source: Pick<VerseSession, 'seatId' | 'model' | 'contextMode'>;\n preferences: VersePreferences | null | undefined;\n}): VerseContextMode {\n const { option, target, source, preferences } = input;\n const valid = (mode: VerseContextMode | undefined): mode is VerseContextMode =>\n mode !== undefined && budgetFor(option, mode) !== null;\n const sameModel = target !== null && target.seatId === source.seatId\n && canonicalModelId(target.model) === canonicalModelId(source.model);\n if (sameModel && valid(source.contextMode ?? 'standard')) return source.contextMode ?? 'standard';\n const preferred = target ? preferences?.seats[target.seatId]?.contextMode : undefined;\n if (valid(preferred)) return preferred;\n return 'standard';\n}\n\n/**\n * The mode to put on the create request, or undefined to leave it to the\n * server. A mode is sent only when the model has a budget for it — which is\n * exactly the server's acceptance rule — so what the dialog shows is what is\n * created, and an unknown-window model is never refused over a mode it could\n * not have.\n */\nexport function requestMode(option: VerseModelOption | null, mode: VerseContextMode): VerseContextMode | undefined {\n return budgetFor(option, mode) !== null ? mode : undefined;\n}\n\n/** \"1M window · compacts ≈367k\" for a model in a mode; null when the budget is unknown. */\nexport function budgetLine(option: VerseModelOption | null, mode: VerseContextMode): string | null {\n const budget = budgetFor(option, mode);\n if (!budget) return null;\n const window = `${formatTokens(budget.contextWindow)} window`;\n return budget.autoCompactAt === null ? window : `${window} · compacts ≈${formatTokens(budget.autoCompactAt)}`;\n}\n\nexport interface HandoffFit {\n verdict: VerseFitVerdict | null;\n /** The handoff text's own estimate (chars / 4). */\n handoffTokens: number;\n /** The target engine's estimated fixed prompt (context-math `sessionOverheadTokens`). */\n overheadTokens: number;\n /** Handoff + that fixed prompt: what the new session holds before its first reply. */\n needTokens: number;\n /** One sentence for the dialog. */\n text: string;\n tone: 'ok' | 'warn' | 'danger' | 'unknown';\n}\n\n/**\n * Will the new session START comfortably? The handoff is small by design\n * (≤ 12k chars ≈ 3k tokens), but every fresh session also carries the CLI's\n * fixed prompt — a large share of a 64k local slot — so this is a real\n * question on small windows, and the sentence shows both halves of the sum\n * rather than a bare verdict.\n *\n * The fixed prompt is the TARGET seat's engine estimate (local ≈15k measured,\n * claude ≈25k, …), not one flat figure: a flat 30k called every handoff to a\n * 64k local seat \"too big for one context\" when the real sum was ~20k. It is\n * still an estimate — no CLI reports its base prompt before the first turn —\n * so the sentence says \"estimated\" rather than presenting it as a reading.\n * `engine` null (target seat not known yet) falls back to the largest estimate.\n */\nexport function handoffFit(\n textChars: number,\n option: VerseModelOption | null,\n mode: VerseContextMode,\n engine: VerseEngine | null,\n): HandoffFit {\n const handoffTokens = estimateTokensFromChars(textChars);\n const overheadTokens = sessionOverheadTokens(engine);\n const needTokens = handoffTokens + overheadTokens;\n const verdict = fitVerdict(handoffTokens, option, overheadTokens);\n const sum = `~${formatTokens(handoffTokens)} tokens of handoff + an estimated ~${formatTokens(overheadTokens)} of fixed prompt`;\n const standard = budgetFor(option, 'standard');\n const standardCap = standard ? standard.autoCompactAt ?? standard.contextWindow : null;\n const base = { verdict, handoffTokens, overheadTokens, needTokens };\n switch (verdict) {\n case 'fits':\n return { ...base, tone: 'ok', text: `Fits: ${sum} leaves most of the budget before the first compaction.` };\n case 'tight':\n return {\n ...base,\n tone: 'warn',\n text: `Tight: ${sum} is ${percentText((needTokens / (standardCap ?? needTokens)) * 100)} of where this model compacts — the new chat will compact early.`,\n };\n case 'expansive':\n return mode === 'expansive'\n ? { ...base, tone: 'warn', text: `Fits only the expansive budget: ${sum}.` }\n : { ...base, tone: 'danger', text: `Too big for the standard budget (${sum}). Switch to Expansive, or trim the handoff.` };\n case 'split':\n return { ...base, tone: 'danger', text: `Too big for one context on this model (${sum}). Trim the handoff or pick a seat with a larger window.` };\n default:\n return { ...base, verdict: null, tone: 'unknown', text: 'This model’s window is not known, so there is no fit estimate.' };\n }\n}\n\n/** True when the target model has a real expansive budget (context-math, re-exported for the dialog). */\nexport function offersExpansive(option: VerseModelOption | null): boolean {\n return hasExpansiveMode(option);\n}\n\n/** A local turn runs on this machine; every other engine spends subscription usage. */\nexport function turnCostSentence(engine: VerseEngine, seatLabel: string): string {\n return engine === 'local'\n ? `Runs on this machine with ${seatLabel}; it spends no subscription usage.`\n : `Sends one turn to ${seatLabel} and spends from its usage. The automatic preview costs nothing.`;\n}\n\n// ---------------------------------------------------------------------------\n// Bytes\n// ---------------------------------------------------------------------------\n\nconst encoder = typeof TextEncoder === 'function' ? new TextEncoder() : null;\n\n/** UTF-8 byte length — the unit the server's caps (64 KB memory content, 64 KB turn) are written in. */\nexport function utf8Bytes(text: string): number {\n if (encoder) return encoder.encode(text).length;\n // Fallback for an environment with no TextEncoder: count code points by width.\n let bytes = 0;\n for (const ch of text) {\n const cp = ch.codePointAt(0) ?? 0;\n bytes += cp < 0x80 ? 1 : cp < 0x800 ? 2 : cp < 0x10000 ? 3 : 4;\n }\n return bytes;\n}\n\n/**\n * The API's default request-body cap: `readBody` in src/core/web/api.ts, which\n * every /api/verse POST uses unless its route passes a larger one (only\n * POST /memory does — see MEMORY_BODY_MAX_BYTES). A write travels as JSON, so what must fit is\n * the ENCODED body — every `\\n` and `\"` escaped to two bytes — not the text\n * alone; the editors measure it so a refusal happens on screen instead of as\n * \"request body too large\".\n */\nexport const API_BODY_MAX_BYTES = 65_536;\n\n/**\n * POST /api/verse/memory's own body cap — mirrors `VERSE_MEMORY_BODY_MAX_BYTES`\n * in src/core/verse/verse-api.ts (a server module the browser cannot import):\n * room for 64 KiB of content in which EVERY byte escapes to two, plus the\n * project path and the JSON around it. The server still holds the CONTENT to\n * VERSE_MEMORY_MAX_BYTES after parsing. Guarding the memory editor with the\n * 64 KiB default instead blocked saves the server accepts — a 60–64 KB\n * MEMORY.md with ordinary line breaks could not be edited from the panel,\n * which is the exact case the server's larger cap exists for.\n */\nexport const MEMORY_BODY_MAX_BYTES = VERSE_MEMORY_BODY_MAX_BYTES;\n\n/** UTF-8 size of `body` exactly as the client will send it. */\nexport function jsonBodyBytes(body: unknown): number {\n return utf8Bytes(JSON.stringify(body) ?? '');\n}\n\nexport function formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes < 0) return '—';\n if (bytes < 1024) return `${bytes} B`;\n const kb = bytes / 1024;\n return `${kb < 10 ? kb.toFixed(1).replace(/\\.0$/, '') : Math.round(kb)} KB`;\n}\n\n/**\n * A relative time that reads as a phrase: \"just now\", \"5m ago\", \"on Sep 19\".\n * `formatRelative` (verse-model) is sized for a 5ch sidebar column and reads\n * as a bare token; prose needs the preposition.\n */\nexport function relativePhrase(iso: string | null | undefined, now: number = Date.now()): string | null {\n if (!iso) return null;\n const short = formatRelative(iso, now);\n if (!short) return null;\n if (short === 'now') return 'just now';\n // Only the relative tokens (\"5m\", \"3h\", \"2d\") take \"ago\". Anything else is a\n // DATE, whatever the locale prints: \"Sep 1\" (en-US) but \"1 Sept\" (en-GB)\n // and \"1. Sept.\" (de) start with a digit — testing for a leading digit\n // printed \"Last completed 1 Sept ago.\" outside the US.\n return /^\\d+[mhd]$/.test(short) ? `${short} ago` : `on ${short}`;\n}\n\n// ---------------------------------------------------------------------------\n// Memory\n// ---------------------------------------------------------------------------\n\n/**\n * Shapes that are almost certainly credentials. MEMORY.md is sent to every\n * seat's model on every turn, so a pasted key would travel to every provider\n * — the panel warns BEFORE the save rather than trusting the server's scrub\n * to catch it on the way out. Conservative on purpose: a false alarm on prose\n * would teach the operator to ignore the warning.\n */\nconst SECRET_PATTERNS: ReadonlyArray<{ label: string; re: RegExp }> = [\n { label: 'a private key', re: /-----BEGIN [A-Z ]*PRIVATE KEY-----/ },\n { label: 'an Anthropic API key', re: /\\bsk-ant-[A-Za-z0-9_-]{20,}/ },\n { label: 'an OpenAI-style API key', re: /\\bsk-(?:proj-)?[A-Za-z0-9_-]{32,}/ },\n { label: 'an xAI API key', re: /\\bxai-[A-Za-z0-9]{32,}/ },\n { label: 'a GitHub token', re: /\\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{30,}|\\bgithub_pat_[A-Za-z0-9_]{40,}/ },\n { label: 'an AWS access key', re: /\\b(?:AKIA|ASIA)[0-9A-Z]{16}\\b/ },\n { label: 'a Slack token', re: /\\bxox[abprs]-[A-Za-z0-9-]{10,}/ },\n { label: 'a Google API key', re: /\\bAIza[0-9A-Za-z_-]{35}\\b/ },\n { label: 'a Stripe secret key', re: /\\b(?:sk|rk)_live_[0-9A-Za-z]{20,}/ },\n];\n\n/**\n * Mirrors `VERSE_MEMORY_BLOCK_MAX_BYTES` in src/core/verse/project-memory.ts\n * (a node module the browser cannot import): the most memory text a chat's\n * instructions carry, however large MEMORY.md itself is.\n */\nexport const MEMORY_BLOCK_MAX_BYTES = VERSE_MEMORY_BLOCK_MAX_BYTES;\n\n/**\n * What memory costs, in the one wording the memory panel and the resources\n * panel share. Memory is ON by default and snapshotted into every new chat's\n * system prompt (claude `--append-system-prompt`, codex `developer_instructions`,\n * grok `--rules`), which re-rides every turn, and it asks writable seats to\n * read and update MEMORY.md — tool calls and output. On a paid seat that is\n * real (if small, mostly cached) usage, so \"nothing here spends\" would be\n * false for exactly the operator deciding whether to leave it on near a limit.\n * Reading and editing the file from the panel is still free.\n */\nexport const MEMORY_SPEND_NOTE =\n `Reading and editing memory here spends nothing. On a paid seat it is not free to use: each new chat’s system prompt carries a memory block of up to ${MEMORY_BLOCK_MAX_BYTES / 1024} KB, re-sent every turn (cached after the first), and the agent reads and updates MEMORY.md as it works. Local seats spend nothing.`;\n\n/** The first credential shape found, as a phrase (\"a GitHub token\"), or null. */\nexport function secretLike(text: string): string | null {\n for (const { label, re } of SECRET_PATTERNS) if (re.test(text)) return label;\n return null;\n}\n\n/**\n * The placeholder the server's scrubber (src/core/util/scrub.ts) writes over\n * secret-shaped text in every rule. In a memory view flagged\n * `contentSanitized`, each one stands for a REAL value still in MEMORY.md.\n */\nexport const REDACTION_MARKER = '[REDACTED]';\n\n/** How many redaction placeholders a text carries. */\nexport function redactionMarkers(text: string): number {\n return text.split(REDACTION_MARKER).length - 1;\n}\n\n// ---------------------------------------------------------------------------\n// Search\n// ---------------------------------------------------------------------------\n\n/** Below this many characters a keyword search over every message is noise, not recall. */\nexport const SEARCH_MIN_CHARS = 2;\n/** Keystrokes inside this window collapse into one request. */\nexport const SEARCH_DEBOUNCE_MS = 250;\n/** Hits asked for per search — enough to fill the sidebar twice over. */\nexport const SEARCH_LIMIT = 30;\n\n/** Whitespace-separated terms, lowercased and de-duplicated (the server ANDs them). */\nexport function searchTerms(query: string): string[] {\n const out: string[] = [];\n for (const raw of query.toLowerCase().split(/\\s+/)) {\n if (raw && !out.includes(raw)) out.push(raw);\n }\n return out;\n}\n\nexport interface HighlightSegment {\n text: string;\n match: boolean;\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Split `text` into plain and matched runs for every term, case-insensitive.\n * Longest terms first so \"migrate\" wins over \"migrat\" at the same position.\n */\nexport function highlightSegments(text: string, terms: readonly string[]): HighlightSegment[] {\n const usable = [...terms].filter((t) => t.length > 0).sort((a, b) => b.length - a.length);\n if (usable.length === 0 || text.length === 0) return text ? [{ text, match: false }] : [];\n const re = new RegExp(usable.map(escapeRegExp).join('|'), 'gi');\n const out: HighlightSegment[] = [];\n let last = 0;\n for (const m of text.matchAll(re)) {\n const start = m.index ?? 0;\n if (m[0].length === 0) continue;\n if (start > last) out.push({ text: text.slice(last, start), match: false });\n out.push({ text: m[0], match: true });\n last = start + m[0].length;\n }\n if (last < text.length) out.push({ text: text.slice(last), match: false });\n return out;\n}\n\nexport interface SessionSearchGroup {\n sessionId: string;\n title: string;\n projectPath: string;\n engine: VerseEngine;\n /** The best-scoring hit in this session (the server returns hits best-first). */\n top: VerseSearchHit;\n /** Every hit this session contributed to the response. */\n count: number;\n /** Newest hit time, for the row's relative time. */\n latestAt: string;\n}\n\n/**\n * One row per session. The server ranks MESSAGES; the sidebar lists CHATS,\n * and five rows for one chat would push every other match off screen. Order\n * is the order each session first appears, i.e. by its best hit.\n */\nexport function groupSearchHits(hits: readonly VerseSearchHit[]): SessionSearchGroup[] {\n const groups = new Map<string, SessionSearchGroup>();\n for (const hit of hits) {\n const existing = groups.get(hit.sessionId);\n if (!existing) {\n groups.set(hit.sessionId, {\n sessionId: hit.sessionId,\n title: hit.title,\n projectPath: hit.projectPath,\n engine: hit.engine,\n top: hit,\n count: 1,\n latestAt: hit.at,\n });\n continue;\n }\n existing.count += 1;\n if (hit.at > existing.latestAt) existing.latestAt = hit.at;\n }\n return [...groups.values()];\n}\n"],"mappings":"2MA2CA,IAAM,EAAc,oBAOpB,SAAgB,EAAa,EAA6B,CACxD,IAAM,EAAY,EAAY,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,EAClD,EAAQ,EAAY,KAAK,CAAS,EAClC,GAAQ,EAAQ,EAAU,MA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EACP,SAAU,EAAI,EAChB,CAAC,EACD,QACF,CACA,EAAS,OAAS,EACd,EAAI,GAAK,EAAS,WAAU,EAAS,SAAW,EAAI,GAC1D,CACA,MAAO,CAAC,GAAG,EAAO,OAAO,CAAC,CAC5B"}
|
|
1
|
+
{"version":3,"file":"context-model-BC-HOmPo.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/context/context-model.ts"],"sourcesContent":["/**\n * routes/verse/context/context-model.ts — the pure half of the context\n * components (handoff dialog, memory panel, session search). No React, no\n * I/O, so every rule the components render is pinned by a plain unit test.\n *\n * Every number shown here comes from context-math.ts (the one module the\n * server and the browser share), so \"compacts ≈367k\" in the handoff dialog is\n * the same figure the meter and the seat picker show.\n */\nimport type { VerseEngine, VerseModelOption, VerseSeat, VerseSession } from '../../../data/api-types.js';\nimport type {\n VerseContextMode,\n VerseFitVerdict,\n VersePreferences,\n VerseSearchHit,\n} from '../../../../core/verse/types.js';\nimport { VERSE_MEMORY_BLOCK_MAX_BYTES, VERSE_MEMORY_BODY_MAX_BYTES } from '../../../../core/verse/types.js';\nimport {\n budgetFor,\n canonicalModelId,\n estimateTokensFromChars,\n fitVerdict,\n hasExpansiveMode,\n sessionOverheadTokens,\n} from '../../../../core/verse/context-math.js';\nimport { formatRelative } from '../verse-model.js';\nimport { asClause, percentText, tidyProse } from '../autonomy/format.js';\nimport { formatTokens } from '../verse-store.js';\n\n// ---------------------------------------------------------------------------\n// Handoff\n// ---------------------------------------------------------------------------\n\n// The canned \"Ask this seat to summarize first\" turn is\n// VERSE_HANDOFF_SUMMARY_REQUEST in core/verse/types.ts, not a copy here: the\n// handoff builder on the server matches that exact text to keep it OUT of the\n// new session's \"latest requests\" (otherwise the new chat is told to write\n// another handoff note). A local copy that drifted by one character would\n// silently defeat that filter.\n\n/** Mirrors session-engine's TITLE_MAX so a title we send is never cut by the server instead. */\nexport const TITLE_MAX_CHARS = 120;\n\nconst PART_SUFFIX = /\\s·\\spart\\s(\\d+)$/;\n\n/**\n * Title for the session a handoff continues in: \"Fix the login bug · part 2\".\n * A continuation of a continuation counts up rather than stacking suffixes, so\n * the sidebar reads \"part 3\", never \"part 2 · part 2\".\n */\nexport function handoffTitle(sourceTitle: string): string {\n const collapsed = sourceTitle.replace(/\\s+/g, ' ').trim();\n const match = PART_SUFFIX.exec(collapsed);\n const base = (match ? collapsed.slice(0, match.index) : collapsed) || 'Untitled chat';\n const next = match ? Number.parseInt(match[1]!, 10) + 1 : 2;\n const suffix = ` · part ${next}`;\n const room = TITLE_MAX_CHARS - suffix.length;\n const clipped = base.length > room ? `${base.slice(0, room - 1).trimEnd()}…` : base;\n return `${clipped}${suffix}`;\n}\n\n/**\n * A seat's catalog entry for a model id. Exact id first, then canonical — a\n * session created before the alias fix stores `claude-opus-5.5` while the\n * catalog now lists `claude-opus-5-5` (context-math VERSE_MODEL_ID_ALIASES).\n */\nexport function modelOption(seat: VerseSeat | null | undefined, modelId: string): VerseModelOption | null {\n if (!seat) return null;\n const exact = seat.models.find((m) => m.id === modelId);\n if (exact) return exact;\n const canonical = canonicalModelId(modelId);\n return seat.models.find((m) => canonicalModelId(m.id) === canonical) ?? null;\n}\n\n/**\n * Why a seat+model cannot take a new session right now; null when it can.\n *\n * The seat's own reason is embedded as a clause: its closing period is\n * dropped (no \"exhausted..\") and any ISO instant in it — a health summary\n * saying when usage resets — is read as the viewer's local time.\n */\nexport function targetUnavailableReason(\n seat: VerseSeat | null | undefined,\n option: VerseModelOption | null,\n now: number = Date.now(),\n): string | null {\n if (!seat) return 'Pick a seat to continue on.';\n if (seat.health.state === 'unavailable') {\n return `${seat.label} is unavailable: ${asClause(tidyProse(seat.health.summary ?? 'no reason given', now))}.`;\n }\n if (!option) return 'Pick a model on this seat.';\n if (option.unavailableReason) {\n return `${option.label} cannot run on ${seat.label}: ${asClause(tidyProse(option.unavailableReason, now))}.`;\n }\n return null;\n}\n\nexport interface HandoffTarget {\n seatId: string;\n model: string;\n}\n\n/**\n * Where a handoff lands by default: the SAME seat and model (the common case\n * is \"same agent, fresh context\"). When that model can no longer run there,\n * the seat's first runnable model; when the seat itself is gone or\n * unavailable, the first runnable model on any available seat, in the seat\n * list's own order.\n */\nexport function defaultHandoffTarget(seats: readonly VerseSeat[], source: Pick<VerseSession, 'seatId' | 'model'>): HandoffTarget | null {\n const own = seats.find((s) => s.id === source.seatId);\n if (own && own.health.state !== 'unavailable') {\n const same = modelOption(own, source.model);\n if (same && !same.unavailableReason) return { seatId: own.id, model: same.id };\n const runnable = own.models.find((m) => !m.unavailableReason);\n if (runnable) return { seatId: own.id, model: runnable.id };\n }\n for (const seat of seats) {\n if (seat.health.state === 'unavailable') continue;\n const runnable = seat.models.find((m) => !m.unavailableReason);\n if (runnable) return { seatId: seat.id, model: runnable.id };\n }\n return null;\n}\n\n/**\n * The mode a handoff starts in. Only a mode that EXISTS for the target model\n * is ever returned (a mode with no budget would be refused by the server).\n *\n * 1. Same seat and model as the source → keep the source's mode. \"Continue in\n * a fresh chat\" means the same settings with a clean context; an operator\n * who chose expansive for this work chose it for the work.\n * 2. Otherwise the target seat's standing preference (preferences.json).\n * 3. Otherwise standard.\n */\nexport function defaultHandoffMode(input: {\n option: VerseModelOption | null;\n target: HandoffTarget | null;\n source: Pick<VerseSession, 'seatId' | 'model' | 'contextMode'>;\n preferences: VersePreferences | null | undefined;\n}): VerseContextMode {\n const { option, target, source, preferences } = input;\n const valid = (mode: VerseContextMode | undefined): mode is VerseContextMode =>\n mode !== undefined && budgetFor(option, mode) !== null;\n const sameModel = target !== null && target.seatId === source.seatId\n && canonicalModelId(target.model) === canonicalModelId(source.model);\n if (sameModel && valid(source.contextMode ?? 'standard')) return source.contextMode ?? 'standard';\n const preferred = target ? preferences?.seats[target.seatId]?.contextMode : undefined;\n if (valid(preferred)) return preferred;\n return 'standard';\n}\n\n/**\n * The mode to put on the create request, or undefined to leave it to the\n * server. A mode is sent only when the model has a budget for it — which is\n * exactly the server's acceptance rule — so what the dialog shows is what is\n * created, and an unknown-window model is never refused over a mode it could\n * not have.\n */\nexport function requestMode(option: VerseModelOption | null, mode: VerseContextMode): VerseContextMode | undefined {\n return budgetFor(option, mode) !== null ? mode : undefined;\n}\n\n/** \"1M window · compacts ≈367k\" for a model in a mode; null when the budget is unknown. */\nexport function budgetLine(option: VerseModelOption | null, mode: VerseContextMode): string | null {\n const budget = budgetFor(option, mode);\n if (!budget) return null;\n const window = `${formatTokens(budget.contextWindow)} window`;\n return budget.autoCompactAt === null ? window : `${window} · compacts ≈${formatTokens(budget.autoCompactAt)}`;\n}\n\nexport interface HandoffFit {\n verdict: VerseFitVerdict | null;\n /** The handoff text's own estimate (chars / 4). */\n handoffTokens: number;\n /** The target engine's estimated fixed prompt (context-math `sessionOverheadTokens`). */\n overheadTokens: number;\n /** Handoff + that fixed prompt: what the new session holds before its first reply. */\n needTokens: number;\n /** One sentence for the dialog. */\n text: string;\n tone: 'ok' | 'warn' | 'danger' | 'unknown';\n}\n\n/**\n * Will the new session START comfortably? The handoff is small by design\n * (≤ 12k chars ≈ 3k tokens), but every fresh session also carries the CLI's\n * fixed prompt — a large share of a 64k local slot — so this is a real\n * question on small windows, and the sentence shows both halves of the sum\n * rather than a bare verdict.\n *\n * The fixed prompt is the TARGET seat's engine estimate (local ≈15k measured,\n * claude ≈25k, …), not one flat figure: a flat 30k called every handoff to a\n * 64k local seat \"too big for one context\" when the real sum was ~20k. It is\n * still an estimate — no CLI reports its base prompt before the first turn —\n * so the sentence says \"estimated\" rather than presenting it as a reading.\n * `engine` null (target seat not known yet) falls back to the largest estimate.\n */\nexport function handoffFit(\n textChars: number,\n option: VerseModelOption | null,\n mode: VerseContextMode,\n engine: VerseEngine | null,\n): HandoffFit {\n const handoffTokens = estimateTokensFromChars(textChars);\n const overheadTokens = sessionOverheadTokens(engine);\n const needTokens = handoffTokens + overheadTokens;\n const verdict = fitVerdict(handoffTokens, option, overheadTokens);\n const sum = `~${formatTokens(handoffTokens)} tokens of handoff + an estimated ~${formatTokens(overheadTokens)} of fixed prompt`;\n const standard = budgetFor(option, 'standard');\n const standardCap = standard ? standard.autoCompactAt ?? standard.contextWindow : null;\n const base = { verdict, handoffTokens, overheadTokens, needTokens };\n switch (verdict) {\n case 'fits':\n return { ...base, tone: 'ok', text: `Fits: ${sum} leaves most of the budget before the first compaction.` };\n case 'tight':\n return {\n ...base,\n tone: 'warn',\n text: `Tight: ${sum} is ${percentText((needTokens / (standardCap ?? needTokens)) * 100)} of where this model compacts — the new chat will compact early.`,\n };\n case 'expansive':\n return mode === 'expansive'\n ? { ...base, tone: 'warn', text: `Fits only the expansive budget: ${sum}.` }\n : { ...base, tone: 'danger', text: `Too big for the standard budget (${sum}). Switch to Expansive, or trim the handoff.` };\n case 'split':\n return { ...base, tone: 'danger', text: `Too big for one context on this model (${sum}). Trim the handoff or pick a seat with a larger window.` };\n default:\n return { ...base, verdict: null, tone: 'unknown', text: 'This model’s window is not known, so there is no fit estimate.' };\n }\n}\n\n/** True when the target model has a real expansive budget (context-math, re-exported for the dialog). */\nexport function offersExpansive(option: VerseModelOption | null): boolean {\n return hasExpansiveMode(option);\n}\n\n/** A local turn runs on this machine; every other engine spends subscription usage. */\nexport function turnCostSentence(engine: VerseEngine, seatLabel: string): string {\n return engine === 'local'\n ? `Runs on this machine with ${seatLabel}; it spends no subscription usage.`\n : `Sends one turn to ${seatLabel} and spends from its usage. The automatic preview costs nothing.`;\n}\n\n// ---------------------------------------------------------------------------\n// Bytes\n// ---------------------------------------------------------------------------\n\nconst encoder = typeof TextEncoder === 'function' ? new TextEncoder() : null;\n\n/** UTF-8 byte length — the unit the server's caps (64 KB memory content, 64 KB turn) are written in. */\nexport function utf8Bytes(text: string): number {\n if (encoder) return encoder.encode(text).length;\n // Fallback for an environment with no TextEncoder: count code points by width.\n let bytes = 0;\n for (const ch of text) {\n const cp = ch.codePointAt(0) ?? 0;\n bytes += cp < 0x80 ? 1 : cp < 0x800 ? 2 : cp < 0x10000 ? 3 : 4;\n }\n return bytes;\n}\n\n/**\n * The API's default request-body cap: `readBody` in src/core/web/api.ts, which\n * every /api/verse POST uses unless its route passes a larger one (only\n * POST /memory does — see MEMORY_BODY_MAX_BYTES). A write travels as JSON, so what must fit is\n * the ENCODED body — every `\\n` and `\"` escaped to two bytes — not the text\n * alone; the editors measure it so a refusal happens on screen instead of as\n * \"request body too large\".\n */\nexport const API_BODY_MAX_BYTES = 65_536;\n\n/**\n * POST /api/verse/memory's own body cap — mirrors `VERSE_MEMORY_BODY_MAX_BYTES`\n * in src/core/verse/verse-api.ts (a server module the browser cannot import):\n * room for 64 KiB of content in which EVERY byte escapes to two, plus the\n * project path and the JSON around it. The server still holds the CONTENT to\n * VERSE_MEMORY_MAX_BYTES after parsing. Guarding the memory editor with the\n * 64 KiB default instead blocked saves the server accepts — a 60–64 KB\n * MEMORY.md with ordinary line breaks could not be edited from the panel,\n * which is the exact case the server's larger cap exists for.\n */\nexport const MEMORY_BODY_MAX_BYTES = VERSE_MEMORY_BODY_MAX_BYTES;\n\n/** UTF-8 size of `body` exactly as the client will send it. */\nexport function jsonBodyBytes(body: unknown): number {\n return utf8Bytes(JSON.stringify(body) ?? '');\n}\n\nexport function formatBytes(bytes: number): string {\n if (!Number.isFinite(bytes) || bytes < 0) return '—';\n if (bytes < 1024) return `${bytes} B`;\n const kb = bytes / 1024;\n return `${kb < 10 ? kb.toFixed(1).replace(/\\.0$/, '') : Math.round(kb)} KB`;\n}\n\n/**\n * A relative time that reads as a phrase: \"just now\", \"5m ago\", \"on Sep 19\".\n * `formatRelative` (verse-model) is sized for a 5ch sidebar column and reads\n * as a bare token; prose needs the preposition.\n */\nexport function relativePhrase(iso: string | null | undefined, now: number = Date.now()): string | null {\n if (!iso) return null;\n const short = formatRelative(iso, now);\n if (!short) return null;\n if (short === 'now') return 'just now';\n // Only the relative tokens (\"5m\", \"3h\", \"2d\") take \"ago\". Anything else is a\n // DATE, whatever the locale prints: \"Sep 1\" (en-US) but \"1 Sept\" (en-GB)\n // and \"1. Sept.\" (de) start with a digit — testing for a leading digit\n // printed \"Last completed 1 Sept ago.\" outside the US.\n return /^\\d+[mhd]$/.test(short) ? `${short} ago` : `on ${short}`;\n}\n\n// ---------------------------------------------------------------------------\n// Memory\n// ---------------------------------------------------------------------------\n\n/**\n * Shapes that are almost certainly credentials. MEMORY.md is sent to every\n * seat's model on every turn, so a pasted key would travel to every provider\n * — the panel warns BEFORE the save rather than trusting the server's scrub\n * to catch it on the way out. Conservative on purpose: a false alarm on prose\n * would teach the operator to ignore the warning.\n */\nconst SECRET_PATTERNS: ReadonlyArray<{ label: string; re: RegExp }> = [\n { label: 'a private key', re: /-----BEGIN [A-Z ]*PRIVATE KEY-----/ },\n { label: 'an Anthropic API key', re: /\\bsk-ant-[A-Za-z0-9_-]{20,}/ },\n { label: 'an OpenAI-style API key', re: /\\bsk-(?:proj-)?[A-Za-z0-9_-]{32,}/ },\n { label: 'an xAI API key', re: /\\bxai-[A-Za-z0-9]{32,}/ },\n { label: 'a GitHub token', re: /\\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{30,}|\\bgithub_pat_[A-Za-z0-9_]{40,}/ },\n { label: 'an AWS access key', re: /\\b(?:AKIA|ASIA)[0-9A-Z]{16}\\b/ },\n { label: 'a Slack token', re: /\\bxox[abprs]-[A-Za-z0-9-]{10,}/ },\n { label: 'a Google API key', re: /\\bAIza[0-9A-Za-z_-]{35}\\b/ },\n { label: 'a Stripe secret key', re: /\\b(?:sk|rk)_live_[0-9A-Za-z]{20,}/ },\n];\n\n/**\n * Mirrors `VERSE_MEMORY_BLOCK_MAX_BYTES` in src/core/verse/project-memory.ts\n * (a node module the browser cannot import): the most memory text a chat's\n * instructions carry, however large MEMORY.md itself is.\n */\nexport const MEMORY_BLOCK_MAX_BYTES = VERSE_MEMORY_BLOCK_MAX_BYTES;\n\n/**\n * What memory costs, in the one wording the memory panel and the resources\n * panel share. Memory is ON by default and snapshotted into every new chat's\n * system prompt (claude `--append-system-prompt`, codex `developer_instructions`,\n * grok `--rules`), which re-rides every turn, and it asks writable seats to\n * read and update MEMORY.md — tool calls and output. On a paid seat that is\n * real (if small, mostly cached) usage, so \"nothing here spends\" would be\n * false for exactly the operator deciding whether to leave it on near a limit.\n * Reading and editing the file from the panel is still free.\n */\nexport const MEMORY_SPEND_NOTE =\n `Reading and editing memory here spends nothing. On a paid seat it is not free to use: each new chat’s system prompt carries a memory block of up to ${MEMORY_BLOCK_MAX_BYTES / 1024} KB, re-sent every turn (cached after the first), and the agent reads and updates MEMORY.md as it works. Local seats spend nothing.`;\n\n/** The first credential shape found, as a phrase (\"a GitHub token\"), or null. */\nexport function secretLike(text: string): string | null {\n for (const { label, re } of SECRET_PATTERNS) if (re.test(text)) return label;\n return null;\n}\n\n/**\n * The placeholder the server's scrubber (src/core/util/scrub.ts) writes over\n * secret-shaped text in every rule. In a memory view flagged\n * `contentSanitized`, each one stands for a REAL value still in MEMORY.md.\n */\nexport const REDACTION_MARKER = '[REDACTED]';\n\n/** How many redaction placeholders a text carries. */\nexport function redactionMarkers(text: string): number {\n return text.split(REDACTION_MARKER).length - 1;\n}\n\n// ---------------------------------------------------------------------------\n// Search\n// ---------------------------------------------------------------------------\n\n/** Below this many characters a keyword search over every message is noise, not recall. */\nexport const SEARCH_MIN_CHARS = 2;\n/** Keystrokes inside this window collapse into one request. */\nexport const SEARCH_DEBOUNCE_MS = 250;\n/** Hits asked for per search — enough to fill the sidebar twice over. */\nexport const SEARCH_LIMIT = 30;\n\n/** Whitespace-separated terms, lowercased and de-duplicated (the server ANDs them). */\nexport function searchTerms(query: string): string[] {\n const out: string[] = [];\n for (const raw of query.toLowerCase().split(/\\s+/)) {\n if (raw && !out.includes(raw)) out.push(raw);\n }\n return out;\n}\n\nexport interface HighlightSegment {\n text: string;\n match: boolean;\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Split `text` into plain and matched runs for every term, case-insensitive.\n * Longest terms first so \"migrate\" wins over \"migrat\" at the same position.\n */\nexport function highlightSegments(text: string, terms: readonly string[]): HighlightSegment[] {\n const usable = [...terms].filter((t) => t.length > 0).sort((a, b) => b.length - a.length);\n if (usable.length === 0 || text.length === 0) return text ? [{ text, match: false }] : [];\n const re = new RegExp(usable.map(escapeRegExp).join('|'), 'gi');\n const out: HighlightSegment[] = [];\n let last = 0;\n for (const m of text.matchAll(re)) {\n const start = m.index ?? 0;\n if (m[0].length === 0) continue;\n if (start > last) out.push({ text: text.slice(last, start), match: false });\n out.push({ text: m[0], match: true });\n last = start + m[0].length;\n }\n if (last < text.length) out.push({ text: text.slice(last), match: false });\n return out;\n}\n\nexport interface SessionSearchGroup {\n sessionId: string;\n title: string;\n projectPath: string;\n engine: VerseEngine;\n /** The best-scoring hit in this session (the server returns hits best-first). */\n top: VerseSearchHit;\n /** Every hit this session contributed to the response. */\n count: number;\n /** Newest hit time, for the row's relative time. */\n latestAt: string;\n}\n\n/**\n * One row per session. The server ranks MESSAGES; the sidebar lists CHATS,\n * and five rows for one chat would push every other match off screen. Order\n * is the order each session first appears, i.e. by its best hit.\n */\nexport function groupSearchHits(hits: readonly VerseSearchHit[]): SessionSearchGroup[] {\n const groups = new Map<string, SessionSearchGroup>();\n for (const hit of hits) {\n const existing = groups.get(hit.sessionId);\n if (!existing) {\n groups.set(hit.sessionId, {\n sessionId: hit.sessionId,\n title: hit.title,\n projectPath: hit.projectPath,\n engine: hit.engine,\n top: hit,\n count: 1,\n latestAt: hit.at,\n });\n continue;\n }\n existing.count += 1;\n if (hit.at > existing.latestAt) existing.latestAt = hit.at;\n }\n return [...groups.values()];\n}\n"],"mappings":"2MA2CA,IAAM,EAAc,oBAOpB,SAAgB,EAAa,EAA6B,CACxD,IAAM,EAAY,EAAY,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,EAClD,EAAQ,EAAY,KAAK,CAAS,EAClC,GAAQ,EAAQ,EAAU,MAAM,EAAG,EAAM,KAAK,EAAI,IAAc,gBAEhE,EAAS,WADF,E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,EACd,EAAI,GAAK,EAAS,WAAU,EAAS,SAAW,EAAI,GAC1D,CACA,MAAO,CAAC,GAAG,EAAO,OAAO,CAAC,CAC5B"}
|
package/dist/core/web/public/next/assets/{context-model-CjiJTnf1.js → context-model-CIBmSugV.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as e,F as t,L as n,S as r,b as i,i as a,k as o,m as s,t as c,z as l}from"./verse-model-
|
|
2
|
-
//# sourceMappingURL=context-model-
|
|
1
|
+
import{A as e,F as t,L as n,S as r,b as i,i as a,k as o,m as s,t as c,z as l}from"./verse-model-DyCwZF-M.js";import{r as u}from"./verse-store-b_Lek_c5.js";import{f as d}from"./format-BkWdOQDL.js";function f(e,t){return e?s([e],{seatId:e.id,model:t}):null}function p(e,t){return t!==`standard`&&o(e,t)!==null?t:`standard`}function m(e,t){return o(e,p(e,t))}function h(e,t){let n=i(e);if(n!==null)return n;let r=t.unavailableReason;return typeof r==`string`&&r.trim().length>0?r.trim():null}var g={standard:`Standard`,expansive:`Expansive`},_={claude:`Claude Code`,codex:`Codex CLI`,grok:`Grok CLI`,local:`Claude Code`};function v(e){let t=typeof e.cliVersion==`string`?e.cliVersion.trim():``;return t.length>0?`${_[e.engine]} ${t}`:null}function y(e){return(e.notes??[]).filter(e=>typeof e==`string`&&e.trim().length>0)}function b(e){return e===`fallback`}function x(e,t=`standard`){let n=p(e,t),r=o(e,n);return r?`${`${u(r.contextWindow)} ctx${b(e.windowSource)?` (est.)`:``}`}${r.autoCompactAt===null?``:` · compacts ≈${u(r.autoCompactAt)}`}${n===`expansive`?` (expansive)`:``}`:`window unknown`}function S(e){let t=o(e,`standard`),r=n(e)?o(e,`expansive`):null,i=[];if(!t)i.push(`Context window unknown for this model.`);else{let e=t.autoCompactAt===null?``:`; compacts at about ${u(t.autoCompactAt)}${r?` in Standard`:``}`;i.push(`${u(t.contextWindow)}-token window${e}.`)}return r&&i.push(`Expansive runs to about ${u(r.autoCompactAt??r.contextWindow)} before compacting.`),e.windowSource&&i.push(`Window ${a[e.windowSource]}.`),i.join(` `)}function C(e){return e===`codex`?c:null}function w(e){let t=o(e,`standard`),n=o(e,`expansive`),r=t?t.autoCompactAt??t.contextWindow:null,i=n?n.autoCompactAt??n.contextWindow:null;return r===null||i===null||r<=0?null:`A turn at ${u(i)} re-sends ${(i/r).toFixed(1)}× the tokens of one at ${u(r)}.`}function T(e,t,n){let r=o(t,`standard`),i=o(t,`expansive`),a=r?r.autoCompactAt??r.contextWindow:null,s=i?i.autoCompactAt??i.contextWindow:null;if(n===`standard`||s===null)return a===null?`The CLI compacts at its own default point for this model.`:e===`claude`?`Compacts at about ${u(a)}. Every turn re-sends the whole context, so holding it under this point keeps each turn cheaper and recall sharper.`:`Compacts at about ${u(a)} — the CLI's own default budget for this model.`;let c=w(t),l=C(e);return`Runs to about ${u(s)} before compacting — for tightly coupled, cross-cutting work that needs everything in view at once. Each turn re-sends everything held, so a long expansive chat uses noticeably more of your plan per turn.${c?` ${c}`:``}${l?` ${l}`:``}`}function E(e,t){return o(t,`standard`)?e===`grok`||e===`local`?`One budget: this CLI compacts at its own fixed point, and Verse cannot raise it per chat.`:`One budget: this model has no larger window to expand into.`:`This model’s window is unknown, so Verse cannot offer a larger budget for it.`}var D={fits:`code fits`,tight:`code fits, tight`,expansive:`code needs expansive`,split:`code too big — split`},O={fits:`Fits`,tight:`Tight fit`,expansive:`Needs expansive`,split:`Split the work`};function k(e){return e.roots.some(e=>e.truncated)}function A(e,n,r,i){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return null;let a=l(i);if(p(n,r)===`expansive`&&n){let r=o(n,`expansive`);return t(e,{...n,contextWindow:r.contextWindow,autoCompactAt:r.autoCompactAt,expansive:null},a)}return t(e,n,a)}function j(e){let t=`${e.floor?`at least `:``}~${u(e.tokens)} tokens of tracked code`,r=p(e.option,e.mode)===`expansive`,i=o(e.option,`standard`),a=o(e.option,`expansive`),s=i?u(i.autoCompactAt??i.contextWindow):null,c=a?u(a.autoCompactAt??a.contextWindow):null,l=r?c:s,d=r?`Expansive budget`:`budget`;switch(e.verdict){case`fits`:return`All ${t} fits well inside this model's ${d}${l?` (compacts ≈${l})`:``}, with room left for the conversation.`;case`tight`:{let i=!r&&c!==null&&n(e.option)?` Expansive (≈${c}) would hold it with room to spare.`:``;return`${N(t)} fits under the ≈${l??`?`} compaction point${r?` of the Expansive budget`:``}, with little room for the conversation — expect it to compact if the agent reads widely.${i}`}case`expansive`:return`${N(t)} is more than the Standard budget (≈${s??`?`}) holds; only Expansive (≈${c??`?`}) takes it all. Switch to Expansive, or narrow the folders to the part you are changing.`;case`split`:return`${N(t)} is more than any single context on this model holds${c?`, even Expansive (≈${c})`:``}. Split the work: fan it out across several chats, each scoped to one folder or subsystem, or narrow this chat to the part you are changing.`}}function M(e){let t=e?` for ${_[e]}`:``;return`Estimated from the size of tracked text files (bytes ÷ 4), plus an estimated ~${u(l(e))} of fixed prompt${t} that every chat starts with. An agent rarely reads everything, so this is a ceiling, not a forecast.`}function N(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function P(e,t){let i=r(t,e);return{tokens:Math.floor(i.contextTokens),exact:i.exact,window:i.contextWindow,autoCompactAt:i.autoCompactAt,source:i.source,mode:i.mode,hasModes:n(i.option)}}function F(t){return t.cacheReadTokens<=0&&t.cacheCreationTokens<=0?null:e(t)}function I(e){return e===null||!Number.isFinite(e)?`—`:d(e)}function L(e){let t=new Map,n=0,r=null,i=(e,n,r)=>{if(!Number.isFinite(n)||n<0)return;let i=t.get(e)??{exact:null,bound:null};r?i.exact=Math.max(i.exact??0,n):i.bound=Math.max(i.bound??0,n),t.set(e,i)};for(let t of e)switch(t.type){case`usage`:r=t.usage,i(t.turnId,t.usage.contextTokens,t.usage.contextTokensExact!==!1);break;case`context`:t.turnId!==null&&i(t.turnId,t.contextTokens,t.exact);break;case`compaction`:n+=1}let a=0,o=null,s=!0,c=0;for(let e of t.values()){let t=e.exact??e.bound;t!==null&&(e.exact===null&&(s=!1),c+=1,a+=t,o=o===null?t:Math.max(o,t))}return{turns:c,average:c===0?null:Math.round(a/c),peak:o,exact:s,compactions:n,lastTurnCacheHit:r===null?null:F(r)}}function R(e,t,n,r){if(e.status===`running`||r===null)return null;let i=Date.parse(r);if(!Number.isFinite(i))return null;let a=n-i;return a<36e5||t<l(e.engine)?null:{idleMs:a,tokens:t,local:e.engine===`local`}}function z(e,t){return e.window!==null&&t.window!==null?e.tokens/e.window>t.tokens/t.window:e.window!==null||t.window===null&&e.tokens>t.tokens}function B(e,t){let n=new Map;for(let t of e){let e=n.get(t.seatId)??[];e.push(t),n.set(t.seatId,e)}let r=[];for(let[e,i]of n){let n=t.find(t=>t.id===e)??null,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=null;for(let e of i){a+=e.usage.inputTokens,o+=e.usage.cacheReadTokens,s+=e.usage.cacheCreationTokens,c+=e.usage.outputTokens,l+=e.turnCount,u+=e.compactionCount??0;let n=P(e,t);if(n.mode===`expansive`&&(d+=1),n.tokens<=0)continue;let r={sessionId:e.id,title:e.title,tokens:n.tokens,window:n.window,exact:n.exact};(f===null||z(r,f))&&(f=r)}r.push({seatId:e,label:n?.label??e,engine:n?.engine??i[0].engine,retired:n===null,sessions:i.length,turns:l,promptTokens:a+o+s,outputTokens:c,cacheHitRatio:F({inputTokens:a,cacheReadTokens:o,cacheCreationTokens:s}),compactions:u,expansiveSessions:d,fullest:f})}return r.sort((e,t)=>t.promptTokens-e.promptTokens||e.label.localeCompare(t.label))}export{f as C,B as S,L as T,E as _,m as a,v as b,j as c,I as d,R as f,h as g,A as h,T as i,k as l,S as m,O as n,C as o,x as p,D as r,w as s,g as t,M as u,F as v,P as w,y as x,p as y};
|
|
2
|
+
//# sourceMappingURL=context-model-CIBmSugV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-model-CjiJTnf1.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/usage/context-model.ts"],"sourcesContent":["/**\n * routes/verse/usage/context-model.ts — the ONE projection of context facts\n * for every surface that shows a seat: the seat picker's rows, the new-chat\n * dialog's context block, the resources panel's \"This chat\" efficiency block,\n * and the Usage section's per-seat efficiency table.\n *\n * WHY ONE MODULE. Before V3.9 every surface read `seat.contextWindow` (the\n * DEFAULT model's window) or the session's creation-time window, and three of\n * them rendered \"200k\" for a 1M Claude model. The arithmetic now lives in\n * core/verse/context-math.ts, shared with the server; this module is only the\n * wording and the aggregation, so the picker, the dialog and the panel cannot\n * describe one model's budget three different ways.\n *\n * HONESTY RULES this module enforces (docs/VERSE-CONTEXT.md):\n *\n * 1. UNKNOWN IS NOT A NUMBER. A model whose budget is unknown reads \"window\n * unknown\", never a default dressed as a fact. A Verse fallback window is\n * marked \"est.\", and its source says so in words.\n * 2. AN UPPER BOUND IS NOT A MEASUREMENT. Codex's turn total sums every model\n * call; until its rollout is read, occupancy is \"≤ N\", and any statistic\n * built on such a reading carries the same flag.\n * 3. NO CACHE REPORTED IS NOT A 0% HIT RATE. A provider that reported no\n * cache activity at all (Ollama; codex on its very first call) gets \"none\n * reported\", not a 0% that reads \"caching is broken\".\n * 4. NOTHING HERE SPENDS. Every figure is derived from what the server\n * already returned (seats, sessions, the open chat's event log).\n *\n * Pure: no React, no I/O.\n */\nimport {\n CACHE_IDLE_TTL_MS,\n budgetFor,\n cacheHitRatio,\n fitVerdict,\n hasExpansiveMode,\n sessionOverheadTokens,\n} from '../../../../core/verse/context-math.js';\nimport type {\n VerseContextBudget,\n VerseContextFit,\n VerseContextMode,\n VerseEngine,\n VerseEvent,\n VerseFitVerdict,\n VerseModelOption,\n VerseSeat,\n VerseSession,\n VerseUsage,\n VerseWindowSource,\n} from '../../../../core/verse/types.js';\nimport { CODEX_EXPANSIVE_METERING_NOTE, WINDOW_SOURCE_TEXT, modelOptionFor, seatUnavailableReason, sessionContextBudget } from '../verse-model.js';\nimport { formatTokens } from '../verse-store.js';\nimport { formatWholePercent } from '../autonomy/format.js';\n\n// ---------------------------------------------------------------------------\n// Models and modes\n// ---------------------------------------------------------------------------\n\n/**\n * A seat's option for a model id, matching through the alias table (a chat\n * remembered on `claude-opus-5.5` is the catalog's `claude-opus-5-5`). The\n * lookup itself is verse-model's `modelOptionFor`, the one the context meter\n * uses, so the picker and the meter can never resolve one id two ways.\n */\nexport function seatModelOption(seat: VerseSeat | null | undefined, modelId: string): VerseModelOption | null {\n return seat ? modelOptionFor([seat], { seatId: seat.id, model: modelId }) : null;\n}\n\n/** `mode` when this model has a budget for it, else `standard` — never a mode the CLI cannot be told. */\nexport function resolveContextMode(option: VerseModelOption | null | undefined, mode: VerseContextMode): VerseContextMode {\n return mode !== 'standard' && budgetFor(option, mode) !== null ? mode : 'standard';\n}\n\n/** The budget a model runs with in a mode (resolved), or null when even its standard window is unknown. */\nexport function effectiveBudget(option: VerseModelOption | null | undefined, mode: VerseContextMode): VerseContextBudget | null {\n return budgetFor(option, resolveContextMode(option, mode));\n}\n\n/** Why this model cannot be chosen on this seat, or null when it can. The seat's own outage wins. */\nexport function modelUnavailableReason(seat: VerseSeat, option: VerseModelOption): string | null {\n const seatReason = seatUnavailableReason(seat);\n if (seatReason !== null) return seatReason;\n const reason = option.unavailableReason;\n return typeof reason === 'string' && reason.trim().length > 0 ? reason.trim() : null;\n}\n\nexport const CONTEXT_MODE_LABEL: Record<VerseContextMode, string> = {\n standard: 'Standard',\n expansive: 'Expansive',\n};\n\n/** How each seat's CLI is named when its pinned version is shown. */\nexport const ENGINE_CLI_NAME: Record<VerseEngine, string> = {\n claude: 'Claude Code',\n codex: 'Codex CLI',\n grok: 'Grok CLI',\n local: 'Claude Code',\n};\n\n/** \"Claude Code 2.1.257\" — the binary this seat is pinned to; null when unknown (local seats, old servers). */\nexport function seatCliLine(seat: VerseSeat): string | null {\n const version = typeof seat.cliVersion === 'string' ? seat.cliVersion.trim() : '';\n return version.length > 0 ? `${ENGINE_CLI_NAME[seat.engine]} ${version}` : null;\n}\n\n/** The seat's own plain-language context facts (binary skew, catalog not yet fetched, …). */\nexport function seatContextNotes(seat: VerseSeat): string[] {\n return (seat.notes ?? []).filter((n): n is string => typeof n === 'string' && n.trim().length > 0);\n}\n\n// ---------------------------------------------------------------------------\n// Window provenance\n// ---------------------------------------------------------------------------\n\n// Window provenance wording is verse-model's `WINDOW_SOURCE_TEXT` — the\n// meter's tooltip, the picker and the resources panel all read that one table.\n\nexport function isEstimatedWindow(source: VerseWindowSource | null | undefined): boolean {\n return source === 'fallback';\n}\n\n// ---------------------------------------------------------------------------\n// Picker and dialog wording\n// ---------------------------------------------------------------------------\n\n/**\n * The compact per-model phrase a picker row carries: \"1M ctx · compacts ≈367k\".\n * Uses the budget for `mode` when the model has one, and names the mode only\n * when it is not the default, so an ordinary row stays short.\n */\nexport function modelContextPhrase(option: VerseModelOption, mode: VerseContextMode = 'standard'): string {\n const resolved = resolveContextMode(option, mode);\n const budget = budgetFor(option, resolved);\n if (!budget) return 'window unknown';\n const window = `${formatTokens(budget.contextWindow)} ctx${isEstimatedWindow(option.windowSource) ? ' (est.)' : ''}`;\n const compacts = budget.autoCompactAt === null ? '' : ` · compacts ≈${formatTokens(budget.autoCompactAt)}`;\n return `${window}${compacts}${resolved === 'expansive' ? ' (expansive)' : ''}`;\n}\n\n/**\n * The full sentence for a tooltip or the dialog: the window, where each mode\n * compacts, and how the window is known.\n */\nexport function modelContextSentence(option: VerseModelOption): string {\n const standard = budgetFor(option, 'standard');\n const expansive = hasExpansiveMode(option) ? budgetFor(option, 'expansive') : null;\n const parts: string[] = [];\n if (!standard) {\n parts.push('Context window unknown for this model.');\n } else {\n const where = standard.autoCompactAt === null\n ? ''\n : `; compacts at about ${formatTokens(standard.autoCompactAt)}${expansive ? ' in Standard' : ''}`;\n parts.push(`${formatTokens(standard.contextWindow)}-token window${where}.`);\n }\n if (expansive) {\n parts.push(`Expansive runs to about ${formatTokens(expansive.autoCompactAt ?? expansive.contextWindow)} before compacting.`);\n }\n if (option.windowSource) parts.push(`Window ${WINDOW_SOURCE_TEXT[option.windowSource]}.`);\n return parts.join(' ');\n}\n\n/**\n * The metering caveat an Expansive cost sentence must carry for this engine,\n * or null when there is none. The wording is verse-model's\n * CODEX_EXPANSIVE_METERING_NOTE — ONE sentence for the new-chat dialog, the\n * handoff dialog, the in-chat mode menu and the \"Expansive could help\" chip.\n * The ratio those surfaces quote (≈3.2× for a 785k vs 245k codex turn) counts\n * re-sent TOKENS only; GPT-5.6-class requests above 272k reportedly also\n * count about 2× against plan limits (docs/VERSE-CONTEXT.md §2.3, a single\n * secondary source), so the note is worded as reported, never as a measured\n * multiplier. Standard never crosses 272k; Expansive does by design.\n */\nexport function expansiveMeteringNote(engine: VerseEngine | null | undefined): string | null {\n return engine === 'codex' ? CODEX_EXPANSIVE_METERING_NOTE : null;\n}\n\n/**\n * \"A turn at 967k re-sends 2.6× the tokens of one at 367k.\" — the only ratio\n * any Expansive cost sentence quotes, and it is arithmetic on the model's own\n * budgets. Null when either compaction point is unknown. It comes BEFORE the\n * codex metering note, whose \"twice that\" refers to it.\n */\nexport function expansiveRatioSentence(option: VerseModelOption | null | undefined): string | null {\n const standard = budgetFor(option, 'standard');\n const expansive = budgetFor(option, 'expansive');\n const stdCap = standard ? standard.autoCompactAt ?? standard.contextWindow : null;\n const expCap = expansive ? expansive.autoCompactAt ?? expansive.contextWindow : null;\n if (stdCap === null || expCap === null || stdCap <= 0) return null;\n return `A turn at ${formatTokens(expCap)} re-sends ${(expCap / stdCap).toFixed(1)}× the tokens of one at ${formatTokens(stdCap)}.`;\n}\n\n/**\n * What each mode costs, in plain words, for the mode selector. Numbers come\n * from the model's own budgets; the only ratio quoted is arithmetic (every\n * turn re-sends everything held, so a turn at X re-sends X/Y of one at Y) —\n * a token ratio, not a usage multiplier, which is why codex also carries the\n * shared metering caveat.\n */\nexport function contextModeDescription(engine: VerseEngine, option: VerseModelOption, mode: VerseContextMode): string {\n const standard = budgetFor(option, 'standard');\n const expansive = budgetFor(option, 'expansive');\n const stdCap = standard ? standard.autoCompactAt ?? standard.contextWindow : null;\n const expCap = expansive ? expansive.autoCompactAt ?? expansive.contextWindow : null;\n if (mode === 'standard' || expCap === null) {\n if (stdCap === null) return 'The CLI compacts at its own default point for this model.';\n return engine === 'claude'\n ? `Compacts at about ${formatTokens(stdCap)}. Every turn re-sends the whole context, so holding it under this point keeps each turn cheaper and recall sharper.`\n : `Compacts at about ${formatTokens(stdCap)} — the CLI's own default budget for this model.`;\n }\n const ratio = expansiveRatioSentence(option);\n const metering = expansiveMeteringNote(engine);\n return `Runs to about ${formatTokens(expCap)} before compacting — for tightly coupled, cross-cutting work that needs everything in view at once. Each turn re-sends everything held, so a long expansive chat uses noticeably more of your plan per turn.${ratio ? ` ${ratio}` : ''}${metering ? ` ${metering}` : ''}`;\n}\n\n/** Why a model offers no mode choice, for the one line where the selector would be. */\nexport function noModeReason(engine: VerseEngine, option: VerseModelOption): string {\n if (!budgetFor(option, 'standard')) return 'This model’s window is unknown, so Verse cannot offer a larger budget for it.';\n if (engine === 'grok' || engine === 'local') return 'One budget: this CLI compacts at its own fixed point, and Verse cannot raise it per chat.';\n return 'One budget: this model has no larger window to expand into.';\n}\n\n// ---------------------------------------------------------------------------\n// Context fit\n// ---------------------------------------------------------------------------\n\n/** Short form for a picker row, where it sits beside the capacity words. */\nexport const FIT_SHORT: Record<VerseFitVerdict, string> = {\n fits: 'code fits',\n tight: 'code fits, tight',\n expansive: 'code needs expansive',\n split: 'code too big — split',\n};\n\n/** Badge text for the chosen model. */\nexport const FIT_LABEL: Record<VerseFitVerdict, string> = {\n fits: 'Fits',\n tight: 'Tight fit',\n expansive: 'Needs expansive',\n split: 'Split the work',\n};\n\n/** A fit reading that is a FLOOR (a root hit its file or time cap). */\nexport function fitIsFloor(fit: VerseContextFit): boolean {\n return fit.roots.some((r) => r.truncated);\n}\n\n/**\n * The verdict for a model IN THE MODE THE CHAT WOULD RUN IN, or null when its\n * budget is unknown (never guessed).\n *\n * `engine` is the seat's engine: the fixed prompt added to the code is that\n * CLI's estimate (context-math `sessionOverheadTokens` — ≈15k local, ≈25k\n * claude), not one flat figure. With a flat 30k a 64k local seat (compacts\n * ≈32.5k) called anything over ~2.5k tokens of code \"too big — split\". Null\n * falls back to the largest estimate.\n *\n * In Standard this is context-math's `fitVerdict` as is — including\n * \"expansive\", the suggestion that only the bigger budget holds the code. In\n * Expansive the bigger budget IS the budget, so the same thresholds are\n * applied to it: the code fits, fits tightly, or no single context on this\n * model holds it. Without this, a chat already set to Expansive would still be\n * told its code \"fits tightly under ≈367k\" — true of a budget it is not using.\n */\nexport function modelFit(\n tokens: number | null | undefined,\n option: VerseModelOption | null | undefined,\n mode: VerseContextMode,\n engine: VerseEngine | null,\n): VerseFitVerdict | null {\n if (typeof tokens !== 'number' || !Number.isFinite(tokens) || tokens < 0) return null;\n const overhead = sessionOverheadTokens(engine);\n if (resolveContextMode(option, mode) === 'expansive' && option) {\n const expansive = budgetFor(option, 'expansive')!;\n return fitVerdict(tokens, { ...option, contextWindow: expansive.contextWindow, autoCompactAt: expansive.autoCompactAt, expansive: null }, overhead);\n }\n return fitVerdict(tokens, option, overhead);\n}\n\n/**\n * The sentence under the fit badge, for the verdict `modelFit` gave in the\n * chat's mode. In Standard a tight fit also names the Expansive budget when\n * one exists, and \"needs expansive\" says what to do — suggestions only;\n * nothing here switches the mode.\n */\nexport function fitExplanation(input: {\n verdict: VerseFitVerdict;\n tokens: number;\n option: VerseModelOption;\n mode: VerseContextMode;\n floor?: boolean;\n}): string {\n const amount = `${input.floor ? 'at least ' : ''}~${formatTokens(input.tokens)} tokens of tracked code`;\n const inExpansive = resolveContextMode(input.option, input.mode) === 'expansive';\n const standard = budgetFor(input.option, 'standard');\n const expansive = budgetFor(input.option, 'expansive');\n const stdCap = standard ? formatTokens(standard.autoCompactAt ?? standard.contextWindow) : null;\n const expCap = expansive ? formatTokens(expansive.autoCompactAt ?? expansive.contextWindow) : null;\n const cap = inExpansive ? expCap : stdCap;\n const budget = inExpansive ? 'Expansive budget' : 'budget';\n switch (input.verdict) {\n case 'fits':\n return `All ${amount} fits well inside this model's ${budget}${cap ? ` (compacts ≈${cap})` : ''}, with room left for the conversation.`;\n case 'tight': {\n const roomier = !inExpansive && expCap !== null && hasExpansiveMode(input.option)\n ? ` Expansive (≈${expCap}) would hold it with room to spare.`\n : '';\n return `${capitalize(amount)} fits under the ≈${cap ?? '?'} compaction point${inExpansive ? ' of the Expansive budget' : ''}, with little room for the conversation — expect it to compact if the agent reads widely.${roomier}`;\n }\n case 'expansive':\n return `${capitalize(amount)} is more than the Standard budget (≈${stdCap ?? '?'}) holds; only Expansive (≈${expCap ?? '?'}) takes it all. Switch to Expansive, or narrow the folders to the part you are changing.`;\n case 'split':\n return `${capitalize(amount)} is more than any single context on this model holds${expCap ? `, even Expansive (≈${expCap})` : ''}. Split the work: fan it out across several chats, each scoped to one folder or subsystem, or narrow this chat to the part you are changing.`;\n }\n}\n\n/**\n * How the working-set figure is made — shown once, beside the badge. Names the\n * fixed-prompt figure the verdict added, and calls it an estimate: no CLI\n * reports its base prompt before a turn has run.\n */\nexport function fitMethodNote(engine: VerseEngine | null): string {\n const cli = engine ? ` for ${ENGINE_CLI_NAME[engine]}` : '';\n return `Estimated from the size of tracked text files (bytes ÷ 4), plus an estimated ~${formatTokens(sessionOverheadTokens(engine))} of fixed prompt${cli} that every chat starts with. An agent rarely reads everything, so this is a ceiling, not a forecast.`;\n}\n\nfunction capitalize(text: string): string {\n return text.length === 0 ? text : text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n// ---------------------------------------------------------------------------\n// One session's context\n// ---------------------------------------------------------------------------\n\nexport interface SessionContextView {\n tokens: number;\n /** False when `tokens` is an upper bound (codex before its rollout is read). */\n exact: boolean;\n window: number | null;\n autoCompactAt: number | null;\n /** How the window is known; null when nothing says (no window, or a stored one without provenance). */\n source: VerseWindowSource | null;\n mode: VerseContextMode;\n /** The session's model has a real expansive budget on its seat. */\n hasModes: boolean;\n}\n\n/**\n * The window a session is measured against, by the precedence every surface\n * shares — runtime → the seat's CURRENT catalog budget for the model and mode\n * → what the record stored → the seat default. The precedence itself lives in\n * verse-model's `sessionContextBudget` (the context meter reads it too); this\n * only adds whether the model offers a second mode, for the panels here.\n */\nexport function sessionContext(session: VerseSession, seats: readonly VerseSeat[]): SessionContextView {\n const budget = sessionContextBudget(seats, session);\n return {\n tokens: Math.floor(budget.contextTokens),\n exact: budget.exact,\n window: budget.contextWindow,\n autoCompactAt: budget.autoCompactAt,\n source: budget.source,\n mode: budget.mode,\n hasModes: hasExpansiveMode(budget.option),\n };\n}\n\n/**\n * Cache-hit ratio, except when the provider reported no cache activity at all\n * — then null (\"none reported\"), because 0% would claim caching failed when\n * the truth is that nothing was said about it.\n */\nexport function reportedCacheHitRatio(usage: Pick<VerseUsage, 'inputTokens' | 'cacheReadTokens' | 'cacheCreationTokens'>): number | null {\n if (usage.cacheReadTokens <= 0 && usage.cacheCreationTokens <= 0) return null;\n return cacheHitRatio(usage);\n}\n\n/** A 0–1 ratio as a whole percent; a real sliver reads \"<1%\", never \"0%\". */\nexport function formatRatio(ratio: number | null): string {\n if (ratio === null || !Number.isFinite(ratio)) return '—';\n return formatWholePercent(ratio);\n}\n\nexport interface TurnContextStats {\n /** Turns with at least one context reading. */\n turns: number;\n /** Mean of each turn's context (its largest trustworthy reading); null with no turns. */\n average: number | null;\n /** Largest per-turn context seen. */\n peak: number | null;\n /** False when any counted turn had only an upper-bound reading. */\n exact: boolean;\n /** Compactions recorded in the log. */\n compactions: number;\n /** Cache-hit ratio of the most recent turn (see `reportedCacheHitRatio`). */\n lastTurnCacheHit: number | null;\n}\n\n/**\n * Context per turn from the open chat's event log.\n *\n * A turn's context is its LARGEST trustworthy reading: within one turn the\n * prompt only grows, except across a compaction, and the peak is what the\n * turn actually paid for. Exact readings (`context` events, usage frames not\n * flagged as upper bounds) win; a turn whose only reading is codex's turn\n * total contributes that total and flags the statistic as an upper bound —\n * that figure can be many times the real prompt, so it is never mixed in\n * where an exact one exists.\n */\nexport function turnContextStats(events: readonly VerseEvent[]): TurnContextStats {\n const perTurn = new Map<string, { exact: number | null; bound: number | null }>();\n let compactions = 0;\n let lastUsage: VerseUsage | null = null;\n const note = (turnId: string, tokens: number, exact: boolean): void => {\n if (!Number.isFinite(tokens) || tokens < 0) return;\n const entry = perTurn.get(turnId) ?? { exact: null, bound: null };\n if (exact) entry.exact = Math.max(entry.exact ?? 0, tokens);\n else entry.bound = Math.max(entry.bound ?? 0, tokens);\n perTurn.set(turnId, entry);\n };\n for (const event of events) {\n switch (event.type) {\n case 'usage':\n lastUsage = event.usage;\n note(event.turnId, event.usage.contextTokens, event.usage.contextTokensExact !== false);\n break;\n case 'context':\n if (event.turnId !== null) note(event.turnId, event.contextTokens, event.exact);\n break;\n case 'compaction':\n compactions += 1;\n break;\n default:\n break;\n }\n }\n let sum = 0;\n let peak: number | null = null;\n let exact = true;\n let turns = 0;\n for (const entry of perTurn.values()) {\n const value = entry.exact ?? entry.bound;\n if (value === null) continue;\n if (entry.exact === null) exact = false;\n turns += 1;\n sum += value;\n peak = peak === null ? value : Math.max(peak, value);\n }\n return {\n turns,\n average: turns === 0 ? null : Math.round(sum / turns),\n peak,\n exact,\n compactions,\n lastTurnCacheHit: lastUsage === null ? null : reportedCacheHitRatio(lastUsage),\n };\n}\n\nexport interface IdleCacheWarning {\n idleMs: number;\n tokens: number;\n /** A local model: the cost is time, not spend. */\n local: boolean;\n}\n\n/**\n * The next turn of an idle chat re-reads its whole context uncached once the\n * provider's prompt cache has expired (CACHE_IDLE_TTL_MS). Below the fixed\n * prompt every new chat on this engine pays anyway (its estimate) there is\n * nothing worth warning about.\n */\nexport function idleCacheWarning(\n session: Pick<VerseSession, 'status' | 'engine'>,\n tokens: number,\n now: number,\n /**\n * When the chat last TALKED to its provider (`lastTurnActivityAt(events)`),\n * never `session.updatedAt`: a rename or mode switch moves that without\n * warming the provider's cache. Null (no turn yet / log not loaded) → no warning.\n */\n lastActivityAt: string | null,\n): IdleCacheWarning | null {\n if (session.status === 'running' || lastActivityAt === null) return null;\n const last = Date.parse(lastActivityAt);\n if (!Number.isFinite(last)) return null;\n const idleMs = now - last;\n if (idleMs < CACHE_IDLE_TTL_MS || tokens < sessionOverheadTokens(session.engine)) return null;\n return { idleMs, tokens, local: session.engine === 'local' };\n}\n\n// ---------------------------------------------------------------------------\n// Per-seat efficiency across sessions (Usage section)\n// ---------------------------------------------------------------------------\n\nexport interface SeatEfficiencyRow {\n seatId: string;\n label: string;\n engine: VerseEngine;\n /** The seat is no longer in the roster (its sessions remain on disk). */\n retired: boolean;\n sessions: number;\n turns: number;\n /** input + cache read + cache write: every prompt token the seat was sent. */\n promptTokens: number;\n outputTokens: number;\n /** Null when the provider reported no cache activity on any of these sessions. */\n cacheHitRatio: number | null;\n compactions: number;\n expansiveSessions: number;\n /** The fullest context among these sessions right now, as a share of its window. */\n fullest: { sessionId: string; title: string; tokens: number; window: number | null; exact: boolean } | null;\n}\n\n/**\n * \"Fullest\" is a share of the window when both windows are known; a context\n * with a known window outranks one without (its fullness is a fact, the other\n * a size); two unknown windows compare by size.\n */\nfunction fuller(a: NonNullable<SeatEfficiencyRow['fullest']>, b: NonNullable<SeatEfficiencyRow['fullest']>): boolean {\n if (a.window !== null && b.window !== null) return a.tokens / a.window > b.tokens / b.window;\n if (a.window !== null) return true;\n if (b.window !== null) return false;\n return a.tokens > b.tokens;\n}\n\n/**\n * Aggregate every session by seat. Ratios are computed from SUMS, never as a\n * mean of per-session ratios — a two-turn chat must not weigh as much as a\n * two-hundred-turn one. Seats with no sessions are omitted rather than shown\n * as zeros. Sorted by prompt tokens, largest first: that is where efficiency\n * matters most.\n */\nexport function seatEfficiency(sessions: readonly VerseSession[], seats: readonly VerseSeat[]): SeatEfficiencyRow[] {\n const bySeat = new Map<string, VerseSession[]>();\n for (const s of sessions) {\n const list = bySeat.get(s.seatId) ?? [];\n list.push(s);\n bySeat.set(s.seatId, list);\n }\n const rows: SeatEfficiencyRow[] = [];\n for (const [seatId, list] of bySeat) {\n const seat = seats.find((s) => s.id === seatId) ?? null;\n let input = 0;\n let read = 0;\n let write = 0;\n let output = 0;\n let turns = 0;\n let compactions = 0;\n let expansiveSessions = 0;\n let fullest: SeatEfficiencyRow['fullest'] = null;\n for (const s of list) {\n input += s.usage.inputTokens;\n read += s.usage.cacheReadTokens;\n write += s.usage.cacheCreationTokens;\n output += s.usage.outputTokens;\n turns += s.turnCount;\n compactions += s.compactionCount ?? 0;\n // The mode as the meter resolves it (verse-model sessionContextBudget),\n // counted before the empty-reading skip: the mode is a fact about the\n // chat, not about its reading.\n const view = sessionContext(s, seats);\n if (view.mode === 'expansive') expansiveSessions += 1;\n if (view.tokens <= 0) continue;\n const candidate = { sessionId: s.id, title: s.title, tokens: view.tokens, window: view.window, exact: view.exact };\n if (fullest === null || fuller(candidate, fullest)) fullest = candidate;\n }\n rows.push({\n seatId,\n label: seat?.label ?? seatId,\n engine: seat?.engine ?? list[0]!.engine,\n retired: seat === null,\n sessions: list.length,\n turns,\n promptTokens: input + read + write,\n outputTokens: output,\n cacheHitRatio: reportedCacheHitRatio({ inputTokens: input, cacheReadTokens: read, cacheCreationTokens: write }),\n compactions,\n expansiveSessions,\n fullest,\n });\n }\n return rows.sort((a, b) => b.promptTokens - a.promptTokens || a.label.localeCompare(b.label));\n}\n"],"mappings":"oMAgEA,SAAgB,EAAgB,EAAoC,EAA0C,CAC5G,OAAO,EAAO,EAAe,CAAC,CAAI,EAAG,CAAE,OAAQ,EAAK,GAAI,MAAO,CAAQ,CAAC,EAAI,IAC9E,CAGA,SAAgB,EAAmB,EAA6C,EAA0C,CACxH,OAAO,IAAS,YAAc,EAAU,EAAQ,CAAI,IAAM,KAAO,EAAO,UAC1E,CAGA,SAAgB,EAAgB,EAA6C,EAAmD,CAC9H,OAAO,EAAU,EAAQ,EAAmB,EAAQ,CAAI,CAAC,CAC3D,CAGA,SAAgB,EAAuB,EAAiB,EAAyC,CAC/F,IAAM,EAAa,EAAsB,CAAI,EAC7C,GAAI,IAAe,KAAM,OAAO,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qB,CAAM,CAAC,EAC9G,cACA,oBACA,SACF,CAAC,CACH,CACA,OAAO,EAAK,MAAM,EAAG,IAAM,EAAE,aAAe,EAAE,cAAgB,EAAE,MAAM,cAAc,EAAE,KAAK,CAAC,CAC9F"}
|
|
1
|
+
{"version":3,"file":"context-model-CIBmSugV.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/usage/context-model.ts"],"sourcesContent":["/**\n * routes/verse/usage/context-model.ts — the ONE projection of context facts\n * for every surface that shows a seat: the seat picker's rows, the new-chat\n * dialog's context block, the resources panel's \"This chat\" efficiency block,\n * and the Usage section's per-seat efficiency table.\n *\n * WHY ONE MODULE. Before V3.9 every surface read `seat.contextWindow` (the\n * DEFAULT model's window) or the session's creation-time window, and three of\n * them rendered \"200k\" for a 1M Claude model. The arithmetic now lives in\n * core/verse/context-math.ts, shared with the server; this module is only the\n * wording and the aggregation, so the picker, the dialog and the panel cannot\n * describe one model's budget three different ways.\n *\n * HONESTY RULES this module enforces (docs/VERSE-CONTEXT.md):\n *\n * 1. UNKNOWN IS NOT A NUMBER. A model whose budget is unknown reads \"window\n * unknown\", never a default dressed as a fact. A Verse fallback window is\n * marked \"est.\", and its source says so in words.\n * 2. AN UPPER BOUND IS NOT A MEASUREMENT. Codex's turn total sums every model\n * call; until its rollout is read, occupancy is \"≤ N\", and any statistic\n * built on such a reading carries the same flag.\n * 3. NO CACHE REPORTED IS NOT A 0% HIT RATE. A provider that reported no\n * cache activity at all (Ollama; codex on its very first call) gets \"none\n * reported\", not a 0% that reads \"caching is broken\".\n * 4. NOTHING HERE SPENDS. Every figure is derived from what the server\n * already returned (seats, sessions, the open chat's event log).\n *\n * Pure: no React, no I/O.\n */\nimport {\n CACHE_IDLE_TTL_MS,\n budgetFor,\n cacheHitRatio,\n fitVerdict,\n hasExpansiveMode,\n sessionOverheadTokens,\n} from '../../../../core/verse/context-math.js';\nimport type {\n VerseContextBudget,\n VerseContextFit,\n VerseContextMode,\n VerseEngine,\n VerseEvent,\n VerseFitVerdict,\n VerseModelOption,\n VerseSeat,\n VerseSession,\n VerseUsage,\n VerseWindowSource,\n} from '../../../../core/verse/types.js';\nimport { CODEX_EXPANSIVE_METERING_NOTE, WINDOW_SOURCE_TEXT, modelOptionFor, seatUnavailableReason, sessionContextBudget } from '../verse-model.js';\nimport { formatTokens } from '../verse-store.js';\nimport { formatWholePercent } from '../autonomy/format.js';\n\n// ---------------------------------------------------------------------------\n// Models and modes\n// ---------------------------------------------------------------------------\n\n/**\n * A seat's option for a model id, matching through the alias table (a chat\n * remembered on `claude-opus-5.5` is the catalog's `claude-opus-5-5`). The\n * lookup itself is verse-model's `modelOptionFor`, the one the context meter\n * uses, so the picker and the meter can never resolve one id two ways.\n */\nexport function seatModelOption(seat: VerseSeat | null | undefined, modelId: string): VerseModelOption | null {\n return seat ? modelOptionFor([seat], { seatId: seat.id, model: modelId }) : null;\n}\n\n/** `mode` when this model has a budget for it, else `standard` — never a mode the CLI cannot be told. */\nexport function resolveContextMode(option: VerseModelOption | null | undefined, mode: VerseContextMode): VerseContextMode {\n return mode !== 'standard' && budgetFor(option, mode) !== null ? mode : 'standard';\n}\n\n/** The budget a model runs with in a mode (resolved), or null when even its standard window is unknown. */\nexport function effectiveBudget(option: VerseModelOption | null | undefined, mode: VerseContextMode): VerseContextBudget | null {\n return budgetFor(option, resolveContextMode(option, mode));\n}\n\n/** Why this model cannot be chosen on this seat, or null when it can. The seat's own outage wins. */\nexport function modelUnavailableReason(seat: VerseSeat, option: VerseModelOption): string | null {\n const seatReason = seatUnavailableReason(seat);\n if (seatReason !== null) return seatReason;\n const reason = option.unavailableReason;\n return typeof reason === 'string' && reason.trim().length > 0 ? reason.trim() : null;\n}\n\nexport const CONTEXT_MODE_LABEL: Record<VerseContextMode, string> = {\n standard: 'Standard',\n expansive: 'Expansive',\n};\n\n/** How each seat's CLI is named when its pinned version is shown. */\nexport const ENGINE_CLI_NAME: Record<VerseEngine, string> = {\n claude: 'Claude Code',\n codex: 'Codex CLI',\n grok: 'Grok CLI',\n local: 'Claude Code',\n};\n\n/** \"Claude Code 2.1.257\" — the binary this seat is pinned to; null when unknown (local seats, old servers). */\nexport function seatCliLine(seat: VerseSeat): string | null {\n const version = typeof seat.cliVersion === 'string' ? seat.cliVersion.trim() : '';\n return version.length > 0 ? `${ENGINE_CLI_NAME[seat.engine]} ${version}` : null;\n}\n\n/** The seat's own plain-language context facts (binary skew, catalog not yet fetched, …). */\nexport function seatContextNotes(seat: VerseSeat): string[] {\n return (seat.notes ?? []).filter((n): n is string => typeof n === 'string' && n.trim().length > 0);\n}\n\n// ---------------------------------------------------------------------------\n// Window provenance\n// ---------------------------------------------------------------------------\n\n// Window provenance wording is verse-model's `WINDOW_SOURCE_TEXT` — the\n// meter's tooltip, the picker and the resources panel all read that one table.\n\nexport function isEstimatedWindow(source: VerseWindowSource | null | undefined): boolean {\n return source === 'fallback';\n}\n\n// ---------------------------------------------------------------------------\n// Picker and dialog wording\n// ---------------------------------------------------------------------------\n\n/**\n * The compact per-model phrase a picker row carries: \"1M ctx · compacts ≈367k\".\n * Uses the budget for `mode` when the model has one, and names the mode only\n * when it is not the default, so an ordinary row stays short.\n */\nexport function modelContextPhrase(option: VerseModelOption, mode: VerseContextMode = 'standard'): string {\n const resolved = resolveContextMode(option, mode);\n const budget = budgetFor(option, resolved);\n if (!budget) return 'window unknown';\n const window = `${formatTokens(budget.contextWindow)} ctx${isEstimatedWindow(option.windowSource) ? ' (est.)' : ''}`;\n const compacts = budget.autoCompactAt === null ? '' : ` · compacts ≈${formatTokens(budget.autoCompactAt)}`;\n return `${window}${compacts}${resolved === 'expansive' ? ' (expansive)' : ''}`;\n}\n\n/**\n * The full sentence for a tooltip or the dialog: the window, where each mode\n * compacts, and how the window is known.\n */\nexport function modelContextSentence(option: VerseModelOption): string {\n const standard = budgetFor(option, 'standard');\n const expansive = hasExpansiveMode(option) ? budgetFor(option, 'expansive') : null;\n const parts: string[] = [];\n if (!standard) {\n parts.push('Context window unknown for this model.');\n } else {\n const where = standard.autoCompactAt === null\n ? ''\n : `; compacts at about ${formatTokens(standard.autoCompactAt)}${expansive ? ' in Standard' : ''}`;\n parts.push(`${formatTokens(standard.contextWindow)}-token window${where}.`);\n }\n if (expansive) {\n parts.push(`Expansive runs to about ${formatTokens(expansive.autoCompactAt ?? expansive.contextWindow)} before compacting.`);\n }\n if (option.windowSource) parts.push(`Window ${WINDOW_SOURCE_TEXT[option.windowSource]}.`);\n return parts.join(' ');\n}\n\n/**\n * The metering caveat an Expansive cost sentence must carry for this engine,\n * or null when there is none. The wording is verse-model's\n * CODEX_EXPANSIVE_METERING_NOTE — ONE sentence for the new-chat dialog, the\n * handoff dialog, the in-chat mode menu and the \"Expansive could help\" chip.\n * The ratio those surfaces quote (≈3.2× for a 785k vs 245k codex turn) counts\n * re-sent TOKENS only; GPT-5.6-class requests above 272k reportedly also\n * count about 2× against plan limits (docs/VERSE-CONTEXT.md §2.3, a single\n * secondary source), so the note is worded as reported, never as a measured\n * multiplier. Standard never crosses 272k; Expansive does by design.\n */\nexport function expansiveMeteringNote(engine: VerseEngine | null | undefined): string | null {\n return engine === 'codex' ? CODEX_EXPANSIVE_METERING_NOTE : null;\n}\n\n/**\n * \"A turn at 967k re-sends 2.6× the tokens of one at 367k.\" — the only ratio\n * any Expansive cost sentence quotes, and it is arithmetic on the model's own\n * budgets. Null when either compaction point is unknown. It comes BEFORE the\n * codex metering note, whose \"twice that\" refers to it.\n */\nexport function expansiveRatioSentence(option: VerseModelOption | null | undefined): string | null {\n const standard = budgetFor(option, 'standard');\n const expansive = budgetFor(option, 'expansive');\n const stdCap = standard ? standard.autoCompactAt ?? standard.contextWindow : null;\n const expCap = expansive ? expansive.autoCompactAt ?? expansive.contextWindow : null;\n if (stdCap === null || expCap === null || stdCap <= 0) return null;\n return `A turn at ${formatTokens(expCap)} re-sends ${(expCap / stdCap).toFixed(1)}× the tokens of one at ${formatTokens(stdCap)}.`;\n}\n\n/**\n * What each mode costs, in plain words, for the mode selector. Numbers come\n * from the model's own budgets; the only ratio quoted is arithmetic (every\n * turn re-sends everything held, so a turn at X re-sends X/Y of one at Y) —\n * a token ratio, not a usage multiplier, which is why codex also carries the\n * shared metering caveat.\n */\nexport function contextModeDescription(engine: VerseEngine, option: VerseModelOption, mode: VerseContextMode): string {\n const standard = budgetFor(option, 'standard');\n const expansive = budgetFor(option, 'expansive');\n const stdCap = standard ? standard.autoCompactAt ?? standard.contextWindow : null;\n const expCap = expansive ? expansive.autoCompactAt ?? expansive.contextWindow : null;\n if (mode === 'standard' || expCap === null) {\n if (stdCap === null) return 'The CLI compacts at its own default point for this model.';\n return engine === 'claude'\n ? `Compacts at about ${formatTokens(stdCap)}. Every turn re-sends the whole context, so holding it under this point keeps each turn cheaper and recall sharper.`\n : `Compacts at about ${formatTokens(stdCap)} — the CLI's own default budget for this model.`;\n }\n const ratio = expansiveRatioSentence(option);\n const metering = expansiveMeteringNote(engine);\n return `Runs to about ${formatTokens(expCap)} before compacting — for tightly coupled, cross-cutting work that needs everything in view at once. Each turn re-sends everything held, so a long expansive chat uses noticeably more of your plan per turn.${ratio ? ` ${ratio}` : ''}${metering ? ` ${metering}` : ''}`;\n}\n\n/** Why a model offers no mode choice, for the one line where the selector would be. */\nexport function noModeReason(engine: VerseEngine, option: VerseModelOption): string {\n if (!budgetFor(option, 'standard')) return 'This model’s window is unknown, so Verse cannot offer a larger budget for it.';\n if (engine === 'grok' || engine === 'local') return 'One budget: this CLI compacts at its own fixed point, and Verse cannot raise it per chat.';\n return 'One budget: this model has no larger window to expand into.';\n}\n\n// ---------------------------------------------------------------------------\n// Context fit\n// ---------------------------------------------------------------------------\n\n/** Short form for a picker row, where it sits beside the capacity words. */\nexport const FIT_SHORT: Record<VerseFitVerdict, string> = {\n fits: 'code fits',\n tight: 'code fits, tight',\n expansive: 'code needs expansive',\n split: 'code too big — split',\n};\n\n/** Badge text for the chosen model. */\nexport const FIT_LABEL: Record<VerseFitVerdict, string> = {\n fits: 'Fits',\n tight: 'Tight fit',\n expansive: 'Needs expansive',\n split: 'Split the work',\n};\n\n/** A fit reading that is a FLOOR (a root hit its file or time cap). */\nexport function fitIsFloor(fit: VerseContextFit): boolean {\n return fit.roots.some((r) => r.truncated);\n}\n\n/**\n * The verdict for a model IN THE MODE THE CHAT WOULD RUN IN, or null when its\n * budget is unknown (never guessed).\n *\n * `engine` is the seat's engine: the fixed prompt added to the code is that\n * CLI's estimate (context-math `sessionOverheadTokens` — ≈15k local, ≈25k\n * claude), not one flat figure. With a flat 30k a 64k local seat (compacts\n * ≈32.5k) called anything over ~2.5k tokens of code \"too big — split\". Null\n * falls back to the largest estimate.\n *\n * In Standard this is context-math's `fitVerdict` as is — including\n * \"expansive\", the suggestion that only the bigger budget holds the code. In\n * Expansive the bigger budget IS the budget, so the same thresholds are\n * applied to it: the code fits, fits tightly, or no single context on this\n * model holds it. Without this, a chat already set to Expansive would still be\n * told its code \"fits tightly under ≈367k\" — true of a budget it is not using.\n */\nexport function modelFit(\n tokens: number | null | undefined,\n option: VerseModelOption | null | undefined,\n mode: VerseContextMode,\n engine: VerseEngine | null,\n): VerseFitVerdict | null {\n if (typeof tokens !== 'number' || !Number.isFinite(tokens) || tokens < 0) return null;\n const overhead = sessionOverheadTokens(engine);\n if (resolveContextMode(option, mode) === 'expansive' && option) {\n const expansive = budgetFor(option, 'expansive')!;\n return fitVerdict(tokens, { ...option, contextWindow: expansive.contextWindow, autoCompactAt: expansive.autoCompactAt, expansive: null }, overhead);\n }\n return fitVerdict(tokens, option, overhead);\n}\n\n/**\n * The sentence under the fit badge, for the verdict `modelFit` gave in the\n * chat's mode. In Standard a tight fit also names the Expansive budget when\n * one exists, and \"needs expansive\" says what to do — suggestions only;\n * nothing here switches the mode.\n */\nexport function fitExplanation(input: {\n verdict: VerseFitVerdict;\n tokens: number;\n option: VerseModelOption;\n mode: VerseContextMode;\n floor?: boolean;\n}): string {\n const amount = `${input.floor ? 'at least ' : ''}~${formatTokens(input.tokens)} tokens of tracked code`;\n const inExpansive = resolveContextMode(input.option, input.mode) === 'expansive';\n const standard = budgetFor(input.option, 'standard');\n const expansive = budgetFor(input.option, 'expansive');\n const stdCap = standard ? formatTokens(standard.autoCompactAt ?? standard.contextWindow) : null;\n const expCap = expansive ? formatTokens(expansive.autoCompactAt ?? expansive.contextWindow) : null;\n const cap = inExpansive ? expCap : stdCap;\n const budget = inExpansive ? 'Expansive budget' : 'budget';\n switch (input.verdict) {\n case 'fits':\n return `All ${amount} fits well inside this model's ${budget}${cap ? ` (compacts ≈${cap})` : ''}, with room left for the conversation.`;\n case 'tight': {\n const roomier = !inExpansive && expCap !== null && hasExpansiveMode(input.option)\n ? ` Expansive (≈${expCap}) would hold it with room to spare.`\n : '';\n return `${capitalize(amount)} fits under the ≈${cap ?? '?'} compaction point${inExpansive ? ' of the Expansive budget' : ''}, with little room for the conversation — expect it to compact if the agent reads widely.${roomier}`;\n }\n case 'expansive':\n return `${capitalize(amount)} is more than the Standard budget (≈${stdCap ?? '?'}) holds; only Expansive (≈${expCap ?? '?'}) takes it all. Switch to Expansive, or narrow the folders to the part you are changing.`;\n case 'split':\n return `${capitalize(amount)} is more than any single context on this model holds${expCap ? `, even Expansive (≈${expCap})` : ''}. Split the work: fan it out across several chats, each scoped to one folder or subsystem, or narrow this chat to the part you are changing.`;\n }\n}\n\n/**\n * How the working-set figure is made — shown once, beside the badge. Names the\n * fixed-prompt figure the verdict added, and calls it an estimate: no CLI\n * reports its base prompt before a turn has run.\n */\nexport function fitMethodNote(engine: VerseEngine | null): string {\n const cli = engine ? ` for ${ENGINE_CLI_NAME[engine]}` : '';\n return `Estimated from the size of tracked text files (bytes ÷ 4), plus an estimated ~${formatTokens(sessionOverheadTokens(engine))} of fixed prompt${cli} that every chat starts with. An agent rarely reads everything, so this is a ceiling, not a forecast.`;\n}\n\nfunction capitalize(text: string): string {\n return text.length === 0 ? text : text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n// ---------------------------------------------------------------------------\n// One session's context\n// ---------------------------------------------------------------------------\n\nexport interface SessionContextView {\n tokens: number;\n /** False when `tokens` is an upper bound (codex before its rollout is read). */\n exact: boolean;\n window: number | null;\n autoCompactAt: number | null;\n /** How the window is known; null when nothing says (no window, or a stored one without provenance). */\n source: VerseWindowSource | null;\n mode: VerseContextMode;\n /** The session's model has a real expansive budget on its seat. */\n hasModes: boolean;\n}\n\n/**\n * The window a session is measured against, by the precedence every surface\n * shares — runtime → the seat's CURRENT catalog budget for the model and mode\n * → what the record stored → the seat default. The precedence itself lives in\n * verse-model's `sessionContextBudget` (the context meter reads it too); this\n * only adds whether the model offers a second mode, for the panels here.\n */\nexport function sessionContext(session: VerseSession, seats: readonly VerseSeat[]): SessionContextView {\n const budget = sessionContextBudget(seats, session);\n return {\n tokens: Math.floor(budget.contextTokens),\n exact: budget.exact,\n window: budget.contextWindow,\n autoCompactAt: budget.autoCompactAt,\n source: budget.source,\n mode: budget.mode,\n hasModes: hasExpansiveMode(budget.option),\n };\n}\n\n/**\n * Cache-hit ratio, except when the provider reported no cache activity at all\n * — then null (\"none reported\"), because 0% would claim caching failed when\n * the truth is that nothing was said about it.\n */\nexport function reportedCacheHitRatio(usage: Pick<VerseUsage, 'inputTokens' | 'cacheReadTokens' | 'cacheCreationTokens'>): number | null {\n if (usage.cacheReadTokens <= 0 && usage.cacheCreationTokens <= 0) return null;\n return cacheHitRatio(usage);\n}\n\n/** A 0–1 ratio as a whole percent; a real sliver reads \"<1%\", never \"0%\". */\nexport function formatRatio(ratio: number | null): string {\n if (ratio === null || !Number.isFinite(ratio)) return '—';\n return formatWholePercent(ratio);\n}\n\nexport interface TurnContextStats {\n /** Turns with at least one context reading. */\n turns: number;\n /** Mean of each turn's context (its largest trustworthy reading); null with no turns. */\n average: number | null;\n /** Largest per-turn context seen. */\n peak: number | null;\n /** False when any counted turn had only an upper-bound reading. */\n exact: boolean;\n /** Compactions recorded in the log. */\n compactions: number;\n /** Cache-hit ratio of the most recent turn (see `reportedCacheHitRatio`). */\n lastTurnCacheHit: number | null;\n}\n\n/**\n * Context per turn from the open chat's event log.\n *\n * A turn's context is its LARGEST trustworthy reading: within one turn the\n * prompt only grows, except across a compaction, and the peak is what the\n * turn actually paid for. Exact readings (`context` events, usage frames not\n * flagged as upper bounds) win; a turn whose only reading is codex's turn\n * total contributes that total and flags the statistic as an upper bound —\n * that figure can be many times the real prompt, so it is never mixed in\n * where an exact one exists.\n */\nexport function turnContextStats(events: readonly VerseEvent[]): TurnContextStats {\n const perTurn = new Map<string, { exact: number | null; bound: number | null }>();\n let compactions = 0;\n let lastUsage: VerseUsage | null = null;\n const note = (turnId: string, tokens: number, exact: boolean): void => {\n if (!Number.isFinite(tokens) || tokens < 0) return;\n const entry = perTurn.get(turnId) ?? { exact: null, bound: null };\n if (exact) entry.exact = Math.max(entry.exact ?? 0, tokens);\n else entry.bound = Math.max(entry.bound ?? 0, tokens);\n perTurn.set(turnId, entry);\n };\n for (const event of events) {\n switch (event.type) {\n case 'usage':\n lastUsage = event.usage;\n note(event.turnId, event.usage.contextTokens, event.usage.contextTokensExact !== false);\n break;\n case 'context':\n if (event.turnId !== null) note(event.turnId, event.contextTokens, event.exact);\n break;\n case 'compaction':\n compactions += 1;\n break;\n default:\n break;\n }\n }\n let sum = 0;\n let peak: number | null = null;\n let exact = true;\n let turns = 0;\n for (const entry of perTurn.values()) {\n const value = entry.exact ?? entry.bound;\n if (value === null) continue;\n if (entry.exact === null) exact = false;\n turns += 1;\n sum += value;\n peak = peak === null ? value : Math.max(peak, value);\n }\n return {\n turns,\n average: turns === 0 ? null : Math.round(sum / turns),\n peak,\n exact,\n compactions,\n lastTurnCacheHit: lastUsage === null ? null : reportedCacheHitRatio(lastUsage),\n };\n}\n\nexport interface IdleCacheWarning {\n idleMs: number;\n tokens: number;\n /** A local model: the cost is time, not spend. */\n local: boolean;\n}\n\n/**\n * The next turn of an idle chat re-reads its whole context uncached once the\n * provider's prompt cache has expired (CACHE_IDLE_TTL_MS). Below the fixed\n * prompt every new chat on this engine pays anyway (its estimate) there is\n * nothing worth warning about.\n */\nexport function idleCacheWarning(\n session: Pick<VerseSession, 'status' | 'engine'>,\n tokens: number,\n now: number,\n /**\n * When the chat last TALKED to its provider (`lastTurnActivityAt(events)`),\n * never `session.updatedAt`: a rename or mode switch moves that without\n * warming the provider's cache. Null (no turn yet / log not loaded) → no warning.\n */\n lastActivityAt: string | null,\n): IdleCacheWarning | null {\n if (session.status === 'running' || lastActivityAt === null) return null;\n const last = Date.parse(lastActivityAt);\n if (!Number.isFinite(last)) return null;\n const idleMs = now - last;\n if (idleMs < CACHE_IDLE_TTL_MS || tokens < sessionOverheadTokens(session.engine)) return null;\n return { idleMs, tokens, local: session.engine === 'local' };\n}\n\n// ---------------------------------------------------------------------------\n// Per-seat efficiency across sessions (Usage section)\n// ---------------------------------------------------------------------------\n\nexport interface SeatEfficiencyRow {\n seatId: string;\n label: string;\n engine: VerseEngine;\n /** The seat is no longer in the roster (its sessions remain on disk). */\n retired: boolean;\n sessions: number;\n turns: number;\n /** input + cache read + cache write: every prompt token the seat was sent. */\n promptTokens: number;\n outputTokens: number;\n /** Null when the provider reported no cache activity on any of these sessions. */\n cacheHitRatio: number | null;\n compactions: number;\n expansiveSessions: number;\n /** The fullest context among these sessions right now, as a share of its window. */\n fullest: { sessionId: string; title: string; tokens: number; window: number | null; exact: boolean } | null;\n}\n\n/**\n * \"Fullest\" is a share of the window when both windows are known; a context\n * with a known window outranks one without (its fullness is a fact, the other\n * a size); two unknown windows compare by size.\n */\nfunction fuller(a: NonNullable<SeatEfficiencyRow['fullest']>, b: NonNullable<SeatEfficiencyRow['fullest']>): boolean {\n if (a.window !== null && b.window !== null) return a.tokens / a.window > b.tokens / b.window;\n if (a.window !== null) return true;\n if (b.window !== null) return false;\n return a.tokens > b.tokens;\n}\n\n/**\n * Aggregate every session by seat. Ratios are computed from SUMS, never as a\n * mean of per-session ratios — a two-turn chat must not weigh as much as a\n * two-hundred-turn one. Seats with no sessions are omitted rather than shown\n * as zeros. Sorted by prompt tokens, largest first: that is where efficiency\n * matters most.\n */\nexport function seatEfficiency(sessions: readonly VerseSession[], seats: readonly VerseSeat[]): SeatEfficiencyRow[] {\n const bySeat = new Map<string, VerseSession[]>();\n for (const s of sessions) {\n const list = bySeat.get(s.seatId) ?? [];\n list.push(s);\n bySeat.set(s.seatId, list);\n }\n const rows: SeatEfficiencyRow[] = [];\n for (const [seatId, list] of bySeat) {\n const seat = seats.find((s) => s.id === seatId) ?? null;\n let input = 0;\n let read = 0;\n let write = 0;\n let output = 0;\n let turns = 0;\n let compactions = 0;\n let expansiveSessions = 0;\n let fullest: SeatEfficiencyRow['fullest'] = null;\n for (const s of list) {\n input += s.usage.inputTokens;\n read += s.usage.cacheReadTokens;\n write += s.usage.cacheCreationTokens;\n output += s.usage.outputTokens;\n turns += s.turnCount;\n compactions += s.compactionCount ?? 0;\n // The mode as the meter resolves it (verse-model sessionContextBudget),\n // counted before the empty-reading skip: the mode is a fact about the\n // chat, not about its reading.\n const view = sessionContext(s, seats);\n if (view.mode === 'expansive') expansiveSessions += 1;\n if (view.tokens <= 0) continue;\n const candidate = { sessionId: s.id, title: s.title, tokens: view.tokens, window: view.window, exact: view.exact };\n if (fullest === null || fuller(candidate, fullest)) fullest = candidate;\n }\n rows.push({\n seatId,\n label: seat?.label ?? seatId,\n engine: seat?.engine ?? list[0]!.engine,\n retired: seat === null,\n sessions: list.length,\n turns,\n promptTokens: input + read + write,\n outputTokens: output,\n cacheHitRatio: reportedCacheHitRatio({ inputTokens: input, cacheReadTokens: read, cacheCreationTokens: write }),\n compactions,\n expansiveSessions,\n fullest,\n });\n }\n return rows.sort((a, b) => b.promptTokens - a.promptTokens || a.label.localeCompare(b.label));\n}\n"],"mappings":"oMAgEA,SAAgB,EAAgB,EAAoC,EAA0C,CAC5G,OAAO,EAAO,EAAe,CAAC,CAAI,EAAG,CAAE,OAAQ,EAAK,GAAI,MAAO,CAAQ,CAAC,EAAI,IAC9E,CAGA,SAAgB,EAAmB,EAA6C,EAA0C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AAQ,EAAO,EAAW,CAAO,KAAG,EAAU,EAChE,CACA,EAAK,KAAK,CACR,SACA,MAAO,GAAM,OAAS,EACtB,OAAQ,GAAM,QAAU,EAAK,EAAE,CAAE,OACjC,QAAS,IAAS,KAClB,SAAU,EAAK,OACf,QACA,aAAc,EAAQ,EAAO,EAC7B,aAAc,EACd,cAAe,EAAsB,CAAE,YAAa,EAAO,gBAAiB,EAAM,oBAAqB,CAAM,CAAC,EAC9G,cACA,oBACA,SACF,CAAC,CACH,CACA,OAAO,EAAK,MAAM,EAAG,IAAM,EAAE,aAAe,EAAE,cAAgB,EAAE,MAAM,cAAc,EAAE,KAAK,CAAC,CAC9F"}
|
package/dist/core/web/public/next/assets/{context-queries-BDXT6LQ3.js → context-queries-CrPcHWTz.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as e,F as t,M as n,O as r,U as i,W as a,l as o,o as s}from"./global-
|
|
2
|
-
//# sourceMappingURL=context-queries-
|
|
1
|
+
import{D as e,F as t,M as n,O as r,U as i,W as a,l as o,o as s}from"./global-oEl9Qj8u.js";import{C as c,d as l,n as u,r as d}from"./VerseConsoleApp-DTjDpGCd.js";import{d as f}from"./verse-store-b_Lek_c5.js";import{t as p}from"./format-BkWdOQDL.js";var m=`verse-preferences`,h=`verse-memory:`;async function g(e){try{let t=await e.json();if(typeof t.error==`string`&&t.error)return t.error;if(typeof t.note==`string`&&t.note)return t.note}catch{}return null}async function _(e,t){let i=await fetch(e,{method:`GET`,credentials:`same-origin`,headers:{"x-ashlr-read-client":r()},signal:t});if(i.status===401)throw n(),new s(`Read session expired.`,401,e);if(!i.ok){let t=await g(i);throw new s(`GET ${e} failed (HTTP ${i.status})${t?`: ${p(t)}`:``}.`,i.status,e,t)}return await i.json()}async function v(n,r){let i=e();if(!i)throw new d;let a=await o(n,r,i);return t(),a}function y(e,t){let n=t.toString();return n?`${e}?${n}`:e}async function b(e,t){let n={mode:t},r=await v(c(e,`/context-mode`),n);return f(e,r),i(u),r}async function x(e,t={}){let n={};t.includeLastAssistant===!0&&(n.includeLastAssistant=!0);let r=typeof t.focus==`string`?t.focus.trim().slice(0,500):``;return r&&(n.focus=r),v(c(e,`/handoff-preview`),n)}async function S(e){let{source:t}=e,n={projectPath:t.projectPath,seatId:e.seatId,handoffFromSessionId:t.id},r=(t.extraRoots??[]).filter(e=>typeof e==`string`&&e.length>0&&e!==t.projectPath);r.length>0&&(n.extraRoots=r),e.model&&(n.model=e.model),e.contextMode&&(n.contextMode=e.contextMode);let i=e.title?.trim();i&&(n.title=i);let a=await v(`/api/verse/sessions`,n);return l(),a}function C(e){return _(`/api/verse/preferences`,e)}var w={key:m,fetch:e=>C(e)};async function T(e){let t=await v(`/api/verse/preferences`,e);return i(m),a(h),t}function E(e){let t=new URLSearchParams,n=e.workspaceId?.trim()??``,r=e.projectPath?.trim()??``,i=(e.extraRoots??[]).map(e=>e.trim()).filter(e=>e.length>0);if(n){if(r||i.length>0)throw Error(`Estimate a workspace or a folder set, not both.`);t.set(`workspaceId`,n)}else if(r){t.set(`projectPath`,r);for(let e of i)t.append(`extraRoots`,e)}else throw Error(`Pick a project or a workspace to estimate.`);return y(`/api/verse/context-fit`,t)}function D(e,t){return _(E(e),t)}function O(e,t,n){let r=new URLSearchParams({q:e});return typeof t==`number`&&Number.isFinite(t)&&r.set(`limit`,String(Math.max(1,Math.min(50,Math.floor(t))))),_(y(`/api/verse/search`,r),n)}function k(e){return`${h}${e}`}function A(e,t){return _(y(`/api/verse/memory`,new URLSearchParams({projectPath:e})),t)}function j(e){return{key:k(e),fetch:t=>A(e,t)}}async function M(e,t){let n=await v(`/api/verse/memory`,{projectPath:e,content:t});return i(k(e)),n}export{A as a,T as c,M as d,C as i,w as l,D as n,O as o,x as r,b as s,S as t,j as u};
|
|
2
|
+
//# sourceMappingURL=context-queries-CrPcHWTz.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-queries-BDXT6LQ3.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/context/context-queries.ts"],"sourcesContent":["/**\n * routes/verse/context/context-queries.ts — every V3.9 context-orchestration\n * call the Verse console makes (docs/VERSE-CONTEXT.md): context mode, handoff\n * preview + handoff creation, preferences, context fit, session search and\n * shared project memory.\n *\n * Same conventions as ../verse-queries.ts, deliberately:\n *\n * - WRITES pull the held mutation token from auth-store, throw\n * `VerseMutationLockedError` (the SAME class, so ChatSection's `fail`\n * recognises it) when none is held, touch the hold on success, and\n * invalidate exactly the cache keys they obviously change.\n * - READS carry the per-tab read-client proof and report an expired read\n * session, exactly like `apiGet`. They are written out here rather than\n * routed through `apiGet` for one reason: `apiGet` discards the response\n * body on a non-2xx, and the routes below answer a refused read (\"path is\n * not a directory\", \"q must be at least 2 characters\") with a sentence\n * written for a person. Those sentences travel as `ApiError.detail`, the\n * field `describeControlError` already prefers.\n *\n * NOTHING HERE SPENDS. Every route below is deterministic server work\n * (preferences file, git ls-files, events.jsonl scans, a memory file). The\n * one model call a context feature can cause — \"ask this seat to summarize\"\n * — goes through the ordinary `sendVerseTurn`, i.e. through the engine's\n * `startTurn` chokepoint and the local-only policy, never through this file.\n *\n * `handoff-preview` is a POST although it only reads: it spawns\n * `git diff --stat` per root, and the API keeps every spawning route behind\n * the dispatch flag and the mutation token. It therefore needs the token like\n * any write, and the dialog says so.\n */\nimport type { VerseCreateSessionRequest, VerseSession } from '../../../data/api-types.js';\nimport type {\n VerseContextFit,\n VerseContextMode,\n VerseContextModeRequest,\n VerseHandoffPreview,\n VerseHandoffPreviewRequest,\n VersePreferences,\n VersePreferencesUpdate,\n VerseProjectMemory,\n VerseProjectMemoryWrite,\n VerseSearchResponse,\n} from '../../../../core/verse/types.js';\nimport { getMutationToken, reportSessionExpired, getReadClientProof, touchMutationHold } from '../../../data/auth-store.js';\nimport { invalidate, invalidatePrefix } from '../../../data/cache.js';\nimport { ApiError, apiPost } from '../../../data/client.js';\nimport type { QueryDef } from '../../../data/queries.js';\nimport { invalidateVerseLists, verseSessionPath, VERSE_SESSIONS_KEY, VerseMutationLockedError } from '../verse-queries.js';\nimport { setVerseSession } from '../verse-store.js';\nimport { asClause } from '../autonomy/format.js';\n\nexport const VERSE_PREFERENCES_KEY = 'verse-preferences';\n/** Prefix of every per-project memory key; `invalidatePrefix` reaches all of them. */\nexport const VERSE_MEMORY_KEY_PREFIX = 'verse-memory:';\n/** Prefix of every context-fit key (one per root set). */\nexport const VERSE_CONTEXT_FIT_KEY_PREFIX = 'verse-context-fit:';\n\n// ---------------------------------------------------------------------------\n// Transport\n// ---------------------------------------------------------------------------\n\n/** The server's own refusal sentence, when the body carried one. */\nasync function refusalDetail(res: Response): Promise<string | null> {\n try {\n const body = (await res.json()) as { error?: unknown; note?: unknown };\n if (typeof body.error === 'string' && body.error) return body.error;\n if (typeof body.note === 'string' && body.note) return body.note;\n } catch {\n /* not JSON — the status alone has to do */\n }\n return null;\n}\n\n/**\n * GET with the read-client proof. Behaves like `apiGet` (401 reports the\n * expired read session) but keeps the server's refusal sentence.\n */\nasync function getJson<T>(path: string, signal?: AbortSignal): Promise<T> {\n const res = await fetch(path, {\n method: 'GET',\n credentials: 'same-origin',\n headers: { 'x-ashlr-read-client': getReadClientProof() },\n signal,\n });\n if (res.status === 401) {\n reportSessionExpired();\n throw new ApiError('Read session expired.', 401, path);\n }\n if (!res.ok) {\n const detail = await refusalDetail(res);\n // asClause: a detail ending in its own period would otherwise read \"…..\".\n throw new ApiError(`GET ${path} failed (HTTP ${res.status})${detail ? `: ${asClause(detail)}` : ''}.`, res.status, path, detail);\n }\n return (await res.json()) as T;\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\nfunction withQuery(path: string, params: URLSearchParams): string {\n const query = params.toString();\n return query ? `${path}?${query}` : path;\n}\n\n// ---------------------------------------------------------------------------\n// Context mode\n// ---------------------------------------------------------------------------\n\n/**\n * Switch a session between `standard` and `expansive`. Applies from the next\n * turn (it only changes CLI flags, never prompt content, so the provider's\n * prompt cache survives the switch).\n *\n * The returned record is also written into verse-store, so the meter, the\n * mode chip and the composer hint all move on this response rather than on\n * the next list refresh — whichever component made the call.\n */\nexport async function setSessionContextMode(sessionId: string, mode: VerseContextMode): Promise<VerseSession> {\n const body: VerseContextModeRequest = { mode };\n const session = await post<VerseSession>(verseSessionPath(sessionId, '/context-mode'), body);\n setVerseSession(sessionId, session);\n invalidate(VERSE_SESSIONS_KEY);\n return session;\n}\n\n// ---------------------------------------------------------------------------\n// Handoff\n// ---------------------------------------------------------------------------\n\n/** Longest focus line the API accepts (types.ts VerseHandoffPreviewRequest). */\nexport const HANDOFF_FOCUS_MAX_CHARS = 500;\n\n/**\n * Build the deterministic handoff note for a session. Zero spend: the server\n * reads events.jsonl and a bounded `git diff --stat` per root.\n *\n * Only keys that carry a value are sent — the route rejects unknown keys, and\n * `includeLastAssistant: false` is the default anyway, so omitting it keeps\n * the body minimal and the server's validation the single authority.\n */\nexport async function fetchHandoffPreview(sessionId: string, req: VerseHandoffPreviewRequest = {}): Promise<VerseHandoffPreview> {\n const body: VerseHandoffPreviewRequest = {};\n if (req.includeLastAssistant === true) body.includeLastAssistant = true;\n const focus = typeof req.focus === 'string' ? req.focus.trim().slice(0, HANDOFF_FOCUS_MAX_CHARS) : '';\n if (focus) body.focus = focus;\n return post<VerseHandoffPreview>(verseSessionPath(sessionId, '/handoff-preview'), body);\n}\n\nexport interface HandoffSessionInput {\n /** The session being handed off. Its PINNED roots are reused, see below. */\n source: VerseSession;\n seatId: string;\n model?: string;\n contextMode?: VerseContextMode;\n /** Optional title; absent → the server titles it from the first message. */\n title?: string;\n}\n\n/**\n * Create the session a handoff continues in. FREE: creating a session spawns\n * nothing. The handoff text is NOT sent here — the caller pre-fills the new\n * chat's composer and the operator presses send, so the first (spent) turn is\n * always one the operator read.\n *\n * Roots: the source's PINNED roots (`projectPath` + `extraRoots`), never its\n * `workspaceId`. A session keeps the roots it was created with even if the\n * named workspace was later edited or deleted (types.ts VerseSession\n * `extraRoots`); re-resolving the workspace here would let the continuation\n * silently gain or lose a folder the conversation was about — or fail\n * outright on a deleted workspace. The API also refuses the two spellings\n * mixed, so it is one or the other, and the pinned set is the honest one.\n *\n * The server resolves `handoffFrom.title` from `handoffFromSessionId` itself;\n * nothing about provenance is taken from this body.\n */\nexport async function createHandoffSession(input: HandoffSessionInput): Promise<VerseSession> {\n const { source } = input;\n const req: VerseCreateSessionRequest = {\n projectPath: source.projectPath,\n seatId: input.seatId,\n handoffFromSessionId: source.id,\n };\n const extras = (source.extraRoots ?? []).filter((root) => typeof root === 'string' && root.length > 0 && root !== source.projectPath);\n if (extras.length > 0) req.extraRoots = extras;\n if (input.model) req.model = input.model;\n if (input.contextMode) req.contextMode = input.contextMode;\n const title = input.title?.trim();\n if (title) req.title = title;\n const session = await post<VerseSession>('/api/verse/sessions', req);\n invalidateVerseLists();\n return session;\n}\n\n// ---------------------------------------------------------------------------\n// Preferences\n// ---------------------------------------------------------------------------\n\nexport function fetchPreferences(signal?: AbortSignal): Promise<VersePreferences> {\n return getJson<VersePreferences>('/api/verse/preferences', signal);\n}\n\nexport const versePreferencesQuery: QueryDef<VersePreferences> = {\n key: VERSE_PREFERENCES_KEY,\n fetch: (signal) => fetchPreferences(signal),\n};\n\n/**\n * Change ONE standing preference (the three request forms are exclusive, so a\n * body never changes more than the operator clicked). Memory records carry an\n * `enabled` flag derived from these preferences, so every cached memory read\n * is refreshed too.\n */\nexport async function updatePreferences(update: VersePreferencesUpdate): Promise<VersePreferences> {\n const prefs = await post<VersePreferences>('/api/verse/preferences', update);\n invalidate(VERSE_PREFERENCES_KEY);\n invalidatePrefix(VERSE_MEMORY_KEY_PREFIX);\n return prefs;\n}\n\n// ---------------------------------------------------------------------------\n// Context fit\n// ---------------------------------------------------------------------------\n\nexport interface ContextFitQuery {\n workspaceId?: string;\n projectPath?: string;\n extraRoots?: string[];\n}\n\n/**\n * The query string for a fit request: a workspace id ALONE, or a project path\n * with each extra root as its own repeated `extraRoots` parameter (a path may\n * contain a comma, so a joined list could not be split back honestly). The\n * API refuses the two spellings mixed — refused here first, with the reason.\n */\nexport function contextFitPath(q: ContextFitQuery): string {\n const params = new URLSearchParams();\n const workspaceId = q.workspaceId?.trim() ?? '';\n const projectPath = q.projectPath?.trim() ?? '';\n const extras = (q.extraRoots ?? []).map((r) => r.trim()).filter((r) => r.length > 0);\n if (workspaceId) {\n if (projectPath || extras.length > 0) throw new Error('Estimate a workspace or a folder set, not both.');\n params.set('workspaceId', workspaceId);\n } else if (projectPath) {\n params.set('projectPath', projectPath);\n for (const root of extras) params.append('extraRoots', root);\n } else {\n throw new Error('Pick a project or a workspace to estimate.');\n }\n return withQuery('/api/verse/context-fit', params);\n}\n\n/** How big the reachable code is, in estimated tokens. Zero spend (git ls-files + stat). */\nexport function fetchContextFit(q: ContextFitQuery, signal?: AbortSignal): Promise<VerseContextFit> {\n return getJson<VerseContextFit>(contextFitPath(q), signal);\n}\n\n/** Cache-backed form, keyed by the exact root set, for pickers that re-render often. */\nexport function verseContextFitQuery(q: ContextFitQuery): QueryDef<VerseContextFit> {\n const path = contextFitPath(q);\n return { key: `${VERSE_CONTEXT_FIT_KEY_PREFIX}${path}`, fetch: (signal) => getJson<VerseContextFit>(path, signal) };\n}\n\n// ---------------------------------------------------------------------------\n// Session search\n// ---------------------------------------------------------------------------\n\n/** The API caps `limit` at 50 (session-search.ts); asking for more is refused, so clamp. */\nexport const SEARCH_LIMIT_MAX = 50;\n\n/** Keyword search over past sessions' messages. Zero spend — a bounded scan of events.jsonl. */\nexport function searchSessions(q: string, limit?: number, signal?: AbortSignal): Promise<VerseSearchResponse> {\n const params = new URLSearchParams({ q });\n if (typeof limit === 'number' && Number.isFinite(limit)) {\n params.set('limit', String(Math.max(1, Math.min(SEARCH_LIMIT_MAX, Math.floor(limit)))));\n }\n return getJson<VerseSearchResponse>(withQuery('/api/verse/search', params), signal);\n}\n\n// ---------------------------------------------------------------------------\n// Shared project memory\n// ---------------------------------------------------------------------------\n\n/**\n * The memory record as the browser receives it. The server's public-JSON\n * sanitizer rewrites the home folder as `~` and secret-shaped text as\n * `[REDACTED]` on the way out, so `content` can differ from the file on disk;\n * the route then adds `contentSanitized: true` (absent otherwise). Declared\n * here, not in types.ts: that contract is frozen and the flag is additive.\n */\nexport type VerseProjectMemoryView = VerseProjectMemory & { contentSanitized?: boolean };\n\nexport function verseProjectMemoryKey(projectPath: string): string {\n return `${VERSE_MEMORY_KEY_PREFIX}${projectPath}`;\n}\n\nexport function fetchProjectMemory(projectPath: string, signal?: AbortSignal): Promise<VerseProjectMemoryView> {\n return getJson<VerseProjectMemoryView>(withQuery('/api/verse/memory', new URLSearchParams({ projectPath })), signal);\n}\n\nexport function verseProjectMemoryQuery(projectPath: string): QueryDef<VerseProjectMemoryView> {\n return { key: verseProjectMemoryKey(projectPath), fetch: (signal) => fetchProjectMemory(projectPath, signal) };\n}\n\n/**\n * Replace MEMORY.md for a project (atomic, 0600 on the server, capped at\n * VERSE_MEMORY_MAX_BYTES). `''` clears it. Chats already open keep the block\n * pinned in their instructions at creation; they see the change when they\n * next read the file.\n */\nexport async function writeProjectMemory(projectPath: string, content: string): Promise<VerseProjectMemoryView> {\n const body: VerseProjectMemoryWrite = { projectPath, content };\n const memory = await post<VerseProjectMemoryView>('/api/verse/memory', body);\n invalidate(verseProjectMemoryKey(projectPath));\n return memory;\n}\n"],"mappings":"wPAoDA,IAAa,EAAwB,oBAExB,EAA0B,gBASvC,eAAe,EAAc,EAAuC,CAClE,GAAI,CACF,IAAM,EAAQ,MAAM,EAAI,KAAK,EAC7B,GAAI,OAAO,EAAK,OAAU,UAAY,EAAK,MAAO,OAAO,EAAK,MAC9D,GAAI,OAAO,EAAK,MAAS,UAAY,EAAK,KAAM,OAAO,EAAK,IAC9D,MAAQ,CAER,CACA,OAAO,IACT,CAMA,eAAe,EAAW,EAAc,EAAkC,CACxE,IAAM,EAAM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,CAAM,CACnD,CAGA,SAAgB,EAAgB,EAAoB,EAAgD,CAClG,OAAO,EAAyB,EAAe,CAAC,EAAG,CAAM,CAC3D,CAgBA,SAAgB,EAAe,EAAW,EAAgB,EAAoD,CAC5G,IAAM,EAAS,IAAI,gBAAgB,CAAE,GAAE,CAAC,EAIxC,OAHI,OAAO,GAAU,UAAY,OAAO,SAAS,CAAK,GACpD,EAAO,IAAI,QAAS,OAAO,KAAK,IAAI,EAAG,KAAK,IAAA,GAAsB,KAAK,MAAM,CAAK,CAAC,CAAC,CAAC,CAAC,EAEjF,EAA6B,EAAU,oBAAqB,CAAM,EAAG,CAAM,CACpF,CAeA,SAAgB,EAAsB,EAA6B,CACjE,MAAO,GAAG,IAA0B,GACtC,CAEA,SAAgB,EAAmB,EAAqB,EAAuD,CAC7G,OAAO,EAAgC,EAAU,oBAAqB,IAAI,gBAAgB,CAAE,aAAY,CAAC,CAAC,EAAG,CAAM,CACrH,CAEA,SAAgB,EAAwB,EAAuD,CAC7F,MAAO,CAAE,IAAK,EAAsB,CAAW,EAAG,MAAQ,GAAW,EAAmB,EAAa,CAAM,CAAE,CAC/G,CAQA,eAAsB,EAAmB,EAAqB,EAAkD,CAE9G,IAAM,EAAS,MAAM,EAA6B,oBAAqB,CAD/B,cAAa,SACkB,CAAI,EAE3E,OADA,EAAW,EAAsB,CAAW,CAAC,EACtC,CACT"}
|
|
1
|
+
{"version":3,"file":"context-queries-CrPcHWTz.js","names":[],"sources":["../../../../../../src/web-ui/routes/verse/context/context-queries.ts"],"sourcesContent":["/**\n * routes/verse/context/context-queries.ts — every V3.9 context-orchestration\n * call the Verse console makes (docs/VERSE-CONTEXT.md): context mode, handoff\n * preview + handoff creation, preferences, context fit, session search and\n * shared project memory.\n *\n * Same conventions as ../verse-queries.ts, deliberately:\n *\n * - WRITES pull the held mutation token from auth-store, throw\n * `VerseMutationLockedError` (the SAME class, so ChatSection's `fail`\n * recognises it) when none is held, touch the hold on success, and\n * invalidate exactly the cache keys they obviously change.\n * - READS carry the per-tab read-client proof and report an expired read\n * session, exactly like `apiGet`. They are written out here rather than\n * routed through `apiGet` for one reason: `apiGet` discards the response\n * body on a non-2xx, and the routes below answer a refused read (\"path is\n * not a directory\", \"q must be at least 2 characters\") with a sentence\n * written for a person. Those sentences travel as `ApiError.detail`, the\n * field `describeControlError` already prefers.\n *\n * NOTHING HERE SPENDS. Every route below is deterministic server work\n * (preferences file, git ls-files, events.jsonl scans, a memory file). The\n * one model call a context feature can cause — \"ask this seat to summarize\"\n * — goes through the ordinary `sendVerseTurn`, i.e. through the engine's\n * `startTurn` chokepoint and the local-only policy, never through this file.\n *\n * `handoff-preview` is a POST although it only reads: it spawns\n * `git diff --stat` per root, and the API keeps every spawning route behind\n * the dispatch flag and the mutation token. It therefore needs the token like\n * any write, and the dialog says so.\n */\nimport type { VerseCreateSessionRequest, VerseSession } from '../../../data/api-types.js';\nimport type {\n VerseContextFit,\n VerseContextMode,\n VerseContextModeRequest,\n VerseHandoffPreview,\n VerseHandoffPreviewRequest,\n VersePreferences,\n VersePreferencesUpdate,\n VerseProjectMemory,\n VerseProjectMemoryWrite,\n VerseSearchResponse,\n} from '../../../../core/verse/types.js';\nimport { getMutationToken, reportSessionExpired, getReadClientProof, touchMutationHold } from '../../../data/auth-store.js';\nimport { invalidate, invalidatePrefix } from '../../../data/cache.js';\nimport { ApiError, apiPost } from '../../../data/client.js';\nimport type { QueryDef } from '../../../data/queries.js';\nimport { invalidateVerseLists, verseSessionPath, VERSE_SESSIONS_KEY, VerseMutationLockedError } from '../verse-queries.js';\nimport { setVerseSession } from '../verse-store.js';\nimport { asClause } from '../autonomy/format.js';\n\nexport const VERSE_PREFERENCES_KEY = 'verse-preferences';\n/** Prefix of every per-project memory key; `invalidatePrefix` reaches all of them. */\nexport const VERSE_MEMORY_KEY_PREFIX = 'verse-memory:';\n/** Prefix of every context-fit key (one per root set). */\nexport const VERSE_CONTEXT_FIT_KEY_PREFIX = 'verse-context-fit:';\n\n// ---------------------------------------------------------------------------\n// Transport\n// ---------------------------------------------------------------------------\n\n/** The server's own refusal sentence, when the body carried one. */\nasync function refusalDetail(res: Response): Promise<string | null> {\n try {\n const body = (await res.json()) as { error?: unknown; note?: unknown };\n if (typeof body.error === 'string' && body.error) return body.error;\n if (typeof body.note === 'string' && body.note) return body.note;\n } catch {\n /* not JSON — the status alone has to do */\n }\n return null;\n}\n\n/**\n * GET with the read-client proof. Behaves like `apiGet` (401 reports the\n * expired read session) but keeps the server's refusal sentence.\n */\nasync function getJson<T>(path: string, signal?: AbortSignal): Promise<T> {\n const res = await fetch(path, {\n method: 'GET',\n credentials: 'same-origin',\n headers: { 'x-ashlr-read-client': getReadClientProof() },\n signal,\n });\n if (res.status === 401) {\n reportSessionExpired();\n throw new ApiError('Read session expired.', 401, path);\n }\n if (!res.ok) {\n const detail = await refusalDetail(res);\n // asClause: a detail ending in its own period would otherwise read \"…..\".\n throw new ApiError(`GET ${path} failed (HTTP ${res.status})${detail ? `: ${asClause(detail)}` : ''}.`, res.status, path, detail);\n }\n return (await res.json()) as T;\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\nfunction withQuery(path: string, params: URLSearchParams): string {\n const query = params.toString();\n return query ? `${path}?${query}` : path;\n}\n\n// ---------------------------------------------------------------------------\n// Context mode\n// ---------------------------------------------------------------------------\n\n/**\n * Switch a session between `standard` and `expansive`. Applies from the next\n * turn (it only changes CLI flags, never prompt content, so the provider's\n * prompt cache survives the switch).\n *\n * The returned record is also written into verse-store, so the meter, the\n * mode chip and the composer hint all move on this response rather than on\n * the next list refresh — whichever component made the call.\n */\nexport async function setSessionContextMode(sessionId: string, mode: VerseContextMode): Promise<VerseSession> {\n const body: VerseContextModeRequest = { mode };\n const session = await post<VerseSession>(verseSessionPath(sessionId, '/context-mode'), body);\n setVerseSession(sessionId, session);\n invalidate(VERSE_SESSIONS_KEY);\n return session;\n}\n\n// ---------------------------------------------------------------------------\n// Handoff\n// ---------------------------------------------------------------------------\n\n/** Longest focus line the API accepts (types.ts VerseHandoffPreviewRequest). */\nexport const HANDOFF_FOCUS_MAX_CHARS = 500;\n\n/**\n * Build the deterministic handoff note for a session. Zero spend: the server\n * reads events.jsonl and a bounded `git diff --stat` per root.\n *\n * Only keys that carry a value are sent — the route rejects unknown keys, and\n * `includeLastAssistant: false` is the default anyway, so omitting it keeps\n * the body minimal and the server's validation the single authority.\n */\nexport async function fetchHandoffPreview(sessionId: string, req: VerseHandoffPreviewRequest = {}): Promise<VerseHandoffPreview> {\n const body: VerseHandoffPreviewRequest = {};\n if (req.includeLastAssistant === true) body.includeLastAssistant = true;\n const focus = typeof req.focus === 'string' ? req.focus.trim().slice(0, HANDOFF_FOCUS_MAX_CHARS) : '';\n if (focus) body.focus = focus;\n return post<VerseHandoffPreview>(verseSessionPath(sessionId, '/handoff-preview'), body);\n}\n\nexport interface HandoffSessionInput {\n /** The session being handed off. Its PINNED roots are reused, see below. */\n source: VerseSession;\n seatId: string;\n model?: string;\n contextMode?: VerseContextMode;\n /** Optional title; absent → the server titles it from the first message. */\n title?: string;\n}\n\n/**\n * Create the session a handoff continues in. FREE: creating a session spawns\n * nothing. The handoff text is NOT sent here — the caller pre-fills the new\n * chat's composer and the operator presses send, so the first (spent) turn is\n * always one the operator read.\n *\n * Roots: the source's PINNED roots (`projectPath` + `extraRoots`), never its\n * `workspaceId`. A session keeps the roots it was created with even if the\n * named workspace was later edited or deleted (types.ts VerseSession\n * `extraRoots`); re-resolving the workspace here would let the continuation\n * silently gain or lose a folder the conversation was about — or fail\n * outright on a deleted workspace. The API also refuses the two spellings\n * mixed, so it is one or the other, and the pinned set is the honest one.\n *\n * The server resolves `handoffFrom.title` from `handoffFromSessionId` itself;\n * nothing about provenance is taken from this body.\n */\nexport async function createHandoffSession(input: HandoffSessionInput): Promise<VerseSession> {\n const { source } = input;\n const req: VerseCreateSessionRequest = {\n projectPath: source.projectPath,\n seatId: input.seatId,\n handoffFromSessionId: source.id,\n };\n const extras = (source.extraRoots ?? []).filter((root) => typeof root === 'string' && root.length > 0 && root !== source.projectPath);\n if (extras.length > 0) req.extraRoots = extras;\n if (input.model) req.model = input.model;\n if (input.contextMode) req.contextMode = input.contextMode;\n const title = input.title?.trim();\n if (title) req.title = title;\n const session = await post<VerseSession>('/api/verse/sessions', req);\n invalidateVerseLists();\n return session;\n}\n\n// ---------------------------------------------------------------------------\n// Preferences\n// ---------------------------------------------------------------------------\n\nexport function fetchPreferences(signal?: AbortSignal): Promise<VersePreferences> {\n return getJson<VersePreferences>('/api/verse/preferences', signal);\n}\n\nexport const versePreferencesQuery: QueryDef<VersePreferences> = {\n key: VERSE_PREFERENCES_KEY,\n fetch: (signal) => fetchPreferences(signal),\n};\n\n/**\n * Change ONE standing preference (the three request forms are exclusive, so a\n * body never changes more than the operator clicked). Memory records carry an\n * `enabled` flag derived from these preferences, so every cached memory read\n * is refreshed too.\n */\nexport async function updatePreferences(update: VersePreferencesUpdate): Promise<VersePreferences> {\n const prefs = await post<VersePreferences>('/api/verse/preferences', update);\n invalidate(VERSE_PREFERENCES_KEY);\n invalidatePrefix(VERSE_MEMORY_KEY_PREFIX);\n return prefs;\n}\n\n// ---------------------------------------------------------------------------\n// Context fit\n// ---------------------------------------------------------------------------\n\nexport interface ContextFitQuery {\n workspaceId?: string;\n projectPath?: string;\n extraRoots?: string[];\n}\n\n/**\n * The query string for a fit request: a workspace id ALONE, or a project path\n * with each extra root as its own repeated `extraRoots` parameter (a path may\n * contain a comma, so a joined list could not be split back honestly). The\n * API refuses the two spellings mixed — refused here first, with the reason.\n */\nexport function contextFitPath(q: ContextFitQuery): string {\n const params = new URLSearchParams();\n const workspaceId = q.workspaceId?.trim() ?? '';\n const projectPath = q.projectPath?.trim() ?? '';\n const extras = (q.extraRoots ?? []).map((r) => r.trim()).filter((r) => r.length > 0);\n if (workspaceId) {\n if (projectPath || extras.length > 0) throw new Error('Estimate a workspace or a folder set, not both.');\n params.set('workspaceId', workspaceId);\n } else if (projectPath) {\n params.set('projectPath', projectPath);\n for (const root of extras) params.append('extraRoots', root);\n } else {\n throw new Error('Pick a project or a workspace to estimate.');\n }\n return withQuery('/api/verse/context-fit', params);\n}\n\n/** How big the reachable code is, in estimated tokens. Zero spend (git ls-files + stat). */\nexport function fetchContextFit(q: ContextFitQuery, signal?: AbortSignal): Promise<VerseContextFit> {\n return getJson<VerseContextFit>(contextFitPath(q), signal);\n}\n\n/** Cache-backed form, keyed by the exact root set, for pickers that re-render often. */\nexport function verseContextFitQuery(q: ContextFitQuery): QueryDef<VerseContextFit> {\n const path = contextFitPath(q);\n return { key: `${VERSE_CONTEXT_FIT_KEY_PREFIX}${path}`, fetch: (signal) => getJson<VerseContextFit>(path, signal) };\n}\n\n// ---------------------------------------------------------------------------\n// Session search\n// ---------------------------------------------------------------------------\n\n/** The API caps `limit` at 50 (session-search.ts); asking for more is refused, so clamp. */\nexport const SEARCH_LIMIT_MAX = 50;\n\n/** Keyword search over past sessions' messages. Zero spend — a bounded scan of events.jsonl. */\nexport function searchSessions(q: string, limit?: number, signal?: AbortSignal): Promise<VerseSearchResponse> {\n const params = new URLSearchParams({ q });\n if (typeof limit === 'number' && Number.isFinite(limit)) {\n params.set('limit', String(Math.max(1, Math.min(SEARCH_LIMIT_MAX, Math.floor(limit)))));\n }\n return getJson<VerseSearchResponse>(withQuery('/api/verse/search', params), signal);\n}\n\n// ---------------------------------------------------------------------------\n// Shared project memory\n// ---------------------------------------------------------------------------\n\n/**\n * The memory record as the browser receives it. The server's public-JSON\n * sanitizer rewrites the home folder as `~` and secret-shaped text as\n * `[REDACTED]` on the way out, so `content` can differ from the file on disk;\n * the route then adds `contentSanitized: true` (absent otherwise). Declared\n * here, not in types.ts: that contract is frozen and the flag is additive.\n */\nexport type VerseProjectMemoryView = VerseProjectMemory & { contentSanitized?: boolean };\n\nexport function verseProjectMemoryKey(projectPath: string): string {\n return `${VERSE_MEMORY_KEY_PREFIX}${projectPath}`;\n}\n\nexport function fetchProjectMemory(projectPath: string, signal?: AbortSignal): Promise<VerseProjectMemoryView> {\n return getJson<VerseProjectMemoryView>(withQuery('/api/verse/memory', new URLSearchParams({ projectPath })), signal);\n}\n\nexport function verseProjectMemoryQuery(projectPath: string): QueryDef<VerseProjectMemoryView> {\n return { key: verseProjectMemoryKey(projectPath), fetch: (signal) => fetchProjectMemory(projectPath, signal) };\n}\n\n/**\n * Replace MEMORY.md for a project (atomic, 0600 on the server, capped at\n * VERSE_MEMORY_MAX_BYTES). `''` clears it. Chats already open keep the block\n * pinned in their instructions at creation; they see the change when they\n * next read the file.\n */\nexport async function writeProjectMemory(projectPath: string, content: string): Promise<VerseProjectMemoryView> {\n const body: VerseProjectMemoryWrite = { projectPath, content };\n const memory = await post<VerseProjectMemoryView>('/api/verse/memory', body);\n invalidate(verseProjectMemoryKey(projectPath));\n return memory;\n}\n"],"mappings":"wPAoDA,IAAa,EAAwB,oBAExB,EAA0B,gBASvC,eAAe,EAAc,EAAuC,CAClE,GAAI,CACF,IAAM,EAAQ,MAAM,EAAI,KAAK,EAC7B,GAAI,OAAO,EAAK,OAAU,UAAY,EAAK,MAAO,OAAO,EAAK,MAC9D,GAAI,OAAO,EAAK,MAAS,UAAY,EAAK,KAAM,OAAO,EAAK,IAC9D,MAAQ,CAER,CACA,OAAO,IACT,CAMA,eAAe,EAAW,EAAc,EAAkC,CACxE,IAAM,EAAM,MAAM,MAAM,EAAM,CAC5B,OAAQ,MACR,YAAa,cACb,QAAS,CAAE,sBAAuB,EAAmB,CAAE,EACvD,QACF,CAAC,EACD,GAAI,EAAI,SAAW,IAEjB,MADA,EAAqB,EACf,IAAI,EAAS,wBAAyB,IAAK,CAAI,EAEvD,GAAI,CAAC,EAAI,GAAI,CACX,IAAM,EAAS,MAAM,EAAc,CAAG,EAEtC,MAAM,IAAI,EAAS,OAAO,EAAK,gBAAgB,EAAI,OAAO,GAAG,EAAS,K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AM,CAAK,CAAC,CAAC,CAAC,CAAC,EAEjF,EAA6B,EAAU,oBAAqB,CAAM,EAAG,CAAM,CACpF,CAeA,SAAgB,EAAsB,EAA6B,CACjE,MAAO,GAAG,IAA0B,GACtC,CAEA,SAAgB,EAAmB,EAAqB,EAAuD,CAC7G,OAAO,EAAgC,EAAU,oBAAqB,IAAI,gBAAgB,CAAE,aAAY,CAAC,CAAC,EAAG,CAAM,CACrH,CAEA,SAAgB,EAAwB,EAAuD,CAC7F,MAAO,CAAE,IAAK,EAAsB,CAAW,EAAG,MAAQ,GAAW,EAAmB,EAAa,CAAM,CAAE,CAC/G,CAQA,eAAsB,EAAmB,EAAqB,EAAkD,CAE9G,IAAM,EAAS,MAAM,EAA6B,oBAAqB,CAD/B,cAAa,SACkB,CAAI,EAE3E,OADA,EAAW,EAAsB,CAAW,CAAC,EACtC,CACT"}
|
package/dist/core/web/public/next/assets/{control-queries-Dv-h1Clu.js → control-queries-CmgBgKV7.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as e,F as t,U as n,c as r,l as i}from"./global-
|
|
2
|
-
//# sourceMappingURL=control-queries-
|
|
1
|
+
import{D as e,F as t,U as n,c as r,l as i}from"./global-oEl9Qj8u.js";import{i as a,n as o}from"./mutations-C5S7okTW.js";var s={dailyBudgetUsd:{min:0,max:1e3},perTickItems:{min:1,max:50},parallel:{min:1,max:16},intervalMs:{min:3e4,max:864e5},maxConcurrent:{min:1,max:32},concurrency:{min:1,max:32},subscriptionMaxPercent:{min:1,max:100},foundryLimitMax:{min:0,max:1e6}},c=`verse-control`,l=`verse-caps`,u=`verse-scope`,d=`verse-safety`,f=`verse-audit:`,p=500,m={key:c,fetch:e=>r(`/api/verse/control`,e)},h={key:l,fetch:e=>r(`/api/verse/caps`,e)},g={key:d,fetch:e=>r(`/api/verse/safety`,e)};function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var v={key:u,fetch:e=>r(`/api/verse/scope`,e)};function y(e={}){let t=Math.min(e.limit??200,p),n=new URLSearchParams;return n.set(`limit`,String(t)),e.action&&n.set(`action`,e.action),e.result&&n.set(`result`,e.result),{key:`${f}${t}:${e.action??``}:${e.result??``}`,fetch:e=>r(`/api/verse/audit?${n.toString()}`,e)}}var b={key:`goals`,fetch:e=>r(`/api/goals`,e)};function x(e){return e==null?{items:[],absent:!0}:Array.isArray(e)?{items:e,absent:!1}:_(e)&&Array.isArray(e.items)?{items:e.items,absent:!1}:{items:[],absent:!0}}var S={key:`backlog`,fetch:e=>r(`/api/backlog`,e).then(x)},C=class extends Error{constructor(){super(`Unlock actions with the mutation token before changing the loop.`),this.name=`VerseControlLockedError`}};async function w(n,r){let a=e();if(!a)throw new C;let o=await i(n,r,a);return t(),o}function T(){n(c)}async function E(e){let t=await w(`/api/verse/caps`,e);return n(l),T(),t}async function D(e){await w(`/api/verse/scope`,e),n(u),T()}async function O(e){let t=await w(`/api/verse/daemon`,{action:e});return T(),n(`daemon`),t}async function k(){await o(),T()}async function A(){await a(),T()}export{O as a,y as c,m as d,b as f,s as h,A as i,S as l,v as m,C as n,E as o,g as p,k as r,D as s,c as t,h as u};
|
|
2
|
+
//# sourceMappingURL=control-queries-CmgBgKV7.js.map
|