@kabmo-labs/kabmo 0.16.0 → 0.18.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 +2 -2
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +552 -471
- package/dist/client/static/js/index-hp75vsv9.css +1 -0
- package/dist/client/static/js/{index-cpydmygd.js → index-tc09dtca.js} +897 -886
- package/package.json +1 -1
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +143 -0
- package/src/client/components/common/code-surface/bracket-guide.test.ts +2 -2
- package/src/client/components/common/code-surface/bracket-guide.ts +2 -2
- package/src/client/components/common/code-surface/conflict-markers.ts +5 -5
- package/src/client/components/common/code-surface/extensions.ts +7 -4
- package/src/client/components/common/code-surface/theme.ts +34 -9
- package/src/client/components/common/code-surface/whitespace.test.ts +223 -0
- package/src/client/components/common/code-surface/whitespace.ts +140 -0
- 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/{server-switcher/index.tsx → server-control/Panel.tsx} +92 -44
- package/src/client/components/common/server-control/index.test.tsx +217 -0
- package/src/client/components/common/server-control/index.tsx +120 -0
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +8 -50
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +42 -21
- 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/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/WorkspaceHeader.tsx +28 -10
- 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/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +6 -12
- 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 +41 -13
- 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/settings/Modal.tsx +9 -3
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +19 -9
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +38 -44
- 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/ProjectSettings.tsx +122 -156
- package/src/client/components/settings/categories/SkillCatalogSettings.tsx +220 -260
- package/src/client/components/settings/categories/SkillSettings.tsx +8 -5
- 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 +14 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -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 +91 -76
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +26 -13
- 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/project-settings/AccentPalette.test.tsx +189 -0
- package/src/client/components/settings/categories/project-settings/AccentPalette.tsx +156 -24
- package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +175 -0
- package/src/client/components/settings/categories/project-settings/DeleteProjectModal.tsx +107 -0
- package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +40 -24
- package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +17 -7
- package/src/client/components/settings/categories/project-settings/IconGrid.tsx +164 -69
- package/src/client/components/settings/categories/project-settings/ModelDropdown.test.tsx +122 -0
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +124 -53
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +57 -11
- package/src/client/components/settings/categories/project-settings/PathField.tsx +122 -0
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +100 -59
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +253 -0
- package/src/client/components/settings/categories/skill-catalog/SkillCard.tsx +89 -0
- package/src/client/components/settings/categories/skill-catalog/SourceRail.tsx +122 -0
- package/src/client/components/settings/categories/skill-catalog/catalog-ui.test.tsx +179 -0
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +236 -0
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +164 -239
- package/src/client/components/settings/categories/skill-settings/InstructionsEditor.tsx +84 -0
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +144 -87
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +188 -0
- package/src/client/components/settings/categories/skill-settings/row-meta.ts +58 -0
- 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/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/index.tsx +6 -1
- 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/Proc.test.ts +46 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -6
- 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/panels/Wait.test.ts +29 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +11 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +6 -2
- 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/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/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/PreviewPane.tsx +70 -0
- 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/editor/viewers/SvgPreview.tsx +18 -2
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +39 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +18 -5
- package/src/client/components/workspace/file-explorer/Modals.tsx +15 -1
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +68 -0
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +47 -57
- package/src/client/components/workspace/file-explorer/collapsed-chain.test.ts +167 -0
- package/src/client/components/workspace/file-explorer/drag-props.ts +42 -0
- package/src/client/components/workspace/file-explorer/drag.test.ts +43 -0
- package/src/client/components/workspace/file-explorer/index.tsx +21 -20
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- 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 +123 -4
- package/src/client/data/settings/project.ts +9 -28
- package/src/client/data/settings/skill.ts +6 -32
- 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/pending-model.ts +28 -0
- 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/projects/index.ts +294 -0
- package/src/client/hooks/settings/projects.test.ts +237 -0
- package/src/client/hooks/settings/skill-catalog.ts +101 -9
- package/src/client/hooks/settings/skill-git-import.ts +153 -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/shell/servers.test.ts +166 -0
- package/src/client/hooks/{desktop → shell}/servers.ts +17 -14
- package/src/client/hooks/ui/markdown-hydration.ts +125 -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/ui/updates/shell-download.ts +1 -1
- package/src/client/hooks/ui/updates/shell-update.ts +2 -6
- package/src/client/hooks/workspace/file-row-drag.ts +41 -0
- package/src/client/hooks/workspace/file-tree-actions.ts +25 -1
- package/src/client/hooks/workspace/file-tree-edits.ts +23 -6
- package/src/client/hooks/workspace/root-drop-target.ts +77 -0
- package/src/client/hooks/workspace/unfolded-chains.ts +165 -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/desktop/dropped-paths.ts +1 -1
- package/src/client/lib/desktop/titlebar.test.ts +12 -3
- package/src/client/lib/desktop/titlebar.ts +1 -1
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/lib/shell/desktop.ts +117 -0
- package/src/client/lib/shell/servers.ts +75 -0
- package/src/client/lib/shell/transport.ts +216 -0
- package/src/client/main.tsx +9 -0
- package/src/client/tailwind.css +65 -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/fs/git-merge-conflict.test.ts +14 -1
- 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/config/skill-sources.ts +49 -0
- package/src/server/lib/omp/config/skills-git-install.ts +155 -0
- package/src/server/lib/omp/config/skills-git-repo.ts +288 -0
- package/src/server/lib/omp/config/skills-git.test.ts +220 -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/process.ts +11 -14
- package/src/server/lib/omp/rpc/session-commands.ts +6 -3
- 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/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/lib/workspace/project-model.server.test.ts +102 -0
- package/src/server/lib/workspace/project-model.server.ts +47 -0
- package/src/server/lib/workspace/project-patch.server.ts +156 -0
- package/src/server/routes/agent/new.ts +8 -1
- 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 +99 -94
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/projects.ts +53 -19
- package/src/server/routes/settings/settings-projects-routes.test.ts +214 -0
- package/src/server/routes/settings/settings-store-routes.test.ts +11 -115
- package/src/server/routes/settings/skills-catalog-actions.ts +195 -0
- package/src/server/routes/settings/skills.test.ts +225 -0
- package/src/server/routes/settings/skills.ts +18 -15
- 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/fs/folder-chain.test.ts +81 -1
- package/src/shared/lib/fs/folder-chain.ts +84 -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/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 +66 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +48 -47
- package/src/shared/lib/omp/rpc/frame.ts +49 -40
- package/src/shared/lib/omp/session/job-progress.test.ts +37 -1
- package/src/shared/lib/omp/session/job-progress.ts +31 -0
- package/src/shared/lib/omp/session/proc.ts +5 -0
- package/src/shared/lib/omp/session/wait.ts +5 -0
- 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/ui/mobile-overlay.ts +61 -0
- package/src/shared/lib/ui/svg-scope.test.ts +97 -0
- package/src/shared/lib/ui/svg-scope.ts +134 -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/project-accent.test.ts +69 -0
- package/src/shared/lib/workspace/project-accent.ts +63 -0
- package/src/shared/lib/workspace/project-icon.ts +40 -0
- package/src/shared/lib/workspace/project-model.test.ts +79 -0
- package/src/shared/lib/workspace/project-model.ts +64 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/skill.ts +53 -3
- package/src/shared/types/settings/state.ts +4 -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/file-explorer-disk.test-util.ts +25 -1
- package/src/test-support/file-explorer-drag.test-util.ts +88 -0
- package/src/test-support/file-explorer.test-util.ts +47 -47
- package/dist/client/static/js/index-fjnq2z2d.css +0 -1
- package/src/client/components/common/code-surface/indent-guide.ts +0 -104
- package/src/client/components/common/server-switcher/index.test.tsx +0 -150
- package/src/client/components/settings/categories/skill-catalog/AddSourceModal.tsx +0 -133
- package/src/client/hooks/desktop/servers.test.ts +0 -73
- package/src/client/lib/desktop/bridge.ts +0 -203
- 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/shared/lib/code/editor/indent-guide-rule.test.ts +0 -65
- package/src/shared/lib/code/editor/indent-guide-rule.ts +0 -47
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Loader2, MoreHorizontal, PanelLeft, ServerCog } from 'lucide-preact';
|
|
1
|
+
import { Loader2, MoreHorizontal, PanelLeft } from 'lucide-preact';
|
|
3
2
|
import { HeaderControls } from '@/client/components/common/header-controls';
|
|
4
3
|
import { BrandWordmark } from '@/client/components/common/brand-wordmark';
|
|
5
4
|
import { StreamStatusDot } from '@/client/components/common/StreamStatusDot';
|
|
@@ -9,11 +8,8 @@ import { useSessionRenaming } from '@/client/hooks/workspace/renaming-sessions';
|
|
|
9
8
|
import type { AgentStreamStatus } from '@/shared/lib/chat/omp/status';
|
|
10
9
|
import { withChord } from '@/client/lib/ui/with-chord';
|
|
11
10
|
import { titlebarPaddingLeft, titlebarPaddingRight } from '@/shared/lib/ui/titlebar';
|
|
12
|
-
import {
|
|
13
|
-
import { useDesktopServers } from '@/client/hooks/desktop/servers';
|
|
14
|
-
import { isDesktopShell } from '@/client/lib/desktop/bridge';
|
|
11
|
+
import { ServerControl } from '@/client/components/common/server-control';
|
|
15
12
|
import { dragRegionProps, titlebarInsetLeft } from '@/client/lib/desktop/titlebar';
|
|
16
|
-
import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
|
|
17
13
|
|
|
18
14
|
interface TopNavbarProps {
|
|
19
15
|
sessionTitle: string | null;
|
|
@@ -61,19 +57,6 @@ export function TopNavbar({
|
|
|
61
57
|
// sidebar row may be scrolled out of view — so the header says the wait is
|
|
62
58
|
// happening even when the row that started it is not on screen.
|
|
63
59
|
const renaming = useSessionRenaming(sessionId);
|
|
64
|
-
// The shell's server control: which server this window is on, and how to
|
|
65
|
-
// change it. Absent in a browser — there is no shell to control there, and a
|
|
66
|
-
// button that opened onto "not available" would never work.
|
|
67
|
-
const shell = isDesktopShell();
|
|
68
|
-
const [serverPanelOpen, setServerPanelOpen] = useState(false);
|
|
69
|
-
const serverPanelRef = useRef<HTMLDivElement>(null);
|
|
70
|
-
const servers = useDesktopServers(serverPanelOpen);
|
|
71
|
-
const activeServer =
|
|
72
|
-
servers.state?.entries.find((entry) => entry.id === servers.state?.activeId) ??
|
|
73
|
-
servers.state?.detected.find((entry) => entry.url === servers.state?.activeUrl) ??
|
|
74
|
-
null;
|
|
75
|
-
useOnClickOutside(serverPanelRef, () => setServerPanelOpen(false));
|
|
76
|
-
|
|
77
60
|
const hasSessionActions = Boolean(
|
|
78
61
|
sessionActions && (sessionActions.onRename || sessionActions.onRenameWithAi || sessionActions.onArchive || sessionActions.onDelete)
|
|
79
62
|
);
|
|
@@ -162,37 +145,12 @@ export function TopNavbar({
|
|
|
162
145
|
<div className="flex items-center space-x-3 titlebar-no-drag">
|
|
163
146
|
{/* One cluster, one order, shared with the phone's header. Each layout
|
|
164
147
|
passes only what it has; the order is stated in `HeaderControls`. */}
|
|
165
|
-
{shell
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
activeServer
|
|
172
|
-
? `Server: ${activeServer.label} — ${activeServer.running ? 'running' : 'stopped'}`
|
|
173
|
-
: 'Choose a server'
|
|
174
|
-
}
|
|
175
|
-
aria-label="Servers"
|
|
176
|
-
aria-haspopup="dialog"
|
|
177
|
-
aria-expanded={serverPanelOpen}
|
|
178
|
-
className="flex items-center gap-1.5 rounded px-1.5 py-1 text-ink/60 hover:text-ink hover:bg-ink/10 transition-colors cursor-pointer"
|
|
179
|
-
>
|
|
180
|
-
<ServerCog size={16} />
|
|
181
|
-
{activeServer && (
|
|
182
|
-
<span className="max-w-[120px] truncate text-[11px] font-medium text-ink/70">
|
|
183
|
-
{activeServer.label}
|
|
184
|
-
</span>
|
|
185
|
-
)}
|
|
186
|
-
<span
|
|
187
|
-
className={`w-1.5 h-1.5 rounded-full ${
|
|
188
|
-
activeServer?.running ? 'bg-success' : 'bg-ink/25'
|
|
189
|
-
}`}
|
|
190
|
-
aria-hidden="true"
|
|
191
|
-
/>
|
|
192
|
-
</button>
|
|
193
|
-
<ServerSwitcher open={serverPanelOpen} onClose={() => setServerPanelOpen(false)} />
|
|
194
|
-
</div>
|
|
195
|
-
)}
|
|
148
|
+
{/* The shell's server control. It draws nothing in a browser; a shell
|
|
149
|
+
window narrowed below the layout breakpoint renders the PHONE layout
|
|
150
|
+
and gets the same control in the drawer's header instead — which is
|
|
151
|
+
why the trigger, the store and the panel all live in one component
|
|
152
|
+
rather than in this file. */}
|
|
153
|
+
<ServerControl variant="nav" />
|
|
196
154
|
<HeaderControls
|
|
197
155
|
layout="desktop"
|
|
198
156
|
sessionId={sessionId ?? null}
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* props; this file only decides how the two states look.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { useState } from 'preact/hooks';
|
|
17
|
+
import { useRef, useState } from 'preact/hooks';
|
|
18
18
|
import { ChevronDown, ChevronRight, MoreHorizontal, Pin, Plus } from 'lucide-preact';
|
|
19
|
+
import { AnchoredMenu } from '@/client/components/common/anchored-menu';
|
|
20
|
+
import { anchorRectOf, type AnchorRect } from '@/shared/lib/ui/menu-anchor';
|
|
19
21
|
import { NewWorktreeModal } from '@/client/components/workspace/worktree-modal/index';
|
|
20
22
|
import { SelectionCheckbox } from '@/client/components/common/batch-selection/SelectionCheckbox';
|
|
21
23
|
import { WorkspaceOptionsMenu } from '@/client/components/common/workspace-options-menu';
|
|
@@ -37,9 +39,10 @@ export interface CategoryHeaderProps {
|
|
|
37
39
|
checkbox: CategoryHeaderCheckbox | null;
|
|
38
40
|
/** True while a batch selection is active — actions are hidden then. */
|
|
39
41
|
batchActive: boolean;
|
|
40
|
-
menuRef: { current: HTMLDivElement | null };
|
|
41
42
|
showMenu: boolean;
|
|
42
43
|
onToggleMenu: () => void;
|
|
44
|
+
/** Close the `⋯` menu (backdrop, Escape, or a parent that moved on). */
|
|
45
|
+
onCloseMenu: () => void;
|
|
43
46
|
onNewSession: () => void;
|
|
44
47
|
/** Start a chat in a worktree made from this folder. */
|
|
45
48
|
onNewWorktreeSession?: (folderId: number, worktreePath: string) => void;
|
|
@@ -58,9 +61,9 @@ export function CategoryHeader({
|
|
|
58
61
|
onToggleFolder,
|
|
59
62
|
checkbox,
|
|
60
63
|
batchActive,
|
|
61
|
-
menuRef,
|
|
62
64
|
showMenu,
|
|
63
65
|
onToggleMenu,
|
|
66
|
+
onCloseMenu,
|
|
64
67
|
onNewSession,
|
|
65
68
|
onNewWorktreeSession,
|
|
66
69
|
onOpenFolder,
|
|
@@ -77,6 +80,13 @@ export function CategoryHeader({
|
|
|
77
80
|
const [worktreeDialogOpen, setWorktreeDialogOpen] = useState(false);
|
|
78
81
|
const canCreateWorktree = Boolean(onNewWorktreeSession && folder.project_path);
|
|
79
82
|
|
|
83
|
+
// The `⋯` panel is portalled and measured from this rectangle, because the
|
|
84
|
+
// sidebar this row sits in is a scroller: an `absolute` menu was clipped at
|
|
85
|
+
// the scroller's edge, and one at `z-50` inside the row still lost to a later
|
|
86
|
+
// sibling's stacking context. See `common/anchored-menu/`.
|
|
87
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
88
|
+
const [anchor, setAnchor] = useState<AnchorRect | null>(null);
|
|
89
|
+
|
|
80
90
|
return (
|
|
81
91
|
<div className="group flex items-center justify-between h-7 text-xs font-semibold text-ink px-2 hover:bg-ink/5 rounded-md transition-colors select-none">
|
|
82
92
|
<div
|
|
@@ -150,33 +160,44 @@ export function CategoryHeader({
|
|
|
150
160
|
<Plus size={12} />
|
|
151
161
|
</button>
|
|
152
162
|
|
|
153
|
-
<div className="relative flex items-center"
|
|
163
|
+
<div className="relative flex items-center">
|
|
154
164
|
<button
|
|
165
|
+
ref={triggerRef}
|
|
155
166
|
type="button"
|
|
156
167
|
title={`Options for ${folder.name}`}
|
|
157
168
|
aria-label={`Options for ${folder.name}`}
|
|
169
|
+
aria-haspopup="menu"
|
|
170
|
+
aria-expanded={showMenu}
|
|
158
171
|
className="w-5 h-5 flex items-center justify-center text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer transition-colors"
|
|
159
|
-
onClick={(e) => {
|
|
172
|
+
onClick={(e) => {
|
|
173
|
+
e.stopPropagation();
|
|
174
|
+
if (triggerRef.current) setAnchor(anchorRectOf(triggerRef.current));
|
|
175
|
+
onToggleMenu();
|
|
176
|
+
}}
|
|
160
177
|
>
|
|
161
178
|
<MoreHorizontal size={12} />
|
|
162
179
|
</button>
|
|
163
180
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
<AnchoredMenu
|
|
182
|
+
anchor={showMenu ? anchor : null}
|
|
183
|
+
align="end"
|
|
184
|
+
ariaLabel={`Options for ${folder.name}`}
|
|
185
|
+
className="w-44 rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg"
|
|
186
|
+
onClose={onCloseMenu}
|
|
187
|
+
>
|
|
188
|
+
<WorkspaceOptionsMenu
|
|
189
|
+
variant="desktop"
|
|
190
|
+
isPinned={folder.isPinned}
|
|
191
|
+
onOpenFolder={onOpenFolder}
|
|
192
|
+
onSelectSessions={onSelectSessions}
|
|
193
|
+
onNewWorktree={canCreateWorktree ? () => { onToggleMenu(); setWorktreeDialogOpen(true); } : undefined}
|
|
194
|
+
confirmDelete={confirmDelete}
|
|
195
|
+
onPin={onPin}
|
|
196
|
+
onDelete={onDelete}
|
|
197
|
+
onRequestDelete={onRequestDelete}
|
|
198
|
+
onCancelDelete={onCancelDelete}
|
|
199
|
+
/>
|
|
200
|
+
</AnchoredMenu>
|
|
180
201
|
</div>
|
|
181
202
|
</div>
|
|
182
203
|
)}
|
|
@@ -53,7 +53,15 @@ afterAll(() => {
|
|
|
53
53
|
restoreDomGlobals();
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Mount the header, then open its `⋯` menu the way a user does.
|
|
58
|
+
*
|
|
59
|
+
* The menu panel is PORTALLED to `document.body` (the row is inside the
|
|
60
|
+
* sidebar's scroller, and an `absolute` menu was clipped at its edge), so it can
|
|
61
|
+
* no longer be rendered by handing `showMenu: true` to a header that was never
|
|
62
|
+
* clicked: the panel is placed from the TRIGGER's measured rectangle, which
|
|
63
|
+
* only exists once that button has been pressed.
|
|
64
|
+
*/
|
|
57
65
|
function mountHeader(overrides: Partial<Parameters<typeof CategoryHeader>[0]> = {}): HTMLElement {
|
|
58
66
|
host = document.createElement('div');
|
|
59
67
|
document.body.appendChild(host);
|
|
@@ -64,9 +72,9 @@ function mountHeader(overrides: Partial<Parameters<typeof CategoryHeader>[0]> =
|
|
|
64
72
|
onToggleFolder: () => {},
|
|
65
73
|
checkbox: null,
|
|
66
74
|
batchActive: false,
|
|
67
|
-
menuRef: { current: null },
|
|
68
75
|
showMenu: true,
|
|
69
76
|
onToggleMenu: () => {},
|
|
77
|
+
onCloseMenu: () => {},
|
|
70
78
|
onNewSession: () => {},
|
|
71
79
|
confirmDelete: false,
|
|
72
80
|
onPin: () => {},
|
|
@@ -80,33 +88,44 @@ function mountHeader(overrides: Partial<Parameters<typeof CategoryHeader>[0]> =
|
|
|
80
88
|
return host;
|
|
81
89
|
}
|
|
82
90
|
|
|
83
|
-
/**
|
|
84
|
-
function
|
|
85
|
-
|
|
91
|
+
/** Press the row's `⋯` trigger, which is what mounts the portalled menu. */
|
|
92
|
+
async function openMenu(host: HTMLElement): Promise<void> {
|
|
93
|
+
const trigger = host.querySelector('button[aria-label^="Options for"]') as HTMLButtonElement | null;
|
|
94
|
+
if (!trigger) throw new Error('no options trigger rendered');
|
|
95
|
+
await act(async () => {
|
|
96
|
+
trigger.click();
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** The menu's own buttons, by their words — read from the document it portals into. */
|
|
101
|
+
function menuRows(): string[] {
|
|
102
|
+
return [...document.body.querySelectorAll('[aria-label^="Options for"] button')]
|
|
103
|
+
.map((button) => (button.textContent ?? '').trim())
|
|
104
|
+
.filter(Boolean);
|
|
86
105
|
}
|
|
87
106
|
|
|
88
107
|
describe('CategoryHeader worktree entry', () => {
|
|
89
|
-
test('the menu offers New worktree… when a handler is supplied', () => {
|
|
90
|
-
|
|
91
|
-
expect(menuRows(
|
|
108
|
+
test('the menu offers New worktree… when a handler is supplied', async () => {
|
|
109
|
+
await openMenu(mountHeader({ onNewWorktreeSession: () => {} }));
|
|
110
|
+
expect(menuRows()).toContain('New worktree…');
|
|
92
111
|
});
|
|
93
112
|
|
|
94
|
-
test('no row without a handler — a folder that cannot create one does not offer it', () => {
|
|
95
|
-
|
|
96
|
-
expect(menuRows(
|
|
113
|
+
test('no row without a handler — a folder that cannot create one does not offer it', async () => {
|
|
114
|
+
await openMenu(mountHeader());
|
|
115
|
+
expect(menuRows().some((row) => row.startsWith('New worktree'))).toBe(false);
|
|
97
116
|
});
|
|
98
117
|
|
|
99
|
-
test('a folder with no project path offers nothing: a worktree needs a repository', () => {
|
|
100
|
-
|
|
118
|
+
test('a folder with no project path offers nothing: a worktree needs a repository', async () => {
|
|
119
|
+
await openMenu(mountHeader({
|
|
101
120
|
folder: { ...folder, project_path: null },
|
|
102
121
|
onNewWorktreeSession: () => {},
|
|
103
|
-
});
|
|
104
|
-
expect(menuRows(
|
|
122
|
+
}));
|
|
123
|
+
expect(menuRows().some((row) => row.startsWith('New worktree'))).toBe(false);
|
|
105
124
|
});
|
|
106
125
|
|
|
107
126
|
test('clicking it opens the dialog, closed on its own name field', async () => {
|
|
108
|
-
|
|
109
|
-
const row = [...
|
|
127
|
+
await openMenu(mountHeader({ onNewWorktreeSession: () => {} }));
|
|
128
|
+
const row = [...document.body.querySelectorAll<HTMLButtonElement>('[aria-label^="Options for"] button')].find(
|
|
110
129
|
(button) => (button.textContent ?? '').trim() === 'New worktree…',
|
|
111
130
|
);
|
|
112
131
|
if (!row) throw new Error('no New worktree row rendered');
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useEffect,
|
|
1
|
+
import { useEffect, useState } from 'preact/hooks';
|
|
2
2
|
import { ChevronDown, ChevronUp } from 'lucide-preact';
|
|
3
3
|
import { useSearchParams } from '@/client/lib/router/search-params';
|
|
4
4
|
import { useFetcher } from '@/client/lib/router/fetcher';
|
|
5
|
-
import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
|
|
6
5
|
import { useShowMore } from '@/client/hooks/ui/show-more';
|
|
7
6
|
import { useWorkspaceFolderActions } from '@/client/hooks/workspace/workspace-folder-actions';
|
|
8
7
|
import { useSessionDelete } from '@/client/hooks/workspace/session-delete';
|
|
@@ -63,8 +62,7 @@ export function Category({
|
|
|
63
62
|
useEffect(() => {
|
|
64
63
|
if (typeof folder.isExpanded === 'boolean') setIsOpen(folder.isExpanded);
|
|
65
64
|
}, [folder.isExpanded]);
|
|
66
|
-
|
|
67
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
65
|
+
|
|
68
66
|
const { refresh } = useSidebarData();
|
|
69
67
|
const toggleFetcher = useFetcher<{ success?: boolean }>();
|
|
70
68
|
const {
|
|
@@ -80,10 +78,13 @@ export function Category({
|
|
|
80
78
|
} = useWorkspaceFolderActions(folder, refresh, onToast);
|
|
81
79
|
const sessionDelete = useSessionDelete();
|
|
82
80
|
|
|
83
|
-
|
|
81
|
+
// The menu's own portalled backdrop is the dismissal now, so there is exactly
|
|
82
|
+
// one close path (`common/anchored-menu/`) and it also closes the inline
|
|
83
|
+
// delete confirmation.
|
|
84
|
+
const closeMenu = () => {
|
|
84
85
|
setShowMenu(false);
|
|
85
86
|
cancelDelete();
|
|
86
|
-
}
|
|
87
|
+
};
|
|
87
88
|
|
|
88
89
|
const allSessions = folder.sessions;
|
|
89
90
|
|
|
@@ -170,9 +171,9 @@ export function Category({
|
|
|
170
171
|
: null
|
|
171
172
|
}
|
|
172
173
|
batchActive={Boolean(batch)}
|
|
173
|
-
menuRef={menuRef}
|
|
174
174
|
showMenu={showMenu}
|
|
175
175
|
onToggleMenu={() => setShowMenu(!showMenu)}
|
|
176
|
+
onCloseMenu={closeMenu}
|
|
176
177
|
onNewSession={() => onNewSessionForFolder(folder.id)}
|
|
177
178
|
onNewWorktreeSession={onNewWorktreeSession}
|
|
178
179
|
onOpenFolder={onOpenFolder}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One product's changelog for the version that is RUNNING, opened from About.
|
|
3
|
+
*
|
|
4
|
+
* The About modal's pair of buttons answer "what am I running" — the update
|
|
5
|
+
* popup answers "what would I get" — so this dialog renders exactly one section,
|
|
6
|
+
* taken from the install's own version by the server. It sits above About rather
|
|
7
|
+
* than replacing it, and `z-[65]` keeps it above the update popup's layer for the
|
|
8
|
+
* case where both are reachable at once.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { createPortal } from 'preact/compat';
|
|
12
|
+
import { AlertCircle, ExternalLink, RefreshCw, Sparkles } from 'lucide-preact';
|
|
13
|
+
import { Modal } from '@/client/components/common/Modal';
|
|
14
|
+
import { openLinksExternally, ReleaseSection } from '@/client/components/layout/update-popup/ReleaseNotes';
|
|
15
|
+
import { useActiveReleaseNotes } from '@/client/hooks/ui/updates/notes';
|
|
16
|
+
import type { UpdateTarget } from '@/shared/types/updates';
|
|
17
|
+
|
|
18
|
+
export interface NotesDialogProps {
|
|
19
|
+
target: UpdateTarget;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const PRODUCT: Record<UpdateTarget, string> = { kabmo: 'Kabmo', omp: 'Oh-My-Pi' };
|
|
24
|
+
|
|
25
|
+
export function NotesDialog({ target, onClose }: NotesDialogProps) {
|
|
26
|
+
const notes = useActiveReleaseNotes(target);
|
|
27
|
+
const data = notes.data;
|
|
28
|
+
const product = PRODUCT[target];
|
|
29
|
+
const version = data?.version ?? null;
|
|
30
|
+
// "installed" vs "running" names where the version came from: a package on
|
|
31
|
+
// disk for Kabmo, the live `omp` binary for Oh-My-Pi. Both are this machine's.
|
|
32
|
+
const origin = target === 'omp' ? 'running' : 'installed';
|
|
33
|
+
|
|
34
|
+
return createPortal(
|
|
35
|
+
<Modal
|
|
36
|
+
onClose={onClose}
|
|
37
|
+
zClass="z-[65]"
|
|
38
|
+
// A single release's notes are long prose — commit subjects, long PR and
|
|
39
|
+
// contributor names, 60+ wrapped list items in omp's case. At 560px the
|
|
40
|
+
// body was 542px of column and a release ran past 1900px of scroll, so the
|
|
41
|
+
// width is the reader's cost. 768px is the widest panel that still wraps
|
|
42
|
+
// those items once instead of three times while staying under a prose
|
|
43
|
+
// measure a reader can track; `max-h-full` keeps it inside a phone's
|
|
44
|
+
// viewport, where the body scrolls.
|
|
45
|
+
maxWidthClass="max-w-3xl"
|
|
46
|
+
ariaLabel={`What is new in ${product}`}
|
|
47
|
+
header={
|
|
48
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
49
|
+
<Sparkles size={16} className="shrink-0 text-ink/70" />
|
|
50
|
+
<div className="min-w-0">
|
|
51
|
+
<h2 className="text-sm font-semibold text-ink">What's new in {product}</h2>
|
|
52
|
+
<p className="truncate font-mono text-[11px] text-ink/50">
|
|
53
|
+
{version ? `v${version} · ${origin}` : `${origin} version…`}
|
|
54
|
+
</p>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
}
|
|
58
|
+
footer={
|
|
59
|
+
data?.changelogUrl ? (
|
|
60
|
+
<div className="border-t border-ink/10 px-5 py-3">
|
|
61
|
+
<a
|
|
62
|
+
href={data.changelogUrl}
|
|
63
|
+
target="_blank"
|
|
64
|
+
rel="noopener noreferrer"
|
|
65
|
+
className="inline-flex items-center gap-1.5 text-[11px] font-medium text-ink/60 transition-colors hover:text-ink"
|
|
66
|
+
>
|
|
67
|
+
<span>Full changelog</span>
|
|
68
|
+
<ExternalLink size={11} />
|
|
69
|
+
</a>
|
|
70
|
+
</div>
|
|
71
|
+
) : undefined
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
<div className="px-5 py-4" onClick={openLinksExternally}>
|
|
75
|
+
{notes.loading && (
|
|
76
|
+
<p className="flex items-center gap-2 text-[11px] text-ink/50">
|
|
77
|
+
<RefreshCw size={12} className="animate-spin motion-reduce:animate-none" />
|
|
78
|
+
<span>Loading release notes…</span>
|
|
79
|
+
</p>
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
{!notes.loading && notes.error && (
|
|
83
|
+
<div className="flex items-start gap-2">
|
|
84
|
+
<AlertCircle size={14} className="mt-0.5 shrink-0 text-ink/40" />
|
|
85
|
+
<p className="text-[11px] leading-4 text-ink/60">{notes.error}</p>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
|
|
89
|
+
{!notes.loading && data?.note && <ReleaseSection note={data.note} />}
|
|
90
|
+
</div>
|
|
91
|
+
</Modal>,
|
|
92
|
+
document.body,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The version line is the row a reader looks at to learn what is running, so
|
|
8
|
+
* the release-notes control belongs to that row and must be addressable by the
|
|
9
|
+
* product it opens — not by a generic "Info" name that would make the two lines
|
|
10
|
+
* indistinguishable to a screen reader or a spec.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
14
|
+
import { Window } from 'happy-dom';
|
|
15
|
+
import { h, render } from 'preact';
|
|
16
|
+
import { act } from 'preact/test-utils';
|
|
17
|
+
|
|
18
|
+
import { VersionLine } from '@/client/components/layout/session-sidebar/about-modal/VersionLine';
|
|
19
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
20
|
+
|
|
21
|
+
let container: HTMLElement;
|
|
22
|
+
|
|
23
|
+
function mount(label: string, notesLabel: string, onNotes: () => void): HTMLElement {
|
|
24
|
+
container = document.createElement('div');
|
|
25
|
+
document.body.appendChild(container);
|
|
26
|
+
act(() =>
|
|
27
|
+
render(h(VersionLine, { label, notesLabel, onNotes }), container),
|
|
28
|
+
);
|
|
29
|
+
return container;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
beforeAll(() => {
|
|
33
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
if (container) render(null, container);
|
|
38
|
+
container?.remove();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
afterAll(() => {
|
|
42
|
+
restoreDomGlobals();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('VersionLine', () => {
|
|
46
|
+
test('shows the version text beside a circle-i control named for its product', () => {
|
|
47
|
+
const el = mount('Kabmo v0.17.0', "What's new in Kabmo", () => {});
|
|
48
|
+
|
|
49
|
+
expect(el.textContent).toBe('Kabmo v0.17.0');
|
|
50
|
+
const button = el.querySelector('button');
|
|
51
|
+
expect(button?.getAttribute('aria-label')).toBe("What's new in Kabmo");
|
|
52
|
+
expect(button?.getAttribute('title')).toBe("What's new in Kabmo");
|
|
53
|
+
expect(button?.querySelector('svg')).not.toBeNull();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('the control opens that product’s notes', () => {
|
|
57
|
+
let opened = 0;
|
|
58
|
+
const el = mount('Oh-My-Pi 18.14.0', "What's new in Oh-My-Pi", () => {
|
|
59
|
+
opened += 1;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
act(() => {
|
|
63
|
+
el.querySelector('button')?.dispatchEvent(new window.Event('click', { bubbles: true }));
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(opened).toBe(1);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One install line in About — `Kabmo v0.17.0` — with the "circle i" control
|
|
3
|
+
* that opens that product's release notes.
|
|
4
|
+
*
|
|
5
|
+
* The version text and the control are one row because they describe one
|
|
6
|
+
* subject: the version that is running. A separate pair of buttons above the
|
|
7
|
+
* list read as an action on the update, which is the other question the updates
|
|
8
|
+
* row already answers.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Info } from 'lucide-preact';
|
|
12
|
+
|
|
13
|
+
export interface VersionLineProps {
|
|
14
|
+
/** The version text exactly as it is shown, e.g. `Kabmo v0.17.0`. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Accessible name of the notes control; it names the product. */
|
|
17
|
+
notesLabel: string;
|
|
18
|
+
onNotes: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function VersionLine({ label, notesLabel, onNotes }: VersionLineProps) {
|
|
22
|
+
return (
|
|
23
|
+
<p className="flex items-center justify-center gap-1.5">
|
|
24
|
+
<span>{label}</span>
|
|
25
|
+
<button
|
|
26
|
+
type="button"
|
|
27
|
+
onClick={onNotes}
|
|
28
|
+
aria-label={notesLabel}
|
|
29
|
+
title={notesLabel}
|
|
30
|
+
className="rounded-full p-0.5 text-ink/40 transition-colors hover:text-ink focus-visible:text-ink"
|
|
31
|
+
>
|
|
32
|
+
<Info size={13} aria-hidden="true" />
|
|
33
|
+
</button>
|
|
34
|
+
</p>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { useState } from 'preact/hooks';
|
|
1
2
|
import { createPortal } from 'preact/compat';
|
|
2
3
|
import { Heart, X } from 'lucide-preact';
|
|
3
4
|
import packageJson from '@/../package.json';
|
|
4
5
|
import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
|
|
5
6
|
import { BrandWordmark } from '@/client/components/common/brand-wordmark';
|
|
7
|
+
import { NotesDialog } from '@/client/components/layout/session-sidebar/about-modal/NotesDialog';
|
|
6
8
|
import { SocialLinks } from '@/client/components/layout/session-sidebar/about-modal/SocialLinks';
|
|
7
9
|
import { UpdateSection } from '@/client/components/layout/session-sidebar/about-modal/UpdateSection';
|
|
10
|
+
import { VersionLine } from '@/client/components/layout/session-sidebar/about-modal/VersionLine';
|
|
8
11
|
import { useKabmoEvent } from '@/client/hooks/ui/window-event';
|
|
9
12
|
import { UPDATE_POPUP_OPEN_EVENT } from '@/shared/lib/updates/popup-state';
|
|
13
|
+
import type { UpdateTarget } from '@/shared/types/updates';
|
|
10
14
|
|
|
11
15
|
export interface AboutModalProps {
|
|
12
16
|
isOpen: boolean;
|
|
@@ -16,6 +20,10 @@ export interface AboutModalProps {
|
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProps) {
|
|
23
|
+
// Which product's "what am I running" notes are open. The dialog draws above
|
|
24
|
+
// this panel instead of replacing it, so closing it returns here.
|
|
25
|
+
const [notesTarget, setNotesTarget] = useState<UpdateTarget | null>(null);
|
|
26
|
+
|
|
19
27
|
// "What's new" opens the popup, which draws at a higher layer: leaving this
|
|
20
28
|
// dialog mounted would stack two modals over the same subject, and its
|
|
21
29
|
// backdrop would swallow the popup's clicks.
|
|
@@ -34,50 +42,65 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
34
42
|
// handing its run over to this dialog: it opens over the chat, with the drawer
|
|
35
43
|
// closed, and was invisible.
|
|
36
44
|
return createPortal(
|
|
37
|
-
|
|
38
|
-
className="fixed inset-0 bg-ink/40 backdrop-blur-[2px] z-50 flex items-center justify-center p-4 animate-in fade-in duration-200"
|
|
39
|
-
onClick={onClose}
|
|
40
|
-
>
|
|
45
|
+
<>
|
|
41
46
|
<div
|
|
42
|
-
className="
|
|
43
|
-
onClick={
|
|
47
|
+
className="fixed inset-0 bg-ink/40 backdrop-blur-[2px] z-50 flex items-center justify-center p-4 animate-in fade-in duration-200"
|
|
48
|
+
onClick={onClose}
|
|
44
49
|
>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onClick={
|
|
48
|
-
className="absolute top-4 right-4 text-ink/40 hover:text-ink transition-colors p-1 rounded-md"
|
|
49
|
-
aria-label="Close"
|
|
50
|
+
<div
|
|
51
|
+
className="relative bg-paper border border-ink/15 rounded-2xl shadow-2xl w-full max-w-[340px] p-6 text-center text-ink select-none"
|
|
52
|
+
onClick={(e) => e.stopPropagation()}
|
|
50
53
|
>
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
{/* Close Button */}
|
|
55
|
+
<button
|
|
56
|
+
onClick={onClose}
|
|
57
|
+
className="absolute top-4 right-4 text-ink/40 hover:text-ink transition-colors p-1 rounded-md"
|
|
58
|
+
aria-label="Close"
|
|
59
|
+
>
|
|
60
|
+
<X size={18} className="stroke-[2.5]" />
|
|
61
|
+
</button>
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
{/* Brand mark */}
|
|
64
|
+
<div className="flex justify-center pt-2 pb-1">
|
|
65
|
+
<img src="/icon.svg" alt="Kabmo" width={96} height={96} draggable={false} />
|
|
66
|
+
</div>
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
{/* Title */}
|
|
69
|
+
<h2 className="text-xl font-bold tracking-tight mt-3 flex items-center justify-center">
|
|
70
|
+
<BrandWordmark className="text-2xl" />
|
|
71
|
+
</h2>
|
|
63
72
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
|
|
73
|
+
{/* App & Agent Versions. Each line's circle-i opens the release notes
|
|
74
|
+
for the version that is RUNNING; the updates section below answers
|
|
75
|
+
the other question — what an update would install. */}
|
|
76
|
+
<div className="text-xs text-ink/60 space-y-1 mt-1.5 font-mono">
|
|
77
|
+
<VersionLine
|
|
78
|
+
label={`Kabmo v${packageJson.version}`}
|
|
79
|
+
notesLabel="What's new in Kabmo"
|
|
80
|
+
onNotes={() => setNotesTarget('kabmo')}
|
|
81
|
+
/>
|
|
82
|
+
<VersionLine
|
|
83
|
+
label={`Oh-My-Pi ${updates.info?.omp.current ?? '…'}`}
|
|
84
|
+
notesLabel="What's new in Oh-My-Pi"
|
|
85
|
+
onNotes={() => setNotesTarget('omp')}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
69
88
|
|
|
70
|
-
|
|
89
|
+
<UpdateSection updates={updates} onToast={onToast} />
|
|
71
90
|
|
|
72
|
-
|
|
91
|
+
<SocialLinks />
|
|
73
92
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
{/* Footer */}
|
|
94
|
+
<p className="text-[11px] text-ink/50 font-normal mt-8 flex items-center justify-center gap-1.5">
|
|
95
|
+
<Heart size={12} className="fill-current text-error shrink-0" aria-hidden="true" />
|
|
96
|
+
Made with love for the community
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
79
99
|
</div>
|
|
80
|
-
|
|
100
|
+
{/* Sibling of the About backdrop, not a child: an event inside the portal
|
|
101
|
+
would otherwise bubble to that backdrop's `onClick` and close About. */}
|
|
102
|
+
{notesTarget && <NotesDialog target={notesTarget} onClose={() => setNotesTarget(null)} />}
|
|
103
|
+
</>,
|
|
81
104
|
document.body,
|
|
82
105
|
);
|
|
83
106
|
}
|