@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
|
@@ -92,11 +92,30 @@ const MINIMAL: BlockChrome = {
|
|
|
92
92
|
body: 'my-1.5 overflow-hidden rounded-md border border-dashed border-ink/15 px-3 py-2.5',
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* `tui` — omp's terminal transcript. A block is a LINE of coloured text, not a
|
|
97
|
+
* box: the tool row draws its own status line (`styles/Tui.tsx`), and a
|
|
98
|
+
* thinking block or a notice wears the same frameless shape in the terminal's
|
|
99
|
+
* own type, with its name in the accent and its subject in the meta hue. The
|
|
100
|
+
* body hangs off a hairline rule, the way a terminal prints output under the
|
|
101
|
+
* command that produced it.
|
|
102
|
+
*/
|
|
103
|
+
const TUI: BlockChrome = {
|
|
104
|
+
root: '',
|
|
105
|
+
frame: '',
|
|
106
|
+
header: 'flex w-full items-center gap-2 px-1 py-0.5 text-left transition-colors font-mono',
|
|
107
|
+
icon: 'flex shrink-0 items-center justify-center',
|
|
108
|
+
title: 'shrink-0 text-[11.5px] font-semibold text-info',
|
|
109
|
+
subtitle: 'min-w-0 truncate font-mono text-[10.5px] text-meta',
|
|
110
|
+
body: 'my-1.5 ml-2 overflow-hidden border-l border-ink/10 py-1.5 pl-3 font-mono',
|
|
111
|
+
};
|
|
112
|
+
|
|
95
113
|
const BY_MODE: Record<ToolRenderMode, BlockChrome> = {
|
|
96
114
|
card: CARD,
|
|
97
115
|
compact: COMPACT,
|
|
98
116
|
trace: TRACE,
|
|
99
117
|
minimal: MINIMAL,
|
|
118
|
+
tui: TUI,
|
|
100
119
|
};
|
|
101
120
|
|
|
102
121
|
export function blockChrome(mode: ToolRenderMode): BlockChrome {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* How a tool call is drawn in the chat transcript, as ONE of
|
|
7
|
+
* How a tool call is drawn in the chat transcript, as ONE of five modes.
|
|
8
8
|
*
|
|
9
9
|
* This is a READING style, not a capability: every mode renders the same call,
|
|
10
10
|
* the same facts and the same body — only the frame, the density and the
|
|
@@ -15,13 +15,15 @@
|
|
|
15
15
|
* - `compact` — one status line per call, facts inline, body inset on demand.
|
|
16
16
|
* - `trace` — a vertical rail per section, one node per call.
|
|
17
17
|
* - `minimal` — a faint line per call, read as part of the answer.
|
|
18
|
+
* - `tui` — omp's own terminal frame: a rounded box drawn from glyphs,
|
|
19
|
+
* with the header riding the top border.
|
|
18
20
|
*
|
|
19
21
|
* **The mode NAMES and the copy live here**; the markup lives in
|
|
20
22
|
* `tool-renderers/styles/`. A mode added here without a renderer is a build
|
|
21
23
|
* error at the switch in `ToolCallingSection`, not a silent fallback.
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
|
-
export type ToolRenderMode = 'card' | 'compact' | 'trace' | 'minimal';
|
|
26
|
+
export type ToolRenderMode = 'card' | 'compact' | 'trace' | 'minimal' | 'tui';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* The mode a document with no stored preference renders at. It is the value
|
|
@@ -30,11 +32,17 @@ export type ToolRenderMode = 'card' | 'compact' | 'trace' | 'minimal';
|
|
|
30
32
|
export const DEFAULT_TOOL_RENDER_MODE: ToolRenderMode = 'card';
|
|
31
33
|
|
|
32
34
|
/** Every mode, in the order the settings control lists them: fullest first. */
|
|
33
|
-
export const TOOL_RENDER_MODES = ['card', 'compact', 'trace', 'minimal'] as const;
|
|
35
|
+
export const TOOL_RENDER_MODES = ['card', 'compact', 'trace', 'minimal', 'tui'] as const;
|
|
34
36
|
|
|
35
37
|
/** A stored value written by another build is not a mode this one can draw. */
|
|
36
38
|
export function isToolRenderMode(value: unknown): value is ToolRenderMode {
|
|
37
|
-
return
|
|
39
|
+
return (
|
|
40
|
+
value === 'card' ||
|
|
41
|
+
value === 'compact' ||
|
|
42
|
+
value === 'trace' ||
|
|
43
|
+
value === 'minimal' ||
|
|
44
|
+
value === 'tui'
|
|
45
|
+
);
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/**
|
|
@@ -71,4 +79,9 @@ export const TOOL_RENDER_MODE_COPY: Record<ToolRenderMode, ToolRenderModeCopy> =
|
|
|
71
79
|
label: 'Minimal',
|
|
72
80
|
description: 'The quietest form: a faint line per call, read as part of the answer.',
|
|
73
81
|
},
|
|
82
|
+
tui: {
|
|
83
|
+
label: 'TUI',
|
|
84
|
+
description:
|
|
85
|
+
"omp's terminal frame: a rounded box with the header on the top border, the way the TUI draws a call.",
|
|
86
|
+
},
|
|
74
87
|
};
|
|
@@ -4,13 +4,21 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The `artifact://<id>` reference a truncated tool result carries.
|
|
7
|
+
* The `artifact://<id>` reference a rewritten or truncated tool result carries.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* the
|
|
9
|
+
* Two records name one, and both are read here:
|
|
10
|
+
*
|
|
11
|
+
* - `details.meta.minimized.artifactId` — the LOSSLESS original behind a shell
|
|
12
|
+
* minimizer rewrite (omp 18.16.0). The inline body is the compressed text, so
|
|
13
|
+
* this is the only way back to what the command actually printed.
|
|
14
|
+
* - `details.meta.limits.columnTruncated.artifactId` — the raw stream behind a
|
|
15
|
+
* capped result. Measured over 5,441 real results, 65 carry one and they are
|
|
16
|
+
* the longest outputs in the corpus, so the card can offer a way to read the
|
|
17
|
+
* rest instead of stopping at the 768 bytes the transcript kept.
|
|
18
|
+
*
|
|
19
|
+
* The minimized original wins when both are present: it holds the command's
|
|
20
|
+
* own bytes, while the truncated record only ever holds the stream omp already
|
|
21
|
+
* rewrote.
|
|
14
22
|
*
|
|
15
23
|
* Pure and shared: the card renders the chip, and the panel that opens it needs
|
|
16
24
|
* the same id and kind.
|
|
@@ -21,7 +29,7 @@ import type { ToolCallData } from '@/shared/types/chat';
|
|
|
21
29
|
export interface ArtifactRef {
|
|
22
30
|
/** Numeric id omp assigned the spill file. */
|
|
23
31
|
id: string;
|
|
24
|
-
/** Tool kind the file belongs to (`bash`, `eval`, `read`, …), when omp said. */
|
|
32
|
+
/** Tool kind the file belongs to (`bash`, `bash-original`, `eval`, `read`, …), when omp said. */
|
|
25
33
|
kind?: string;
|
|
26
34
|
/** How many bytes were dropped from the inline copy, when omp reported it. */
|
|
27
35
|
elidedBytes?: number;
|
|
@@ -38,24 +46,51 @@ const KIND_BY_TOOL: Record<string, string> = {
|
|
|
38
46
|
view_file: 'read',
|
|
39
47
|
};
|
|
40
48
|
|
|
41
|
-
/**
|
|
49
|
+
/** The kind holding the pre-minimizer stream, written only by the `bash` tool. */
|
|
50
|
+
const ORIGINAL_KIND_BY_TOOL: Record<string, string> = {
|
|
51
|
+
bash: 'bash-original',
|
|
52
|
+
terminal: 'bash-original',
|
|
53
|
+
run_command: 'bash-original',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** A numeric id, or undefined — anything else could never name a file. */
|
|
57
|
+
function numericId(value: unknown): string | undefined {
|
|
58
|
+
return typeof value === 'string' && /^\d+$/.test(value) ? value : undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function recordOf(value: unknown): Record<string, unknown> | undefined {
|
|
62
|
+
return value && typeof value === 'object' ? (value as Record<string, unknown>) : undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Walk a `details` bag to the artifact omp recorded, if any. */
|
|
42
66
|
export function artifactRefOf(tool: ToolCallData): ArtifactRef | null {
|
|
43
67
|
const details = tool.details;
|
|
44
68
|
if (!details || typeof details !== 'object') return null;
|
|
45
|
-
const meta = (details as Record<string, unknown>).meta;
|
|
46
|
-
if (!meta
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
|
|
69
|
+
const meta = recordOf((details as Record<string, unknown>).meta);
|
|
70
|
+
if (!meta) return null;
|
|
71
|
+
const key = (tool.name || tool.type || '').toLowerCase();
|
|
72
|
+
|
|
73
|
+
// The minimizer's own record is a rewrite, not a truncation: the bytes it
|
|
74
|
+
// dropped are `inputBytes - outputBytes`, and the file holds them all.
|
|
75
|
+
const minimized = recordOf(meta.minimized);
|
|
76
|
+
const originalId = numericId(minimized?.artifactId);
|
|
77
|
+
if (originalId) {
|
|
78
|
+
const inputBytes = typeof minimized?.inputBytes === 'number' ? minimized.inputBytes : undefined;
|
|
79
|
+
const outputBytes = typeof minimized?.outputBytes === 'number' ? minimized.outputBytes : undefined;
|
|
80
|
+
const saved = inputBytes !== undefined && outputBytes !== undefined && inputBytes > outputBytes
|
|
81
|
+
? inputBytes - outputBytes
|
|
82
|
+
: undefined;
|
|
83
|
+
return { id: originalId, kind: ORIGINAL_KIND_BY_TOOL[key], elidedBytes: saved };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const limits = recordOf(meta.limits);
|
|
87
|
+
const truncated = recordOf(limits?.columnTruncated);
|
|
88
|
+
const id = numericId(truncated?.artifactId);
|
|
89
|
+
if (!id) return null;
|
|
90
|
+
const elidedBytes = typeof truncated?.artifactElidedBytes === 'number' ? truncated.artifactElidedBytes : undefined;
|
|
55
91
|
// omp's record names the id and the cap but not the kind — the tool that
|
|
56
92
|
// produced the result is what tells them apart.
|
|
57
|
-
|
|
58
|
-
return { id, kind, elidedBytes };
|
|
93
|
+
return { id, kind: KIND_BY_TOOL[key], elidedBytes };
|
|
59
94
|
}
|
|
60
95
|
|
|
61
96
|
/** Request URL for one artifact's full text. */
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The fact chips for a `bash` call: outcome, cost, and what omp did to the
|
|
8
|
+
* output.
|
|
9
|
+
*
|
|
10
|
+
* Split out of `summary.ts`, which is at the repo's per-file ceiling, with the
|
|
11
|
+
* same contract as its `proc`/`wait` siblings — the facts describe the CALL,
|
|
12
|
+
* never the transport.
|
|
13
|
+
*
|
|
14
|
+
* Order is load-bearing: a service launch's identity leads (an exit code is not
|
|
15
|
+
* the story for a process meant to keep running), then the exit code, the
|
|
16
|
+
* clock, the output's size, and finally the two things that qualify the body on
|
|
17
|
+
* screen — the shell minimizer's rewrite (omp 18.16.0) and a background job.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { ToolCallData } from '@/shared/types/chat';
|
|
21
|
+
import type { ToolFact } from '@/shared/lib/chat/tool/summary';
|
|
22
|
+
import { bashServiceFacts } from '@/shared/lib/chat/tool/proc-facts';
|
|
23
|
+
import { formatToolMs } from '@/shared/lib/chat/tool/labels';
|
|
24
|
+
import { minimizedLabel, minimizedOutputOf } from '@/shared/lib/chat/tool/minimized';
|
|
25
|
+
|
|
26
|
+
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
27
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
28
|
+
? (value as Record<string, unknown>)
|
|
29
|
+
: undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function asNumber(value: unknown): number | undefined {
|
|
33
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function asString(value: unknown): string | undefined {
|
|
37
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Every fact a collapsed `bash` card states about the call. */
|
|
41
|
+
export function bashFacts(tool: ToolCallData, isError: boolean): ToolFact[] {
|
|
42
|
+
const details = asRecord(tool.details) ?? {};
|
|
43
|
+
const facts: ToolFact[] = [
|
|
44
|
+
// A `bash` that launches a named service answers with `details.service` —
|
|
45
|
+
// the same snapshot `proc://<id>` reports.
|
|
46
|
+
...bashServiceFacts(tool),
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
const exitCode = asNumber(details.exitCode);
|
|
50
|
+
if (exitCode !== undefined) {
|
|
51
|
+
facts.push({ kind: 'exit', label: `exit ${exitCode}`, tone: exitCode === 0 ? 'ok' : 'error' });
|
|
52
|
+
} else if (isError) {
|
|
53
|
+
facts.push({ kind: 'exit', label: 'failed', tone: 'error' });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const wallMs = asNumber(details.wallTimeMs);
|
|
57
|
+
if (wallMs !== undefined) {
|
|
58
|
+
facts.push({ kind: 'time', label: formatToolMs(wallMs) });
|
|
59
|
+
} else if (tool.duration || tool.time) {
|
|
60
|
+
// The MOCK/legacy path carries a preformatted duration instead of
|
|
61
|
+
// `wallTimeMs`; it is the same fact in the same slot.
|
|
62
|
+
facts.push({ kind: 'time', label: tool.duration || tool.time || '' });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// omp 18.16.0 rewrote the output through its shell minimizer and says so in
|
|
66
|
+
// `details.meta.minimized`. Without this chip the card showed the compressed
|
|
67
|
+
// body as if the command had produced it — a reader comparing the log they
|
|
68
|
+
// expected with the one on screen had no way to know 7 KB were dropped.
|
|
69
|
+
//
|
|
70
|
+
// It ranks BEFORE the line count on purpose: the count describes the text
|
|
71
|
+
// below, which is the rewrite. A collapsed row shows two facts beside its
|
|
72
|
+
// subtitle, so a rewrite named last would be the one folded into `+1` — the
|
|
73
|
+
// qualifier hidden behind the number it qualifies.
|
|
74
|
+
const minimized = minimizedOutputOf(tool);
|
|
75
|
+
if (minimized) {
|
|
76
|
+
facts.push({ kind: 'note', label: minimizedLabel(minimized), tone: 'warn' });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const output = (tool.output ?? '').trimEnd();
|
|
80
|
+
if (output) {
|
|
81
|
+
const lines = output.split(/\r?\n/).length;
|
|
82
|
+
if (lines > 1) facts.push({ kind: 'count', label: `${lines} lines` });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const async = asRecord(details.async);
|
|
86
|
+
if (async?.state === 'running') {
|
|
87
|
+
facts.push({ kind: 'warn', label: `background ${asString(async.jobId) ?? ''}`.trim(), tone: 'warn' });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const timeoutSeconds = asNumber(details.timeoutSeconds);
|
|
91
|
+
if (exitCode === undefined && isError && timeoutSeconds !== undefined) {
|
|
92
|
+
facts.push({ kind: 'note', label: `timeout ${timeoutSeconds}s`, tone: 'warn' });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return facts;
|
|
96
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shell minimizer's record on a `bash` result (omp 18.16.0).
|
|
8
|
+
*
|
|
9
|
+
* The fixture is verbatim from a real child: `git --no-pager log` in a 60-commit
|
|
10
|
+
* repo answered a `bash` RPC with
|
|
11
|
+
*
|
|
12
|
+
* details: { wallTimeMs: …, meta: { minimized: { filter: 'git',
|
|
13
|
+
* inputBytes: 10970, outputBytes: 3905, artifactId: '0' } } }
|
|
14
|
+
*
|
|
15
|
+
* and wrote the lossless original to `<sessionId>/0.bash-original.log`. The
|
|
16
|
+
* reloaded transcript carries the same record, so both paths are pinned.
|
|
17
|
+
*
|
|
18
|
+
* Pure function, no mounting.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { describe, expect, test } from 'bun:test';
|
|
22
|
+
import { minimizedLabel, minimizedOutputOf } from '@/shared/lib/chat/tool/minimized';
|
|
23
|
+
import { artifactRefOf } from '@/shared/lib/chat/tool/artifact';
|
|
24
|
+
import type { ToolCallData } from '@/shared/types/chat';
|
|
25
|
+
|
|
26
|
+
function tool(partial: Partial<ToolCallData> & Pick<ToolCallData, 'type'>): ToolCallData {
|
|
27
|
+
return { id: 'c1', name: partial.type, title: partial.type, ...partial } as ToolCallData;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const RECORD = { filter: 'git', inputBytes: 10970, outputBytes: 3905, artifactId: '0' };
|
|
31
|
+
|
|
32
|
+
describe('minimizedOutputOf', () => {
|
|
33
|
+
test('reads the record a real bash result carries', () => {
|
|
34
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { meta: { minimized: RECORD } } }))).toEqual({
|
|
35
|
+
filter: 'git',
|
|
36
|
+
inputBytes: 10970,
|
|
37
|
+
outputBytes: 3905,
|
|
38
|
+
artifactId: '0',
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('states the rewrite without the artifact when omp saved none', () => {
|
|
43
|
+
const { artifactId, ...noArtifact } = RECORD;
|
|
44
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { meta: { minimized: noArtifact } } })))
|
|
45
|
+
.toEqual({ filter: 'git', inputBytes: 10970, outputBytes: 3905 });
|
|
46
|
+
expect(artifactId).toBe('0');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('returns null for a result the minimizer left alone', () => {
|
|
50
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { meta: { limits: {} }, wallTimeMs: 12 } }))).toBeNull();
|
|
51
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { wallTimeMs: 12 } }))).toBeNull();
|
|
52
|
+
expect(minimizedOutputOf(tool({ type: 'bash' }))).toBeNull();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('refuses a record missing either size, which could only be guessed', () => {
|
|
56
|
+
// "→ 0 B" is a claim about a number omp did not send; the card says nothing
|
|
57
|
+
// instead.
|
|
58
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { meta: { minimized: { filter: 'git', inputBytes: 100 } } } }))).toBeNull();
|
|
59
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { meta: { minimized: { filter: 'git', outputBytes: 10 } } } }))).toBeNull();
|
|
60
|
+
expect(minimizedOutputOf(tool({ type: 'bash', details: { meta: { minimized: { inputBytes: 1, outputBytes: 0 } } } }))).toBeNull();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('labels the filter and both sizes', () => {
|
|
64
|
+
expect(minimizedLabel({ filter: 'git', inputBytes: 10970, outputBytes: 3905 })).toBe('git 10.7 KB → 3.8 KB');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe('artifactRefOf — the minimizer original', () => {
|
|
69
|
+
test('points at the bash-original file and states the bytes it saved', () => {
|
|
70
|
+
// The inline body is the REWRITE; `bash-original` holds what the command
|
|
71
|
+
// actually printed, so the chip must probe that kind, not `bash`.
|
|
72
|
+
expect(artifactRefOf(tool({ type: 'bash', details: { meta: { minimized: RECORD } } }))).toEqual({
|
|
73
|
+
id: '0',
|
|
74
|
+
kind: 'bash-original',
|
|
75
|
+
elidedBytes: 10970 - 3905,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('wins over a truncation record on the same result', () => {
|
|
80
|
+
const ref = artifactRefOf(tool({
|
|
81
|
+
type: 'bash',
|
|
82
|
+
details: {
|
|
83
|
+
meta: {
|
|
84
|
+
minimized: RECORD,
|
|
85
|
+
limits: { columnTruncated: { maxColumn: 768, unit: 'bytes', artifactId: '9' } },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
}));
|
|
89
|
+
expect(ref).toEqual({ id: '0', kind: 'bash-original', elidedBytes: 7065 });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('refuses a non-numeric minimizer id, which could never name a file', () => {
|
|
93
|
+
expect(artifactRefOf(tool({
|
|
94
|
+
type: 'bash',
|
|
95
|
+
details: { meta: { minimized: { ...RECORD, artifactId: '../../etc/passwd' } } },
|
|
96
|
+
}))).toBeNull();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shell minimizer's rewrite of a `bash` result (omp 18.16.0).
|
|
8
|
+
*
|
|
9
|
+
* omp compresses verbose command output (git, npm, cargo, …) before returning it
|
|
10
|
+
* to the model and records what it did in `details.meta.minimized`:
|
|
11
|
+
*
|
|
12
|
+
* { filter: "git", inputBytes: 10970, outputBytes: 3905, artifactId: "0" }
|
|
13
|
+
*
|
|
14
|
+
* `artifactId` names the LOSSLESS original under the `bash-original` artifact
|
|
15
|
+
* kind — the rewrite itself is lossy — so the card can offer the raw stream.
|
|
16
|
+
* Measured on a child running `git --no-pager log` in a 60-commit repo: the
|
|
17
|
+
* field arrives on the live `bash` result AND on the reloaded transcript's
|
|
18
|
+
* `toolResult.details.meta`, so both paths read it here.
|
|
19
|
+
*
|
|
20
|
+
* omp's own TUI states the same three facts (`Minimized: git 120.4KB → 3.2KB`
|
|
21
|
+
* in `formatMinimizedMeta`); Kabmo states them from the wire values so the card
|
|
22
|
+
* cannot disagree with what it renders.
|
|
23
|
+
*
|
|
24
|
+
* Pure and shared: no mounting, no DOM.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ToolCallData } from '@/shared/types/chat';
|
|
28
|
+
import { formatToolBytes } from '@/shared/lib/chat/tool/labels';
|
|
29
|
+
|
|
30
|
+
export interface MinimizedOutput {
|
|
31
|
+
/** The minimizer filter that ran (`git`, `npm`, `cargo`, …). */
|
|
32
|
+
filter: string;
|
|
33
|
+
/** Bytes the command produced. */
|
|
34
|
+
inputBytes: number;
|
|
35
|
+
/** Bytes the rewrite kept. */
|
|
36
|
+
outputBytes: number;
|
|
37
|
+
/** Artifact holding the lossless original, when omp saved one. */
|
|
38
|
+
artifactId?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Record `minimized` on a `bash`/`terminal` result, or null when there is none. */
|
|
42
|
+
export function minimizedOutputOf(tool: ToolCallData): MinimizedOutput | null {
|
|
43
|
+
const details = tool.details;
|
|
44
|
+
if (!details || typeof details !== 'object') return null;
|
|
45
|
+
const meta = details.meta;
|
|
46
|
+
if (!meta || typeof meta !== 'object') return null;
|
|
47
|
+
const record = (meta as Record<string, unknown>).minimized;
|
|
48
|
+
if (!record || typeof record !== 'object') return null;
|
|
49
|
+
const value = record as Record<string, unknown>;
|
|
50
|
+
const filter = typeof value.filter === 'string' && value.filter.trim() ? value.filter.trim() : undefined;
|
|
51
|
+
const inputBytes = typeof value.inputBytes === 'number' && Number.isFinite(value.inputBytes) ? value.inputBytes : undefined;
|
|
52
|
+
const outputBytes =
|
|
53
|
+
typeof value.outputBytes === 'number' && Number.isFinite(value.outputBytes) ? value.outputBytes : undefined;
|
|
54
|
+
// A record without the two sizes cannot be stated honestly — "→ 0 B" would be
|
|
55
|
+
// a claim about a number omp did not send.
|
|
56
|
+
if (!filter || inputBytes === undefined || outputBytes === undefined) return null;
|
|
57
|
+
const artifactId = typeof value.artifactId === 'string' && /^\d+$/.test(value.artifactId) ? value.artifactId : undefined;
|
|
58
|
+
return { filter, inputBytes, outputBytes, ...(artifactId ? { artifactId } : {}) };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** `git 10.7 KB → 3.8 KB` — the filter that ran and what it saved. */
|
|
62
|
+
export function minimizedLabel(minimized: MinimizedOutput): string {
|
|
63
|
+
return `${minimized.filter} ${formatToolBytes(minimized.inputBytes)} → ${formatToolBytes(minimized.outputBytes)}`;
|
|
64
|
+
}
|
|
@@ -6,14 +6,12 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* The collapsed card's one line.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `exit 0` on the 98% of bash results that report no code is the failure this
|
|
16
|
-
* guards against.
|
|
9
|
+
* A closed card must state what the call DID, from the data omp actually sends.
|
|
10
|
+
* The fixtures are verbatim `details` shapes measured off real toolResults
|
|
11
|
+
* (bash carries `wallTimeMs` on 97% of results and `exitCode` on only 2%,
|
|
12
|
+
* `edit` the excerpt diff on 99%, `grep` `matchCount` on 100%) — so the "no
|
|
13
|
+
* chip" cases are as load-bearing as the populated ones: a fabricated `exit 0`
|
|
14
|
+
* on the 98% of bash results that report no code is the failure this guards.
|
|
17
15
|
*
|
|
18
16
|
* Pure function, no mounting.
|
|
19
17
|
*/
|
|
@@ -87,6 +85,28 @@ describe('toolSummary — bash', () => {
|
|
|
87
85
|
}));
|
|
88
86
|
expect(summary?.line).toBe('900ms · 3 lines');
|
|
89
87
|
});
|
|
88
|
+
|
|
89
|
+
test('names the minimizer rewrite omp 18.16.0 records', () => {
|
|
90
|
+
// Verbatim from a real child: the body on the card is the COMPRESSED text,
|
|
91
|
+
// and without this chip a reader had no way to know 7 KB were dropped.
|
|
92
|
+
// It outranks the line count because the count describes the rewrite.
|
|
93
|
+
const summary = toolSummary(tool({
|
|
94
|
+
type: 'bash',
|
|
95
|
+
details: { wallTimeMs: 412, meta: { minimized: { filter: 'git', inputBytes: 10970, outputBytes: 3905, artifactId: '0' } } },
|
|
96
|
+
output: 'a\nb',
|
|
97
|
+
}));
|
|
98
|
+
expect(summary?.line).toBe('412ms · git 10.7 KB → 3.8 KB · 2 lines');
|
|
99
|
+
expect(summary?.facts.find((fact) => fact.kind === 'note')).toMatchObject({ tone: 'warn' });
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('states no rewrite when the minimizer left the output alone', () => {
|
|
103
|
+
const summary = toolSummary(tool({
|
|
104
|
+
type: 'bash',
|
|
105
|
+
details: { wallTimeMs: 12, meta: { limits: {} } },
|
|
106
|
+
output: 'ok',
|
|
107
|
+
}));
|
|
108
|
+
expect(summary?.line).not.toContain('→');
|
|
109
|
+
});
|
|
90
110
|
});
|
|
91
111
|
|
|
92
112
|
describe('toolSummary — edit', () => {
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
import type { ToolCallData } from '@/shared/types/chat';
|
|
28
28
|
import { procPathOf } from '@/shared/lib/omp/session/proc';
|
|
29
29
|
import { isExcerptFurniture } from '@/shared/lib/chat/excerpt';
|
|
30
|
-
import {
|
|
30
|
+
import { bashFacts } from '@/shared/lib/chat/tool/bash-facts';
|
|
31
|
+
import { procFacts } from '@/shared/lib/chat/tool/proc-facts';
|
|
31
32
|
import { waitFacts } from '@/shared/lib/chat/tool/wait-facts';
|
|
32
33
|
import {
|
|
33
34
|
countPhrase,
|
|
@@ -133,37 +134,7 @@ export function toolSummary(tool: ToolCallData): ToolSummary | null {
|
|
|
133
134
|
|
|
134
135
|
// ── bash / terminal ───────────────────────────────────────────────────────
|
|
135
136
|
if (key === 'bash' || key === 'terminal' || key === 'run_command') {
|
|
136
|
-
|
|
137
|
-
// the same snapshot `proc://<id>` reports — and its identity leads the row:
|
|
138
|
-
// an exit code is not the story for a process that is meant to keep running.
|
|
139
|
-
facts.push(...bashServiceFacts(tool));
|
|
140
|
-
const exitCode = asNumber(details.exitCode);
|
|
141
|
-
if (exitCode !== undefined) {
|
|
142
|
-
facts.push({ kind: 'exit', label: `exit ${exitCode}`, tone: exitCode === 0 ? 'ok' : 'error' });
|
|
143
|
-
} else if (isError) {
|
|
144
|
-
facts.push({ kind: 'exit', label: 'failed', tone: 'error' });
|
|
145
|
-
}
|
|
146
|
-
const wallMs = asNumber(details.wallTimeMs);
|
|
147
|
-
if (wallMs !== undefined) {
|
|
148
|
-
facts.push({ kind: 'time', label: formatToolMs(wallMs) });
|
|
149
|
-
} else if (tool.duration || tool.time) {
|
|
150
|
-
// The MOCK/legacy path carries a preformatted duration instead of
|
|
151
|
-
// `wallTimeMs`; it is the same fact in the same slot.
|
|
152
|
-
facts.push({ kind: 'time', label: tool.duration || tool.time || '' });
|
|
153
|
-
}
|
|
154
|
-
const output = (tool.output ?? '').trimEnd();
|
|
155
|
-
if (output) {
|
|
156
|
-
const lines = output.split(/\r?\n/).length;
|
|
157
|
-
if (lines > 1) facts.push({ kind: 'count', label: `${lines} lines` });
|
|
158
|
-
}
|
|
159
|
-
const async = asRecord(details.async);
|
|
160
|
-
if (async?.state === 'running') {
|
|
161
|
-
facts.push({ kind: 'warn', label: `background ${asString(async.jobId) ?? ''}`.trim(), tone: 'warn' });
|
|
162
|
-
}
|
|
163
|
-
const timeoutSeconds = asNumber(details.timeoutSeconds);
|
|
164
|
-
if (exitCode === undefined && isError && timeoutSeconds !== undefined) {
|
|
165
|
-
facts.push({ kind: 'note', label: `timeout ${timeoutSeconds}s`, tone: 'warn' });
|
|
166
|
-
}
|
|
137
|
+
facts.push(...bashFacts(tool, isError));
|
|
167
138
|
}
|
|
168
139
|
|
|
169
140
|
// ── edit / write ──────────────────────────────────────────────────────────
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The official colour of every file-type brand mark, resolved for both variants.
|
|
8
|
+
*
|
|
9
|
+
* `file-brand-paths.ts` carries Simple Icons' hex, which is chosen for the
|
|
10
|
+
* brand's own background. The same problem the provider marks have applies here
|
|
11
|
+
* — a `#F7DF1E` JavaScript yellow is 1.28:1 on the lightest paper — so the
|
|
12
|
+
* painted values come from the shared {@link legiblePair} rule instead of a
|
|
13
|
+
* second hand-maintained table.
|
|
14
|
+
*
|
|
15
|
+
* `dark: null` means "monochrome art": the mark is drawn in the theme's ink.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { BRAND_ICONS } from '@/shared/lib/icons/file-brand-paths';
|
|
19
|
+
import { legiblePair } from '@/shared/lib/theme/legibility';
|
|
20
|
+
|
|
21
|
+
export interface FileBrandColor {
|
|
22
|
+
/** The official Simple Icons hex, as published. */
|
|
23
|
+
base: string;
|
|
24
|
+
light: string;
|
|
25
|
+
dark: string | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const FILE_BRAND_COLORS: Readonly<Record<string, FileBrandColor>> = Object.fromEntries(
|
|
29
|
+
Object.entries(BRAND_ICONS).map(([name, brand]) => [name, { base: brand.color, ...legiblePair(brand.color) }]),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
/** The colour a file-type mark is painted in, or `null` for the theme ink. */
|
|
33
|
+
export function fileBrandColorFor(name: string | null | undefined, variant: 'light' | 'dark'): string | null {
|
|
34
|
+
if (!name) return null;
|
|
35
|
+
const entry = FILE_BRAND_COLORS[name];
|
|
36
|
+
if (!entry) return null;
|
|
37
|
+
return variant === 'dark' ? entry.dark : entry.light;
|
|
38
|
+
}
|