@kabmo-labs/kabmo 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +523 -441
- package/dist/client/static/js/{index-rerjq5th.js → index-fcee4c13.js} +828 -818
- package/dist/client/static/js/index-sxdw908m.css +1 -0
- package/marketplace/plugins/command-runner/package.json +3 -2
- package/marketplace/plugins/git-forge/package.json +3 -2
- package/marketplace/plugins/session-info/package.json +3 -2
- package/marketplace/plugins/stats/package.json +3 -2
- package/package.json +3 -1
- package/src/client/components/auth/login-screen/index.tsx +2 -1
- package/src/client/components/common/ComposerPicker.tsx +1 -1
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/Modal.tsx +2 -2
- package/src/client/components/common/PWAInstallButton.tsx +2 -2
- package/src/client/components/common/ViewportSelector.tsx +1 -1
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +147 -0
- package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
- package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
- package/src/client/components/common/brand-wordmark/index.tsx +13 -2
- package/src/client/components/common/checkbox/style.test.ts +139 -0
- package/src/client/components/common/checkbox/style.ts +51 -0
- package/src/client/components/common/context-usage-button/index.tsx +2 -2
- package/src/client/components/common/file-icon/index.tsx +23 -9
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
- package/src/client/components/common/markdown-review/index.tsx +129 -0
- package/src/client/components/common/panel-mark/index.tsx +97 -0
- package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
- package/src/client/components/common/provider-icon/index.test.ts +14 -0
- package/src/client/components/common/provider-icon/index.tsx +4 -0
- package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
- package/src/client/components/common/provider-icon/resolve.ts +16 -3
- package/src/client/components/common/server-control/Panel.tsx +33 -23
- package/src/client/components/common/server-control/index.test.tsx +11 -5
- package/src/client/components/common/server-control/index.tsx +10 -8
- package/src/client/components/common/session-actions-menu/index.tsx +1 -1
- package/src/client/components/common/toolbar-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +22 -3
- package/src/client/components/layout/LeftDock.tsx +9 -2
- package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
- package/src/client/components/layout/WindowAura.tsx +27 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
- package/src/client/components/layout/desktop-layout/index.tsx +3 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +44 -23
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
- package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
- package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +40 -14
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
- package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
- package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
- package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/mobile/panel-chips.tsx +10 -2
- package/src/client/components/settings/Modal.tsx +4 -4
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/apply-side-effects.test.ts +30 -0
- package/src/client/components/settings/apply-side-effects.ts +14 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
- package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
- package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
- package/src/client/components/settings/categories/McpSettings.tsx +4 -21
- package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
- package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +93 -77
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +28 -15
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
- package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
- package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
- package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +37 -8
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
- package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
- package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
- package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
- package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
- package/src/client/components/workspace/browser-panel/index.tsx +50 -4
- package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
- package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
- package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
- package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
- package/src/client/components/workspace/diff-panel/changes.ts +28 -12
- package/src/client/components/workspace/diff-panel/index.tsx +2 -2
- package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
- package/src/client/components/workspace/diff-panel/merge.ts +21 -1
- package/src/client/components/workspace/editor/Body.tsx +7 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
- package/src/client/components/workspace/editor/FilePane.tsx +12 -0
- package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
- package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
- package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +25 -22
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
- package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
- package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
- package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
- package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
- package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- package/src/client/components/workspace/git-panel/index.tsx +7 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
- package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
- package/src/client/components/workspace/search-panel/Body.tsx +1 -1
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
- package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
- package/src/client/data/agent-data/builtin.ts +0 -10
- package/src/client/data/agent-data/orchestrator.ts +0 -45
- package/src/client/data/agent-data/specialist.ts +0 -100
- package/src/client/data/mock/token-usage.ts +170 -120
- package/src/client/data/settings/omp-schema.json +33 -1
- package/src/client/glass.css +785 -0
- package/src/client/glass.test.ts +346 -0
- package/src/client/hooks/browser/use-annotate.test.ts +143 -0
- package/src/client/hooks/browser/use-annotate.ts +98 -0
- package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
- package/src/client/hooks/browser/use-close-tab.ts +67 -0
- package/src/client/hooks/browser/use-screencast.ts +13 -1
- package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
- package/src/client/hooks/chat/composer/browser-context.ts +40 -16
- package/src/client/hooks/chat/composer/items.test.ts +1 -1
- package/src/client/hooks/chat/composer/review-context.ts +38 -0
- package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
- package/src/client/hooks/chat/composer/use-draft.ts +31 -2
- package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
- package/src/client/hooks/editor/use-document-annotations.ts +124 -0
- package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
- package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
- package/src/client/hooks/editor/use-preview-review.ts +148 -0
- package/src/client/hooks/settings/agents.ts +149 -0
- package/src/client/hooks/settings/crud-list.test.ts +28 -6
- package/src/client/hooks/settings/crud-list.ts +96 -57
- package/src/client/hooks/settings/omp-config.ts +164 -0
- package/src/client/hooks/settings/useTokenUsage.ts +125 -0
- package/src/client/hooks/settings/write-feedback.test.ts +104 -0
- package/src/client/hooks/settings/write-feedback.ts +63 -0
- package/src/client/hooks/ui/glass-support.ts +57 -0
- package/src/client/hooks/ui/icon-style.ts +59 -0
- package/src/client/hooks/ui/markdown-hydration.ts +125 -0
- package/src/client/hooks/ui/stuck-header.test.ts +188 -0
- package/src/client/hooks/ui/stuck-header.ts +91 -0
- package/src/client/hooks/ui/style-attributes.test.ts +120 -0
- package/src/client/hooks/ui/surface-style.ts +56 -0
- package/src/client/hooks/ui/updates/index.test.ts +100 -1
- package/src/client/hooks/ui/updates/index.ts +50 -0
- package/src/client/hooks/ui/updates/notes.test.ts +138 -0
- package/src/client/hooks/ui/updates/notes.ts +57 -0
- package/src/client/hooks/workspace/panel-hues.ts +23 -0
- package/src/client/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/main.tsx +10 -0
- package/src/client/tailwind.css +329 -11
- package/src/server/lib/assets/shell-attributes.server.ts +80 -0
- package/src/server/lib/assets/shell-attributes.test.ts +86 -0
- package/src/server/lib/btw/lifecycle.server.ts +2 -2
- package/src/server/lib/db/schema.ts +7 -0
- package/src/server/lib/db/seed-terminal.test.ts +4 -0
- package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
- package/src/server/lib/omp/config/agents.ts +231 -61
- package/src/server/lib/omp/config/definitions.test.ts +9 -105
- package/src/server/lib/omp/config/extensions.ts +16 -7
- package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
- package/src/server/lib/omp/rpc/constants.test.ts +11 -0
- package/src/server/lib/omp/rpc/constants.ts +15 -0
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
- package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/rpc/manager.ts +2 -2
- package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
- package/src/server/lib/omp/rpc/process.test.ts +106 -0
- package/src/server/lib/omp/rpc/process.ts +39 -18
- package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
- package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
- package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
- package/src/server/lib/omp/rpc/session-commands.ts +17 -3
- package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
- package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
- package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
- package/src/server/lib/omp/rpc/utility.ts +12 -0
- package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
- package/src/server/lib/panels/manifest.test.ts +20 -0
- package/src/server/lib/panels/manifest.ts +12 -0
- package/src/server/lib/panels/scan.server.ts +4 -0
- package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
- package/src/server/lib/queue/delivery-harness.ts +8 -4
- package/src/server/lib/queue/delivery.server.test.ts +29 -0
- package/src/server/lib/queue/delivery.server.ts +39 -0
- package/src/server/lib/queue/store.server.test.ts +22 -2
- package/src/server/lib/queue/store.server.ts +33 -11
- package/src/server/lib/review/schema.server.ts +45 -0
- package/src/server/lib/review/store.server.ts +138 -0
- package/src/server/lib/terminal/attach-replay.test.ts +132 -0
- package/src/server/lib/terminal/output.test.ts +166 -0
- package/src/server/lib/terminal/output.ts +104 -0
- package/src/server/lib/terminal/runtime.server.ts +5 -0
- package/src/server/lib/terminal/send-result.test.ts +33 -0
- package/src/server/lib/terminal/send-result.ts +32 -0
- package/src/server/lib/terminal/session.server.ts +45 -11
- package/src/server/lib/terminal/store-liveness.test.ts +4 -0
- package/src/server/lib/updates/active-notes.test.ts +149 -0
- package/src/server/lib/updates/active-notes.ts +75 -0
- package/src/server/lib/updates/changelog-file.ts +42 -11
- package/src/server/lib/updates/changelog.test.ts +15 -1
- package/src/server/lib/updates/omp.ts +42 -15
- package/src/server/lib/updates/release-url.ts +27 -1
- package/src/server/lib/usage/index-parse.test.ts +200 -0
- package/src/server/lib/usage/index-parse.ts +178 -0
- package/src/server/lib/usage/index-query.server.ts +248 -0
- package/src/server/lib/usage/index-scan.server.ts +343 -0
- package/src/server/lib/usage/index-schema.server.ts +82 -0
- package/src/server/lib/usage/index.test.ts +234 -0
- package/src/server/lib/usage/providers.server.ts +4 -53
- package/src/server/plugins/ssr.ts +22 -5
- package/src/server/routes/browser/index.ts +3 -0
- package/src/server/routes/browser/stream.ts +31 -2
- package/src/server/routes/browser/tabs.test.ts +94 -0
- package/src/server/routes/browser/tabs.ts +85 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/review/bindings.ts +11 -0
- package/src/server/routes/review/index.ts +127 -0
- package/src/server/routes/review/routes.test.ts +191 -0
- package/src/server/routes/settings/agents.test.ts +180 -0
- package/src/server/routes/settings/agents.ts +95 -102
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
- package/src/server/routes/telemetry/tokens.test.ts +145 -0
- package/src/server/routes/telemetry/tokens.ts +70 -149
- package/src/server/routes/terminal/ws.ts +6 -5
- package/src/server/routes/updates/index.ts +2 -0
- package/src/server/routes/updates/notes.ts +34 -0
- package/src/server/routes/updates/routes.test.ts +49 -0
- package/src/shared/lib/browser/annotate.test.ts +283 -0
- package/src/shared/lib/browser/annotate.ts +231 -0
- package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
- package/src/shared/lib/browser/frame-gate.test.ts +91 -0
- package/src/shared/lib/browser/frame-gate.ts +69 -0
- package/src/shared/lib/browser/frame-params.test.ts +43 -0
- package/src/shared/lib/browser/frame-params.ts +60 -0
- package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
- package/src/shared/lib/browser/frame-pipeline.ts +80 -0
- package/src/shared/lib/browser/page-context.ts +60 -4
- package/src/shared/lib/browser/snapshot.test.ts +115 -0
- package/src/shared/lib/browser/snapshot.ts +112 -0
- package/src/shared/lib/browser/tab-close.test.ts +74 -0
- package/src/shared/lib/browser/tab-close.ts +77 -0
- package/src/shared/lib/browser/viewer.ts +45 -26
- package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
- package/src/shared/lib/chat/tool/artifact.ts +55 -20
- package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
- package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
- package/src/shared/lib/chat/tool/minimized.ts +64 -0
- package/src/shared/lib/chat/tool/summary.test.ts +28 -8
- package/src/shared/lib/chat/tool/summary.ts +3 -32
- package/src/shared/lib/icons/file-brand-color.ts +38 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
- package/src/shared/lib/icons/icon-paint-css.ts +284 -0
- package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
- package/src/shared/lib/icons/tint.test.ts +273 -0
- package/src/shared/lib/icons/tint.ts +219 -0
- package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
- package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
- package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
- package/src/shared/lib/markdown/blocks/scan.ts +100 -0
- package/src/shared/lib/markdown/blocks/types.ts +62 -0
- package/src/shared/lib/markdown/marked.ts +58 -147
- package/src/shared/lib/markdown/math-extensions.ts +168 -0
- package/src/shared/lib/markdown/review/prompt.ts +77 -0
- package/src/shared/lib/markdown/review/reconcile.ts +55 -0
- package/src/shared/lib/markdown/review/review.test.ts +96 -0
- package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
- package/src/shared/lib/markdown/xml-sections.ts +139 -0
- package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
- package/src/shared/lib/models/provider/brand-color.ts +103 -0
- package/src/shared/lib/models/provider/label.ts +57 -0
- package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
- package/src/shared/lib/omp/config/agent-file.ts +43 -0
- package/src/shared/lib/omp/config/row-value.test.ts +95 -0
- package/src/shared/lib/omp/config/row-value.ts +97 -0
- package/src/shared/lib/omp/config/schema.test.ts +31 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +113 -47
- package/src/shared/lib/omp/rpc/frame.ts +107 -43
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/theme/catalog.test.ts +5 -4
- package/src/shared/lib/theme/catalog.ts +18 -3
- package/src/shared/lib/theme/glass-support.test.ts +38 -0
- package/src/shared/lib/theme/glass-support.ts +73 -0
- package/src/shared/lib/theme/icon-style.test.ts +74 -0
- package/src/shared/lib/theme/icon-style.ts +90 -0
- package/src/shared/lib/theme/legibility.ts +91 -0
- package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
- package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
- package/src/shared/lib/theme/surface-style.test.ts +68 -0
- package/src/shared/lib/theme/surface-style.ts +91 -0
- package/src/shared/lib/theme/theme.test.ts +11 -7
- package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -0
- package/src/shared/lib/usage/breakdown.test.ts +197 -0
- package/src/shared/lib/usage/breakdown.ts +241 -0
- package/src/shared/lib/usage/range.test.ts +204 -0
- package/src/shared/lib/usage/range.ts +240 -0
- package/src/shared/lib/usage/view.test.ts +85 -0
- package/src/shared/lib/usage/view.ts +74 -0
- package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
- package/src/shared/lib/workspace/panel-hues.ts +57 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/panels-registry.ts +6 -0
- package/src/shared/types/panels.ts +14 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/state.ts +30 -3
- package/src/shared/types/settings/write.ts +6 -0
- package/src/shared/types/tokenUsage.ts +128 -21
- package/src/shared/types/updates.ts +20 -0
- package/src/test-support/fake-omp-frames.ts +163 -0
- package/dist/client/static/js/index-3ve31rzx.css +0 -1
- package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
- package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
- package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
- package/src/server/lib/omp/session/usage/shaping.ts +0 -130
- /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
|
@@ -42,12 +42,23 @@
|
|
|
42
42
|
* `className` carries the SIZE (each surface sets its own) and nothing else: the
|
|
43
43
|
* colour split and the tracking are the brand and are not a per-call-site
|
|
44
44
|
* decision.
|
|
45
|
+
*
|
|
46
|
+
* `glow` adds the soft halo every HEADER surface wears — both layouts' sidebar
|
|
47
|
+
* headers and both top navbars — and nothing else does. It is a variant rather
|
|
48
|
+
* than another `className` value for the reason above: the effect is the same
|
|
49
|
+
* brand decision on all four, and a caller that spelled it itself would be the
|
|
50
|
+
* second copy this module exists to prevent. All four or none: the desktop
|
|
51
|
+
* draws its sidebar and its navbar side by side, so a wordmark that glowed in
|
|
52
|
+
* one and not the other would be two products on one screen. The halo is drawn
|
|
53
|
+
* by `.brand-wordmark-glow` in `tailwind.css`, which applies it on dark
|
|
54
|
+
* palettes only: on a near-black canvas the lockup needs the light, on paper a
|
|
55
|
+
* white glow would only muddy the ink it is drawn on.
|
|
45
56
|
*/
|
|
46
57
|
import { BrandMark } from '@/client/components/common/brand-wordmark/Mark';
|
|
47
58
|
|
|
48
|
-
export function BrandWordmark({ className = 'text-[15px]' }: { className?: string }) {
|
|
59
|
+
export function BrandWordmark({ className = 'text-[15px]', glow = false }: { className?: string; glow?: boolean }) {
|
|
49
60
|
return (
|
|
50
|
-
<span className={`font-extrabold tracking-tight ${className}`}>
|
|
61
|
+
<span className={`font-extrabold tracking-tight${glow ? ' brand-wordmark-glow' : ''} ${className}`}>
|
|
51
62
|
<BrandMark />
|
|
52
63
|
<span className="sr-only">K</span>
|
|
53
64
|
<span className="text-transparent bg-clip-text bg-gradient-to-r from-amber-500 to-orange-600" style={{ paddingRight: '0.06em', marginRight: '-0.06em' }}>ab</span>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The checkbox's own contract: the class is applied everywhere, and the styles
|
|
8
|
+
* that make "on" and "off" readable exist.
|
|
9
|
+
*
|
|
10
|
+
* Both halves are pinned because they failed for different reasons. The MARKUP
|
|
11
|
+
* half is a count: 22 `<input type="checkbox">` call sites across the app, and a
|
|
12
|
+
* control that is styled in the sidebar but native in Settings is two controls
|
|
13
|
+
* that disagree about what a checkbox looks like. The CSS half is a measurement:
|
|
14
|
+
* the native unchecked box composited 1.10:1 against its row while the checked
|
|
15
|
+
* one was 10.84:1 — "checkbox gk kelihatan on off nya".
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { describe, expect, test } from 'bun:test';
|
|
19
|
+
import { Glob } from 'bun';
|
|
20
|
+
|
|
21
|
+
describe('checkbox', () => {
|
|
22
|
+
test('every checkbox input carries the shared class', async () => {
|
|
23
|
+
// The glob is rooted at the REPOSITORY, not at this folder: a path that
|
|
24
|
+
// resolves wrong walks zero files and every assertion passes vacuously —
|
|
25
|
+
// which is exactly what the first version of this test did.
|
|
26
|
+
//
|
|
27
|
+
// `Bun.fileURLToPath` and `new URL(file, repoUrl)`, never `URL.pathname`:
|
|
28
|
+
// on Windows the pathname is `/D:/a/kabmo/kabmo/`, which walks nothing —
|
|
29
|
+
// the same vacuous pass this comment warns about, arriving by another
|
|
30
|
+
// route. `Bun.fileURLToPath` rather than `node:url` because this module is
|
|
31
|
+
// under `src/`, where a `node:` import is not allowed.
|
|
32
|
+
const repoUrl = new URL('../../../../..', import.meta.url);
|
|
33
|
+
const repo = Bun.fileURLToPath(repoUrl);
|
|
34
|
+
const glob = new Glob('src/client/**/*.tsx');
|
|
35
|
+
const offenders: string[] = [];
|
|
36
|
+
for await (const file of glob.scan({ cwd: repo })) {
|
|
37
|
+
if (file.includes('.test.')) continue;
|
|
38
|
+
// Comments first: `SelectionCheckbox` documents itself with the literal
|
|
39
|
+
// markup (`A native <input type="checkbox"> rather than a styled span`),
|
|
40
|
+
// and a scanner that reads prose reports the file that explains the rule.
|
|
41
|
+
const source = (await Bun.file(new URL(file, repoUrl)).text())
|
|
42
|
+
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
43
|
+
.replace(/^\s*\/\/.*$/gm, '');
|
|
44
|
+
if (!source.includes('type="checkbox"')) continue;
|
|
45
|
+
// Every `<input … type="checkbox" … />` element must name the class; the
|
|
46
|
+
// primitive itself imports the constant rather than spelling it.
|
|
47
|
+
const inputs = source.split('<input').filter((chunk) => chunk.includes('type="checkbox"'));
|
|
48
|
+
for (const chunk of inputs) {
|
|
49
|
+
const tag = chunk.slice(0, chunk.indexOf('/>') + 2);
|
|
50
|
+
if (!tag.includes('CHECKBOX_CLASS') && !tag.includes('kabmo-checkbox')) {
|
|
51
|
+
offenders.push(`${file}: ${tag.slice(0, 60).replace(/\s+/g, ' ')}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
expect(offenders).toEqual([]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('the styles state all three states in palette tokens', async () => {
|
|
59
|
+
const css = await Bun.file(new URL('../../../tailwind.css', import.meta.url)).text();
|
|
60
|
+
// The recipe lives in `@layer components`, NOT unlayered: an unlayered
|
|
61
|
+
// `width` beat every call site's `w-4`, so six Settings rows collapsed to the
|
|
62
|
+
// border box ("4x4"). A layer loses to utilities, which is the whole point.
|
|
63
|
+
const layer = css.slice(css.indexOf('@layer components {'), css.indexOf('/* Dot grain texture'));
|
|
64
|
+
expect(layer).toContain('.kabmo-checkbox {');
|
|
65
|
+
expect(layer).toContain('appearance: none;');
|
|
66
|
+
// A DEFAULT size, because `appearance: none` removes the intrinsic one.
|
|
67
|
+
expect(layer).toContain('width: 0.875rem;');
|
|
68
|
+
|
|
69
|
+
// The ring's alpha is a contrast budget: `ink 75%` is the first alpha whose
|
|
70
|
+
// worst case over all 63 palettes clears WCAG's 3:1 non-text floor
|
|
71
|
+
// (3.02:1 on solarized-light); 40% measured 1.71:1, which was the bug. The
|
|
72
|
+
// COLOURED ring below clears 3.56:1 on the same sweep. 2px
|
|
73
|
+
// rather than 1.5px because a half-pixel border antialiases into a 50% blend
|
|
74
|
+
// and the intended alpha never reaches the screen.
|
|
75
|
+
expect(layer).toContain('border: 2px solid color-mix(in srgb, var(--theme-ink) 75%, transparent);');
|
|
76
|
+
// Checked is the full ink, so the tick is `paper` — the palette's own pair.
|
|
77
|
+
expect(layer).toContain('.kabmo-checkbox:checked,');
|
|
78
|
+
expect(layer).toContain('background-color: var(--theme-ink);');
|
|
79
|
+
// The tick is a MASK, not a glyph: a glyph would inherit the row's text
|
|
80
|
+
// colour, and these rows set `text-ink/NN` for their own reasons.
|
|
81
|
+
expect(layer).toContain('background-color: var(--theme-paper);');
|
|
82
|
+
expect(layer).toContain('mask: center / contain no-repeat');
|
|
83
|
+
expect(layer).toContain('.kabmo-checkbox:indeterminate::after {');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('the colour mode states on as green and off as red, and mono does not', async () => {
|
|
87
|
+
const css = await Bun.file(new URL('../../../tailwind.css', import.meta.url)).text();
|
|
88
|
+
// The colour mode is the one place a user asks for chroma, so the states are
|
|
89
|
+
// colour there. Both are MIXED TOWARD THE INK, which is a contrast budget:
|
|
90
|
+
// at full strength the ring measured 2.73:1 and the fill 1.75:1 worst case
|
|
91
|
+
// over the 63 palettes, both under the 3:1 non-text floor; 75%/55% clear
|
|
92
|
+
// 3.56:1 (`solarized-dark`) and 3.63:1 (`nord-light`) on the real chrome
|
|
93
|
+
// composite, and the tick's `paper` clears 3.59:1 on the same fill.
|
|
94
|
+
expect(css).toContain('[data-icon-style="color"] .kabmo-checkbox {\n border-color: color-mix(in srgb, var(--theme-error) 75%, var(--theme-ink));');
|
|
95
|
+
expect(css).toContain('background-color: color-mix(in srgb, var(--theme-success) 55%, var(--theme-ink));');
|
|
96
|
+
// Hover stops at 85%, not the raw error colour: at 100% the ring drops to
|
|
97
|
+
// 2.77:1 on `mono-light`, i.e. the highlight would be less legible than the
|
|
98
|
+
// idle state it is meant to emphasise.
|
|
99
|
+
expect(css).toContain('border-color: color-mix(in srgb, var(--theme-error) 85%, var(--theme-ink));');
|
|
100
|
+
// Gated on the attribute: monochrome has no colour to state a state with, so
|
|
101
|
+
// it keeps the ink pair the base layer declares.
|
|
102
|
+
expect(css).not.toContain(':root:not([data-icon-style="color"]) .kabmo-checkbox {');
|
|
103
|
+
const mono = css.slice(0, css.indexOf('[data-icon-style="color"] .kabmo-checkbox'));
|
|
104
|
+
expect(mono).toContain('background-color: var(--theme-ink);');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The switch knob is a SHAPE, and `bg-canvas` is the app's ground.
|
|
110
|
+
*
|
|
111
|
+
* Under the glass surface a canvas well goes transparent — correct for a chat
|
|
112
|
+
* well, fatal for a knob: measured on the plugin switches in dark, the 12px knob
|
|
113
|
+
* composited to `rgba(0,0,0,0)` and the control rendered as a plain pill with no
|
|
114
|
+
* "on" position at all. The mark is the switch ROLE, so any control that declares
|
|
115
|
+
* itself a switch owns its knob whatever it paints it with.
|
|
116
|
+
*/
|
|
117
|
+
describe('switch knob', () => {
|
|
118
|
+
test('the switch track states on/off in the same two colours as the checkbox', async () => {
|
|
119
|
+
const css = await Bun.file(new URL('../../../tailwind.css', import.meta.url)).text();
|
|
120
|
+
// Keyed on the ROLE and `aria-checked`, not a class: six call sites paint the
|
|
121
|
+
// track with five different utilities, and none of them is the fact "on".
|
|
122
|
+
expect(css).toContain('[data-icon-style="color"] [role="switch"][aria-checked="true"] {');
|
|
123
|
+
expect(css).toContain('background-color: color-mix(in srgb, var(--theme-success) 55%, var(--theme-ink));');
|
|
124
|
+
expect(css).toContain('[data-icon-style="color"] [role="switch"][aria-checked="false"] {');
|
|
125
|
+
expect(css).toContain('background-color: color-mix(in srgb, var(--theme-error) 75%, var(--theme-ink));');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('a knob on a switch keeps its fill under the glass surface', async () => {
|
|
129
|
+
const glass = await Bun.file(new URL('../../../glass.css', import.meta.url)).text();
|
|
130
|
+
expect(glass).toContain('[data-surface="glass"] .app-window [role="switch"] .bg-canvas {');
|
|
131
|
+
expect(glass).toContain('background-color: var(--theme-canvas);');
|
|
132
|
+
// The exemption must come AFTER the well rule it overrides, or source order
|
|
133
|
+
// hands the knob back to the transparent one at equal specificity.
|
|
134
|
+
const well = glass.indexOf('[data-surface="glass"] .app-window .bg-canvas:not(.app-window) {');
|
|
135
|
+
const knob = glass.indexOf('[data-surface="glass"] .app-window [role="switch"] .bg-canvas {');
|
|
136
|
+
expect(well).toBeGreaterThan(-1);
|
|
137
|
+
expect(knob).toBeGreaterThan(well);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The checkbox, drawn by us instead of by the engine.
|
|
8
|
+
*
|
|
9
|
+
* A native `<input type="checkbox">` with `accent-color` is the right CONTROL —
|
|
10
|
+
* it carries checked/indeterminate, keyboard behaviour and the announcement for
|
|
11
|
+
* free — but its rendering is the platform's, and the platform disagrees with
|
|
12
|
+
* this app about what "on" and "off" look like:
|
|
13
|
+
*
|
|
14
|
+
* - **The unchecked box is nearly invisible.** Measured in the session sidebar
|
|
15
|
+
* (batch selection), the unchecked box composited to `(236,238,235)` on a
|
|
16
|
+
* `(250,248,242)` row — **1.10:1** — while the checked one was 10.84:1. Two
|
|
17
|
+
* states 10 points apart in luminance are not a control you can read; the
|
|
18
|
+
* report was "checkbox gk kelihatan on off nya".
|
|
19
|
+
* - **The checked box is the platform's accent**, not the palette's: Chromium
|
|
20
|
+
* paints `accent-color` as a FILL and then whichever glyph it likes, so the
|
|
21
|
+
* tint tracks `--theme-ink` here but the tick colour, the corner radius and the
|
|
22
|
+
* size are the engine's.
|
|
23
|
+
* - **The indeterminate dash** is a property with no attribute equivalent, so a
|
|
24
|
+
* styled span could not carry it anyway.
|
|
25
|
+
*
|
|
26
|
+
* So the input STAYS (same semantics, same `indeterminate` assignment) and only
|
|
27
|
+
* its box is replaced: `appearance: none` plus a pseudo-element that states each
|
|
28
|
+
* state explicitly, in palette tokens.
|
|
29
|
+
*
|
|
30
|
+
* **The numbers are a contrast budget, not taste.** The unchecked ring needs 3:1
|
|
31
|
+
* against the surface it sits on — WCAG's non-text floor, the same one the brand
|
|
32
|
+
* marks use — and a `text-ink/NN` alpha is the only way to reach it on every
|
|
33
|
+
* palette: measured across all 43, `ink 75%` is the first alpha whose worst case
|
|
34
|
+
* clears the floor (3.02:1 on `solarized-light`); 60% is 2.34:1 and 40% — the
|
|
35
|
+
* `border-ink/30` these controls shipped with — is **1.71:1**. The checked fill
|
|
36
|
+
* is the full ink, which makes the tick `paper`, so the pair is the palette's
|
|
37
|
+
* own `ink`/`paper` contrast: 4.85:1 worst case, 17.5:1 on `paper`.
|
|
38
|
+
*
|
|
39
|
+
* `accent-color` is left set as well: a browser that cannot draw the
|
|
40
|
+
* pseudo-element still gets the platform control rather than a blank square.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `appearance: none` plus a state pseudo-element, in ONE class so 22 call sites
|
|
45
|
+
* cannot drift into 22 slightly different boxes.
|
|
46
|
+
*
|
|
47
|
+
* The rules live in `tailwind.css` (`.kabmo-checkbox`) rather than here because
|
|
48
|
+
* they are CSS-only facts about a state selector — `checked`, `indeterminate`,
|
|
49
|
+
* `disabled` — that no component can express.
|
|
50
|
+
*/
|
|
51
|
+
export const CHECKBOX_CLASS = 'kabmo-checkbox';
|
|
@@ -99,8 +99,8 @@ export function ContextUsageButton({ sessionId, layout = 'desktop' }: ContextUsa
|
|
|
99
99
|
aria-label="Context usage"
|
|
100
100
|
className={
|
|
101
101
|
layout === 'mobile'
|
|
102
|
-
? 'fixed z-50 bg-paper border border-ink/20 rounded-xl shadow-xl p-3 text-xs font-mono'
|
|
103
|
-
: 'absolute right-0 top-full z-50 mt-2 w-56 bg-paper border border-ink/20 rounded-xl shadow-xl p-3 text-xs font-mono'
|
|
102
|
+
? 'glass-popover fixed z-50 bg-paper border border-ink/20 rounded-xl shadow-xl p-3 text-xs font-mono'
|
|
103
|
+
: 'glass-popover absolute right-0 top-full z-50 mt-2 w-56 bg-paper border border-ink/20 rounded-xl shadow-xl p-3 text-xs font-mono'
|
|
104
104
|
}
|
|
105
105
|
style={
|
|
106
106
|
layout === 'mobile'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
FolderOpen,
|
|
12
12
|
} from 'lucide-preact';
|
|
13
13
|
import type { ReactNode } from 'preact/compat';
|
|
14
|
-
import { BRAND_ICONS, BRAND_VIEWBOX, type BrandIconName } from '@/
|
|
14
|
+
import { BRAND_ICONS, BRAND_VIEWBOX, type BrandIconName } from '@/shared/lib/icons/file-brand-paths';
|
|
15
15
|
import { getImageMimeType } from '@/shared/lib/fs/file-kind';
|
|
16
16
|
|
|
17
17
|
interface FileIconProps {
|
|
@@ -22,9 +22,18 @@ interface FileIconProps {
|
|
|
22
22
|
className?: string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
/**
|
|
26
|
+
* A brand icon rendered from static path data.
|
|
27
|
+
*
|
|
28
|
+
* The paint is CSS, not a prop: the mark is always `fill="currentColor"` and
|
|
29
|
+
* carries `data-file-brand`, which `icon-paint-css.ts` colours under
|
|
30
|
+
* `[data-icon-style="color"]` (and leaves ink otherwise). That is what makes the
|
|
31
|
+
* setting reach 30-odd call sites without a prop at any of them.
|
|
32
|
+
*
|
|
33
|
+
* `monochrome` is the explicit OPT-OUT, for a surface that must stay free of
|
|
34
|
+
* chroma whatever the setting says — the chat's tool cards, where a coloured
|
|
35
|
+
* logo beside every tool name would compete with the tool's own state colour.
|
|
36
|
+
*/
|
|
28
37
|
function BrandIconSvg({ name, size, className, monochrome = false }: { name: BrandIconName; size: number; className?: string; monochrome?: boolean }) {
|
|
29
38
|
const brand = BRAND_ICONS[name];
|
|
30
39
|
return (
|
|
@@ -32,7 +41,8 @@ function BrandIconSvg({ name, size, className, monochrome = false }: { name: Bra
|
|
|
32
41
|
viewBox={BRAND_VIEWBOX}
|
|
33
42
|
width={size}
|
|
34
43
|
height={size}
|
|
35
|
-
fill=
|
|
44
|
+
fill="currentColor"
|
|
45
|
+
data-file-brand={monochrome ? undefined : name}
|
|
36
46
|
className={className}
|
|
37
47
|
aria-hidden="true"
|
|
38
48
|
>
|
|
@@ -126,7 +136,7 @@ export function FileIcon({ name, isFolder, isOpen, size = 14, className = '' }:
|
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
if (lowerName.endsWith('.json')) {
|
|
129
|
-
return <Braces size={size}
|
|
139
|
+
return <Braces size={size} className={className} />;
|
|
130
140
|
}
|
|
131
141
|
if (lowerName.endsWith('.css') || lowerName.endsWith('.scss')) {
|
|
132
142
|
return <BrandIconSvg name="Css" size={size} className={className} />;
|
|
@@ -138,11 +148,15 @@ export function FileIcon({ name, isFolder, isOpen, size = 14, className = '' }:
|
|
|
138
148
|
// document icon for PDF/Word. Each has a viewer behind it, so the glyph is
|
|
139
149
|
// what tells a user at a glance that the file opens as something other than
|
|
140
150
|
// source text.
|
|
151
|
+
// These four used to carry inline hexes (`#22c55e`, `#f97316`, `#c084fc`),
|
|
152
|
+
// which made them the only icons in the app that ignored BOTH modes. Their
|
|
153
|
+
// hue is now a role in `shared/lib/icons/tint.ts`, so the palette decides it
|
|
154
|
+
// and `monochrome` finally reaches them.
|
|
141
155
|
if (lowerName.endsWith('.csv') || lowerName.endsWith('.tsv') || lowerName.endsWith('.xlsx') || lowerName.endsWith('.xlsm')) {
|
|
142
|
-
return <FileSpreadsheet size={size}
|
|
156
|
+
return <FileSpreadsheet size={size} className={className} />;
|
|
143
157
|
}
|
|
144
158
|
if (lowerName.endsWith('.pdf') || lowerName.endsWith('.docx')) {
|
|
145
|
-
return <FileType size={size}
|
|
159
|
+
return <FileType size={size} className={className} />;
|
|
146
160
|
}
|
|
147
161
|
if (lowerName.endsWith('.md') || lowerName.endsWith('.txt')) {
|
|
148
162
|
return <FileText size={size} className={`text-ink/70 ${className}`} />;
|
|
@@ -150,7 +164,7 @@ export function FileIcon({ name, isFolder, isOpen, size = 14, className = '' }:
|
|
|
150
164
|
// SVG is text the editor edits as code, but it is still a picture to the eye,
|
|
151
165
|
// so the icon stays the image glyph for it.
|
|
152
166
|
if (getImageMimeType(lowerName) || lowerName.endsWith('.svg')) {
|
|
153
|
-
return <FileImage size={size}
|
|
167
|
+
return <FileImage size={size} className={className} />;
|
|
154
168
|
}
|
|
155
169
|
if (lowerName.endsWith('.sh') || lowerName.endsWith('.bash')) {
|
|
156
170
|
return <BrandIconSvg name="Gnubash" size={size} className={className} />;
|
|
@@ -111,7 +111,7 @@ export function HeaderMoreMenu({ entries = [] }: { entries?: HeaderEntry[] }) {
|
|
|
111
111
|
{open && (
|
|
112
112
|
<div
|
|
113
113
|
role="menu"
|
|
114
|
-
className="absolute right-0 top-full mt-1 w-44 bg-paper border border-ink/15 rounded-xl shadow-lg z-50 py-1 text-xs"
|
|
114
|
+
className="glass-popover absolute right-0 top-full mt-1 w-44 bg-paper border border-ink/15 rounded-xl shadow-lg z-50 py-1 text-xs"
|
|
115
115
|
>
|
|
116
116
|
<button
|
|
117
117
|
type="button"
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The judge panel: two answers, one note.
|
|
8
|
+
*
|
|
9
|
+
* Fixed at the rectangle the click reported rather than tracking its block. A
|
|
10
|
+
* rendered document rehydrates (mermaid, math, directives) and every hydrate
|
|
11
|
+
* moves blocks, so anything that measured once and followed would drift away
|
|
12
|
+
* from what it describes; a scroll closes it instead, which is also the moment
|
|
13
|
+
* the block under it is no longer where the user is looking.
|
|
14
|
+
*
|
|
15
|
+
* The two answers are `aria-pressed` buttons, not a radio or a checkbox: the
|
|
16
|
+
* pressed state IS the judgement, and a screen reader has to hear which one it
|
|
17
|
+
* is without counting options.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { useEffect, useRef } from 'preact/hooks';
|
|
21
|
+
import { Check, X } from 'lucide-preact';
|
|
22
|
+
|
|
23
|
+
import type { BlockVerdict, MdBlock } from '@/shared/lib/markdown/blocks/types';
|
|
24
|
+
import { ACTION_CLASS } from '@/client/components/workspace/editor/toolbar-toggle';
|
|
25
|
+
|
|
26
|
+
interface ReviewPopoverProps {
|
|
27
|
+
block: MdBlock;
|
|
28
|
+
verdict: BlockVerdict | null;
|
|
29
|
+
note: string;
|
|
30
|
+
anchor: { top: number; left: number };
|
|
31
|
+
onSave: (verdict: BlockVerdict, note: string) => void;
|
|
32
|
+
onRemove: () => void;
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function rangeOf(block: MdBlock): string {
|
|
37
|
+
return block.lineStart === block.lineEnd ? `L${block.lineStart}` : `L${block.lineStart}-${block.lineEnd}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function ReviewPopover({ block, verdict, note, anchor, onSave, onRemove, onClose }: ReviewPopoverProps) {
|
|
41
|
+
// The whole panel is one form, so the draft lives in the DOM rather than in
|
|
42
|
+
// state: two saves of the same block would otherwise need a re-seed effect,
|
|
43
|
+
// and the `key` on this element already re-mounts it per block.
|
|
44
|
+
const form = useRef<HTMLDivElement | null>(null);
|
|
45
|
+
const field = useRef<HTMLTextAreaElement | null>(null);
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
field.current?.focus();
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const onKey = (event: KeyboardEvent) => {
|
|
53
|
+
if (event.key !== 'Escape') return;
|
|
54
|
+
// `stopPropagation`, not `preventDefault`: Escape is also the panel's own
|
|
55
|
+
// chord for closing the find bar, and the innermost scope must win.
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
onClose();
|
|
58
|
+
};
|
|
59
|
+
// Capture, so the panel's own keydown handler cannot consume it first.
|
|
60
|
+
window.addEventListener('keydown', onKey, true);
|
|
61
|
+
return () => window.removeEventListener('keydown', onKey, true);
|
|
62
|
+
}, [onClose]);
|
|
63
|
+
|
|
64
|
+
const submit = (chosen: BlockVerdict) => onSave(chosen, field.current?.value ?? note);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
ref={form}
|
|
69
|
+
role="dialog"
|
|
70
|
+
aria-label={`Review block ${rangeOf(block)}`}
|
|
71
|
+
// `fixed`, from the click's own rectangle — see the module note.
|
|
72
|
+
style={{ top: `${anchor.top}px`, left: `${anchor.left}px` }}
|
|
73
|
+
className="glass-popover fixed z-[65] w-[min(24rem,calc(100vw-2rem))] rounded-md border border-ink/15 bg-paper shadow-lg p-2 font-sans text-[11.5px] text-ink"
|
|
74
|
+
onClick={(event) => event.stopPropagation()}
|
|
75
|
+
>
|
|
76
|
+
<div className="flex items-center gap-1.5 text-[10.5px] font-mono text-ink/50">
|
|
77
|
+
<span>{rangeOf(block)}</span>
|
|
78
|
+
<span className="truncate">«{block.quote}»</span>
|
|
79
|
+
<button
|
|
80
|
+
type="button"
|
|
81
|
+
onClick={onClose}
|
|
82
|
+
className="ml-auto cursor-pointer text-ink/50 hover:text-ink"
|
|
83
|
+
aria-label="Close review"
|
|
84
|
+
>
|
|
85
|
+
<X size={12} />
|
|
86
|
+
</button>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div className="mt-1.5 flex items-center gap-1.5">
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
aria-pressed={verdict === 'good'}
|
|
93
|
+
title="This block is good — do not change it"
|
|
94
|
+
onClick={() => submit('good')}
|
|
95
|
+
className={`${ACTION_CLASS} border px-2 text-[11px] ${
|
|
96
|
+
verdict === 'good' ? 'border-ink bg-ink/10 text-ink' : 'border-ink/15 text-ink/70 hover:border-ink/40'
|
|
97
|
+
}`}
|
|
98
|
+
>
|
|
99
|
+
<Check size={11} /> Good
|
|
100
|
+
</button>
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
aria-pressed={verdict === 'needs-work'}
|
|
104
|
+
title="This block needs work"
|
|
105
|
+
onClick={() => submit('needs-work')}
|
|
106
|
+
className={`${ACTION_CLASS} border px-2 text-[11px] ${
|
|
107
|
+
verdict === 'needs-work' ? 'border-error bg-error/10 text-error' : 'border-ink/15 text-ink/70 hover:border-ink/40'
|
|
108
|
+
}`}
|
|
109
|
+
>
|
|
110
|
+
<X size={11} /> Needs work
|
|
111
|
+
</button>
|
|
112
|
+
{verdict && (
|
|
113
|
+
<button
|
|
114
|
+
type="button"
|
|
115
|
+
onClick={onRemove}
|
|
116
|
+
className={`${ACTION_CLASS} ml-auto border border-ink/15 px-2 text-[11px] text-ink/60 hover:text-error`}
|
|
117
|
+
>
|
|
118
|
+
Remove
|
|
119
|
+
</button>
|
|
120
|
+
)}
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<textarea
|
|
124
|
+
ref={field}
|
|
125
|
+
defaultValue={note}
|
|
126
|
+
rows={3}
|
|
127
|
+
placeholder="What is wrong — or what is right — with this block…"
|
|
128
|
+
onKeyDown={(event) => {
|
|
129
|
+
// ⌘↵ saves the CURRENT verdict; a block with none is not saved by a
|
|
130
|
+
// keystroke that cannot say which answer it means.
|
|
131
|
+
if (event.key === 'Enter' && (event.metaKey || event.ctrlKey) && verdict) {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
submit(verdict);
|
|
134
|
+
}
|
|
135
|
+
}}
|
|
136
|
+
className="mt-1.5 w-full resize-y rounded border border-ink/15 bg-canvas/40 px-2 py-1 text-[11px] font-sans outline-none focus:border-ink"
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<div className="mt-1 flex items-center gap-1.5 text-[10.5px] text-ink/45">
|
|
140
|
+
<span>Click an answer to save · ⌘↵ keeps the note with it</span>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The review's totals, the way out, and the marks that no longer fit.
|
|
8
|
+
*
|
|
9
|
+
* Two rules this bar exists to keep:
|
|
10
|
+
*
|
|
11
|
+
* - **An outdated mark is SHOWN.** Its block was edited, so it matches nothing
|
|
12
|
+
* rendered — but the note is still the user's and the only copy of it.
|
|
13
|
+
* Dropping it silently is the one thing a review tool must never do, so it is
|
|
14
|
+
* listed with its stored quote and a Remove of its own.
|
|
15
|
+
* - **Sending is a prefill.** The button says "to the chat box": it writes the
|
|
16
|
+
* draft and focuses the composer. A review the user never read before it
|
|
17
|
+
* reached the agent is how a wrong note becomes an instruction.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { Send, X } from 'lucide-preact';
|
|
21
|
+
|
|
22
|
+
import type { DocumentAnnotation } from '@/shared/lib/markdown/blocks/types';
|
|
23
|
+
|
|
24
|
+
interface ReviewSummaryProps {
|
|
25
|
+
counts: { good: number; needsWork: number };
|
|
26
|
+
outdated: readonly DocumentAnnotation[];
|
|
27
|
+
error: string | null;
|
|
28
|
+
/** True once the block reached the composer, so the bar can say so. */
|
|
29
|
+
sent: boolean;
|
|
30
|
+
onSend: () => void;
|
|
31
|
+
onRemoveOutdated: (id: string) => void;
|
|
32
|
+
onExit: () => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function rangeOf(annotation: DocumentAnnotation): string {
|
|
36
|
+
return annotation.lineStart === annotation.lineEnd
|
|
37
|
+
? `L${annotation.lineStart}`
|
|
38
|
+
: `L${annotation.lineStart}-${annotation.lineEnd}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function ReviewSummary({ counts, outdated, error, sent, onSend, onRemoveOutdated, onExit }: ReviewSummaryProps) {
|
|
42
|
+
const total = counts.good + counts.needsWork;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="sticky bottom-0 z-40 mt-2 border-t border-ink/10 bg-paper/95 px-1 py-2 backdrop-blur">
|
|
46
|
+
{outdated.length > 0 && (
|
|
47
|
+
<div className="mb-1.5 space-y-1">
|
|
48
|
+
<div className="text-[10px] uppercase font-mono text-ink/40">
|
|
49
|
+
{outdated.length} outdated — the block was edited or is no longer rendered
|
|
50
|
+
</div>
|
|
51
|
+
{outdated.map((annotation) => (
|
|
52
|
+
<div key={annotation.id} className="flex items-start gap-1.5 text-[11px] text-ink/60">
|
|
53
|
+
<span className="font-mono text-[10.5px] text-ink/40">{rangeOf(annotation)}</span>
|
|
54
|
+
{/* Both halves, because they say different things: the QUOTE is
|
|
55
|
+
the block this note was written about, the NOTE is what the
|
|
56
|
+
user said about it — and the note is the reason the row is
|
|
57
|
+
worth keeping at all. */}
|
|
58
|
+
<span className="min-w-0 flex-1">
|
|
59
|
+
<span className="block truncate text-ink/45">{annotation.quote || '(block text unavailable)'}</span>
|
|
60
|
+
{annotation.note.trim() && <span className="block truncate text-ink/70">{annotation.note}</span>}
|
|
61
|
+
</span>
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
onClick={() => onRemoveOutdated(annotation.id)}
|
|
65
|
+
className="cursor-pointer text-ink/40 hover:text-error"
|
|
66
|
+
aria-label={`Remove outdated annotation at ${rangeOf(annotation)}`}
|
|
67
|
+
>
|
|
68
|
+
<X size={11} />
|
|
69
|
+
</button>
|
|
70
|
+
</div>
|
|
71
|
+
))}
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{error && (
|
|
76
|
+
<div role="alert" className="mb-1.5 text-[11px] text-error">
|
|
77
|
+
{error}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
|
|
81
|
+
<div className="flex items-center gap-2 font-sans text-[11px]">
|
|
82
|
+
<span className="text-ink/70">
|
|
83
|
+
<span className="text-ink">{counts.good}</span> good ·{' '}
|
|
84
|
+
<span className="text-error">{counts.needsWork}</span> needs work
|
|
85
|
+
</span>
|
|
86
|
+
{sent && <span className="text-ink/50">Added to the chat box</span>}
|
|
87
|
+
<button
|
|
88
|
+
type="button"
|
|
89
|
+
onClick={onExit}
|
|
90
|
+
className="ml-auto cursor-pointer p-1 text-ink/50 hover:text-ink"
|
|
91
|
+
title="Exit review mode"
|
|
92
|
+
aria-label="Exit review mode"
|
|
93
|
+
>
|
|
94
|
+
<X size={13} />
|
|
95
|
+
</button>
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
disabled={total === 0}
|
|
99
|
+
onClick={onSend}
|
|
100
|
+
title="Put this review into the chat box — you still choose to send it"
|
|
101
|
+
className="flex items-center gap-1 rounded border border-ink bg-ink px-2 py-1 text-canvas transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed"
|
|
102
|
+
>
|
|
103
|
+
<Send size={11} /> Send to chat
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|