@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,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Agent file naming, enforced on both sides of the wire.
|
|
8
|
+
*
|
|
9
|
+
* The route refuses an unsafe base name and the pane refuses the same name
|
|
10
|
+
* before it sends one. Pinned here so the two cannot drift: a name the pane
|
|
11
|
+
* accepted and the route rejected would surface as a 400 under a form that
|
|
12
|
+
* looked valid.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import { agentFileBaseName, agentFileNameError } from '@/shared/lib/omp/config/agent-file';
|
|
17
|
+
|
|
18
|
+
describe('agentFileNameError', () => {
|
|
19
|
+
test('accepts a normal agent name', () => {
|
|
20
|
+
expect(agentFileNameError('reviewer')).toBeNull();
|
|
21
|
+
expect(agentFileNameError('code-reviewer.v2')).toBeNull();
|
|
22
|
+
expect(agentFileNameError(' helper_1 ')).toBeNull();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('refuses an empty name with a sentence that says what it becomes', () => {
|
|
26
|
+
expect(agentFileNameError(' ')).toContain('becomes the definition');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('refuses a path or a space instead of letting the route answer 400', () => {
|
|
30
|
+
expect(agentFileNameError('a/b')).toContain('letters, numbers');
|
|
31
|
+
expect(agentFileNameError('../escape')).toContain('letters, numbers');
|
|
32
|
+
expect(agentFileNameError('bad name')).toContain('letters, numbers');
|
|
33
|
+
expect(agentFileNameError('-leading')).toContain('letters, numbers');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('agentFileBaseName', () => {
|
|
38
|
+
test('strips the directory and the extension', () => {
|
|
39
|
+
expect(agentFileBaseName('/home/u/.omp/agent/agents/reviewer.md')).toBe('reviewer');
|
|
40
|
+
expect(agentFileBaseName('C:/agents/helper.MD')).toBe('helper');
|
|
41
|
+
expect(agentFileBaseName('plain')).toBe('plain');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('strips a BACKSLASH path, which is what a Windows host reports', () => {
|
|
45
|
+
// The pane sends this value straight back as `fileName` on the next rename
|
|
46
|
+
// or delete, so returning the whole path made every write land at a path
|
|
47
|
+
// named after itself and no delete find its file — measured on the Windows
|
|
48
|
+
// gate, where the list answered
|
|
49
|
+
// `fileName: "C:\Users\RUNNER~1\AppData\Local\Temp\…\agents\reviewer"`
|
|
50
|
+
// and three cases failed.
|
|
51
|
+
expect(agentFileBaseName('C:\\Users\\u\\.omp\\agent\\agents\\reviewer.md')).toBe('reviewer');
|
|
52
|
+
expect(agentFileBaseName('D:\\agents\\helper.MD')).toBe('helper');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The file-name rules for a native omp agent definition.
|
|
8
|
+
*
|
|
9
|
+
* One module because two sides enforce the same rule: the route refuses a file
|
|
10
|
+
* name that is not a safe base name (path traversal, spaces, dots-only), and
|
|
11
|
+
* the pane refuses the same name before it sends it — a save that travels and
|
|
12
|
+
* returns a 500 for a name the form could have rejected reads as a server bug
|
|
13
|
+
* rather than as a typo.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** A file base name (no extension) an agent can be written to. */
|
|
17
|
+
export const AGENT_FILE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
18
|
+
|
|
19
|
+
/** Why a name cannot be used as an agent file, or null when it can. */
|
|
20
|
+
export function agentFileNameError(name: string): string | null {
|
|
21
|
+
const trimmed = name.trim();
|
|
22
|
+
if (!trimmed) return 'An agent needs a name — it becomes the definition’s file name.';
|
|
23
|
+
if (!AGENT_FILE_NAME_PATTERN.test(trimmed)) {
|
|
24
|
+
return 'Use letters, numbers, dots, dashes or underscores, starting with a letter or number.';
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The base name (no `.md`) of an agent definition file path. */
|
|
30
|
+
export function agentFileBaseName(filePath: string): string {
|
|
31
|
+
// BOTH separators, because `filePath` is whatever the host produced: a
|
|
32
|
+
// Windows runner reports `C:\Users\…\agents\reviewer.md`, and splitting on
|
|
33
|
+
// `/` alone returned that entire path as the "file name". The pane then sent
|
|
34
|
+
// it back as `fileName`, the route wrote a file named after the full path,
|
|
35
|
+
// and every later rename/delete missed the file it meant — measured on the
|
|
36
|
+
// Windows gate, where `fileName` came back as
|
|
37
|
+
// `C:\Users\RUNNER~1\AppData\Local\Temp\…\agents\reviewer` and three cases
|
|
38
|
+
// failed. `node:path` is not usable here: this module is shared with the
|
|
39
|
+
// browser, where it has no implementation.
|
|
40
|
+
const cut = Math.max(filePath.lastIndexOf('/'), filePath.lastIndexOf('\\'));
|
|
41
|
+
const file = filePath.slice(cut + 1);
|
|
42
|
+
return file.replace(/\.md$/i, '');
|
|
43
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The OMP config row's text → value conversion.
|
|
8
|
+
*
|
|
9
|
+
* Pinned because a bad draft used to revert SILENTLY: a trailing comma in a
|
|
10
|
+
* JSON array or a half-typed number simply did not save, with nothing on screen
|
|
11
|
+
* to say why. Each case here is a draft a user can produce with one keystroke
|
|
12
|
+
* too many.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
import {
|
|
17
|
+
parseDraft,
|
|
18
|
+
parseFiniteNumber,
|
|
19
|
+
parseJsonArray,
|
|
20
|
+
parseJsonRecord,
|
|
21
|
+
valueToText,
|
|
22
|
+
valuesEqual,
|
|
23
|
+
} from '@/shared/lib/omp/config/row-value';
|
|
24
|
+
|
|
25
|
+
describe('valueToText', () => {
|
|
26
|
+
test('scalars print themselves and containers print JSON', () => {
|
|
27
|
+
expect(valueToText('titanium')).toBe('titanium');
|
|
28
|
+
expect(valueToText(42)).toBe('42');
|
|
29
|
+
expect(valueToText(false)).toBe('false');
|
|
30
|
+
expect(valueToText(['anthropic', 'openai'])).toBe('["anthropic","openai"]');
|
|
31
|
+
expect(valueToText({ bash: 'prompt' })).toBe('{"bash":"prompt"}');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('an unset value is an empty field, not the text "undefined"', () => {
|
|
35
|
+
expect(valueToText(undefined)).toBe('');
|
|
36
|
+
expect(valueToText(null)).toBe('');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('parseFiniteNumber', () => {
|
|
41
|
+
test('a partial entry is not a number', () => {
|
|
42
|
+
expect(parseFiniteNumber('')).toBeNull();
|
|
43
|
+
expect(parseFiniteNumber('-')).toBeNull();
|
|
44
|
+
expect(parseFiniteNumber('+')).toBeNull();
|
|
45
|
+
expect(parseFiniteNumber('.')).toBeNull();
|
|
46
|
+
expect(parseFiniteNumber('abc')).toBeNull();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('a finite number survives surrounding whitespace', () => {
|
|
50
|
+
expect(parseFiniteNumber(' 1200 ')).toBe(1200);
|
|
51
|
+
expect(parseFiniteNumber('-0.5')).toBe(-0.5);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('parseDraft', () => {
|
|
56
|
+
test('a number row names what it wants instead of reverting', () => {
|
|
57
|
+
expect(parseDraft('number', '12')).toEqual({ ok: true, value: 12 });
|
|
58
|
+
expect(parseDraft('number', '')).toMatchObject({ ok: false });
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('a string row keeps an empty value — clearing a credential is a write', () => {
|
|
62
|
+
expect(parseDraft('string', ' ')).toEqual({ ok: true, value: '' });
|
|
63
|
+
expect(parseDraft('string', ' sk-live ')).toEqual({ ok: true, value: 'sk-live' });
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('an array row accepts a JSON array and rejects anything else', () => {
|
|
67
|
+
expect(parseDraft('array', '["a"]')).toEqual({ ok: true, value: ['a'] });
|
|
68
|
+
expect(parseDraft('array', '')).toEqual({ ok: true, value: [] });
|
|
69
|
+
expect(parseDraft('array', '["a",]')).toMatchObject({ ok: false });
|
|
70
|
+
expect(parseDraft('array', '{"a":1}')).toMatchObject({ ok: false });
|
|
71
|
+
expect(parseDraft('array', 'nope')).toMatchObject({ ok: false });
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('a record row accepts a JSON object and rejects an array', () => {
|
|
75
|
+
expect(parseDraft('record', '{"bash":"prompt"}')).toEqual({ ok: true, value: { bash: 'prompt' } });
|
|
76
|
+
expect(parseDraft('record', '')).toEqual({ ok: true, value: {} });
|
|
77
|
+
expect(parseDraft('record', '[]')).toMatchObject({ ok: false });
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('json helpers', () => {
|
|
82
|
+
test('a non-array and a non-object parse to null', () => {
|
|
83
|
+
expect(parseJsonArray('7')).toBeNull();
|
|
84
|
+
expect(parseJsonRecord('"x"')).toBeNull();
|
|
85
|
+
expect(parseJsonArray('[1,2]')).toEqual([1, 2]);
|
|
86
|
+
expect(parseJsonRecord('{"a":1}')).toEqual({ a: 1 });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('valuesEqual compares depth-first, ignoring key-independent order', () => {
|
|
90
|
+
expect(valuesEqual(['a'], ['a'])).toBe(true);
|
|
91
|
+
expect(valuesEqual(['a', 'b'], ['b', 'a'])).toBe(false);
|
|
92
|
+
expect(valuesEqual({ a: 1 }, { a: 1 })).toBe(true);
|
|
93
|
+
expect(valuesEqual(1, '1')).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Text ↔ value conversion for one omp config row.
|
|
8
|
+
*
|
|
9
|
+
* `omp config set` accepts a string, number, boolean, array or record, and the
|
|
10
|
+
* schema decides which one a row holds. The panel edits everything as text, so
|
|
11
|
+
* this module is where a keystroke becomes a typed value — and where invalid
|
|
12
|
+
* text is REJECTED instead of being silently dropped. The old editor reverted
|
|
13
|
+
* on a parse failure with no message, so a trailing comma in a JSON array
|
|
14
|
+
* looked like the field had simply refused to save.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { SchemaEntry } from '@/shared/lib/omp/config/schema-types';
|
|
18
|
+
|
|
19
|
+
/** A row's draft parsed back into the value to write, or a reason it cannot be. */
|
|
20
|
+
export type ParsedValue =
|
|
21
|
+
| { ok: true; value: string | number | boolean | unknown[] | Record<string, unknown> }
|
|
22
|
+
| { ok: false; error: string };
|
|
23
|
+
|
|
24
|
+
/** Deep equality for JSON-safe values (arrays, records, scalars). */
|
|
25
|
+
export function valuesEqual(a: unknown, b: unknown): boolean {
|
|
26
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Render a stored value as the text its editor shows. */
|
|
30
|
+
export function valueToText(value: unknown): string {
|
|
31
|
+
if (value === undefined || value === null) return '';
|
|
32
|
+
if (Array.isArray(value) || typeof value === 'object') return JSON.stringify(value);
|
|
33
|
+
return String(value);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Number-editor conversion: an incomplete or non-finite entry is not a value. */
|
|
37
|
+
export function parseFiniteNumber(raw: string): number | null {
|
|
38
|
+
const trimmed = raw.trim();
|
|
39
|
+
if (trimmed === '' || trimmed === '-' || trimmed === '+' || trimmed === '.') return null;
|
|
40
|
+
const parsed = Number(trimmed);
|
|
41
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Parse a JSON array; `null` when the text is not one. */
|
|
45
|
+
export function parseJsonArray(raw: string): unknown[] | null {
|
|
46
|
+
const trimmed = raw.trim();
|
|
47
|
+
if (trimmed === '') return [];
|
|
48
|
+
try {
|
|
49
|
+
const parsed: unknown = JSON.parse(trimmed);
|
|
50
|
+
return Array.isArray(parsed) ? parsed : null;
|
|
51
|
+
} catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Parse a JSON record; `null` when the text is not one. */
|
|
57
|
+
export function parseJsonRecord(raw: string): Record<string, unknown> | null {
|
|
58
|
+
const trimmed = raw.trim();
|
|
59
|
+
if (trimmed === '') return {};
|
|
60
|
+
try {
|
|
61
|
+
const parsed: unknown = JSON.parse(trimmed);
|
|
62
|
+
return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)
|
|
63
|
+
? (parsed as Record<string, unknown>)
|
|
64
|
+
: null;
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Interpret a draft for a text-editable row type.
|
|
72
|
+
*
|
|
73
|
+
* An empty number is "no value" rather than `NaN`; an empty string is a value
|
|
74
|
+
* (clearing a credential field is a real write); JSON text must parse to the
|
|
75
|
+
* shape the schema names.
|
|
76
|
+
*/
|
|
77
|
+
export function parseDraft(type: SchemaEntry['type'], raw: string): ParsedValue {
|
|
78
|
+
if (type === 'number') {
|
|
79
|
+
const parsed = parseFiniteNumber(raw);
|
|
80
|
+
return parsed === null
|
|
81
|
+
? { ok: false, error: 'A number is required, e.g. 1200.' }
|
|
82
|
+
: { ok: true, value: parsed };
|
|
83
|
+
}
|
|
84
|
+
if (type === 'array') {
|
|
85
|
+
const parsed = parseJsonArray(raw);
|
|
86
|
+
return parsed === null
|
|
87
|
+
? { ok: false, error: 'This key is a JSON array, e.g. ["anthropic","openai"].' }
|
|
88
|
+
: { ok: true, value: parsed };
|
|
89
|
+
}
|
|
90
|
+
if (type === 'record') {
|
|
91
|
+
const parsed = parseJsonRecord(raw);
|
|
92
|
+
return parsed === null
|
|
93
|
+
? { ok: false, error: 'This key is a JSON object, e.g. {"bash":"prompt"}.' }
|
|
94
|
+
: { ok: true, value: parsed };
|
|
95
|
+
}
|
|
96
|
+
return { ok: true, value: raw.trim() };
|
|
97
|
+
}
|
|
@@ -106,6 +106,25 @@ describe('OMP_SCHEMA', () => {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
|
|
110
|
+
test('the rows omp 18.16.0 adds are offered', () => {
|
|
111
|
+
// Measured against `omp config list --json` on 18.16.0: all three exist and
|
|
112
|
+
// `omp config get` answers each. Two are TUI-composer features Kabmo has no
|
|
113
|
+
// surface for, but the panel is the only place a user CAN reach an omp
|
|
114
|
+
// setting, so a regenerated schema that drops them removes the row entirely.
|
|
115
|
+
const expected: Record<string, { type: SchemaEntry['type']; tab: string; group: string }> = {
|
|
116
|
+
'btw.inject': { type: 'boolean', tab: 'interaction', group: 'Input' },
|
|
117
|
+
'composer.predictionAlternatives': { type: 'boolean', tab: 'interaction', group: 'Input' },
|
|
118
|
+
'hindsight.globalScope': { type: 'boolean', tab: 'memory', group: 'Hindsight' },
|
|
119
|
+
};
|
|
120
|
+
for (const [key, want] of Object.entries(expected)) {
|
|
121
|
+
const entry = OMP_SCHEMA.entries[key];
|
|
122
|
+
expect({ key, entry: entry && { type: entry.type, tab: entry.ui.tab, group: entry.ui.group } }).toEqual({
|
|
123
|
+
key,
|
|
124
|
+
entry: want,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
109
128
|
});
|
|
110
129
|
|
|
111
130
|
describe('ALL_SCHEMA_ENTRIES', () => {
|
|
@@ -180,6 +199,18 @@ describe('isConditionMet', () => {
|
|
|
180
199
|
expect(isConditionMet('hasImageProtocol', {})).toBe(true);
|
|
181
200
|
});
|
|
182
201
|
|
|
202
|
+
test('the prediction-alternatives row follows composer predictions (omp 18.16.0)', () => {
|
|
203
|
+
// Upstream: `cfgComposerPredictionAlternatives` is gated on
|
|
204
|
+
// `cfgComposerPredictions.get(s) === true`. Falling through to the default
|
|
205
|
+
// arm would keep the modifier row visible with its parent switched off.
|
|
206
|
+
expect(isConditionMet('composerPredictionsEnabled', snapshot({ 'composer.predictions': true }))).toBe(true);
|
|
207
|
+
expect(isConditionMet('composerPredictionsEnabled', snapshot({ 'composer.predictions': false }))).toBe(false);
|
|
208
|
+
expect(isConditionMet('composerPredictionsEnabled', {})).toBe(false);
|
|
209
|
+
// And the row really is the one carrying that condition.
|
|
210
|
+
expect(OMP_SCHEMA.entries['composer.predictionAlternatives']?.ui.condition).toBe('composerPredictionsEnabled');
|
|
211
|
+
expect(OMP_SCHEMA.entries['composer.predictions']?.ui.condition).toBeUndefined();
|
|
212
|
+
});
|
|
213
|
+
|
|
183
214
|
test('an unknown condition degrades to visible', () => {
|
|
184
215
|
expect(isConditionMet('someFutureCondition', {})).toBe(true);
|
|
185
216
|
});
|
|
@@ -55,6 +55,12 @@ export function isConditionMet(condition: string | undefined, entries: Record<st
|
|
|
55
55
|
return configValue(entries, 'retry.usageAwareFallback') === true;
|
|
56
56
|
case 'planModeEnabled':
|
|
57
57
|
return configValue(entries, 'plan.enabled') === true;
|
|
58
|
+
// omp 18.16.0's `composer.predictionAlternatives` hangs off this one: the
|
|
59
|
+
// alternatives row is a modifier of composer predictions, and offering it
|
|
60
|
+
// while predictions are off would present a setting the user cannot reach
|
|
61
|
+
// a use for. Upstream evaluates `cfgComposerPredictions.get(s) === true`.
|
|
62
|
+
case 'composerPredictionsEnabled':
|
|
63
|
+
return configValue(entries, 'composer.predictions') === true;
|
|
58
64
|
case 'planAutosaveEnabled':
|
|
59
65
|
return configValue(entries, 'plan.enabled') === true && configValue(entries, 'plan.autosave') === true;
|
|
60
66
|
case 'unexpectedStopSmart':
|
|
@@ -8,19 +8,21 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Framing bugs are silent data corruption: a frame read as two lines, or a
|
|
10
10
|
* chunk sequence reassembled with the wrong bytes, reaches the session wrapper
|
|
11
|
-
* as a plausible-looking but wrong event. These tests pin the
|
|
12
|
-
*
|
|
13
|
-
* bookkeeping (ordering, count, declared byte length), the strict
|
|
14
|
-
* UTF-8 decoding, and the failure modes that must reject rather than
|
|
11
|
+
* as a plausible-looking but wrong event. These tests pin the OUTBOUND rule
|
|
12
|
+
* (one line, never chunked — omp does not reassemble what Kabmo writes), the
|
|
13
|
+
* inbound chunk bookkeeping (ordering, count, declared byte length), the strict
|
|
14
|
+
* base64 and UTF-8 decoding, and the failure modes that must reject rather than
|
|
15
|
+
* guess.
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import { describe, expect, test } from 'bun:test';
|
|
18
19
|
|
|
19
20
|
import {
|
|
21
|
+
MAX_OUTBOUND_FRAME_BYTES,
|
|
20
22
|
MAX_RPC_FRAME_BYTES,
|
|
21
23
|
MAX_RPC_REASSEMBLED_BYTES,
|
|
22
24
|
RpcFrameDecoder,
|
|
23
|
-
|
|
25
|
+
encodeRpcFrameLine,
|
|
24
26
|
type RpcFrameRecord,
|
|
25
27
|
} from '@/shared/lib/omp/rpc/frame';
|
|
26
28
|
|
|
@@ -36,6 +38,21 @@ function chunk(overrides: Record<string, unknown>): Record<string, unknown> {
|
|
|
36
38
|
return { type: 'rpc_chunk', chunkId: 'c1', index: 0, count: 2, byteLength: MAX_RPC_FRAME_BYTES, data: 'AAAA', ...overrides };
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
/** A complete inbound `rpc_chunk` sequence for `frame`, the shape omp emits.
|
|
42
|
+
* Kabmo never writes one (see `encodeRpcFrameLine`), so the test owns it. */
|
|
43
|
+
function chunkSequence(frame: RpcFrameRecord, chunkId: string): Record<string, unknown>[] {
|
|
44
|
+
const bytes = new TextEncoder().encode(JSON.stringify(frame));
|
|
45
|
+
const count = Math.ceil(bytes.byteLength / (256 * 1024));
|
|
46
|
+
return Array.from({ length: count }, (_, index) => ({
|
|
47
|
+
type: 'rpc_chunk',
|
|
48
|
+
chunkId,
|
|
49
|
+
index,
|
|
50
|
+
count,
|
|
51
|
+
byteLength: bytes.byteLength,
|
|
52
|
+
data: bytes.subarray(index * 256 * 1024, (index + 1) * 256 * 1024).toBase64(),
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
|
|
39
56
|
describe('transport limits', () => {
|
|
40
57
|
test('the frame and reassembly ceilings are the documented values', () => {
|
|
41
58
|
expect(MAX_RPC_FRAME_BYTES).toBe(1024 * 1024);
|
|
@@ -43,54 +60,27 @@ describe('transport limits', () => {
|
|
|
43
60
|
});
|
|
44
61
|
});
|
|
45
62
|
|
|
46
|
-
describe('
|
|
63
|
+
describe('encodeRpcFrameLine — one line, never chunked', () => {
|
|
47
64
|
test('a small frame is one JSON line terminated by a newline', () => {
|
|
48
65
|
const frame = { type: 'ready', n: 1 };
|
|
49
|
-
expect(
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('the exact boundary is a frame whose JSON is MAX-1 bytes (plus newline = MAX)', () => {
|
|
53
|
-
const frame = frameOfBytes(MAX_RPC_FRAME_BYTES - 1);
|
|
54
|
-
const lines = encodeRpcFrames(frame, 1, 'chunk');
|
|
55
|
-
expect(lines.length).toBe(1);
|
|
56
|
-
expect(lines[0].length).toBe(MAX_RPC_FRAME_BYTES);
|
|
66
|
+
expect(encodeRpcFrameLine(frame)).toBe(`${JSON.stringify(frame)}\n`);
|
|
57
67
|
});
|
|
58
68
|
|
|
59
|
-
test('
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('encodeRpcFrames — v2 chunking', () => {
|
|
67
|
-
test('an oversized frame becomes a contiguous chunk sequence that round-trips', () => {
|
|
69
|
+
test('a frame ABOVE the inbound frame limit is still a single line', () => {
|
|
70
|
+
// The regression this pins: a >1 MiB prompt (any real screenshot) used to be
|
|
71
|
+
// split into `rpc_chunk` records, which omp's rpc-ui stdin loop rejects with
|
|
72
|
+
// `Unknown command: rpc_chunk` — the prompt was never dispatched and the
|
|
73
|
+
// session was reset on ack timeout.
|
|
68
74
|
const frame = frameOfBytes(MAX_RPC_FRAME_BYTES + 5_000);
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
expect(
|
|
73
|
-
|
|
74
|
-
const decoder = new RpcFrameDecoder();
|
|
75
|
-
const records = lines.map((line) => JSON.parse(line));
|
|
76
|
-
for (let i = 0; i < records.length; i++) {
|
|
77
|
-
expect(records[i].type).toBe('rpc_chunk');
|
|
78
|
-
expect(records[i].chunkId).toBe('chunk-1');
|
|
79
|
-
expect(records[i].index).toBe(i);
|
|
80
|
-
expect(records[i].count).toBe(expectedCount);
|
|
81
|
-
expect(records[i].byteLength).toBe(payload.byteLength);
|
|
82
|
-
expect(lines[i].endsWith('\n')).toBe(true);
|
|
83
|
-
// Every push before the last must yield nothing — the decoder is holding
|
|
84
|
-
// an incomplete logical frame.
|
|
85
|
-
const out = decoder.push(records[i]);
|
|
86
|
-
if (i < records.length - 1) expect(out).toBeUndefined();
|
|
87
|
-
else expect(out).toEqual(frame);
|
|
88
|
-
}
|
|
75
|
+
const line = encodeRpcFrameLine(frame);
|
|
76
|
+
expect(line.endsWith('\n')).toBe(true);
|
|
77
|
+
expect(line.indexOf('\n')).toBe(line.length - 1);
|
|
78
|
+
expect(JSON.parse(line)).toEqual(frame);
|
|
89
79
|
});
|
|
90
80
|
|
|
91
|
-
test('a frame over the
|
|
92
|
-
const frame = { type: 'x', pad: 'A'.repeat(
|
|
93
|
-
expect(() =>
|
|
81
|
+
test('a frame over the outbound ceiling is refused instead of chunked', () => {
|
|
82
|
+
const frame = { type: 'x', pad: 'A'.repeat(MAX_OUTBOUND_FRAME_BYTES) };
|
|
83
|
+
expect(() => encodeRpcFrameLine(frame)).toThrow('exceeds the');
|
|
94
84
|
});
|
|
95
85
|
});
|
|
96
86
|
|
|
@@ -232,10 +222,86 @@ describe('RpcFrameDecoder — sequence bookkeeping', () => {
|
|
|
232
222
|
expect(() => decoder.push({ type: 'rpc_chunk', ...base, index: 3, data: last })).toThrow();
|
|
233
223
|
});
|
|
234
224
|
|
|
225
|
+
test('an inbound sequence reassembles to the frame omp emitted', () => {
|
|
226
|
+
// omp → Kabmo is the direction that DOES chunk, so the decoder must keep
|
|
227
|
+
// reassembling: an oversized event (a big tool result) arrives this way.
|
|
228
|
+
const frame = frameOfBytes(MAX_RPC_FRAME_BYTES + 5_000);
|
|
229
|
+
const decoder = new RpcFrameDecoder();
|
|
230
|
+
const records = chunkSequence(frame, 'chunk-1');
|
|
231
|
+
expect(records.length).toBeGreaterThan(1);
|
|
232
|
+
for (const record of records.slice(0, -1)) expect(decoder.push(record)).toBeUndefined();
|
|
233
|
+
expect(decoder.push(records.at(-1))).toEqual(frame);
|
|
234
|
+
});
|
|
235
|
+
|
|
235
236
|
test('a fresh sequence can start after a completed one', () => {
|
|
236
237
|
const decoder = new RpcFrameDecoder();
|
|
237
238
|
const frame = frameOfBytes(MAX_RPC_FRAME_BYTES + 1_000);
|
|
238
|
-
for (const
|
|
239
|
+
for (const record of chunkSequence(frame, 'a')) decoder.push(record);
|
|
239
240
|
expect(decoder.push({ type: 'ready' })).toEqual({ type: 'ready' });
|
|
240
241
|
});
|
|
241
242
|
});
|
|
243
|
+
|
|
244
|
+
describe('RpcFrameDecoder — ceilings advertised in ready', () => {
|
|
245
|
+
test('a smaller reassembly ceiling rejects a chunk above it', () => {
|
|
246
|
+
const decoder = new RpcFrameDecoder();
|
|
247
|
+
decoder.setLimits({ maxReassembledFrameBytes: 2 * 1024 * 1024 });
|
|
248
|
+
expect(() =>
|
|
249
|
+
decoder.push(chunk({ byteLength: 3 * 1024 * 1024, data: new Uint8Array(1024).fill(65).toBase64() })),
|
|
250
|
+
).toThrow('invalid RPC chunk metadata');
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test('a smaller reassembly ceiling caps how many slices one sequence may claim', () => {
|
|
254
|
+
const decoder = new RpcFrameDecoder();
|
|
255
|
+
decoder.setLimits({ maxReassembledFrameBytes: 2 * 1024 * 1024 });
|
|
256
|
+
// 2 MiB / 256 KiB = 8 slices; a ninth cannot exist under that ceiling.
|
|
257
|
+
expect(() =>
|
|
258
|
+
decoder.push(chunk({ count: 9, byteLength: 2 * 1024 * 1024, data: new Uint8Array(1024).fill(65).toBase64() })),
|
|
259
|
+
).toThrow('invalid RPC chunk metadata');
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test('a larger frame ceiling makes a formerly chunk-worthy frame too small to chunk', () => {
|
|
263
|
+
const decoder = new RpcFrameDecoder();
|
|
264
|
+
decoder.setLimits({ maxFrameBytes: 4 * 1024 * 1024 });
|
|
265
|
+
expect(() =>
|
|
266
|
+
decoder.push(chunk({ byteLength: 2 * 1024 * 1024, data: new Uint8Array(1024).fill(65).toBase64() })),
|
|
267
|
+
).toThrow('invalid RPC chunk metadata');
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test('a zero, negative, fractional or non-numeric ceiling keeps the previous value', () => {
|
|
271
|
+
const decoder = new RpcFrameDecoder();
|
|
272
|
+
decoder.setLimits({ maxFrameBytes: 0, maxReassembledFrameBytes: -1 });
|
|
273
|
+
decoder.setLimits({ maxFrameBytes: Number.NaN, maxReassembledFrameBytes: '8192' });
|
|
274
|
+
decoder.setLimits({ maxFrameBytes: 1.5, maxReassembledFrameBytes: null });
|
|
275
|
+
// Defaults still in force: below 1 MiB is not chunk-worthy, at 1 MiB is.
|
|
276
|
+
expect(() => decoder.push(chunk({ byteLength: MAX_RPC_FRAME_BYTES - 1 }))).toThrow('invalid RPC chunk metadata');
|
|
277
|
+
expect(decoder.push(chunk({ data: new Uint8Array(1024).fill(65).toBase64() }))).toBeUndefined();
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
describe('RpcFrameDecoder — resync after a damaged sequence', () => {
|
|
282
|
+
test('swallows the damaged tail and resumes at the next ordinary frame', () => {
|
|
283
|
+
const decoder = new RpcFrameDecoder();
|
|
284
|
+
expect(decoder.push(chunk({ count: 3, data: new Uint8Array(1024).fill(65).toBase64() }))).toBeUndefined();
|
|
285
|
+
// What `process.ts` does when `push` throws: abandon the sequence, keep the session.
|
|
286
|
+
decoder.resync();
|
|
287
|
+
expect(decoder.push(chunk({ count: 3, index: 2, data: new Uint8Array(1024).fill(65).toBase64() }))).toBeUndefined();
|
|
288
|
+
expect(decoder.push({ type: 'ready' })).toEqual({ type: 'ready' });
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test('resumes at a new sequence that starts over at index 0', () => {
|
|
292
|
+
const decoder = new RpcFrameDecoder();
|
|
293
|
+
decoder.resync();
|
|
294
|
+
const frame = frameOfBytes(MAX_RPC_FRAME_BYTES + 5_000);
|
|
295
|
+
const records = chunkSequence(frame, 'after-resync');
|
|
296
|
+
for (const record of records.slice(0, -1)) expect(decoder.push(record)).toBeUndefined();
|
|
297
|
+
expect(decoder.push(records.at(-1))).toEqual(frame);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
test('a malformed frame that is not a chunk still throws', () => {
|
|
301
|
+
// Recovery is scoped to a damaged CHUNK sequence; a line that is not an
|
|
302
|
+
// object at all remains a protocol fault the caller must see.
|
|
303
|
+
const decoder = new RpcFrameDecoder();
|
|
304
|
+
expect(() => decoder.push(42)).toThrow('RPC frame must be an object');
|
|
305
|
+
expect(() => decoder.push({ noType: 1 })).toThrow('RPC frame must be an object');
|
|
306
|
+
});
|
|
307
|
+
});
|