@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,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The archive and batch-delete actions at the route.
|
|
8
|
+
*
|
|
9
|
+
* The round trips are driven through the real `/api/fs/action` entry point, so
|
|
10
|
+
* the scoped-root resolution, the JSON path list and the external tool all run
|
|
11
|
+
* together. Cases that need a binary the machine lacks are skipped, not failed.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
15
|
+
import fs from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { action } from '@/server/routes/fs/action';
|
|
18
|
+
|
|
19
|
+
const DIR = path.join(process.cwd(), 'tmp-fs-archive-probe');
|
|
20
|
+
|
|
21
|
+
function reset(files: Record<string, string>): void {
|
|
22
|
+
fs.rmSync(DIR, { recursive: true, force: true });
|
|
23
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
24
|
+
const target = path.join(DIR, rel);
|
|
25
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
26
|
+
fs.writeFileSync(target, content);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
fs.rmSync(DIR, { recursive: true, force: true });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
async function post(fields: Record<string, string>) {
|
|
35
|
+
const form = new FormData();
|
|
36
|
+
form.append('root', process.cwd());
|
|
37
|
+
for (const [key, value] of Object.entries(fields)) form.append(key, value);
|
|
38
|
+
const res = await action({ request: new Request('http://localhost/api/fs/action', { method: 'POST', body: form }) } as never);
|
|
39
|
+
return { status: res.status, body: (await res.json()) as Record<string, unknown> };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const hasZip = Bun.which('zip') !== null && Bun.which('unzip') !== null;
|
|
43
|
+
|
|
44
|
+
describe('fs batch delete', () => {
|
|
45
|
+
test('removes every path in one request', async () => {
|
|
46
|
+
reset({ 'a.ts': 'A', 'src/b.ts': 'B', 'keep.ts': 'K' });
|
|
47
|
+
|
|
48
|
+
const { status, body } = await post({
|
|
49
|
+
actionType: 'delete',
|
|
50
|
+
paths: JSON.stringify(['tmp-fs-archive-probe/a.ts', 'tmp-fs-archive-probe/src']),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
expect(status).toBe(200);
|
|
54
|
+
expect(body.removed).toEqual(['tmp-fs-archive-probe/a.ts', 'tmp-fs-archive-probe/src']);
|
|
55
|
+
expect(fs.existsSync(path.join(DIR, 'a.ts'))).toBe(false);
|
|
56
|
+
expect(fs.existsSync(path.join(DIR, 'src'))).toBe(false);
|
|
57
|
+
expect(fs.existsSync(path.join(DIR, 'keep.ts'))).toBe(true);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('refuses a path outside the scoped root', async () => {
|
|
61
|
+
reset({ 'a.ts': 'A' });
|
|
62
|
+
const { status } = await post({ actionType: 'delete', paths: JSON.stringify(['../outside.ts']) });
|
|
63
|
+
expect(status).toBe(403);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('fs archive actions', () => {
|
|
68
|
+
test.skipIf(!hasZip)('compress then extract round-trips the selection', async () => {
|
|
69
|
+
reset({ 'a.ts': 'A', 'deep/b.ts': 'B' });
|
|
70
|
+
|
|
71
|
+
const compressed = await post({
|
|
72
|
+
actionType: 'compress',
|
|
73
|
+
format: 'zip',
|
|
74
|
+
name: 'bundle.zip',
|
|
75
|
+
destination: 'tmp-fs-archive-probe',
|
|
76
|
+
paths: JSON.stringify(['tmp-fs-archive-probe/a.ts', 'tmp-fs-archive-probe/deep']),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
expect(compressed.status).toBe(200);
|
|
80
|
+
expect(compressed.body.path).toBe('tmp-fs-archive-probe/bundle.zip');
|
|
81
|
+
expect(fs.existsSync(path.join(DIR, 'bundle.zip'))).toBe(true);
|
|
82
|
+
|
|
83
|
+
const extracted = await post({
|
|
84
|
+
actionType: 'extract',
|
|
85
|
+
path: 'tmp-fs-archive-probe/bundle.zip',
|
|
86
|
+
destination: 'tmp-fs-archive-probe/out',
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
expect(extracted.status).toBe(200);
|
|
90
|
+
expect(fs.readFileSync(path.join(DIR, 'out/a.ts'), 'utf8')).toBe('A');
|
|
91
|
+
expect(fs.readFileSync(path.join(DIR, 'out/deep/b.ts'), 'utf8')).toBe('B');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('refuses an archive name carrying a path separator', async () => {
|
|
95
|
+
reset({ 'a.ts': 'A' });
|
|
96
|
+
const { status } = await post({
|
|
97
|
+
actionType: 'compress',
|
|
98
|
+
format: 'zip',
|
|
99
|
+
name: '../escape.zip',
|
|
100
|
+
destination: 'tmp-fs-archive-probe',
|
|
101
|
+
paths: JSON.stringify(['tmp-fs-archive-probe/a.ts']),
|
|
102
|
+
});
|
|
103
|
+
expect(status).toBe(400);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('refuses to extract a file that is not an archive', async () => {
|
|
107
|
+
reset({ 'notes.txt': 'hello' });
|
|
108
|
+
const { status, body } = await post({
|
|
109
|
+
actionType: 'extract',
|
|
110
|
+
path: 'tmp-fs-archive-probe/notes.txt',
|
|
111
|
+
destination: 'tmp-fs-archive-probe/out',
|
|
112
|
+
});
|
|
113
|
+
expect(status).toBe(400);
|
|
114
|
+
expect(String(body.error)).toContain('recognised archive');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('refuses a destination outside the scoped root', async () => {
|
|
118
|
+
reset({ 'a.ts': 'A' });
|
|
119
|
+
const { status } = await post({
|
|
120
|
+
actionType: 'compress',
|
|
121
|
+
format: 'zip',
|
|
122
|
+
name: 'bundle.zip',
|
|
123
|
+
destination: '../outside',
|
|
124
|
+
paths: JSON.stringify(['tmp-fs-archive-probe/a.ts']),
|
|
125
|
+
});
|
|
126
|
+
expect(status).toBe(403);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Files panel's BULK actions: a multi-selection delete, and the two archive
|
|
8
|
+
* verbs. Split from `action.ts` because that dispatcher is at the repository's
|
|
9
|
+
* line ceiling, and because all three take path LISTS rather than the single
|
|
10
|
+
* `path` the row actions are built around.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import { json } from '@/server/lib/remix-compat';
|
|
15
|
+
import { resolveWithinRoot } from '@/server/lib/fs/root';
|
|
16
|
+
import { toRelPath } from '@/server/lib/fs/transfer';
|
|
17
|
+
import { isSinglePathSegment } from '@/server/lib/fs/path-segment';
|
|
18
|
+
import { compressEntries, extractArchive } from '@/server/lib/fs/archive';
|
|
19
|
+
import { COMPRESS_FORMATS } from '@/shared/lib/fs/archive';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Files panel's multi-select delete: one request, one resolved path per
|
|
23
|
+
* entry. `paths` is JSON because a form field cannot repeat into an array with
|
|
24
|
+
* a shape the route can trust; the single-row Delete keeps its own branch.
|
|
25
|
+
*/
|
|
26
|
+
export async function runBatchDeleteAction(options: { formData: FormData; scopedRoot: string }) {
|
|
27
|
+
const { formData, scopedRoot } = options;
|
|
28
|
+
let paths: unknown;
|
|
29
|
+
try {
|
|
30
|
+
paths = JSON.parse((formData.get('paths') as string) ?? '[]');
|
|
31
|
+
} catch {
|
|
32
|
+
return json({ error: 'Invalid delete list' }, { status: 400 });
|
|
33
|
+
}
|
|
34
|
+
if (!Array.isArray(paths) || paths.length === 0 || paths.some((entry) => typeof entry !== 'string')) {
|
|
35
|
+
return json({ error: 'Invalid delete list' }, { status: 400 });
|
|
36
|
+
}
|
|
37
|
+
// Resolve EVERY path before removing any: one invalid entry must refuse the
|
|
38
|
+
// batch, not delete the entries that came before it.
|
|
39
|
+
const targets: { rel: string; full: string }[] = [];
|
|
40
|
+
for (const rel of paths as string[]) {
|
|
41
|
+
const target = resolveWithinRoot(scopedRoot, rel);
|
|
42
|
+
if (!target) return json({ error: 'Invalid path' }, { status: 403 });
|
|
43
|
+
targets.push({ rel, full: target });
|
|
44
|
+
}
|
|
45
|
+
const removed: string[] = [];
|
|
46
|
+
for (const target of targets) {
|
|
47
|
+
await fs.promises.rm(target.full, { recursive: true, force: true });
|
|
48
|
+
removed.push(target.rel);
|
|
49
|
+
}
|
|
50
|
+
return json({ success: true, removed });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* `extract` and `compress`: the two archive verbs, one branch because they
|
|
55
|
+
* share every piece of path validation.
|
|
56
|
+
*
|
|
57
|
+
* `compress` takes the whole selection as JSON `paths` plus the target file
|
|
58
|
+
* name and the folder it lands in — the folder IS the working directory, which
|
|
59
|
+
* is what keeps every stored name a plain relative one. `extract` takes one
|
|
60
|
+
* archive and the folder to unpack into (`mkdir -p` is the tool's job).
|
|
61
|
+
*/
|
|
62
|
+
export async function runArchiveAction(options: { actionType: string; formData: FormData; scopedRoot: string }) {
|
|
63
|
+
const { actionType, formData, scopedRoot } = options;
|
|
64
|
+
if (actionType === 'extract') {
|
|
65
|
+
const archiveRel = ((formData.get('path') as string) ?? '').trim();
|
|
66
|
+
const archivePath = resolveWithinRoot(scopedRoot, archiveRel);
|
|
67
|
+
if (!archivePath) return json({ error: 'Invalid path' }, { status: 403 });
|
|
68
|
+
const destinationRel = ((formData.get('destination') as string) ?? '').trim() || '.';
|
|
69
|
+
const destinationDir = resolveWithinRoot(scopedRoot, destinationRel);
|
|
70
|
+
if (!destinationDir) return json({ error: 'Invalid destination' }, { status: 403 });
|
|
71
|
+
const outcome = await extractArchive({ archivePath, destinationDir });
|
|
72
|
+
if (!outcome.ok) return json({ error: outcome.error }, { status: outcome.status });
|
|
73
|
+
return json({ success: true, path: toRelPath(scopedRoot, destinationDir) });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const formatRaw = (formData.get('format') as string) ?? 'zip';
|
|
77
|
+
const format = COMPRESS_FORMATS.find((entry) => entry.id === formatRaw)?.id;
|
|
78
|
+
if (!format) return json({ error: 'Unknown archive format' }, { status: 400 });
|
|
79
|
+
const name = ((formData.get('name') as string) ?? '').trim();
|
|
80
|
+
if (!isSinglePathSegment(name)) {
|
|
81
|
+
return json({ error: 'Enter an archive name without a path separator' }, { status: 400 });
|
|
82
|
+
}
|
|
83
|
+
const destinationRel = ((formData.get('destination') as string) ?? '').trim() || '.';
|
|
84
|
+
const destinationDir = resolveWithinRoot(scopedRoot, destinationRel);
|
|
85
|
+
if (!destinationDir) return json({ error: 'Invalid destination' }, { status: 403 });
|
|
86
|
+
|
|
87
|
+
let paths: unknown;
|
|
88
|
+
try {
|
|
89
|
+
paths = JSON.parse((formData.get('paths') as string) ?? '[]');
|
|
90
|
+
} catch {
|
|
91
|
+
return json({ error: 'Invalid selection' }, { status: 400 });
|
|
92
|
+
}
|
|
93
|
+
if (!Array.isArray(paths) || paths.length === 0 || paths.some((entry) => typeof entry !== 'string')) {
|
|
94
|
+
return json({ error: 'Select something to compress' }, { status: 400 });
|
|
95
|
+
}
|
|
96
|
+
const sources: string[] = [];
|
|
97
|
+
for (const rel of paths as string[]) {
|
|
98
|
+
const full = resolveWithinRoot(scopedRoot, rel);
|
|
99
|
+
if (!full) return json({ error: 'Invalid path' }, { status: 403 });
|
|
100
|
+
sources.push(full);
|
|
101
|
+
}
|
|
102
|
+
const outcome = await compressEntries({ destinationDir, name, format, sources });
|
|
103
|
+
if (!outcome.ok) return json({ error: outcome.error }, { status: outcome.status });
|
|
104
|
+
return json({ success: true, path: toRelPath(scopedRoot, outcome.path) });
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The binary save branch: a workbook the grid edited.
|
|
8
|
+
*
|
|
9
|
+
* The bytes must land VERBATIM — a ZIP container cannot survive the text
|
|
10
|
+
* field's UTF-8 and line-ending normalization, which is why this branch exists
|
|
11
|
+
* at all — and the conflict guard must apply to it exactly as it does to a text
|
|
12
|
+
* save.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import { action } from '@/server/routes/fs/action';
|
|
19
|
+
|
|
20
|
+
const PROBE = path.join(process.cwd(), 'tmp-bytes-probe.xlsx');
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
fs.rmSync(PROBE, { force: true });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
async function saveBytes(bytes: Uint8Array, baseMtime?: number) {
|
|
27
|
+
const form = new FormData();
|
|
28
|
+
form.append('actionType', 'saveBytes');
|
|
29
|
+
form.append('root', process.cwd());
|
|
30
|
+
form.append('path', 'tmp-bytes-probe.xlsx');
|
|
31
|
+
form.append('bytes', new Blob([bytes]));
|
|
32
|
+
if (baseMtime !== undefined) form.append('baseMtime', String(baseMtime));
|
|
33
|
+
return action({ request: new Request('http://localhost/api/fs/action', { method: 'POST', body: form }) } as never);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe('fs saveBytes', () => {
|
|
37
|
+
test('writes the bytes verbatim', async () => {
|
|
38
|
+
const bytes = new Uint8Array([0x50, 0x4b, 0x03, 0x04, 0x00, 0xff, 0x0a, 0x0d]);
|
|
39
|
+
const res = await saveBytes(bytes);
|
|
40
|
+
expect(res.status).toBe(200);
|
|
41
|
+
expect([...new Uint8Array(await Bun.file(PROBE).arrayBuffer())]).toEqual([...bytes]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('a stale base mtime is a conflict, not a write', async () => {
|
|
45
|
+
fs.writeFileSync(PROBE, 'disk');
|
|
46
|
+
const res = await saveBytes(new Uint8Array([1, 2, 3]), 1);
|
|
47
|
+
expect(res.status).toBe(409);
|
|
48
|
+
expect(await Bun.file(PROBE).text()).toBe('disk');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('a request with no bytes is refused', async () => {
|
|
52
|
+
const form = new FormData();
|
|
53
|
+
form.append('actionType', 'saveBytes');
|
|
54
|
+
form.append('root', process.cwd());
|
|
55
|
+
form.append('path', 'tmp-bytes-probe.xlsx');
|
|
56
|
+
const res = await action({ request: new Request('http://localhost/api/fs/action', { method: 'POST', body: form }) } as never);
|
|
57
|
+
expect(res.status).toBe(400);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -113,6 +113,32 @@ describe('fs paste', () => {
|
|
|
113
113
|
expect(fs.readFileSync(path.join(DIR, 'a.ts'), 'utf8')).toBe('A');
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
+
test('a multi-entry cut moves every source in one request', async () => {
|
|
117
|
+
reset({
|
|
118
|
+
'tmp-fs-transfer-probe/a.ts': 'A',
|
|
119
|
+
'tmp-fs-transfer-probe/b.ts': 'B',
|
|
120
|
+
'tmp-fs-transfer-probe/dest/.keep': '',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const form = new FormData();
|
|
124
|
+
for (const [key, value] of Object.entries({
|
|
125
|
+
root: process.cwd(),
|
|
126
|
+
actionType: 'paste',
|
|
127
|
+
mode: 'cut',
|
|
128
|
+
targetPath: 'tmp-fs-transfer-probe/dest',
|
|
129
|
+
targetKind: 'folder',
|
|
130
|
+
})) form.append(key, value);
|
|
131
|
+
form.append('sourcePath', 'tmp-fs-transfer-probe/a.ts');
|
|
132
|
+
form.append('sourcePath', 'tmp-fs-transfer-probe/b.ts');
|
|
133
|
+
const res = await action({ request: new Request('http://localhost/api/fs/action', { method: 'POST', body: form }) } as never);
|
|
134
|
+
const body = (await res.json()) as { success?: boolean; paths?: string[]; failures?: unknown[] };
|
|
135
|
+
|
|
136
|
+
expect(res.status).toBe(200);
|
|
137
|
+
expect(body.paths?.sort()).toEqual(['tmp-fs-transfer-probe/dest/a.ts', 'tmp-fs-transfer-probe/dest/b.ts']);
|
|
138
|
+
expect(fs.existsSync(path.join(DIR, 'a.ts'))).toBe(false);
|
|
139
|
+
expect(fs.readFileSync(path.join(DIR, 'dest/b.ts'), 'utf8')).toBe('B');
|
|
140
|
+
});
|
|
141
|
+
|
|
116
142
|
test('refuses a folder pasted into its own subtree', async () => {
|
|
117
143
|
reset({ 'tmp-fs-transfer-probe/src/a.ts': 'A', 'tmp-fs-transfer-probe/src/deep/.keep': '' });
|
|
118
144
|
|
|
@@ -7,11 +7,14 @@ import { getDefaultFsRoot, isWithinRoot, resolveRoot, resolveWithinRoot } from '
|
|
|
7
7
|
import { runShell } from '@/server/lib/fs/shell';
|
|
8
8
|
import { revealInFileManager } from '@/server/lib/fs/reveal';
|
|
9
9
|
import { duplicateEntry, nextDuplicateName, pasteEntry, toRelPath } from '@/server/lib/fs/transfer';
|
|
10
|
+
import { runArchiveAction, runBatchDeleteAction } from '@/server/routes/fs/action-bulk';
|
|
10
11
|
import { normalizeRelativePath } from '@/server/lib/fs/relative-path';
|
|
11
12
|
import { isSinglePathSegment } from '@/server/lib/fs/path-segment';
|
|
12
13
|
import { checkWriteConflict, parseBaseMtime, stableMtime } from '@/server/lib/fs/write-conflict';
|
|
13
14
|
import { transferRefusal } from '@/shared/lib/fs/clipboard';
|
|
14
15
|
import { toDiskText } from '@/shared/lib/code/line-endings';
|
|
16
|
+
import { contentHash } from '@/shared/lib/fs/content-hash';
|
|
17
|
+
import { DOCUMENT_MAX_FILE_BYTES } from '@/shared/lib/fs/file-kind';
|
|
15
18
|
|
|
16
19
|
/** The two shapes a transfer action answers with, ready for `json`. */
|
|
17
20
|
function transferResponse(outcome: { path?: string; error?: string; status?: number }) {
|
|
@@ -50,22 +53,54 @@ async function runDuplicateAction(options: { filePath: string; scopedRoot: strin
|
|
|
50
53
|
async function runPasteAction(options: { formData: FormData; scopedRoot: string }) {
|
|
51
54
|
const { formData, scopedRoot } = options;
|
|
52
55
|
const mode = formData.get('mode') === 'cut' ? 'cut' : 'copy';
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!sourceStat) return json({ error: 'The entry on the clipboard no longer exists' }, { status: 404 });
|
|
56
|
+
// Repeated fields carry a whole selection; a single `sourcePath` from an older
|
|
57
|
+
// client is the same list of one.
|
|
58
|
+
const sourceRels = formData.getAll('sourcePath').map((value) => String(value).trim()).filter(Boolean);
|
|
59
|
+
if (sourceRels.length === 0) return json({ error: 'Nothing to paste' }, { status: 400 });
|
|
58
60
|
const rawTarget = ((formData.get('targetPath') as string) ?? '').trim() || '.';
|
|
59
61
|
const rawTargetKind = formData.get('targetKind') === 'folder' ? 'folder' : 'file';
|
|
60
62
|
const targetDir = rawTargetKind === 'folder' ? rawTarget : path.dirname(rawTarget);
|
|
61
|
-
const refusal = transferRefusal(
|
|
62
|
-
{ path: sourceRel, kind: sourceStat.isDirectory() ? 'folder' : 'file' },
|
|
63
|
-
targetDir,
|
|
64
|
-
);
|
|
65
|
-
if (refusal) return json({ error: refusal }, { status: 409 });
|
|
66
63
|
const fullDir = resolveWithinRoot(scopedRoot, targetDir);
|
|
67
64
|
if (!fullDir) return json({ error: 'Invalid path' }, { status: 403 });
|
|
68
|
-
|
|
65
|
+
|
|
66
|
+
// VALIDATE the whole batch before moving anything: a refusal on the third
|
|
67
|
+
// entry must leave the first two where they were, or the answer says "no"
|
|
68
|
+
// while the tree has already changed.
|
|
69
|
+
const sources: { rel: string; full: string }[] = [];
|
|
70
|
+
const failures: { path: string; error: string }[] = [];
|
|
71
|
+
for (const sourceRel of sourceRels) {
|
|
72
|
+
const sourcePath = resolveWithinRoot(scopedRoot, sourceRel);
|
|
73
|
+
if (!sourcePath) return json({ error: 'Invalid path' }, { status: 403 });
|
|
74
|
+
const sourceStat = await Bun.file(sourcePath).stat().catch(() => null);
|
|
75
|
+
if (!sourceStat) {
|
|
76
|
+
failures.push({ path: sourceRel, error: 'The entry on the clipboard no longer exists' });
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const refusal = transferRefusal(
|
|
80
|
+
{ path: sourceRel, kind: sourceStat.isDirectory() ? 'folder' : 'file' },
|
|
81
|
+
targetDir,
|
|
82
|
+
);
|
|
83
|
+
if (refusal) return json({ error: refusal }, { status: 409 });
|
|
84
|
+
sources.push({ rel: sourceRel, full: sourcePath });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const paths: string[] = [];
|
|
88
|
+
for (const source of sources) {
|
|
89
|
+
const outcome = await pasteEntry({ scopedRoot, sourcePath: source.full, destinationDir: fullDir, mode });
|
|
90
|
+
if (outcome.error) failures.push({ path: source.rel, error: outcome.error });
|
|
91
|
+
else if (outcome.path) paths.push(outcome.path);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (paths.length === 0 && failures.length > 0) {
|
|
95
|
+
// The single-entry answer keeps the status it always had, so a stale tab
|
|
96
|
+
// still reads "that entry is gone" rather than a generic 400.
|
|
97
|
+
const missing = failures.every((failure) => failure.error.includes('no longer exists'));
|
|
98
|
+
return json({ error: failures[0]!.error }, { status: missing ? 404 : 400 });
|
|
99
|
+
}
|
|
100
|
+
// One source answers the shape the panel has always read; a batch names the
|
|
101
|
+
// whole list so the reload after it can reveal what moved.
|
|
102
|
+
if (sourceRels.length === 1) return json({ success: true, path: paths[0] });
|
|
103
|
+
return json(failures.length > 0 ? { success: true, paths, failures } : { success: true, paths });
|
|
69
104
|
}
|
|
70
105
|
|
|
71
106
|
export async function action({ request }: ActionFunctionArgs) {
|
|
@@ -88,6 +123,16 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
88
123
|
return await runPasteAction({ formData, scopedRoot });
|
|
89
124
|
}
|
|
90
125
|
|
|
126
|
+
// The archive verbs name their own paths (`path`/`paths`), so they are
|
|
127
|
+
// dispatched BEFORE the single-`path` resolution: a compress request has no
|
|
128
|
+
// `path` field at all, and resolving `undefined` is a crash, not a refusal.
|
|
129
|
+
if (actionType === 'extract' || actionType === 'compress') {
|
|
130
|
+
return await runArchiveAction({ actionType, formData, scopedRoot });
|
|
131
|
+
}
|
|
132
|
+
if (actionType === 'delete' && typeof formData.get('paths') === 'string') {
|
|
133
|
+
return await runBatchDeleteAction({ formData, scopedRoot });
|
|
134
|
+
}
|
|
135
|
+
|
|
91
136
|
const fullPath = resolveWithinRoot(scopedRoot, filePath);
|
|
92
137
|
|
|
93
138
|
if (!fullPath) {
|
|
@@ -128,7 +173,50 @@ export async function action({ request }: ActionFunctionArgs) {
|
|
|
128
173
|
await fs.promises.mkdir(path.dirname(fullPath), { recursive: true });
|
|
129
174
|
await Bun.write(fullPath, content);
|
|
130
175
|
const written = await Bun.file(fullPath).stat().catch(() => null);
|
|
131
|
-
|
|
176
|
+
// The hash of the bytes just written travels back so the buffer adopts it as
|
|
177
|
+
// its own fingerprint. Without it the auto-refresh watcher would read the
|
|
178
|
+
// save as an EXTERNAL change and re-read the file the user just wrote.
|
|
179
|
+
return json({
|
|
180
|
+
success: true,
|
|
181
|
+
mtimeMs: written ? stableMtime(written.mtimeMs) : null,
|
|
182
|
+
hash: await contentHash(content),
|
|
183
|
+
});
|
|
184
|
+
} else if (actionType === 'saveBytes') {
|
|
185
|
+
// A workbook the grid edited: the bytes are the file, so they travel as a
|
|
186
|
+
// Blob rather than as a text field. `content` cannot carry them — a
|
|
187
|
+
// multipart text field is UTF-8 and normalizes line endings, which would
|
|
188
|
+
// corrupt a ZIP container.
|
|
189
|
+
const blob = formData.get('bytes');
|
|
190
|
+
if (!(blob instanceof Blob)) {
|
|
191
|
+
return json({ error: 'No file bytes' }, { status: 400 });
|
|
192
|
+
}
|
|
193
|
+
if (blob.size > DOCUMENT_MAX_FILE_BYTES) {
|
|
194
|
+
return json({ error: 'The edited file is larger than the editor writes.' }, { status: 413 });
|
|
195
|
+
}
|
|
196
|
+
const verdict = await checkWriteConflict(
|
|
197
|
+
fullPath,
|
|
198
|
+
parseBaseMtime(formData.get('baseMtime')),
|
|
199
|
+
async (target) => {
|
|
200
|
+
const stat = await Bun.file(target).stat().catch(() => null);
|
|
201
|
+
return stat && !stat.isDirectory() ? { mtimeMs: stat.mtimeMs } : null;
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
if (!verdict.write) {
|
|
205
|
+
return json(
|
|
206
|
+
{
|
|
207
|
+
error: 'This file changed on disk since it was opened.',
|
|
208
|
+
conflict: true,
|
|
209
|
+
mtimeMs: verdict.diskMtimeMs,
|
|
210
|
+
},
|
|
211
|
+
{ status: 409 },
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
await fs.promises.mkdir(path.dirname(fullPath), { recursive: true });
|
|
215
|
+
await Bun.write(fullPath, blob);
|
|
216
|
+
const written = await Bun.file(fullPath).stat().catch(() => null);
|
|
217
|
+
// No content hash: the digest route hashes TEXT, and a workbook is not
|
|
218
|
+
// text. The mtime is what the next save's conflict base needs.
|
|
219
|
+
return json({ success: true, mtimeMs: written ? stableMtime(written.mtimeMs) : null, hash: null });
|
|
132
220
|
} else if (actionType === 'saveAs') {
|
|
133
221
|
// Write the buffer to a NEW path. The destination is `path` (a directory) plus
|
|
134
222
|
// `name` (ONE segment), both resolved against this route's own scope — a
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `GET /api/fs/archive` — which compress formats this machine can write.
|
|
8
|
+
*
|
|
9
|
+
* The dialog cannot guess: `rar` is almost never installed and `7z` is not on
|
|
10
|
+
* a stock macOS. Offering a format the server then refuses with ENOENT is a
|
|
11
|
+
* dead row; asking here means the dialog lists exactly the tools the machine
|
|
12
|
+
* has, and the user learns the reason before typing a name.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { json } from '@/server/lib/remix-compat';
|
|
16
|
+
import { compressFormats } from '@/server/lib/fs/archive';
|
|
17
|
+
|
|
18
|
+
export async function loader() {
|
|
19
|
+
return json({ formats: compressFormats() });
|
|
20
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The editor's disk-digest probe.
|
|
8
|
+
*
|
|
9
|
+
* The rules that matter are the ones an mtime cannot express: a file rewritten
|
|
10
|
+
* with the SAME bytes answers the same hash (so a `touch` or a no-op formatter
|
|
11
|
+
* never replaces a buffer), a file whose bytes changed answers a different one,
|
|
12
|
+
* and a path outside the root allow-list is refused rather than answered.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import { fileDigest } from '@/server/routes/fs/digest';
|
|
19
|
+
import { contentHash } from '@/shared/lib/fs/content-hash';
|
|
20
|
+
|
|
21
|
+
const PROBE = path.join(process.cwd(), 'tmp-digest-probe.txt');
|
|
22
|
+
const NESTED = path.join(process.cwd(), 'tmp-digest-repo');
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
fs.rmSync(PROBE, { recursive: true, force: true });
|
|
26
|
+
fs.rmSync(NESTED, { recursive: true, force: true });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
async function digest(filePath: string, root: string = process.cwd(), repo?: string) {
|
|
30
|
+
const url = new URL('http://localhost/api/fs/digest');
|
|
31
|
+
url.searchParams.set('path', filePath);
|
|
32
|
+
url.searchParams.set('root', root);
|
|
33
|
+
if (repo) url.searchParams.set('repo', repo);
|
|
34
|
+
const res = await fileDigest({ request: new Request(url) } as never);
|
|
35
|
+
return {
|
|
36
|
+
status: res.status,
|
|
37
|
+
body: (await res.json()) as { exists?: boolean; mtimeMs?: number | null; hash?: string | null; error?: string },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
describe('fs digest', () => {
|
|
42
|
+
test('a file answers the hash of its content', async () => {
|
|
43
|
+
fs.writeFileSync(PROBE, 'const a = 1;\n');
|
|
44
|
+
const { status, body } = await digest('tmp-digest-probe.txt');
|
|
45
|
+
|
|
46
|
+
expect(status).toBe(200);
|
|
47
|
+
expect(body.exists).toBe(true);
|
|
48
|
+
expect(body.hash).toBe(await contentHash('const a = 1;\n'));
|
|
49
|
+
expect(typeof body.mtimeMs).toBe('number');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('a file rewritten with the SAME bytes keeps its hash, however far the mtime moved', async () => {
|
|
53
|
+
fs.writeFileSync(PROBE, 'same bytes\n');
|
|
54
|
+
const first = await digest('tmp-digest-probe.txt');
|
|
55
|
+
|
|
56
|
+
// A `touch`, a formatter that changed nothing, a checkout of the revision
|
|
57
|
+
// already open: the clock moves, the bytes do not.
|
|
58
|
+
const later = new Date(Date.now() + 5_000);
|
|
59
|
+
fs.utimesSync(PROBE, later, later);
|
|
60
|
+
const second = await digest('tmp-digest-probe.txt');
|
|
61
|
+
|
|
62
|
+
expect(second.body.hash).toBe(first.body.hash);
|
|
63
|
+
expect(second.body.mtimeMs).not.toBe(first.body.mtimeMs);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('changed bytes answer a different hash', async () => {
|
|
67
|
+
fs.writeFileSync(PROBE, 'one\n');
|
|
68
|
+
const first = await digest('tmp-digest-probe.txt');
|
|
69
|
+
fs.writeFileSync(PROBE, 'two, and longer\n');
|
|
70
|
+
const second = await digest('tmp-digest-probe.txt');
|
|
71
|
+
|
|
72
|
+
expect(second.body.hash).not.toBe(first.body.hash);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('a missing file is not a digest', async () => {
|
|
76
|
+
const { status, body } = await digest('tmp-digest-probe.txt');
|
|
77
|
+
expect(status).toBe(200);
|
|
78
|
+
expect(body.exists).toBe(false);
|
|
79
|
+
expect(body.hash).toBeNull();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('a directory standing in the file’s place is not the file', async () => {
|
|
83
|
+
fs.mkdirSync(PROBE, { recursive: true });
|
|
84
|
+
const { body } = await digest('tmp-digest-probe.txt');
|
|
85
|
+
expect(body.exists).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('a path outside the root allow-list is refused', async () => {
|
|
89
|
+
const { status, body } = await digest('../../etc/passwd');
|
|
90
|
+
expect(status).toBe(403);
|
|
91
|
+
expect(body.error).toBe('Invalid path');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('the scope travels with the probe, so a nested repo is read from its own tree', async () => {
|
|
95
|
+
fs.mkdirSync(NESTED, { recursive: true });
|
|
96
|
+
fs.writeFileSync(path.join(NESTED, 'a.txt'), 'nested\n');
|
|
97
|
+
const { body } = await digest('a.txt', process.cwd(), 'tmp-digest-repo');
|
|
98
|
+
expect(body.hash).toBe(await contentHash('nested\n'));
|
|
99
|
+
});
|
|
100
|
+
});
|