@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
|
@@ -23,7 +23,10 @@ import { useFetcher } from '@/client/lib/router/fetcher';
|
|
|
23
23
|
import { toAbsolutePath } from '@/shared/lib/fs/paths';
|
|
24
24
|
import { copyToClipboard } from '@/client/hooks/ui/clipboard';
|
|
25
25
|
import { useFileCreate, type CreatedEntry } from '@/client/hooks/workspace/file-create';
|
|
26
|
-
import type { FileClipboard } from '@/client/hooks/workspace/file-clipboard';
|
|
26
|
+
import type { FileClipboard, ClipboardTarget } from '@/client/hooks/workspace/file-clipboard';
|
|
27
|
+
import type { FileArchive } from '@/client/hooks/workspace/file-archive';
|
|
28
|
+
import { clipboardLabel } from '@/shared/lib/fs/clipboard';
|
|
29
|
+
import { isArchiveName } from '@/shared/lib/fs/archive';
|
|
27
30
|
import type { FsActionResponse } from '@/shared/types';
|
|
28
31
|
|
|
29
32
|
export interface FileActionTarget {
|
|
@@ -65,6 +68,16 @@ export interface FileActionDeps {
|
|
|
65
68
|
clipboard: FileClipboard;
|
|
66
69
|
/** Whether this row is a folder — what Cut/Copy/Paste need to name their target. */
|
|
67
70
|
isFolder: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The rows the panel has MARKED. When this row is one of several, every batch
|
|
73
|
+
* verb acts on the whole selection; the row that was right-clicked only
|
|
74
|
+
* supplies the menu.
|
|
75
|
+
*/
|
|
76
|
+
selection: readonly ClipboardTarget[];
|
|
77
|
+
/** True when this row is part of the marked set. */
|
|
78
|
+
selected: boolean;
|
|
79
|
+
/** The panel's archive dialogs. */
|
|
80
|
+
archive: FileArchive;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
export interface FileActions {
|
|
@@ -90,6 +103,10 @@ export interface FileActions {
|
|
|
90
103
|
busy: boolean;
|
|
91
104
|
/** Label of the row's Paste action, or null when a paste cannot land here. */
|
|
92
105
|
pasteLabel: string | null;
|
|
106
|
+
/** How many rows the batch verbs act on — one, or the panel's selection. */
|
|
107
|
+
selectionCount: number;
|
|
108
|
+
/** True when the row itself is an archive the Extract flow understands. */
|
|
109
|
+
isArchive: boolean;
|
|
93
110
|
/**
|
|
94
111
|
* True when the row's label names more than one directory — a collapsed
|
|
95
112
|
* chain, whose inner levels are not rows and therefore not renameable until
|
|
@@ -111,7 +128,7 @@ export interface FileActions {
|
|
|
111
128
|
closeHistory: () => void;
|
|
112
129
|
}
|
|
113
130
|
|
|
114
|
-
export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCreated, onRenamed, onUnfold, onFold, clipboard, isFolder }: FileActionDeps): FileActions {
|
|
131
|
+
export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCreated, onRenamed, onUnfold, onFold, clipboard, isFolder, selection, selected, archive }: FileActionDeps): FileActions {
|
|
115
132
|
const actionFetcher = useFetcher<FsActionResponse>();
|
|
116
133
|
const [contextMenu, setContextMenu] = useState<{ x: number; y: number } | null>(null);
|
|
117
134
|
const contextMenuRef = useRef<HTMLDivElement>(null);
|
|
@@ -183,7 +200,11 @@ export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCre
|
|
|
183
200
|
onOpenFile?.({ path: file.path, name: file.name, root: rootPath, repo: repo || '.' });
|
|
184
201
|
};
|
|
185
202
|
|
|
186
|
-
const clipboardTarget = { path: file.path, name: file.name, kind: isFolder ? 'folder'
|
|
203
|
+
const clipboardTarget: ClipboardTarget = { path: file.path, name: file.name, kind: isFolder ? 'folder' : 'file' };
|
|
204
|
+
// The menu's verbs act on the marked rows when this row is one of them; a
|
|
205
|
+
// right-click on an unmarked row never gets here — the panel selects it first.
|
|
206
|
+
const targets = selected && selection.length > 1 ? selection : [clipboardTarget];
|
|
207
|
+
const archiveTarget = isArchiveName(file.name);
|
|
187
208
|
/**
|
|
188
209
|
* The row's Paste label, or null when a paste cannot land here.
|
|
189
210
|
*
|
|
@@ -194,7 +215,7 @@ export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCre
|
|
|
194
215
|
* background menu, which cannot know which rows are illegal.
|
|
195
216
|
*/
|
|
196
217
|
const pasteLabel = clipboard.clip && !clipboard.refusalFor(clipboardTarget)
|
|
197
|
-
? `Paste ${clipboard.clip
|
|
218
|
+
? `Paste ${clipboardLabel(clipboard.clip) ?? 'item'}`
|
|
198
219
|
: null;
|
|
199
220
|
|
|
200
221
|
const handleAction = (actionType: string) => {
|
|
@@ -241,9 +262,13 @@ export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCre
|
|
|
241
262
|
} else if (actionType === 'delete') {
|
|
242
263
|
setShowDeleteModal(true);
|
|
243
264
|
} else if (actionType === 'cut') {
|
|
244
|
-
clipboard.cut(
|
|
265
|
+
clipboard.cut(targets);
|
|
245
266
|
} else if (actionType === 'copy') {
|
|
246
|
-
clipboard.copy(
|
|
267
|
+
clipboard.copy(targets);
|
|
268
|
+
} else if (actionType === 'compress') {
|
|
269
|
+
archive.openCompress(targets);
|
|
270
|
+
} else if (actionType === 'extract') {
|
|
271
|
+
archive.openExtract(clipboardTarget);
|
|
247
272
|
} else if (actionType === 'duplicate') {
|
|
248
273
|
clipboard.duplicate(clipboardTarget);
|
|
249
274
|
} else if (actionType === 'paste') {
|
|
@@ -264,7 +289,8 @@ export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCre
|
|
|
264
289
|
const submitDelete = () => {
|
|
265
290
|
const fd = new FormData();
|
|
266
291
|
fd.append('actionType', 'delete');
|
|
267
|
-
fd.append('
|
|
292
|
+
if (targets.length > 1) fd.append('paths', JSON.stringify(targets.map((target) => target.path)));
|
|
293
|
+
else fd.append('path', file.path);
|
|
268
294
|
submitAction(fd);
|
|
269
295
|
};
|
|
270
296
|
|
|
@@ -284,8 +310,10 @@ export function useFileActions({ file, diff, onOpenFile, onActionComplete, onCre
|
|
|
284
310
|
renameValue,
|
|
285
311
|
setRenameValue,
|
|
286
312
|
renameError,
|
|
287
|
-
busy: actionFetcher.state !== 'idle' || create.busy || clipboard.busy,
|
|
313
|
+
busy: actionFetcher.state !== 'idle' || create.busy || clipboard.busy || archive.busy,
|
|
288
314
|
pasteLabel,
|
|
315
|
+
selectionCount: targets.length,
|
|
316
|
+
isArchive: archiveTarget,
|
|
289
317
|
chainLabel: onUnfold !== undefined,
|
|
290
318
|
foldable: onFold !== undefined,
|
|
291
319
|
fetcherState: actionFetcher.state,
|
|
@@ -55,7 +55,7 @@ interface PanelRegistryState {
|
|
|
55
55
|
/**
|
|
56
56
|
* Every panel id switched off — a bare built-in view id, or `plugin:<id>`.
|
|
57
57
|
* Read by the built-in registrations and the activity bar; the single source
|
|
58
|
-
* of "is this panel on", shared with the
|
|
58
|
+
* of "is this panel on", shared with the Plugins Kabmo switches.
|
|
59
59
|
*/
|
|
60
60
|
disabledPanels: string[];
|
|
61
61
|
/** The last known freshness of each git-installed plugin, by plugin id. */
|
|
@@ -24,19 +24,31 @@ export interface ScheduleDraft {
|
|
|
24
24
|
prompt: string;
|
|
25
25
|
kind: ScheduleKind;
|
|
26
26
|
spec: string;
|
|
27
|
+
harness: string;
|
|
28
|
+
timezone: string;
|
|
27
29
|
folderId: number | null;
|
|
28
30
|
sessionId: string | null;
|
|
29
31
|
model: ScheduledTaskModel | null;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
/** The schedule topic's payload: the list plus the zone a new task defaults to. */
|
|
35
|
+
export interface ScheduleSnapshot {
|
|
36
|
+
tasks: ScheduledTask[];
|
|
37
|
+
serverTimeZone: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function readList(res: Response): Promise<ScheduleSnapshot | null> {
|
|
41
|
+
const data = (await res.json().catch(() => null)) as
|
|
42
|
+
| { tasks?: ScheduledTask[]; serverTimeZone?: string; error?: string }
|
|
43
|
+
| null;
|
|
34
44
|
if (!res.ok || !data || data.error) return null;
|
|
35
|
-
return data.tasks ?? [];
|
|
45
|
+
return { tasks: data.tasks ?? [], serverTimeZone: data.serverTimeZone ?? '' };
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
export interface ScheduleController {
|
|
39
49
|
tasks: ScheduledTask[];
|
|
50
|
+
/** The server's IANA zone; a new task defaults to it. */
|
|
51
|
+
serverTimeZone: string;
|
|
40
52
|
loading: boolean;
|
|
41
53
|
error: string | null;
|
|
42
54
|
refresh: () => Promise<void>;
|
|
@@ -49,15 +61,17 @@ export interface ScheduleController {
|
|
|
49
61
|
|
|
50
62
|
export function useScheduledTasks(active: boolean): ScheduleController {
|
|
51
63
|
const [tasks, setTasks] = useState<ScheduledTask[]>([]);
|
|
64
|
+
const [serverTimeZone, setServerTimeZone] = useState('');
|
|
52
65
|
const [loading, setLoading] = useState(false);
|
|
53
66
|
const [error, setError] = useState<string | null>(null);
|
|
54
67
|
|
|
55
68
|
const refresh = useCallback(async () => {
|
|
56
69
|
setLoading(true);
|
|
57
70
|
try {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
setTasks(
|
|
71
|
+
const snapshot = await readList(await fetch('/api/schedule'));
|
|
72
|
+
if (snapshot) {
|
|
73
|
+
setTasks(snapshot.tasks);
|
|
74
|
+
if (snapshot.serverTimeZone) setServerTimeZone(snapshot.serverTimeZone);
|
|
61
75
|
setError(null);
|
|
62
76
|
} else {
|
|
63
77
|
setError('Could not load scheduled tasks.');
|
|
@@ -72,10 +86,11 @@ export function useScheduledTasks(active: boolean): ScheduleController {
|
|
|
72
86
|
// The schedule topic is the read path: a snapshot on subscribe, then a push
|
|
73
87
|
// whenever a task is written — by this tab, another tab, or the runtime's own
|
|
74
88
|
// fire. `refresh` stays for a caller that needs an immediate re-read.
|
|
75
|
-
const topic = useRealtimeTopic<
|
|
89
|
+
const topic = useRealtimeTopic<ScheduleSnapshot>(TOPIC_SCHEDULE, { enabled: active });
|
|
76
90
|
useEffect(() => {
|
|
77
91
|
if (!topic.data) return;
|
|
78
|
-
setTasks(topic.data);
|
|
92
|
+
setTasks(topic.data.tasks);
|
|
93
|
+
if (topic.data.serverTimeZone) setServerTimeZone(topic.data.serverTimeZone);
|
|
79
94
|
setLoading(false);
|
|
80
95
|
setError(null);
|
|
81
96
|
}, [topic.data]);
|
|
@@ -139,7 +154,7 @@ export function useScheduledTasks(active: boolean): ScheduleController {
|
|
|
139
154
|
}
|
|
140
155
|
}, []);
|
|
141
156
|
|
|
142
|
-
return { tasks, loading, error, refresh, create, patch, remove, runNow, loadRuns };
|
|
157
|
+
return { tasks, serverTimeZone, loading, error, refresh, create, patch, remove, runNow, loadRuns };
|
|
143
158
|
}
|
|
144
159
|
|
|
145
160
|
/**
|
|
@@ -154,6 +169,6 @@ export function useScheduledTasks(active: boolean): ScheduleController {
|
|
|
154
169
|
export function useScheduledTaskCount(): number {
|
|
155
170
|
// Derived from the SAME topic the modal reads, so the badge cannot disagree
|
|
156
171
|
// with the list, and the modal's own writes reach it without an event.
|
|
157
|
-
const topic = useRealtimeTopic<
|
|
158
|
-
return useMemo(() => (topic.data ?? []).filter((task) => task.enabled).length, [topic.data]);
|
|
172
|
+
const topic = useRealtimeTopic<ScheduleSnapshot>(TOPIC_SCHEDULE);
|
|
173
|
+
return useMemo(() => (topic.data?.tasks ?? []).filter((task) => task.enabled).length, [topic.data]);
|
|
159
174
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Edited workbooks that are not on disk yet, keyed by the file they belong to.
|
|
8
|
+
*
|
|
9
|
+
* The grid's edits live in the viewer, and the viewer unmounts when the user
|
|
10
|
+
* switches tabs — so a draft kept in component state would be lost by a glance
|
|
11
|
+
* at another file while the tab still said "edited". This map is the smallest
|
|
12
|
+
* thing that survives that: one entry per workbook with unsaved edits, dropped
|
|
13
|
+
* when the save lands.
|
|
14
|
+
*
|
|
15
|
+
* It is deliberately NOT a cache of every workbook ever opened: a clean
|
|
16
|
+
* workbook is re-read from disk, which is the only copy that can be trusted
|
|
17
|
+
* after an external change.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { LoadedWorkbook } from '@/client/components/workspace/editor/viewers/workbook';
|
|
21
|
+
|
|
22
|
+
export interface WorkbookDraft {
|
|
23
|
+
workbook: LoadedWorkbook;
|
|
24
|
+
dirty: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const drafts = new Map<string, WorkbookDraft>();
|
|
28
|
+
|
|
29
|
+
/** The draft for a file, or undefined when it has none. */
|
|
30
|
+
export function draftFor(key: string): WorkbookDraft | undefined {
|
|
31
|
+
return drafts.get(key);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Keep an edited workbook for a file. */
|
|
35
|
+
export function rememberDraft(key: string, draft: WorkbookDraft): void {
|
|
36
|
+
drafts.set(key, draft);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Drop a file's draft — the save landed, or the edits were discarded. */
|
|
40
|
+
export function forgetDraft(key: string): void {
|
|
41
|
+
drafts.delete(key);
|
|
42
|
+
}
|
|
@@ -145,7 +145,7 @@ export type HandleWriteResult = 'written' | 'needs-permission' | 'failed';
|
|
|
145
145
|
*/
|
|
146
146
|
export async function writeThroughHandle(
|
|
147
147
|
handleId: string,
|
|
148
|
-
|
|
148
|
+
data: string | Uint8Array,
|
|
149
149
|
options: { interactive: boolean },
|
|
150
150
|
): Promise<HandleWriteResult> {
|
|
151
151
|
const handle = handles.get(handleId);
|
|
@@ -162,7 +162,7 @@ export async function writeThroughHandle(
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
const writable = await handle.createWritable();
|
|
165
|
-
await writable.write(
|
|
165
|
+
await writable.write(data);
|
|
166
166
|
await writable.close();
|
|
167
167
|
return 'written';
|
|
168
168
|
} catch {
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/**
|
|
6
|
+
/** Permission, the two transports, and the refusals that must stay quiet. */
|
|
7
7
|
|
|
8
8
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
9
9
|
import { Window } from 'happy-dom';
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
requestNotificationPermission,
|
|
13
|
-
shouldShowSystemNotification,
|
|
14
13
|
showOsNotification,
|
|
15
14
|
} from '@/client/lib/notifications/os';
|
|
16
15
|
|
|
@@ -32,34 +31,6 @@ afterEach(() => {
|
|
|
32
31
|
for (const key of DOM_GLOBALS) target[key] = nativeGlobals[key];
|
|
33
32
|
});
|
|
34
33
|
|
|
35
|
-
function setVisibility(value: 'visible' | 'hidden'): void {
|
|
36
|
-
Object.defineProperty(document, 'visibilityState', { configurable: true, value });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function setFocus(value: boolean): void {
|
|
40
|
-
Object.defineProperty(document, 'hasFocus', { configurable: true, value: () => value });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
describe('shouldShowSystemNotification', () => {
|
|
44
|
-
test('a backgrounded tab is worth a banner', () => {
|
|
45
|
-
setVisibility('hidden');
|
|
46
|
-
setFocus(false);
|
|
47
|
-
expect(shouldShowSystemNotification()).toBe(true);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('a desktop window behind another app is worth a banner', () => {
|
|
51
|
-
setVisibility('visible');
|
|
52
|
-
setFocus(false);
|
|
53
|
-
expect(shouldShowSystemNotification()).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('the window the user is reading is not', () => {
|
|
57
|
-
setVisibility('visible');
|
|
58
|
-
setFocus(true);
|
|
59
|
-
expect(shouldShowSystemNotification()).toBe(false);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
34
|
describe('a browser without the Notification API', () => {
|
|
64
35
|
test('refuses permission instead of throwing', async () => {
|
|
65
36
|
expect(await requestNotificationPermission()).toBe(false);
|
|
@@ -113,18 +113,3 @@ export async function showOsNotification(notification: OsNotification): Promise<
|
|
|
113
113
|
console.warn('[notifications] the browser could not show a notification:', error);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Whether a system notification is worth sending right now.
|
|
119
|
-
*
|
|
120
|
-
* Only when Kabmo is NOT the window the user is looking at. The sidebar badge
|
|
121
|
-
* and the inline error card already say these things on screen; a banner over
|
|
122
|
-
* the app the user is reading is noise. `visibilityState` catches a backgrounded
|
|
123
|
-
* tab and a paused WebView (both phones), `hasFocus` catches a desktop window
|
|
124
|
-
* behind another application.
|
|
125
|
-
*/
|
|
126
|
-
export function shouldShowSystemNotification(): boolean {
|
|
127
|
-
if (typeof document === 'undefined') return false;
|
|
128
|
-
if (document.visibilityState === 'hidden') return true;
|
|
129
|
-
return !document.hasFocus();
|
|
130
|
-
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The device class decides which master switch a banner obeys. The distinction
|
|
8
|
+
* that matters: a narrow desktop window reflows the shell but must still answer
|
|
9
|
+
* to the Desktop switch, so width is deliberately not consulted.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
13
|
+
import { Window } from 'happy-dom';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
isMobileNotificationClient,
|
|
17
|
+
notificationPlatformForClient,
|
|
18
|
+
} from '@/client/lib/notifications/platform';
|
|
19
|
+
|
|
20
|
+
const DOM_GLOBALS = ['window', 'document', 'navigator'] as const;
|
|
21
|
+
const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
|
|
22
|
+
|
|
23
|
+
function install(userAgent: string, opts: { coarse?: boolean; hoverNone?: boolean } = {}): void {
|
|
24
|
+
const win = new Window({ url: 'http://localhost' });
|
|
25
|
+
Object.defineProperty(win.navigator, 'userAgent', { configurable: true, value: userAgent });
|
|
26
|
+
win.matchMedia = ((query: string) => ({
|
|
27
|
+
matches: (query === '(pointer: coarse)' && opts.coarse === true)
|
|
28
|
+
|| (query === '(hover: none)' && opts.hoverNone === true),
|
|
29
|
+
media: query,
|
|
30
|
+
onchange: null,
|
|
31
|
+
addEventListener: () => {},
|
|
32
|
+
removeEventListener: () => {},
|
|
33
|
+
addListener: () => {},
|
|
34
|
+
removeListener: () => {},
|
|
35
|
+
dispatchEvent: () => false,
|
|
36
|
+
})) as unknown as typeof win.matchMedia;
|
|
37
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
38
|
+
for (const key of DOM_GLOBALS) {
|
|
39
|
+
if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
|
|
40
|
+
target[key] = (win as unknown as Record<string, unknown>)[key];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
install('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
afterEach(() => {
|
|
49
|
+
const target = globalThis as unknown as Record<string, unknown>;
|
|
50
|
+
for (const key of DOM_GLOBALS) target[key] = nativeGlobals[key];
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('isMobileNotificationClient', () => {
|
|
54
|
+
test('a desktop browser is desktop, whatever its window width', () => {
|
|
55
|
+
expect(isMobileNotificationClient()).toBe(false);
|
|
56
|
+
expect(notificationPlatformForClient()).toBe('desktop');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('a phone user agent is mobile', () => {
|
|
60
|
+
install('Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) Mobile/15E148');
|
|
61
|
+
expect(isMobileNotificationClient()).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('a coarse primary pointer is mobile even with a desktop user agent', () => {
|
|
65
|
+
install('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)', { coarse: true, hoverNone: true });
|
|
66
|
+
expect(notificationPlatformForClient()).toBe('mobile');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which device class this client is, for the Notifications page's two delivery
|
|
8
|
+
* switches.
|
|
9
|
+
*
|
|
10
|
+
* This is a DEVICE fact, not a layout one: `App.tsx` also treats a narrow
|
|
11
|
+
* desktop window as mobile so the shell can reflow, but a 700px-wide desktop
|
|
12
|
+
* browser is still a desktop and must honour the Desktop switch. The union is
|
|
13
|
+
* deliberately the same as the touch-device rule (a phone/tablet reports a
|
|
14
|
+
* coarse primary pointer, and iPadOS desktop-class Safari answers the
|
|
15
|
+
* touch-points + `hover: none` pair) plus the phone user agent, which is what
|
|
16
|
+
* the shells and mobile browsers identify themselves with.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const MOBILE_UA =
|
|
20
|
+
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i;
|
|
21
|
+
|
|
22
|
+
/** Whether this client is a phone or tablet — what the Mobile switch governs. */
|
|
23
|
+
export function isMobileNotificationClient(): boolean {
|
|
24
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined') return false;
|
|
25
|
+
if (MOBILE_UA.test(navigator.userAgent ?? '')) return true;
|
|
26
|
+
if (typeof window.matchMedia !== 'function') return false;
|
|
27
|
+
if (window.matchMedia('(pointer: coarse)').matches) return true;
|
|
28
|
+
return (
|
|
29
|
+
(navigator.maxTouchPoints ?? 0) > 0 && window.matchMedia('(hover: none)').matches
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The delivery switch this client reads: `mobile` on a phone/tablet, else `desktop`. */
|
|
34
|
+
export function notificationPlatformForClient(): 'desktop' | 'mobile' {
|
|
35
|
+
return isMobileNotificationClient() ? 'mobile' : 'desktop';
|
|
36
|
+
}
|
|
@@ -3,107 +3,40 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The app-wide scrollbar reveal rule.
|
|
8
|
-
*
|
|
9
|
-
* What this file pins is the part that is easy to get wrong and impossible to
|
|
10
|
-
* notice by hand: `scroll` does not bubble, so a document listener only sees
|
|
11
|
-
* the reveal if it is registered in the CAPTURE phase with `event.target` read
|
|
12
|
-
* as the scroller. Get that wrong and the code still runs, still adds no error
|
|
13
|
-
* anywhere, and simply never reveals a bar on any container except the page
|
|
14
|
-
* itself — which looks exactly like a CSS problem.
|
|
15
|
-
*
|
|
16
|
-
* The other half is the gate, and it is the reason this module exists in the
|
|
17
|
-
* shape it does: a PROGRAMMATIC scroll is a real, trusted `scroll` event, so a
|
|
18
|
-
* reveal keyed on the event alone pins the bar on screen for as long as
|
|
19
|
-
* anything else moves the container — measured as a chat timeline whose bar
|
|
20
|
-
* never faded during a stream, with nobody touching the page. Every case below
|
|
21
|
-
* that asserts a reveal therefore produces INPUT first, and the cases that
|
|
22
|
-
* assert no reveal are the ones with a bare scroll.
|
|
23
|
-
*
|
|
24
|
-
* Each case gets its OWN document and its own install, because the module is
|
|
25
|
-
* idempotent per document and its input clock is per install: a shared document
|
|
26
|
-
* would make every case inherit the previous one's wheel (and would make a
|
|
27
|
-
* `useFakeTimers` clock that restarts at real time read as recent input).
|
|
28
|
-
*
|
|
29
|
-
* Mounted against happy-dom, the same way the other client tests are.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
6
|
import { afterAll, afterEach, beforeAll, describe, expect, jest, test } from 'bun:test';
|
|
33
|
-
import { Window } from 'happy-dom';
|
|
34
7
|
|
|
35
8
|
import {
|
|
36
|
-
installScrollbarActivity,
|
|
37
9
|
SCROLLBAR_ACTIVE_ATTRIBUTE,
|
|
38
10
|
SCROLLBAR_IDLE_MS,
|
|
39
|
-
|
|
11
|
+
installScrollbarActivity,
|
|
40
12
|
} from '@/client/lib/scrollbar-activity';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
13
|
+
import {
|
|
14
|
+
ARM_MS,
|
|
15
|
+
IDLE_MS,
|
|
16
|
+
freshPage,
|
|
17
|
+
inputAt,
|
|
18
|
+
restoreNativeGlobals,
|
|
19
|
+
saveNativeGlobals,
|
|
20
|
+
scrollAt,
|
|
21
|
+
scroller,
|
|
22
|
+
} from '@/client/lib/scrollbar-probe.test-util';
|
|
23
|
+
|
|
24
|
+
beforeAll(saveNativeGlobals);
|
|
25
|
+
afterAll(restoreNativeGlobals);
|
|
58
26
|
afterEach(() => {
|
|
59
27
|
jest.useRealTimers();
|
|
60
28
|
});
|
|
61
29
|
|
|
62
|
-
afterAll(() => {
|
|
63
|
-
const target = globalThis as unknown as Record<string, unknown>;
|
|
64
|
-
for (const key of DOM_GLOBALS) {
|
|
65
|
-
if (nativeGlobals[key] === undefined) delete target[key];
|
|
66
|
-
else target[key] = nativeGlobals[key];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
30
|
/**
|
|
71
|
-
*
|
|
31
|
+
* The reveal gate: which scrolls may paint a bar, and for how long.
|
|
72
32
|
*
|
|
73
|
-
* A
|
|
74
|
-
*
|
|
75
|
-
*
|
|
33
|
+
* A `scroll` event alone is not proof of a user — a stream's auto-follow emits
|
|
34
|
+
* real, trusted scroll events — so the gate asks whether the user's input
|
|
35
|
+
* produced this scroll. Everything here is that question, its escape hatches
|
|
36
|
+
* (a held pointer, a delayed delivery) and the fade window.
|
|
76
37
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const target = globalThis as unknown as Record<string, unknown>;
|
|
80
|
-
for (const key of DOM_GLOBALS) target[key] = (win as unknown as Record<string, unknown>)[key];
|
|
81
|
-
installScrollbarActivity(IDLE_MS, ARM_MS);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** A scroll container in the live document. */
|
|
85
|
-
function scroller(): HTMLElement {
|
|
86
|
-
const element = document.createElement('div');
|
|
87
|
-
document.body.appendChild(element);
|
|
88
|
-
return element;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** The event a browser dispatches at a scroller — it does not bubble. */
|
|
92
|
-
function scrollAt(element: Element): void {
|
|
93
|
-
element.dispatchEvent(new Event('scroll'));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** The input a browser delivers before a scroll the USER caused.
|
|
97
|
-
*
|
|
98
|
-
* Dispatched ON the scroller, because that is what a wheel does: it is targeted
|
|
99
|
-
* at the element under the pointer, and the arm is bound to that subtree so a
|
|
100
|
-
* wheel that could not move its container cannot later vouch for a programmatic
|
|
101
|
-
* scroll somewhere else. */
|
|
102
|
-
function inputAt(element: Element = document.body): void {
|
|
103
|
-
element.dispatchEvent(new Event('wheel'));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
describe('installScrollbarActivity', () => {
|
|
38
|
+
|
|
39
|
+
describe('the scrollbar reveal gate', () => {
|
|
107
40
|
test('a user-driven scroll on a nested container reveals ITS bar, not the page\'s', () => {
|
|
108
41
|
jest.useFakeTimers();
|
|
109
42
|
freshPage();
|