@kabmo-labs/kabmo 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +523 -441
- package/dist/client/static/js/{index-rerjq5th.js → index-fcee4c13.js} +828 -818
- package/dist/client/static/js/index-sxdw908m.css +1 -0
- package/marketplace/plugins/command-runner/package.json +3 -2
- package/marketplace/plugins/git-forge/package.json +3 -2
- package/marketplace/plugins/session-info/package.json +3 -2
- package/marketplace/plugins/stats/package.json +3 -2
- package/package.json +3 -1
- package/src/client/components/auth/login-screen/index.tsx +2 -1
- package/src/client/components/common/ComposerPicker.tsx +1 -1
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/Modal.tsx +2 -2
- package/src/client/components/common/PWAInstallButton.tsx +2 -2
- package/src/client/components/common/ViewportSelector.tsx +1 -1
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +147 -0
- package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
- package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
- package/src/client/components/common/brand-wordmark/index.tsx +13 -2
- package/src/client/components/common/checkbox/style.test.ts +139 -0
- package/src/client/components/common/checkbox/style.ts +51 -0
- package/src/client/components/common/context-usage-button/index.tsx +2 -2
- package/src/client/components/common/file-icon/index.tsx +23 -9
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
- package/src/client/components/common/markdown-review/index.tsx +129 -0
- package/src/client/components/common/panel-mark/index.tsx +97 -0
- package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
- package/src/client/components/common/provider-icon/index.test.ts +14 -0
- package/src/client/components/common/provider-icon/index.tsx +4 -0
- package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
- package/src/client/components/common/provider-icon/resolve.ts +16 -3
- package/src/client/components/common/server-control/Panel.tsx +33 -23
- package/src/client/components/common/server-control/index.test.tsx +11 -5
- package/src/client/components/common/server-control/index.tsx +10 -8
- package/src/client/components/common/session-actions-menu/index.tsx +1 -1
- package/src/client/components/common/toolbar-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +22 -3
- package/src/client/components/layout/LeftDock.tsx +9 -2
- package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
- package/src/client/components/layout/WindowAura.tsx +27 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
- package/src/client/components/layout/desktop-layout/index.tsx +3 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +44 -23
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
- package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
- package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +40 -14
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
- package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
- package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
- package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/mobile/panel-chips.tsx +10 -2
- package/src/client/components/settings/Modal.tsx +4 -4
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/apply-side-effects.test.ts +30 -0
- package/src/client/components/settings/apply-side-effects.ts +14 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
- package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
- package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
- package/src/client/components/settings/categories/McpSettings.tsx +4 -21
- package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
- package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +93 -77
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +28 -15
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
- package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
- package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
- package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +37 -8
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
- package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
- package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
- package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
- package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
- package/src/client/components/workspace/browser-panel/index.tsx +50 -4
- package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
- package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
- package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
- package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
- package/src/client/components/workspace/diff-panel/changes.ts +28 -12
- package/src/client/components/workspace/diff-panel/index.tsx +2 -2
- package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
- package/src/client/components/workspace/diff-panel/merge.ts +21 -1
- package/src/client/components/workspace/editor/Body.tsx +7 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
- package/src/client/components/workspace/editor/FilePane.tsx +12 -0
- package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
- package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
- package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +25 -22
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
- package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
- package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
- package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
- package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
- package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- package/src/client/components/workspace/git-panel/index.tsx +7 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
- package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
- package/src/client/components/workspace/search-panel/Body.tsx +1 -1
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
- package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
- package/src/client/data/agent-data/builtin.ts +0 -10
- package/src/client/data/agent-data/orchestrator.ts +0 -45
- package/src/client/data/agent-data/specialist.ts +0 -100
- package/src/client/data/mock/token-usage.ts +170 -120
- package/src/client/data/settings/omp-schema.json +33 -1
- package/src/client/glass.css +785 -0
- package/src/client/glass.test.ts +346 -0
- package/src/client/hooks/browser/use-annotate.test.ts +143 -0
- package/src/client/hooks/browser/use-annotate.ts +98 -0
- package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
- package/src/client/hooks/browser/use-close-tab.ts +67 -0
- package/src/client/hooks/browser/use-screencast.ts +13 -1
- package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
- package/src/client/hooks/chat/composer/browser-context.ts +40 -16
- package/src/client/hooks/chat/composer/items.test.ts +1 -1
- package/src/client/hooks/chat/composer/review-context.ts +38 -0
- package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
- package/src/client/hooks/chat/composer/use-draft.ts +31 -2
- package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
- package/src/client/hooks/editor/use-document-annotations.ts +124 -0
- package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
- package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
- package/src/client/hooks/editor/use-preview-review.ts +148 -0
- package/src/client/hooks/settings/agents.ts +149 -0
- package/src/client/hooks/settings/crud-list.test.ts +28 -6
- package/src/client/hooks/settings/crud-list.ts +96 -57
- package/src/client/hooks/settings/omp-config.ts +164 -0
- package/src/client/hooks/settings/useTokenUsage.ts +125 -0
- package/src/client/hooks/settings/write-feedback.test.ts +104 -0
- package/src/client/hooks/settings/write-feedback.ts +63 -0
- package/src/client/hooks/ui/glass-support.ts +57 -0
- package/src/client/hooks/ui/icon-style.ts +59 -0
- package/src/client/hooks/ui/markdown-hydration.ts +125 -0
- package/src/client/hooks/ui/stuck-header.test.ts +188 -0
- package/src/client/hooks/ui/stuck-header.ts +91 -0
- package/src/client/hooks/ui/style-attributes.test.ts +120 -0
- package/src/client/hooks/ui/surface-style.ts +56 -0
- package/src/client/hooks/ui/updates/index.test.ts +100 -1
- package/src/client/hooks/ui/updates/index.ts +50 -0
- package/src/client/hooks/ui/updates/notes.test.ts +138 -0
- package/src/client/hooks/ui/updates/notes.ts +57 -0
- package/src/client/hooks/workspace/panel-hues.ts +23 -0
- package/src/client/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/main.tsx +10 -0
- package/src/client/tailwind.css +329 -11
- package/src/server/lib/assets/shell-attributes.server.ts +80 -0
- package/src/server/lib/assets/shell-attributes.test.ts +86 -0
- package/src/server/lib/btw/lifecycle.server.ts +2 -2
- package/src/server/lib/db/schema.ts +7 -0
- package/src/server/lib/db/seed-terminal.test.ts +4 -0
- package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
- package/src/server/lib/omp/config/agents.ts +231 -61
- package/src/server/lib/omp/config/definitions.test.ts +9 -105
- package/src/server/lib/omp/config/extensions.ts +16 -7
- package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
- package/src/server/lib/omp/rpc/constants.test.ts +11 -0
- package/src/server/lib/omp/rpc/constants.ts +15 -0
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
- package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/rpc/manager.ts +2 -2
- package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
- package/src/server/lib/omp/rpc/process.test.ts +106 -0
- package/src/server/lib/omp/rpc/process.ts +39 -18
- package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
- package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
- package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
- package/src/server/lib/omp/rpc/session-commands.ts +17 -3
- package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
- package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
- package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
- package/src/server/lib/omp/rpc/utility.ts +12 -0
- package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
- package/src/server/lib/panels/manifest.test.ts +20 -0
- package/src/server/lib/panels/manifest.ts +12 -0
- package/src/server/lib/panels/scan.server.ts +4 -0
- package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
- package/src/server/lib/queue/delivery-harness.ts +8 -4
- package/src/server/lib/queue/delivery.server.test.ts +29 -0
- package/src/server/lib/queue/delivery.server.ts +39 -0
- package/src/server/lib/queue/store.server.test.ts +22 -2
- package/src/server/lib/queue/store.server.ts +33 -11
- package/src/server/lib/review/schema.server.ts +45 -0
- package/src/server/lib/review/store.server.ts +138 -0
- package/src/server/lib/terminal/attach-replay.test.ts +132 -0
- package/src/server/lib/terminal/output.test.ts +166 -0
- package/src/server/lib/terminal/output.ts +104 -0
- package/src/server/lib/terminal/runtime.server.ts +5 -0
- package/src/server/lib/terminal/send-result.test.ts +33 -0
- package/src/server/lib/terminal/send-result.ts +32 -0
- package/src/server/lib/terminal/session.server.ts +45 -11
- package/src/server/lib/terminal/store-liveness.test.ts +4 -0
- package/src/server/lib/updates/active-notes.test.ts +149 -0
- package/src/server/lib/updates/active-notes.ts +75 -0
- package/src/server/lib/updates/changelog-file.ts +42 -11
- package/src/server/lib/updates/changelog.test.ts +15 -1
- package/src/server/lib/updates/omp.ts +42 -15
- package/src/server/lib/updates/release-url.ts +27 -1
- package/src/server/lib/usage/index-parse.test.ts +200 -0
- package/src/server/lib/usage/index-parse.ts +178 -0
- package/src/server/lib/usage/index-query.server.ts +248 -0
- package/src/server/lib/usage/index-scan.server.ts +343 -0
- package/src/server/lib/usage/index-schema.server.ts +82 -0
- package/src/server/lib/usage/index.test.ts +234 -0
- package/src/server/lib/usage/providers.server.ts +4 -53
- package/src/server/plugins/ssr.ts +22 -5
- package/src/server/routes/browser/index.ts +3 -0
- package/src/server/routes/browser/stream.ts +31 -2
- package/src/server/routes/browser/tabs.test.ts +94 -0
- package/src/server/routes/browser/tabs.ts +85 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/review/bindings.ts +11 -0
- package/src/server/routes/review/index.ts +127 -0
- package/src/server/routes/review/routes.test.ts +191 -0
- package/src/server/routes/settings/agents.test.ts +180 -0
- package/src/server/routes/settings/agents.ts +95 -102
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
- package/src/server/routes/telemetry/tokens.test.ts +145 -0
- package/src/server/routes/telemetry/tokens.ts +70 -149
- package/src/server/routes/terminal/ws.ts +6 -5
- package/src/server/routes/updates/index.ts +2 -0
- package/src/server/routes/updates/notes.ts +34 -0
- package/src/server/routes/updates/routes.test.ts +49 -0
- package/src/shared/lib/browser/annotate.test.ts +283 -0
- package/src/shared/lib/browser/annotate.ts +231 -0
- package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
- package/src/shared/lib/browser/frame-gate.test.ts +91 -0
- package/src/shared/lib/browser/frame-gate.ts +69 -0
- package/src/shared/lib/browser/frame-params.test.ts +43 -0
- package/src/shared/lib/browser/frame-params.ts +60 -0
- package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
- package/src/shared/lib/browser/frame-pipeline.ts +80 -0
- package/src/shared/lib/browser/page-context.ts +60 -4
- package/src/shared/lib/browser/snapshot.test.ts +115 -0
- package/src/shared/lib/browser/snapshot.ts +112 -0
- package/src/shared/lib/browser/tab-close.test.ts +74 -0
- package/src/shared/lib/browser/tab-close.ts +77 -0
- package/src/shared/lib/browser/viewer.ts +45 -26
- package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
- package/src/shared/lib/chat/tool/artifact.ts +55 -20
- package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
- package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
- package/src/shared/lib/chat/tool/minimized.ts +64 -0
- package/src/shared/lib/chat/tool/summary.test.ts +28 -8
- package/src/shared/lib/chat/tool/summary.ts +3 -32
- package/src/shared/lib/icons/file-brand-color.ts +38 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
- package/src/shared/lib/icons/icon-paint-css.ts +284 -0
- package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
- package/src/shared/lib/icons/tint.test.ts +273 -0
- package/src/shared/lib/icons/tint.ts +219 -0
- package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
- package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
- package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
- package/src/shared/lib/markdown/blocks/scan.ts +100 -0
- package/src/shared/lib/markdown/blocks/types.ts +62 -0
- package/src/shared/lib/markdown/marked.ts +58 -147
- package/src/shared/lib/markdown/math-extensions.ts +168 -0
- package/src/shared/lib/markdown/review/prompt.ts +77 -0
- package/src/shared/lib/markdown/review/reconcile.ts +55 -0
- package/src/shared/lib/markdown/review/review.test.ts +96 -0
- package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
- package/src/shared/lib/markdown/xml-sections.ts +139 -0
- package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
- package/src/shared/lib/models/provider/brand-color.ts +103 -0
- package/src/shared/lib/models/provider/label.ts +57 -0
- package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
- package/src/shared/lib/omp/config/agent-file.ts +43 -0
- package/src/shared/lib/omp/config/row-value.test.ts +95 -0
- package/src/shared/lib/omp/config/row-value.ts +97 -0
- package/src/shared/lib/omp/config/schema.test.ts +31 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +113 -47
- package/src/shared/lib/omp/rpc/frame.ts +107 -43
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/theme/catalog.test.ts +5 -4
- package/src/shared/lib/theme/catalog.ts +18 -3
- package/src/shared/lib/theme/glass-support.test.ts +38 -0
- package/src/shared/lib/theme/glass-support.ts +73 -0
- package/src/shared/lib/theme/icon-style.test.ts +74 -0
- package/src/shared/lib/theme/icon-style.ts +90 -0
- package/src/shared/lib/theme/legibility.ts +91 -0
- package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
- package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
- package/src/shared/lib/theme/surface-style.test.ts +68 -0
- package/src/shared/lib/theme/surface-style.ts +91 -0
- package/src/shared/lib/theme/theme.test.ts +11 -7
- package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -0
- package/src/shared/lib/usage/breakdown.test.ts +197 -0
- package/src/shared/lib/usage/breakdown.ts +241 -0
- package/src/shared/lib/usage/range.test.ts +204 -0
- package/src/shared/lib/usage/range.ts +240 -0
- package/src/shared/lib/usage/view.test.ts +85 -0
- package/src/shared/lib/usage/view.ts +74 -0
- package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
- package/src/shared/lib/workspace/panel-hues.ts +57 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/panels-registry.ts +6 -0
- package/src/shared/types/panels.ts +14 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/state.ts +30 -3
- package/src/shared/types/settings/write.ts +6 -0
- package/src/shared/types/tokenUsage.ts +128 -21
- package/src/shared/types/updates.ts +20 -0
- package/src/test-support/fake-omp-frames.ts +163 -0
- package/dist/client/static/js/index-3ve31rzx.css +0 -1
- package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
- package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
- package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
- package/src/server/lib/omp/session/usage/shaping.ts +0 -130
- /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* "What's new" for the running version: the changelog section is chosen by the
|
|
8
|
+
* version this machine reports, not by anything the caller says.
|
|
9
|
+
*
|
|
10
|
+
* Pinned here: the exact section wins over a newer one, `v` prefixes normalize,
|
|
11
|
+
* a version the changelog does not name is reported rather than replaced by the
|
|
12
|
+
* newest section, and an unreadable install is an error. The omp half uses the
|
|
13
|
+
* same stub-binary shape as `omp.test.ts`, so no real binary or network is
|
|
14
|
+
* needed; both changelog reads are stubbed per source URL.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
18
|
+
import { tmpdir } from 'node:os';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
|
|
21
|
+
import { executableStub } from '@/test-support/executable-stub';
|
|
22
|
+
import { invalidateOmpCliCache } from '@/server/lib/omp/core/cli';
|
|
23
|
+
import { buildActiveReleaseNotes, selectActiveNote } from '@/server/lib/updates/active-notes';
|
|
24
|
+
import { readInstalledVersion } from '@/server/lib/updates/install';
|
|
25
|
+
import { ompReleaseTagUrl, releaseTagUrl } from '@/server/lib/updates/release-url';
|
|
26
|
+
import type { ReleaseNote } from '@/shared/types/updates';
|
|
27
|
+
|
|
28
|
+
/** The runner's own fetch, reached through `Bun` so a stub leaked onto the global cannot be mistaken for it. */
|
|
29
|
+
const originalFetch = Bun.fetch;
|
|
30
|
+
const CACHE_SLOT = globalThis as { __kabmoChangelogCache?: unknown };
|
|
31
|
+
|
|
32
|
+
/** Same constant source as `omp.test.ts`: the compiled fixture is cached by source text. */
|
|
33
|
+
const OMP_STUB_SOURCE = `process.stdout.write(process.env.FAKE_OMP_VERSION_OUTPUT || '');`;
|
|
34
|
+
|
|
35
|
+
const note = (version: string): ReleaseNote => ({
|
|
36
|
+
version,
|
|
37
|
+
date: null,
|
|
38
|
+
url: releaseTagUrl(version),
|
|
39
|
+
body: `* notes for ${version}`,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** A changelog naming each version, newest first as the real file is. */
|
|
43
|
+
function changelog(versions: string[]): string {
|
|
44
|
+
return [
|
|
45
|
+
'# Changelog',
|
|
46
|
+
'',
|
|
47
|
+
...versions.flatMap((version) => [`## [${version}] — 2026-01-01`, '', note(version).body, '']),
|
|
48
|
+
].join('\n');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe('selectActiveNote', () => {
|
|
52
|
+
test('picks the section for the running version, not the newest one', () => {
|
|
53
|
+
const notes = [note('2.0.0'), note('1.5.0'), note('1.0.0')];
|
|
54
|
+
expect(selectActiveNote(notes, '1.5.0')?.version).toBe('1.5.0');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('a heading `v` prefix and a bare binary version agree', () => {
|
|
58
|
+
expect(selectActiveNote([{ ...note('1.2.3'), version: 'v1.2.3' }], '1.2.3')?.version).toBe('v1.2.3');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('an unnamed version is null, never the newest section', () => {
|
|
62
|
+
expect(selectActiveNote([note('2.0.0')], '1.0.0')).toBeNull();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('no readable version is null', () => {
|
|
66
|
+
expect(selectActiveNote([note('2.0.0')], null)).toBeNull();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('buildActiveReleaseNotes', () => {
|
|
71
|
+
const realOverride = Bun.env.KABMO_OMP_BIN;
|
|
72
|
+
const realOutput = Bun.env.FAKE_OMP_VERSION_OUTPUT;
|
|
73
|
+
|
|
74
|
+
/** Every changelog read answers the same page; the target decides the URL. */
|
|
75
|
+
function stubChangelog(markdown: string, status = 200): void {
|
|
76
|
+
globalThis.fetch = (async () =>
|
|
77
|
+
new Response(markdown, { status, headers: { 'content-type': 'text/markdown' } })) as unknown as typeof fetch;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function stubOmp(output: string): Promise<void> {
|
|
81
|
+
Bun.env.FAKE_OMP_VERSION_OUTPUT = output;
|
|
82
|
+
Bun.env.KABMO_OMP_BIN = await executableStub(OMP_STUB_SOURCE, 'fake-omp-version');
|
|
83
|
+
invalidateOmpCliCache();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
beforeEach(() => {
|
|
87
|
+
delete CACHE_SLOT.__kabmoChangelogCache;
|
|
88
|
+
Bun.env.KABMO_OMP_BIN = join(tmpdir(), 'kabmo-definitely-absent', 'omp');
|
|
89
|
+
invalidateOmpCliCache();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
afterEach(() => {
|
|
93
|
+
if (realOverride === undefined) delete Bun.env.KABMO_OMP_BIN;
|
|
94
|
+
else Bun.env.KABMO_OMP_BIN = realOverride;
|
|
95
|
+
if (realOutput === undefined) delete Bun.env.FAKE_OMP_VERSION_OUTPUT;
|
|
96
|
+
else Bun.env.FAKE_OMP_VERSION_OUTPUT = realOutput;
|
|
97
|
+
globalThis.fetch = originalFetch;
|
|
98
|
+
delete CACHE_SLOT.__kabmoChangelogCache;
|
|
99
|
+
invalidateOmpCliCache();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('kabmo: the section for the version on disk', async () => {
|
|
103
|
+
const installed = await readInstalledVersion();
|
|
104
|
+
expect(installed).not.toBeNull();
|
|
105
|
+
stubChangelog(changelog(['999.0.0', installed!]));
|
|
106
|
+
|
|
107
|
+
const result = await buildActiveReleaseNotes('kabmo');
|
|
108
|
+
|
|
109
|
+
expect(result).toMatchObject({ target: 'kabmo', version: installed, error: null });
|
|
110
|
+
expect(result.note?.body).toBe(`* notes for ${installed}`);
|
|
111
|
+
expect(result.note?.url).toBe(releaseTagUrl(installed!));
|
|
112
|
+
expect(result.changelogUrl).toBe('https://github.com/kabmo-labs/kabmo/blob/HEAD/CHANGELOG.md');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('kabmo: a version the changelog never named is reported, not faked', async () => {
|
|
116
|
+
stubChangelog(changelog(['999.0.0']));
|
|
117
|
+
|
|
118
|
+
const result = await buildActiveReleaseNotes('kabmo');
|
|
119
|
+
|
|
120
|
+
expect(result.note).toBeNull();
|
|
121
|
+
expect(result.error).toBe(`No changelog section for v${await readInstalledVersion()}`);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('kabmo: an unreachable changelog is an error field, not a throw', async () => {
|
|
125
|
+
stubChangelog('', 500);
|
|
126
|
+
|
|
127
|
+
const result = await buildActiveReleaseNotes('kabmo');
|
|
128
|
+
|
|
129
|
+
expect(result.note).toBeNull();
|
|
130
|
+
expect(result.error).toBe('Release notes could not be fetched');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('omp: the section for the version the binary reports', async () => {
|
|
134
|
+
await stubOmp('omp/18.3.0\n');
|
|
135
|
+
stubChangelog(changelog(['18.4.0', '18.3.0']));
|
|
136
|
+
|
|
137
|
+
const result = await buildActiveReleaseNotes('omp');
|
|
138
|
+
|
|
139
|
+
expect(result).toMatchObject({ target: 'omp', version: '18.3.0', error: null });
|
|
140
|
+
expect(result.note?.body).toBe('* notes for 18.3.0');
|
|
141
|
+
expect(result.note?.url).toBe(ompReleaseTagUrl('18.3.0'));
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('omp: no binary is an error, not notes for some other version', async () => {
|
|
145
|
+
const result = await buildActiveReleaseNotes('omp');
|
|
146
|
+
|
|
147
|
+
expect(result).toMatchObject({ target: 'omp', version: null, note: null, error: 'omp binary not found' });
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "What's new" for the version that is running, per target.
|
|
3
|
+
*
|
|
4
|
+
* The update popup answers "what would I get" from the range between the
|
|
5
|
+
* installed version and npm's newest one. The About modal's pair of buttons
|
|
6
|
+
* answers the other question — "what am I running" — so this module reads the
|
|
7
|
+
* installed version from the machine (package.json on disk for Kabmo,
|
|
8
|
+
* `omp --version` for oh-my-pi) and takes exactly that version's changelog
|
|
9
|
+
* section. Nothing here trusts a client-supplied version: a caller cannot ask
|
|
10
|
+
* for notes belonging to a release this install never had.
|
|
11
|
+
*
|
|
12
|
+
* Never throws. A missing section, an unreadable install and an unreachable
|
|
13
|
+
* changelog are all `error` fields, because the dialog opens from a button and a
|
|
14
|
+
* 500 would surface as an empty panel with no explanation.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { fetchChangelogNotes, fetchOmpChangelogNotes } from '@/server/lib/updates/changelog-file';
|
|
18
|
+
import { readInstalledVersion } from '@/server/lib/updates/install';
|
|
19
|
+
import { readOmpInstalledVersion } from '@/server/lib/updates/omp';
|
|
20
|
+
import { CHANGELOG_PAGE, OMP_CHANGELOG_PAGE } from '@/server/lib/updates/release-url';
|
|
21
|
+
import { normalizeVersion } from '@/shared/lib/updates/semver';
|
|
22
|
+
import type { ActiveReleaseNotes, ReleaseNote, UpdateTarget } from '@/shared/types/updates';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The section belonging to `version`, matched on normalized semver so a
|
|
26
|
+
* changelog heading's `v` prefix and the binary's bare version agree.
|
|
27
|
+
*/
|
|
28
|
+
export function selectActiveNote(notes: ReleaseNote[], version: string | null): ReleaseNote | null {
|
|
29
|
+
const wanted = version ? normalizeVersion(version) : null;
|
|
30
|
+
if (!wanted) return null;
|
|
31
|
+
return notes.find((note) => normalizeVersion(note.version) === wanted) ?? null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The notes for one target's running version. */
|
|
35
|
+
export async function buildActiveReleaseNotes(target: UpdateTarget): Promise<ActiveReleaseNotes> {
|
|
36
|
+
const changelogUrl = target === 'omp' ? OMP_CHANGELOG_PAGE : CHANGELOG_PAGE;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const probe = target === 'omp' ? await readOmpInstalledVersion() : null;
|
|
40
|
+
const version = probe ? probe.current : await readInstalledVersion();
|
|
41
|
+
if (!version) {
|
|
42
|
+
return {
|
|
43
|
+
target,
|
|
44
|
+
version: null,
|
|
45
|
+
note: null,
|
|
46
|
+
changelogUrl,
|
|
47
|
+
error: probe
|
|
48
|
+
? probe.error ?? 'Could not determine the installed omp version'
|
|
49
|
+
: 'The installed Kabmo version could not be read',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const notes = target === 'omp' ? await fetchOmpChangelogNotes() : await fetchChangelogNotes();
|
|
54
|
+
if (notes.length === 0) {
|
|
55
|
+
return { target, version, note: null, changelogUrl, error: 'Release notes could not be fetched' };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const note = selectActiveNote(notes, version);
|
|
59
|
+
return {
|
|
60
|
+
target,
|
|
61
|
+
version,
|
|
62
|
+
note,
|
|
63
|
+
changelogUrl,
|
|
64
|
+
error: note ? null : `No changelog section for v${version}`,
|
|
65
|
+
};
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return {
|
|
68
|
+
target,
|
|
69
|
+
version: null,
|
|
70
|
+
note: null,
|
|
71
|
+
changelogUrl,
|
|
72
|
+
error: error instanceof Error ? error.message : 'Release notes could not be read',
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* the heading itself and links each section to that version's release page.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { releaseTagUrl, REPO } from '@/server/lib/updates/release-url';
|
|
18
|
+
import { OMP_REPO, releaseTagUrl, REPO, ompReleaseTagUrl } from '@/server/lib/updates/release-url';
|
|
19
19
|
import type { ReleaseNote } from '@/shared/types/updates';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -28,6 +28,12 @@ import type { ReleaseNote } from '@/shared/types/updates';
|
|
|
28
28
|
*/
|
|
29
29
|
export const CHANGELOG_URL = `https://raw.githubusercontent.com/${REPO}/HEAD/CHANGELOG.md`;
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* oh-my-pi's changelog: the coding-agent package inside its monorepo. Same
|
|
33
|
+
* contract as Kabmo's — one `## [x.y.z]` section per release tag.
|
|
34
|
+
*/
|
|
35
|
+
export const OMP_CHANGELOG_URL = `https://raw.githubusercontent.com/${OMP_REPO}/HEAD/packages/coding-agent/CHANGELOG.md`;
|
|
36
|
+
|
|
31
37
|
/** How long a read is reused. The file changes on release, not on read. */
|
|
32
38
|
const TTL_MS = 60_000;
|
|
33
39
|
|
|
@@ -57,7 +63,10 @@ const REFERENCE_DEFINITION = /^\[[^\]]+\]:\s/;
|
|
|
57
63
|
* definitions, not notes, and without the guard they rendered as the last
|
|
58
64
|
* section's body.
|
|
59
65
|
*/
|
|
60
|
-
export function parseChangelogSections(
|
|
66
|
+
export function parseChangelogSections(
|
|
67
|
+
markdown: string,
|
|
68
|
+
releaseUrl: (version: string) => string = releaseTagUrl,
|
|
69
|
+
): ReleaseNote[] {
|
|
61
70
|
const notes: ReleaseNote[] = [];
|
|
62
71
|
let version: string | null = null;
|
|
63
72
|
let date: string | null = null;
|
|
@@ -65,7 +74,7 @@ export function parseChangelogSections(markdown: string): ReleaseNote[] {
|
|
|
65
74
|
|
|
66
75
|
const flush = () => {
|
|
67
76
|
if (version === null) return;
|
|
68
|
-
notes.push({ version, date, url:
|
|
77
|
+
notes.push({ version, date, url: releaseUrl(version), body: body.join('\n').trim() });
|
|
69
78
|
};
|
|
70
79
|
|
|
71
80
|
for (const raw of markdown.split('\n')) {
|
|
@@ -97,26 +106,48 @@ interface ChangelogCache {
|
|
|
97
106
|
at: number;
|
|
98
107
|
}
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Keyed by source URL: Kabmo and omp are two files, and a shared single slot
|
|
111
|
+
* made one target's read answer the other's — measured as omp notes rendering
|
|
112
|
+
* under the Kabmo heading. A `Map` also keeps the boot cost at one read per
|
|
113
|
+
* file rather than one per target.
|
|
114
|
+
*/
|
|
115
|
+
type ChangelogCacheSlot = { __kabmoChangelogCache?: Map<string, ChangelogCache> };
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
117
|
+
const cacheSlot = globalThis as typeof globalThis & ChangelogCacheSlot;
|
|
118
|
+
|
|
119
|
+
async function fetchNotes(
|
|
120
|
+
url: string,
|
|
121
|
+
releaseUrl: (version: string) => string,
|
|
122
|
+
force: boolean,
|
|
123
|
+
): Promise<ReleaseNote[]> {
|
|
124
|
+
const cache = (cacheSlot.__kabmoChangelogCache ??= new Map<string, ChangelogCache>());
|
|
125
|
+
const cached = cache.get(url);
|
|
105
126
|
if (!force && cached && Date.now() - cached.at < TTL_MS) return cached.notes;
|
|
106
127
|
|
|
107
128
|
let notes: ReleaseNote[] = [];
|
|
108
129
|
try {
|
|
109
|
-
const response = await fetch(
|
|
130
|
+
const response = await fetch(url, {
|
|
110
131
|
headers: { 'User-Agent': 'kabmo' },
|
|
111
132
|
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
112
133
|
});
|
|
113
|
-
if (response.ok) notes = parseChangelogSections(await response.text());
|
|
134
|
+
if (response.ok) notes = parseChangelogSections(await response.text(), releaseUrl);
|
|
114
135
|
} catch {
|
|
115
|
-
// Reported as an empty list; the
|
|
136
|
+
// Reported as an empty list; the caller words the failure.
|
|
116
137
|
}
|
|
117
138
|
|
|
118
139
|
// An empty read is not cached: a transient failure would otherwise pin "no
|
|
119
140
|
// release notes" for a minute and hide a real update.
|
|
120
|
-
if (notes.length > 0)
|
|
141
|
+
if (notes.length > 0) cache.set(url, { notes, at: Date.now() });
|
|
121
142
|
return notes;
|
|
122
143
|
}
|
|
144
|
+
|
|
145
|
+
/** Never throws: an unreadable changelog is an empty list, and the caller words it. */
|
|
146
|
+
export function fetchChangelogNotes(force = false): Promise<ReleaseNote[]> {
|
|
147
|
+
return fetchNotes(CHANGELOG_URL, releaseTagUrl, force);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** oh-my-pi's sections, linked to omp's own release tags. Never throws. */
|
|
151
|
+
export function fetchOmpChangelogNotes(force = false): Promise<ReleaseNote[]> {
|
|
152
|
+
return fetchNotes(OMP_CHANGELOG_URL, ompReleaseTagUrl, force);
|
|
153
|
+
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
26
26
|
|
|
27
27
|
import { MAX_NOTES_BYTES, MAX_VERSIONS, capReleaseNotes, selectReleaseRange } from '@/server/lib/updates/changelog';
|
|
28
|
-
import { CHANGELOG_URL, fetchChangelogNotes, parseChangelogSections } from '@/server/lib/updates/changelog-file';
|
|
28
|
+
import { CHANGELOG_URL, OMP_CHANGELOG_URL, fetchChangelogNotes, fetchOmpChangelogNotes, parseChangelogSections } from '@/server/lib/updates/changelog-file';
|
|
29
29
|
import { releaseTagUrl } from '@/server/lib/updates/release-url';
|
|
30
30
|
import type { ReleaseNote } from '@/shared/types/updates';
|
|
31
31
|
|
|
@@ -110,6 +110,8 @@ describe('fetchChangelogNotes', () => {
|
|
|
110
110
|
beforeEach(() => {
|
|
111
111
|
delete (globalThis as typeof globalThis & { __kabmoChangelogCache?: unknown }).__kabmoChangelogCache;
|
|
112
112
|
urls = [];
|
|
113
|
+
body = CHANGELOG;
|
|
114
|
+
status = 200;
|
|
113
115
|
globalThis.fetch = (async (input: RequestInfo | URL) => {
|
|
114
116
|
urls.push(String(input));
|
|
115
117
|
return new Response(body, { status, headers: { 'content-type': 'text/markdown' } });
|
|
@@ -145,6 +147,18 @@ describe('fetchChangelogNotes', () => {
|
|
|
145
147
|
expect(await fetchChangelogNotes()).toEqual([]);
|
|
146
148
|
expect(urls).toHaveLength(2);
|
|
147
149
|
});
|
|
150
|
+
|
|
151
|
+
test('the omp source is its own URL and links omp release tags', async () => {
|
|
152
|
+
const notes = await fetchOmpChangelogNotes();
|
|
153
|
+
expect(urls[0]).toBe(OMP_CHANGELOG_URL);
|
|
154
|
+
expect(notes[0]!.url).toBe('https://github.com/can1357/oh-my-pi/releases/tag/v3.14.0');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('a warm Kabmo cache does not answer the omp read', async () => {
|
|
158
|
+
await fetchChangelogNotes();
|
|
159
|
+
await fetchOmpChangelogNotes();
|
|
160
|
+
expect(urls).toEqual([CHANGELOG_URL, OMP_CHANGELOG_URL]);
|
|
161
|
+
});
|
|
148
162
|
});
|
|
149
163
|
|
|
150
164
|
describe('selectReleaseRange', () => {
|
|
@@ -48,35 +48,62 @@ function parseOmpVersion(output: string): string | null {
|
|
|
48
48
|
return output.match(/^omp\/(\S+)/m)?.[1] ?? null;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export
|
|
51
|
+
export interface OmpInstalledVersion {
|
|
52
|
+
/** Whether an `omp` binary was found at all. */
|
|
53
|
+
installed: boolean;
|
|
54
|
+
/** The version the binary names itself, or null when it could not be read. */
|
|
55
|
+
current: string | null;
|
|
56
|
+
error: string | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The version `omp --version` reports, split out of the update check because
|
|
61
|
+
* the About modal's "What's new in Oh-My-Pi" needs only this half: the notes
|
|
62
|
+
* belong to the running binary, and reading npm again would answer a different
|
|
63
|
+
* question (what is published, not what is installed).
|
|
64
|
+
*/
|
|
65
|
+
export async function readOmpInstalledVersion(): Promise<OmpInstalledVersion> {
|
|
52
66
|
const bin = resolveOmpBin();
|
|
53
|
-
if (!bin) {
|
|
67
|
+
if (!bin) return { installed: false, current: null, error: 'omp binary not found' };
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const { stdout, stderr, exitCode } = await runCapture(bin, ['--version'], 30000, 1024 * 1024);
|
|
71
|
+
const current = parseOmpVersion(combined(stdout, stderr));
|
|
72
|
+
if (current) return { installed: true, current, error: null };
|
|
73
|
+
const error =
|
|
74
|
+
exitCode !== 0
|
|
75
|
+
? `omp --version exited with code ${exitCode}`
|
|
76
|
+
: 'Could not determine the installed omp version';
|
|
77
|
+
return { installed: true, current: null, error };
|
|
78
|
+
} catch (err) {
|
|
79
|
+
return {
|
|
80
|
+
installed: true,
|
|
81
|
+
current: null,
|
|
82
|
+
error: err instanceof Error ? err.message : String(err),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function checkOmpUpdate(): Promise<UpdateTargetInfo> {
|
|
88
|
+
const probe = await readOmpInstalledVersion();
|
|
89
|
+
if (!probe.installed) {
|
|
54
90
|
return {
|
|
55
91
|
current: null,
|
|
56
92
|
latest: null,
|
|
57
93
|
updateAvailable: false,
|
|
58
94
|
installed: false,
|
|
59
|
-
error:
|
|
95
|
+
error: probe.error,
|
|
60
96
|
};
|
|
61
97
|
}
|
|
62
98
|
|
|
63
|
-
|
|
64
|
-
let execMessage: string | null = null;
|
|
65
|
-
try {
|
|
66
|
-
const { stdout, stderr, exitCode } = await runCapture(bin, ['--version'], 30000, 1024 * 1024);
|
|
67
|
-
current = parseOmpVersion(combined(stdout, stderr));
|
|
68
|
-
if (exitCode !== 0) execMessage = `omp --version exited with code ${exitCode}`;
|
|
69
|
-
} catch (err) {
|
|
70
|
-
execMessage = err instanceof Error ? err.message : String(err);
|
|
71
|
-
}
|
|
72
|
-
|
|
99
|
+
const current = probe.current;
|
|
73
100
|
const latest = await fetchNpmLatest(OMP_PACKAGE);
|
|
74
101
|
// With no version on disk there is nothing to compare, and "an update exists"
|
|
75
102
|
// would be a claim about a copy that could not be read.
|
|
76
103
|
const updateAvailable = Boolean(current && latest && isNewer(latest, current));
|
|
77
104
|
|
|
78
|
-
let error: string | null =
|
|
79
|
-
if (!current) error =
|
|
105
|
+
let error: string | null = probe.error;
|
|
106
|
+
if (!current) error = probe.error ?? 'Could not determine the installed omp version';
|
|
80
107
|
else if (!latest) error = 'Could not read the latest oh-my-pi version from npm';
|
|
81
108
|
|
|
82
109
|
return { current, latest, updateAvailable, installed: true, error };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where Kabmo's
|
|
2
|
+
* Where the release notes live: Kabmo's repository, and oh-my-pi's.
|
|
3
3
|
*
|
|
4
4
|
* Two questions, two sources, deliberately. The VERSION an install can move to
|
|
5
5
|
* comes from npm (see ./npm) — that is the channel `bun add -g kabmo@…`
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* hashes and contributor credits, and the release page is where a reader can
|
|
9
9
|
* follow them. So the popup's links point at GitHub while the version it
|
|
10
10
|
* announces comes from the registry.
|
|
11
|
+
*
|
|
12
|
+
* omp follows the same shape from its own monorepo; the coding-agent package
|
|
13
|
+
* owns the changelog, and its release tags are `v<version>`.
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -23,3 +26,26 @@ export const RELEASES_URL = `https://github.com/${REPO}/releases`;
|
|
|
23
26
|
export function releaseTagUrl(version: string): string {
|
|
24
27
|
return `${RELEASES_URL}/tag/v${version}`;
|
|
25
28
|
}
|
|
29
|
+
|
|
30
|
+
/** The Kabmo changelog file, as a reader follows it on GitHub. */
|
|
31
|
+
export const CHANGELOG_PAGE = `https://github.com/${REPO}/blob/HEAD/CHANGELOG.md`;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* oh-my-pi's repository. `omp` publishes from a monorepo, and its release
|
|
35
|
+
* notes live in the coding-agent package's own changelog — the same prose the
|
|
36
|
+
* GitHub release bodies carry.
|
|
37
|
+
*/
|
|
38
|
+
export const OMP_REPO = 'can1357/oh-my-pi';
|
|
39
|
+
|
|
40
|
+
/** The package directory inside that monorepo. */
|
|
41
|
+
const OMP_PACKAGE_DIR = 'packages/coding-agent';
|
|
42
|
+
|
|
43
|
+
export const OMP_RELEASES_URL = `https://github.com/${OMP_REPO}/releases`;
|
|
44
|
+
|
|
45
|
+
/** One omp release tag's page. */
|
|
46
|
+
export function ompReleaseTagUrl(version: string): string {
|
|
47
|
+
return `${OMP_RELEASES_URL}/tag/v${version}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The omp changelog file, as a reader follows it on GitHub. */
|
|
51
|
+
export const OMP_CHANGELOG_PAGE = `https://github.com/${OMP_REPO}/blob/HEAD/${OMP_PACKAGE_DIR}/CHANGELOG.md`;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Folding one transcript line into rollup counters — the pure half of the
|
|
8
|
+
* Token Usage index.
|
|
9
|
+
*
|
|
10
|
+
* Every case pins a number a user reads, so the assertions are exact:
|
|
11
|
+
*
|
|
12
|
+
* - a provider is part of a row's identity (two accounts serving one model id
|
|
13
|
+
* are two rows, not one merged cost);
|
|
14
|
+
* - the day is the reader's LOCAL calendar day, so "Today" and the chart agree;
|
|
15
|
+
* - a turn with tokens and no reported cost is unpriced, never free;
|
|
16
|
+
* - a torn final line must be dropped, or the next append would parse its
|
|
17
|
+
* remainder as a fresh entry.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { describe, expect, test } from 'bun:test';
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
completeLineOffset,
|
|
24
|
+
foldUsage,
|
|
25
|
+
foldUsageText,
|
|
26
|
+
parseUsageLine,
|
|
27
|
+
type ParsedUsageEntry,
|
|
28
|
+
type UsageRollupRow,
|
|
29
|
+
} from '@/server/lib/usage/index-parse';
|
|
30
|
+
import { localDayKey } from '@/shared/lib/usage/range';
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
function messageLine(options: {
|
|
34
|
+
timestamp?: string;
|
|
35
|
+
provider?: string;
|
|
36
|
+
model?: string;
|
|
37
|
+
usage?: Record<string, unknown>;
|
|
38
|
+
}): string {
|
|
39
|
+
return JSON.stringify({
|
|
40
|
+
type: 'message',
|
|
41
|
+
timestamp: options.timestamp,
|
|
42
|
+
message: {
|
|
43
|
+
role: 'assistant',
|
|
44
|
+
provider: options.provider,
|
|
45
|
+
model: options.model,
|
|
46
|
+
usage: options.usage ?? {},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function costed(options: {
|
|
52
|
+
timestamp: string;
|
|
53
|
+
provider: string;
|
|
54
|
+
model: string;
|
|
55
|
+
input: number;
|
|
56
|
+
output: number;
|
|
57
|
+
cacheRead: number;
|
|
58
|
+
cost: number;
|
|
59
|
+
}): string {
|
|
60
|
+
return messageLine({
|
|
61
|
+
timestamp: options.timestamp,
|
|
62
|
+
provider: options.provider,
|
|
63
|
+
model: options.model,
|
|
64
|
+
usage: {
|
|
65
|
+
input: options.input,
|
|
66
|
+
output: options.output,
|
|
67
|
+
cacheRead: options.cacheRead,
|
|
68
|
+
cacheWrite: 0,
|
|
69
|
+
totalTokens: options.input + options.output + options.cacheRead,
|
|
70
|
+
cost: { total: options.cost, input: options.cost / 2, output: options.cost / 4, cacheRead: options.cost / 4, cacheWrite: 0 },
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
describe('parseUsageLine', () => {
|
|
76
|
+
test('attributes the provider and model that served the turn', () => {
|
|
77
|
+
const parsed = parseUsageLine(costed({
|
|
78
|
+
timestamp: '2026-10-05T10:00:00.000Z',
|
|
79
|
+
provider: 'kenari-jatis',
|
|
80
|
+
model: 'deepseek-v4-1-flash',
|
|
81
|
+
input: 10,
|
|
82
|
+
output: 5,
|
|
83
|
+
cacheRead: 100,
|
|
84
|
+
cost: 1.5,
|
|
85
|
+
}));
|
|
86
|
+
expect(parsed).not.toBeNull();
|
|
87
|
+
expect(parsed?.provider).toBe('kenari-jatis');
|
|
88
|
+
expect(parsed?.model).toBe('deepseek-v4-1-flash');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('folds a slug alias onto one provider identity', () => {
|
|
92
|
+
// omp writes both spellings; the breakdown must not grow a second
|
|
93
|
+
// `command-code` row beside `commandcode`.
|
|
94
|
+
const parsed = parseUsageLine(costed({
|
|
95
|
+
timestamp: '2026-10-05T10:00:00.000Z',
|
|
96
|
+
provider: 'command-code',
|
|
97
|
+
model: 'glm-5.3-flash',
|
|
98
|
+
input: 1,
|
|
99
|
+
output: 1,
|
|
100
|
+
cacheRead: 0,
|
|
101
|
+
cost: 0,
|
|
102
|
+
}));
|
|
103
|
+
expect(parsed?.provider).toBe('commandcode');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('missing provider and model become `unknown`, not empty strings', () => {
|
|
107
|
+
const parsed = parseUsageLine(messageLine({ timestamp: '2026-10-05T10:00:00.000Z' }));
|
|
108
|
+
expect(parsed?.provider).toBe('unknown');
|
|
109
|
+
expect(parsed?.model).toBe('unknown');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('the day is the local calendar day of the timestamp', () => {
|
|
113
|
+
const at = new Date(2026, 9, 5, 0, 30, 0).getTime();
|
|
114
|
+
const parsed = parseUsageLine(costed({
|
|
115
|
+
timestamp: new Date(at).toISOString(),
|
|
116
|
+
provider: 'kenari',
|
|
117
|
+
model: 'm',
|
|
118
|
+
input: 1,
|
|
119
|
+
output: 0,
|
|
120
|
+
cacheRead: 0,
|
|
121
|
+
cost: 0,
|
|
122
|
+
}));
|
|
123
|
+
// UTC is still Oct 4 for a 00:30 WIB record; the panel's "Today" is local.
|
|
124
|
+
expect(parsed?.day).toBe(localDayKey(at));
|
|
125
|
+
expect(parsed?.day).toBe('2026-10-05');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('a line with no timestamp keeps an empty day so windows can include it', () => {
|
|
129
|
+
const parsed = parseUsageLine(messageLine({ provider: 'kenari', model: 'm' }));
|
|
130
|
+
expect(parsed?.day).toBe('');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('non-message entries and torn lines are rejected', () => {
|
|
134
|
+
expect(parseUsageLine(JSON.stringify({ type: 'custom', message: { usage: { input: 1 } } }))).toBeNull();
|
|
135
|
+
expect(parseUsageLine(messageLine({}).slice(0, 20))).toBeNull();
|
|
136
|
+
expect(parseUsageLine('')).toBeNull();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe('foldUsage', () => {
|
|
141
|
+
const rows = new Map<string, UsageRollupRow>();
|
|
142
|
+
const entry = (provider: string, model: string, cost: number, totalTokens = 10): ParsedUsageEntry => ({
|
|
143
|
+
day: '2026-10-05',
|
|
144
|
+
provider,
|
|
145
|
+
model,
|
|
146
|
+
usage: { input: 4, output: 2, cacheRead: 4, cacheWrite: 0, totalTokens, cost: { total: cost } },
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('keys on provider AND model, so two accounts stay separate', () => {
|
|
150
|
+
foldUsage(rows, 'p', entry('kenari-jatis', 'deepseek-v4-1-flash', 10));
|
|
151
|
+
foldUsage(rows, 'p', entry('kenari', 'deepseek-v4-1-flash', 2));
|
|
152
|
+
expect(rows.size).toBe(2);
|
|
153
|
+
expect([...rows.values()].map((row) => row.provider).sort()).toEqual(['kenari', 'kenari-jatis']);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('one key accumulates its counters rather than replacing them', () => {
|
|
157
|
+
const single = new Map<string, UsageRollupRow>();
|
|
158
|
+
foldUsage(single, 'p', entry('kenari', 'm', 1.5));
|
|
159
|
+
foldUsage(single, 'p', entry('kenari', 'm', 2.5));
|
|
160
|
+
const row = [...single.values()][0];
|
|
161
|
+
expect(row.records).toBe(2);
|
|
162
|
+
expect(row.costTotal).toBeCloseTo(4, 10);
|
|
163
|
+
expect(row.total).toBe(20);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('an explicit totalTokens wins over the re-derived sum', () => {
|
|
167
|
+
const single = new Map<string, UsageRollupRow>();
|
|
168
|
+
foldUsage(single, 'p', entry('kenari', 'm', 1, 999));
|
|
169
|
+
expect([...single.values()][0].total).toBe(999);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('a turn with tokens and no reported cost counts as unpriced', () => {
|
|
173
|
+
const single = new Map<string, UsageRollupRow>();
|
|
174
|
+
foldUsage(single, 'p', entry('kenari', 'm', 0));
|
|
175
|
+
expect([...single.values()][0].unpriced).toBe(1);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe('foldUsageText', () => {
|
|
180
|
+
test('a partial last line is dropped when only complete lines are wanted', () => {
|
|
181
|
+
const complete = costed({ timestamp: '2026-10-05T10:00:00.000Z', provider: 'kenari', model: 'm', input: 1, output: 1, cacheRead: 0, cost: 1 });
|
|
182
|
+
const text = `${complete}\n{"type":"message","message":{"usage":{"inp`;
|
|
183
|
+
const rows = new Map<string, UsageRollupRow>();
|
|
184
|
+
foldUsageText(rows, 'p', text, true);
|
|
185
|
+
expect([...rows.values()][0].records).toBe(1);
|
|
186
|
+
|
|
187
|
+
// The same text read as a whole file keeps the trailing fragment's parse
|
|
188
|
+
// failure silent rather than throwing.
|
|
189
|
+
const whole = new Map<string, UsageRollupRow>();
|
|
190
|
+
foldUsageText(whole, 'p', text, false);
|
|
191
|
+
expect([...whole.values()][0].records).toBe(1);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test('completeLineOffset stops at the last newline, never mid-line', () => {
|
|
195
|
+
expect(completeLineOffset('{"a":1}\n{"b":2}\n')).toBe(16);
|
|
196
|
+
expect(completeLineOffset('{"a":1}\n{"b":')).toBe(8);
|
|
197
|
+
expect(completeLineOffset('no newline')).toBe(0);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|