@kabmo-labs/kabmo 0.21.0 → 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-zg32n2sk.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 +139 -25
- package/src/shared/lib/icons/icon-paint-css.ts +76 -50
- package/src/shared/lib/icons/icon-paint-panel.ts +15 -18
- package/src/shared/lib/icons/icon-paint-weight.ts +142 -0
- 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
|
@@ -32,6 +32,7 @@ import { UI_PASSWORD_ENV } from '@/shared/lib/auth/password';
|
|
|
32
32
|
import { getLogFilePath } from '@/cli/lib/paths.js';
|
|
33
33
|
import { resolveServeMode } from '@/cli/lib/serve-mode.js';
|
|
34
34
|
import { ompStartupError } from '@/server/lib/omp/core/startup';
|
|
35
|
+
import { offerOmpInstall } from '@/cli/lib/omp-setup.js';
|
|
35
36
|
import { installAutostart, removeLegacyAutostart, uninstallAutostart, getAutostartEntryPath } from '@/server/lib/tray/autostart';
|
|
36
37
|
import { getAutostartCredentialPath, removeAutostartCredential, writeAutostartCredential } from '@/server/lib/tray/credential';
|
|
37
38
|
import { buildLoginEntryArgv } from '@/server/lib/tray/entry';
|
|
@@ -96,17 +97,14 @@ export async function run(options, ctx) {
|
|
|
96
97
|
const tls = options?.tls === true;
|
|
97
98
|
const tray = trayForOptions(options);
|
|
98
99
|
|
|
99
|
-
// The same gate the server entry applies, run here first so a missing omp
|
|
100
|
-
// binary fails immediately — with no detached child spawned, no log file to
|
|
101
|
-
// read and no registry entry left pointing at a process that already exited.
|
|
102
|
-
const ompError = ompStartupError();
|
|
103
|
-
if (ompError) fail(ompError);
|
|
104
|
-
|
|
105
100
|
// `--no-startup` is a REGISTRATION change, not a server start, so it runs
|
|
106
|
-
// before the port check and returns: asking to stop
|
|
107
|
-
// work whether or not something is already serving the
|
|
108
|
-
// the flag below the port guard, `serve --no-startup` on
|
|
109
|
-
// with "already served" and left the entry in place)
|
|
101
|
+
// before the port check and the omp gate, then returns: asking to stop
|
|
102
|
+
// starting at login must work whether or not something is already serving the
|
|
103
|
+
// port (measured: with the flag below the port guard, `serve --no-startup` on
|
|
104
|
+
// a busy port failed with "already served" and left the entry in place), and
|
|
105
|
+
// whether or not omp resolves — a machine whose omp was removed is exactly
|
|
106
|
+
// when a leftover login entry has to be removable, and an install prompt
|
|
107
|
+
// there would ask for something the command does not need.
|
|
110
108
|
if (options?.startup === false) {
|
|
111
109
|
const removed = uninstallAutostart();
|
|
112
110
|
// A pre-rename entry names a CLI file this release does not ship, so it
|
|
@@ -122,6 +120,21 @@ export async function run(options, ctx) {
|
|
|
122
120
|
return;
|
|
123
121
|
}
|
|
124
122
|
|
|
123
|
+
// The same gate the server entry applies, run here first so a missing omp
|
|
124
|
+
// binary fails immediately — with no detached child spawned, no log file to
|
|
125
|
+
// read and no registry entry left pointing at a process that already exited.
|
|
126
|
+
//
|
|
127
|
+
// Before refusing, offer the one action that fixes it — but only on a
|
|
128
|
+
// terminal, and only when the answer defaults to no (see lib/omp-setup.js).
|
|
129
|
+
// The gate is re-evaluated afterwards rather than trusted: the install may
|
|
130
|
+
// have declined, failed, or written a binary this PATH cannot see.
|
|
131
|
+
const ompError = ompStartupError();
|
|
132
|
+
if (ompError) {
|
|
133
|
+
await offerOmpInstall({ json, quiet });
|
|
134
|
+
const stillMissing = ompStartupError();
|
|
135
|
+
if (stillMissing) fail(stillMissing);
|
|
136
|
+
}
|
|
137
|
+
|
|
125
138
|
if (mode === 'prod') {
|
|
126
139
|
const builtServer = joinPath(pkgRoot, 'dist', 'client', 'index.js');
|
|
127
140
|
// Bun.file().exists() is file-only (false for directories) — correct here,
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import { findLiveInstance, listLiveInstances, waitForHealth } from '@/cli/lib/runtime.js';
|
|
10
10
|
import { isLoopbackHost, probeHost } from '@/server/lib/lifecycle/probe';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
12
|
+
import { log, ok, printJson, isJson, warn } from '@/cli/lib/output.js';
|
|
12
13
|
|
|
13
14
|
function explicitPort(options) {
|
|
14
15
|
const raw = options?.port;
|
|
@@ -92,9 +93,25 @@ function printInstance(entry) {
|
|
|
92
93
|
log(` log: ${entry.logFile}`);
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
/**
|
|
97
|
+
* The omp fact, printed with the instance report.
|
|
98
|
+
*
|
|
99
|
+
* `serve` refuses to start without a resolvable binary, so "Kabmo is not
|
|
100
|
+
* running" and "omp is not installed" look identical from the outside and need
|
|
101
|
+
* opposite fixes. Reported here because this is the command a user runs to ask
|
|
102
|
+
* why — and it is a warning, not a failure: `status` answers whether instances
|
|
103
|
+
* are alive, and an instance can be alive only if this resolved at its start.
|
|
104
|
+
*/
|
|
105
|
+
function ompNote() {
|
|
106
|
+
const bin = resolveOmpBin();
|
|
107
|
+
if (bin) return `omp: ${bin}`;
|
|
108
|
+
return 'omp: not found — `kabmo serve` cannot start (run `kabmo doctor`)';
|
|
109
|
+
}
|
|
110
|
+
|
|
95
111
|
export async function run(options) {
|
|
96
112
|
const json = isJson();
|
|
97
113
|
const requested = explicitPort(options);
|
|
114
|
+
const ompBin = resolveOmpBin();
|
|
98
115
|
|
|
99
116
|
const instances = requested !== null
|
|
100
117
|
? [await findLiveInstance(requested)].filter(Boolean)
|
|
@@ -102,10 +119,11 @@ export async function run(options) {
|
|
|
102
119
|
|
|
103
120
|
if (instances.length === 0) {
|
|
104
121
|
if (json) {
|
|
105
|
-
printJson(requested !== null ? { running: false, port: requested } : { running: false, instances: [] });
|
|
122
|
+
printJson(requested !== null ? { running: false, port: requested, omp: ompBin } : { running: false, instances: [], omp: ompBin });
|
|
106
123
|
return;
|
|
107
124
|
}
|
|
108
125
|
log(requested !== null ? `No Kabmo instance on port ${requested}.` : 'Kabmo is not running.');
|
|
126
|
+
if (!ompBin) warn(ompNote());
|
|
109
127
|
return;
|
|
110
128
|
}
|
|
111
129
|
|
|
@@ -118,7 +136,7 @@ export async function run(options) {
|
|
|
118
136
|
}
|
|
119
137
|
|
|
120
138
|
if (json) {
|
|
121
|
-
printJson(requested !== null ? { ...reported[0], running: true } : { running: true, instances: reported });
|
|
139
|
+
printJson(requested !== null ? { ...reported[0], running: true, omp: ompBin } : { running: true, instances: reported, omp: ompBin });
|
|
122
140
|
return;
|
|
123
141
|
}
|
|
124
142
|
|
|
@@ -127,4 +145,5 @@ export async function run(options) {
|
|
|
127
145
|
if (index > 0) log('');
|
|
128
146
|
printInstance(entry);
|
|
129
147
|
}
|
|
148
|
+
log(ompNote());
|
|
130
149
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// The one interactive offer Kabmo makes about oh-my-pi.
|
|
2
|
+
//
|
|
3
|
+
// `serve` refuses to start without an `omp` binary, and before this the only
|
|
4
|
+
// remedy was a paragraph the user had to copy out of the error. The offer runs
|
|
5
|
+
// `bun install -g @oh-my-pi/pi-coding-agent` — the SOURCE route, never the
|
|
6
|
+
// `curl | sh` installer: a product that pipes a remote script through a shell
|
|
7
|
+
// as part of `serve` is a decision the operator never made, and the printed
|
|
8
|
+
// line already names both routes for anyone who prefers the prebuilt binary.
|
|
9
|
+
//
|
|
10
|
+
// Three rules make the prompt safe:
|
|
11
|
+
//
|
|
12
|
+
// - It is asked ONLY on a TTY, never in JSON/quiet mode. A pipe or a daemon
|
|
13
|
+
// start must not block on a question nobody can answer (`serve` writes a
|
|
14
|
+
// login entry and detaches; a hung read there is a broken login).
|
|
15
|
+
// - The default is NO. Enter alone declines, so a stray keystroke on a
|
|
16
|
+
// production box never rewrites the global Bun prefix.
|
|
17
|
+
// - A failure is reported and nothing else happens: the caller still applies
|
|
18
|
+
// the startup gate, so a half-installed omp cannot make the server look
|
|
19
|
+
// healthy.
|
|
20
|
+
|
|
21
|
+
import { createInterface } from 'node:readline/promises';
|
|
22
|
+
|
|
23
|
+
import { color, log, warn } from '@/cli/lib/output.js';
|
|
24
|
+
import { resolveBunBin } from '@/cli/lib/runtime.js';
|
|
25
|
+
import { invalidateOmpCliCache, resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
26
|
+
import { ompInstallCommands } from '@/server/lib/omp/core/install-hint';
|
|
27
|
+
|
|
28
|
+
/** Whether this process may ask the question at all. */
|
|
29
|
+
export function canOfferOmpInstall({ isTTY, json, quiet }) {
|
|
30
|
+
return Boolean(isTTY) && !json && !quiet;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Yes, and only the spellings a user actually types. Everything else is a no. */
|
|
34
|
+
export function isYes(answer) {
|
|
35
|
+
const value = String(answer ?? '').trim().toLowerCase();
|
|
36
|
+
return value === 'y' || value === 'yes';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Ask, defaulting to no. The interface is closed on every path: an open readline
|
|
41
|
+
* keeps stdin in raw-ish mode and the detached spawn that follows would inherit
|
|
42
|
+
* a terminal that no longer echoes.
|
|
43
|
+
*/
|
|
44
|
+
async function ask(question) {
|
|
45
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
46
|
+
try {
|
|
47
|
+
const answer = await rl.question(question);
|
|
48
|
+
return answer;
|
|
49
|
+
} finally {
|
|
50
|
+
rl.close();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Run the source install, streaming its output.
|
|
56
|
+
*
|
|
57
|
+
* Streamed rather than buffered because `bun install -g` prints progress, and a
|
|
58
|
+
* silent minute is indistinguishable from a hang. The `omp` probe is
|
|
59
|
+
* invalidated afterwards: a miss is cached for 30s, and the gate that runs next
|
|
60
|
+
* must see the binary that was just written.
|
|
61
|
+
*/
|
|
62
|
+
export async function installOmpSource({ bun = null } = {}) {
|
|
63
|
+
const bin = bun ?? resolveBunBin();
|
|
64
|
+
const { source } = ompInstallCommands();
|
|
65
|
+
const parts = source.split(' ');
|
|
66
|
+
const proc = Bun.spawn({
|
|
67
|
+
cmd: [bin, ...parts.slice(1)],
|
|
68
|
+
stdin: 'ignore',
|
|
69
|
+
stdout: 'inherit',
|
|
70
|
+
stderr: 'inherit',
|
|
71
|
+
env: { ...Bun.env, FORCE_COLOR: '0' },
|
|
72
|
+
});
|
|
73
|
+
const exitCode = await proc.exited;
|
|
74
|
+
invalidateOmpCliCache();
|
|
75
|
+
return { exitCode, installed: Boolean(resolveOmpBin()) };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The whole interaction: print the remedy, ask, install when told to.
|
|
80
|
+
*
|
|
81
|
+
* Returns what happened so the caller can word the outcome and still decide
|
|
82
|
+
* about the startup gate itself — this module never exits the process.
|
|
83
|
+
*/
|
|
84
|
+
export async function offerOmpInstall({
|
|
85
|
+
isTTY = Boolean(process.stdin.isTTY),
|
|
86
|
+
json = false,
|
|
87
|
+
quiet = false,
|
|
88
|
+
confirm = ask,
|
|
89
|
+
install = installOmpSource,
|
|
90
|
+
} = {}) {
|
|
91
|
+
if (!canOfferOmpInstall({ isTTY, json, quiet })) return 'unavailable';
|
|
92
|
+
|
|
93
|
+
const { source, binary } = ompInstallCommands();
|
|
94
|
+
log('');
|
|
95
|
+
log('Kabmo drives your existing omp binary and does not install one by itself.');
|
|
96
|
+
log(` install from source: ${source}`);
|
|
97
|
+
log(` or the prebuilt one: ${binary}`);
|
|
98
|
+
log('');
|
|
99
|
+
|
|
100
|
+
let answer;
|
|
101
|
+
try {
|
|
102
|
+
answer = await confirm(`Install oh-my-pi from source now? [y/N] `);
|
|
103
|
+
} catch {
|
|
104
|
+
// A closed stdin (Ctrl+D, a terminal that went away) is a decline.
|
|
105
|
+
return 'declined';
|
|
106
|
+
}
|
|
107
|
+
if (!isYes(answer)) {
|
|
108
|
+
log(color.dim('Skipped — nothing was installed.'));
|
|
109
|
+
return 'declined';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let result;
|
|
113
|
+
try {
|
|
114
|
+
result = await install();
|
|
115
|
+
} catch (err) {
|
|
116
|
+
warn(`Install failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
117
|
+
return 'failed';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (result.exitCode !== 0) {
|
|
121
|
+
warn(`Install exited with code ${result.exitCode}.`);
|
|
122
|
+
return 'failed';
|
|
123
|
+
}
|
|
124
|
+
if (!result.installed) {
|
|
125
|
+
// The install reported success but `omp` still does not resolve: say so
|
|
126
|
+
// instead of letting the gate below print a second, unrelated message.
|
|
127
|
+
warn('The install finished, but `omp` is still not on PATH. Open a new shell, or set KABMO_OMP_BIN.');
|
|
128
|
+
return 'failed';
|
|
129
|
+
}
|
|
130
|
+
return 'installed';
|
|
131
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// The interactive omp offer, tested by its decisions rather than its prompt.
|
|
2
|
+
//
|
|
3
|
+
// What must not regress is who is ALLOWED to be asked and what the default is:
|
|
4
|
+
// a daemon start, a JSON read or a piped invocation that blocks on a question
|
|
5
|
+
// is a hung login entry, and a default of yes rewrites the global Bun prefix
|
|
6
|
+
// because someone pressed Enter. Both `confirm` and `install` are injected, so
|
|
7
|
+
// no test spawns `bun add -g`.
|
|
8
|
+
|
|
9
|
+
import { describe, expect, test } from 'bun:test';
|
|
10
|
+
|
|
11
|
+
import { canOfferOmpInstall, isYes, offerOmpInstall } from '@/cli/lib/omp-setup.js';
|
|
12
|
+
|
|
13
|
+
describe('canOfferOmpInstall', () => {
|
|
14
|
+
test('a plain terminal may be asked', () => {
|
|
15
|
+
expect(canOfferOmpInstall({ isTTY: true, json: false, quiet: false })).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// `serve` writes a login entry and detaches; a read there hangs the login.
|
|
19
|
+
test('a pipe is never asked', () => {
|
|
20
|
+
expect(canOfferOmpInstall({ isTTY: false, json: false, quiet: false })).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('machine-readable and quiet runs are never asked', () => {
|
|
24
|
+
expect(canOfferOmpInstall({ isTTY: true, json: true, quiet: false })).toBe(false);
|
|
25
|
+
expect(canOfferOmpInstall({ isTTY: true, json: false, quiet: true })).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('isYes', () => {
|
|
30
|
+
test('only the spellings a user types count as yes', () => {
|
|
31
|
+
expect(isYes('y')).toBe(true);
|
|
32
|
+
expect(isYes('YES')).toBe(true);
|
|
33
|
+
expect(isYes(' yes ')).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('an empty answer and everything else is no', () => {
|
|
37
|
+
for (const answer of ['', ' ', 'n', 'no', 'nope', 'yeah', undefined, null]) {
|
|
38
|
+
expect(isYes(answer)).toBe(false);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('offerOmpInstall', () => {
|
|
44
|
+
test('a non-terminal installs nothing and never asks', async () => {
|
|
45
|
+
let asked = false;
|
|
46
|
+
const outcome = await offerOmpInstall({
|
|
47
|
+
isTTY: false,
|
|
48
|
+
confirm: async () => { asked = true; return 'y'; },
|
|
49
|
+
install: async () => ({ exitCode: 0, installed: true }),
|
|
50
|
+
});
|
|
51
|
+
expect(outcome).toBe('unavailable');
|
|
52
|
+
expect(asked).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('declining runs no install command', async () => {
|
|
56
|
+
let installed = false;
|
|
57
|
+
const outcome = await offerOmpInstall({
|
|
58
|
+
isTTY: true,
|
|
59
|
+
confirm: async () => '',
|
|
60
|
+
install: async () => { installed = true; return { exitCode: 0, installed: true }; },
|
|
61
|
+
});
|
|
62
|
+
expect(outcome).toBe('declined');
|
|
63
|
+
expect(installed).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('a non-zero exit is a failure, and is not reported as installed', async () => {
|
|
67
|
+
const outcome = await offerOmpInstall({
|
|
68
|
+
isTTY: true,
|
|
69
|
+
confirm: async () => 'y',
|
|
70
|
+
install: async () => ({ exitCode: 1, installed: false }),
|
|
71
|
+
});
|
|
72
|
+
expect(outcome).toBe('failed');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// `bun add -g` can succeed while PATH does not see the launcher yet. Saying
|
|
76
|
+
// "installed" there would make the gate below print a second, contradictory
|
|
77
|
+
// message about a missing binary.
|
|
78
|
+
test('a successful command that leaves omp unresolvable is a failure', async () => {
|
|
79
|
+
const outcome = await offerOmpInstall({
|
|
80
|
+
isTTY: true,
|
|
81
|
+
confirm: async () => 'y',
|
|
82
|
+
install: async () => ({ exitCode: 0, installed: false }),
|
|
83
|
+
});
|
|
84
|
+
expect(outcome).toBe('failed');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('a thrown install is reported, not propagated', async () => {
|
|
88
|
+
const outcome = await offerOmpInstall({
|
|
89
|
+
isTTY: true,
|
|
90
|
+
confirm: async () => 'y',
|
|
91
|
+
install: async () => { throw new Error('bun is missing'); },
|
|
92
|
+
});
|
|
93
|
+
expect(outcome).toBe('failed');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('yes plus a resolvable binary is the one success', async () => {
|
|
97
|
+
const outcome = await offerOmpInstall({
|
|
98
|
+
isTTY: true,
|
|
99
|
+
confirm: async () => 'y',
|
|
100
|
+
install: async () => ({ exitCode: 0, installed: true }),
|
|
101
|
+
});
|
|
102
|
+
expect(outcome).toBe('installed');
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Ctrl+D closes stdin without an answer; that must read as a decline rather
|
|
106
|
+
// than escape as an unhandled rejection out of `serve`.
|
|
107
|
+
test('a confirm that throws (closed stdin) is a decline', async () => {
|
|
108
|
+
const outcome = await offerOmpInstall({
|
|
109
|
+
isTTY: true,
|
|
110
|
+
confirm: async () => { throw new Error('EOF'); },
|
|
111
|
+
install: async () => ({ exitCode: 0, installed: true }),
|
|
112
|
+
});
|
|
113
|
+
expect(outcome).toBe('declined');
|
|
114
|
+
});
|
|
115
|
+
});
|
package/src/cli/main.js
CHANGED
|
@@ -16,7 +16,7 @@ import { migrateLegacyDataDir } from '@/server/lib/lifecycle/paths';
|
|
|
16
16
|
|
|
17
17
|
const { version } = packageJson;
|
|
18
18
|
|
|
19
|
-
const COMMANDS = ['serve', 'update', 'stop', 'restart', 'status', 'logs', 'plugin'];
|
|
19
|
+
const COMMANDS = ['serve', 'update', 'stop', 'restart', 'status', 'doctor', 'logs', 'plugin'];
|
|
20
20
|
|
|
21
21
|
export async function runCli(bin = 'kabmo') {
|
|
22
22
|
const { command, positionals, options, unknown } = parseArgs(process.argv.slice(2));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The app-wide "this is demo data" marker.
|
|
8
|
+
*
|
|
9
|
+
* `MOCK=true` boots the server on bundled sample sessions, and the sidebar and
|
|
10
|
+
* timeline then look EXACTLY like a real install: measured in mock mode, the
|
|
11
|
+
* drawer listed `drrealhandler` / `History Commit 2026-09-05` and a 39-card
|
|
12
|
+
* transcript with no marker anywhere in the shell. Only two panels said the
|
|
13
|
+
* word "Mock", both of them deep inside Settings, so a demo instance was
|
|
14
|
+
* indistinguishable from a real one at a glance — the failure R-38 names.
|
|
15
|
+
*
|
|
16
|
+
* Three surfaces already draw a per-panel `Mock` badge (Usage, Todos, the
|
|
17
|
+
* behavior editor). This is the SHELL-level statement, and it exists once so a
|
|
18
|
+
* demo session cannot look real in one place and demo in another.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { FlaskConical } from 'lucide-preact';
|
|
22
|
+
|
|
23
|
+
interface DemoDataBadgeProps {
|
|
24
|
+
/**
|
|
25
|
+
* `strip` is the shell-level bar drawn above the workspace; `inline` is the
|
|
26
|
+
* chip a panel's own header uses.
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'strip' | 'inline';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function DemoDataBadge({ variant = 'inline' }: DemoDataBadgeProps) {
|
|
32
|
+
const label = 'Demo data: nothing here comes from a real session';
|
|
33
|
+
if (variant === 'strip') {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
role="status"
|
|
37
|
+
className="flex flex-shrink-0 items-center justify-center gap-1.5 border-b border-ink/15 bg-ink/5 px-3 py-1 text-[11px] font-medium text-muted"
|
|
38
|
+
>
|
|
39
|
+
<FlaskConical size={12} aria-hidden="true" />
|
|
40
|
+
<span>{label}</span>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return (
|
|
45
|
+
<span
|
|
46
|
+
title={label}
|
|
47
|
+
className="flex-shrink-0 rounded border border-ink/15 bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-muted"
|
|
48
|
+
>
|
|
49
|
+
Demo
|
|
50
|
+
</span>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -121,7 +121,7 @@ export function FolderPicker({ initialPath, onSelect, onClose }: FolderPickerPro
|
|
|
121
121
|
value={pathInput}
|
|
122
122
|
onChange={(e) => setPathInput(e.currentTarget.value)}
|
|
123
123
|
placeholder="~ or /absolute/path"
|
|
124
|
-
className="flex-1 bg-transparent outline-none text-xs font-mono text-ink placeholder-ink/
|
|
124
|
+
className="flex-1 bg-transparent outline-none text-xs font-mono text-ink placeholder-ink/35 py-1"
|
|
125
125
|
spellcheck={false}
|
|
126
126
|
/>
|
|
127
127
|
<button
|
|
@@ -169,7 +169,7 @@ export function FolderPicker({ initialPath, onSelect, onClose }: FolderPickerPro
|
|
|
169
169
|
<Loader2 size={18} className="animate-spin" />
|
|
170
170
|
</div>
|
|
171
171
|
) : error ? (
|
|
172
|
-
<div className="flex flex-col items-center justify-center h-40 text-xs text-
|
|
172
|
+
<div className="flex flex-col items-center justify-center h-40 text-xs text-error space-y-2 px-4">
|
|
173
173
|
<span>{error}</span>
|
|
174
174
|
<button
|
|
175
175
|
type="button"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { useId, useRef } from 'preact/hooks';
|
|
1
2
|
import type { FormEvent, ReactNode } from 'preact/compat';
|
|
2
3
|
import { X } from 'lucide-preact';
|
|
4
|
+
import { useDialogBehaviour } from '@/client/hooks/ui/dialog-behaviour';
|
|
3
5
|
|
|
4
6
|
export interface ModalProps {
|
|
5
7
|
/** Backdrop click / close-button handler. */
|
|
@@ -22,6 +24,7 @@ export interface ModalProps {
|
|
|
22
24
|
/**
|
|
23
25
|
* Accessible name for the dialog. The header is ordinary content, so without
|
|
24
26
|
* this the `role="dialog"` announces itself anonymously to a screen reader.
|
|
27
|
+
* When absent the header's own text names it through `aria-labelledby`.
|
|
25
28
|
*/
|
|
26
29
|
ariaLabel?: string;
|
|
27
30
|
}
|
|
@@ -41,6 +44,12 @@ export function Modal({
|
|
|
41
44
|
zClass = 'z-[60]',
|
|
42
45
|
ariaLabel,
|
|
43
46
|
}: ModalProps) {
|
|
47
|
+
// Focus, Escape and the Tab wrap come from ONE hook, so every dialog built on
|
|
48
|
+
// this shell behaves the same and a later shell cannot forget the keyboard.
|
|
49
|
+
const panelRef = useRef<HTMLDivElement | null>(null);
|
|
50
|
+
const headerId = useId();
|
|
51
|
+
useDialogBehaviour(panelRef, { open: true, onClose });
|
|
52
|
+
|
|
44
53
|
const body = (
|
|
45
54
|
<>
|
|
46
55
|
{children}
|
|
@@ -66,14 +75,19 @@ export function Modal({
|
|
|
66
75
|
shells already carry the pair; the shared shell was the one that
|
|
67
76
|
lacked it. */}
|
|
68
77
|
<div
|
|
78
|
+
ref={panelRef}
|
|
69
79
|
role="dialog"
|
|
70
80
|
aria-modal="true"
|
|
71
81
|
aria-label={ariaLabel}
|
|
82
|
+
aria-labelledby={ariaLabel ? undefined : headerId}
|
|
83
|
+
tabIndex={-1}
|
|
72
84
|
className={`glass-overlay bg-paper border border-ink/15 rounded-xl shadow-2xl w-full ${maxWidthClass} max-h-full flex flex-col overflow-hidden text-ink`}
|
|
73
85
|
onClick={(e) => e.stopPropagation()}
|
|
74
86
|
>
|
|
75
87
|
<div className="px-5 py-4 border-b border-ink/10 flex items-center justify-between flex-shrink-0">
|
|
76
|
-
{
|
|
88
|
+
<div id={headerId} className="min-w-0">
|
|
89
|
+
{header}
|
|
90
|
+
</div>
|
|
77
91
|
<button
|
|
78
92
|
type="button"
|
|
79
93
|
onClick={onClose}
|
|
@@ -51,7 +51,7 @@ const AUTHOR_CLASS = 'truncate text-xs font-semibold text-ink';
|
|
|
51
51
|
const AGE_CLASS = 'shrink-0 font-mono text-[10px] text-ink/40';
|
|
52
52
|
const SUBJECT_CLASS = 'mt-1 line-clamp-2 text-[11px] leading-snug text-ink/80';
|
|
53
53
|
const RULE_CLASS = 'mt-2 border-t border-ink/10 pt-2';
|
|
54
|
-
const META_CLASS = 'flex items-center gap-2 font-mono text-[
|
|
54
|
+
const META_CLASS = 'flex items-center gap-2 font-mono text-[10px] text-ink/40';
|
|
55
55
|
const NOTE_CLASS = 'mt-1 text-[10px] leading-snug text-ink/50';
|
|
56
56
|
const HISTORY_BUTTON_CLASS =
|
|
57
57
|
'mt-2 flex w-full items-center gap-1.5 text-left text-[10px] text-ink/50 hover:text-ink cursor-pointer';
|
|
@@ -186,7 +186,7 @@ describe('ContextUsageButton', () => {
|
|
|
186
186
|
|
|
187
187
|
test('a session with no turn says so instead of printing zeros', async () => {
|
|
188
188
|
await mount({ ...telemetryAt(0), messagesCount: 0 });
|
|
189
|
-
expect(trigger().getAttribute('title')).toBe('Context usage
|
|
189
|
+
expect(trigger().getAttribute('title')).toBe('Context usage: session not started');
|
|
190
190
|
await act(async () => {
|
|
191
191
|
trigger().click();
|
|
192
192
|
});
|
|
@@ -73,7 +73,7 @@ export function ContextUsageButton({ sessionId, layout = 'desktop' }: ContextUsa
|
|
|
73
73
|
const started = Boolean(telemetry && telemetry.messagesCount > 0);
|
|
74
74
|
const band = contextUsageBand(percent);
|
|
75
75
|
const triggerClass = layout === 'mobile'
|
|
76
|
-
? 'w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center transition-colors cursor-pointer'
|
|
76
|
+
? 'tap-target w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center transition-colors cursor-pointer'
|
|
77
77
|
: 'p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer';
|
|
78
78
|
|
|
79
79
|
return (
|
|
@@ -85,7 +85,7 @@ export function ContextUsageButton({ sessionId, layout = 'desktop' }: ContextUsa
|
|
|
85
85
|
setOpen((previous) => !previous);
|
|
86
86
|
}}
|
|
87
87
|
className={triggerClass}
|
|
88
|
-
title={started ? `Context usage
|
|
88
|
+
title={started ? `Context usage: ${percent.toFixed(0)}% of the window` : 'Context usage: session not started'}
|
|
89
89
|
aria-label="Context usage"
|
|
90
90
|
aria-haspopup="dialog"
|
|
91
91
|
aria-expanded={open}
|
|
@@ -124,11 +124,11 @@ export function ContextUsageButton({ sessionId, layout = 'desktop' }: ContextUsa
|
|
|
124
124
|
<div className="pt-2 space-y-1.5 text-[11px] text-ink/80">
|
|
125
125
|
<div className="flex justify-between gap-2">
|
|
126
126
|
<span className="text-ink/50 flex-shrink-0">Provider:</span>
|
|
127
|
-
<span className="truncate text-right">{providerName || '
|
|
127
|
+
<span className="truncate text-right">{providerName || '–'}</span>
|
|
128
128
|
</div>
|
|
129
129
|
<div className="flex justify-between gap-2">
|
|
130
130
|
<span className="text-ink/50 flex-shrink-0">Model:</span>
|
|
131
|
-
<span className="truncate text-right">{modelName || '
|
|
131
|
+
<span className="truncate text-right">{modelName || '–'}</span>
|
|
132
132
|
</div>
|
|
133
133
|
<div className="flex justify-between">
|
|
134
134
|
<span className="text-ink/50">Context:</span>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Demo data is stated, never implied.
|
|
3
|
+
*
|
|
4
|
+
* `MOCK=true` boots the server on bundled sample sessions. Measured in that
|
|
5
|
+
* mode, the drawer listed real-looking session titles and the timeline rendered
|
|
6
|
+
* a 39-card transcript, with no marker anywhere in the shell: only two panels
|
|
7
|
+
* deep in Settings said "Mock", and both were off screen. A demo instance was
|
|
8
|
+
* therefore indistinguishable from a real one, which is the failure R-38 names.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
12
|
+
import { Window } from 'happy-dom';
|
|
13
|
+
import { h, render } from 'preact';
|
|
14
|
+
|
|
15
|
+
import { DemoDataBadge } from '@/client/components/common/DemoDataBadge';
|
|
16
|
+
|
|
17
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
|
|
18
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
19
|
+
let container: HTMLElement;
|
|
20
|
+
|
|
21
|
+
beforeAll(() => {
|
|
22
|
+
const win = new Window({ url: 'http://localhost' });
|
|
23
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
24
|
+
for (const key of DOM_GLOBALS) {
|
|
25
|
+
nativeGlobals[key] = target[key];
|
|
26
|
+
target[key] = (win as unknown as Record<string, unknown>)[key];
|
|
27
|
+
}
|
|
28
|
+
container = document.createElement('div');
|
|
29
|
+
document.body.appendChild(container);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterAll(() => {
|
|
33
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
34
|
+
for (const key of DOM_GLOBALS) {
|
|
35
|
+
if (nativeGlobals[key] === undefined) delete target[key];
|
|
36
|
+
else target[key] = nativeGlobals[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
afterEach(() => render(null, container));
|
|
41
|
+
|
|
42
|
+
describe('DemoDataBadge', () => {
|
|
43
|
+
test('the strip says what the data is, not just that something is on', () => {
|
|
44
|
+
render(h(DemoDataBadge, { variant: 'strip' }), container);
|
|
45
|
+
const strip = container.querySelector('[role="status"]')!;
|
|
46
|
+
expect(strip).not.toBeNull();
|
|
47
|
+
// "Demo" alone leaves the reader guessing whether it means data, mode or a
|
|
48
|
+
// product tier. The sentence names the fact: nothing came from a session.
|
|
49
|
+
expect(strip.textContent).toContain('nothing here comes from a real session');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('the inline chip carries the same explanation in its title', () => {
|
|
53
|
+
render(h(DemoDataBadge, { variant: 'inline' }), container);
|
|
54
|
+
const chip = container.querySelector('span[title]')!;
|
|
55
|
+
expect(chip.textContent).toBe('Demo');
|
|
56
|
+
expect(chip.getAttribute('title')).toContain('nothing here comes from a real session');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -216,7 +216,7 @@ export function DiagramViewer({ svg, width, height, onClose }: DiagramViewerProp
|
|
|
216
216
|
<ViewerButton label="Zoom out (-)" onClick={() => zoomBy(1 / ZOOM_STEP)}>
|
|
217
217
|
<Minus size={14} />
|
|
218
218
|
</ViewerButton>
|
|
219
|
-
<span className="w-12 text-center font-mono text-[11px] tabular-nums text-
|
|
219
|
+
<span className="w-12 text-center font-mono text-[11px] tabular-nums text-on-ink-muted">
|
|
220
220
|
{Math.round(view.scale * 100)}%
|
|
221
221
|
</span>
|
|
222
222
|
<ViewerButton label="Zoom in (+)" onClick={() => zoomBy(ZOOM_STEP)}>
|
|
@@ -250,7 +250,7 @@ function ViewerButton({
|
|
|
250
250
|
onClick={onClick}
|
|
251
251
|
title={label}
|
|
252
252
|
aria-label={label}
|
|
253
|
-
className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-full text-
|
|
253
|
+
className="flex h-7 w-7 cursor-pointer items-center justify-center rounded-full text-on-ink-muted transition-colors hover:bg-canvas/10 hover:text-canvas"
|
|
254
254
|
>
|
|
255
255
|
{children}
|
|
256
256
|
</button>
|
|
@@ -30,13 +30,13 @@ export const EDITOR_VIEW_MODES: Array<{
|
|
|
30
30
|
{
|
|
31
31
|
target: 'compact',
|
|
32
32
|
label: 'Compact view',
|
|
33
|
-
hint: 'Editor takes the chat width
|
|
33
|
+
hint: 'Editor takes the chat width: chat hidden, sidebar and right panel kept',
|
|
34
34
|
Icon: MessageSquareOff,
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
target: 'full',
|
|
38
38
|
label: 'Full view',
|
|
39
|
-
hint: 'Editor takes the chat and sidebar width
|
|
39
|
+
hint: 'Editor takes the chat and sidebar width: chat and sidebar hidden, right panel kept',
|
|
40
40
|
Icon: PanelLeftClose,
|
|
41
41
|
},
|
|
42
42
|
];
|
|
@@ -97,7 +97,7 @@ export function HeaderMoreMenu({ entries = [] }: { entries?: HeaderEntry[] }) {
|
|
|
97
97
|
<button
|
|
98
98
|
type="button"
|
|
99
99
|
onClick={() => setOpen((current) => !current)}
|
|
100
|
-
className={`w-8 h-8 rounded-lg flex items-center justify-center transition-colors cursor-pointer ${
|
|
100
|
+
className={`tap-target w-8 h-8 rounded-lg flex items-center justify-center transition-colors cursor-pointer ${
|
|
101
101
|
open ? 'bg-ink/10 text-ink' : 'text-ink hover:bg-ink/5 active:bg-ink/10'
|
|
102
102
|
}`}
|
|
103
103
|
title="More actions"
|