@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
|
@@ -269,3 +269,49 @@ describe('Proc panel — legacy hub tool', () => {
|
|
|
269
269
|
expect(text).toContain('22985');
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* omp 18.15.0 puts the caller's `i` intent on the job snapshot and leads its
|
|
275
|
+
* own `/jobs` rows with it. Kabmo drew `label` alone, so the purpose was
|
|
276
|
+
* dropped and the raw command stood in for it. Both lines are drawn now: the
|
|
277
|
+
* intent as the subject, the command beneath.
|
|
278
|
+
*/
|
|
279
|
+
describe('Proc panel — a job the model gave a purpose to', () => {
|
|
280
|
+
test('leads with the intent and keeps the command line beneath it', async () => {
|
|
281
|
+
const el = await mount({
|
|
282
|
+
type: 'read',
|
|
283
|
+
name: 'read',
|
|
284
|
+
target: 'proc://',
|
|
285
|
+
input: { path: 'proc://' },
|
|
286
|
+
output: 'bg_1 [bash] running — Start the dev server — bun run dev',
|
|
287
|
+
status: 'success',
|
|
288
|
+
details: {
|
|
289
|
+
proc: {
|
|
290
|
+
jobs: [
|
|
291
|
+
{ id: 'bg_1', type: 'bash', status: 'running', label: 'bun run dev', intent: 'Start the dev server', durationMs: 1200 },
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
const text = el.textContent ?? '';
|
|
297
|
+
expect(text).toContain('Start the dev server');
|
|
298
|
+
expect(text).toContain('bun run dev');
|
|
299
|
+
// The subject precedes the command: the purpose is the first line.
|
|
300
|
+
expect(text.indexOf('Start the dev server')).toBeLessThan(text.indexOf('bun run dev'));
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test('a job with no intent draws only its label', async () => {
|
|
304
|
+
const el = await mount({
|
|
305
|
+
type: 'read',
|
|
306
|
+
name: 'read',
|
|
307
|
+
target: 'proc://',
|
|
308
|
+
input: { path: 'proc://' },
|
|
309
|
+
output: '',
|
|
310
|
+
status: 'success',
|
|
311
|
+
details: {
|
|
312
|
+
proc: { jobs: [{ id: 'bg_2', type: 'task', status: 'running', label: 'audit', durationMs: 500 }] },
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
expect(el.textContent ?? '').toContain('audit');
|
|
316
|
+
});
|
|
317
|
+
});
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from '@/shared/lib/omp/session/proc';
|
|
38
38
|
import { FallbackOutput } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput';
|
|
39
39
|
import { ToolPanelHeader } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader';
|
|
40
|
-
import { jobProgressLine } from '@/shared/lib/omp/session/job-progress';
|
|
40
|
+
import { jobSubject, jobProgressLine } from '@/shared/lib/omp/session/job-progress';
|
|
41
41
|
|
|
42
42
|
/** Tone → class list. A toned chip is text-only; the ink palette has no room
|
|
43
43
|
* for a filled pill in a dense row. */
|
|
@@ -88,13 +88,16 @@ function DaemonFacts({ daemon, now }: { daemon: ProcDaemon; now: number }) {
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/** A job row: status, id, type, what it
|
|
91
|
+
/** A job row: status, id, type, what it is for, and how long it has run. */
|
|
92
92
|
function JobRow({ job }: { job: ProcJob }) {
|
|
93
93
|
const tone = jobTone(job.status);
|
|
94
94
|
const running = job.status === 'running';
|
|
95
95
|
const duration = typeof job.durationMs === 'number' ? formatProcDuration(job.durationMs) : undefined;
|
|
96
96
|
// This row has no percent chip, so the line carries the estimate itself.
|
|
97
97
|
const progress = jobProgressLine(job, { includePercent: true });
|
|
98
|
+
// omp 18.15.0 records the caller's intent on the job and leads its own rows
|
|
99
|
+
// with it; the label (the raw command) is the second line, not the subject.
|
|
100
|
+
const subject = jobSubject(job);
|
|
98
101
|
return (
|
|
99
102
|
<div className="space-y-0.5 px-3 py-1.5">
|
|
100
103
|
<div className="flex items-center gap-2 text-[11.5px]">
|
|
@@ -113,8 +116,8 @@ function JobRow({ job }: { job: ProcJob }) {
|
|
|
113
116
|
{job.type}
|
|
114
117
|
</span>
|
|
115
118
|
)}
|
|
116
|
-
<span className="min-w-0 flex-1 truncate text-ink/85" title={
|
|
117
|
-
{
|
|
119
|
+
<span className="min-w-0 flex-1 truncate text-ink/85" title={subject.primary}>
|
|
120
|
+
{subject.primary ?? job.resultText ?? job.errorText ?? ''}
|
|
118
121
|
</span>
|
|
119
122
|
{job.resolvedModel && (
|
|
120
123
|
<span className="hidden max-w-[120px] truncate font-mono text-[9px] text-ink/40 sm:inline-block">
|
|
@@ -126,6 +129,11 @@ function JobRow({ job }: { job: ProcJob }) {
|
|
|
126
129
|
<span className={`shrink-0 font-mono text-[9px] font-semibold ${TONE_CLASSES[tone]}`}>{job.status}</span>
|
|
127
130
|
)}
|
|
128
131
|
</div>
|
|
132
|
+
{subject.secondary && (
|
|
133
|
+
<div className="truncate font-mono text-[9px] text-ink/45" title={subject.secondary}>
|
|
134
|
+
{subject.secondary}
|
|
135
|
+
</div>
|
|
136
|
+
)}
|
|
129
137
|
{progress && <div className="truncate font-mono text-[9px] text-ink/40">{progress}</div>}
|
|
130
138
|
</div>
|
|
131
139
|
);
|
|
@@ -261,12 +269,13 @@ export function Proc({ tool }: { tool: ToolCallData }) {
|
|
|
261
269
|
{view.cancelled.map((outcome, index) => {
|
|
262
270
|
const job = view.jobs.find((row) => row.id === outcome.id);
|
|
263
271
|
const tone = jobTone(outcome.status);
|
|
272
|
+
const subject = jobSubject(job ?? {});
|
|
264
273
|
return (
|
|
265
274
|
<div key={`${outcome.id ?? index}`} className="flex items-center gap-2 px-3 py-1.5 text-[11.5px]">
|
|
266
275
|
<CircleSlash size={11} className="shrink-0 text-warning" />
|
|
267
276
|
<span className="shrink-0 font-mono text-[10px] font-semibold text-ink/80">{outcome.id ?? 'job'}</span>
|
|
268
|
-
<span className="min-w-0 flex-1 truncate text-ink/70" title={
|
|
269
|
-
{
|
|
277
|
+
<span className="min-w-0 flex-1 truncate text-ink/70" title={subject.primary}>
|
|
278
|
+
{subject.primary ?? subject.secondary ?? ''}
|
|
270
279
|
</span>
|
|
271
280
|
<span className={`shrink-0 font-mono text-[9px] font-semibold ${TONE_CLASSES[tone]}`}>
|
|
272
281
|
{outcome.status}
|
|
@@ -153,6 +153,40 @@ describe('Read panel — language and markdown', () => {
|
|
|
153
153
|
expect(rendered).toContain('Static content? Use read.');
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
+
test('an xd:// doc sectioned with XML wrappers renders headings, not tags', async () => {
|
|
157
|
+
// omp's `xd://eval/browser` docs mark `<instruction>`, `<examples>` and
|
|
158
|
+
// `<critical>` as XML wrappers rather than `##` headings. Prose escapes its
|
|
159
|
+
// own HTML, so the panel printed the wrapper lines literally and every
|
|
160
|
+
// section ran together as one block.
|
|
161
|
+
const text = [
|
|
162
|
+
'Drive real Chromium tabs.',
|
|
163
|
+
'',
|
|
164
|
+
'<instruction>',
|
|
165
|
+
'- Static content? Use `read`.',
|
|
166
|
+
'</instruction>',
|
|
167
|
+
'',
|
|
168
|
+
'<critical>',
|
|
169
|
+
'- MUST open a tab before direct use.',
|
|
170
|
+
'</critical>',
|
|
171
|
+
].join('\n');
|
|
172
|
+
const el = await mount(readTool({
|
|
173
|
+
target: 'xd://eval/browser',
|
|
174
|
+
input: { path: 'xd://eval/browser' },
|
|
175
|
+
output: text.split('\n').map((line, index) => `${index + 1}|${line}`).join('\n'),
|
|
176
|
+
details: {
|
|
177
|
+
contentType: 'text/plain',
|
|
178
|
+
totalLines: 9,
|
|
179
|
+
displayContent: { text, startLine: 1, lineNumbers: [1, 2, 3, 4, 5, 6, 7, 8, 9] },
|
|
180
|
+
},
|
|
181
|
+
}));
|
|
182
|
+
const rendered = el.textContent ?? '';
|
|
183
|
+
const headings = Array.from(el.querySelectorAll('h2')).map((node) => node.textContent);
|
|
184
|
+
expect(headings).toEqual(['Instruction', 'Critical']);
|
|
185
|
+
expect(rendered).not.toContain('<instruction>');
|
|
186
|
+
expect(rendered).not.toContain('</instruction>');
|
|
187
|
+
expect(el.querySelectorAll('ul li').length).toBe(2);
|
|
188
|
+
});
|
|
189
|
+
|
|
156
190
|
test('a one-row doc read keeps its line-number gutter out of the prose', async () => {
|
|
157
191
|
// omp's raw output prefixes every row with its line number, and the
|
|
158
192
|
// stripper needs two numbered rows to recognise the format — so the real
|
|
@@ -7,6 +7,7 @@ import { getImageMimeType } from '@/shared/lib/fs/file-kind';
|
|
|
7
7
|
import { buildFsRawUrl, isVirtualPath, stripReadSelector } from '@/shared/lib/fs/paths';
|
|
8
8
|
import { toolImageSrc } from '@/shared/lib/omp/session/tool-images';
|
|
9
9
|
import { MarkdownRenderer } from '@/client/components/common/MarkdownRenderer';
|
|
10
|
+
import { xmlSectionsToHeadings } from '@/shared/lib/markdown/xml-sections';
|
|
10
11
|
import type { ToolCallData } from '@/shared/types/chat';
|
|
11
12
|
import { MAX_OUTPUT_LINES, truncateTailLines } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/truncate';
|
|
12
13
|
import { extractLineMeta } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/read-line-meta';
|
|
@@ -185,6 +186,9 @@ export function Read({ tool, targetFilePath, output }: ReadPanelProps) {
|
|
|
185
186
|
* stripper that serves every other read keeps a one-row document's `1|`
|
|
186
187
|
* prefix (it needs two numbered rows to recognise the format). */
|
|
187
188
|
const markdownContent = displayText || parsedCode.cleanCode || displayContent;
|
|
189
|
+
/** An omp doc marks some sections with XML wrappers (`<instruction>…`), and
|
|
190
|
+
* prose escapes its own HTML: parse them as headings. Copy keeps the file. */
|
|
191
|
+
const markdownSource = useMemo(() => xmlSectionsToHeadings(markdownContent), [markdownContent]);
|
|
188
192
|
|
|
189
193
|
const visibleEntries = dirInfo.entries.slice(-MAX_OUTPUT_LINES);
|
|
190
194
|
const skippedEntries = dirInfo.entries.length - visibleEntries.length;
|
|
@@ -299,7 +303,7 @@ export function Read({ tool, targetFilePath, output }: ReadPanelProps) {
|
|
|
299
303
|
two numbered rows to recognise the format, so a one-row document
|
|
300
304
|
(`read xd://propose`) kept its prefix through it. */
|
|
301
305
|
<div className="max-h-80 overflow-auto rounded-lg border border-ink/8 bg-paper px-3.5 py-3 select-text">
|
|
302
|
-
<MarkdownRenderer content={
|
|
306
|
+
<MarkdownRenderer content={markdownSource} className="text-[12.5px] text-ink/85" />
|
|
303
307
|
</div>
|
|
304
308
|
) : rawContent ? (
|
|
305
309
|
/* Render Code Content with synchronized, straight line numbers and clean code */
|
|
@@ -280,4 +280,33 @@ describe('Wait panel — interrupted and messaged', () => {
|
|
|
280
280
|
expect(text).toContain('Sleeper');
|
|
281
281
|
expect(text).toContain('sleeper reporting in');
|
|
282
282
|
});
|
|
283
|
+
|
|
284
|
+
test('leads a job row with the intent omp 18.15.0 records', async () => {
|
|
285
|
+
const el = await mount({
|
|
286
|
+
type: 'wait',
|
|
287
|
+
name: 'wait',
|
|
288
|
+
status: 'running',
|
|
289
|
+
details: {
|
|
290
|
+
op: 'wait',
|
|
291
|
+
jobs: [
|
|
292
|
+
{ id: 'bg_1', type: 'bash', status: 'running', label: 'bun run dev', intent: 'Start the dev server', durationMs: 4_000 },
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
const text = el.textContent ?? '';
|
|
297
|
+
expect(text).toContain('Start the dev server');
|
|
298
|
+
expect(text).toContain('bun run dev');
|
|
299
|
+
// The purpose is the row's subject: it comes BEFORE the raw command.
|
|
300
|
+
expect(text.indexOf('Start the dev server')).toBeLessThan(text.indexOf('bun run dev'));
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test('a task job without an intent still draws its label', async () => {
|
|
304
|
+
const el = await mount({
|
|
305
|
+
type: 'wait',
|
|
306
|
+
name: 'wait',
|
|
307
|
+
status: 'running',
|
|
308
|
+
details: { op: 'wait', jobs: [{ id: 'bg_2', type: 'task', status: 'running', label: 'audit', durationMs: 2_000 }] },
|
|
309
|
+
});
|
|
310
|
+
expect(el.textContent ?? '').toContain('audit');
|
|
311
|
+
});
|
|
283
312
|
});
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
} from '@/shared/lib/omp/session/wait';
|
|
50
50
|
import { FallbackOutput } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput';
|
|
51
51
|
import { ToolPanelHeader } from '@/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader';
|
|
52
|
-
import { jobProgressLine } from '@/shared/lib/omp/session/job-progress';
|
|
52
|
+
import { jobSubject, jobProgressLine } from '@/shared/lib/omp/session/job-progress';
|
|
53
53
|
|
|
54
54
|
const TONE_CLASSES = {
|
|
55
55
|
ok: 'text-success',
|
|
@@ -127,11 +127,14 @@ function ProgressTrack({ percent, active }: { percent: number | null; active: bo
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
/** One job row: what it
|
|
130
|
+
/** One job row: what it is for, its status, and how long it has run. */
|
|
131
131
|
function JobRow({ job }: { job: WaitJob }) {
|
|
132
132
|
const tone = jobTone(job.status);
|
|
133
133
|
const running = job.status === 'running';
|
|
134
|
-
|
|
134
|
+
// omp 18.15.0 records the caller's intent on the job and leads its own rows
|
|
135
|
+
// with it, so `bun run dev` is not what the reader sees first.
|
|
136
|
+
const subject = jobSubject(job);
|
|
137
|
+
const label = subject.primary ?? job.resultText ?? job.errorText ?? job.id ?? '';
|
|
135
138
|
const percent = running ? job.completionPercent : undefined;
|
|
136
139
|
// The percent is already a chip in this row, so the progress line leaves it out.
|
|
137
140
|
const progress = jobProgressLine(job);
|
|
@@ -176,6 +179,11 @@ function JobRow({ job }: { job: WaitJob }) {
|
|
|
176
179
|
{running && percent !== undefined && (
|
|
177
180
|
<ProgressTrack percent={percent} active />
|
|
178
181
|
)}
|
|
182
|
+
{subject.secondary && (
|
|
183
|
+
<div className="truncate font-mono text-[9px] text-ink/45" title={subject.secondary}>
|
|
184
|
+
{subject.secondary.split('\n')[0]}
|
|
185
|
+
</div>
|
|
186
|
+
)}
|
|
179
187
|
{progress && (
|
|
180
188
|
<div className="truncate font-mono text-[9px] text-ink/40">{progress}</div>
|
|
181
189
|
)}
|
package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* "Full output" — the chip that opens the stream omp
|
|
7
|
+
* "Full output" — the chip that opens the stream omp kept beside the session.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Two records name one, and both are reachable here (`artifactRefOf`):
|
|
10
|
+
* a result too long to keep inline leaves `details.meta.limits.columnTruncated`
|
|
11
|
+
* — measured over 5,441 real results, 65 carry one, and they are the longest
|
|
12
|
+
* outputs in the corpus — and since 18.16.0 a result the shell minimizer
|
|
13
|
+
* REWROTE carries `details.meta.minimized`, whose file is the lossless original
|
|
14
|
+
* of the compressed body on screen.
|
|
14
15
|
*
|
|
15
16
|
* The chip lives in the card's action slot rather than inside a panel: it must
|
|
16
17
|
* be reachable without expanding anything, because the reason it exists is that
|
package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts
CHANGED
|
@@ -157,12 +157,35 @@ describe('toolCardHeader — read xd:// docs', () => {
|
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
+
describe('toolCardHeader — a wait names what it blocks on', () => {
|
|
161
|
+
test('leads with the job intent omp 18.15.0 records', () => {
|
|
162
|
+
// The header reads the SAME resolver as the job rows, so a card and its row
|
|
163
|
+
// cannot name different things — and the intent is the better subject: the
|
|
164
|
+
// raw command does not say what the job is for.
|
|
165
|
+
expect(header({
|
|
166
|
+
type: 'wait',
|
|
167
|
+
status: 'running',
|
|
168
|
+
details: {
|
|
169
|
+
op: 'wait',
|
|
170
|
+
jobs: [{ id: 'bg_1', type: 'bash', status: 'running', label: 'bun run dev', intent: 'Start the dev server' }],
|
|
171
|
+
},
|
|
172
|
+
})).toEqual({ title: 'Wait', subtitle: 'Start the dev server' });
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('falls back to the raw label when the job has no intent', () => {
|
|
176
|
+
expect(header({
|
|
177
|
+
type: 'wait',
|
|
178
|
+
status: 'running',
|
|
179
|
+
details: { op: 'wait', jobs: [{ id: 'bg_2', type: 'task', status: 'running', label: 'audit the diff' }] },
|
|
180
|
+
})).toEqual({ title: 'Wait', subtitle: 'audit the diff' });
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
160
184
|
describe('toolCardHeader — generic', () => {
|
|
161
185
|
test('splits a `name — subject` title', () => {
|
|
162
186
|
expect(header({ type: 'bash', title: 'grep — export function ToolCallCard' }))
|
|
163
187
|
.toEqual({ title: 'Grep', subtitle: 'export function ToolCallCard' });
|
|
164
188
|
});
|
|
165
|
-
|
|
166
189
|
test('carries the subagent from tasks[0] for a task call', () => {
|
|
167
190
|
expect(header({
|
|
168
191
|
type: 'task',
|
|
@@ -22,6 +22,7 @@ import { toTitleCase } from '@/shared/lib/chat/title-case';
|
|
|
22
22
|
import { parseAskQuestions } from '@/shared/lib/chat/ask-questions';
|
|
23
23
|
import { procOpLabel, procPathOf, procViewOf } from '@/shared/lib/omp/session/proc';
|
|
24
24
|
import { waitViewOf } from '@/shared/lib/omp/session/wait';
|
|
25
|
+
import { jobSubject } from '@/shared/lib/omp/session/job-progress';
|
|
25
26
|
import { isXdDocRead, xdDocPath } from '@/client/components/workspace/chat-timeline/tool-renderers/registry';
|
|
26
27
|
import { resolveTargetFile } from '@/client/components/workspace/chat-timeline/tool-renderers';
|
|
27
28
|
import {
|
|
@@ -114,11 +115,14 @@ export function toolCardHeader(tool: ToolCallData, toolKey: string): ToolCardHea
|
|
|
114
115
|
// The generic path printed the tool name and nothing else, so a card that
|
|
115
116
|
// blocked for two minutes was indistinguishable from a call that never ran.
|
|
116
117
|
// The subtitle names the job (or the message) the wait was for; the clock is
|
|
117
|
-
// a fact chip, not a title line.
|
|
118
|
+
// a fact chip, not a title line. The subject comes from `jobSubject`, the same
|
|
119
|
+
// resolver the job rows read, so a header and its row cannot name different
|
|
120
|
+
// things — and since omp 18.15.0 that means the model's intent when it gave
|
|
121
|
+
// one, with the raw command as the fallback.
|
|
118
122
|
if (toolKey === 'wait') {
|
|
119
123
|
const view = waitViewOf(tool);
|
|
120
124
|
const job = view?.jobs[0];
|
|
121
|
-
const subject = job?.
|
|
125
|
+
const subject = (job ? jobSubject(job).primary?.split('\n')[0]?.trim() : undefined) || job?.id || view?.waited?.from;
|
|
122
126
|
return { title: 'Wait', subtitle: subject ? clip(subject) : undefined };
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `tui` style — omp's terminal transcript, drawn as coloured text.
|
|
8
|
+
*
|
|
9
|
+
* The style is deliberately NOT a card: omp's terminal writes a call as a
|
|
10
|
+
* status line (`✔ Bash: bun test [done] · 599ms`), and the colour carries what
|
|
11
|
+
* a box would otherwise carry with borders. These are the properties that make
|
|
12
|
+
* it that line rather than a recoloured card.
|
|
13
|
+
*
|
|
14
|
+
* - No frame at all — no border, no fill, no radius on the row. A regression
|
|
15
|
+
* that reintroduces a card is visible here as a class.
|
|
16
|
+
* - Three separate claims, three separate colours: the outcome (`--theme-success`
|
|
17
|
+
* / `--theme-error` / `--theme-info` for a live run), the tool NAME in the
|
|
18
|
+
* accent, the SUBJECT in the meta hue. Merging the last two is the reported
|
|
19
|
+
* defect — the head then reads as one undifferentiated run of text.
|
|
20
|
+
* - Facts are terminal text (`599ms · exit 0`), not pills, and a diff keeps
|
|
21
|
+
* `+4` green and `−1` red inside one statement.
|
|
22
|
+
* - The head is the toggle, with the SHARED wording (`toolToggleLabel`), so
|
|
23
|
+
* `chat.e2e.ts`'s `[aria-label^="Expand "]` collection and `mobile.e2e.ts`'s
|
|
24
|
+
* `/^Expand Bash/` click still work, and the section's per-call intent
|
|
25
|
+
* heading is untouched (it is drawn outside the renderer).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
29
|
+
import { Window } from 'happy-dom';
|
|
30
|
+
import { h, render } from 'preact';
|
|
31
|
+
import { act } from 'preact/test-utils';
|
|
32
|
+
import { ToolCallingSection } from '@/client/components/workspace/chat-timeline/ToolCallingSection';
|
|
33
|
+
import { SessionStateProvider } from '@/client/components/common/session-state-provider';
|
|
34
|
+
import { primeKabmoSettings } from '@/shared/lib/settings/client';
|
|
35
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
36
|
+
import type { ToolCallData } from '@/shared/types/chat';
|
|
37
|
+
|
|
38
|
+
let container: HTMLElement;
|
|
39
|
+
|
|
40
|
+
beforeAll(() => installDomGlobals(new Window({ url: 'http://localhost' })));
|
|
41
|
+
afterAll(() => restoreDomGlobals());
|
|
42
|
+
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
primeKabmoSettings({ kabmo_settings: { toolRenderStyle: 'tui' } });
|
|
45
|
+
container = document.createElement('div');
|
|
46
|
+
document.body.appendChild(container);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
render(null, container);
|
|
51
|
+
container.remove();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const OK_TOOL: ToolCallData = {
|
|
55
|
+
id: 'tui-ok',
|
|
56
|
+
type: 'bash',
|
|
57
|
+
name: 'bash',
|
|
58
|
+
title: 'Bash',
|
|
59
|
+
status: 'success',
|
|
60
|
+
command: 'bun test',
|
|
61
|
+
detail: 'bun test',
|
|
62
|
+
output: 'TUI_OUTPUT_TOKEN',
|
|
63
|
+
intent: 'Running the suite',
|
|
64
|
+
details: { wallTimeMs: 599, exitCode: 0 },
|
|
65
|
+
} as ToolCallData;
|
|
66
|
+
|
|
67
|
+
const FAILED_TOOL: ToolCallData = {
|
|
68
|
+
id: 'tui-fail',
|
|
69
|
+
type: 'bash',
|
|
70
|
+
name: 'bash',
|
|
71
|
+
title: 'Bash',
|
|
72
|
+
status: 'error',
|
|
73
|
+
command: 'bun test',
|
|
74
|
+
detail: 'bun test',
|
|
75
|
+
output: 'boom',
|
|
76
|
+
details: { exitCode: 1 },
|
|
77
|
+
} as ToolCallData;
|
|
78
|
+
|
|
79
|
+
const RUNNING_TOOL: ToolCallData = {
|
|
80
|
+
id: 'tui-run',
|
|
81
|
+
type: 'bash',
|
|
82
|
+
name: 'bash',
|
|
83
|
+
title: 'Bash',
|
|
84
|
+
status: 'running',
|
|
85
|
+
command: 'bun run build',
|
|
86
|
+
detail: 'bun run dev',
|
|
87
|
+
output: '',
|
|
88
|
+
} as ToolCallData;
|
|
89
|
+
|
|
90
|
+
const EDIT_TOOL: ToolCallData = {
|
|
91
|
+
id: 'tui-edit',
|
|
92
|
+
type: 'edit_file',
|
|
93
|
+
name: 'edit',
|
|
94
|
+
title: 'Edit',
|
|
95
|
+
status: 'success',
|
|
96
|
+
target: 'src/app.ts',
|
|
97
|
+
detail: 'src/app.ts',
|
|
98
|
+
output: 'Applied 6 changes.',
|
|
99
|
+
details: { diff: 'a\n+b\n+c\n-d\n' },
|
|
100
|
+
} as ToolCallData;
|
|
101
|
+
|
|
102
|
+
async function mount(tools: ToolCallData[]): Promise<HTMLElement> {
|
|
103
|
+
await act(async () => {
|
|
104
|
+
render(
|
|
105
|
+
h(SessionStateProvider, {
|
|
106
|
+
sessionId: 'spec-tui',
|
|
107
|
+
children: h(ToolCallingSection, { tools }),
|
|
108
|
+
}),
|
|
109
|
+
container,
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
return container;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function row(el: HTMLElement): HTMLElement {
|
|
116
|
+
const found = el.querySelector('[data-tool-row="tui"]');
|
|
117
|
+
if (!found) throw new Error('no tui row');
|
|
118
|
+
return found as HTMLElement;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function head(el: HTMLElement): HTMLElement {
|
|
122
|
+
return row(el).querySelector('button') as HTMLElement;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The head's own spans, in order: glyph wrapper, title, subject, outcome… */
|
|
126
|
+
function headClasses(el: HTMLElement): string[] {
|
|
127
|
+
return Array.from(head(el).children).map((child) => (child as HTMLElement).className);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
describe('the tui style', () => {
|
|
131
|
+
test('the section announces the style and draws a LINE, not a card', async () => {
|
|
132
|
+
const el = await mount([OK_TOOL]);
|
|
133
|
+
expect(el.querySelector('[data-tool-section]')?.getAttribute('data-tool-style')).toBe('tui');
|
|
134
|
+
|
|
135
|
+
const frame = row(el);
|
|
136
|
+
expect(frame.className).toContain('font-mono');
|
|
137
|
+
// No card: no border, no fill, no rounded frame on the row.
|
|
138
|
+
expect(frame.className).not.toContain('border');
|
|
139
|
+
expect(frame.className).not.toContain('rounded');
|
|
140
|
+
expect(frame.className).not.toContain('bg-');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('the head is one status line: glyph, title, subject, bracketed outcome', async () => {
|
|
144
|
+
const el = await mount([OK_TOOL]);
|
|
145
|
+
const text = head(el).textContent ?? '';
|
|
146
|
+
expect(text).toContain('Bash');
|
|
147
|
+
expect(text).toContain(':');
|
|
148
|
+
expect(text).toContain('bun test');
|
|
149
|
+
// A one-line head carries the outcome as a word, not as the card's badge.
|
|
150
|
+
expect(text).toContain('[done]');
|
|
151
|
+
// …and the same word for a screen reader, from the shared glyph table.
|
|
152
|
+
expect(head(el).querySelector('.sr-only')?.textContent).toBe('Done');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('title and subject are different colours', async () => {
|
|
156
|
+
const el = await mount([OK_TOOL]);
|
|
157
|
+
const classes = headClasses(el);
|
|
158
|
+
// The name is the accent, the subject the meta hue — the two halves of the
|
|
159
|
+
// head must never render as one undifferentiated string.
|
|
160
|
+
const title = classes.find((cls) => cls.includes('text-info'));
|
|
161
|
+
const subject = classes.find((cls) => cls.includes('text-meta'));
|
|
162
|
+
expect(title).toBeDefined();
|
|
163
|
+
expect(subject).toBeDefined();
|
|
164
|
+
expect(title).not.toBe(subject);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test('the outcome colour follows the call state', async () => {
|
|
168
|
+
const ok = await mount([OK_TOOL]);
|
|
169
|
+
expect(head(ok).textContent).toContain('[done]');
|
|
170
|
+
expect(headClasses(ok).some((cls) => cls.includes('text-success'))).toBe(true);
|
|
171
|
+
|
|
172
|
+
render(null, container);
|
|
173
|
+
const failed = await mount([FAILED_TOOL]);
|
|
174
|
+
expect(head(failed).textContent).toContain('[failed]');
|
|
175
|
+
expect(headClasses(failed).some((cls) => cls.includes('text-error'))).toBe(true);
|
|
176
|
+
|
|
177
|
+
render(null, container);
|
|
178
|
+
const running = await mount([RUNNING_TOOL]);
|
|
179
|
+
expect(head(running).textContent).toContain('[running]');
|
|
180
|
+
expect(headClasses(running).some((cls) => cls.includes('text-info'))).toBe(true);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test('the collapsed line states the facts as terminal text', async () => {
|
|
184
|
+
const el = await mount([OK_TOOL]);
|
|
185
|
+
const text = row(el).textContent ?? '';
|
|
186
|
+
expect(text).toContain('599ms');
|
|
187
|
+
expect(text).toContain('exit 0');
|
|
188
|
+
// One statement, not a row of pills.
|
|
189
|
+
expect(text).toContain('·');
|
|
190
|
+
// The facts are NOT behind the toggle: they are on the collapsed line.
|
|
191
|
+
expect(head(el).textContent).toContain('599ms');
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test('expanding shows the shared body and collapsing hides it', async () => {
|
|
195
|
+
const el = await mount([OK_TOOL]);
|
|
196
|
+
expect(head(el).getAttribute('aria-label')).toBe('Expand Bash — bun test');
|
|
197
|
+
expect(el.querySelector('.code-surface')).toBeNull();
|
|
198
|
+
|
|
199
|
+
await act(async () => {
|
|
200
|
+
head(el).click();
|
|
201
|
+
});
|
|
202
|
+
expect(head(el).getAttribute('aria-expanded')).toBe('true');
|
|
203
|
+
expect(head(el).getAttribute('aria-label')).toBe('Collapse Bash — bun test');
|
|
204
|
+
expect(el.querySelector('.code-surface')).not.toBeNull();
|
|
205
|
+
expect(row(el).textContent).toContain('TUI_OUTPUT_TOKEN');
|
|
206
|
+
|
|
207
|
+
await act(async () => {
|
|
208
|
+
head(el).click();
|
|
209
|
+
});
|
|
210
|
+
expect(el.querySelector('.code-surface')).toBeNull();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('a diff keeps its two halves coloured inside one fact', async () => {
|
|
214
|
+
const el = await mount([EDIT_TOOL]);
|
|
215
|
+
const text = row(el).textContent ?? '';
|
|
216
|
+
expect(text).toContain('+2');
|
|
217
|
+
expect(text).toContain('−1');
|
|
218
|
+
const marks = Array.from(row(el).querySelectorAll('.text-success, .text-error')) as HTMLElement[];
|
|
219
|
+
expect(marks.some((node) => node.textContent === '+2')).toBe(true);
|
|
220
|
+
expect(marks.some((node) => node.textContent === '−1')).toBe(true);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test('the per-card intent heading the section draws survives the style', async () => {
|
|
224
|
+
const el = await mount([OK_TOOL]);
|
|
225
|
+
expect(el.textContent).toContain('Running the suite');
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test('the toggle affordance follows the open state', async () => {
|
|
229
|
+
const el = await mount([OK_TOOL]);
|
|
230
|
+
// `▸` closed, `▾` open — omp's own navigator glyphs.
|
|
231
|
+
expect(row(el).textContent).toContain('▸');
|
|
232
|
+
await act(async () => {
|
|
233
|
+
head(el).click();
|
|
234
|
+
});
|
|
235
|
+
expect(row(el).textContent).toContain('▾');
|
|
236
|
+
});
|
|
237
|
+
});
|