@kabmo-labs/kabmo 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +523 -441
- package/dist/client/static/js/{index-rerjq5th.js → index-fcee4c13.js} +828 -818
- package/dist/client/static/js/index-sxdw908m.css +1 -0
- package/marketplace/plugins/command-runner/package.json +3 -2
- package/marketplace/plugins/git-forge/package.json +3 -2
- package/marketplace/plugins/session-info/package.json +3 -2
- package/marketplace/plugins/stats/package.json +3 -2
- package/package.json +3 -1
- package/src/client/components/auth/login-screen/index.tsx +2 -1
- package/src/client/components/common/ComposerPicker.tsx +1 -1
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/Modal.tsx +2 -2
- package/src/client/components/common/PWAInstallButton.tsx +2 -2
- package/src/client/components/common/ViewportSelector.tsx +1 -1
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +147 -0
- package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
- package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
- package/src/client/components/common/brand-wordmark/index.tsx +13 -2
- package/src/client/components/common/checkbox/style.test.ts +139 -0
- package/src/client/components/common/checkbox/style.ts +51 -0
- package/src/client/components/common/context-usage-button/index.tsx +2 -2
- package/src/client/components/common/file-icon/index.tsx +23 -9
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
- package/src/client/components/common/markdown-review/index.tsx +129 -0
- package/src/client/components/common/panel-mark/index.tsx +97 -0
- package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
- package/src/client/components/common/provider-icon/index.test.ts +14 -0
- package/src/client/components/common/provider-icon/index.tsx +4 -0
- package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
- package/src/client/components/common/provider-icon/resolve.ts +16 -3
- package/src/client/components/common/server-control/Panel.tsx +33 -23
- package/src/client/components/common/server-control/index.test.tsx +11 -5
- package/src/client/components/common/server-control/index.tsx +10 -8
- package/src/client/components/common/session-actions-menu/index.tsx +1 -1
- package/src/client/components/common/toolbar-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +22 -3
- package/src/client/components/layout/LeftDock.tsx +9 -2
- package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
- package/src/client/components/layout/WindowAura.tsx +27 -0
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
- package/src/client/components/layout/desktop-layout/index.tsx +3 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +44 -23
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
- package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
- package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +40 -14
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
- package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
- package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
- package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/mobile/panel-chips.tsx +10 -2
- package/src/client/components/settings/Modal.tsx +4 -4
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/apply-side-effects.test.ts +30 -0
- package/src/client/components/settings/apply-side-effects.ts +14 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
- package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
- package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
- package/src/client/components/settings/categories/McpSettings.tsx +4 -21
- package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
- package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +93 -77
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +28 -15
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
- package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
- package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
- package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +37 -8
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
- package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
- package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
- package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
- package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
- package/src/client/components/workspace/browser-panel/index.tsx +50 -4
- package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
- package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
- package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
- package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
- package/src/client/components/workspace/diff-panel/changes.ts +28 -12
- package/src/client/components/workspace/diff-panel/index.tsx +2 -2
- package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
- package/src/client/components/workspace/diff-panel/merge.ts +21 -1
- package/src/client/components/workspace/editor/Body.tsx +7 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
- package/src/client/components/workspace/editor/FilePane.tsx +12 -0
- package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
- package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
- package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +25 -22
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
- package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
- package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
- package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
- package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
- package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- package/src/client/components/workspace/git-panel/index.tsx +7 -0
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
- package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
- package/src/client/components/workspace/search-panel/Body.tsx +1 -1
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
- package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
- package/src/client/data/agent-data/builtin.ts +0 -10
- package/src/client/data/agent-data/orchestrator.ts +0 -45
- package/src/client/data/agent-data/specialist.ts +0 -100
- package/src/client/data/mock/token-usage.ts +170 -120
- package/src/client/data/settings/omp-schema.json +33 -1
- package/src/client/glass.css +785 -0
- package/src/client/glass.test.ts +346 -0
- package/src/client/hooks/browser/use-annotate.test.ts +143 -0
- package/src/client/hooks/browser/use-annotate.ts +98 -0
- package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
- package/src/client/hooks/browser/use-close-tab.ts +67 -0
- package/src/client/hooks/browser/use-screencast.ts +13 -1
- package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
- package/src/client/hooks/chat/composer/browser-context.ts +40 -16
- package/src/client/hooks/chat/composer/items.test.ts +1 -1
- package/src/client/hooks/chat/composer/review-context.ts +38 -0
- package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
- package/src/client/hooks/chat/composer/use-draft.ts +31 -2
- package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
- package/src/client/hooks/editor/use-document-annotations.ts +124 -0
- package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
- package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
- package/src/client/hooks/editor/use-preview-review.ts +148 -0
- package/src/client/hooks/settings/agents.ts +149 -0
- package/src/client/hooks/settings/crud-list.test.ts +28 -6
- package/src/client/hooks/settings/crud-list.ts +96 -57
- package/src/client/hooks/settings/omp-config.ts +164 -0
- package/src/client/hooks/settings/useTokenUsage.ts +125 -0
- package/src/client/hooks/settings/write-feedback.test.ts +104 -0
- package/src/client/hooks/settings/write-feedback.ts +63 -0
- package/src/client/hooks/ui/glass-support.ts +57 -0
- package/src/client/hooks/ui/icon-style.ts +59 -0
- package/src/client/hooks/ui/markdown-hydration.ts +125 -0
- package/src/client/hooks/ui/stuck-header.test.ts +188 -0
- package/src/client/hooks/ui/stuck-header.ts +91 -0
- package/src/client/hooks/ui/style-attributes.test.ts +120 -0
- package/src/client/hooks/ui/surface-style.ts +56 -0
- package/src/client/hooks/ui/updates/index.test.ts +100 -1
- package/src/client/hooks/ui/updates/index.ts +50 -0
- package/src/client/hooks/ui/updates/notes.test.ts +138 -0
- package/src/client/hooks/ui/updates/notes.ts +57 -0
- package/src/client/hooks/workspace/panel-hues.ts +23 -0
- package/src/client/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/main.tsx +10 -0
- package/src/client/tailwind.css +329 -11
- package/src/server/lib/assets/shell-attributes.server.ts +80 -0
- package/src/server/lib/assets/shell-attributes.test.ts +86 -0
- package/src/server/lib/btw/lifecycle.server.ts +2 -2
- package/src/server/lib/db/schema.ts +7 -0
- package/src/server/lib/db/seed-terminal.test.ts +4 -0
- package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
- package/src/server/lib/omp/config/agents.ts +231 -61
- package/src/server/lib/omp/config/definitions.test.ts +9 -105
- package/src/server/lib/omp/config/extensions.ts +16 -7
- package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
- package/src/server/lib/omp/rpc/constants.test.ts +11 -0
- package/src/server/lib/omp/rpc/constants.ts +15 -0
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
- package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/rpc/manager.ts +2 -2
- package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
- package/src/server/lib/omp/rpc/process.test.ts +106 -0
- package/src/server/lib/omp/rpc/process.ts +39 -18
- package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
- package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
- package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
- package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
- package/src/server/lib/omp/rpc/session-commands.ts +17 -3
- package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
- package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
- package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
- package/src/server/lib/omp/rpc/utility.ts +12 -0
- package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
- package/src/server/lib/panels/manifest.test.ts +20 -0
- package/src/server/lib/panels/manifest.ts +12 -0
- package/src/server/lib/panels/scan.server.ts +4 -0
- package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
- package/src/server/lib/queue/delivery-harness.ts +8 -4
- package/src/server/lib/queue/delivery.server.test.ts +29 -0
- package/src/server/lib/queue/delivery.server.ts +39 -0
- package/src/server/lib/queue/store.server.test.ts +22 -2
- package/src/server/lib/queue/store.server.ts +33 -11
- package/src/server/lib/review/schema.server.ts +45 -0
- package/src/server/lib/review/store.server.ts +138 -0
- package/src/server/lib/terminal/attach-replay.test.ts +132 -0
- package/src/server/lib/terminal/output.test.ts +166 -0
- package/src/server/lib/terminal/output.ts +104 -0
- package/src/server/lib/terminal/runtime.server.ts +5 -0
- package/src/server/lib/terminal/send-result.test.ts +33 -0
- package/src/server/lib/terminal/send-result.ts +32 -0
- package/src/server/lib/terminal/session.server.ts +45 -11
- package/src/server/lib/terminal/store-liveness.test.ts +4 -0
- package/src/server/lib/updates/active-notes.test.ts +149 -0
- package/src/server/lib/updates/active-notes.ts +75 -0
- package/src/server/lib/updates/changelog-file.ts +42 -11
- package/src/server/lib/updates/changelog.test.ts +15 -1
- package/src/server/lib/updates/omp.ts +42 -15
- package/src/server/lib/updates/release-url.ts +27 -1
- package/src/server/lib/usage/index-parse.test.ts +200 -0
- package/src/server/lib/usage/index-parse.ts +178 -0
- package/src/server/lib/usage/index-query.server.ts +248 -0
- package/src/server/lib/usage/index-scan.server.ts +343 -0
- package/src/server/lib/usage/index-schema.server.ts +82 -0
- package/src/server/lib/usage/index.test.ts +234 -0
- package/src/server/lib/usage/providers.server.ts +4 -53
- package/src/server/plugins/ssr.ts +22 -5
- package/src/server/routes/browser/index.ts +3 -0
- package/src/server/routes/browser/stream.ts +31 -2
- package/src/server/routes/browser/tabs.test.ts +94 -0
- package/src/server/routes/browser/tabs.ts +85 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/review/bindings.ts +11 -0
- package/src/server/routes/review/index.ts +127 -0
- package/src/server/routes/review/routes.test.ts +191 -0
- package/src/server/routes/settings/agents.test.ts +180 -0
- package/src/server/routes/settings/agents.ts +95 -102
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
- package/src/server/routes/telemetry/tokens.test.ts +145 -0
- package/src/server/routes/telemetry/tokens.ts +70 -149
- package/src/server/routes/terminal/ws.ts +6 -5
- package/src/server/routes/updates/index.ts +2 -0
- package/src/server/routes/updates/notes.ts +34 -0
- package/src/server/routes/updates/routes.test.ts +49 -0
- package/src/shared/lib/browser/annotate.test.ts +283 -0
- package/src/shared/lib/browser/annotate.ts +231 -0
- package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
- package/src/shared/lib/browser/frame-gate.test.ts +91 -0
- package/src/shared/lib/browser/frame-gate.ts +69 -0
- package/src/shared/lib/browser/frame-params.test.ts +43 -0
- package/src/shared/lib/browser/frame-params.ts +60 -0
- package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
- package/src/shared/lib/browser/frame-pipeline.ts +80 -0
- package/src/shared/lib/browser/page-context.ts +60 -4
- package/src/shared/lib/browser/snapshot.test.ts +115 -0
- package/src/shared/lib/browser/snapshot.ts +112 -0
- package/src/shared/lib/browser/tab-close.test.ts +74 -0
- package/src/shared/lib/browser/tab-close.ts +77 -0
- package/src/shared/lib/browser/viewer.ts +45 -26
- package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
- package/src/shared/lib/chat/tool/artifact.ts +55 -20
- package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
- package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
- package/src/shared/lib/chat/tool/minimized.ts +64 -0
- package/src/shared/lib/chat/tool/summary.test.ts +28 -8
- package/src/shared/lib/chat/tool/summary.ts +3 -32
- package/src/shared/lib/icons/file-brand-color.ts +38 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
- package/src/shared/lib/icons/icon-paint-css.ts +284 -0
- package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
- package/src/shared/lib/icons/tint.test.ts +273 -0
- package/src/shared/lib/icons/tint.ts +219 -0
- package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
- package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
- package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
- package/src/shared/lib/markdown/blocks/scan.ts +100 -0
- package/src/shared/lib/markdown/blocks/types.ts +62 -0
- package/src/shared/lib/markdown/marked.ts +58 -147
- package/src/shared/lib/markdown/math-extensions.ts +168 -0
- package/src/shared/lib/markdown/review/prompt.ts +77 -0
- package/src/shared/lib/markdown/review/reconcile.ts +55 -0
- package/src/shared/lib/markdown/review/review.test.ts +96 -0
- package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
- package/src/shared/lib/markdown/xml-sections.ts +139 -0
- package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
- package/src/shared/lib/models/provider/brand-color.ts +103 -0
- package/src/shared/lib/models/provider/label.ts +57 -0
- package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
- package/src/shared/lib/omp/config/agent-file.ts +43 -0
- package/src/shared/lib/omp/config/row-value.test.ts +95 -0
- package/src/shared/lib/omp/config/row-value.ts +97 -0
- package/src/shared/lib/omp/config/schema.test.ts +31 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +113 -47
- package/src/shared/lib/omp/rpc/frame.ts +107 -43
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/theme/catalog.test.ts +5 -4
- package/src/shared/lib/theme/catalog.ts +18 -3
- package/src/shared/lib/theme/glass-support.test.ts +38 -0
- package/src/shared/lib/theme/glass-support.ts +73 -0
- package/src/shared/lib/theme/icon-style.test.ts +74 -0
- package/src/shared/lib/theme/icon-style.ts +90 -0
- package/src/shared/lib/theme/legibility.ts +91 -0
- package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
- package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
- package/src/shared/lib/theme/surface-style.test.ts +68 -0
- package/src/shared/lib/theme/surface-style.ts +91 -0
- package/src/shared/lib/theme/theme.test.ts +11 -7
- package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -0
- package/src/shared/lib/usage/breakdown.test.ts +197 -0
- package/src/shared/lib/usage/breakdown.ts +241 -0
- package/src/shared/lib/usage/range.test.ts +204 -0
- package/src/shared/lib/usage/range.ts +240 -0
- package/src/shared/lib/usage/view.test.ts +85 -0
- package/src/shared/lib/usage/view.ts +74 -0
- package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
- package/src/shared/lib/workspace/panel-hues.ts +57 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/panels-registry.ts +6 -0
- package/src/shared/types/panels.ts +14 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/state.ts +30 -3
- package/src/shared/types/settings/write.ts +6 -0
- package/src/shared/types/tokenUsage.ts +128 -21
- package/src/shared/types/updates.ts +20 -0
- package/src/test-support/fake-omp-frames.ts +163 -0
- package/dist/client/static/js/index-3ve31rzx.css +0 -1
- package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
- package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
- package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
- package/src/server/lib/omp/session/usage/shaping.ts +0 -130
- /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx
CHANGED
|
@@ -142,11 +142,7 @@ export function ExtensionDialog({ request, onRespond }: ExtensionDialogProps) {
|
|
|
142
142
|
|
|
143
143
|
return (
|
|
144
144
|
<div
|
|
145
|
-
className="extension-dialog-backdrop fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6"
|
|
146
|
-
style={{
|
|
147
|
-
background: 'color-mix(in srgb, var(--theme-ink) 55%, transparent)',
|
|
148
|
-
backdropFilter: 'blur(8px)',
|
|
149
|
-
}}
|
|
145
|
+
className="extension-dialog-backdrop modal-scrim fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 backdrop-blur-[8px]"
|
|
150
146
|
onMouseDown={(e) => {
|
|
151
147
|
if (e.target === e.currentTarget) cancel();
|
|
152
148
|
}}
|
|
@@ -157,7 +153,7 @@ export function ExtensionDialog({ request, onRespond }: ExtensionDialogProps) {
|
|
|
157
153
|
aria-modal="true"
|
|
158
154
|
aria-label={request.title || methodMeta.label}
|
|
159
155
|
tabIndex={-1}
|
|
160
|
-
className="extension-dialog-panel w-full max-w-[560px] overflow-hidden rounded-2xl border border-ink/15 bg-paper shadow-2xl outline-none"
|
|
156
|
+
className="glass-overlay extension-dialog-panel w-full max-w-[560px] overflow-hidden rounded-2xl border border-ink/15 bg-paper shadow-2xl outline-none"
|
|
161
157
|
style={{
|
|
162
158
|
boxShadow: '0 24px 64px -8px color-mix(in srgb, var(--theme-ink) 28%, transparent)',
|
|
163
159
|
}}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `bash` card for a result omp's shell minimizer rewrote (18.16.0).
|
|
8
|
+
*
|
|
9
|
+
* The panel used to draw the compressed body with nothing saying so: a
|
|
10
|
+
* `git --no-pager log` that lost 7 KB of commits looked like the command's own
|
|
11
|
+
* output. The record omp sends is
|
|
12
|
+
*
|
|
13
|
+
* details.meta.minimized = { filter: 'git', inputBytes: 10970,
|
|
14
|
+
* outputBytes: 3905, artifactId: '0' }
|
|
15
|
+
*
|
|
16
|
+
* and this pins that the card states it, and that a result the minimizer left
|
|
17
|
+
* alone says nothing rather than drawing an empty strip.
|
|
18
|
+
*
|
|
19
|
+
* Rendered with `h()` against happy-dom, following `panels/Edit.test.ts`.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
23
|
+
import { Window } from 'happy-dom';
|
|
24
|
+
import { h, render } from 'preact';
|
|
25
|
+
import { act } from 'preact/test-utils';
|
|
26
|
+
import { Bash } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/Bash';
|
|
27
|
+
import type { ToolCallData } from '@/shared/types';
|
|
28
|
+
|
|
29
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'HTMLInputElement', 'Event', 'MouseEvent', 'KeyboardEvent'] as const;
|
|
30
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
31
|
+
|
|
32
|
+
let container: HTMLElement;
|
|
33
|
+
|
|
34
|
+
beforeAll(() => {
|
|
35
|
+
const win = new Window({ url: 'http://localhost' });
|
|
36
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
37
|
+
for (const key of DOM_GLOBALS) {
|
|
38
|
+
nativeGlobals[key] = target[key];
|
|
39
|
+
target[key] = (win as unknown as Record<string, unknown>)[key];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterAll(() => {
|
|
44
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
45
|
+
for (const key of DOM_GLOBALS) {
|
|
46
|
+
if (nativeGlobals[key] === undefined) delete target[key];
|
|
47
|
+
else target[key] = nativeGlobals[key];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
async function mount(details: Record<string, unknown>): Promise<HTMLElement> {
|
|
52
|
+
container = document.createElement('div');
|
|
53
|
+
document.body.appendChild(container);
|
|
54
|
+
const tool = {
|
|
55
|
+
id: 'c1',
|
|
56
|
+
type: 'bash',
|
|
57
|
+
name: 'bash',
|
|
58
|
+
title: 'bash',
|
|
59
|
+
command: 'git --no-pager log',
|
|
60
|
+
output: 'b7b0b41 commit number 60\n6c1bd61 commit number 59',
|
|
61
|
+
status: 'success',
|
|
62
|
+
details,
|
|
63
|
+
} as ToolCallData;
|
|
64
|
+
await act(async () => {
|
|
65
|
+
render(h(Bash, { tool }), container);
|
|
66
|
+
});
|
|
67
|
+
return container;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
describe('bash panel — minimized output', () => {
|
|
71
|
+
test('states the filter that ran and both byte sizes', async () => {
|
|
72
|
+
const el = await mount({
|
|
73
|
+
wallTimeMs: 412,
|
|
74
|
+
meta: { minimized: { filter: 'git', inputBytes: 10970, outputBytes: 3905, artifactId: '0' } },
|
|
75
|
+
});
|
|
76
|
+
const text = el.textContent ?? '';
|
|
77
|
+
expect(text).toContain('Minimized');
|
|
78
|
+
expect(text).toContain('git');
|
|
79
|
+
expect(text).toContain('10.7 KB');
|
|
80
|
+
expect(text).toContain('3.8 KB');
|
|
81
|
+
expect(text).toContain('the output below is the filtered rewrite');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('says nothing when the minimizer left the output alone', async () => {
|
|
85
|
+
const el = await mount({ wallTimeMs: 12, meta: { limits: {} } });
|
|
86
|
+
expect(el.textContent ?? '').not.toContain('Minimized');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useMemo } from 'preact/hooks';
|
|
2
|
-
import { Check, Clock, Server, Terminal } from 'lucide-preact';
|
|
2
|
+
import { Check, Clock, Server, Shrink, Terminal } from 'lucide-preact';
|
|
3
3
|
import type { ToolCallData } from '@/shared/types';
|
|
4
4
|
import { bashServiceOf, daemonTone, procUptime } from '@/shared/lib/omp/session/proc';
|
|
5
|
+
import { formatToolBytes } from '@/shared/lib/chat/tool/labels';
|
|
6
|
+
import { minimizedOutputOf } from '@/shared/lib/chat/tool/minimized';
|
|
5
7
|
import { CopyButton } from '@/client/components/common/CopyButton';
|
|
6
8
|
import { stripAnsiCodes } from '@/shared/lib/code/ansi';
|
|
7
9
|
import { isCodeLike } from '@/shared/lib/code/language';
|
|
@@ -83,6 +85,7 @@ export function Bash({ tool }: { tool: ToolCallData }) {
|
|
|
83
85
|
const service = bashServiceOf(tool);
|
|
84
86
|
const serviceTone = daemonTone(service?.state);
|
|
85
87
|
const serviceUptime = service ? procUptime(service) : undefined;
|
|
88
|
+
const minimized = minimizedOutputOf(tool);
|
|
86
89
|
|
|
87
90
|
return (
|
|
88
91
|
<div className="space-y-2">
|
|
@@ -141,6 +144,26 @@ export function Bash({ tool }: { tool: ToolCallData }) {
|
|
|
141
144
|
</div>
|
|
142
145
|
)}
|
|
143
146
|
|
|
147
|
+
{/* omp 18.16.0 compresses verbose shell output before returning it. The
|
|
148
|
+
body below is the REWRITE, so a card that said nothing about it looked
|
|
149
|
+
like the command had produced that text — `git log` lost 6 KB and the
|
|
150
|
+
reader had no way to know. Naming the filter and both sizes is what
|
|
151
|
+
omp's own TUI does; the full output is behind the artifact chip. */}
|
|
152
|
+
{minimized && (
|
|
153
|
+
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-ink/8 bg-paper px-3 py-2 font-mono text-[10.5px]">
|
|
154
|
+
<span className="flex items-center gap-1.5 text-[9.5px] font-semibold uppercase tracking-wider text-ink/40">
|
|
155
|
+
<Shrink size={11} className="text-ink/40" />
|
|
156
|
+
Minimized
|
|
157
|
+
</span>
|
|
158
|
+
<span className="font-semibold text-ink">{minimized.filter}</span>
|
|
159
|
+
<span className="text-ink/45">
|
|
160
|
+
<strong className="text-ink">{formatToolBytes(minimized.inputBytes)}</strong> {'→'}{' '}
|
|
161
|
+
<strong className="text-ink">{formatToolBytes(minimized.outputBytes)}</strong>
|
|
162
|
+
</span>
|
|
163
|
+
<span className="text-ink/35">the output below is the filtered rewrite</span>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
|
|
144
167
|
{/* Terminal Command Window */}
|
|
145
168
|
{command && (
|
|
146
169
|
<div className="overflow-hidden rounded-lg border border-ink/10 bg-paper">
|
|
@@ -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 */
|
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
|
|
@@ -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
|
+
});
|