@kabmo-labs/kabmo 0.27.0 → 0.29.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/bunfig.toml +6 -0
- package/dist/client/index.html +2 -2
- package/dist/client/index.js +530 -493
- package/dist/client/static/js/{index-e3qh2yps.js → index-43z47ngg.js} +1178 -1034
- package/dist/client/static/js/index-naa91727.css +1 -0
- package/dist/client/static/{manifest-q6h8k9e0.webmanifest → manifest-vdvdqpre.webmanifest} +1 -0
- package/marketplace/plugins/command-runner/package.json +3 -17
- package/marketplace/plugins/command-runner/settings-schema.json +14 -0
- package/marketplace/plugins/git-forge/README.md +17 -7
- package/marketplace/plugins/git-forge/package.json +4 -30
- package/marketplace/plugins/git-forge/panel.css +16 -0
- package/marketplace/plugins/git-forge/settings-schema.json +27 -0
- package/marketplace/plugins/git-forge/src/panel/Badge.tsx +35 -22
- package/marketplace/plugins/git-forge/src/panel/Change.tsx +20 -24
- package/marketplace/plugins/git-forge/src/panel/CiBadge.tsx +16 -7
- package/marketplace/plugins/git-forge/src/panel/Credential.tsx +31 -26
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +18 -2
- package/marketplace/plugins/git-forge/src/panel/Header.tsx +160 -96
- package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +60 -44
- package/marketplace/plugins/git-forge/src/panel/List.tsx +150 -22
- package/marketplace/plugins/git-forge/src/panel/Row.tsx +11 -5
- package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +17 -15
- package/marketplace/plugins/git-forge/src/panel/Write.tsx +84 -61
- package/marketplace/plugins/git-forge/src/panel/format.test.ts +99 -0
- package/marketplace/plugins/git-forge/src/panel/format.ts +59 -16
- package/marketplace/plugins/git-forge/src/panel/index.test.tsx +109 -5
- package/marketplace/plugins/git-forge/src/panel/index.tsx +37 -4
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +17 -0
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +31 -0
- package/marketplace/plugins/session-info/package.json +2 -10
- package/marketplace/plugins/session-info/settings-schema.json +8 -0
- package/marketplace/plugins/stats/README.md +17 -5
- package/marketplace/plugins/stats/package.json +3 -23
- package/marketplace/plugins/stats/settings-schema.json +20 -0
- package/marketplace/plugins/stats/src/app.tsx +1 -1
- package/marketplace/plugins/stats/src/groups.test.ts +46 -1
- package/marketplace/plugins/stats/src/groups.ts +22 -11
- package/marketplace/plugins/stats/src/harness-leases.test.ts +84 -0
- package/marketplace/plugins/stats/src/harness-leases.ts +132 -0
- package/marketplace/plugins/stats/src/labels.test.ts +54 -1
- package/marketplace/plugins/stats/src/labels.ts +33 -7
- package/marketplace/plugins/stats/src/sampler.test.ts +61 -0
- package/marketplace/plugins/stats/src/sampler.ts +39 -5
- package/marketplace/plugins/stats/src/snapshot.ts +6 -0
- package/package.json +4 -3
- package/public/manifest.webmanifest +1 -0
- package/src/client/components/common/ComposerTextarea.test.tsx +109 -0
- package/src/client/components/common/ComposerTextarea.tsx +6 -0
- package/src/client/components/common/ReloadPageButton.test.tsx +14 -0
- package/src/client/components/common/ReloadPageButton.tsx +11 -2
- package/src/client/components/common/diagram-viewer/read-block.test.ts +71 -0
- package/src/client/components/common/diagram-viewer/read-block.ts +40 -16
- package/src/client/components/common/file-icon/index.tsx +7 -1
- package/src/client/components/common/harness-glyph/brands.ts +7 -1
- package/src/client/components/common/harness-glyph/index.tsx +18 -1
- package/src/client/components/common/image-viewer/index.tsx +37 -165
- package/src/client/components/common/picker-search/index.tsx +70 -0
- package/src/client/components/common/search-select/index.tsx +2 -7
- package/src/client/components/common/session-actions-menu/index.test.tsx +106 -0
- package/src/client/components/common/session-actions-menu/index.tsx +43 -1
- package/src/client/components/common/session-row/TrailingSlot.tsx +9 -4
- package/src/client/components/common/session-row/index.tsx +4 -0
- package/src/client/components/common/session-row/session-row.test.tsx +6 -0
- package/src/client/components/common/zoom-pan-stage/index.tsx +258 -0
- package/src/client/components/common/zoom-pan-stage/zoom-pan-stage.test.tsx +87 -0
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +2 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +9 -1
- package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +7 -3
- package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +4 -1
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +12 -1
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.test.tsx +82 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +23 -3
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +1 -0
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +2 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +202 -0
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +80 -19
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +29 -7
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +3 -0
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +8 -0
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +181 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +41 -86
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +6 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +9 -1
- package/src/client/components/settings/Modal.tsx +6 -2
- package/src/client/components/settings/Sidebar.tsx +32 -7
- package/src/client/components/settings/categories/HarnessSettings.tsx +15 -9
- package/src/client/components/settings/categories/NotificationSettings.test.tsx +40 -15
- package/src/client/components/settings/categories/NotificationSettings.tsx +142 -64
- package/src/client/components/settings/categories/PanelPluginSettings.tsx +3 -3
- package/src/client/components/settings/categories/PluginSettings.tsx +1 -1
- package/src/client/components/settings/categories/harness-settings/ConfigForm.tsx +3 -6
- package/src/client/components/settings/categories/harness-settings/CustomHarnessForm.tsx +186 -0
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +36 -0
- package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +11 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +1 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +15 -1
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +1 -3
- package/src/client/components/settings/categories/panel-plugins/SettingsModal.test.tsx +165 -0
- package/src/client/components/settings/categories/panel-plugins/SettingsModal.tsx +260 -0
- package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +18 -4
- package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +64 -61
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +15 -4
- package/src/client/components/settings/groups.test.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.fork.test.ts +24 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +8 -4
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +34 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +3 -2
- package/src/client/components/workspace/chat-timeline/IrcNotice.test.tsx +55 -0
- package/src/client/components/workspace/chat-timeline/IrcNotice.tsx +71 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.fork.test.ts +80 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +13 -4
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +8 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +9 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +19 -0
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +32 -3
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.search.test.tsx +72 -0
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +53 -33
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/chat-input/props.ts +5 -5
- package/src/client/components/workspace/chat-timeline/index.tsx +11 -5
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +1 -9
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +129 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +30 -12
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +47 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +55 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
- package/src/client/components/workspace/editor/FilePane.tsx +41 -4
- package/src/client/components/workspace/editor/Notices.tsx +2 -2
- package/src/client/components/workspace/editor/Pane.tsx +2 -2
- package/src/client/components/workspace/editor/Toolbar.tsx +20 -10
- package/src/client/components/workspace/editor/index.tsx +6 -10
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +5 -3
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +26 -14
- package/src/client/components/workspace/editor/viewers/CsvGrid.tsx +52 -5
- package/src/client/components/workspace/editor/viewers/DataGrid.tsx +227 -41
- package/src/client/components/workspace/editor/viewers/DrawioView.tsx +93 -0
- package/src/client/components/workspace/editor/viewers/GridRow.tsx +91 -0
- package/src/client/components/workspace/editor/viewers/GridToolbar.tsx +53 -0
- package/src/client/components/workspace/editor/viewers/SheetView.tsx +152 -57
- package/src/client/components/workspace/editor/viewers/dispatch.tsx +42 -9
- package/src/client/components/workspace/editor/viewers/drawio-pages.test.ts +80 -0
- package/src/client/components/workspace/editor/viewers/drawio-pages.ts +63 -0
- package/src/client/components/workspace/editor/viewers/grid.test.ts +296 -0
- package/src/client/components/workspace/editor/viewers/use-cell-edit.ts +64 -0
- package/src/client/components/workspace/editor/viewers/use-grid-interaction.ts +216 -0
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +47 -2
- package/src/client/components/workspace/editor/viewers/workbook.ts +149 -0
- package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +262 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +30 -6
- package/src/client/components/workspace/file-explorer/Modals.tsx +8 -3
- package/src/client/components/workspace/file-explorer/RootOverlays.tsx +60 -0
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +6 -2
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +39 -49
- package/src/client/components/workspace/file-explorer/TreeItemModals.tsx +80 -0
- package/src/client/components/workspace/file-explorer/index.tsx +53 -29
- package/src/client/components/workspace/file-explorer/selection.test.tsx +109 -0
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +9 -1
- package/src/client/components/workspace/terminal-panel/focus.test.ts +70 -0
- package/src/client/components/workspace/terminal-panel/focus.ts +46 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +14 -1
- package/src/client/components/workspace/terminal-panel/mount.ts +17 -9
- package/src/client/components/workspace/terminal-panel/scroll-hold.test.ts +158 -0
- package/src/client/components/workspace/terminal-panel/scroll-hold.ts +136 -0
- package/src/client/data/settings/omp-schema.json +169 -22
- package/src/client/glass.css +39 -14
- package/src/client/glass.test.ts +37 -0
- package/src/client/hooks/chat/composer/history.test.ts +267 -0
- package/src/client/hooks/chat/composer/history.ts +146 -0
- package/src/client/hooks/chat/composer/use-draft.ts +45 -1
- package/src/client/hooks/chat/omp/pending-sessions.waiting.test.ts +11 -10
- package/src/client/hooks/chat/omp/pending-waiting.ts +15 -7
- package/src/client/hooks/chat/omp/prompt-send.test.ts +11 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +3 -0
- package/src/client/hooks/chat/timeline/actions.ts +4 -4
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +54 -0
- package/src/client/hooks/chat/timeline/ask-frames.ts +29 -1
- package/src/client/hooks/chat/timeline/composer-modes.ts +13 -2
- package/src/client/hooks/chat/timeline/fork-open.ts +52 -0
- package/src/client/hooks/chat/timeline/index.ts +5 -2
- package/src/client/hooks/chat/timeline/mode-availability.ts +7 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +6 -0
- package/src/client/hooks/chat/timeline/modes-hydrate.ts +93 -0
- package/src/client/hooks/chat/timeline/modes.ts +32 -52
- package/src/client/hooks/chat/timeline/new-chat-open.ts +7 -6
- package/src/client/hooks/chat/timeline/new-chat.ts +10 -1
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +4 -0
- package/src/client/hooks/chat/timeline/pending-session-mode.test.ts +136 -0
- package/src/client/hooks/chat/timeline/pending-session-mode.ts +69 -0
- package/src/client/hooks/chat/timeline/pending-warmup.test.ts +147 -0
- package/src/client/hooks/chat/timeline/pending-warmup.ts +62 -0
- package/src/client/hooks/chat/timeline/run-identity.test.ts +12 -0
- package/src/client/hooks/chat/timeline/run-identity.ts +4 -1
- package/src/client/hooks/chat/timeline/send-props.ts +2 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +1 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +1 -0
- package/src/client/hooks/chat/timeline/send.test.ts +1 -0
- package/src/client/hooks/chat/timeline/session-harness.ts +4 -0
- package/src/client/hooks/chat/timeline/timeline-rail.test.ts +34 -2
- package/src/client/hooks/chat/timeline/use-fork-session.ts +9 -22
- package/src/client/hooks/chat/timeline/user-turns.ts +31 -2
- package/src/client/hooks/chat/waiting/cancel.ts +13 -6
- package/src/client/hooks/chat/waiting/choice.ts +13 -16
- package/src/client/hooks/chat/waiting/composer-wait.ts +70 -0
- package/src/client/hooks/chat/waiting/dispatch.ts +48 -28
- package/src/client/hooks/chat/waiting/held.ts +37 -13
- package/src/client/hooks/chat/waiting/hold.test.ts +22 -0
- package/src/client/hooks/chat/waiting/hold.ts +20 -11
- package/src/client/hooks/chat/waiting/restore.test.ts +69 -0
- package/src/client/hooks/chat/waiting/restore.ts +34 -0
- package/src/client/hooks/chat/waiting/store.ts +9 -3
- package/src/client/hooks/editor/file-editor-types.ts +36 -12
- package/src/client/hooks/editor/save-bytes.ts +79 -0
- package/src/client/hooks/editor/save-file.test.ts +1 -1
- package/src/client/hooks/editor/save-file.ts +35 -8
- package/src/client/hooks/editor/target-key.ts +17 -0
- package/src/client/hooks/editor/use-disk-digest.test.ts +82 -0
- package/src/client/hooks/editor/use-disk-digest.ts +164 -0
- package/src/client/hooks/editor/use-disk-sync.ts +212 -0
- package/src/client/hooks/editor/use-file-cache.ts +113 -0
- package/src/client/hooks/editor/use-file-editor.test.ts +120 -0
- package/src/client/hooks/editor/use-file-editor.ts +143 -57
- package/src/client/hooks/editor/use-file-read.ts +45 -12
- package/src/client/hooks/editor/use-file-writes.ts +4 -4
- package/src/client/hooks/editor/use-grid-selection.ts +160 -0
- package/src/client/hooks/models/harness-catalog.ts +15 -0
- package/src/client/hooks/models/use-harness-update.test.ts +35 -2
- package/src/client/hooks/models/use-harness-update.ts +49 -10
- package/src/client/hooks/ui/notifications.ts +17 -8
- package/src/client/hooks/workspace/diff-file.test.ts +72 -0
- package/src/client/hooks/workspace/diff-file.ts +12 -6
- package/src/client/hooks/workspace/file-archive.ts +220 -0
- package/src/client/hooks/workspace/file-clipboard.test.ts +4 -4
- package/src/client/hooks/workspace/file-clipboard.ts +37 -26
- package/src/client/hooks/workspace/file-selection.test.ts +67 -0
- package/src/client/hooks/workspace/file-selection.ts +156 -0
- package/src/client/hooks/workspace/file-tree-actions-clipboard.test.ts +5 -5
- package/src/client/hooks/workspace/file-tree-actions.ts +36 -8
- package/src/client/hooks/workspace/panel-registry.ts +1 -1
- package/src/client/hooks/workspace/scheduled-tasks.ts +26 -11
- package/src/client/lib/editor/workbook-drafts.ts +42 -0
- package/src/client/lib/launch/file-handlers.ts +2 -2
- package/src/client/lib/notifications/os.test.ts +1 -30
- package/src/client/lib/notifications/os.ts +0 -15
- package/src/client/lib/notifications/platform.test.ts +68 -0
- package/src/client/lib/notifications/platform.ts +36 -0
- package/src/client/lib/scrollbar-activity.test.ts +21 -88
- package/src/client/lib/scrollbar-activity.ts +71 -73
- package/src/client/lib/scrollbar-events.ts +143 -0
- package/src/client/lib/scrollbar-input.test.ts +126 -0
- package/src/client/lib/scrollbar-probe.test-util.ts +107 -0
- package/src/client/tailwind.css +32 -1
- package/src/server/db.server.test.ts +50 -1
- package/src/server/db.server.ts +36 -3
- package/src/server/index.ts +7 -0
- package/src/server/lib/chat/prompt-history.server.test.ts +92 -0
- package/src/server/lib/chat/prompt-history.server.ts +65 -0
- package/src/server/lib/chat/schema.server.ts +35 -0
- package/src/server/lib/db/schema.ts +3 -0
- package/src/server/lib/fs/archive.test.ts +139 -0
- package/src/server/lib/fs/archive.ts +259 -0
- package/src/server/lib/fs/git-diff.test.ts +26 -1
- package/src/server/lib/fs/git-diff.ts +43 -15
- package/src/server/lib/harness/acp/client.ts +81 -87
- package/src/server/lib/harness/acp/prewarm.server.ts +237 -0
- package/src/server/lib/harness/acp/prewarm.test.ts +171 -0
- package/src/server/lib/harness/acp/prompt.test.ts +70 -1
- package/src/server/lib/harness/acp/prompt.ts +32 -1
- package/src/server/lib/harness/acp/protocol.ts +23 -0
- package/src/server/lib/harness/acp/session-handshake.test.ts +26 -0
- package/src/server/lib/harness/acp/session-handshake.ts +22 -20
- package/src/server/lib/harness/acp/session-options.ts +16 -0
- package/src/server/lib/harness/acp/session-process.ts +43 -0
- package/src/server/lib/harness/acp/session.ts +11 -12
- package/src/server/lib/harness/acp/stdio.ts +129 -0
- package/src/server/lib/harness/acp/verbs.test.ts +97 -0
- package/src/server/lib/harness/acp/verbs.ts +16 -6
- package/src/server/lib/harness/auto-probe.server.ts +4 -3
- package/src/server/lib/harness/capabilities.ts +8 -0
- package/src/server/lib/harness/config.server.ts +3 -2
- package/src/server/lib/harness/custom.server.ts +209 -0
- package/src/server/lib/harness/launch-table.ts +19 -0
- package/src/server/lib/harness/launch.ts +6 -1
- package/src/server/lib/harness/provider-entry.ts +1 -1
- package/src/server/lib/harness/provider-file.server.ts +1 -1
- package/src/server/lib/harness/provider-sources.server.ts +2 -1
- package/src/server/lib/harness/provider-write.server.ts +2 -1
- package/src/server/lib/harness/register.server.ts +8 -1
- package/src/server/lib/harness/schema.server.ts +21 -0
- package/src/server/lib/harness/session-lease.server.test.ts +99 -0
- package/src/server/lib/harness/session-lease.server.ts +193 -0
- package/src/server/lib/harness/session-store.server.test.ts +8 -8
- package/src/server/lib/harness/session-store.server.ts +25 -4
- package/src/server/lib/harness/session-title.server.ts +12 -2
- package/src/server/lib/harness/spawn.server.ts +123 -20
- package/src/server/lib/harness/update-job-store.ts +12 -0
- package/src/server/lib/harness/update-queue.server.ts +18 -13
- package/src/server/lib/lifecycle/after-listen.ts +12 -1
- package/src/server/lib/lifecycle/paths.ts +19 -1
- package/src/server/lib/mcp/registry.server.ts +155 -0
- package/src/server/lib/mcp/registry.test.ts +169 -0
- package/src/server/lib/mcp/store.server.ts +38 -0
- package/src/server/lib/omp/rpc/frame-fold-contract.ts +59 -0
- package/src/server/lib/omp/rpc/frame-fold-frames.test.ts +64 -1
- package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +2 -1
- package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +5 -1
- package/src/server/lib/omp/rpc/frame-fold.test.ts +7 -2
- package/src/server/lib/omp/rpc/frame-fold.ts +6 -45
- package/src/server/lib/omp/rpc/lifecycle.test.ts +4 -0
- package/src/server/lib/omp/rpc/prewarm-pool.ts +19 -5
- package/src/server/lib/omp/rpc/run-model.test.ts +116 -0
- package/src/server/lib/omp/rpc/run-model.ts +4 -2
- package/src/server/lib/omp/session/auto-title.server.test.ts +4 -0
- package/src/server/lib/omp/session/delete.server.ts +1 -0
- package/src/server/lib/omp/session/goal-driver.test.ts +5 -1
- package/src/server/lib/omp/session/goal-settings.test.ts +5 -1
- package/src/server/lib/omp/session/sidebar-data.harness.test.ts +6 -3
- package/src/server/lib/omp/session/standby.server.ts +13 -2
- package/src/server/lib/panels/auto-update.server.test.ts +5 -2
- package/src/server/lib/panels/git-update.server.test.ts +5 -2
- package/src/server/lib/panels/install.server.test.ts +5 -2
- package/src/server/lib/panels/manifest.test.ts +47 -1
- package/src/server/lib/panels/manifest.ts +19 -0
- package/src/server/lib/panels/registry.server.ts +19 -2
- package/src/server/lib/panels/remove.server.test.ts +5 -2
- package/src/server/lib/panels/scan.server.ts +26 -2
- package/src/server/lib/panels/settings-schema.server.ts +72 -0
- package/src/server/lib/plugins/background.server.ts +21 -3
- package/src/server/lib/plugins/background.test.ts +13 -0
- package/src/server/lib/plugins/loader.server.ts +35 -51
- package/src/server/lib/plugins/mcp.server.ts +100 -0
- package/src/server/lib/plugins/mcp.test.ts +75 -0
- package/src/server/lib/plugins/schedule-runner.server.ts +153 -0
- package/src/server/lib/plugins/schedule-runner.test.ts +186 -0
- package/src/server/lib/plugins/schedule-store.server.ts +107 -0
- package/src/server/lib/plugins/schema.server.ts +8 -0
- package/src/server/lib/plugins/settings.server.ts +56 -19
- package/src/server/lib/plugins/shutdown.server.ts +58 -0
- package/src/server/lib/plugins/shutdown.test.ts +28 -3
- package/src/server/lib/realtime/topics/global.server.ts +5 -1
- package/src/server/lib/schedule/rows.server.ts +9 -0
- package/src/server/lib/schedule/runtime.server.test.ts +91 -0
- package/src/server/lib/schedule/runtime.server.ts +101 -23
- package/src/server/lib/schedule/schema.server.ts +15 -0
- package/src/server/lib/schedule/store.server.test.ts +34 -0
- package/src/server/lib/schedule/store.server.ts +33 -9
- package/src/server/lib/sessions/fork.server.test.ts +47 -0
- package/src/server/lib/sessions/fork.server.ts +17 -1
- package/src/server/lib/sessions/spawn.server.ts +2 -2
- package/src/server/lib/waiting/runtime.server.test.ts +48 -0
- package/src/server/lib/waiting/runtime.server.ts +22 -0
- package/src/server/lib/waiting/schema.server.ts +8 -0
- package/src/server/lib/waiting/store.server.test.ts +14 -0
- package/src/server/lib/waiting/store.server.ts +6 -2
- package/src/server/routes/agent/command-resume.test.ts +9 -4
- package/src/server/routes/agent/command.ts +11 -0
- package/src/server/routes/agent/new-mode.test.ts +40 -0
- package/src/server/routes/agent/new.ts +36 -10
- package/src/server/routes/agent/prewarm.ts +48 -7
- package/src/server/routes/chat/index.ts +5 -0
- package/src/server/routes/chat/prompt-history.test.ts +67 -0
- package/src/server/routes/chat/prompt-history.ts +31 -0
- package/src/server/routes/chat/stream.test.ts +21 -0
- package/src/server/routes/chat/stream.ts +5 -0
- package/src/server/routes/fs/action-archive.test.ts +128 -0
- package/src/server/routes/fs/action-bulk.ts +106 -0
- package/src/server/routes/fs/action-save-bytes.test.ts +59 -0
- package/src/server/routes/fs/action-transfer.test.ts +26 -0
- package/src/server/routes/fs/action.ts +100 -12
- package/src/server/routes/fs/archive.ts +20 -0
- package/src/server/routes/fs/digest.test.ts +100 -0
- package/src/server/routes/fs/digest.ts +106 -0
- package/src/server/routes/fs/grant.test.ts +5 -2
- package/src/server/routes/fs/index.ts +4 -0
- package/src/server/routes/fs/read.ts +6 -1
- package/src/server/routes/fs/scope.test.ts +6 -2
- package/src/server/routes/harness/custom.test.ts +131 -0
- package/src/server/routes/harness/import-action.ts +3 -3
- package/src/server/routes/harness/root.ts +47 -9
- package/src/server/routes/harness/summary.test.ts +50 -0
- package/src/server/routes/harness/update-status.ts +41 -2
- package/src/server/routes/harness/update.test.ts +56 -2
- package/src/server/routes/harness/update.ts +2 -2
- package/src/server/routes/panels/bindings.ts +2 -0
- package/src/server/routes/panels/settings.test.ts +165 -0
- package/src/server/routes/panels/settings.ts +106 -0
- package/src/server/routes/schedule/body.ts +14 -0
- package/src/server/routes/schedule/index.ts +28 -4
- package/src/server/routes/sessions/delete.test.ts +4 -0
- package/src/server/routes/settings/mcp.ts +9 -26
- package/src/server/routes/waiting/index.ts +21 -2
- package/src/server/routes/waiting/routes.test.ts +21 -0
- package/src/shared/lib/chat/ask-form/index.ts +39 -31
- package/src/shared/lib/chat/ask-form/labels.ts +46 -0
- package/src/shared/lib/chat/ask-form/tokens.ts +11 -2
- package/src/shared/lib/chat/ask-form.test.ts +57 -0
- package/src/shared/lib/chat/ask-questions.ts +31 -0
- package/src/shared/lib/chat/composer/delegation.ts +3 -3
- package/src/shared/lib/chat/composer/history.test.ts +67 -0
- package/src/shared/lib/chat/composer/history.ts +61 -0
- package/src/shared/lib/chat/irc-notice.ts +42 -0
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +99 -0
- package/src/shared/lib/chat/timeline/fork-anchor.ts +47 -0
- package/src/shared/lib/chat/todo/parser.ts +6 -4
- package/src/shared/lib/fs/archive.test.ts +101 -0
- package/src/shared/lib/fs/archive.ts +191 -0
- package/src/shared/lib/fs/clipboard.test.ts +32 -7
- package/src/shared/lib/fs/clipboard.ts +59 -14
- package/src/shared/lib/fs/content-hash.ts +29 -0
- package/src/shared/lib/fs/csv.test.ts +50 -0
- package/src/shared/lib/fs/csv.ts +40 -0
- package/src/shared/lib/fs/document-kind.test.ts +13 -6
- package/src/shared/lib/fs/document-kind.ts +18 -6
- package/src/shared/lib/fs/file-kind-classify.test.ts +4 -0
- package/src/shared/lib/fs/file-kind.test.ts +2 -7
- package/src/shared/lib/fs/file-kind.ts +4 -2
- package/src/shared/lib/fs/grid-edit.test.ts +24 -0
- package/src/shared/lib/fs/grid-edit.ts +29 -0
- package/src/shared/lib/fs/grid-selection.test.ts +137 -0
- package/src/shared/lib/fs/grid-selection.ts +138 -0
- package/src/shared/lib/harness/brand-color.ts +5 -0
- package/src/shared/lib/harness/catalog.test.ts +22 -0
- package/src/shared/lib/harness/catalog.ts +60 -7
- package/src/shared/lib/harness/config-fields.test.ts +25 -0
- package/src/shared/lib/harness/config-fields.ts +33 -3
- package/src/shared/lib/harness/dialects.ts +1 -1
- package/src/shared/lib/harness/fork.ts +60 -0
- package/src/shared/lib/harness/mcp-facts.test.ts +30 -0
- package/src/shared/lib/harness/mcp-facts.ts +69 -0
- package/src/shared/lib/harness/menu.test.ts +16 -1
- package/src/shared/lib/harness/menu.ts +2 -2
- package/src/shared/lib/harness/provider-contracts.ts +109 -0
- package/src/shared/lib/harness/provider-facts.test.ts +2 -1
- package/src/shared/lib/harness/provider-facts.ts +24 -115
- package/src/shared/lib/harness/provider-lookup.ts +37 -0
- package/src/shared/lib/harness/providers.ts +2 -1
- package/src/shared/lib/harness/rewind.ts +6 -6
- package/src/shared/lib/harness/session-modes.ts +31 -0
- package/src/shared/lib/harness/transcript.test.ts +29 -0
- package/src/shared/lib/harness/transcript.ts +19 -0
- package/src/shared/lib/harness/updates.ts +10 -0
- package/src/shared/lib/notifications/settings.test.ts +21 -0
- package/src/shared/lib/notifications/settings.ts +24 -0
- package/src/shared/lib/omp/session/mapper.test.ts +31 -0
- package/src/shared/lib/omp/session/mapper.ts +17 -0
- package/src/shared/lib/omp/session/messages-map-notice.test.ts +68 -0
- package/src/shared/lib/omp/session/messages-map.test.ts +1 -35
- package/src/shared/lib/omp/session/messages-map.ts +17 -0
- package/src/shared/lib/omp/session/prewarm.test.ts +28 -4
- package/src/shared/lib/omp/session/prewarm.ts +25 -6
- package/src/shared/lib/omp/session/stream-state.server.test.ts +25 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +8 -4
- package/src/shared/lib/omp/session/wait.ts +10 -1
- package/src/shared/lib/panels/capabilities.test.ts +1 -1
- package/src/shared/lib/panels/capabilities.ts +3 -0
- package/src/shared/lib/plugins/settings.ts +22 -0
- package/src/shared/lib/schedule/parse.test.ts +48 -0
- package/src/shared/lib/schedule/parse.ts +69 -45
- package/src/shared/lib/schedule/timezone.ts +128 -0
- package/src/shared/lib/settings/defaults.ts +2 -0
- package/src/shared/lib/settings/sections.ts +8 -4
- package/src/shared/lib/ui/picker-filter.test.ts +23 -0
- package/src/shared/lib/ui/picker-filter.ts +20 -0
- package/src/shared/lib/workspace/refresh-cadence.test.ts +25 -1
- package/src/shared/lib/workspace/relative-time.ts +16 -0
- package/src/shared/types/chat.ts +4 -0
- package/src/shared/types/harness.ts +12 -1
- package/src/shared/types/omp/agent.ts +6 -0
- package/src/shared/types/omp/session.ts +18 -0
- package/src/shared/types/panels-registry.ts +3 -3
- package/src/shared/types/panels.ts +4 -2
- package/src/shared/types/schedule.ts +13 -0
- package/src/shared/types/settings/state.ts +18 -7
- package/src/shared/types/todo.ts +3 -1
- package/src/shared/types/waiting.ts +9 -0
- package/src/test-support/file-actions.test-util.ts +4 -0
- package/src/test-support/file-archive.test-util.ts +41 -0
- package/src/test-support/file-clipboard.test-util.ts +9 -6
- package/src/test-support/file-editor.test-util.ts +70 -5
- package/src/test-support/harness-table.test-util.ts +2 -0
- package/src/test-support/preload.ts +46 -0
- package/dist/client/static/js/index-32rpkj6b.css +0 -1
- package/src/client/hooks/editor/use-external-change-notice.ts +0 -71
- package/src/client/hooks/editor/use-external-change.test.ts +0 -88
- package/src/client/hooks/editor/use-external-change.ts +0 -146
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The selection state of the spreadsheet grid.
|
|
8
|
+
*
|
|
9
|
+
* Two cells, not one: the ANCHOR is where the selection started and the FOCUS
|
|
10
|
+
* is where the pointer or the keyboard is now. A plain click collapses both
|
|
11
|
+
* onto the same cell, a drag or a shift-click moves only the focus, and the
|
|
12
|
+
* drawn range is the rectangle between them. Keeping the anchor is what makes
|
|
13
|
+
* shift-click extend instead of restart, which is the behaviour every
|
|
14
|
+
* spreadsheet has and the one a single `selected` cell cannot express.
|
|
15
|
+
*
|
|
16
|
+
* The hook owns no DOM: the grid delegates pointer events from one listener and
|
|
17
|
+
* asks this for the verdict, so a 2000-row sheet does not mount 200 000
|
|
18
|
+
* handlers.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { useCallback, useMemo, useRef, useState } from 'preact/hooks';
|
|
22
|
+
import {
|
|
23
|
+
cellRange,
|
|
24
|
+
clampCell,
|
|
25
|
+
moveCell,
|
|
26
|
+
selectAllRange,
|
|
27
|
+
type GridCell,
|
|
28
|
+
type GridRange,
|
|
29
|
+
} from '@/shared/lib/fs/grid-selection';
|
|
30
|
+
|
|
31
|
+
export interface GridSelection {
|
|
32
|
+
/** The drawn rectangle, or null when nothing is selected. */
|
|
33
|
+
range: GridRange | null;
|
|
34
|
+
/** The cell the keyboard acts on, or null. */
|
|
35
|
+
active: GridCell | null;
|
|
36
|
+
/** True while a pointer drag is extending the selection. */
|
|
37
|
+
dragging: boolean;
|
|
38
|
+
/** Start a selection at `cell`; `extend` keeps the anchor (shift-click). */
|
|
39
|
+
begin: (cell: GridCell, extend: boolean) => void;
|
|
40
|
+
/** Move the focus while dragging. */
|
|
41
|
+
extendTo: (cell: GridCell) => void;
|
|
42
|
+
/** End a drag. */
|
|
43
|
+
endDrag: () => void;
|
|
44
|
+
/** Move the active cell by a delta; `extend` keeps the anchor. */
|
|
45
|
+
move: (rowDelta: number, columnDelta: number, extend: boolean) => void;
|
|
46
|
+
/** Select the whole grid. */
|
|
47
|
+
selectAll: () => void;
|
|
48
|
+
/** Select a whole column; `extend` keeps the anchor. */
|
|
49
|
+
selectColumn: (col: number, extend: boolean) => void;
|
|
50
|
+
/** Select a whole row; `extend` keeps the anchor. */
|
|
51
|
+
selectRow: (row: number, extend: boolean) => void;
|
|
52
|
+
/** Drop the selection. */
|
|
53
|
+
clear: () => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function useGridSelection(rowCount: number, columnCount: number): GridSelection {
|
|
57
|
+
const [anchor, setAnchor] = useState<GridCell | null>(null);
|
|
58
|
+
const [focus, setFocus] = useState<GridCell | null>(null);
|
|
59
|
+
const [dragging, setDragging] = useState(false);
|
|
60
|
+
// The pointer handlers read the live flag, not the render's copy: a
|
|
61
|
+
// pointerover can arrive before the state update that started the drag has
|
|
62
|
+
// been committed.
|
|
63
|
+
const draggingRef = useRef(false);
|
|
64
|
+
|
|
65
|
+
const clamp = useCallback(
|
|
66
|
+
(cell: GridCell) => clampCell(cell, rowCount, columnCount),
|
|
67
|
+
[rowCount, columnCount],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const begin = useCallback(
|
|
71
|
+
(cell: GridCell, extend: boolean) => {
|
|
72
|
+
const next = clamp(cell);
|
|
73
|
+
if (extend && anchor) {
|
|
74
|
+
setFocus(next);
|
|
75
|
+
} else {
|
|
76
|
+
setAnchor(next);
|
|
77
|
+
setFocus(next);
|
|
78
|
+
}
|
|
79
|
+
draggingRef.current = true;
|
|
80
|
+
setDragging(true);
|
|
81
|
+
},
|
|
82
|
+
[anchor, clamp],
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const extendTo = useCallback(
|
|
86
|
+
(cell: GridCell) => {
|
|
87
|
+
if (!draggingRef.current) return;
|
|
88
|
+
setFocus(clamp(cell));
|
|
89
|
+
},
|
|
90
|
+
[clamp],
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const endDrag = useCallback(() => {
|
|
94
|
+
draggingRef.current = false;
|
|
95
|
+
setDragging(false);
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
const move = useCallback(
|
|
99
|
+
(rowDelta: number, columnDelta: number, extend: boolean) => {
|
|
100
|
+
const from = focus ?? { row: 0, col: 0 };
|
|
101
|
+
const next = moveCell(from, rowDelta, columnDelta, rowCount, columnCount);
|
|
102
|
+
if (extend && anchor) {
|
|
103
|
+
setFocus(next);
|
|
104
|
+
} else {
|
|
105
|
+
setAnchor(next);
|
|
106
|
+
setFocus(next);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[anchor, focus, rowCount, columnCount],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const selectAll = useCallback(() => {
|
|
113
|
+
const all = selectAllRange(rowCount, columnCount);
|
|
114
|
+
if (!all) return;
|
|
115
|
+
setAnchor({ row: all.top, col: all.left });
|
|
116
|
+
setFocus({ row: all.bottom, col: all.right });
|
|
117
|
+
}, [rowCount, columnCount]);
|
|
118
|
+
|
|
119
|
+
const selectColumn = useCallback(
|
|
120
|
+
(col: number, extend: boolean) => {
|
|
121
|
+
const next = clamp({ row: rowCount - 1, col });
|
|
122
|
+
if (extend && anchor) {
|
|
123
|
+
setFocus(next);
|
|
124
|
+
} else {
|
|
125
|
+
setAnchor(clamp({ row: 0, col }));
|
|
126
|
+
setFocus(next);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
[anchor, clamp, rowCount],
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const selectRow = useCallback(
|
|
133
|
+
(row: number, extend: boolean) => {
|
|
134
|
+
const next = clamp({ row, col: columnCount - 1 });
|
|
135
|
+
if (extend && anchor) {
|
|
136
|
+
setFocus(next);
|
|
137
|
+
} else {
|
|
138
|
+
setAnchor(clamp({ row, col: 0 }));
|
|
139
|
+
setFocus(next);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
[anchor, clamp, columnCount],
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const clear = useCallback(() => {
|
|
146
|
+
setAnchor(null);
|
|
147
|
+
setFocus(null);
|
|
148
|
+
}, []);
|
|
149
|
+
|
|
150
|
+
// The range is derived, and clamped on read: a sheet switch or a live CSV
|
|
151
|
+
// edit can shrink the grid under a selection that was valid a render ago.
|
|
152
|
+
const range = useMemo(() => {
|
|
153
|
+
if (!anchor || !focus) return null;
|
|
154
|
+
return cellRange(clamp(anchor), clamp(focus));
|
|
155
|
+
}, [anchor, focus, clamp]);
|
|
156
|
+
|
|
157
|
+
const active = useMemo(() => (focus ? clamp(focus) : null), [focus, clamp]);
|
|
158
|
+
|
|
159
|
+
return { range, active, dragging, begin, extendTo, endDrag, move, selectAll, selectColumn, selectRow, clear };
|
|
160
|
+
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import type {
|
|
17
17
|
HarnessConfig, HarnessProviderSupport, HarnessesPayload, HarnessSummary, LiveHarnessModels,
|
|
18
18
|
} from '@/shared/types/harness';
|
|
19
|
+
import { registerHarnessDescriptors } from '@/shared/lib/harness/catalog';
|
|
19
20
|
|
|
20
21
|
export interface HarnessStore {
|
|
21
22
|
harnesses: HarnessSummary[];
|
|
@@ -73,6 +74,20 @@ export async function loadCatalog(): Promise<void> {
|
|
|
73
74
|
})
|
|
74
75
|
.then((payload) => {
|
|
75
76
|
loaded = true;
|
|
77
|
+
// A user-added harness has no entry in the build's static catalog, and the
|
|
78
|
+
// glyph/badge helpers are synchronous. Publish the descriptors the server
|
|
79
|
+
// answered before any surface renders a row for one.
|
|
80
|
+
registerHarnessDescriptors(
|
|
81
|
+
(payload.harnesses ?? [])
|
|
82
|
+
.filter((entry) => entry.custom)
|
|
83
|
+
.map((entry) => ({
|
|
84
|
+
id: entry.id,
|
|
85
|
+
label: entry.label,
|
|
86
|
+
initial: entry.initial ?? entry.label.charAt(0).toUpperCase(),
|
|
87
|
+
transport: entry.transport,
|
|
88
|
+
glyph: 'custom' as const,
|
|
89
|
+
})),
|
|
90
|
+
);
|
|
76
91
|
emit({
|
|
77
92
|
harnesses: Array.isArray(payload.harnesses) ? payload.harnesses : [],
|
|
78
93
|
// Absent from an answer written before per-harness config existed: an
|
|
@@ -35,6 +35,8 @@ let postReplies: { status: number; body: unknown }[] = [];
|
|
|
35
35
|
let statusJobs: HarnessUpdateJob[] = [];
|
|
36
36
|
/** Called when the card re-reads the version rows (the probe-arrival signal). */
|
|
37
37
|
let onVersionsRead: (() => void) | null = null;
|
|
38
|
+
/** Called when the stub answers one status poll — the "a poll landed" signal. */
|
|
39
|
+
let onStatusRead: (() => void) | null = null;
|
|
38
40
|
|
|
39
41
|
function job(overrides: Partial<HarnessUpdateJob> = {}): HarnessUpdateJob {
|
|
40
42
|
return {
|
|
@@ -66,17 +68,24 @@ beforeEach(() => {
|
|
|
66
68
|
statusJobs = [];
|
|
67
69
|
postReplies = [];
|
|
68
70
|
onVersionsRead = null;
|
|
71
|
+
onStatusRead = null;
|
|
69
72
|
(globalThis as unknown as Record<string, unknown>).fetch = async (input: unknown, init?: { method?: string }) => {
|
|
70
73
|
calls.push(`${init?.method ?? 'GET'} ${String(input)}`);
|
|
71
74
|
if (init?.method === 'POST') {
|
|
72
75
|
const reply = postReplies.length > 1 ? postReplies.shift()! : postReplies[0];
|
|
73
76
|
return new Response(JSON.stringify(reply?.body ?? {}), { status: reply?.status ?? 202 });
|
|
74
77
|
}
|
|
78
|
+
if (init?.method === 'DELETE') {
|
|
79
|
+
return new Response(JSON.stringify({ dismissed: true }), { status: 200 });
|
|
80
|
+
}
|
|
75
81
|
if (String(input).includes('/api/harness/versions')) {
|
|
76
82
|
onVersionsRead?.();
|
|
77
83
|
onVersionsRead = null;
|
|
78
84
|
return new Response(JSON.stringify({ harnesses: [] }), { status: 200 });
|
|
79
85
|
}
|
|
86
|
+
const statusRead = onStatusRead;
|
|
87
|
+
onStatusRead = null;
|
|
88
|
+
statusRead?.();
|
|
80
89
|
return new Response(JSON.stringify({ jobs: statusJobs }), { status: 200 });
|
|
81
90
|
};
|
|
82
91
|
});
|
|
@@ -280,7 +289,31 @@ describe('useHarnessUpdate', () => {
|
|
|
280
289
|
expect(current.problem).toBeNull();
|
|
281
290
|
expect(harness.current().jobs).toEqual([]);
|
|
282
291
|
expect(await harness.settlement(0)).toEqual({ message: 'claude is already up to date (adapter 0.102.0)', ok: true });
|
|
283
|
-
|
|
284
|
-
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
test('dismissing a settled result deletes the record and a stale poll cannot paint it back', async () => {
|
|
295
|
+
// The defect: "claude updated (adapter) — it now reports 0.106.0" stayed on
|
|
296
|
+
// the row with no way out. The delete is server-side (a closed card must not
|
|
297
|
+
// resurrect it), and the RUN key is remembered so a poll that started before
|
|
298
|
+
// the delete cannot re-add the record it still carries.
|
|
299
|
+
statusJobs = [finished({ message: 'claude updated (adapter) — it now reports 0.106.0', probe: 'pending' })];
|
|
300
|
+
const harness = mount();
|
|
301
|
+
await flush();
|
|
302
|
+
expect(harness.current().jobs).toHaveLength(1);
|
|
303
|
+
|
|
304
|
+
await act(async () => {
|
|
305
|
+
expect(await harness.current().dismiss('claude')).toBeNull();
|
|
306
|
+
});
|
|
307
|
+
expect(calls).toContain('DELETE /api/harness/update/status');
|
|
308
|
+
expect(harness.current().jobs).toEqual([]);
|
|
309
|
+
|
|
310
|
+
// A pending probe keeps the poll alive, and the stub keeps answering with
|
|
311
|
+
// the record that was just deleted: the next poll landing must not restore it.
|
|
312
|
+
const nextPoll = Promise.withResolvers<void>();
|
|
313
|
+
onStatusRead = nextPoll.resolve;
|
|
314
|
+
await act(async () => {
|
|
315
|
+
await nextPoll.promise;
|
|
316
|
+
});
|
|
317
|
+
expect(harness.current().jobs).toEqual([]);
|
|
285
318
|
});
|
|
286
319
|
});
|
|
@@ -74,10 +74,16 @@ export interface HarnessUpdateController {
|
|
|
74
74
|
/** Start an update; resolves to a refusal, or null when the run was started
|
|
75
75
|
* (immediately or queued behind the one already installing). */
|
|
76
76
|
start: (id: string) => Promise<string | null>;
|
|
77
|
+
/** Drop a settled record (the result is read and has nothing left to say);
|
|
78
|
+
* resolves to the refusal, or null when the record was deleted. */
|
|
79
|
+
dismiss: (id: string) => Promise<string | null>;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
type Settled = (message: string, ok: boolean) => void;
|
|
80
83
|
|
|
84
|
+
/** One run's identity: a new update for the same harness replaces the record. */
|
|
85
|
+
const runKey = (job: HarnessUpdateJob): string => `${job.harness}:${job.startedAt}`;
|
|
86
|
+
|
|
81
87
|
export function useHarnessUpdate(
|
|
82
88
|
onSettled: Settled,
|
|
83
89
|
{ pollMs = HARNESS_UPDATE_POLL_MS, enabled = true }: HarnessUpdateOptions = {},
|
|
@@ -91,6 +97,13 @@ export function useHarnessUpdate(
|
|
|
91
97
|
const reported = useRef(new Set<string>());
|
|
92
98
|
// Runs whose post-install probe answer has already been reflected in the rows.
|
|
93
99
|
const probed = useRef(new Set<string>());
|
|
100
|
+
// The runs this card dismissed, keyed by `harness:startedAt`. A poll already
|
|
101
|
+
// in flight when the delete landed would otherwise paint the record back for
|
|
102
|
+
// one frame; the key, not the harness, stays out so a NEW run is shown.
|
|
103
|
+
const dismissed = useRef(new Set<string>());
|
|
104
|
+
// The jobs as last rendered, so `dismiss` can name the run it is dropping
|
|
105
|
+
// without waiting for a render.
|
|
106
|
+
const shown = useRef<HarnessUpdateJob[]>([]);
|
|
94
107
|
// The callback is read through a ref so an inline arrow from the caller does
|
|
95
108
|
// not restart the mount effect (and re-adopt the records) on every render.
|
|
96
109
|
const settled = useRef(onSettled);
|
|
@@ -99,13 +112,12 @@ export function useHarnessUpdate(
|
|
|
99
112
|
/** Fold one harness's record into the list, keeping the newer one. */
|
|
100
113
|
const merge = useCallback((incoming: HarnessUpdateJob | null) => {
|
|
101
114
|
if (!incoming) return;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
});
|
|
115
|
+
const index = shown.current.findIndex((job) => job.harness === incoming.harness);
|
|
116
|
+
const next = index < 0
|
|
117
|
+
? [...shown.current, incoming]
|
|
118
|
+
: shown.current.map((job) => (job.harness === incoming.harness ? incoming : job));
|
|
119
|
+
shown.current = next;
|
|
120
|
+
setJobs(next);
|
|
109
121
|
}, []);
|
|
110
122
|
|
|
111
123
|
/**
|
|
@@ -117,8 +129,12 @@ export function useHarnessUpdate(
|
|
|
117
129
|
* are two separate moments, not one.
|
|
118
130
|
*/
|
|
119
131
|
const observe = useCallback((incoming: HarnessUpdateJob[]) => {
|
|
120
|
-
|
|
121
|
-
|
|
132
|
+
// A poll that was already in flight when a dismissal deleted the record
|
|
133
|
+
// still carries it; a dismissed run must not be painted back.
|
|
134
|
+
const visible = incoming.filter((job) => !dismissed.current.has(runKey(job)));
|
|
135
|
+
shown.current = visible;
|
|
136
|
+
setJobs(visible);
|
|
137
|
+
for (const job of visible) {
|
|
122
138
|
if (jobUnfinished(job)) {
|
|
123
139
|
watched.current.add(job.harness);
|
|
124
140
|
reported.current.delete(job.harness);
|
|
@@ -246,5 +262,28 @@ export function useHarnessUpdate(
|
|
|
246
262
|
return payload.error ?? 'Update failed';
|
|
247
263
|
}, [follow, merge]);
|
|
248
264
|
|
|
249
|
-
|
|
265
|
+
const dismiss = useCallback(async (id: string): Promise<string | null> => {
|
|
266
|
+
let response: Response;
|
|
267
|
+
try {
|
|
268
|
+
response = await fetch('/api/harness/update/status', {
|
|
269
|
+
method: 'DELETE',
|
|
270
|
+
headers: { 'Content-Type': 'application/json' },
|
|
271
|
+
body: JSON.stringify({ harness: id }),
|
|
272
|
+
});
|
|
273
|
+
} catch (cause) {
|
|
274
|
+
return cause instanceof Error ? cause.message : 'Could not dismiss the update result';
|
|
275
|
+
}
|
|
276
|
+
const payload = (await response.json().catch(() => ({}))) as { error?: string };
|
|
277
|
+
if (!response.ok) return payload.error ?? `Could not dismiss the update result (HTTP ${response.status})`;
|
|
278
|
+
// Remember the RUN, not the harness: the record is gone on disk, and this
|
|
279
|
+
// keeps a poll that predates the delete from painting it back.
|
|
280
|
+
const target = shown.current.find((job) => job.harness === id);
|
|
281
|
+
if (target) dismissed.current.add(runKey(target));
|
|
282
|
+
const next = shown.current.filter((job) => job.harness !== id);
|
|
283
|
+
shown.current = next;
|
|
284
|
+
setJobs(next);
|
|
285
|
+
return null;
|
|
286
|
+
}, []);
|
|
287
|
+
|
|
288
|
+
return { jobs, start, dismiss };
|
|
250
289
|
}
|
|
@@ -6,19 +6,28 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* The one gate every system notification passes through.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Three rules, and all of them are the feature rather than plumbing:
|
|
10
10
|
*
|
|
11
11
|
* - the event's own setting must be the literal `true` (they ship false);
|
|
12
|
-
* - the
|
|
13
|
-
* the
|
|
14
|
-
*
|
|
12
|
+
* - the master switch for THIS device class (`Desktop` / `Mobile`) must not be
|
|
13
|
+
* `false` — the two switches exist so a phone can stay quiet while a desktop
|
|
14
|
+
* banners, and vice versa;
|
|
15
|
+
* - the banner is sent in every window state. Focus is not a gate: the user
|
|
16
|
+
* asked to be told, and the OS decides how to present a banner for the app it
|
|
17
|
+
* belongs to (the shells install a foreground presentation delegate for
|
|
18
|
+
* exactly this reason). The sidebar badge stays the in-app record.
|
|
15
19
|
*
|
|
16
20
|
* Text is clipped here because a failure reason can be a whole provider
|
|
17
21
|
* response; an OS notification is a headline, not a log.
|
|
18
22
|
*/
|
|
19
23
|
|
|
20
|
-
import {
|
|
21
|
-
|
|
24
|
+
import {
|
|
25
|
+
isNotificationEnabled,
|
|
26
|
+
isNotificationPlatformEnabled,
|
|
27
|
+
type NotificationEvent,
|
|
28
|
+
} from '@/shared/lib/notifications/settings';
|
|
29
|
+
import { showOsNotification } from '@/client/lib/notifications/os';
|
|
30
|
+
import { notificationPlatformForClient } from '@/client/lib/notifications/platform';
|
|
22
31
|
|
|
23
32
|
const TITLE_LIMIT = 120;
|
|
24
33
|
const BODY_LIMIT = 240;
|
|
@@ -29,13 +38,13 @@ function clip(text: string, limit: number): string {
|
|
|
29
38
|
return `${trimmed.slice(0, limit - 1).trimEnd()}…`;
|
|
30
39
|
}
|
|
31
40
|
|
|
32
|
-
/** Send a system notification for `event`, unless
|
|
41
|
+
/** Send a system notification for `event`, unless its setting or platform switch says no. */
|
|
33
42
|
export function sendNotification(
|
|
34
43
|
event: NotificationEvent,
|
|
35
44
|
notification: { title: string; body: string; tag?: string; sessionId?: string },
|
|
36
45
|
): void {
|
|
37
46
|
if (!isNotificationEnabled(event)) return;
|
|
38
|
-
if (!
|
|
47
|
+
if (!isNotificationPlatformEnabled(notificationPlatformForClient())) return;
|
|
39
48
|
void showOsNotification({
|
|
40
49
|
title: clip(notification.title, TITLE_LIMIT) || 'Kabmo',
|
|
41
50
|
body: clip(notification.body, BODY_LIMIT),
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The diff panel's read is keyed on the staged flag, not only on the path.
|
|
8
|
+
*
|
|
9
|
+
* One file can be open as two tabs — its staged diff and its unstaged diff —
|
|
10
|
+
* and the editor mounts ONE `DiffPanel` for whichever tab is active, so the
|
|
11
|
+
* second tab arrives as a prop change on the same hook instance. When the
|
|
12
|
+
* fetch was keyed on the path alone, that second tab kept the first tab's
|
|
13
|
+
* patch on screen: the reported "staged and unstaged diffs are identical".
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { Window } from 'happy-dom';
|
|
18
|
+
import { h, render } from 'preact';
|
|
19
|
+
import { act } from 'preact/test-utils';
|
|
20
|
+
import { useFileDiff } from '@/client/hooks/workspace/diff-file';
|
|
21
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
22
|
+
|
|
23
|
+
const originalFetch = globalThis.fetch;
|
|
24
|
+
let requested: string[] = [];
|
|
25
|
+
|
|
26
|
+
function Probe({ isStaged }: { isStaged: boolean }) {
|
|
27
|
+
useFileDiff({ filePath: 'src/a.ts', status: 'M', isStaged, repo: '.' });
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
beforeAll(() => {
|
|
32
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
afterAll(() => {
|
|
36
|
+
restoreDomGlobals();
|
|
37
|
+
globalThis.fetch = originalFetch;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
requested = [];
|
|
42
|
+
globalThis.fetch = (async (input: RequestInfo | URL) => {
|
|
43
|
+
const url = String(input);
|
|
44
|
+
requested.push(url);
|
|
45
|
+
const staged = new URL(url, 'http://localhost').searchParams.get('staged') === '1';
|
|
46
|
+
return new Response(
|
|
47
|
+
JSON.stringify({ success: true, diff: '', oldContent: '', newContent: '', status: 'M', staged }),
|
|
48
|
+
{ headers: { 'content-type': 'application/json' } },
|
|
49
|
+
);
|
|
50
|
+
}) as typeof fetch;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('useFileDiff', () => {
|
|
54
|
+
test('re-reads when the same path is opened as the other staged view', async () => {
|
|
55
|
+
const container = document.createElement('div');
|
|
56
|
+
await act(async () => {
|
|
57
|
+
render(h(Probe, { isStaged: false }), container);
|
|
58
|
+
});
|
|
59
|
+
expect(requested).toHaveLength(1);
|
|
60
|
+
expect(requested[0]).toContain('staged=0');
|
|
61
|
+
|
|
62
|
+
await act(async () => {
|
|
63
|
+
render(h(Probe, { isStaged: true }), container);
|
|
64
|
+
});
|
|
65
|
+
expect(requested).toHaveLength(2);
|
|
66
|
+
expect(requested[1]).toContain('staged=1');
|
|
67
|
+
|
|
68
|
+
await act(async () => {
|
|
69
|
+
render(null, container);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -111,16 +111,22 @@ export function useFileDiff({ filePath, status, isStaged, repo, root }: UseFileD
|
|
|
111
111
|
}
|
|
112
112
|
}, [filePath, repo, root]);
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* The read is keyed on the pair the caller asked for, not only on the path.
|
|
116
|
+
*
|
|
117
|
+
* One file can be open twice — its staged diff and its unstaged diff — and
|
|
118
|
+
* the two tabs share one mounted panel with only the props changing. Keying
|
|
119
|
+
* the fetch on `fetchDiff` alone (path/repo/root) left the previous read on
|
|
120
|
+
* screen, so the second tab showed the first tab's patch. The refs are
|
|
121
|
+
* seeded first: `fetchDiff` reads them, and the state copies lag a render.
|
|
122
|
+
*/
|
|
114
123
|
useEffect(() => {
|
|
115
|
-
setCurrentStatus(status);
|
|
116
|
-
setCurrentStaged(isStaged);
|
|
117
124
|
stagedRef.current = isStaged;
|
|
118
125
|
statusRef.current = status;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
useEffect(() => {
|
|
126
|
+
setCurrentStatus(status);
|
|
127
|
+
setCurrentStaged(isStaged);
|
|
122
128
|
void fetchDiff();
|
|
123
|
-
}, [fetchDiff]);
|
|
129
|
+
}, [fetchDiff, isStaged, status]);
|
|
124
130
|
|
|
125
131
|
const adoptState = useCallback((next: { staged?: boolean; status?: string }) => {
|
|
126
132
|
if (typeof next.staged === 'boolean') {
|