@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,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reading a workbook into the grid's shape, and writing an edited one back.
|
|
8
|
+
*
|
|
9
|
+
* SheetJS (`xlsx`) rather than `read-excel-file`, which this viewer used before
|
|
10
|
+
* `.xls` was supported. The legacy format is an OLE2 compound file holding BIFF
|
|
11
|
+
* records, and `read-excel-file` reads only the ZIP-based OOXML formats — so
|
|
12
|
+
* supporting `.xls` at all means a BIFF reader, and SheetJS is the maintained
|
|
13
|
+
* one. The package is installed from SheetJS's own distribution
|
|
14
|
+
* (`cdn.sheetjs.com`, 0.20.3) because the copy on npm is a stale 0.18.5 with
|
|
15
|
+
* published advisories. Measured cost: 376 KB minified in the client bundle
|
|
16
|
+
* (`bun build --minify`), against 55 KB for the reader it replaces — a 2.7%
|
|
17
|
+
* increase on a 13.8 MB bundle that the local server hands over, and the price
|
|
18
|
+
* of opening `.xls` at all.
|
|
19
|
+
*
|
|
20
|
+
* `raw: false` is what makes a cell read like the spreadsheet shows it: the
|
|
21
|
+
* reader returns the cell's FORMATTED text (`w`), so a date is the file's own
|
|
22
|
+
* date format and a currency keeps its symbol, instead of a serial number the
|
|
23
|
+
* grid would have to re-format. A formula's cached value is what comes back,
|
|
24
|
+
* which is what Excel shows too.
|
|
25
|
+
*
|
|
26
|
+
* **The reader's own workbook is kept**, not just the display rows. An edit
|
|
27
|
+
* writes ONE cell into that workbook and the save serializes it, so every sheet
|
|
28
|
+
* and every cell the user did not touch keeps its value, formula and number
|
|
29
|
+
* format. Rebuilding a workbook from the display rows would silently drop all
|
|
30
|
+
* of it.
|
|
31
|
+
*
|
|
32
|
+
* The read is bounded by the same row and column caps as the CSV grid: a grid
|
|
33
|
+
* is a DOM surface, and an unbounded sheet would mount a table the browser
|
|
34
|
+
* cannot lay out. The caller is told the result was cut (`truncated`) rather
|
|
35
|
+
* than shown a silently short sheet. The CAP is display-only — the workbook
|
|
36
|
+
* behind it is whole, so saving an edit never drops the rows past the cap.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
import * as XLSX from 'xlsx';
|
|
40
|
+
import { MAX_CSV_COLUMNS, MAX_CSV_ROWS } from '@/shared/lib/fs/csv';
|
|
41
|
+
|
|
42
|
+
/** One sheet as the grid draws it: a name and its rows of display text. */
|
|
43
|
+
export interface WorkbookSheet {
|
|
44
|
+
name: string;
|
|
45
|
+
rows: string[][];
|
|
46
|
+
/** The sheet held more rows or columns than the caps allow. */
|
|
47
|
+
truncated: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The container a workbook was read from, and the one it is written back as. */
|
|
51
|
+
export type WorkbookFormat = 'xlsx' | 'xlsm' | 'xls';
|
|
52
|
+
|
|
53
|
+
export interface LoadedWorkbook {
|
|
54
|
+
/** The reader's workbook, kept so an edit can be written back losslessly. */
|
|
55
|
+
book: XLSX.WorkBook;
|
|
56
|
+
sheets: WorkbookSheet[];
|
|
57
|
+
format: WorkbookFormat;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The container a path names. Anything else is treated as the modern format. */
|
|
61
|
+
export function workbookFormatFor(path: string): WorkbookFormat {
|
|
62
|
+
const extension = path.slice(path.lastIndexOf('.') + 1).toLowerCase();
|
|
63
|
+
if (extension === 'xls') return 'xls';
|
|
64
|
+
if (extension === 'xlsm') return 'xlsm';
|
|
65
|
+
return 'xlsx';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function readWorkbook(bytes: ArrayBuffer, path: string): Promise<LoadedWorkbook> {
|
|
69
|
+
const book = XLSX.read(new Uint8Array(bytes), { type: 'array', cellDates: true, bookVBA: true });
|
|
70
|
+
|
|
71
|
+
const sheets = book.SheetNames.map((name) => {
|
|
72
|
+
const sheet = book.Sheets[name];
|
|
73
|
+
const ref = sheet?.['!ref'];
|
|
74
|
+
if (!sheet || !ref) return { name, rows: [], truncated: false };
|
|
75
|
+
|
|
76
|
+
const bounds = XLSX.utils.decode_range(ref);
|
|
77
|
+
const lastRow = Math.min(bounds.e.r, MAX_CSV_ROWS);
|
|
78
|
+
const lastCol = Math.min(bounds.e.c, MAX_CSV_COLUMNS - 1);
|
|
79
|
+
const rows = XLSX.utils.sheet_to_json<string[]>(sheet, {
|
|
80
|
+
header: 1,
|
|
81
|
+
raw: false,
|
|
82
|
+
defval: '',
|
|
83
|
+
blankrows: true,
|
|
84
|
+
range: { s: { r: 0, c: 0 }, e: { r: lastRow, c: lastCol } },
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
name,
|
|
89
|
+
rows: rows.map((row) => row.map((cell) => (cell == null ? '' : String(cell)))),
|
|
90
|
+
truncated: bounds.e.r > MAX_CSV_ROWS || bounds.e.c >= MAX_CSV_COLUMNS,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return { book, sheets, format: workbookFormatFor(path) };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Write one cell into the reader's workbook.
|
|
99
|
+
*
|
|
100
|
+
* `row` and `col` are ABSOLUTE sheet coordinates (0-based), not the grid's data
|
|
101
|
+
* rows: the grid's first data row is the sheet's row 1, because row 0 is drawn
|
|
102
|
+
* as the header strip.
|
|
103
|
+
*
|
|
104
|
+
* A numeric-looking value becomes a number, which is what typing `3` into a
|
|
105
|
+
* spreadsheet does; everything else is text. The cell's style and number format
|
|
106
|
+
* are kept, and its formula is dropped — the user replaced the formula's result
|
|
107
|
+
* with a literal, and keeping `f` would make Excel recompute over the new value.
|
|
108
|
+
*/
|
|
109
|
+
export function setWorkbookCell(
|
|
110
|
+
book: XLSX.WorkBook,
|
|
111
|
+
sheetName: string,
|
|
112
|
+
row: number,
|
|
113
|
+
col: number,
|
|
114
|
+
value: string,
|
|
115
|
+
): void {
|
|
116
|
+
const sheet = book.Sheets[sheetName];
|
|
117
|
+
if (!sheet) return;
|
|
118
|
+
const address = XLSX.utils.encode_cell({ r: row, c: col });
|
|
119
|
+
const previous = sheet[address] as XLSX.CellObject | undefined;
|
|
120
|
+
const numeric = value !== '' && /^-?\d+(\.\d+)?$/.test(value);
|
|
121
|
+
const cell: XLSX.CellObject = numeric
|
|
122
|
+
? { t: 'n', v: Number(value) }
|
|
123
|
+
: { t: 's', v: value };
|
|
124
|
+
if (previous?.s) cell.s = previous.s;
|
|
125
|
+
if (previous?.z) cell.z = previous.z;
|
|
126
|
+
sheet[address] = cell;
|
|
127
|
+
|
|
128
|
+
// A cell written past the sheet's recorded range would be dropped by the
|
|
129
|
+
// writer, so the range grows with the edit.
|
|
130
|
+
const ref = sheet['!ref'];
|
|
131
|
+
if (ref) {
|
|
132
|
+
const bounds = XLSX.utils.decode_range(ref);
|
|
133
|
+
bounds.e.r = Math.max(bounds.e.r, row);
|
|
134
|
+
bounds.e.c = Math.max(bounds.e.c, col);
|
|
135
|
+
sheet['!ref'] = XLSX.utils.encode_range(bounds);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Serialize the edited workbook back into its own container. */
|
|
140
|
+
export function writeWorkbook(book: XLSX.WorkBook, format: WorkbookFormat): Uint8Array {
|
|
141
|
+
const bytes = XLSX.write(book, {
|
|
142
|
+
type: 'array',
|
|
143
|
+
bookType: format,
|
|
144
|
+
cellDates: true,
|
|
145
|
+
compression: true,
|
|
146
|
+
bookVBA: format === 'xlsm',
|
|
147
|
+
}) as ArrayBuffer;
|
|
148
|
+
return new Uint8Array(bytes);
|
|
149
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The two archive dialogs: Compress to… and Extract…
|
|
8
|
+
*
|
|
9
|
+
* Both portal to `<body>` (the composer's backdrop-filter trap lives elsewhere,
|
|
10
|
+
* but the rule is the same: a `fixed` overlay must not be sized by an ancestor)
|
|
11
|
+
* and both show the server's refusal INLINE, because the field that caused it
|
|
12
|
+
* is still on screen. The format list is the server's availability answer;
|
|
13
|
+
* a format whose binary is missing is listed disabled with the reason, so the
|
|
14
|
+
* user sees the machine's limit instead of a failure after submitting.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createPortal } from 'preact/compat';
|
|
18
|
+
import type { FormEvent } from 'preact/compat';
|
|
19
|
+
import { archiveKindLabel, archiveKindOf, type ArchiveFormat } from '@/shared/lib/fs/archive';
|
|
20
|
+
import type { ClipboardTarget } from '@/client/hooks/workspace/file-clipboard';
|
|
21
|
+
import type { FileArchive } from '@/client/hooks/workspace/file-archive';
|
|
22
|
+
|
|
23
|
+
export interface ArchiveFormatOption {
|
|
24
|
+
id: ArchiveFormat;
|
|
25
|
+
label: string;
|
|
26
|
+
extension: string;
|
|
27
|
+
available: boolean;
|
|
28
|
+
tool: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface ShellProps {
|
|
32
|
+
title: string;
|
|
33
|
+
/** What is being acted on, one line. */
|
|
34
|
+
subject: string;
|
|
35
|
+
error: string | null;
|
|
36
|
+
busy: boolean;
|
|
37
|
+
submitLabel: string;
|
|
38
|
+
busyLabel: string;
|
|
39
|
+
onSubmit: (event: FormEvent) => void;
|
|
40
|
+
onCancel: () => void;
|
|
41
|
+
children: preact.ComponentChildren;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function ArchiveDialogShell({ title, subject, error, busy, submitLabel, busyLabel, onSubmit, onCancel, children }: ShellProps) {
|
|
45
|
+
return createPortal(
|
|
46
|
+
<div className="fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 backdrop-blur-sm">
|
|
47
|
+
<form onSubmit={onSubmit} className="glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans">
|
|
48
|
+
<h3 className="font-semibold text-ink mb-1 text-sm">{title}</h3>
|
|
49
|
+
<p className="text-[11px] text-ink/50 mb-3 break-words">{subject}</p>
|
|
50
|
+
{children}
|
|
51
|
+
{error && <p className="text-[11px] text-error mb-2">{error}</p>}
|
|
52
|
+
<div className="flex justify-end space-x-2 mt-3">
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
onClick={onCancel}
|
|
56
|
+
className="px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors"
|
|
57
|
+
disabled={busy}
|
|
58
|
+
>
|
|
59
|
+
Cancel
|
|
60
|
+
</button>
|
|
61
|
+
<button
|
|
62
|
+
type="submit"
|
|
63
|
+
className="px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center"
|
|
64
|
+
disabled={busy}
|
|
65
|
+
>
|
|
66
|
+
{busy ? busyLabel : submitLabel}
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
69
|
+
</form>
|
|
70
|
+
</div>,
|
|
71
|
+
document.body,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface CompressDialogProps {
|
|
76
|
+
entries: readonly ClipboardTarget[];
|
|
77
|
+
format: ArchiveFormat;
|
|
78
|
+
name: string;
|
|
79
|
+
destination: string;
|
|
80
|
+
formats: readonly ArchiveFormatOption[];
|
|
81
|
+
error: string | null;
|
|
82
|
+
busy: boolean;
|
|
83
|
+
onFormatChange: (format: ArchiveFormat) => void;
|
|
84
|
+
onNameChange: (name: string) => void;
|
|
85
|
+
onDestinationChange: (destination: string) => void;
|
|
86
|
+
onCancel: () => void;
|
|
87
|
+
onSubmit: () => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function CompressDialog({
|
|
91
|
+
entries,
|
|
92
|
+
format,
|
|
93
|
+
name,
|
|
94
|
+
destination,
|
|
95
|
+
formats,
|
|
96
|
+
error,
|
|
97
|
+
busy,
|
|
98
|
+
onFormatChange,
|
|
99
|
+
onNameChange,
|
|
100
|
+
onDestinationChange,
|
|
101
|
+
onCancel,
|
|
102
|
+
onSubmit,
|
|
103
|
+
}: CompressDialogProps) {
|
|
104
|
+
const names = entries.slice(0, 4).map((entry) => entry.name).join(', ');
|
|
105
|
+
const more = entries.length > 4 ? ` +${entries.length - 4} more` : '';
|
|
106
|
+
return (
|
|
107
|
+
<ArchiveDialogShell
|
|
108
|
+
title={`Compress ${entries.length === 1 ? entries[0]!.name : `${entries.length} items`}`}
|
|
109
|
+
subject={`${names}${more}`}
|
|
110
|
+
error={error}
|
|
111
|
+
busy={busy}
|
|
112
|
+
submitLabel="Compress"
|
|
113
|
+
busyLabel="Compressing..."
|
|
114
|
+
onCancel={onCancel}
|
|
115
|
+
onSubmit={(event) => {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
onSubmit();
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<label className="block text-[10px] uppercase tracking-wide text-ink/40 mb-1" htmlFor="archive-format">
|
|
121
|
+
Format
|
|
122
|
+
</label>
|
|
123
|
+
<select
|
|
124
|
+
id="archive-format"
|
|
125
|
+
value={format}
|
|
126
|
+
onChange={(event) => onFormatChange(event.currentTarget.value as ArchiveFormat)}
|
|
127
|
+
className="w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink mb-3"
|
|
128
|
+
>
|
|
129
|
+
{formats.map((option) => (
|
|
130
|
+
<option key={option.id} value={option.id} disabled={!option.available}>
|
|
131
|
+
{option.label}
|
|
132
|
+
{option.available ? '' : ` — ${option.tool} not installed`}
|
|
133
|
+
</option>
|
|
134
|
+
))}
|
|
135
|
+
</select>
|
|
136
|
+
|
|
137
|
+
<label className="block text-[10px] uppercase tracking-wide text-ink/40 mb-1" htmlFor="archive-name">
|
|
138
|
+
Archive name
|
|
139
|
+
</label>
|
|
140
|
+
<input
|
|
141
|
+
id="archive-name"
|
|
142
|
+
autoFocus
|
|
143
|
+
type="text"
|
|
144
|
+
value={name}
|
|
145
|
+
onChange={(event) => onNameChange(event.currentTarget.value)}
|
|
146
|
+
aria-label="Archive name"
|
|
147
|
+
className={`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none mb-3 ${
|
|
148
|
+
error ? 'border-error' : 'border-ink/20 focus:border-ink'
|
|
149
|
+
}`}
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<label className="block text-[10px] uppercase tracking-wide text-ink/40 mb-1" htmlFor="archive-destination">
|
|
153
|
+
Destination folder
|
|
154
|
+
</label>
|
|
155
|
+
<input
|
|
156
|
+
id="archive-destination"
|
|
157
|
+
type="text"
|
|
158
|
+
value={destination}
|
|
159
|
+
onChange={(event) => onDestinationChange(event.currentTarget.value)}
|
|
160
|
+
aria-label="Archive destination"
|
|
161
|
+
className="w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink"
|
|
162
|
+
/>
|
|
163
|
+
</ArchiveDialogShell>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface ExtractDialogProps {
|
|
168
|
+
archive: ClipboardTarget;
|
|
169
|
+
/** The detected archive kind, shown so the user knows what will unpack. */
|
|
170
|
+
kindLabel: string;
|
|
171
|
+
destination: string;
|
|
172
|
+
error: string | null;
|
|
173
|
+
busy: boolean;
|
|
174
|
+
onDestinationChange: (destination: string) => void;
|
|
175
|
+
onCancel: () => void;
|
|
176
|
+
onSubmit: () => void;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function ExtractDialog({
|
|
180
|
+
archive,
|
|
181
|
+
kindLabel,
|
|
182
|
+
destination,
|
|
183
|
+
error,
|
|
184
|
+
busy,
|
|
185
|
+
onDestinationChange,
|
|
186
|
+
onCancel,
|
|
187
|
+
onSubmit,
|
|
188
|
+
}: ExtractDialogProps) {
|
|
189
|
+
return (
|
|
190
|
+
<ArchiveDialogShell
|
|
191
|
+
title={`Extract ${archive.name}`}
|
|
192
|
+
subject={`${kindLabel} archive · extracts into a folder`}
|
|
193
|
+
error={error}
|
|
194
|
+
busy={busy}
|
|
195
|
+
submitLabel="Extract"
|
|
196
|
+
busyLabel="Extracting..."
|
|
197
|
+
onCancel={onCancel}
|
|
198
|
+
onSubmit={(event) => {
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
onSubmit();
|
|
201
|
+
}}
|
|
202
|
+
>
|
|
203
|
+
<label className="block text-[10px] uppercase tracking-wide text-ink/40 mb-1" htmlFor="extract-destination">
|
|
204
|
+
Extract to folder
|
|
205
|
+
</label>
|
|
206
|
+
<input
|
|
207
|
+
id="extract-destination"
|
|
208
|
+
autoFocus
|
|
209
|
+
type="text"
|
|
210
|
+
value={destination}
|
|
211
|
+
onChange={(event) => onDestinationChange(event.currentTarget.value)}
|
|
212
|
+
aria-label="Extract destination"
|
|
213
|
+
className={`w-full bg-paper border rounded px-2 py-1.5 text-xs font-mono focus:outline-none ${
|
|
214
|
+
error ? 'border-error' : 'border-ink/20 focus:border-ink'
|
|
215
|
+
}`}
|
|
216
|
+
/>
|
|
217
|
+
</ArchiveDialogShell>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Both archive dialogs, driven by the panel's one `useFileArchive` handle.
|
|
223
|
+
*
|
|
224
|
+
* The panel renders this once, beside the tree: the draft, the format list and
|
|
225
|
+
* the busy flag all live in the hook, so the overlay is a pure projection and
|
|
226
|
+
* the panel does not grow two 20-line prop blocks.
|
|
227
|
+
*/
|
|
228
|
+
export function ArchiveOverlays({ archive }: { archive: FileArchive }) {
|
|
229
|
+
if (archive.compress) {
|
|
230
|
+
return (
|
|
231
|
+
<CompressDialog
|
|
232
|
+
entries={archive.compress.entries}
|
|
233
|
+
format={archive.compress.format}
|
|
234
|
+
name={archive.compress.name}
|
|
235
|
+
destination={archive.compress.destination}
|
|
236
|
+
formats={archive.formats}
|
|
237
|
+
error={archive.error}
|
|
238
|
+
busy={archive.busy}
|
|
239
|
+
onFormatChange={archive.setFormat}
|
|
240
|
+
onNameChange={archive.setName}
|
|
241
|
+
onDestinationChange={archive.setCompressDestination}
|
|
242
|
+
onCancel={archive.cancel}
|
|
243
|
+
onSubmit={archive.submitCompress}
|
|
244
|
+
/>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
if (archive.extract) {
|
|
248
|
+
return (
|
|
249
|
+
<ExtractDialog
|
|
250
|
+
archive={archive.extract.archive}
|
|
251
|
+
kindLabel={archiveKindLabel(archiveKindOf(archive.extract.archive.name) ?? 'zip')}
|
|
252
|
+
destination={archive.extract.destination}
|
|
253
|
+
error={archive.error}
|
|
254
|
+
busy={archive.busy}
|
|
255
|
+
onDestinationChange={archive.setExtractDestination}
|
|
256
|
+
onCancel={archive.cancel}
|
|
257
|
+
onSubmit={archive.submitExtract}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
import { createPortal } from 'preact/compat';
|
|
31
31
|
import type { ReactNode, RefObject } from 'preact/compat';
|
|
32
|
-
import { ChevronDown, ChevronRight, ClipboardPaste, Copy, CopyPlus, Edit2, ExternalLink, Eye, FilePlus, FolderPlus, GitCompare, History, Scissors, Trash2 } from 'lucide-preact';
|
|
32
|
+
import { Archive, ChevronDown, ChevronRight, ClipboardPaste, Copy, CopyPlus, Edit2, ExternalLink, Eye, FilePlus, FolderPlus, GitCompare, History, PackageOpen, Scissors, Trash2 } from 'lucide-preact';
|
|
33
33
|
|
|
34
34
|
interface ContextMenuProps {
|
|
35
35
|
x: number;
|
|
@@ -44,6 +44,10 @@ interface ContextMenuProps {
|
|
|
44
44
|
foldable?: boolean;
|
|
45
45
|
/** True while a transfer is in flight; the acting rows disable on it. */
|
|
46
46
|
busy: boolean;
|
|
47
|
+
/** How many rows the transfer and archive verbs act on. */
|
|
48
|
+
selectionCount: number;
|
|
49
|
+
/** True when the target row is an archive the Extract flow understands. */
|
|
50
|
+
isArchive: boolean;
|
|
47
51
|
onAction: (actionType: string) => void;
|
|
48
52
|
menuRef?: RefObject<HTMLDivElement>;
|
|
49
53
|
}
|
|
@@ -59,9 +63,25 @@ const SEPARATOR_PX = 9;
|
|
|
59
63
|
const PADDING_PX = 8;
|
|
60
64
|
|
|
61
65
|
/** The rows this target offers, in order — the menu's single source of truth. */
|
|
62
|
-
function buildRows(options: { isFolder: boolean; hasGitStatus?: boolean; pasteLabel: string | null; busy: boolean; chainLabel?: boolean; foldable?: boolean }): MenuEntry[] {
|
|
63
|
-
const { isFolder, hasGitStatus, pasteLabel, busy, chainLabel, foldable } = options;
|
|
66
|
+
function buildRows(options: { isFolder: boolean; hasGitStatus?: boolean; pasteLabel: string | null; busy: boolean; chainLabel?: boolean; foldable?: boolean; selectionCount: number; isArchive: boolean }): MenuEntry[] {
|
|
67
|
+
const { isFolder, hasGitStatus, pasteLabel, busy, chainLabel, foldable, selectionCount, isArchive } = options;
|
|
64
68
|
const entries: MenuEntry[] = [];
|
|
69
|
+
const many = selectionCount > 1;
|
|
70
|
+
const count = selectionCount === 1 ? '' : ` ${selectionCount} items`;
|
|
71
|
+
|
|
72
|
+
// A multi-selection is a different object from a row: View, Rename,
|
|
73
|
+
// Duplicate and History all name ONE entry, and offering them for five rows
|
|
74
|
+
// would silently act on the row that was right-clicked. The menu says what
|
|
75
|
+
// the selection can actually do.
|
|
76
|
+
if (many) {
|
|
77
|
+
entries.push({ kind: 'item', id: 'cut', label: `Cut${count}`, icon: <Scissors size={13} className="text-ink/60" />, disabled: busy });
|
|
78
|
+
entries.push({ kind: 'item', id: 'copy', label: `Copy${count}`, icon: <Copy size={13} className="text-ink/60" />, disabled: busy });
|
|
79
|
+
entries.push({ kind: 'separator' });
|
|
80
|
+
entries.push({ kind: 'item', id: 'compress', label: `Compress${count} to…`, icon: <Archive size={13} className="text-ink/60" />, disabled: busy });
|
|
81
|
+
entries.push({ kind: 'separator' });
|
|
82
|
+
entries.push({ kind: 'item', id: 'delete', label: `Delete${count}`, icon: <Trash2 size={13} className="text-error" />, tone: 'text-error' });
|
|
83
|
+
return entries;
|
|
84
|
+
}
|
|
65
85
|
|
|
66
86
|
if (isFolder) {
|
|
67
87
|
entries.push({ kind: 'item', id: 'new_file', label: 'New File', icon: <FilePlus size={13} className="text-ink/60" /> });
|
|
@@ -78,6 +98,9 @@ function buildRows(options: { isFolder: boolean; hasGitStatus?: boolean; pasteLa
|
|
|
78
98
|
entries.push({ kind: 'separator' });
|
|
79
99
|
} else {
|
|
80
100
|
entries.push({ kind: 'item', id: 'view', label: 'View', icon: <Eye size={13} className="text-ink/60" /> });
|
|
101
|
+
if (isArchive) {
|
|
102
|
+
entries.push({ kind: 'item', id: 'extract', label: 'Extract…', icon: <PackageOpen size={13} className="text-ink/60" />, disabled: busy });
|
|
103
|
+
}
|
|
81
104
|
if (hasGitStatus) {
|
|
82
105
|
entries.push({ kind: 'item', id: 'diff', label: 'Open in Diff Panel', icon: <GitCompare size={13} className="text-warning" />, tone: 'font-medium' });
|
|
83
106
|
}
|
|
@@ -86,6 +109,7 @@ function buildRows(options: { isFolder: boolean; hasGitStatus?: boolean; pasteLa
|
|
|
86
109
|
|
|
87
110
|
entries.push({ kind: 'item', id: 'cut', label: 'Cut', icon: <Scissors size={13} className="text-ink/60" />, disabled: busy });
|
|
88
111
|
entries.push({ kind: 'item', id: 'copy', label: 'Copy', icon: <Copy size={13} className="text-ink/60" />, disabled: busy });
|
|
112
|
+
entries.push({ kind: 'item', id: 'compress', label: 'Compress to…', icon: <Archive size={13} className="text-ink/60" />, disabled: busy });
|
|
89
113
|
entries.push({ kind: 'item', id: 'duplicate', label: 'Duplicate', icon: <CopyPlus size={13} className="text-ink/60" />, disabled: busy });
|
|
90
114
|
if (pasteLabel) {
|
|
91
115
|
entries.push({ kind: 'item', id: 'paste', label: pasteLabel, icon: <ClipboardPaste size={13} className="text-ink/60" />, disabled: busy });
|
|
@@ -113,9 +137,9 @@ function menuHeightOf(entries: MenuEntry[]): number {
|
|
|
113
137
|
return items * ROW_PX + separators * SEPARATOR_PX + PADDING_PX;
|
|
114
138
|
}
|
|
115
139
|
|
|
116
|
-
export function FileContextMenu({ x, y, isFolder, hasGitStatus, pasteLabel, chainLabel, foldable, busy, onAction, menuRef }: ContextMenuProps) {
|
|
117
|
-
const menuWidth =
|
|
118
|
-
const entries = buildRows({ isFolder, hasGitStatus, pasteLabel, busy, chainLabel, foldable });
|
|
140
|
+
export function FileContextMenu({ x, y, isFolder, hasGitStatus, pasteLabel, chainLabel, foldable, busy, selectionCount, isArchive, onAction, menuRef }: ContextMenuProps) {
|
|
141
|
+
const menuWidth = 210;
|
|
142
|
+
const entries = buildRows({ isFolder, hasGitStatus, pasteLabel, busy, chainLabel, foldable, selectionCount, isArchive });
|
|
119
143
|
const menuHeight = menuHeightOf(entries);
|
|
120
144
|
|
|
121
145
|
const posX = typeof window !== 'undefined' ? Math.max(10, Math.min(x, window.innerWidth - menuWidth - 12)) : x;
|
|
@@ -85,17 +85,22 @@ interface DeleteModalProps {
|
|
|
85
85
|
/** The row's label, when it differs from the path (a collapsed chain). */
|
|
86
86
|
displayName?: string;
|
|
87
87
|
isFolder: boolean;
|
|
88
|
+
/** How many entries the confirmation removes; 1 for the row's own dialog. */
|
|
89
|
+
count?: number;
|
|
88
90
|
isLoading: boolean;
|
|
89
91
|
onCancel: () => void;
|
|
90
92
|
onConfirm: () => void;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
export function FileDeleteModal({ fileName, displayName, isFolder, isLoading, onCancel, onConfirm }: DeleteModalProps) {
|
|
95
|
+
export function FileDeleteModal({ fileName, displayName, isFolder, count = 1, isLoading, onCancel, onConfirm }: DeleteModalProps) {
|
|
96
|
+
const multiple = count > 1;
|
|
94
97
|
return createPortal(
|
|
95
98
|
<div className="fixed inset-0 modal-scrim z-[100] flex items-center justify-center p-4 backdrop-blur-sm">
|
|
96
99
|
<div className="glass-overlay bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans">
|
|
97
|
-
<h3 className="font-semibold text-ink mb-2 text-sm">Delete {isFolder ? 'Folder' : 'File'}</h3>
|
|
98
|
-
<p className="text-xs text-ink/70 mb-4">
|
|
100
|
+
<h3 className="font-semibold text-ink mb-2 text-sm">Delete {multiple ? `${count} Items` : isFolder ? 'Folder' : 'File'}</h3>
|
|
101
|
+
<p className="text-xs text-ink/70 mb-4">
|
|
102
|
+
Are you sure you want to delete {multiple ? <>the {count} selected entries</> : <span className="font-mono bg-canvas px-1 rounded">{fileName}</span>}? This action cannot be undone.
|
|
103
|
+
</p>
|
|
99
104
|
{/* A collapsed chain row is LABELLED `com/java/app/package` but its path
|
|
100
105
|
is the deepest directory, and that is what gets deleted. Naming only
|
|
101
106
|
the label would promise a removal of four directories and perform
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Files panel's ROOT-level overlays: the background's context menu and the
|
|
8
|
+
* New File / New Folder dialog it opens.
|
|
9
|
+
*
|
|
10
|
+
* Split out of `index.tsx` because the panel owns far too much state to also
|
|
11
|
+
* keep this markup inline, and because both pieces are pure projection of the
|
|
12
|
+
* root menu's state and the `useFileCreate` handle — no behaviour lives here.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { RefObject } from 'preact/compat';
|
|
16
|
+
import { RootContextMenu } from '@/client/components/workspace/file-explorer/RootMenu';
|
|
17
|
+
import { FileCreateModal } from '@/client/components/workspace/file-explorer/Modals';
|
|
18
|
+
import type { FileCreate } from '@/client/hooks/workspace/file-create';
|
|
19
|
+
|
|
20
|
+
export interface RootOverlaysProps {
|
|
21
|
+
menu: { x: number; y: number } | null;
|
|
22
|
+
menuRef: RefObject<HTMLDivElement>;
|
|
23
|
+
/** The clipboard label the root's Paste row shows, or null when it cannot land. */
|
|
24
|
+
pasteLabel: string | null;
|
|
25
|
+
busy: boolean;
|
|
26
|
+
/** A root menu action id; the panel closes the menu and dispatches. */
|
|
27
|
+
onAction: (action: string) => void;
|
|
28
|
+
/** The root's own create flow. */
|
|
29
|
+
create: FileCreate;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function RootOverlays({ menu, menuRef, pasteLabel, busy, onAction, create }: RootOverlaysProps) {
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
{menu && (
|
|
36
|
+
<RootContextMenu
|
|
37
|
+
x={menu.x}
|
|
38
|
+
y={menu.y}
|
|
39
|
+
menuRef={menuRef}
|
|
40
|
+
pasteLabel={pasteLabel}
|
|
41
|
+
busy={busy}
|
|
42
|
+
onAction={onAction}
|
|
43
|
+
/>
|
|
44
|
+
)}
|
|
45
|
+
|
|
46
|
+
{create.open && (
|
|
47
|
+
<FileCreateModal
|
|
48
|
+
folderPath="."
|
|
49
|
+
kind={create.kind}
|
|
50
|
+
value={create.name}
|
|
51
|
+
error={create.error}
|
|
52
|
+
isLoading={create.busy}
|
|
53
|
+
onChange={create.setName}
|
|
54
|
+
onCancel={create.closeDialog}
|
|
55
|
+
onSubmit={create.submit}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -24,14 +24,18 @@ interface TreeRowLabelProps {
|
|
|
24
24
|
isOpen: boolean;
|
|
25
25
|
/** Git-ignored entries render faded rather than being hidden. */
|
|
26
26
|
ignored: boolean;
|
|
27
|
+
/** The row is part of the panel's marked set. */
|
|
28
|
+
selected?: boolean;
|
|
27
29
|
/** This file's own change, when it has one. */
|
|
28
30
|
gitStatus: { colorClass: string; label: string; charStatus: string } | null;
|
|
29
31
|
/** The roll-up a folder wears instead: one dot, its tone from the changes. */
|
|
30
32
|
folderStatus: FolderGitStatusInfo | null | undefined;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
export function TreeRowLabel({ name, path, isFolder, isOpen, ignored, gitStatus, folderStatus }: TreeRowLabelProps) {
|
|
34
|
-
const tone =
|
|
35
|
+
export function TreeRowLabel({ name, path, isFolder, isOpen, ignored, selected, gitStatus, folderStatus }: TreeRowLabelProps) {
|
|
36
|
+
const tone = selected
|
|
37
|
+
? 'text-ink font-semibold'
|
|
38
|
+
: gitStatus ? gitStatus.colorClass : folderStatus ? folderStatus.colorClass : ignored ? 'text-ink/40' : '';
|
|
35
39
|
return (
|
|
36
40
|
<>
|
|
37
41
|
{isFolder ? (
|