@kabmo-labs/kabmo 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +523 -441
- package/dist/client/static/js/{index-rerjq5th.js → index-fcee4c13.js} +828 -818
- package/dist/client/static/js/index-sxdw908m.css +1 -0
- package/marketplace/plugins/command-runner/package.json +3 -2
- package/marketplace/plugins/git-forge/package.json +3 -2
- package/marketplace/plugins/session-info/package.json +3 -2
- package/marketplace/plugins/stats/package.json +3 -2
- package/package.json +3 -1
- package/src/client/components/auth/login-screen/index.tsx +2 -1
- package/src/client/components/common/ComposerPicker.tsx +1 -1
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/Modal.tsx +2 -2
- package/src/client/components/common/PWAInstallButton.tsx +2 -2
- package/src/client/components/common/ViewportSelector.tsx +1 -1
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +147 -0
- package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
- package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
- package/src/client/components/common/brand-wordmark/index.tsx +13 -2
- package/src/client/components/common/checkbox/style.test.ts +139 -0
- package/src/client/components/common/checkbox/style.ts +51 -0
- package/src/client/components/common/context-usage-button/index.tsx +2 -2
- package/src/client/components/common/file-icon/index.tsx +23 -9
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
- package/src/client/components/common/markdown-review/index.tsx +129 -0
- package/src/client/components/common/panel-mark/index.tsx +97 -0
- package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
- package/src/client/components/common/provider-icon/index.test.ts +14 -0
- package/src/client/components/common/provider-icon/index.tsx +4 -0
- package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
- package/src/client/components/common/provider-icon/resolve.ts +16 -3
- package/src/client/components/common/server-control/Panel.tsx +33 -23
- package/src/client/components/common/server-control/index.test.tsx +11 -5
- package/src/client/components/common/server-control/index.tsx +10 -8
- package/src/client/components/common/session-actions-menu/index.tsx +1 -1
- package/src/client/components/common/toolbar-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +22 -3
- package/src/client/components/layout/LeftDock.tsx +9 -2
- package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
- package/src/client/components/layout/WindowAura.tsx +27 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
- package/src/client/components/layout/desktop-layout/index.tsx +3 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +44 -23
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
- package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
- package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +40 -14
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
- package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
- package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
- package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/mobile/panel-chips.tsx +10 -2
- package/src/client/components/settings/Modal.tsx +4 -4
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/apply-side-effects.test.ts +30 -0
- package/src/client/components/settings/apply-side-effects.ts +14 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
- package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
- package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
- package/src/client/components/settings/categories/McpSettings.tsx +4 -21
- package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
- package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +93 -77
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +28 -15
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
- package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
- package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
- package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +37 -8
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
- package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
- package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
- package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
- package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
- package/src/client/components/workspace/browser-panel/index.tsx +50 -4
- package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
- package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
- package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
- package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
- package/src/client/components/workspace/diff-panel/changes.ts +28 -12
- package/src/client/components/workspace/diff-panel/index.tsx +2 -2
- package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
- package/src/client/components/workspace/diff-panel/merge.ts +21 -1
- package/src/client/components/workspace/editor/Body.tsx +7 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
- package/src/client/components/workspace/editor/FilePane.tsx +12 -0
- package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
- package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
- package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +25 -22
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
- package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
- package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
- package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
- package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
- package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- package/src/client/components/workspace/git-panel/index.tsx +7 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
- package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
- package/src/client/components/workspace/search-panel/Body.tsx +1 -1
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
- package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
- package/src/client/data/agent-data/builtin.ts +0 -10
- package/src/client/data/agent-data/orchestrator.ts +0 -45
- package/src/client/data/agent-data/specialist.ts +0 -100
- package/src/client/data/mock/token-usage.ts +170 -120
- package/src/client/data/settings/omp-schema.json +33 -1
- package/src/client/glass.css +785 -0
- package/src/client/glass.test.ts +346 -0
- package/src/client/hooks/browser/use-annotate.test.ts +143 -0
- package/src/client/hooks/browser/use-annotate.ts +98 -0
- package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
- package/src/client/hooks/browser/use-close-tab.ts +67 -0
- package/src/client/hooks/browser/use-screencast.ts +13 -1
- package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
- package/src/client/hooks/chat/composer/browser-context.ts +40 -16
- package/src/client/hooks/chat/composer/items.test.ts +1 -1
- package/src/client/hooks/chat/composer/review-context.ts +38 -0
- package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
- package/src/client/hooks/chat/composer/use-draft.ts +31 -2
- package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
- package/src/client/hooks/editor/use-document-annotations.ts +124 -0
- package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
- package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
- package/src/client/hooks/editor/use-preview-review.ts +148 -0
- package/src/client/hooks/settings/agents.ts +149 -0
- package/src/client/hooks/settings/crud-list.test.ts +28 -6
- package/src/client/hooks/settings/crud-list.ts +96 -57
- package/src/client/hooks/settings/omp-config.ts +164 -0
- package/src/client/hooks/settings/useTokenUsage.ts +125 -0
- package/src/client/hooks/settings/write-feedback.test.ts +104 -0
- package/src/client/hooks/settings/write-feedback.ts +63 -0
- package/src/client/hooks/ui/glass-support.ts +57 -0
- package/src/client/hooks/ui/icon-style.ts +59 -0
- package/src/client/hooks/ui/markdown-hydration.ts +125 -0
- package/src/client/hooks/ui/stuck-header.test.ts +188 -0
- package/src/client/hooks/ui/stuck-header.ts +91 -0
- package/src/client/hooks/ui/style-attributes.test.ts +120 -0
- package/src/client/hooks/ui/surface-style.ts +56 -0
- package/src/client/hooks/ui/updates/index.test.ts +100 -1
- package/src/client/hooks/ui/updates/index.ts +50 -0
- package/src/client/hooks/ui/updates/notes.test.ts +138 -0
- package/src/client/hooks/ui/updates/notes.ts +57 -0
- package/src/client/hooks/workspace/panel-hues.ts +23 -0
- package/src/client/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/main.tsx +10 -0
- package/src/client/tailwind.css +329 -11
- package/src/server/lib/assets/shell-attributes.server.ts +80 -0
- package/src/server/lib/assets/shell-attributes.test.ts +86 -0
- package/src/server/lib/btw/lifecycle.server.ts +2 -2
- package/src/server/lib/db/schema.ts +7 -0
- package/src/server/lib/db/seed-terminal.test.ts +4 -0
- package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
- package/src/server/lib/omp/config/agents.ts +231 -61
- package/src/server/lib/omp/config/definitions.test.ts +9 -105
- package/src/server/lib/omp/config/extensions.ts +16 -7
- package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
- package/src/server/lib/omp/rpc/constants.test.ts +11 -0
- package/src/server/lib/omp/rpc/constants.ts +15 -0
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
- package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/rpc/manager.ts +2 -2
- package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
- package/src/server/lib/omp/rpc/process.test.ts +106 -0
- package/src/server/lib/omp/rpc/process.ts +39 -18
- package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
- package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
- package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
- package/src/server/lib/omp/rpc/session-commands.ts +17 -3
- package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
- package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
- package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
- package/src/server/lib/omp/rpc/utility.ts +12 -0
- package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
- package/src/server/lib/panels/manifest.test.ts +20 -0
- package/src/server/lib/panels/manifest.ts +12 -0
- package/src/server/lib/panels/scan.server.ts +4 -0
- package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
- package/src/server/lib/queue/delivery-harness.ts +8 -4
- package/src/server/lib/queue/delivery.server.test.ts +29 -0
- package/src/server/lib/queue/delivery.server.ts +39 -0
- package/src/server/lib/queue/store.server.test.ts +22 -2
- package/src/server/lib/queue/store.server.ts +33 -11
- package/src/server/lib/review/schema.server.ts +45 -0
- package/src/server/lib/review/store.server.ts +138 -0
- package/src/server/lib/terminal/attach-replay.test.ts +132 -0
- package/src/server/lib/terminal/output.test.ts +166 -0
- package/src/server/lib/terminal/output.ts +104 -0
- package/src/server/lib/terminal/runtime.server.ts +5 -0
- package/src/server/lib/terminal/send-result.test.ts +33 -0
- package/src/server/lib/terminal/send-result.ts +32 -0
- package/src/server/lib/terminal/session.server.ts +45 -11
- package/src/server/lib/terminal/store-liveness.test.ts +4 -0
- package/src/server/lib/updates/active-notes.test.ts +149 -0
- package/src/server/lib/updates/active-notes.ts +75 -0
- package/src/server/lib/updates/changelog-file.ts +42 -11
- package/src/server/lib/updates/changelog.test.ts +15 -1
- package/src/server/lib/updates/omp.ts +42 -15
- package/src/server/lib/updates/release-url.ts +27 -1
- package/src/server/lib/usage/index-parse.test.ts +200 -0
- package/src/server/lib/usage/index-parse.ts +178 -0
- package/src/server/lib/usage/index-query.server.ts +248 -0
- package/src/server/lib/usage/index-scan.server.ts +343 -0
- package/src/server/lib/usage/index-schema.server.ts +82 -0
- package/src/server/lib/usage/index.test.ts +234 -0
- package/src/server/lib/usage/providers.server.ts +4 -53
- package/src/server/plugins/ssr.ts +22 -5
- package/src/server/routes/browser/index.ts +3 -0
- package/src/server/routes/browser/stream.ts +31 -2
- package/src/server/routes/browser/tabs.test.ts +94 -0
- package/src/server/routes/browser/tabs.ts +85 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/review/bindings.ts +11 -0
- package/src/server/routes/review/index.ts +127 -0
- package/src/server/routes/review/routes.test.ts +191 -0
- package/src/server/routes/settings/agents.test.ts +180 -0
- package/src/server/routes/settings/agents.ts +95 -102
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
- package/src/server/routes/telemetry/tokens.test.ts +145 -0
- package/src/server/routes/telemetry/tokens.ts +70 -149
- package/src/server/routes/terminal/ws.ts +6 -5
- package/src/server/routes/updates/index.ts +2 -0
- package/src/server/routes/updates/notes.ts +34 -0
- package/src/server/routes/updates/routes.test.ts +49 -0
- package/src/shared/lib/browser/annotate.test.ts +283 -0
- package/src/shared/lib/browser/annotate.ts +231 -0
- package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
- package/src/shared/lib/browser/frame-gate.test.ts +91 -0
- package/src/shared/lib/browser/frame-gate.ts +69 -0
- package/src/shared/lib/browser/frame-params.test.ts +43 -0
- package/src/shared/lib/browser/frame-params.ts +60 -0
- package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
- package/src/shared/lib/browser/frame-pipeline.ts +80 -0
- package/src/shared/lib/browser/page-context.ts +60 -4
- package/src/shared/lib/browser/snapshot.test.ts +115 -0
- package/src/shared/lib/browser/snapshot.ts +112 -0
- package/src/shared/lib/browser/tab-close.test.ts +74 -0
- package/src/shared/lib/browser/tab-close.ts +77 -0
- package/src/shared/lib/browser/viewer.ts +45 -26
- package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
- package/src/shared/lib/chat/tool/artifact.ts +55 -20
- package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
- package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
- package/src/shared/lib/chat/tool/minimized.ts +64 -0
- package/src/shared/lib/chat/tool/summary.test.ts +28 -8
- package/src/shared/lib/chat/tool/summary.ts +3 -32
- package/src/shared/lib/icons/file-brand-color.ts +38 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
- package/src/shared/lib/icons/icon-paint-css.ts +284 -0
- package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
- package/src/shared/lib/icons/tint.test.ts +273 -0
- package/src/shared/lib/icons/tint.ts +219 -0
- package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
- package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
- package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
- package/src/shared/lib/markdown/blocks/scan.ts +100 -0
- package/src/shared/lib/markdown/blocks/types.ts +62 -0
- package/src/shared/lib/markdown/marked.ts +58 -147
- package/src/shared/lib/markdown/math-extensions.ts +168 -0
- package/src/shared/lib/markdown/review/prompt.ts +77 -0
- package/src/shared/lib/markdown/review/reconcile.ts +55 -0
- package/src/shared/lib/markdown/review/review.test.ts +96 -0
- package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
- package/src/shared/lib/markdown/xml-sections.ts +139 -0
- package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
- package/src/shared/lib/models/provider/brand-color.ts +103 -0
- package/src/shared/lib/models/provider/label.ts +57 -0
- package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
- package/src/shared/lib/omp/config/agent-file.ts +43 -0
- package/src/shared/lib/omp/config/row-value.test.ts +95 -0
- package/src/shared/lib/omp/config/row-value.ts +97 -0
- package/src/shared/lib/omp/config/schema.test.ts +31 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +113 -47
- package/src/shared/lib/omp/rpc/frame.ts +107 -43
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/theme/catalog.test.ts +5 -4
- package/src/shared/lib/theme/catalog.ts +18 -3
- package/src/shared/lib/theme/glass-support.test.ts +38 -0
- package/src/shared/lib/theme/glass-support.ts +73 -0
- package/src/shared/lib/theme/icon-style.test.ts +74 -0
- package/src/shared/lib/theme/icon-style.ts +90 -0
- package/src/shared/lib/theme/legibility.ts +91 -0
- package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
- package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
- package/src/shared/lib/theme/surface-style.test.ts +68 -0
- package/src/shared/lib/theme/surface-style.ts +91 -0
- package/src/shared/lib/theme/theme.test.ts +11 -7
- package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -0
- package/src/shared/lib/usage/breakdown.test.ts +197 -0
- package/src/shared/lib/usage/breakdown.ts +241 -0
- package/src/shared/lib/usage/range.test.ts +204 -0
- package/src/shared/lib/usage/range.ts +240 -0
- package/src/shared/lib/usage/view.test.ts +85 -0
- package/src/shared/lib/usage/view.ts +74 -0
- package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
- package/src/shared/lib/workspace/panel-hues.ts +57 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/panels-registry.ts +6 -0
- package/src/shared/types/panels.ts +14 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/state.ts +30 -3
- package/src/shared/types/settings/write.ts +6 -0
- package/src/shared/types/tokenUsage.ts +128 -21
- package/src/shared/types/updates.ts +20 -0
- package/src/test-support/fake-omp-frames.ts +163 -0
- package/dist/client/static/js/index-3ve31rzx.css +0 -1
- package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
- package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
- package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
- package/src/server/lib/omp/session/usage/shaping.ts +0 -130
- /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* GENERATED by `scripts/icon-tints.mjs` — do not hand-edit.
|
|
8
|
+
*
|
|
9
|
+
* One hue per functional glyph, 36 hues 10° apart, assigned by a stable hash of
|
|
10
|
+
* the icon name. The signal icons in `tint.ts` are deliberately absent: they
|
|
11
|
+
* paint a palette token, because a trash can has to be the theme's error colour
|
|
12
|
+
* and not whatever the hash said.
|
|
13
|
+
*
|
|
14
|
+
* Regenerate with `bun run icons:tints` after adding an icon. The suite fails
|
|
15
|
+
* when this table and the imports disagree (`icons:tints:check`), so a stale
|
|
16
|
+
* table cannot ship.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const ICON_HUES: Readonly<Record<string, number>> = {
|
|
20
|
+
Activity: 240,
|
|
21
|
+
AlignJustify: 100,
|
|
22
|
+
AlignLeft: 150,
|
|
23
|
+
Archive: 50,
|
|
24
|
+
ArchiveRestore: 90,
|
|
25
|
+
ArrowDown: 100,
|
|
26
|
+
ArrowDownToLine: 330,
|
|
27
|
+
ArrowLeft: 350,
|
|
28
|
+
ArrowRight: 80,
|
|
29
|
+
ArrowUp: 150,
|
|
30
|
+
ArrowUpDown: 310,
|
|
31
|
+
BarChart3: 150,
|
|
32
|
+
Blocks: 110,
|
|
33
|
+
Bot: 220,
|
|
34
|
+
Box: 260,
|
|
35
|
+
Boxes: 220,
|
|
36
|
+
Brain: 350,
|
|
37
|
+
BrainCircuit: 300,
|
|
38
|
+
Briefcase: 310,
|
|
39
|
+
Camera: 60,
|
|
40
|
+
CaseSensitive: 110,
|
|
41
|
+
ChevronDown: 120,
|
|
42
|
+
ChevronLeft: 250,
|
|
43
|
+
ChevronRight: 300,
|
|
44
|
+
ChevronUp: 250,
|
|
45
|
+
ChevronsUpDown: 80,
|
|
46
|
+
Circle: 50,
|
|
47
|
+
CircleDot: 240,
|
|
48
|
+
ClipboardCopy: 280,
|
|
49
|
+
ClipboardList: 290,
|
|
50
|
+
ClipboardPaste: 200,
|
|
51
|
+
Cloud: 340,
|
|
52
|
+
CloudDownload: 300,
|
|
53
|
+
Code: 200,
|
|
54
|
+
Code2: 260,
|
|
55
|
+
Coins: 210,
|
|
56
|
+
Columns: 280,
|
|
57
|
+
Columns2: 20,
|
|
58
|
+
Command: 100,
|
|
59
|
+
Component: 200,
|
|
60
|
+
Copy: 320,
|
|
61
|
+
CopyPlus: 40,
|
|
62
|
+
CornerDownLeft: 10,
|
|
63
|
+
Cpu: 250,
|
|
64
|
+
Database: 280,
|
|
65
|
+
Dice5: 50,
|
|
66
|
+
Diff: 300,
|
|
67
|
+
DollarSign: 220,
|
|
68
|
+
Download: 210,
|
|
69
|
+
DownloadCloud: 180,
|
|
70
|
+
Edit2: 210,
|
|
71
|
+
Ellipsis: 100,
|
|
72
|
+
ExternalLink: 60,
|
|
73
|
+
Eye: 20,
|
|
74
|
+
EyeOff: 350,
|
|
75
|
+
File: 310,
|
|
76
|
+
FileCode: 260,
|
|
77
|
+
FileCog: 340,
|
|
78
|
+
FileEdit: 270,
|
|
79
|
+
FileImage: 40,
|
|
80
|
+
FilePlus: 350,
|
|
81
|
+
FilePlus2: 350,
|
|
82
|
+
FileSearch: 310,
|
|
83
|
+
FileText: 80,
|
|
84
|
+
Files: 320,
|
|
85
|
+
Flag: 350,
|
|
86
|
+
FlaskConical: 170,
|
|
87
|
+
Folder: 290,
|
|
88
|
+
FolderGit: 190,
|
|
89
|
+
FolderGit2: 190,
|
|
90
|
+
FolderInput: 310,
|
|
91
|
+
FolderOpen: 330,
|
|
92
|
+
FolderPlus: 250,
|
|
93
|
+
FolderSearch: 10,
|
|
94
|
+
FolderTree: 10,
|
|
95
|
+
Gamepad2: 300,
|
|
96
|
+
GitBranch: 30,
|
|
97
|
+
GitCommitVertical: 240,
|
|
98
|
+
GitCompare: 340,
|
|
99
|
+
GitFork: 30,
|
|
100
|
+
GitMerge: 90,
|
|
101
|
+
GitPullRequest: 10,
|
|
102
|
+
Globe: 340,
|
|
103
|
+
GraduationCap: 190,
|
|
104
|
+
GripVertical: 350,
|
|
105
|
+
Hammer: 310,
|
|
106
|
+
Hand: 200,
|
|
107
|
+
HardDrive: 0,
|
|
108
|
+
Hash: 330,
|
|
109
|
+
Heading: 250,
|
|
110
|
+
Heart: 270,
|
|
111
|
+
History: 110,
|
|
112
|
+
Home: 20,
|
|
113
|
+
Image: 140,
|
|
114
|
+
Key: 240,
|
|
115
|
+
KeyRound: 240,
|
|
116
|
+
Keyboard: 120,
|
|
117
|
+
Laptop: 170,
|
|
118
|
+
Layers: 30,
|
|
119
|
+
LayoutTemplate: 170,
|
|
120
|
+
Leaf: 50,
|
|
121
|
+
Library: 160,
|
|
122
|
+
Lightbulb: 0,
|
|
123
|
+
List: 170,
|
|
124
|
+
ListChecks: 320,
|
|
125
|
+
ListFilter: 230,
|
|
126
|
+
ListOrdered: 220,
|
|
127
|
+
ListTodo: 210,
|
|
128
|
+
ListTree: 330,
|
|
129
|
+
Loader2: 40,
|
|
130
|
+
Lock: 220,
|
|
131
|
+
LockKeyhole: 270,
|
|
132
|
+
LockOpen: 180,
|
|
133
|
+
LogIn: 140,
|
|
134
|
+
LogOut: 190,
|
|
135
|
+
Maximize: 310,
|
|
136
|
+
Maximize2: 270,
|
|
137
|
+
Menu: 100,
|
|
138
|
+
MessageSquare: 150,
|
|
139
|
+
MessageSquareOff: 40,
|
|
140
|
+
MessageSquarePlus: 350,
|
|
141
|
+
MessagesSquare: 220,
|
|
142
|
+
Mic: 160,
|
|
143
|
+
MicOff: 170,
|
|
144
|
+
Minimize: 290,
|
|
145
|
+
Minimize2: 130,
|
|
146
|
+
Minus: 110,
|
|
147
|
+
Monitor: 250,
|
|
148
|
+
Moon: 80,
|
|
149
|
+
MoreHorizontal: 160,
|
|
150
|
+
MousePointerClick: 70,
|
|
151
|
+
MoveVertical: 300,
|
|
152
|
+
Music: 280,
|
|
153
|
+
Package: 270,
|
|
154
|
+
Paintbrush: 250,
|
|
155
|
+
Palette: 320,
|
|
156
|
+
PanelLeft: 280,
|
|
157
|
+
PanelLeftClose: 160,
|
|
158
|
+
PanelRight: 330,
|
|
159
|
+
PanelRightClose: 350,
|
|
160
|
+
Paperclip: 310,
|
|
161
|
+
Pause: 10,
|
|
162
|
+
Pencil: 0,
|
|
163
|
+
PencilLine: 260,
|
|
164
|
+
Pin: 0,
|
|
165
|
+
PinOff: 50,
|
|
166
|
+
Pipette: 120,
|
|
167
|
+
Play: 310,
|
|
168
|
+
Plug: 50,
|
|
169
|
+
Plus: 210,
|
|
170
|
+
Power: 340,
|
|
171
|
+
Puzzle: 50,
|
|
172
|
+
Quote: 110,
|
|
173
|
+
Radio: 320,
|
|
174
|
+
Ratio: 160,
|
|
175
|
+
RefreshCw: 180,
|
|
176
|
+
Regex: 280,
|
|
177
|
+
Replace: 190,
|
|
178
|
+
ReplaceAll: 140,
|
|
179
|
+
Rocket: 210,
|
|
180
|
+
RotateCcw: 330,
|
|
181
|
+
RotateCw: 0,
|
|
182
|
+
Rows: 160,
|
|
183
|
+
Rows3: 250,
|
|
184
|
+
Save: 40,
|
|
185
|
+
SaveAll: 190,
|
|
186
|
+
Scissors: 260,
|
|
187
|
+
Search: 250,
|
|
188
|
+
Send: 110,
|
|
189
|
+
Server: 300,
|
|
190
|
+
ServerCog: 50,
|
|
191
|
+
Settings: 240,
|
|
192
|
+
Settings2: 20,
|
|
193
|
+
Shield: 160,
|
|
194
|
+
Shrink: 160,
|
|
195
|
+
Sliders: 290,
|
|
196
|
+
SlidersHorizontal: 50,
|
|
197
|
+
Smartphone: 20,
|
|
198
|
+
Space: 290,
|
|
199
|
+
Sparkles: 180,
|
|
200
|
+
Square: 60,
|
|
201
|
+
SquareFunction: 220,
|
|
202
|
+
SquarePen: 10,
|
|
203
|
+
Star: 170,
|
|
204
|
+
StickyNote: 100,
|
|
205
|
+
Store: 340,
|
|
206
|
+
Sun: 90,
|
|
207
|
+
Tablet: 290,
|
|
208
|
+
Tag: 310,
|
|
209
|
+
Target: 200,
|
|
210
|
+
Terminal: 210,
|
|
211
|
+
TextSelect: 220,
|
|
212
|
+
Ticket: 170,
|
|
213
|
+
Type: 170,
|
|
214
|
+
Undo2: 310,
|
|
215
|
+
Upload: 0,
|
|
216
|
+
UploadCloud: 50,
|
|
217
|
+
User: 140,
|
|
218
|
+
Variable: 330,
|
|
219
|
+
Volume2: 270,
|
|
220
|
+
VolumeX: 50,
|
|
221
|
+
Wand2: 270,
|
|
222
|
+
WandSparkles: 40,
|
|
223
|
+
WholeWord: 240,
|
|
224
|
+
WrapText: 340,
|
|
225
|
+
Wrench: 0,
|
|
226
|
+
X: 230,
|
|
227
|
+
Zap: 120,
|
|
228
|
+
ZoomIn: 250,
|
|
229
|
+
ZoomOut: 340,
|
|
230
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The functional-glyph colour table.
|
|
8
|
+
*
|
|
9
|
+
* Four facts are worth pinning, and each is invisible until wrong:
|
|
10
|
+
*
|
|
11
|
+
* - **The class conversion matches what Lucide emits.** `Trash2` is an alias of
|
|
12
|
+
* `trash` (class `lucide-trash-2`), `AlertTriangle` of `triangle-alert`, so a
|
|
13
|
+
* table keyed on the IMPORT name is only useful if the kebab translation lands
|
|
14
|
+
* on a class the component really carries. Every row is RENDERED here rather
|
|
15
|
+
* than trusted.
|
|
16
|
+
* - **The hue table matches the imports.** It is generated from `src/`; a stale
|
|
17
|
+
* copy would leave a newly added icon on the default hue, which looks like the
|
|
18
|
+
* mode half-applied. `scripts/icon-tints.mjs --check` is the same comparison.
|
|
19
|
+
* - **Every generated hue clears the non-text contrast floor** on every palette
|
|
20
|
+
* of its variant, at the lightness `ICON_HUE_PAINT` states. That is the whole
|
|
21
|
+
* reason the lightness is 30% / 70% and not something prettier.
|
|
22
|
+
* - **A signal icon is never also a hue row**, so the signal colour cannot be
|
|
23
|
+
* shadowed by a `--icon-hue` on the same element.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
27
|
+
import { Window } from 'happy-dom';
|
|
28
|
+
import { h, render } from 'preact';
|
|
29
|
+
import * as lucide from 'lucide-preact';
|
|
30
|
+
import {
|
|
31
|
+
assignPanelHues,
|
|
32
|
+
DEFAULT_ICON_HUE,
|
|
33
|
+
ICON_HUE_PAINT,
|
|
34
|
+
ICON_HUE_ROWS,
|
|
35
|
+
ICON_TINTS,
|
|
36
|
+
ICON_TINT_ROWS,
|
|
37
|
+
ICON_TINT_TOKENS,
|
|
38
|
+
iconHue,
|
|
39
|
+
hashHue,
|
|
40
|
+
iconHueColor,
|
|
41
|
+
iconHuePaint,
|
|
42
|
+
iconTintRole,
|
|
43
|
+
kebabIconName,
|
|
44
|
+
lucideClassName,
|
|
45
|
+
} from '@/shared/lib/icons/tint';
|
|
46
|
+
import { ICON_HUES } from '@/shared/lib/icons/tint-hues.generated';
|
|
47
|
+
import { THEMES } from '@/shared/lib/theme/catalog';
|
|
48
|
+
import { BRAND_CONTRAST_FLOOR, contrastRatio } from '@/shared/lib/theme/legibility';
|
|
49
|
+
|
|
50
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
|
|
51
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
52
|
+
let container: HTMLElement;
|
|
53
|
+
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
const win = new Window({ url: 'http://localhost' });
|
|
56
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
57
|
+
for (const key of DOM_GLOBALS) {
|
|
58
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = win[key as keyof Window];
|
|
59
|
+
target[key] = win[key as keyof Window];
|
|
60
|
+
}
|
|
61
|
+
container = document.createElement('div');
|
|
62
|
+
document.body.appendChild(container);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
render(null, container);
|
|
67
|
+
container.remove();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
afterAll(() => {
|
|
71
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
72
|
+
for (const key of DOM_GLOBALS) {
|
|
73
|
+
if (key in nativeGlobals) target[key] = nativeGlobals[key];
|
|
74
|
+
else delete target[key];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/** `hsl(<hue> <sat>% <light>%)` as a hex, so contrast can be measured. */
|
|
79
|
+
function hslHex(hue: number, saturation: number, lightness: number): string {
|
|
80
|
+
const s = saturation / 100;
|
|
81
|
+
const l = lightness / 100;
|
|
82
|
+
const k = (n: number) => (n + hue / 30) % 12;
|
|
83
|
+
const a = s * Math.min(l, 1 - l);
|
|
84
|
+
const channel = (n: number) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
85
|
+
const toHex = (value: number) =>
|
|
86
|
+
Math.round(Math.min(1, Math.max(0, value)) * 255)
|
|
87
|
+
.toString(16)
|
|
88
|
+
.padStart(2, '0');
|
|
89
|
+
return `#${toHex(channel(0))}${toHex(channel(8))}${toHex(channel(4))}`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
describe('kebabIconName', () => {
|
|
95
|
+
test('lowercase, camel and digit boundaries', () => {
|
|
96
|
+
expect(kebabIconName('Trash2')).toBe('trash-2');
|
|
97
|
+
expect(kebabIconName('AlertTriangle')).toBe('alert-triangle');
|
|
98
|
+
expect(kebabIconName('ChevronsUpDown')).toBe('chevrons-up-down');
|
|
99
|
+
expect(kebabIconName('BarChart3')).toBe('bar-chart-3');
|
|
100
|
+
expect(kebabIconName('CircleQuestionMark')).toBe('circle-question-mark');
|
|
101
|
+
expect(kebabIconName('ZoomIn')).toBe('zoom-in');
|
|
102
|
+
expect(kebabIconName('Cpu')).toBe('cpu');
|
|
103
|
+
expect(kebabIconName('X')).toBe('x');
|
|
104
|
+
expect(kebabIconName('Settings2')).toBe('settings-2');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('the class is the kebab name behind the component prefix', () => {
|
|
108
|
+
expect(lucideClassName('Trash2')).toBe('lucide-trash-2');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('the signal table', () => {
|
|
113
|
+
test('every row names an icon this build can import', () => {
|
|
114
|
+
for (const name of Object.keys(ICON_TINTS)) {
|
|
115
|
+
expect((lucide as Record<string, unknown>)[name], `${name} is not a lucide export`).toBeDefined();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('every row renders the class the stylesheet keys on', () => {
|
|
120
|
+
for (const name of Object.keys(ICON_TINTS)) {
|
|
121
|
+
const Icon = (lucide as unknown as Record<string, (props: object) => unknown>)[name] as (props: object) => unknown;
|
|
122
|
+
render(h(Icon as never, { 'aria-hidden': true }), container);
|
|
123
|
+
const svg = container.querySelector('svg');
|
|
124
|
+
expect(svg, `${name} draws an svg`).not.toBeNull();
|
|
125
|
+
expect(svg?.classList.contains(lucideClassName(name)), `${name} -> ${lucideClassName(name)}`).toBe(true);
|
|
126
|
+
render(null, container);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test('an unlisted icon has no role, so it takes its own hue', () => {
|
|
131
|
+
expect(iconTintRole('Sparkles')).toBeNull();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('a signal role answers its own token', () => {
|
|
135
|
+
expect(iconTintRole('Trash2')).toBe('error');
|
|
136
|
+
expect(iconTintRole('CheckCircle2')).toBe('success');
|
|
137
|
+
expect(iconTintRole('Hourglass')).toBe('warning');
|
|
138
|
+
expect(iconTintRole('Info')).toBe('info');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test('every role paints a theme token, never a hex', () => {
|
|
142
|
+
for (const role of new Set(Object.values(ICON_TINTS))) {
|
|
143
|
+
expect(ICON_TINT_TOKENS[role], role).toMatch(/^var\(--theme-[a-z]+\)$/);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('the signal rows are unique, so no rule can be shadowed', () => {
|
|
148
|
+
const classes = ICON_TINT_ROWS.map((row) => row.className);
|
|
149
|
+
expect(new Set(classes).size).toBe(classes.length);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe('the generated hues', () => {
|
|
154
|
+
test('the table has one entry per imported, non-signal icon', () => {
|
|
155
|
+
expect(Object.keys(ICON_HUES).length).toBeGreaterThan(100);
|
|
156
|
+
for (const name of Object.keys(ICON_TINTS)) {
|
|
157
|
+
expect(ICON_HUES[name], `${name} is a signal and must not carry a hue`).toBeUndefined();
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test('every hue is a step on the 36-hue wheel', () => {
|
|
162
|
+
for (const [name, hue] of Object.entries(ICON_HUES)) {
|
|
163
|
+
expect(hue % 10, name).toBe(0);
|
|
164
|
+
expect(hue, name).toBeGreaterThanOrEqual(0);
|
|
165
|
+
expect(hue, name).toBeLessThan(360);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test('neighbouring icons are not all the same colour', () => {
|
|
170
|
+
const hues = new Set(Object.values(ICON_HUES));
|
|
171
|
+
// The whole point of a per-icon hue: a dense list must not be one colour.
|
|
172
|
+
expect(hues.size).toBeGreaterThan(20);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('the hue table matches the icons this repo imports', async () => {
|
|
176
|
+
// The generator is the source of truth; running its `--check` here is what
|
|
177
|
+
// makes a stale table a test failure instead of a review miss.
|
|
178
|
+
//
|
|
179
|
+
// `Bun.fileURLToPath`, not `URL.pathname`: on a Windows host the pathname
|
|
180
|
+
// is `/D:/a/kabmo/kabmo/`, which no process can open, so the spawn failed
|
|
181
|
+
// for a reason that had nothing to do with the table — measured on the
|
|
182
|
+
// Windows gate, where this case failed while every other row passed.
|
|
183
|
+
//
|
|
184
|
+
// The script is resolved THROUGH the URL rather than by string-joining onto
|
|
185
|
+
// the directory: `fileURLToPath` keeps a trailing separator (`…/kabmo/`),
|
|
186
|
+
// and a hand-written join would then carry one separator style into a path
|
|
187
|
+
// the other half spelled the other way.
|
|
188
|
+
const repoUrl = new URL('../../../..', import.meta.url);
|
|
189
|
+
const repoRoot = Bun.fileURLToPath(repoUrl);
|
|
190
|
+
const script = Bun.fileURLToPath(new URL('scripts/icon-tints.mjs', repoUrl));
|
|
191
|
+
const check = Bun.spawnSync(['bun', 'run', script, '--check'], {
|
|
192
|
+
cwd: repoRoot,
|
|
193
|
+
stdout: 'pipe',
|
|
194
|
+
stderr: 'pipe',
|
|
195
|
+
});
|
|
196
|
+
expect(check.exitCode, check.stderr.toString()).toBe(0);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('every hue clears the non-text floor on every palette of its variant', () => {
|
|
200
|
+
for (const variant of ['light', 'dark'] as const) {
|
|
201
|
+
const { saturation, lightness } = ICON_HUE_PAINT[variant];
|
|
202
|
+
const papers = THEMES.filter((theme) => theme.variant === variant).map((theme) => theme.paper);
|
|
203
|
+
for (const hue of new Set(Object.values(ICON_HUES))) {
|
|
204
|
+
const color = hslHex(hue, saturation, lightness);
|
|
205
|
+
const worst = Math.min(...papers.map((paper) => contrastRatio(color, paper)));
|
|
206
|
+
expect(worst, `hue ${hue} ${variant} (${color})`).toBeGreaterThanOrEqual(BRAND_CONTRAST_FLOOR);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
test('the paint rule and the concrete colour share one formula', () => {
|
|
212
|
+
// The stylesheet leaves the hue to `--icon-hue`; the settings preview needs a
|
|
213
|
+
// real colour. Both must come from the same numbers, or the preview lies.
|
|
214
|
+
for (const variant of ['light', 'dark'] as const) {
|
|
215
|
+
const { saturation, lightness } = ICON_HUE_PAINT[variant];
|
|
216
|
+
expect(iconHuePaint(variant)).toBe(`hsl(var(--icon-hue, ${DEFAULT_ICON_HUE}) ${saturation}% ${lightness}%)`);
|
|
217
|
+
expect(iconHueColor(120, variant)).toBe(`hsl(120 ${saturation}% ${lightness}%)`);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('the table is exactly what the runtime hash produces', () => {
|
|
222
|
+
// One formula for both: a plugin's mark is coloured by `hashHue` at runtime,
|
|
223
|
+
// so if the generated rows drifted from it, an installed plugin would sit on
|
|
224
|
+
// a different wheel than the glyphs beside it.
|
|
225
|
+
for (const [name, hue] of Object.entries(ICON_HUES)) {
|
|
226
|
+
expect(hashHue(name), name).toBe(hue);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('a plugin name gets a stable hue on the same wheel', () => {
|
|
231
|
+
expect(hashHue('Demo Plugin')).toBe(hashHue('Demo Plugin'));
|
|
232
|
+
expect(hashHue('Demo Plugin')).not.toBe(hashHue('Other Plugin'));
|
|
233
|
+
for (const name of ['Demo', 'Session Info', 'git-forge', 'Stats — CPU & RAM']) {
|
|
234
|
+
expect(hashHue(name) % 10, name).toBe(0);
|
|
235
|
+
expect(hashHue(name), name).toBeLessThan(360);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test('the rail gives every panel its OWN hue, even when two hashes collide', () => {
|
|
240
|
+
// Fourteen buttons on a 36-slot wheel collide about nine times in ten
|
|
241
|
+
// (birthday bound) — measured, three right-rail icons shared one blue.
|
|
242
|
+
const ids = [
|
|
243
|
+
'context', 'files', 'search', 'git', 'wiki', 'terminal', 'user-browser',
|
|
244
|
+
'browser', 'usage', 'todo', 'plan', 'plugin:command-runner',
|
|
245
|
+
'plugin:git-forge', 'plugin:stats',
|
|
246
|
+
];
|
|
247
|
+
const hues = assignPanelHues(ids);
|
|
248
|
+
|
|
249
|
+
expect(hues.size).toBe(ids.length);
|
|
250
|
+
expect(new Set(hues.values()).size).toBe(ids.length);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test('the assignment does not depend on the catalog order', () => {
|
|
254
|
+
// Reordering a rail must not recolour it: the ids are sorted before probing.
|
|
255
|
+
const ids = ['b', 'a', 'c', 'plugin:x'];
|
|
256
|
+
expect([...assignPanelHues(ids)]).toEqual([...assignPanelHues([...ids].reverse())]);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test('an unassigned panel falls back to the plain hash', () => {
|
|
260
|
+
expect(assignPanelHues(['only']).get('only')).toBe(hashHue('only'));
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
test('an icon outside the table keeps a neutral default', () => {
|
|
264
|
+
expect(iconHue('NotAnIcon')).toBe(DEFAULT_ICON_HUE);
|
|
265
|
+
expect(iconHue('Trash2')).toBe(DEFAULT_ICON_HUE);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
test('the rows name classes, one per hue', () => {
|
|
269
|
+
const classes = ICON_HUE_ROWS.map((row) => row.className);
|
|
270
|
+
expect(new Set(classes).size).toBe(classes.length);
|
|
271
|
+
expect(classes.every((className) => className.startsWith('lucide-'))).toBe(true);
|
|
272
|
+
});
|
|
273
|
+
});
|