@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
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The definition files Kabmo owns
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* omp
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
16
|
-
* and `pluginCliError` prefers stderr. `PI_CODING_AGENT_DIR` points at a temp
|
|
17
|
-
* dir and `KABMO_OMP_BIN` at a stub recording its argv — no real process (the stub is a compiled executable, so it spawns on both platforms).
|
|
7
|
+
* The definition files Kabmo owns besides agent definitions (the instruction
|
|
8
|
+
* files) and the plugin CLI wrapper. Agent discovery and the agent-file writer
|
|
9
|
+
* have their own suite, `agent-definitions.test.ts`.
|
|
10
|
+
*
|
|
11
|
+
* An instruction file of only whitespace REMOVES the file, or an empty AGENTS.md
|
|
12
|
+
* would still claim the context scope; plugin wrappers pass `--scope` only where
|
|
13
|
+
* omp accepts it, and `pluginCliError` prefers stderr. `PI_CODING_AGENT_DIR`
|
|
14
|
+
* points at a temp dir and `KABMO_OMP_BIN` at a stub recording its argv — no real
|
|
15
|
+
* process (the stub is a compiled executable, so it spawns on both platforms).
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
@@ -23,7 +21,6 @@ import fs from 'node:fs';
|
|
|
23
21
|
import { tmpdir } from 'node:os';
|
|
24
22
|
import { join } from 'node:path';
|
|
25
23
|
|
|
26
|
-
import { deleteAgentDefinition, discoverNativeAgents, writeAgentDefinition } from '@/server/lib/omp/config/agents';
|
|
27
24
|
import { invalidateOmpCliCache } from '@/server/lib/omp/core/cli';
|
|
28
25
|
import {
|
|
29
26
|
clearInstructionFile,
|
|
@@ -111,99 +108,6 @@ afterAll(() => {
|
|
|
111
108
|
fs.rmSync(root, { recursive: true, force: true });
|
|
112
109
|
});
|
|
113
110
|
|
|
114
|
-
describe('discoverNativeAgents', () => {
|
|
115
|
-
test('shapes frontmatter, defaults malformed fields, and skips non-markdown entries', async () => {
|
|
116
|
-
write(join(userAgents, 'one.md'), [
|
|
117
|
-
'---',
|
|
118
|
-
'name: First',
|
|
119
|
-
'description: "a description"',
|
|
120
|
-
'mode: subagent',
|
|
121
|
-
'model: fast',
|
|
122
|
-
'thinking: high',
|
|
123
|
-
'temperature: 0.5',
|
|
124
|
-
'top_p: nope',
|
|
125
|
-
'---',
|
|
126
|
-
'',
|
|
127
|
-
' system prompt ',
|
|
128
|
-
'',
|
|
129
|
-
].join('\n'));
|
|
130
|
-
write(join(userAgents, 'two.md'), 'no frontmatter body\n');
|
|
131
|
-
write(join(userAgents, 'ignored.txt'), 'x');
|
|
132
|
-
fs.mkdirSync(join(userAgents, 'nested.md'), { recursive: true });
|
|
133
|
-
|
|
134
|
-
const found = await discoverNativeAgents();
|
|
135
|
-
expect(found.map((agent) => agent.id).sort()).toEqual(['omp-user-one', 'omp-user-two']);
|
|
136
|
-
// By id, never by index: `readdir` order is not guaranteed (Windows returned `two` first).
|
|
137
|
-
const byId = new Map(found.map((agent) => [agent.id, agent]));
|
|
138
|
-
expect(byId.get('omp-user-one')).toMatchObject({
|
|
139
|
-
name: 'First', description: 'a description', mode: 'subagent', overrideModel: 'fast', thinkingVariant: 'high',
|
|
140
|
-
temperature: 0.5, topP: null, systemPrompt: 'system prompt', sourceRoot: 'user', filePath: join(userAgents, 'one.md'),
|
|
141
|
-
});
|
|
142
|
-
expect(byId.get('omp-user-two')).toMatchObject({
|
|
143
|
-
name: 'two', description: '', mode: 'all', temperature: null, topP: null, systemPrompt: 'no frontmatter body',
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test('an unrecognized mode and a non-numeric temperature degrade to defaults', async () => {
|
|
148
|
-
write(join(userAgents, 'weird.md'), '---\nmode: wizard\ntemperature: hot\n---\nbody\n');
|
|
149
|
-
const agent = (await discoverNativeAgents()).find((item) => item.id === 'omp-user-weird');
|
|
150
|
-
expect(agent).toMatchObject({ mode: 'all', temperature: null });
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test('a user agent wins over a project agent with the same base name', async () => {
|
|
154
|
-
write(join(userAgents, 'shared.md'), '---\nname: FromUser\n---\nuser body\n');
|
|
155
|
-
write(join(projectAgents, 'shared.md'), '---\nname: FromProject\n---\nproject body\n');
|
|
156
|
-
write(join(projectAgents, 'project-only.md'), '---\nname: OnlyProject\n---\nbody\n');
|
|
157
|
-
|
|
158
|
-
const found = await discoverNativeAgents(projectAgents);
|
|
159
|
-
expect(found.find((agent) => agent.filePath === join(userAgents, 'shared.md'))?.name).toBe('FromUser');
|
|
160
|
-
expect(found.some((agent) => agent.filePath === join(projectAgents, 'shared.md'))).toBe(false);
|
|
161
|
-
expect(found.find((agent) => agent.id === 'omp-project-project-only')?.sourceRoot).toBe('project');
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test('an oversized definition is skipped and a missing directory is not an error', async () => {
|
|
165
|
-
write(join(userAgents, 'huge.md'), `---\nname: Huge\n---\n${'x'.repeat(512 * 1024 + 1)}\n`);
|
|
166
|
-
const found = await discoverNativeAgents();
|
|
167
|
-
expect(found.some((agent) => agent.name === 'Huge')).toBe(false);
|
|
168
|
-
expect(await discoverNativeAgents(join(root, 'no-such-dir'))).toEqual(found);
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
describe('writeAgentDefinition', () => {
|
|
173
|
-
test('refuses an unsafe file name and an empty system prompt', async () => {
|
|
174
|
-
await expect(writeAgentDefinition({ fileName: '../escape', systemPrompt: 'x' })).rejects.toThrow(/may contain letters/);
|
|
175
|
-
await expect(writeAgentDefinition({ fileName: 'ok', systemPrompt: ' ' })).rejects.toThrow(/cannot be empty/);
|
|
176
|
-
expect(fs.existsSync(join(userAgents, 'ok.md'))).toBe(false);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
test('writes omp frontmatter keys, quoting scalars, then deletes on request', async () => {
|
|
180
|
-
const { path } = await writeAgentDefinition({
|
|
181
|
-
fileName: 'written',
|
|
182
|
-
description: 'has "quotes" and \\ slashes',
|
|
183
|
-
mode: 'primary',
|
|
184
|
-
thinking: 'low',
|
|
185
|
-
temperature: 0.2,
|
|
186
|
-
topP: 0.9,
|
|
187
|
-
tools: ['read', 'bash'],
|
|
188
|
-
systemPrompt: 'do the thing',
|
|
189
|
-
});
|
|
190
|
-
expect(path).toBe(join(userAgents, 'written.md'));
|
|
191
|
-
const text = fs.readFileSync(path, 'utf8');
|
|
192
|
-
expect(text).toContain('name: "written"');
|
|
193
|
-
expect(text).toContain('mode: "primary"');
|
|
194
|
-
expect(text).toContain('thinking-level: "low"');
|
|
195
|
-
expect(text).toContain('temperature: 0.2');
|
|
196
|
-
expect(text).toContain('top_p: 0.9');
|
|
197
|
-
expect(text).toContain('tools: "read", "bash"');
|
|
198
|
-
expect(text).toContain('has \\"quotes\\" and \\\\ slashes');
|
|
199
|
-
expect(text.endsWith('\n')).toBe(true);
|
|
200
|
-
|
|
201
|
-
expect(await deleteAgentDefinition('written')).toBe(true);
|
|
202
|
-
expect(await deleteAgentDefinition('written')).toBe(false);
|
|
203
|
-
await expect(deleteAgentDefinition('bad/name')).rejects.toThrow(/Invalid agent file name/);
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
111
|
describe('instruction files', () => {
|
|
208
112
|
test('narrows the kind and resolves the two omp basenames', () => {
|
|
209
113
|
expect(isInstructionFileKind('agents')).toBe(true);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { join } from 'path';
|
|
13
13
|
import { getAgentDir, pathExists } from '@/server/lib/omp/core/paths';
|
|
14
14
|
import { getOmpConfigPath } from '@/server/lib/omp/config/yaml';
|
|
15
|
-
import { withOmpYamlDocument } from '@/server/lib/omp/config/document';
|
|
15
|
+
import { seqAt, valueAt, withOmpYamlDocument } from '@/server/lib/omp/config/document';
|
|
16
16
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
17
17
|
|
|
18
18
|
export interface DiscoveredExtension {
|
|
@@ -75,17 +75,26 @@ export async function readDisabledExtensions(): Promise<Set<string>> {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Toggle one extension id in config.yml `disabledExtensions` atomically.
|
|
80
|
+
*
|
|
81
|
+
* The list is read through `valueAt`, which unwraps the YAML node: `doc.get()`
|
|
82
|
+
* returns a SEQ node, and `Array.isArray` on a node is `false` — so the whole
|
|
83
|
+
* list read as empty. Disabling then wrote a one-item list over the user's
|
|
84
|
+
* others, and ENABLING found the id absent from its own empty view, answered
|
|
85
|
+
* "nothing to do", and left the extension disabled forever.
|
|
86
|
+
*/
|
|
79
87
|
export async function setExtensionDisabled(id: string, disabled: boolean): Promise<boolean> {
|
|
80
88
|
if (!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(id)) throw new Error('Invalid extension id');
|
|
81
89
|
const path = getOmpConfigPath();
|
|
82
90
|
return withOmpYamlDocument(path, (doc) => {
|
|
83
|
-
const
|
|
84
|
-
const list = Array.isArray(
|
|
85
|
-
? current.filter((item): item is string => typeof item === 'string')
|
|
86
|
-
: [];
|
|
91
|
+
const raw = valueAt(doc, ['disabledExtensions']);
|
|
92
|
+
const list = Array.isArray(raw) ? raw.filter((item): item is string => typeof item === 'string') : [];
|
|
87
93
|
if (disabled === list.includes(id)) return { result: false, changed: false };
|
|
88
|
-
|
|
94
|
+
const next = disabled ? [...list, id] : list.filter((item) => item !== id);
|
|
95
|
+
const seq = seqAt(doc, ['disabledExtensions']);
|
|
96
|
+
if (seq) seq.items = next;
|
|
97
|
+
else doc.set('disabledExtensions', next);
|
|
89
98
|
return { result: true, changed: true };
|
|
90
99
|
});
|
|
91
100
|
}
|
|
@@ -248,6 +248,33 @@ describe('extensions', () => {
|
|
|
248
248
|
expect(await setExtensionDisabled('skill:a', false)).toBe(false);
|
|
249
249
|
expect(await fs.promises.readFile(configPath, 'utf8')).toBe('theme: dark\n');
|
|
250
250
|
});
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The list was read with `doc.get()`, which returns a YAML SEQ node —
|
|
254
|
+
* `Array.isArray` on that is `false`, so the panel saw an empty list. Turning
|
|
255
|
+
* an extension back ON then found its id "absent" and answered "nothing to
|
|
256
|
+
* do", leaving it disabled forever; turning one OFF overwrote every other
|
|
257
|
+
* disabled id. Both directions are pinned here.
|
|
258
|
+
*/
|
|
259
|
+
test('disabling keeps the ids already in the list', async () => {
|
|
260
|
+
const agent = await freshAgentDir();
|
|
261
|
+
const configPath = join(agent, 'config.yml');
|
|
262
|
+
await Bun.write(configPath, 'disabledExtensions:\n - skill:a\n - skill:b\n');
|
|
263
|
+
expect(await setExtensionDisabled('extension-module:c', true)).toBe(true);
|
|
264
|
+
expect(Bun.YAML.parse(await fs.promises.readFile(configPath, 'utf8'))).toEqual({
|
|
265
|
+
disabledExtensions: ['skill:a', 'skill:b', 'extension-module:c'],
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test('enabling removes only its own id and reports the change', async () => {
|
|
270
|
+
const agent = await freshAgentDir();
|
|
271
|
+
const configPath = join(agent, 'config.yml');
|
|
272
|
+
await Bun.write(configPath, 'disabledExtensions:\n - skill:a\n - skill:b\n');
|
|
273
|
+
expect(await setExtensionDisabled('skill:a', false)).toBe(true);
|
|
274
|
+
expect(Bun.YAML.parse(await fs.promises.readFile(configPath, 'utf8'))).toEqual({
|
|
275
|
+
disabledExtensions: ['skill:b'],
|
|
276
|
+
});
|
|
277
|
+
});
|
|
251
278
|
});
|
|
252
279
|
|
|
253
280
|
describe('behavior rules', () => {
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
GET_STATE_TIMEOUT_MS,
|
|
31
31
|
IDLE_REAP_MS,
|
|
32
32
|
IMAGE_BEARING_COMMANDS,
|
|
33
|
+
IMAGE_PROMPT_ACK_TIMEOUT_MS,
|
|
33
34
|
MAX_AGGREGATE_IMAGE_BYTES,
|
|
34
35
|
MAX_ATTACHED_IMAGE_BYTES,
|
|
35
36
|
MAX_ATTACHED_IMAGES,
|
|
@@ -43,6 +44,7 @@ import {
|
|
|
43
44
|
SESSION_BUSY_MESSAGE,
|
|
44
45
|
SUBAGENT_STALE_MS,
|
|
45
46
|
buildSessionSpawnArgs,
|
|
47
|
+
promptAckTimeoutMs,
|
|
46
48
|
resolveSpawnCwd,
|
|
47
49
|
toImageContents,
|
|
48
50
|
validateAgentImages,
|
|
@@ -71,11 +73,20 @@ describe('timeout windows and messages', () => {
|
|
|
71
73
|
expect(READY_TIMEOUT_MS).toBe(120_000);
|
|
72
74
|
expect(GET_STATE_TIMEOUT_MS).toBe(5_000);
|
|
73
75
|
expect(PROMPT_ACK_TIMEOUT_MS).toBe(30_000);
|
|
76
|
+
expect(IMAGE_PROMPT_ACK_TIMEOUT_MS).toBe(120_000);
|
|
74
77
|
expect(RELOAD_PLUGINS_TIMEOUT_MS).toBe(10_000);
|
|
75
78
|
expect(NON_TERMINAL_CONTINUATION_GRACE_MS).toBe(2_000);
|
|
76
79
|
expect(AWAITING_AGENT_START_TIMEOUT_MS).toBe(10_000);
|
|
77
80
|
});
|
|
78
81
|
|
|
82
|
+
test('an image prompt gets the longer ack budget; a text prompt keeps the short one', () => {
|
|
83
|
+
// omp describes the image before it acks, which measured 21-26 s — past the
|
|
84
|
+
// text budget, and overrunning it RESETS the child and loses the turn.
|
|
85
|
+
expect(promptAckTimeoutMs([{ type: 'image', data: 'AAAA', mimeType: 'image/png' }])).toBe(IMAGE_PROMPT_ACK_TIMEOUT_MS);
|
|
86
|
+
expect(promptAckTimeoutMs(undefined)).toBe(PROMPT_ACK_TIMEOUT_MS);
|
|
87
|
+
expect(promptAckTimeoutMs([])).toBe(PROMPT_ACK_TIMEOUT_MS);
|
|
88
|
+
});
|
|
89
|
+
|
|
79
90
|
test('user-facing messages are verbatim', () => {
|
|
80
91
|
expect(RESTARTING_MESSAGE).toBe('This session is restarting — retry in a moment.');
|
|
81
92
|
expect(SESSION_BUSY_MESSAGE).toBe('The OMP session is busy with the running turn; retry once it settles.');
|
|
@@ -88,6 +88,14 @@ export const SUBAGENT_STALE_MS = 30 * 60 * 1000;
|
|
|
88
88
|
export const READY_TIMEOUT_MS = 120_000;
|
|
89
89
|
export const GET_STATE_TIMEOUT_MS = 5_000;
|
|
90
90
|
export const PROMPT_ACK_TIMEOUT_MS = 30_000;
|
|
91
|
+
// An image-bearing prompt is NOT ack'd at dispatch time: omp stores the bytes,
|
|
92
|
+
// downscales them and asks the vision model for a description FIRST. Measured
|
|
93
|
+
// on 18.16.0: a plain prompt acks in ~0 ms, while a 1 MB PNG took 21 s and a
|
|
94
|
+
// 30 MB one 26 s — a size-independent cost dominated by that model call, which
|
|
95
|
+
// left 4 s of headroom under the text budget. Overrunning the ack cap does not
|
|
96
|
+
// merely report late: `settleCommandTimeout` RESETS the child, destroying the
|
|
97
|
+
// turn the operator just sent.
|
|
98
|
+
export const IMAGE_PROMPT_ACK_TIMEOUT_MS = 120_000;
|
|
91
99
|
// A `/reload-plugins` re-read of the skill/command roots. omp answers it in
|
|
92
100
|
// ~16-40 ms even mid-turn (measured on 18.4.3), so a short cap only bounds a
|
|
93
101
|
// child that stopped answering at all — the caller's retry is the recovery.
|
|
@@ -253,6 +261,13 @@ export function toImageContents(value: unknown): Array<{ type: 'image'; data: st
|
|
|
253
261
|
return images?.length ? images : undefined;
|
|
254
262
|
}
|
|
255
263
|
|
|
264
|
+
/** How long a prompt dispatch may wait for its ack, given what it carries.
|
|
265
|
+
* One function because both dispatch paths (the session command router and the
|
|
266
|
+
* BTW side question) must give an image prompt the same window. */
|
|
267
|
+
export function promptAckTimeoutMs(images: unknown): number {
|
|
268
|
+
return toImageContents(images) ? IMAGE_PROMPT_ACK_TIMEOUT_MS : PROMPT_ACK_TIMEOUT_MS;
|
|
269
|
+
}
|
|
270
|
+
|
|
256
271
|
/** Pick a spawn cwd that actually exists. A session records the directory it
|
|
257
272
|
* was created in, but that directory may have been deleted since: spawn()
|
|
258
273
|
* would fail with ENOENT and `omp --cwd <missing>` throws in setProjectDir. */
|
|
@@ -29,6 +29,7 @@ export function makeHost(overrides: Partial<SessionFrameHost> = {}): SessionFram
|
|
|
29
29
|
promptRunning: false,
|
|
30
30
|
streaming: false,
|
|
31
31
|
compacting: false,
|
|
32
|
+
runAborted: false,
|
|
32
33
|
awaitingAgentStart: false,
|
|
33
34
|
awaitingAgentStartDeadline: 0,
|
|
34
35
|
continuationGraceUntil: 0,
|
|
@@ -25,37 +25,9 @@
|
|
|
25
25
|
|
|
26
26
|
import { describe, expect, test } from 'bun:test';
|
|
27
27
|
|
|
28
|
-
import { foldSessionFrame
|
|
28
|
+
import { foldSessionFrame } from '@/server/lib/omp/rpc/frame-fold';
|
|
29
|
+
import { makeHost } from '@/server/lib/omp/rpc/frame-fold-host.test-util';
|
|
29
30
|
import { onRealtimeSignal } from '@/server/lib/realtime/signals.server';
|
|
30
|
-
import { ModeMirror } from '@/server/lib/omp/rpc/mode-mirror';
|
|
31
|
-
|
|
32
|
-
/** The same minimal host the sibling suite uses. */
|
|
33
|
-
function makeHost(overrides: Partial<SessionFrameHost> = {}): SessionFrameHost {
|
|
34
|
-
return {
|
|
35
|
-
sessionId: '',
|
|
36
|
-
autoTitleWindowUntil: 0,
|
|
37
|
-
autoTitleClaims: 0,
|
|
38
|
-
autoTitleDispatch: null,
|
|
39
|
-
autoTitlePending: true,
|
|
40
|
-
autoTitleRequested: false,
|
|
41
|
-
promptRunning: false,
|
|
42
|
-
streaming: false,
|
|
43
|
-
compacting: false,
|
|
44
|
-
awaitingAgentStart: false,
|
|
45
|
-
awaitingAgentStartDeadline: 0,
|
|
46
|
-
continuationGraceUntil: 0,
|
|
47
|
-
proc: { sendCommand: async () => undefined as never },
|
|
48
|
-
emit() {},
|
|
49
|
-
trackUiDialog() {},
|
|
50
|
-
observeSubagent() {},
|
|
51
|
-
syncRunModel() {},
|
|
52
|
-
modeMirror: new ModeMirror(),
|
|
53
|
-
isAlive: () => true,
|
|
54
|
-
isBusy: () => false,
|
|
55
|
-
send: async () => undefined,
|
|
56
|
-
...overrides,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
31
|
|
|
60
32
|
/**
|
|
61
33
|
* The `tool_execution_end` frame is what moves a running session's sidebar row
|
|
@@ -119,6 +119,61 @@ describe('auto-title trigger wiring', () => {
|
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
describe('the abort verdict survives agent_end compaction', () => {
|
|
123
|
+
test('an aborted assistant message is remembered before agent_end trims it', () => {
|
|
124
|
+
// omp drops the messages it already delivered via `message_end` when the
|
|
125
|
+
// terminal frame is oversized, and the aborted assistant message is one of
|
|
126
|
+
// them — so reading the verdict from `agent_end.messages` alone reports a
|
|
127
|
+
// stopped run as finished. Measured on 18.16.0: `message_end`
|
|
128
|
+
// (role=assistant, stopReason=aborted) arrives BEFORE `agent_end`.
|
|
129
|
+
const host = makeHost();
|
|
130
|
+
fold(host, { type: 'agent_start' });
|
|
131
|
+
fold(host, { type: 'message_end', message: { role: 'user', content: 'go' } });
|
|
132
|
+
fold(host, { type: 'message_end', message: { role: 'assistant', stopReason: 'aborted' } });
|
|
133
|
+
|
|
134
|
+
expect(host.runAborted).toBe(true);
|
|
135
|
+
|
|
136
|
+
// The compacted terminal frame: everything streamed, nothing left to carry
|
|
137
|
+
// the stopReason.
|
|
138
|
+
fold(host, { type: 'agent_end', isTerminal: true, messages: [], messageCount: 2 });
|
|
139
|
+
|
|
140
|
+
// A stopped turn is not a settle, so the title latch must survive.
|
|
141
|
+
expect(host.autoTitlePending).toBe(true);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('a natural stop is not remembered as an abort', () => {
|
|
145
|
+
const host = makeHost();
|
|
146
|
+
fold(host, { type: 'agent_start' });
|
|
147
|
+
fold(host, { type: 'message_end', message: { role: 'assistant', stopReason: 'stop' } });
|
|
148
|
+
|
|
149
|
+
expect(host.runAborted).toBe(false);
|
|
150
|
+
fold(host, { type: 'agent_end', isTerminal: true, messages: [] });
|
|
151
|
+
expect(host.autoTitlePending).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('a new run starts un-aborted', () => {
|
|
155
|
+
const host = makeHost();
|
|
156
|
+
fold(host, { type: 'agent_start' });
|
|
157
|
+
fold(host, { type: 'message_end', message: { role: 'assistant', stopReason: 'aborted' } });
|
|
158
|
+
expect(host.runAborted).toBe(true);
|
|
159
|
+
|
|
160
|
+
fold(host, { type: 'agent_start' });
|
|
161
|
+
expect(host.runAborted).toBe(false);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test('the frame is still read for a host that attached mid-run', () => {
|
|
165
|
+
// A synthetic terminal frame (`run-settle.server.ts`) carries no
|
|
166
|
+
// `message_end` history, so the array remains the fallback source.
|
|
167
|
+
const host = makeHost();
|
|
168
|
+
fold(host, {
|
|
169
|
+
type: 'agent_end',
|
|
170
|
+
isTerminal: true,
|
|
171
|
+
messages: [{ role: 'assistant', stopReason: 'aborted' }],
|
|
172
|
+
});
|
|
173
|
+
expect(host.autoTitlePending).toBe(true);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
122
177
|
/**
|
|
123
178
|
* The Kabmo's own background `/rename` answers on `prompt_result` with
|
|
124
179
|
* `agentInvoked:false` — auto-title fires it right after the first settled user
|
|
@@ -46,6 +46,8 @@ export interface SessionFrameHost extends AutoTitleHost, QueueDeliveryHost {
|
|
|
46
46
|
promptRunning: boolean;
|
|
47
47
|
streaming: boolean;
|
|
48
48
|
compacting: boolean;
|
|
49
|
+
/** Abort verdict of the current run — see `endedAborted` in `terminal-settle.ts`. */
|
|
50
|
+
runAborted: boolean;
|
|
49
51
|
awaitingAgentStart: boolean;
|
|
50
52
|
awaitingAgentStartDeadline: number;
|
|
51
53
|
continuationGraceUntil: number;
|
|
@@ -99,6 +101,7 @@ export interface FrameFoldResult {
|
|
|
99
101
|
*/
|
|
100
102
|
function handleMessageEnd(host: SessionFrameHost, event: AgentEvent): void {
|
|
101
103
|
const message = event.message as Record<string, unknown> | undefined;
|
|
104
|
+
if (message?.role === 'assistant' && message.stopReason === 'aborted') host.runAborted = true;
|
|
102
105
|
if (message?.role === 'user') void triggerAutoSessionTitle(host, 'opening');
|
|
103
106
|
else if (message?.role === 'custom' && message.customType === SKILL_PROMPT_CUSTOM_TYPE) {
|
|
104
107
|
void triggerAutoSessionTitle(host, 'opening');
|
|
@@ -188,6 +191,7 @@ export function foldSessionFrame(host: SessionFrameHost, event: AgentEvent): Fra
|
|
|
188
191
|
case 'agent_start':
|
|
189
192
|
host.promptRunning = true;
|
|
190
193
|
host.streaming = true;
|
|
194
|
+
host.runAborted = false;
|
|
191
195
|
host.awaitingAgentStart = false;
|
|
192
196
|
host.awaitingAgentStartDeadline = 0;
|
|
193
197
|
host.continuationGraceUntil = 0;
|
|
@@ -52,8 +52,7 @@ export class AgentSessionWrapper {
|
|
|
52
52
|
promptDispatchPendingCount = 0;
|
|
53
53
|
awaitingAgentStart = false;
|
|
54
54
|
awaitingAgentStartDeadline = 0;
|
|
55
|
-
/** Watches the deadline above so a dispatch
|
|
56
|
-
* strand the session (see `AgentStartWatchdog`). */
|
|
55
|
+
/** Watches the deadline above so a stranded dispatch is settled (`AgentStartWatchdog`). */
|
|
57
56
|
private readonly agentStartWatchdog: AgentStartWatchdog;
|
|
58
57
|
/** Settles a run omp no longer owns (see `run-settle.server.ts`). */
|
|
59
58
|
readonly runSettle: RunSettle;
|
|
@@ -61,6 +60,7 @@ export class AgentSessionWrapper {
|
|
|
61
60
|
bashRunning = false;
|
|
62
61
|
streaming = false;
|
|
63
62
|
compacting = false;
|
|
63
|
+
runAborted = false;
|
|
64
64
|
fastModeEnabled = false;
|
|
65
65
|
runModel: SessionRunModel | null = null;
|
|
66
66
|
private onDestroyCallback: (() => void) | null = null;
|
|
@@ -68,3 +68,14 @@ export interface RpcProcessOptions {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export const STDERR_TAIL_LIMIT = 8 * 1024;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* How many transport notices one child may push before the reader stops
|
|
74
|
+
* repeating itself.
|
|
75
|
+
*
|
|
76
|
+
* A malformed chunk sequence is recoverable (the logical frame is lost, the
|
|
77
|
+
* session is not), but a server stuck emitting invalid chunks would otherwise
|
|
78
|
+
* append a notice per line and bury the transcript. Three is enough to prove
|
|
79
|
+
* the fault is real; the stderr tail keeps the full account for diagnostics.
|
|
80
|
+
*/
|
|
81
|
+
export const MAX_PROTOCOL_ERROR_NOTICES = 3;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The transport faults `RpcProcess` has to survive.
|
|
8
|
+
*
|
|
9
|
+
* Two behaviours are pinned here, and neither can be observed against a real
|
|
10
|
+
* child (omp 18.16.0 advertises one set of ceilings and never emits a malformed
|
|
11
|
+
* chunk), so the scripted child says what the test needs:
|
|
12
|
+
*
|
|
13
|
+
* - **The ceilings come from `ready`.** The same chunk record is valid under
|
|
14
|
+
* the default 1 MiB physical ceiling and invalid under an advertised 4 MiB
|
|
15
|
+
* one — a 2 MiB logical frame is never chunked at 4 MiB — so the two runs
|
|
16
|
+
* differ only in what the server advertised.
|
|
17
|
+
* - **A malformed chunk sequence does not kill the session.** It used to call
|
|
18
|
+
* `dispose(0)`, which took the child's LSP servers, browser targets and
|
|
19
|
+
* prewarm slot down for a transport fault; now the reader reports a notice,
|
|
20
|
+
* loses that one logical frame, and keeps answering.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { afterEach, expect, test } from 'bun:test';
|
|
24
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
25
|
+
import { tmpdir } from 'node:os';
|
|
26
|
+
import { join } from 'node:path';
|
|
27
|
+
|
|
28
|
+
import { describePosix } from '@/test-support/platform';
|
|
29
|
+
import { RpcProcess, type RpcFrame } from '@/server/lib/omp/rpc/process';
|
|
30
|
+
|
|
31
|
+
const FAKE_OMP = join(import.meta.dir, '../../../../test-support/fake-omp-frames.ts');
|
|
32
|
+
|
|
33
|
+
const started: RpcProcess[] = [];
|
|
34
|
+
let root = '';
|
|
35
|
+
|
|
36
|
+
function start(env: Record<string, string>): { proc: RpcProcess; frames: RpcFrame[] } {
|
|
37
|
+
root ||= mkdtempSync(join(tmpdir(), 'omp-frames-test-'));
|
|
38
|
+
const frames: RpcFrame[] = [];
|
|
39
|
+
const proc = new RpcProcess({
|
|
40
|
+
cwd: root,
|
|
41
|
+
env,
|
|
42
|
+
onFrame: (frame) => frames.push(frame),
|
|
43
|
+
dependencies: { resolveOmpBin: () => FAKE_OMP },
|
|
44
|
+
});
|
|
45
|
+
started.push(proc);
|
|
46
|
+
return { proc, frames };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Ready + v2 negotiation, the state every chunk test needs. */
|
|
50
|
+
async function negotiated(env: Record<string, string>): Promise<{ proc: RpcProcess; frames: RpcFrame[] }> {
|
|
51
|
+
const { proc, frames } = start(env);
|
|
52
|
+
const ready = await proc.waitReady(20_000);
|
|
53
|
+
await proc.negotiateProtocol(ready);
|
|
54
|
+
return { proc, frames };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
afterEach(async () => {
|
|
58
|
+
for (const proc of started.splice(0)) await proc.dispose(500);
|
|
59
|
+
if (root) {
|
|
60
|
+
rmSync(root, { recursive: true, force: true });
|
|
61
|
+
root = '';
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describePosix('RpcProcess framing', () => {
|
|
66
|
+
test('the advertised frame ceiling is what the decoder applies', async () => {
|
|
67
|
+
// 4 MiB advertised: a 2 MiB logical frame is below it, so it would never be
|
|
68
|
+
// chunked — the record is a protocol fault and must be reported, once.
|
|
69
|
+
const { proc, frames } = await negotiated({
|
|
70
|
+
FAKE_OMP_READY_MAX_FRAME_BYTES: String(4 * 1024 * 1024),
|
|
71
|
+
FAKE_OMP_CHUNK: 'valid-1mib',
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const result = await proc.sendCommand<{ exitCode?: number }>({ type: 'bash', command: 'true' }, 20_000);
|
|
75
|
+
|
|
76
|
+
// The response still arrived: the reader continued past the bad record.
|
|
77
|
+
expect(result.exitCode).toBe(0);
|
|
78
|
+
const notices = frames.filter((frame) => frame.type === 'notice');
|
|
79
|
+
expect(notices).toHaveLength(1);
|
|
80
|
+
expect(String(notices[0].message)).toContain('malformed RPC frame');
|
|
81
|
+
expect(proc.isAlive).toBe(true);
|
|
82
|
+
}, 30_000);
|
|
83
|
+
|
|
84
|
+
test('the same record is accepted under the default ceiling', async () => {
|
|
85
|
+
// Control for the test above: identical bytes, no advertised override. The
|
|
86
|
+
// record is a valid FIRST slice, so nothing is reported and nothing is lost.
|
|
87
|
+
const { proc, frames } = await negotiated({ FAKE_OMP_CHUNK: 'valid-1mib' });
|
|
88
|
+
|
|
89
|
+
const result = await proc.sendCommand<{ exitCode?: number }>({ type: 'bash', command: 'true' }, 20_000);
|
|
90
|
+
|
|
91
|
+
expect(result.exitCode).toBe(0);
|
|
92
|
+
expect(frames.filter((frame) => frame.type === 'notice')).toHaveLength(0);
|
|
93
|
+
}, 30_000);
|
|
94
|
+
|
|
95
|
+
test('a malformed sequence costs one frame, not the child', async () => {
|
|
96
|
+
const { proc, frames } = await negotiated({ FAKE_OMP_CHUNK: 'bad-index' });
|
|
97
|
+
|
|
98
|
+
await proc.sendCommand({ type: 'bash', command: 'true' }, 20_000);
|
|
99
|
+
expect(frames.filter((frame) => frame.type === 'notice')).toHaveLength(1);
|
|
100
|
+
|
|
101
|
+
// The session is still there: a later command is answered by the SAME child.
|
|
102
|
+
const state = await proc.sendCommand<{ sessionId?: string }>({ type: 'get_state' }, 20_000);
|
|
103
|
+
expect(state.sessionId).toBe('fake-session');
|
|
104
|
+
expect(proc.isAlive).toBe(true);
|
|
105
|
+
}, 30_000);
|
|
106
|
+
});
|