@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,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Day arithmetic for the Token Usage surface: which days a range covers, what
|
|
8
|
+
* a day is called, and how days bucket into weeks and months.
|
|
9
|
+
*
|
|
10
|
+
* Shared deliberately. The SERVER decides which rows a period includes and the
|
|
11
|
+
* CLIENT re-buckets those same rows for the chart and the time tab, so two
|
|
12
|
+
* copies of "what is a week" would draw a chart that disagrees with the table
|
|
13
|
+
* beside it.
|
|
14
|
+
*
|
|
15
|
+
* **A period is a period.** Day / Week / Month / 90 days / All time / Custom are
|
|
16
|
+
* one list of trailing spans, not a grouping choice: every figure in the panel
|
|
17
|
+
* is the total for the selected span. The only derived thing is how those rows
|
|
18
|
+
* are bucketed for the chart, and that follows the period's own length.
|
|
19
|
+
*
|
|
20
|
+
* Every day is a LOCAL calendar day (`YYYY-MM-DD` in the server's timezone),
|
|
21
|
+
* never the UTC prefix of the timestamp. The panel's "Today" is the day the
|
|
22
|
+
* user is in; deriving buckets from the UTC prefix sent a 00:30 WIB record to
|
|
23
|
+
* yesterday's column while the totals counted it in today's.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { BucketGranularity, TimeRangeOption, TimeRangeType } from '@/shared/types';
|
|
27
|
+
|
|
28
|
+
/** Every range the Tokens endpoint answers for, in display order. */
|
|
29
|
+
export type PresetTimeRange = Exclude<TimeRangeType, 'custom'>;
|
|
30
|
+
export const PRESET_RANGES: readonly PresetTimeRange[] = ['today', '7d', '30d', '90d', 'all'];
|
|
31
|
+
|
|
32
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
33
|
+
/** Calendar days covered by each trailing preset, today included. */
|
|
34
|
+
const PRESET_DAYS: Record<'7d' | '30d' | '90d', number> = { '7d': 7, '30d': 30, '90d': 90 };
|
|
35
|
+
|
|
36
|
+
const MONTH_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as const;
|
|
37
|
+
const ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
38
|
+
|
|
39
|
+
function pad2(value: number): string {
|
|
40
|
+
return value < 10 ? `0${value}` : String(value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** `YYYY-MM-DD` of an instant in LOCAL time. */
|
|
44
|
+
export function localDayKey(ms: number): string {
|
|
45
|
+
const date = new Date(ms);
|
|
46
|
+
return `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The local day of an omp entry timestamp, or `''` when it carries none.
|
|
51
|
+
*
|
|
52
|
+
* `''` rather than `undefined` because the rollup's day column is part of its
|
|
53
|
+
* primary key: SQLite treats NULLs as distinct, so two dateless records for
|
|
54
|
+
* one session would both INSERT instead of accumulating into one row.
|
|
55
|
+
*/
|
|
56
|
+
export function dayKeyOfTimestamp(timestamp: string | undefined): string {
|
|
57
|
+
if (!timestamp) return '';
|
|
58
|
+
const ms = Date.parse(timestamp);
|
|
59
|
+
return Number.isNaN(ms) ? '' : localDayKey(ms);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A half-open-free string window: `''` on either side means unbounded. */
|
|
63
|
+
export interface DayWindow {
|
|
64
|
+
from: string;
|
|
65
|
+
to: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Validate a `YYYY-MM-DD` query parameter, rejecting impossible dates. */
|
|
69
|
+
export function parseIsoDay(value: string): string | null {
|
|
70
|
+
if (!ISO_DAY.test(value)) return null;
|
|
71
|
+
const ms = Date.parse(`${value}T00:00:00`);
|
|
72
|
+
if (Number.isNaN(ms)) return null;
|
|
73
|
+
return localDayKey(ms) === value ? value : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The days a range covers. `null` means "every day" (all time).
|
|
78
|
+
*
|
|
79
|
+
* Trailing presets count CALENDAR days with today included — "Last 7 days" is
|
|
80
|
+
* today plus the six before it, which is what the tab promises and what the
|
|
81
|
+
* chart's first/last labels then show.
|
|
82
|
+
*/
|
|
83
|
+
export function dayWindow(
|
|
84
|
+
range: TimeRangeType,
|
|
85
|
+
now: number,
|
|
86
|
+
custom?: { from?: string | null; to?: string | null },
|
|
87
|
+
): DayWindow | null {
|
|
88
|
+
if (range === 'custom') {
|
|
89
|
+
const from = custom?.from ? parseIsoDay(custom.from) : null;
|
|
90
|
+
const to = custom?.to ? parseIsoDay(custom.to) : null;
|
|
91
|
+
if (from && to && from <= to) return { from, to };
|
|
92
|
+
return trailingWindow('30d', now);
|
|
93
|
+
}
|
|
94
|
+
if (range === 'all') return null;
|
|
95
|
+
if (range === 'today') {
|
|
96
|
+
const today = localDayKey(now);
|
|
97
|
+
return { from: today, to: today };
|
|
98
|
+
}
|
|
99
|
+
return trailingWindow(range, now);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function trailingWindow(range: '7d' | '30d' | '90d', now: number): DayWindow {
|
|
103
|
+
const days = PRESET_DAYS[range];
|
|
104
|
+
return { from: localDayKey(now - (days - 1) * DAY_MS), to: localDayKey(now) };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Short day label: `2026-11-03` → `Nov 3`. */
|
|
108
|
+
export function dayLabel(dayKey: string): string {
|
|
109
|
+
if (!dayKey) return 'Undated';
|
|
110
|
+
const date = new Date(`${dayKey}T00:00:00`);
|
|
111
|
+
return Number.isNaN(date.getTime()) ? dayKey : `${MONTH_LABELS[date.getMonth()]} ${date.getDate()}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** `from`/`to` as one human range; a same-day window collapses to that day. */
|
|
115
|
+
export function dayRangeLabel(from: string, to: string, now: number = Date.now()): string {
|
|
116
|
+
if (!from || !to) return 'All time';
|
|
117
|
+
if (from === to) return `${dayLabel(from)}, ${new Date(`${from}T00:00:00`).getFullYear()}`;
|
|
118
|
+
const thisYear = new Date(now).getFullYear();
|
|
119
|
+
const fromYear = new Date(`${from}T00:00:00`).getFullYear();
|
|
120
|
+
const toYear = new Date(`${to}T00:00:00`).getFullYear();
|
|
121
|
+
const left = fromYear === thisYear ? dayLabel(from) : `${dayLabel(from)}, ${fromYear}`;
|
|
122
|
+
const right = `${dayLabel(to)}, ${toYear}`;
|
|
123
|
+
return `${left} – ${right}`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The bucket a day folds into: the day itself, its Monday, or `YYYY-MM`.
|
|
128
|
+
* Monday alignment is ISO-8601's week, which is also what a "week" row means to
|
|
129
|
+
* the reader.
|
|
130
|
+
*/
|
|
131
|
+
export function bucketKey(dayKey: string, granularity: BucketGranularity): string {
|
|
132
|
+
if (granularity === 'month') return dayKey.slice(0, 7);
|
|
133
|
+
if (granularity === 'week') {
|
|
134
|
+
const date = new Date(`${dayKey}T00:00:00`);
|
|
135
|
+
if (Number.isNaN(date.getTime())) return dayKey;
|
|
136
|
+
const monday = new Date(date);
|
|
137
|
+
monday.setDate(date.getDate() - ((date.getDay() + 6) % 7));
|
|
138
|
+
return localDayKey(monday.getTime());
|
|
139
|
+
}
|
|
140
|
+
return dayKey;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Label for a bucket key, matching the granularity that produced it. */
|
|
144
|
+
export function bucketLabel(key: string, granularity: BucketGranularity): string {
|
|
145
|
+
if (granularity === 'month') {
|
|
146
|
+
const [year, month] = key.split('-');
|
|
147
|
+
const label = MONTH_LABELS[Number(month) - 1] ?? key;
|
|
148
|
+
const fullYear = Number(year);
|
|
149
|
+
return Number.isFinite(fullYear) && fullYear !== new Date().getFullYear() ? `${label} ${year}` : label;
|
|
150
|
+
}
|
|
151
|
+
return dayLabel(key);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The period picker's entries, each with the dates it covers.
|
|
156
|
+
*
|
|
157
|
+
* Day / Week / Month name the SPAN (today, the last 7 days, the last 30), which
|
|
158
|
+
* is why there is no separate daily/weekly/monthly control: choosing Month and
|
|
159
|
+
* choosing "Last 30 days" are the same act.
|
|
160
|
+
*/
|
|
161
|
+
export function timeRangeOptions(now: number = Date.now()): TimeRangeOption[] {
|
|
162
|
+
const option = (id: TimeRangeType, label: string): TimeRangeOption => {
|
|
163
|
+
const window = dayWindow(id, now);
|
|
164
|
+
return { id, label, dateRange: window ? dayRangeLabel(window.from, window.to, now) : 'All time' };
|
|
165
|
+
};
|
|
166
|
+
return [
|
|
167
|
+
option('today', 'Day'),
|
|
168
|
+
option('7d', 'Week'),
|
|
169
|
+
option('30d', 'Month'),
|
|
170
|
+
option('90d', '90 days'),
|
|
171
|
+
option('all', 'All time'),
|
|
172
|
+
{ id: 'custom', label: 'Custom…', dateRange: 'Custom period' },
|
|
173
|
+
];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* How the period's rows are bucketed for the chart and the time tab.
|
|
178
|
+
*
|
|
179
|
+
* Follows the period's own length, so the picture stays readable without
|
|
180
|
+
* asking the user a second question: a day or a month draws days, a quarter
|
|
181
|
+
* draws weeks, a long custom span or all time draws months.
|
|
182
|
+
*/
|
|
183
|
+
export function granularityFor(range: TimeRangeType, custom?: { from?: string; to?: string }): BucketGranularity {
|
|
184
|
+
if (range === 'today' || range === '7d' || range === '30d') return 'day';
|
|
185
|
+
if (range === '90d') return 'week';
|
|
186
|
+
if (range === 'all') return 'month';
|
|
187
|
+
const from = custom?.from ? parseIsoDay(custom.from) : null;
|
|
188
|
+
const to = custom?.to ? parseIsoDay(custom.to) : null;
|
|
189
|
+
if (!from || !to) return 'day';
|
|
190
|
+
const days = Math.round((Date.parse(`${to}T00:00:00`) - Date.parse(`${from}T00:00:00`)) / DAY_MS) + 1;
|
|
191
|
+
if (days <= 31) return 'day';
|
|
192
|
+
if (days <= 120) return 'week';
|
|
193
|
+
return 'month';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Every day in a window, oldest first.
|
|
198
|
+
*
|
|
199
|
+
* The rollup only stores days that HAVE usage, so a day with no work is absent
|
|
200
|
+
* from the payload — and a time table built from those rows silently omits it.
|
|
201
|
+
* The panel promises the PERIOD, so the range's own days are what it lists.
|
|
202
|
+
* Capped so an all-time range cannot build a decade of rows.
|
|
203
|
+
*/
|
|
204
|
+
export function daysInWindow(window: DayWindow, cap = 400): string[] {
|
|
205
|
+
const start = Date.parse(`${window.from}T00:00:00`);
|
|
206
|
+
const end = Date.parse(`${window.to}T00:00:00`);
|
|
207
|
+
if (Number.isNaN(start) || Number.isNaN(end) || end < start) return [];
|
|
208
|
+
const days: string[] = [];
|
|
209
|
+
for (let at = start; at <= end && days.length < cap; at += DAY_MS) {
|
|
210
|
+
// DST-safe: the key is recomputed from the local calendar, never by adding
|
|
211
|
+
// 86 400 000 ms to a formatted string.
|
|
212
|
+
const day = localDayKey(at);
|
|
213
|
+
if (days[days.length - 1] !== day) days.push(day);
|
|
214
|
+
}
|
|
215
|
+
return days;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The span a set of day keys covers, or `null` when there are none.
|
|
220
|
+
*
|
|
221
|
+
* All time has no bounded window, but its table still has to list every bucket
|
|
222
|
+
* between the first and last recorded day — otherwise a quiet month in the
|
|
223
|
+
* middle of the history disappears and the rows stop adding up to the totals
|
|
224
|
+
* shown beside them.
|
|
225
|
+
*/
|
|
226
|
+
export function spanOfDays(dayKeys: Iterable<string>): DayWindow | null {
|
|
227
|
+
let from = '';
|
|
228
|
+
let to = '';
|
|
229
|
+
for (const day of dayKeys) {
|
|
230
|
+
if (!day) continue;
|
|
231
|
+
if (!from || day < from) from = day;
|
|
232
|
+
if (!to || day > to) to = day;
|
|
233
|
+
}
|
|
234
|
+
return from && to ? { from, to } : null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Sort helper for day keys (`YYYY-MM-DD` sorts lexicographically). */
|
|
238
|
+
export function compareDayKeys(a: string, b: string): number {
|
|
239
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
240
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Token Usage panel's view models.
|
|
8
|
+
*
|
|
9
|
+
* These are the numbers a user reads, so each case pins a value that would be a
|
|
10
|
+
* bug if it drifted: a model shown under the wrong provider, a share computed
|
|
11
|
+
* against the wrong denominator, a cadence that relabels without re-bucketing,
|
|
12
|
+
* or a cache rate that divides by the wrong input.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
cacheHitLabel,
|
|
19
|
+
cacheHitRate,
|
|
20
|
+
costLabel,
|
|
21
|
+
costPerMillionLabel,
|
|
22
|
+
tokenLabel,
|
|
23
|
+
toMetricSet,
|
|
24
|
+
} from '@/shared/lib/usage/view';
|
|
25
|
+
import type { UsageTotals } from '@/shared/types';
|
|
26
|
+
|
|
27
|
+
const counters = (cost: number, tokens: number, records = 1, cacheRead = 0, input = 0) => ({
|
|
28
|
+
cost, tokens, input, output: tokens - input - cacheRead, cacheRead, cacheWrite: 0,
|
|
29
|
+
reasoning: 0, cacheReadCost: cost * 0.1, records, unpriced: 0,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const totals: UsageTotals = {
|
|
33
|
+
...counters(20, 1_000_000, 40, 900_000, 50_000),
|
|
34
|
+
unpriced: 4,
|
|
35
|
+
activeDays: 6,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
describe('formatting', () => {
|
|
39
|
+
test('token labels switch unit at the decimal boundary', () => {
|
|
40
|
+
expect(tokenLabel(0)).toBe('0');
|
|
41
|
+
expect(tokenLabel(999)).toBe('999');
|
|
42
|
+
expect(tokenLabel(1_500)).toBe('1.5K');
|
|
43
|
+
expect(tokenLabel(2_219_000_000)).toBe('2.2B');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('a nonzero sub-cent cost is not rounded into "free"', () => {
|
|
47
|
+
expect(costLabel(0)).toBe('$0.00');
|
|
48
|
+
expect(costLabel(1.234)).toBe('$1.23');
|
|
49
|
+
expect(costLabel(0.0009)).toBe('< $0.01');
|
|
50
|
+
expect(costLabel(0.01)).toBe('$0.01');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test('cost per million is derived from cost and tokens, and blank when empty', () => {
|
|
54
|
+
expect(costPerMillionLabel({ cost: 1.7, tokens: 1_000_000 })).toBe('$1.70');
|
|
55
|
+
expect(costPerMillionLabel({ cost: 1.7, tokens: 0 })).toBe('—');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('cache hit rate is cache reads over ALL observed input', () => {
|
|
59
|
+
expect(cacheHitRate({ cacheRead: 900, input: 100 })).toBeCloseTo(0.9, 10);
|
|
60
|
+
expect(cacheHitLabel({ cacheRead: 900, input: 100 })).toBe('90.0%');
|
|
61
|
+
// Nothing observed is not a 100% hit rate.
|
|
62
|
+
expect(cacheHitLabel({ cacheRead: 0, input: 0 })).toBe('—');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe('toMetricSet', () => {
|
|
67
|
+
test('every figure is the period total', () => {
|
|
68
|
+
const metrics = toMetricSet(totals);
|
|
69
|
+
expect(metrics.rawCost).toBe('$20.00');
|
|
70
|
+
expect(metrics.processedTokens).toBe('1.0M');
|
|
71
|
+
expect(metrics.cachedInput).toBe('900.0K');
|
|
72
|
+
expect(metrics.uncachedInput).toBe('50.0K');
|
|
73
|
+
expect(metrics.costPerMillion).toBe('$20.00');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('the activity hint counts the period days, singular at one', () => {
|
|
77
|
+
expect(toMetricSet(totals).activeRate).toBe('6 active days');
|
|
78
|
+
expect(toMetricSet({ ...totals, activeDays: 1 }).activeRate).toBe('1 active day');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('there is no per-day or per-week figure in the set', () => {
|
|
82
|
+
const metrics = toMetricSet(totals);
|
|
83
|
+
expect(Object.keys(metrics).some((key) => /perDay|perWeek|perMonth|average/i.test(key))).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Formatting and the headline metric set for the Token Usage panel.
|
|
8
|
+
*
|
|
9
|
+
* Nothing here divides or averages: the panel reports ONE period, so every
|
|
10
|
+
* figure is that period's total. A cadence switch used to exist beside the
|
|
11
|
+
* period switch, and a period total cannot move when days are regrouped — which
|
|
12
|
+
* made the control look broken. The period IS the switch now.
|
|
13
|
+
*
|
|
14
|
+
* Pure and shared, so the panel's components hold no arithmetic.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { TokenUsageMetricSet, UsageCounters, UsageTotals } from '@/shared/types';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* `$1.23` for a cost row, `< $0.01` for a real but sub-cent amount.
|
|
21
|
+
*
|
|
22
|
+
* Rounding a nonzero cost to `$0.00` reads as "this was free", which is the
|
|
23
|
+
* one thing an unpriced/free provider is NOT. `<$0.01` says the cost exists
|
|
24
|
+
* and is below the display precision.
|
|
25
|
+
*/
|
|
26
|
+
export function costLabel(value: number, fractionDigits = 2): string {
|
|
27
|
+
if (value > 0 && Number(value.toFixed(fractionDigits)) === 0) return '< $0.01';
|
|
28
|
+
return `$${value.toFixed(fractionDigits)}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Compact token count with decimal units, matching the rest of the app. */
|
|
32
|
+
export function tokenLabel(value: number): string {
|
|
33
|
+
if (!Number.isFinite(value) || value <= 0) return '0';
|
|
34
|
+
if (value >= 1_000_000_000) return `${(value / 1_000_000_000).toFixed(1)}B`;
|
|
35
|
+
if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`;
|
|
36
|
+
if (value >= 1_000) return `${(value / 1_000).toFixed(1)}K`;
|
|
37
|
+
return String(Math.round(value));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Cache-hit percentage over observed input (cache read + uncached input). */
|
|
41
|
+
export function cacheHitRate(counters: Pick<UsageCounters, 'cacheRead' | 'input'>): number | null {
|
|
42
|
+
const observed = counters.cacheRead + counters.input;
|
|
43
|
+
return observed > 0 ? counters.cacheRead / observed : null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** `98.7%` or `—` when nothing was cached or read. */
|
|
47
|
+
export function cacheHitLabel(counters: Pick<UsageCounters, 'cacheRead' | 'input'>): string {
|
|
48
|
+
const rate = cacheHitRate(counters);
|
|
49
|
+
return rate === null ? '—' : `${(rate * 100).toFixed(1)}%`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** `$0.07` per 1M tokens, or `—` when no tokens were processed. */
|
|
53
|
+
export function costPerMillionLabel(counters: Pick<UsageCounters, 'cost' | 'tokens'>): string {
|
|
54
|
+
if (counters.tokens <= 0) return '—';
|
|
55
|
+
return `$${((counters.cost / counters.tokens) * 1_000_000).toFixed(2)}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The headline tiles, as display strings for the selected period. */
|
|
59
|
+
export function toMetricSet(totals: UsageTotals): TokenUsageMetricSet {
|
|
60
|
+
return {
|
|
61
|
+
rawCost: costLabel(totals.cost),
|
|
62
|
+
costPerMillion: costPerMillionLabel(totals),
|
|
63
|
+
processedTokens: tokenLabel(totals.tokens),
|
|
64
|
+
activeRate: `${totals.activeDays} active ${totals.activeDays === 1 ? 'day' : 'days'}`,
|
|
65
|
+
cachedInput: tokenLabel(totals.cacheRead),
|
|
66
|
+
cachedPercent: `${cacheHitLabel(totals)} of observed input`,
|
|
67
|
+
uncachedInput: tokenLabel(totals.input),
|
|
68
|
+
cacheWrite: tokenLabel(totals.cacheWrite),
|
|
69
|
+
outputTokens: tokenLabel(totals.output),
|
|
70
|
+
reasoning: `${tokenLabel(totals.reasoning)} reasoning`,
|
|
71
|
+
records: totals.records,
|
|
72
|
+
unpricedRecords: totals.unpriced,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One panel id, ONE hue — the property that four surfaces were breaking.
|
|
8
|
+
*
|
|
9
|
+
* The measurements that motivated this: `Files` drew at `hsl(0 …)` on the
|
|
10
|
+
* activity bar (hash of the PANEL id) and `hsl(320 …)` in Settings → Panel
|
|
11
|
+
* Plugins → Built-in (hash of the GLYPH `Files`), and `Wiki`'s `BookOpen` was
|
|
12
|
+
* `info` in Settings because a glyph that MEANS something takes a signal colour.
|
|
13
|
+
* These tests pin the two things that make the disagreement impossible: the map
|
|
14
|
+
* is derived from the whole built-in set (so it cannot depend on what a surface
|
|
15
|
+
* is drawing), and every view gets a slot of its own.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { describe, expect, test } from 'bun:test';
|
|
19
|
+
import { RIGHT_PANEL_TYPES } from '@/shared/lib/workspace/right-panels';
|
|
20
|
+
import { SESSIONS_VIEW_ID } from '@/shared/lib/workspace/left-dock';
|
|
21
|
+
import { hashHue } from '@/shared/lib/icons/tint';
|
|
22
|
+
import { panelHueOf, panelHueUniverse, resolvePanelHues } from '@/shared/lib/workspace/panel-hues';
|
|
23
|
+
|
|
24
|
+
describe('panel hues', () => {
|
|
25
|
+
test('the universe holds every built-in view and the dock view, and nothing else', () => {
|
|
26
|
+
const universe = panelHueUniverse();
|
|
27
|
+
expect(new Set(universe)).toEqual(new Set([SESSIONS_VIEW_ID, ...RIGHT_PANEL_TYPES]));
|
|
28
|
+
expect(universe.length).toBe(RIGHT_PANEL_TYPES.length + 1);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('every built-in view gets a hue of its own', () => {
|
|
32
|
+
// A collision is what `assignPanelHues` exists to resolve: 13 views on a
|
|
33
|
+
// 36-slot wheel collide by birthday about nine times in ten, and two
|
|
34
|
+
// neighbours on one blue is the opposite of "each panel has its colour".
|
|
35
|
+
const hues = resolvePanelHues();
|
|
36
|
+
expect(hues.size).toBe(panelHueUniverse().length);
|
|
37
|
+
expect(new Set(hues.values()).size).toBe(hues.size);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('the answer does not depend on what a surface draws or the order it asks', () => {
|
|
41
|
+
// The defect this replaces: the rail built its map from the panels it was
|
|
42
|
+
// DRAWING, so switching one off or dragging it recoloured the rest, and
|
|
43
|
+
// Settings (which lists the switched-off views too) could never agree.
|
|
44
|
+
// `panelHueOf` is a pure lookup on one static map.
|
|
45
|
+
const hues = resolvePanelHues();
|
|
46
|
+
const forward = panelHueUniverse().map((id) => panelHueOf(hues, id));
|
|
47
|
+
const reversed = [...panelHueUniverse()].reverse().map((id) => panelHueOf(hues, id));
|
|
48
|
+
expect(reversed).toEqual([...forward].reverse());
|
|
49
|
+
expect(panelHueOf(hues, 'files')).toBe(hues.get('files')!);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('an id outside the map keeps a stable hue instead of a shared default', () => {
|
|
53
|
+
// A plugin's slot id, or an id from a newer version. Falling back to
|
|
54
|
+
// `DEFAULT_ICON_HUE` would paint every unknown panel the same neutral blue,
|
|
55
|
+
// which is the "one colour for everything" failure the mode exists to avoid.
|
|
56
|
+
const hues = resolvePanelHues();
|
|
57
|
+
expect(panelHueOf(hues, 'plugin:unknown:rightPanel')).toBe(hashHue('plugin:unknown:rightPanel'));
|
|
58
|
+
expect(panelHueOf(hues, 'plugin:a:rightPanel')).not.toBe(panelHueOf(hues, 'plugin:b:rightPanel'));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('a built-in hue is keyed by the PANEL id, never the glyph', () => {
|
|
62
|
+
// The literal defect: `lucide-files` hashes to 320, `files` to 0. If the map
|
|
63
|
+
// ever answered with the glyph's hue again, these two lines catch it.
|
|
64
|
+
const hues = resolvePanelHues();
|
|
65
|
+
expect(panelHueOf(hues, 'files')).toBe(hashHue('files'));
|
|
66
|
+
expect(panelHueOf(hues, 'files')).not.toBe(hashHue('Files'));
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The colour a BUILT-IN panel's mark is drawn in, as one fact for every surface.
|
|
8
|
+
*
|
|
9
|
+
* A built-in panel's mark is drawn by the activity bar, the phone's chip strip
|
|
10
|
+
* and the Built-in list in Settings, and each of them used to answer "what
|
|
11
|
+
* colour is this?" differently: the rail hashed the PANEL ID (`files` → 0°),
|
|
12
|
+
* while the two lists drew the glyph and therefore took the GLYPH's hue
|
|
13
|
+
* (`lucide-files` → 320°, and `lucide-book-open` even fell through to the `info`
|
|
14
|
+
* signal colour). One panel, two colours — measured, the same `Files` mark was
|
|
15
|
+
* `hsl(0 …)` in the rail and `hsl(320 …)` in Settings.
|
|
16
|
+
*
|
|
17
|
+
* The answer is computed ONCE, over the whole SET of built-in views rather than
|
|
18
|
+
* over whatever a surface happens to be drawing:
|
|
19
|
+
*
|
|
20
|
+
* - **The universe is fixed, not the drawn set.** Every built-in view plus the
|
|
21
|
+
* dock's own view, including the ones switched OFF — because the Settings list
|
|
22
|
+
* draws exactly those, and the colour must not change when a view is toggled
|
|
23
|
+
* or dragged.
|
|
24
|
+
* - **Collisions are resolved over that same universe** (`assignPanelHues`), so
|
|
25
|
+
* two neighbours never land on one blue, and the answer does not depend on the
|
|
26
|
+
* order a surface asks in.
|
|
27
|
+
*
|
|
28
|
+
* A PLUGIN panel is deliberately absent: its colour is the plugin's OWN mark
|
|
29
|
+
* colour (the brand hex its manifest declares, else the hue of its name), the
|
|
30
|
+
* same one its marketplace card draws. Keying that by the slot id instead would
|
|
31
|
+
* give one plugin two colours — the exact defect this module removes.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import { assignPanelHues, hashHue } from '@/shared/lib/icons/tint';
|
|
35
|
+
import { RIGHT_PANEL_TYPES } from '@/shared/lib/workspace/right-panels';
|
|
36
|
+
import { SESSIONS_VIEW_ID } from '@/shared/lib/workspace/left-dock';
|
|
37
|
+
|
|
38
|
+
/** Every id the built-in hue map is computed over: all of them, drawn or not. */
|
|
39
|
+
export function panelHueUniverse(): string[] {
|
|
40
|
+
return [SESSIONS_VIEW_ID, ...RIGHT_PANEL_TYPES];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The hue map every surface reads. */
|
|
44
|
+
export function resolvePanelHues(): Map<string, number> {
|
|
45
|
+
return assignPanelHues(panelHueUniverse());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The hue for one panel id, with the plain hash as the fallback.
|
|
50
|
+
*
|
|
51
|
+
* An id outside the universe is one this build does not know — a plugin's slot,
|
|
52
|
+
* an id from a newer version. A stable hash still gives it a colour on the same
|
|
53
|
+
* wheel instead of the neutral default every unknown glyph shares.
|
|
54
|
+
*/
|
|
55
|
+
export function panelHueOf(hues: ReadonlyMap<string, number>, panelId: string): number {
|
|
56
|
+
return hues.get(panelId) ?? hashHue(panelId);
|
|
57
|
+
}
|
|
@@ -51,8 +51,86 @@ export interface BrowserPanelAction {
|
|
|
51
51
|
label: string;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* How the user marked a spot on the user-browser panel.
|
|
56
|
+
*
|
|
57
|
+
* The panel is a cross-origin iframe, so a mark can never carry PIXELS: the
|
|
58
|
+
* page inside is unreadable to this origin (`contentDocument` is null,
|
|
59
|
+
* `drawImage(iframe)` throws, and a capture would show the user's whole
|
|
60
|
+
* screen). What travels is geometry plus words — the exact region, and what
|
|
61
|
+
* the user says is wrong there.
|
|
62
|
+
*/
|
|
63
|
+
export type AnnotateTool = 'box' | 'pin' | 'arrow';
|
|
64
|
+
|
|
65
|
+
/** One point, normalized to the measured panel: 0..1 on both axes. */
|
|
66
|
+
export interface AnnotatePoint {
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* What the marked spot IS, when the page allows reading it.
|
|
73
|
+
*
|
|
74
|
+
* Only a SAME-ORIGIN frame can be read (`contentDocument` is non-null); a real
|
|
75
|
+
* dev server runs on its own port, which is a different origin even on the same
|
|
76
|
+
* host — measured in Chromium: `:7101` reading `:7102` yields `contentDocument
|
|
77
|
+
* === null`. So this is present only when the page was readable, and the prompt
|
|
78
|
+
* says so when it is absent instead of pretending.
|
|
79
|
+
*/
|
|
80
|
+
export interface AnnotateElement {
|
|
81
|
+
/** `section[aria-label="Ringkasan"] > button#pay`, at most 4 levels. */
|
|
82
|
+
path: string;
|
|
83
|
+
/** Lowercase tag name, e.g. `select`. */
|
|
84
|
+
tag: string;
|
|
85
|
+
/** Explicit `role`, when the element declares one. */
|
|
86
|
+
role?: string;
|
|
87
|
+
/** Visible text, whitespace-collapsed and cut short. */
|
|
88
|
+
text?: string;
|
|
89
|
+
/** `<select>` value and option count, `disabled`, and similar. */
|
|
90
|
+
state?: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* One numbered mark. `box`/`arrow` use both points; `pin` uses `start`.
|
|
95
|
+
*
|
|
96
|
+
* `label` is the user's NAME for the region ("Ringkasan pesanan", "form
|
|
97
|
+
* alamat"). It is not derived from the page: the label is the one fact a
|
|
98
|
+
* cross-origin frame can never give us, and the user always has it.
|
|
99
|
+
*/
|
|
100
|
+
export interface AnnotateShape {
|
|
101
|
+
id: string;
|
|
102
|
+
tool: AnnotateTool;
|
|
103
|
+
start: AnnotatePoint;
|
|
104
|
+
end: AnnotatePoint;
|
|
105
|
+
/** The user's name for the region; empty until they say it. */
|
|
106
|
+
label: string;
|
|
107
|
+
/** What the user says about this region; empty while they are still drawing. */
|
|
108
|
+
note: string;
|
|
109
|
+
/** The element under the mark, when the frame was same-origin and readable. */
|
|
110
|
+
element?: AnnotateElement;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The panel box the marks were drawn on, in CSS px.
|
|
115
|
+
*
|
|
116
|
+
* Percentages alone are not enough: `12% of a 1024px panel` and `12% of a
|
|
117
|
+
* 375px panel` are different places, and the agent has to know which page
|
|
118
|
+
* shape the user was looking at to reproduce the view.
|
|
119
|
+
*/
|
|
120
|
+
export interface AnnotatePanelSize {
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
viewportMode: string;
|
|
124
|
+
/** CSS zoom the panel was showing at (100 = none). */
|
|
125
|
+
zoom: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
54
128
|
/** Page context handed from a browser panel to the chat composer draft. */
|
|
55
129
|
export interface BrowserPageContext {
|
|
56
130
|
url: string;
|
|
57
131
|
title?: string;
|
|
132
|
+
/** The marks the user made, in draw order. Absent when they only shared a page. */
|
|
133
|
+
annotations?: AnnotateShape[];
|
|
134
|
+
/** The box those marks were normalized against. Present whenever `annotations` is. */
|
|
135
|
+
panel?: AnnotatePanelSize;
|
|
58
136
|
}
|
|
@@ -18,6 +18,7 @@ export * from '@/shared/types/settings/mcp';
|
|
|
18
18
|
export * from '@/shared/types/settings/usage';
|
|
19
19
|
export * from '@/shared/types/settings/skill';
|
|
20
20
|
export * from '@/shared/types/settings/plugin';
|
|
21
|
+
export * from '@/shared/types/settings/write';
|
|
21
22
|
export * from '@/shared/types/context';
|
|
22
23
|
export * from '@/shared/types/omp/session';
|
|
23
24
|
export * from '@/shared/types/omp/agent';
|
|
@@ -46,6 +46,8 @@ export interface PanelRegistryEntry {
|
|
|
46
46
|
cssUrl?: string;
|
|
47
47
|
/** Absolute URL of the plugin's icon, when it declares one. */
|
|
48
48
|
iconUrl?: string;
|
|
49
|
+
/** The colour the plugin's mark is drawn in, when its manifest declares one. */
|
|
50
|
+
color?: string;
|
|
49
51
|
/** Absolute URL of the plugin's README, when it ships one. */
|
|
50
52
|
readmeUrl?: string;
|
|
51
53
|
}
|
|
@@ -165,6 +167,8 @@ export interface PanelPluginStatus {
|
|
|
165
167
|
homepage?: string;
|
|
166
168
|
/** The slots the manifest DECLARES; live registrations are authoritative. */
|
|
167
169
|
slots?: PanelSlotName[];
|
|
170
|
+
/** The mark colour the manifest declares, when it declares one. */
|
|
171
|
+
color?: string;
|
|
168
172
|
capabilities?: string[];
|
|
169
173
|
/** How many settings the manifest declares, so the card can say what is configurable. */
|
|
170
174
|
settingsCount?: number;
|
|
@@ -203,6 +207,8 @@ export interface PanelCatalogEntry {
|
|
|
203
207
|
description?: string;
|
|
204
208
|
/** Absolute URL of the plugin's icon, when the store's copy declares one. */
|
|
205
209
|
iconUrl?: string;
|
|
210
|
+
/** The mark colour the store's copy declares, so a card can preview it. */
|
|
211
|
+
color?: string;
|
|
206
212
|
/** Absolute URL of the plugin's README, when the store's copy ships one. */
|
|
207
213
|
readmeUrl?: string;
|
|
208
214
|
/** True once the plugin is installed — the row then offers Enable/Remove. */
|
|
@@ -95,6 +95,20 @@ export interface PanelPluginManifest {
|
|
|
95
95
|
capabilities?: string[];
|
|
96
96
|
/** Optional icon file, relative to the plugin root. */
|
|
97
97
|
icon?: string;
|
|
98
|
+
/**
|
|
99
|
+
* The colour this plugin's mark is drawn in, as a CSS hex (`#RRGGBB`).
|
|
100
|
+
*
|
|
101
|
+
* Declared by the plugin because only the plugin knows its own brand — the
|
|
102
|
+
* host's alternative is a hue hashed from the plugin's NAME, which is stable
|
|
103
|
+
* but arbitrary (`hashHue`), and a marketplace author who ships a logo should
|
|
104
|
+
* not have that logo tinted by a hash. Read by the activity bar's colour mode;
|
|
105
|
+
* absent means the host falls back to the hashed hue.
|
|
106
|
+
*
|
|
107
|
+
* Hex only, and validated on the server: the value reaches an inline custom
|
|
108
|
+
* property, so `color: url(...)` or `red; background: …` must not be able to
|
|
109
|
+
* arrive through a manifest. The same rule the project accent follows.
|
|
110
|
+
*/
|
|
111
|
+
color?: string;
|
|
98
112
|
/**
|
|
99
113
|
* Optional README, relative to the plugin root. Markdown, shown in the pane's
|
|
100
114
|
* reader so a user can judge a plugin before installing it.
|