@kabmo-labs/kabmo 0.21.1 → 0.22.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 +7 -2
- package/dist/client/index.html +9 -8
- package/dist/client/index.js +334 -334
- package/dist/client/static/js/{index-thwqf24c.js → index-297dck9a.js} +784 -791
- package/dist/client/static/js/index-7ppta1pb.css +1 -0
- package/extensions/kabmo-modes/commands.ts +17 -3
- package/extensions/kabmo-modes/goal-start.ts +101 -0
- package/extensions/kabmo-modes/goal.test.ts +80 -5
- package/extensions/kabmo-modes/goal.ts +13 -38
- package/extensions/kabmo-modes/prompts.test.ts +12 -0
- package/extensions/kabmo-modes/prompts.ts +9 -2
- package/index.html +8 -7
- package/package.json +2 -2
- package/src/cli/lib/args.js +9 -0
- package/src/cli/lib/args.test.js +26 -0
- package/src/cli/lib/commands/doctor.js +153 -0
- package/src/cli/lib/commands/doctor.test.js +139 -0
- package/src/cli/lib/commands/serve.js +23 -10
- package/src/cli/lib/commands/status.js +22 -3
- package/src/cli/lib/omp-setup.js +131 -0
- package/src/cli/lib/omp-setup.test.js +115 -0
- package/src/cli/main.js +1 -1
- package/src/client/components/common/DemoDataBadge.tsx +52 -0
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/Modal.tsx +15 -1
- package/src/client/components/common/code-surface/blame-panel.ts +1 -1
- package/src/client/components/common/context-usage-button/index.test.tsx +1 -1
- package/src/client/components/common/context-usage-button/index.tsx +4 -4
- package/src/client/components/common/demo-data-badge.test.tsx +58 -0
- package/src/client/components/common/diagram-viewer/index.tsx +2 -2
- package/src/client/components/common/editor-view-buttons/index.tsx +2 -2
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/header-controls/index.tsx +4 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +2 -2
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +1 -1
- package/src/client/components/common/panel-mark/index.tsx +2 -1
- package/src/client/components/common/server-control/Panel.tsx +3 -3
- package/src/client/components/common/server-control/index.tsx +1 -1
- package/src/client/components/common/shell-update-button/Modal.tsx +1 -1
- package/src/client/components/common/todo-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +4 -0
- package/src/client/components/layout/ShellNotice.tsx +33 -0
- package/src/client/components/layout/desktop-layout/index.tsx +14 -16
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +14 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +2 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +5 -1
- package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +56 -0
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +12 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +2 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +6 -2
- package/src/client/components/layout/session-sidebar/new-workspace-modal/CloneField.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 +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +3 -3
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +150 -0
- package/src/client/components/layout/session-sidebar/variant-props.ts +6 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +20 -30
- package/src/client/components/mobile/MainView.tsx +5 -2
- package/src/client/components/mobile/RightSidebar.tsx +1 -1
- package/src/client/components/mobile/SessionSidebar.tsx +3 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +7 -1
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/settings/Modal.tsx +15 -1
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +2 -2
- package/src/client/components/settings/categories/OmpSettings.tsx +1 -1
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +1 -1
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +3 -3
- package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +5 -5
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ComposerStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +1 -1
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +2 -2
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +5 -5
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +3 -3
- package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +2 -2
- package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +4 -3
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +2 -2
- package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/PathField.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +3 -3
- package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +4 -4
- package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/PriceFields.tsx +1 -1
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +4 -4
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +2 -2
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +1 -1
- package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +5 -5
- package/src/client/components/workspace/browser-panel/AddressBar.tsx +1 -1
- package/src/client/components/workspace/browser-panel/Screencast.tsx +6 -6
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +1 -1
- package/src/client/components/workspace/browser-panel/index.tsx +1 -1
- package/src/client/components/workspace/browser-toolbar/index.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +13 -26
- package/src/client/components/workspace/chat-timeline/GoalNotice.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/QueueList.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SubagentView.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ArmedGoalStrip.tsx +71 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.test.ts +176 -0
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +70 -81
- package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +10 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +20 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +13 -7
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +65 -3
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +69 -19
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +174 -0
- package/src/client/components/workspace/chat-timeline/chat-input/goal-modal-parts.tsx +80 -0
- package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +15 -3
- package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
- 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/ask-panel/FrameControl.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Header.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/SelectBody.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +6 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +13 -13
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +9 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +10 -10
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/GoalRecord.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +6 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -15
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +7 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +4 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +17 -17
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/EnvelopeHeader.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/OutputWindow.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +1 -1
- package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +2 -2
- package/src/client/components/workspace/context-panel/StatsGrid.tsx +1 -1
- package/src/client/components/workspace/context-panel/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/ConflictBanner.tsx +1 -1
- package/src/client/components/workspace/editor/EmptyEditor.tsx +1 -1
- package/src/client/components/workspace/editor/FindWidget.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +1 -1
- package/src/client/components/workspace/file-explorer/OutlineSection.tsx +2 -2
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -1
- package/src/client/components/workspace/file-explorer/index.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
- package/src/client/components/workspace/git-panel/ChangesList.tsx +3 -3
- package/src/client/components/workspace/git-panel/ConflictItem.tsx +3 -3
- package/src/client/components/workspace/git-panel/FileItem.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +5 -5
- package/src/client/components/workspace/git-panel/TreeItem.tsx +2 -2
- package/src/client/components/workspace/git-panel/branch-modal/BranchRow.tsx +4 -4
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -2
- package/src/client/components/workspace/git-panel/index.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/Item.tsx +3 -3
- package/src/client/components/workspace/model-dropdown/Section.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
- package/src/client/components/workspace/plan-panel/index.tsx +2 -2
- package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
- package/src/client/components/workspace/repo-picker/Row.tsx +6 -6
- package/src/client/components/workspace/search-panel/Body.tsx +2 -2
- package/src/client/components/workspace/search-panel/Results.tsx +1 -1
- package/src/client/components/workspace/search-panel/index.tsx +1 -1
- package/src/client/components/workspace/terminal-panel/index.tsx +1 -1
- package/src/client/components/workspace/todo-panel/PhaseGroup.tsx +1 -1
- package/src/client/components/workspace/todo-panel/index.tsx +2 -2
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -5
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +13 -13
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +4 -4
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +7 -7
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/Nav.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/index.tsx +2 -2
- package/src/client/glass.css +50 -0
- package/src/client/glass.test.ts +68 -24
- package/src/client/hooks/chat/composer/browser-context.test.ts +6 -6
- package/src/client/hooks/chat/composer/use-draft.test.ts +2 -2
- package/src/client/hooks/chat/omp/prompt-send.test.ts +36 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +24 -18
- package/src/client/hooks/chat/omp/session-list.tsx +24 -70
- package/src/client/hooks/chat/omp/session-merges.ts +89 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -1
- package/src/client/hooks/chat/timeline/armed-goal-send.test.ts +168 -0
- package/src/client/hooks/chat/timeline/armed-goal.test.ts +178 -0
- package/src/client/hooks/chat/timeline/goal-command.ts +57 -27
- package/src/client/hooks/chat/timeline/index.ts +7 -4
- package/src/client/hooks/chat/timeline/mode-post.ts +46 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +94 -0
- package/src/client/hooks/chat/timeline/modes.ts +60 -95
- package/src/client/hooks/chat/timeline/send-props.ts +97 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +6 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +55 -8
- package/src/client/hooks/chat/timeline/send.test.ts +17 -1
- package/src/client/hooks/chat/timeline/send.ts +64 -72
- package/src/client/hooks/ui/dialog-behaviour.ts +143 -0
- package/src/client/hooks/ui/theme.ts +17 -0
- package/src/client/hooks/workspace/copy-tab-path.ts +23 -0
- package/src/client/hooks/workspace/mobile-back.ts +71 -0
- package/src/client/palette-class.test.ts +93 -0
- package/src/client/tailwind-contrast.test.ts +194 -0
- package/src/client/tailwind.css +327 -8
- package/src/server/lib/assets/theme-shell.server.ts +4 -10
- package/src/server/lib/omp/config/provider-seeds.test.ts +39 -1
- package/src/server/lib/omp/config/provider-seeds.ts +32 -3
- package/src/server/lib/omp/config/provider-vision-compat.test.ts +140 -0
- package/src/server/lib/omp/core/host-resolution.test.ts +1 -55
- package/src/server/lib/omp/core/install-hint.test.ts +48 -0
- package/src/server/lib/omp/core/install-hint.ts +64 -0
- package/src/server/lib/omp/core/startup.test.ts +125 -0
- package/src/server/lib/omp/core/startup.ts +5 -1
- package/src/server/lib/omp/mode/request.ts +14 -6
- package/src/server/plugins/ssr.ts +2 -1
- package/src/shared/lib/browser/annotate.test.ts +22 -22
- package/src/shared/lib/browser/annotate.ts +14 -14
- package/src/shared/lib/browser/page-context.ts +6 -6
- package/src/shared/lib/icons/icon-paint-authority.test.ts +86 -0
- package/src/shared/lib/icons/icon-paint-authority.ts +94 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +44 -8
- package/src/shared/lib/icons/icon-paint-css.ts +18 -1
- package/src/shared/lib/icons/icon-paint-panel.ts +15 -18
- package/src/shared/lib/icons/icon-paint-weight.ts +20 -1
- package/src/shared/lib/icons/icon-tone.ts +58 -13
- package/src/shared/lib/icons/tint-hues.generated.ts +51 -6
- package/src/shared/lib/icons/tint-tones.test.ts +257 -0
- package/src/shared/lib/icons/tint.test.ts +3 -211
- package/src/shared/lib/icons/tint.ts +23 -25
- package/src/shared/lib/omp/mode/actions.ts +40 -0
- package/src/shared/lib/omp/mode/types.ts +12 -0
- package/src/shared/lib/theme/css.ts +21 -0
- package/src/shared/lib/theme/first-frame.ts +38 -0
- package/src/shared/lib/theme/ink-scale.test.ts +151 -0
- package/src/shared/lib/theme/ink-scale.ts +103 -0
- package/src/shared/lib/theme/shell-palette.test.ts +22 -5
- package/src/shared/lib/theme/shell-palette.ts +9 -4
- package/src/shared/lib/theme/theme.test.ts +28 -3
- package/src/shared/lib/workspace/project-accent.test.ts +33 -1
- package/src/shared/lib/workspace/project-accent.ts +23 -0
- package/src/shared/types/omp/agent.ts +24 -9
- package/dist/client/static/js/index-0721wrkf.css +0 -1
|
@@ -53,6 +53,24 @@ export function knownModelIds(provider: Record<string, unknown> | undefined): Se
|
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* `compat` block that makes omp actually send the image.
|
|
58
|
+
*
|
|
59
|
+
* omp's model classifier derives `stripImageInput` from the model id and wins
|
|
60
|
+
* over a `compat` the file does not state: a `deepseek-v4-1-flash` entry
|
|
61
|
+
* declaring `input: [text, image]` still had its pixels replaced with
|
|
62
|
+
* `[image omitted: the active model does not support image input]` on the wire,
|
|
63
|
+
* while the same provider accepted the identical payload when posted by hand.
|
|
64
|
+
* Declaring the flag is what turns the vision checkbox into behaviour instead
|
|
65
|
+
* of a comment omp ignores.
|
|
66
|
+
*
|
|
67
|
+
* Written for EVERY `imageInput` model rather than only the ids that strip
|
|
68
|
+
* today: re-deriving omp's classification here would be a second copy of a fact
|
|
69
|
+
* omp already owns, and it would silently miss the next family added to that
|
|
70
|
+
* table. The flag is inert where nothing strips.
|
|
71
|
+
*/
|
|
72
|
+
const VISION_COMPAT = { stripImageInput: false } as const;
|
|
73
|
+
|
|
56
74
|
/** The model entry as omp expects it, omitting anything omp would reject. */
|
|
57
75
|
export function toModelEntry(model: OmpProviderModelSeed): Record<string, unknown> {
|
|
58
76
|
const efforts = model.efforts && model.efforts.length > 0 ? model.efforts : undefined;
|
|
@@ -62,7 +80,9 @@ export function toModelEntry(model: OmpProviderModelSeed): Record<string, unknow
|
|
|
62
80
|
...(model.kind && model.kind !== 'chat' ? { kind: model.kind } : {}),
|
|
63
81
|
...(model.reasoning !== undefined ? { reasoning: model.reasoning } : {}),
|
|
64
82
|
...(efforts ? { thinking: { mode: 'effort', efforts } } : {}),
|
|
65
|
-
...(model.imageInput
|
|
83
|
+
...(model.imageInput
|
|
84
|
+
? { input: ['text', 'image'], compat: { ...VISION_COMPAT } }
|
|
85
|
+
: { input: ['text'] }),
|
|
66
86
|
...(model.contextWindow && model.contextWindow > 0 ? { contextWindow: model.contextWindow } : {}),
|
|
67
87
|
...(model.maxTokens && model.maxTokens > 0 ? { maxTokens: model.maxTokens } : {}),
|
|
68
88
|
...(model.cost ? { cost: model.cost } : {}),
|
|
@@ -82,6 +102,11 @@ export function backfillEntry(doc: Document, entry: YAMLMap, seed: OmpProviderMo
|
|
|
82
102
|
if (seed.imageInput && (!Array.isArray(currentInput) || !currentInput.includes('image'))) {
|
|
83
103
|
entry.set('input', ['text', 'image']);
|
|
84
104
|
}
|
|
105
|
+
// Separate from the branch above on purpose: an entry that already names the
|
|
106
|
+
// image input but leaves `compat` unstated is exactly the pair omp reads as
|
|
107
|
+
// "vision declared, pixels stripped", so the flag has to be filled even when
|
|
108
|
+
// the input list needs no change. A `compat` the user pinned is theirs.
|
|
109
|
+
if (seed.imageInput && !entry.has('compat')) entry.set('compat', { ...VISION_COMPAT });
|
|
85
110
|
if (seed.contextWindow && seed.contextWindow > 0 && !plainOf(doc, entry.get('contextWindow'))) {
|
|
86
111
|
entry.set('contextWindow', seed.contextWindow);
|
|
87
112
|
}
|
|
@@ -104,6 +129,7 @@ export function updateEntry(_doc: Document, entry: YAMLMap, seed: OmpProviderMod
|
|
|
104
129
|
if (seed.reasoning !== undefined) entry.set('reasoning', seed.reasoning);
|
|
105
130
|
if (seed.imageInput !== undefined) {
|
|
106
131
|
entry.set('input', seed.imageInput ? ['text', 'image'] : ['text']);
|
|
132
|
+
if (seed.imageInput && !entry.has('compat')) entry.set('compat', { ...VISION_COMPAT });
|
|
107
133
|
}
|
|
108
134
|
if (seed.contextWindow && seed.contextWindow > 0) entry.set('contextWindow', seed.contextWindow);
|
|
109
135
|
if (seed.maxTokens && seed.maxTokens > 0) entry.set('maxTokens', seed.maxTokens);
|
|
@@ -112,7 +138,9 @@ export function updateEntry(_doc: Document, entry: YAMLMap, seed: OmpProviderMod
|
|
|
112
138
|
|
|
113
139
|
/**
|
|
114
140
|
* Existing entries worth backfilling: a bare id whose seed now carries
|
|
115
|
-
* metadata the entry lacks (context window, price, reasoning, image input)
|
|
141
|
+
* metadata the entry lacks (context window, price, reasoning, image input), or
|
|
142
|
+
* one that declares the image input without the `compat` that makes omp honour
|
|
143
|
+
* it — the entry looks configured and drops every picture.
|
|
116
144
|
*/
|
|
117
145
|
export function backfillableIds(
|
|
118
146
|
existingModels: unknown,
|
|
@@ -129,7 +157,8 @@ export function backfillableIds(
|
|
|
129
157
|
(missingContext && (seed.contextWindow || seed.maxTokens))
|
|
130
158
|
|| (!model.cost && seed.cost)
|
|
131
159
|
|| (seed.reasoning !== undefined && model.reasoning === undefined)
|
|
132
|
-
|| (!Array.isArray(model.input) && seed.imageInput)
|
|
160
|
+
|| (!Array.isArray(model.input) && seed.imageInput)
|
|
161
|
+
|| (seed.imageInput && !isRecord(model.compat)),
|
|
133
162
|
);
|
|
134
163
|
})
|
|
135
164
|
.map((model) => String(model.id));
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `compat` block that makes a declared image input actually reach the wire.
|
|
8
|
+
*
|
|
9
|
+
* omp's model classifier derives `stripImageInput` from the model id and wins
|
|
10
|
+
* over a `compat` the file does not state, so an entry carrying
|
|
11
|
+
* `input: [text, image]` and nothing else is read as "vision declared, every
|
|
12
|
+
* picture stripped": the pixels are replaced with
|
|
13
|
+
* `[image omitted: the active model does not support image input]` before the
|
|
14
|
+
* request leaves. Measured on `deepseek-v4-1-flash` against a provider that
|
|
15
|
+
* accepted the identical payload when posted by hand.
|
|
16
|
+
*
|
|
17
|
+
* These tests pin the writer side of that pair, and the one rule that matters
|
|
18
|
+
* for a hand-authored file: a `compat` the user pinned is never rewritten.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { afterAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
22
|
+
import fs from 'fs';
|
|
23
|
+
import { tmpdir } from 'os';
|
|
24
|
+
import { join } from 'path';
|
|
25
|
+
|
|
26
|
+
import { upsertOmpProviderModels } from '@/server/lib/omp/config/providers';
|
|
27
|
+
|
|
28
|
+
const originalAgentDir = Bun.env.PI_CODING_AGENT_DIR;
|
|
29
|
+
const roots: string[] = [];
|
|
30
|
+
let agentDir = '';
|
|
31
|
+
|
|
32
|
+
beforeEach(async () => {
|
|
33
|
+
const root = await fs.promises.mkdtemp(join(tmpdir(), 'omp-vision-compat-'));
|
|
34
|
+
roots.push(root);
|
|
35
|
+
agentDir = join(root, 'agent');
|
|
36
|
+
await fs.promises.mkdir(agentDir, { recursive: true });
|
|
37
|
+
Bun.env.PI_CODING_AGENT_DIR = agentDir;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
afterAll(async () => {
|
|
41
|
+
if (originalAgentDir === undefined) delete Bun.env.PI_CODING_AGENT_DIR;
|
|
42
|
+
else Bun.env.PI_CODING_AGENT_DIR = originalAgentDir;
|
|
43
|
+
for (const root of roots) await fs.promises.rm(root, { recursive: true, force: true });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const modelsPath = () => join(agentDir, 'models.yml');
|
|
47
|
+
|
|
48
|
+
/** Read back through fs: Bun.file memoizes across the atomic rename. */
|
|
49
|
+
async function readModels(): Promise<Record<string, Record<string, unknown>>> {
|
|
50
|
+
const doc = Bun.YAML.parse(await fs.promises.readFile(modelsPath(), 'utf8')) as
|
|
51
|
+
| { providers?: Record<string, Record<string, unknown>> }
|
|
52
|
+
| null;
|
|
53
|
+
if (!doc?.providers) throw new Error('models.yml has no providers map');
|
|
54
|
+
return doc.providers;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** One existing provider whose single model already declares the image input. */
|
|
58
|
+
function providerWith(input: string[]): string {
|
|
59
|
+
return [
|
|
60
|
+
'providers:',
|
|
61
|
+
' pinned:',
|
|
62
|
+
' baseUrl: https://old.example',
|
|
63
|
+
' apiKey: sk-old',
|
|
64
|
+
' api: openai-completions',
|
|
65
|
+
' models:',
|
|
66
|
+
' - id: m1',
|
|
67
|
+
` input: [ ${input.join(', ')} ]`,
|
|
68
|
+
'',
|
|
69
|
+
].join('\n');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
describe('vision compat on the provider write path', () => {
|
|
73
|
+
test('a newly added vision model carries the compat block', async () => {
|
|
74
|
+
await upsertOmpProviderModels('gw', {
|
|
75
|
+
baseUrl: 'https://gw.example/v1',
|
|
76
|
+
apiKey: 'sk-live',
|
|
77
|
+
models: [{ id: 'deepseek-v4-1-flash', imageInput: true }],
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const model = (await readModels()).gw?.models;
|
|
81
|
+
expect(Array.isArray(model) ? model[0] : undefined).toMatchObject({
|
|
82
|
+
id: 'deepseek-v4-1-flash',
|
|
83
|
+
input: ['text', 'image'],
|
|
84
|
+
compat: { stripImageInput: false },
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('re-importing a provider fills the compat a vision entry is missing', async () => {
|
|
89
|
+
// The entry omp reads as "vision declared, pixels stripped". Re-fetching the
|
|
90
|
+
// provider is the repair path, so the input list being unchanged must not
|
|
91
|
+
// stop the compat from landing.
|
|
92
|
+
await Bun.write(modelsPath(), providerWith(['text', 'image']));
|
|
93
|
+
|
|
94
|
+
const result = await upsertOmpProviderModels('pinned', {
|
|
95
|
+
baseUrl: 'https://old.example',
|
|
96
|
+
apiKey: 'sk-old',
|
|
97
|
+
models: [{ id: 'm1', imageInput: true }],
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expect(result.backfilledModels).toEqual(['m1']);
|
|
101
|
+
const model = (await readModels()).pinned?.models;
|
|
102
|
+
expect(Array.isArray(model) ? model[0] : undefined).toMatchObject({
|
|
103
|
+
input: ['text', 'image'],
|
|
104
|
+
compat: { stripImageInput: false },
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('a compat the user pinned is never overwritten', async () => {
|
|
109
|
+
await Bun.write(modelsPath(), providerWith(['text', 'image']).replace(
|
|
110
|
+
' input: [ text, image ]\n',
|
|
111
|
+
' input: [ text, image ]\n compat: { stripImageInput: true }\n',
|
|
112
|
+
));
|
|
113
|
+
|
|
114
|
+
await upsertOmpProviderModels('pinned', {
|
|
115
|
+
baseUrl: 'https://old.example',
|
|
116
|
+
apiKey: 'sk-old',
|
|
117
|
+
models: [{ id: 'm1', imageInput: true }],
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const model = (await readModels()).pinned?.models;
|
|
121
|
+
expect(Array.isArray(model) ? model[0] : undefined).toMatchObject({
|
|
122
|
+
compat: { stripImageInput: true },
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('a text-only seed leaves an entry without a compat block', async () => {
|
|
127
|
+
await Bun.write(modelsPath(), providerWith(['text']));
|
|
128
|
+
|
|
129
|
+
await upsertOmpProviderModels('pinned', {
|
|
130
|
+
baseUrl: 'https://old.example',
|
|
131
|
+
apiKey: 'sk-old',
|
|
132
|
+
models: [{ id: 'm1', imageInput: false }],
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const model = (await readModels()).pinned?.models;
|
|
136
|
+
const entry = Array.isArray(model) ? model[0] : undefined;
|
|
137
|
+
expect(entry).toMatchObject({ input: ['text'] });
|
|
138
|
+
expect(entry?.compat).toBeUndefined();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
* that lands while the server runs has to become visible).
|
|
14
14
|
* - `resolveProjectRoot` groups linked worktrees under the main repo; a
|
|
15
15
|
* non-git directory must resolve to itself, realpath-canonicalized.
|
|
16
|
-
* - `ompStartupError` is the one gate that keeps the server from booting
|
|
17
|
-
* without omp, with `MOCK=true` exempt by definition.
|
|
18
16
|
* - `buildWebState` reconciles the wrapper's running flags against the child's
|
|
19
17
|
* payload: dispatched-but-unstarted work and an unexpired continuation
|
|
20
18
|
* grace window keep a session "running" even when `isStreaming` is false.
|
|
@@ -22,13 +20,11 @@
|
|
|
22
20
|
|
|
23
21
|
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
24
22
|
import fs from 'fs';
|
|
25
|
-
import {
|
|
23
|
+
import { tmpdir } from 'os';
|
|
26
24
|
import { join } from 'path';
|
|
27
25
|
|
|
28
26
|
import { invalidateOmpCliCache, resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
29
27
|
import { resolveProjectRoot } from '@/server/lib/omp/core/worktree';
|
|
30
|
-
import { ompStartupError, ompStartupLogLines } from '@/server/lib/omp/core/startup';
|
|
31
|
-
import { getAgentDir, getConfigRoot } from '@/server/lib/omp/core/paths';
|
|
32
28
|
import { buildWebState, type WebStateHost } from '@/server/lib/omp/rpc/web-state';
|
|
33
29
|
import type { RpcSessionState } from '@/server/lib/omp/rpc/constants';
|
|
34
30
|
|
|
@@ -164,56 +160,6 @@ describe('resolveProjectRoot', () => {
|
|
|
164
160
|
});
|
|
165
161
|
});
|
|
166
162
|
|
|
167
|
-
describe('ompStartupError', () => {
|
|
168
|
-
test('MOCK=true is exempt even when no binary resolves', () => {
|
|
169
|
-
Bun.env.KABMO_OMP_BIN = join(tempDir('omp-mock'), 'omp');
|
|
170
|
-
Bun.env.MOCK = 'true';
|
|
171
|
-
invalidateOmpCliCache();
|
|
172
|
-
expect(ompStartupError()).toBeNull();
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test('a missing binary yields the actionable multi-line message', () => {
|
|
176
|
-
Bun.env.KABMO_OMP_BIN = join(tempDir('omp-miss2'), 'omp');
|
|
177
|
-
Bun.env.MOCK = 'false';
|
|
178
|
-
invalidateOmpCliCache();
|
|
179
|
-
const message = ompStartupError();
|
|
180
|
-
expect(message).toContain('omp binary not found — Kabmo cannot start.');
|
|
181
|
-
expect(message).toContain('KABMO_OMP_BIN=/path/to/omp');
|
|
182
|
-
expect(message).toContain('MOCK=true');
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
test('a resolvable binary lets the app start', () => {
|
|
186
|
-
Bun.env.KABMO_OMP_BIN = fakeBinary();
|
|
187
|
-
Bun.env.MOCK = 'false';
|
|
188
|
-
invalidateOmpCliCache();
|
|
189
|
-
expect(ompStartupError()).toBeNull();
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
describe('ompStartupLogLines', () => {
|
|
194
|
-
test('names the executable actually spawned plus the config and agent dirs', () => {
|
|
195
|
-
const bin = fakeBinary();
|
|
196
|
-
const agentDir = tempDir('omp-agent');
|
|
197
|
-
Bun.env.KABMO_OMP_BIN = bin;
|
|
198
|
-
Bun.env.PI_CODING_AGENT_DIR = agentDir;
|
|
199
|
-
Bun.env.PI_CONFIG_DIR = '.omp-alt';
|
|
200
|
-
invalidateOmpCliCache();
|
|
201
|
-
const lines = ompStartupLogLines();
|
|
202
|
-
expect(lines).toHaveLength(3);
|
|
203
|
-
expect(lines[0]).toBe(`omp binary: ${bin}`);
|
|
204
|
-
expect(lines[1]).toBe(`omp config dir: ${join(homedir(), '.omp-alt')}`);
|
|
205
|
-
expect(lines[2]).toBe(`omp agent dir: ${agentDir}`);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
test('the paths shown match the resolvers the running process uses', () => {
|
|
209
|
-
delete Bun.env.PI_CONFIG_DIR;
|
|
210
|
-
delete Bun.env.PI_CODING_AGENT_DIR;
|
|
211
|
-
const lines = ompStartupLogLines();
|
|
212
|
-
expect(lines[1]).toBe(`omp config dir: ${getConfigRoot()}`);
|
|
213
|
-
expect(lines[2]).toBe(`omp agent dir: ${getAgentDir()}`);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
163
|
function webStateHost(overrides: Partial<WebStateHost> = {}): WebStateHost {
|
|
218
164
|
return {
|
|
219
165
|
streaming: false,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The install remedy, and the promise that nobody wrote a second copy of it.
|
|
8
|
+
*
|
|
9
|
+
* Kabmo refuses to start without `omp`, so this text is the first and sometimes
|
|
10
|
+
* only thing a new user reads. Four surfaces print it — the startup refusal,
|
|
11
|
+
* `--help`, `status` and `doctor` — and the failure mode is precisely that they
|
|
12
|
+
* drift: one names the package, another names an installer, and the user is
|
|
13
|
+
* left with two answers. Pinning both commands here means a surface that stops
|
|
14
|
+
* using this module fails a suite instead of quietly disagreeing.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, expect, test } from 'bun:test';
|
|
18
|
+
|
|
19
|
+
import { OMP_INSTALL_SCRIPT_URL, ompInstallCommands, ompInstallHintLines } from '@/server/lib/omp/core/install-hint';
|
|
20
|
+
import { OMP_PACKAGE } from '@/server/lib/updates/npm';
|
|
21
|
+
|
|
22
|
+
describe('ompInstallCommands', () => {
|
|
23
|
+
test('the source route names the package the update path already resolves against', () => {
|
|
24
|
+
expect(ompInstallCommands().source).toBe(`bun install -g ${OMP_PACKAGE}`);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('the binary route is omp own installer', () => {
|
|
28
|
+
expect(OMP_INSTALL_SCRIPT_URL).toBe('https://omp.sh/install');
|
|
29
|
+
expect(ompInstallCommands().binary).toBe(`curl -fsSL ${OMP_INSTALL_SCRIPT_URL} | sh`);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('ompInstallHintLines', () => {
|
|
34
|
+
test('three lines: both routes and the verification', () => {
|
|
35
|
+
const lines = ompInstallHintLines();
|
|
36
|
+
expect(lines).toHaveLength(3);
|
|
37
|
+
expect(lines[0]).toContain('bun install -g');
|
|
38
|
+
expect(lines[1]).toContain('omp.sh/install');
|
|
39
|
+
// `omp --version` is the check `readOmpInstalledVersion` performs, so a
|
|
40
|
+
// user running it sees exactly what `doctor` will report.
|
|
41
|
+
expect(lines[2]).toContain('omp --version');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('the indent reaches every line, so a caller can nest the block', () => {
|
|
45
|
+
const lines = ompInstallHintLines(' ');
|
|
46
|
+
for (const line of lines) expect(line.startsWith(' ')).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The one place the remedy for a missing `omp` binary is written down.
|
|
8
|
+
*
|
|
9
|
+
* Kabmo never installs oh-my-pi by itself: `kabmo serve` means "run the
|
|
10
|
+
* server", and downloading a binary into `$HOME` as a side effect of that is
|
|
11
|
+
* an effect nobody asked for (and in a container or a read-only host it fails
|
|
12
|
+
* half way). The remedy is therefore TEXT, and it has to be the same text
|
|
13
|
+
* everywhere it appears — the startup refusal, `--help`, `status` and
|
|
14
|
+
* `doctor` — because four copies of an install command drift into three
|
|
15
|
+
* different answers about which package and which installer are right.
|
|
16
|
+
*
|
|
17
|
+
* Both commands are listed because they are not equivalent:
|
|
18
|
+
*
|
|
19
|
+
* - `bun install -g <package>` installs from source with the Bun this
|
|
20
|
+
* process already requires, and lands `omp` beside `bun` on PATH.
|
|
21
|
+
* - `curl -fsSL https://omp.sh/install | sh` is omp's own installer: it
|
|
22
|
+
* downloads a prebuilt binary to `~/.local/bin`, verifies it against the
|
|
23
|
+
* build service's sha256 and smoke-runs it before reporting success. It
|
|
24
|
+
* also installs Bun when it is missing, and picks the musl build on
|
|
25
|
+
* Alpine-style hosts.
|
|
26
|
+
*
|
|
27
|
+
* `probeOmpBin` already searches `~/.local/bin` and `~/.bun/bin`, so either
|
|
28
|
+
* route is found without a restart (see ./cli.ts).
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { OMP_PACKAGE } from '@/server/lib/updates/npm';
|
|
32
|
+
|
|
33
|
+
/** omp's own installer, which fetches a sha256-verified prebuilt binary. */
|
|
34
|
+
export const OMP_INSTALL_SCRIPT_URL = 'https://omp.sh/install';
|
|
35
|
+
|
|
36
|
+
export interface OmpInstallCommands {
|
|
37
|
+
/** Install from source with the Bun this product already runs on. */
|
|
38
|
+
source: string;
|
|
39
|
+
/** omp's installer: prebuilt binary, published release. */
|
|
40
|
+
binary: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function ompInstallCommands(): OmpInstallCommands {
|
|
44
|
+
return {
|
|
45
|
+
source: `bun install -g ${OMP_PACKAGE}`,
|
|
46
|
+
binary: `curl -fsSL ${OMP_INSTALL_SCRIPT_URL} | sh`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The install block, indented as a group.
|
|
52
|
+
*
|
|
53
|
+
* Returned as lines rather than one string so each caller can nest it in its
|
|
54
|
+
* own prose without re-deriving the spacing (the startup refusal prints it
|
|
55
|
+
* beside two other paragraphs, `--help` inside a section).
|
|
56
|
+
*/
|
|
57
|
+
export function ompInstallHintLines(indent = ''): string[] {
|
|
58
|
+
const { source, binary } = ompInstallCommands();
|
|
59
|
+
return [
|
|
60
|
+
`${indent}install omp: ${source}`,
|
|
61
|
+
`${indent} or: ${binary}`,
|
|
62
|
+
`${indent}verify: omp --version`,
|
|
63
|
+
];
|
|
64
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The startup gate and its banner.
|
|
8
|
+
*
|
|
9
|
+
* Split from `host-resolution.test.ts` when this suite pushed that file past
|
|
10
|
+
* the 350-line ceiling: both are about what a process PRINTS about its omp
|
|
11
|
+
* install, while the other file is about which host and binary it resolves.
|
|
12
|
+
*
|
|
13
|
+
* What is pinned is the difference between a message that names a prerequisite
|
|
14
|
+
* and one that names the command satisfying it. The refusal is the only thing a
|
|
15
|
+
* first-time user sees — it used to say "Install AI Oh-My-Pi and put `omp` on
|
|
16
|
+
* your PATH", leaving the reader to find the package — so both install routes
|
|
17
|
+
* and the `kabmo doctor` pointer are part of the contract, not decoration.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
21
|
+
import fs from 'fs';
|
|
22
|
+
import { homedir, tmpdir } from 'os';
|
|
23
|
+
import { join } from 'path';
|
|
24
|
+
|
|
25
|
+
import { invalidateOmpCliCache } from '@/server/lib/omp/core/cli';
|
|
26
|
+
import { getAgentDir, getConfigRoot } from '@/server/lib/omp/core/paths';
|
|
27
|
+
import { ompStartupError, ompStartupLogLines } from '@/server/lib/omp/core/startup';
|
|
28
|
+
|
|
29
|
+
const tempDirs: string[] = [];
|
|
30
|
+
const realEnv = {
|
|
31
|
+
KABMO_OMP_BIN: Bun.env.KABMO_OMP_BIN,
|
|
32
|
+
MOCK: Bun.env.MOCK,
|
|
33
|
+
PI_CODING_AGENT_DIR: Bun.env.PI_CODING_AGENT_DIR,
|
|
34
|
+
PI_CONFIG_DIR: Bun.env.PI_CONFIG_DIR,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function tempDir(prefix: string): string {
|
|
38
|
+
const dir = fs.mkdtempSync(join(tmpdir(), `${prefix}-`));
|
|
39
|
+
tempDirs.push(dir);
|
|
40
|
+
return dir;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A real file that exists on disk, for the binary override. */
|
|
44
|
+
function fakeBinary(): string {
|
|
45
|
+
const file = join(tempDir('omp-bin'), 'omp');
|
|
46
|
+
fs.writeFileSync(file, '#!/bin/sh\n');
|
|
47
|
+
return file;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
beforeAll(() => {
|
|
51
|
+
invalidateOmpCliCache();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
afterAll(() => {
|
|
55
|
+
invalidateOmpCliCache();
|
|
56
|
+
for (const dir of tempDirs) fs.rmSync(dir, { recursive: true, force: true });
|
|
57
|
+
for (const [key, value] of Object.entries(realEnv)) {
|
|
58
|
+
if (value === undefined) delete Bun.env[key];
|
|
59
|
+
else Bun.env[key] = value;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('ompStartupError', () => {
|
|
64
|
+
test('MOCK=true is exempt even when no binary resolves', () => {
|
|
65
|
+
Bun.env.KABMO_OMP_BIN = join(tempDir('omp-mock'), 'omp');
|
|
66
|
+
Bun.env.MOCK = 'true';
|
|
67
|
+
invalidateOmpCliCache();
|
|
68
|
+
expect(ompStartupError()).toBeNull();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('a missing binary yields the actionable multi-line message', () => {
|
|
72
|
+
Bun.env.KABMO_OMP_BIN = join(tempDir('omp-miss2'), 'omp');
|
|
73
|
+
Bun.env.MOCK = 'false';
|
|
74
|
+
invalidateOmpCliCache();
|
|
75
|
+
const message = ompStartupError();
|
|
76
|
+
expect(message).toContain('omp binary not found — Kabmo cannot start.');
|
|
77
|
+
expect(message).toContain('KABMO_OMP_BIN=/path/to/omp');
|
|
78
|
+
expect(message).toContain('MOCK=true');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('the refusal carries both install commands and the doctor pointer', () => {
|
|
82
|
+
Bun.env.KABMO_OMP_BIN = join(tempDir('omp-miss3'), 'omp');
|
|
83
|
+
Bun.env.MOCK = 'false';
|
|
84
|
+
invalidateOmpCliCache();
|
|
85
|
+
const message = ompStartupError() ?? '';
|
|
86
|
+
expect(message).toContain('bun install -g @oh-my-pi/pi-coding-agent');
|
|
87
|
+
expect(message).toContain('curl -fsSL https://omp.sh/install | sh');
|
|
88
|
+
expect(message).toContain('omp --version');
|
|
89
|
+
expect(message).toContain('kabmo doctor');
|
|
90
|
+
// Never a promise the product does not keep: the refusal states that Kabmo
|
|
91
|
+
// does not install omp for the user.
|
|
92
|
+
expect(message).toContain('never installs it for you');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('a resolvable binary lets the app start', () => {
|
|
96
|
+
Bun.env.KABMO_OMP_BIN = fakeBinary();
|
|
97
|
+
Bun.env.MOCK = 'false';
|
|
98
|
+
invalidateOmpCliCache();
|
|
99
|
+
expect(ompStartupError()).toBeNull();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('ompStartupLogLines', () => {
|
|
104
|
+
test('names the executable actually spawned plus the config and agent dirs', () => {
|
|
105
|
+
const bin = fakeBinary();
|
|
106
|
+
const agentDir = tempDir('omp-agent');
|
|
107
|
+
Bun.env.KABMO_OMP_BIN = bin;
|
|
108
|
+
Bun.env.PI_CODING_AGENT_DIR = agentDir;
|
|
109
|
+
Bun.env.PI_CONFIG_DIR = '.omp-alt';
|
|
110
|
+
invalidateOmpCliCache();
|
|
111
|
+
const lines = ompStartupLogLines();
|
|
112
|
+
expect(lines).toHaveLength(3);
|
|
113
|
+
expect(lines[0]).toBe(`omp binary: ${bin}`);
|
|
114
|
+
expect(lines[1]).toBe(`omp config dir: ${join(homedir(), '.omp-alt')}`);
|
|
115
|
+
expect(lines[2]).toBe(`omp agent dir: ${agentDir}`);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('the paths shown match the resolvers the running process uses', () => {
|
|
119
|
+
delete Bun.env.PI_CONFIG_DIR;
|
|
120
|
+
delete Bun.env.PI_CODING_AGENT_DIR;
|
|
121
|
+
const lines = ompStartupLogLines();
|
|
122
|
+
expect(lines[1]).toBe(`omp config dir: ${getConfigRoot()}`);
|
|
123
|
+
expect(lines[2]).toBe(`omp agent dir: ${getAgentDir()}`);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
22
|
+
import { ompInstallHintLines } from '@/server/lib/omp/core/install-hint';
|
|
22
23
|
import { getAgentDir, getConfigRoot } from '@/server/lib/omp/core/paths';
|
|
23
24
|
import { isMockMode } from '@/server/mock.server';
|
|
24
25
|
|
|
@@ -30,8 +31,11 @@ export function ompStartupError(): string | null {
|
|
|
30
31
|
'omp binary not found — Kabmo cannot start.',
|
|
31
32
|
'Agent sessions, omp config, session state and updates all run through the `omp` CLI,',
|
|
32
33
|
'so the binary must be resolvable before the server starts.',
|
|
33
|
-
'
|
|
34
|
+
...ompInstallHintLines(' '),
|
|
35
|
+
' Kabmo never installs it for you, and never touches an existing omp.',
|
|
36
|
+
'Already installed somewhere else? Set KABMO_OMP_BIN=/path/to/omp.',
|
|
34
37
|
'To run on demo data without an omp install, start with MOCK=true.',
|
|
38
|
+
'Full report: `kabmo doctor`.',
|
|
35
39
|
].join('\n');
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -24,7 +24,12 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
KABMO_MODE_COMMAND,
|
|
29
|
+
LEGACY_MODE_COMMAND_TYPE,
|
|
30
|
+
MODE_COMMAND_TYPE,
|
|
31
|
+
type KabmoModeSelection,
|
|
32
|
+
} from '@/shared/lib/omp/mode/types';
|
|
28
33
|
|
|
29
34
|
export type ModeScope = 'plan' | 'goal';
|
|
30
35
|
|
|
@@ -35,15 +40,18 @@ export interface ModeRequest {
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
/** The command type a mode request travels as.
|
|
43
|
+
*
|
|
44
|
+
* The name lives in the shared vocabulary (`@/shared/lib/omp/mode/types`)
|
|
45
|
+
* because BOTH ends need it: the client posts it and the route matches it, and
|
|
46
|
+
* two declarations would let a rename ship on one side only.
|
|
38
47
|
*
|
|
39
48
|
* `kabmo_mode` is what this build sends; `chamber_mode` is the pre-rename
|
|
40
49
|
* spelling and is still ACCEPTED, because a tab that loaded before a restart
|
|
41
50
|
* keeps posting the old name until it reloads, and a rejected request there
|
|
42
|
-
* reads as a dead Plan/Goal button.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export const LEGACY_MODE_COMMAND_TYPE = 'chamber_mode';
|
|
51
|
+
* reads as a dead Plan/Goal button. That legacy name is an external
|
|
52
|
+
* compatibility requirement (a browser tab this build does not control),
|
|
53
|
+
* which is why it survives the rename */
|
|
54
|
+
export { LEGACY_MODE_COMMAND_TYPE, MODE_COMMAND_TYPE };
|
|
47
55
|
|
|
48
56
|
/** Whether a command body's `type` names a mode request, under either spelling. */
|
|
49
57
|
export function isModeCommandType(type: unknown): boolean {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from '@/server/lib/assets/theme-shell.server';
|
|
22
22
|
import { readSettingsBlob } from '@/shared/lib/settings/keys';
|
|
23
23
|
import { resolveTheme } from '@/shared/lib/theme/catalog';
|
|
24
|
+
import { FIRST_FRAME_STYLE_ELEMENT_ID } from '@/shared/lib/theme/first-frame';
|
|
24
25
|
import { applyShellDocumentFacts } from '@/server/lib/assets/shell-attributes.server';
|
|
25
26
|
import { SURFACE_STYLE_SETTING_KEY } from '@/shared/lib/theme/surface-style';
|
|
26
27
|
import { ICON_STYLE_SETTING_KEY } from '@/shared/lib/theme/icon-style';
|
|
@@ -232,7 +233,7 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
|
|
|
232
233
|
// own canvas is white, and on a dark install that is a measured white flash
|
|
233
234
|
// for the length of the CSS request. The palette's ground is the only correct
|
|
234
235
|
// answer, and it has to be inline because nothing else has loaded.
|
|
235
|
-
const firstFrame = `<style>${firstFrameStyle(theme)}</style>`;
|
|
236
|
+
const firstFrame = `<style id="${FIRST_FRAME_STYLE_ELEMENT_ID}">${firstFrameStyle(theme)}</style>`;
|
|
236
237
|
// The chrome color has to match the surface at the TOP of the window, which
|
|
237
238
|
// is per-layout (`shared/lib/theme/chrome.ts`); this request already knows the
|
|
238
239
|
// two facts behind it. The login screen is the shell too, and paints canvas.
|