@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,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ArrowUp recall in the composer: the cursor, the scope, the draft restore, and
|
|
8
|
+
* the keys it must leave to the caret.
|
|
9
|
+
*
|
|
10
|
+
* The hook is mounted against a REAL textarea, because half of its contract is
|
|
11
|
+
* about where the caret sits (a multi-line draft keeps its arrows) and the
|
|
12
|
+
* other half about what lands in the box.
|
|
13
|
+
*
|
|
14
|
+
* No wall clock: the fetch is a stub this file answers, and
|
|
15
|
+
* `requestAnimationFrame` is installed synchronously, so "settled" is a
|
|
16
|
+
* microtask, never a duration.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
20
|
+
import { Window } from 'happy-dom';
|
|
21
|
+
import { h, render } from 'preact';
|
|
22
|
+
import { act } from 'preact/test-utils';
|
|
23
|
+
import { useState } from 'preact/hooks';
|
|
24
|
+
import { useComposerHistory, type ComposerHistory } from '@/client/hooks/chat/composer/history';
|
|
25
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
26
|
+
|
|
27
|
+
const nativeFetch = globalThis.fetch;
|
|
28
|
+
const nativeFrame = globalThis.requestAnimationFrame;
|
|
29
|
+
const nativeKeyboardEvent = globalThis.KeyboardEvent;
|
|
30
|
+
|
|
31
|
+
let container: HTMLElement | undefined;
|
|
32
|
+
let holder: {
|
|
33
|
+
api: ComposerHistory | null;
|
|
34
|
+
value: string;
|
|
35
|
+
setValue: (value: string) => void;
|
|
36
|
+
sessionId: string | null;
|
|
37
|
+
rerender: () => void;
|
|
38
|
+
};
|
|
39
|
+
let textareaRef: { current: HTMLTextAreaElement | null };
|
|
40
|
+
let requested: string[] = [];
|
|
41
|
+
let prompts: string[] = [];
|
|
42
|
+
|
|
43
|
+
beforeAll(() => {
|
|
44
|
+
const win = new Window({ url: 'http://localhost' });
|
|
45
|
+
installDomGlobals(win);
|
|
46
|
+
// `DOM_TEST_GLOBALS` does not carry `KeyboardEvent`; this suite builds real
|
|
47
|
+
// key events, so it installs the window's own class and puts it back.
|
|
48
|
+
(globalThis as unknown as Record<string, unknown>).KeyboardEvent = win.KeyboardEvent;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
requested = [];
|
|
53
|
+
prompts = ['newest prompt', 'older prompt'];
|
|
54
|
+
// Synchronous frames: the hook only uses one to place the caret after the
|
|
55
|
+
// value has landed, which is the render this file already drives.
|
|
56
|
+
globalThis.requestAnimationFrame = ((callback: FrameRequestCallback) => {
|
|
57
|
+
callback(0);
|
|
58
|
+
return 0;
|
|
59
|
+
}) as typeof globalThis.requestAnimationFrame;
|
|
60
|
+
globalThis.fetch = ((input: string | URL | Request) => {
|
|
61
|
+
requested.push(String(input));
|
|
62
|
+
return Promise.resolve(new Response(JSON.stringify({ prompts })));
|
|
63
|
+
}) as unknown as typeof fetch;
|
|
64
|
+
textareaRef = { current: null };
|
|
65
|
+
holder = {
|
|
66
|
+
api: null,
|
|
67
|
+
value: '',
|
|
68
|
+
setValue: () => {},
|
|
69
|
+
sessionId: 'session-1',
|
|
70
|
+
rerender: () => {},
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
if (container) render(null, container);
|
|
76
|
+
container?.remove();
|
|
77
|
+
container = undefined;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
afterAll(() => {
|
|
81
|
+
globalThis.fetch = nativeFetch;
|
|
82
|
+
globalThis.requestAnimationFrame = nativeFrame;
|
|
83
|
+
if (nativeKeyboardEvent === undefined) {
|
|
84
|
+
delete (globalThis as unknown as Record<string, unknown>).KeyboardEvent;
|
|
85
|
+
} else {
|
|
86
|
+
globalThis.KeyboardEvent = nativeKeyboardEvent;
|
|
87
|
+
}
|
|
88
|
+
restoreDomGlobals();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
function mount(sessionId: string | null): void {
|
|
92
|
+
holder.sessionId = sessionId;
|
|
93
|
+
function Probe() {
|
|
94
|
+
const [value, setValue] = useState('');
|
|
95
|
+
const [, bump] = useState(0);
|
|
96
|
+
holder.value = value;
|
|
97
|
+
holder.setValue = setValue;
|
|
98
|
+
holder.rerender = () => bump((turn) => turn + 1);
|
|
99
|
+
holder.api = useComposerHistory({
|
|
100
|
+
value,
|
|
101
|
+
onChange: (next) => {
|
|
102
|
+
setValue(next);
|
|
103
|
+
if (textareaRef.current) textareaRef.current.value = next;
|
|
104
|
+
},
|
|
105
|
+
sessionId: holder.sessionId,
|
|
106
|
+
textareaRef,
|
|
107
|
+
});
|
|
108
|
+
return h('textarea', {
|
|
109
|
+
ref: (node: HTMLTextAreaElement | null) => {
|
|
110
|
+
textareaRef.current = node;
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
container = document.body.appendChild(document.createElement('div'));
|
|
115
|
+
act(() => {
|
|
116
|
+
render(h(Probe, null), container!);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Let the hook's fetch → then chain run out. Microtasks only, no duration. */
|
|
121
|
+
async function settle(): Promise<void> {
|
|
122
|
+
for (let turn = 0; turn < 4; turn++) await Promise.resolve();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Type a draft and put the caret where the next arrow will read it. */
|
|
126
|
+
function writeDraft(value: string, caret = value.length): void {
|
|
127
|
+
act(() => holder.setValue(value));
|
|
128
|
+
if (!textareaRef.current) return;
|
|
129
|
+
textareaRef.current.value = value;
|
|
130
|
+
textareaRef.current.setSelectionRange(caret, caret);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function press(key: string, init: KeyboardEventInit = {}): boolean {
|
|
134
|
+
const event = new KeyboardEvent('keydown', { key, cancelable: true, ...init });
|
|
135
|
+
let consumed = false;
|
|
136
|
+
act(() => {
|
|
137
|
+
consumed = holder.api!.handleKey(event as never);
|
|
138
|
+
});
|
|
139
|
+
return consumed;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
describe('useComposerHistory', () => {
|
|
143
|
+
test('ArrowUp recalls the newest prompt, then the older one', async () => {
|
|
144
|
+
mount('session-1');
|
|
145
|
+
expect(press('ArrowUp')).toBe(true);
|
|
146
|
+
await settle();
|
|
147
|
+
expect(holder.value).toBe('newest prompt');
|
|
148
|
+
expect(press('ArrowUp')).toBe(true);
|
|
149
|
+
expect(holder.value).toBe('older prompt');
|
|
150
|
+
// The list is exhausted: the key is still ours, and nothing changes.
|
|
151
|
+
expect(press('ArrowUp')).toBe(true);
|
|
152
|
+
expect(holder.value).toBe('older prompt');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('ArrowDown walks back to the draft the list was entered from', async () => {
|
|
156
|
+
mount('session-1');
|
|
157
|
+
writeDraft('work in progress');
|
|
158
|
+
|
|
159
|
+
press('ArrowUp');
|
|
160
|
+
await settle();
|
|
161
|
+
expect(holder.value).toBe('newest prompt');
|
|
162
|
+
press('ArrowUp');
|
|
163
|
+
expect(holder.value).toBe('older prompt');
|
|
164
|
+
press('ArrowDown');
|
|
165
|
+
expect(holder.value).toBe('newest prompt');
|
|
166
|
+
press('ArrowDown');
|
|
167
|
+
expect(holder.value).toBe('work in progress');
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test('ArrowDown from the draft is left to the caret', () => {
|
|
171
|
+
mount('session-1');
|
|
172
|
+
expect(press('ArrowDown')).toBe(false);
|
|
173
|
+
expect(requested).toHaveLength(0);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('a pending new chat asks for the merged list', async () => {
|
|
177
|
+
mount('new-1790756769131');
|
|
178
|
+
press('ArrowUp');
|
|
179
|
+
await settle();
|
|
180
|
+
expect(requested).toEqual(['/api/chat/prompt-history']);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test('an open chat scopes the list to its own id', async () => {
|
|
184
|
+
mount('01a1b49f-0000-7000-8000-000000000001');
|
|
185
|
+
press('ArrowUp');
|
|
186
|
+
await settle();
|
|
187
|
+
expect(requested).toEqual(['/api/chat/prompt-history?sessionId=01a1b49f-0000-7000-8000-000000000001']);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test('a modified arrow is never consumed', () => {
|
|
191
|
+
mount('session-1');
|
|
192
|
+
expect(press('ArrowUp', { shiftKey: true })).toBe(false);
|
|
193
|
+
expect(press('ArrowUp', { metaKey: true })).toBe(false);
|
|
194
|
+
expect(press('ArrowUp', { ctrlKey: true })).toBe(false);
|
|
195
|
+
expect(press('ArrowUp', { altKey: true })).toBe(false);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test('ArrowUp below the first line moves the caret instead', () => {
|
|
199
|
+
mount('session-1');
|
|
200
|
+
writeDraft('first line\nsecond line');
|
|
201
|
+
expect(press('ArrowUp')).toBe(false);
|
|
202
|
+
expect(requested).toHaveLength(0);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test('ArrowUp on the first line of a multi-line draft recalls', async () => {
|
|
206
|
+
mount('session-1');
|
|
207
|
+
writeDraft('first line\nsecond line', 3);
|
|
208
|
+
expect(press('ArrowUp')).toBe(true);
|
|
209
|
+
await settle();
|
|
210
|
+
expect(holder.value).toBe('newest prompt');
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('ArrowDown above the last line moves the caret instead', async () => {
|
|
214
|
+
mount('session-1');
|
|
215
|
+
press('ArrowUp');
|
|
216
|
+
await settle();
|
|
217
|
+
writeDraft('line one\nline two', 2);
|
|
218
|
+
expect(press('ArrowDown')).toBe(false);
|
|
219
|
+
expect(holder.value).toBe('line one\nline two');
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test('a failed fetch recalls nothing and the next ArrowUp asks again', async () => {
|
|
223
|
+
globalThis.fetch = ((input: string | URL | Request) => {
|
|
224
|
+
requested.push(String(input));
|
|
225
|
+
return Promise.resolve(new Response('{}', { status: 500 }));
|
|
226
|
+
}) as unknown as typeof fetch;
|
|
227
|
+
mount('session-1');
|
|
228
|
+
expect(press('ArrowUp')).toBe(true);
|
|
229
|
+
await settle();
|
|
230
|
+
expect(holder.value).toBe('');
|
|
231
|
+
expect(press('ArrowUp')).toBe(true);
|
|
232
|
+
await settle();
|
|
233
|
+
expect(requested).toHaveLength(2);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test('a session switch forgets the list', async () => {
|
|
237
|
+
mount('session-1');
|
|
238
|
+
press('ArrowUp');
|
|
239
|
+
await settle();
|
|
240
|
+
expect(holder.value).toBe('newest prompt');
|
|
241
|
+
|
|
242
|
+
prompts = ['other chat prompt'];
|
|
243
|
+
act(() => {
|
|
244
|
+
holder.sessionId = 'session-2';
|
|
245
|
+
holder.rerender();
|
|
246
|
+
});
|
|
247
|
+
expect(press('ArrowUp')).toBe(true);
|
|
248
|
+
await settle();
|
|
249
|
+
expect(holder.value).toBe('other chat prompt');
|
|
250
|
+
expect(requested.at(-1)).toBe('/api/chat/prompt-history?sessionId=session-2');
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test('an emptied draft starts the next recall at the newest entry', async () => {
|
|
254
|
+
mount('session-1');
|
|
255
|
+
press('ArrowUp');
|
|
256
|
+
await settle();
|
|
257
|
+
press('ArrowUp');
|
|
258
|
+
expect(holder.value).toBe('older prompt');
|
|
259
|
+
|
|
260
|
+
// Sending clears the composer; the next recall is a fresh walk.
|
|
261
|
+
writeDraft('');
|
|
262
|
+
prompts = ['just sent', 'newest prompt', 'older prompt'];
|
|
263
|
+
press('ArrowUp');
|
|
264
|
+
await settle();
|
|
265
|
+
expect(holder.value).toBe('just sent');
|
|
266
|
+
});
|
|
267
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ArrowUp / ArrowDown prompt recall for the chat composer.
|
|
8
|
+
*
|
|
9
|
+
* The list is fetched, never derived from the mounted transcript: the timeline
|
|
10
|
+
* only mounts a window of a long chat (`useChatTimeline` pages the newest
|
|
11
|
+
* rows), so a recall built from `messages` would forget everything the user
|
|
12
|
+
* paged past. The server owns the list and scopes it — one chat's own prompts
|
|
13
|
+
* on an open session, every session's prompts merged on a pending `new-…`
|
|
14
|
+
* chat — so this hook only holds the cursor.
|
|
15
|
+
*
|
|
16
|
+
* One GET per entry into the list (each `ArrowUp` from the draft), so a chat
|
|
17
|
+
* that just sent a prompt recalls it without polling: the fetch is what makes
|
|
18
|
+
* the newest entry the newest. Everything after that is in memory, and the
|
|
19
|
+
* fetch is lazy — a composer nobody presses ArrowUp in costs nothing.
|
|
20
|
+
*
|
|
21
|
+
* The rules, each of which has a failing case in the unit test:
|
|
22
|
+
* - `-1` is the draft the user was typing. ArrowUp from there ENTERS the list;
|
|
23
|
+
* ArrowDown from there is a plain caret move and is left alone.
|
|
24
|
+
* - Neither end wraps: past the newest entry, and back down past the oldest to
|
|
25
|
+
* the draft, nothing happens.
|
|
26
|
+
* - Arrow moves only at the list's edges of the TEXT: ArrowUp on the second
|
|
27
|
+
* line of a multi-line draft must move the caret, not recall.
|
|
28
|
+
* - A modified arrow (Shift/Ctrl/Cmd/Alt) is never consumed — Shift+ArrowUp is
|
|
29
|
+
* a selection.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { useCallback, useEffect, useRef } from 'preact/hooks';
|
|
33
|
+
import type { KeyboardEvent, RefObject } from 'preact/compat';
|
|
34
|
+
import {
|
|
35
|
+
canRecallDown,
|
|
36
|
+
canRecallUp,
|
|
37
|
+
stepHistoryCursor,
|
|
38
|
+
type HistoryDirection,
|
|
39
|
+
} from '@/shared/lib/chat/composer/history';
|
|
40
|
+
|
|
41
|
+
export interface ComposerHistoryOptions {
|
|
42
|
+
value: string;
|
|
43
|
+
onChange: (value: string) => void;
|
|
44
|
+
/** The open chat. A pending `new-…` id (or `null`) asks for the merged list. */
|
|
45
|
+
sessionId: string | null;
|
|
46
|
+
textareaRef: RefObject<HTMLTextAreaElement | null>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ComposerHistory {
|
|
50
|
+
/** Consume the key when it recalled something; false leaves the caret alone. */
|
|
51
|
+
handleKey: (event: KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function fetchPromptHistory(sessionId: string | null): Promise<string[]> {
|
|
55
|
+
const scope = sessionId && !sessionId.startsWith('new-') ? sessionId : null;
|
|
56
|
+
const query = scope ? `?sessionId=${encodeURIComponent(scope)}` : '';
|
|
57
|
+
const response = await fetch(`/api/chat/prompt-history${query}`);
|
|
58
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
59
|
+
const body = (await response.json()) as { prompts?: unknown };
|
|
60
|
+
return Array.isArray(body.prompts) ? body.prompts.filter((text): text is string => typeof text === 'string') : [];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function useComposerHistory({ value, onChange, sessionId, textareaRef }: ComposerHistoryOptions): ComposerHistory {
|
|
64
|
+
/** Newest first, as the route answers it. */
|
|
65
|
+
const entriesRef = useRef<string[]>([]);
|
|
66
|
+
const cursorRef = useRef(-1);
|
|
67
|
+
/** The draft the list was entered from, restored on the way back down. */
|
|
68
|
+
const draftRef = useRef('');
|
|
69
|
+
|
|
70
|
+
// A list belongs to ONE session: carrying it across a switch would offer the
|
|
71
|
+
// prompts of the chat the user just left.
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
entriesRef.current = [];
|
|
74
|
+
cursorRef.current = -1;
|
|
75
|
+
draftRef.current = '';
|
|
76
|
+
}, [sessionId]);
|
|
77
|
+
|
|
78
|
+
// An emptied draft is a SENT prompt (or a cleared one): the next ArrowUp must
|
|
79
|
+
// start from the newest entry again, not continue from where the last recall
|
|
80
|
+
// left off.
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (value === '') cursorRef.current = -1;
|
|
83
|
+
}, [value]);
|
|
84
|
+
|
|
85
|
+
const apply = useCallback((text: string) => {
|
|
86
|
+
onChange(text);
|
|
87
|
+
// The value lands on the next render; the caret must follow the text that
|
|
88
|
+
// arrived, not the one the textarea still holds in this tick.
|
|
89
|
+
requestAnimationFrame(() => {
|
|
90
|
+
const element = textareaRef.current;
|
|
91
|
+
if (!element) return;
|
|
92
|
+
element.setSelectionRange(text.length, text.length);
|
|
93
|
+
});
|
|
94
|
+
}, [onChange, textareaRef]);
|
|
95
|
+
|
|
96
|
+
const step = useCallback((direction: HistoryDirection): boolean => {
|
|
97
|
+
const next = stepHistoryCursor(entriesRef.current.length, cursorRef.current, direction);
|
|
98
|
+
if (next === null) return false;
|
|
99
|
+
cursorRef.current = next;
|
|
100
|
+
apply(next === -1 ? draftRef.current : entriesRef.current[next]);
|
|
101
|
+
return true;
|
|
102
|
+
}, [apply]);
|
|
103
|
+
|
|
104
|
+
const handleKey = useCallback((event: KeyboardEvent<HTMLTextAreaElement>): boolean => {
|
|
105
|
+
const key = event.key;
|
|
106
|
+
if (key !== 'ArrowUp' && key !== 'ArrowDown') return false;
|
|
107
|
+
if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) return false;
|
|
108
|
+
// An IME composition owns the arrows: picking a candidate is not a recall.
|
|
109
|
+
if (event.isComposing) return false;
|
|
110
|
+
|
|
111
|
+
const element = textareaRef.current;
|
|
112
|
+
if (!element) return false;
|
|
113
|
+
const caret = element.selectionStart ?? value.length;
|
|
114
|
+
const direction: HistoryDirection = key === 'ArrowUp' ? 'up' : 'down';
|
|
115
|
+
|
|
116
|
+
if (cursorRef.current !== -1) {
|
|
117
|
+
// Inside the list. Down is only recall while the caret is on the last
|
|
118
|
+
// line; up never leaves the list early (both ends refuse, no wrap).
|
|
119
|
+
if (direction === 'down' && !canRecallDown(value, caret)) return false;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
step(direction);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// In the draft. Down is an ordinary caret move; up has to start on the
|
|
126
|
+
// first line, and only then is the list fetched.
|
|
127
|
+
if (direction === 'down' || !canRecallUp(value, caret)) return false;
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
draftRef.current = value;
|
|
130
|
+
void fetchPromptHistory(sessionId)
|
|
131
|
+
.then((entries) => {
|
|
132
|
+
entriesRef.current = entries;
|
|
133
|
+
// The cursor may have been reset by a session switch while this was in
|
|
134
|
+
// flight; the effect cleared the draft, so start from the top again.
|
|
135
|
+
cursorRef.current = -1;
|
|
136
|
+
draftRef.current = value;
|
|
137
|
+
step('up');
|
|
138
|
+
})
|
|
139
|
+
// Nothing was substituted: the caret simply did not move, and the next
|
|
140
|
+
// ArrowUp asks again.
|
|
141
|
+
.catch(() => {});
|
|
142
|
+
return true;
|
|
143
|
+
}, [sessionId, step, textareaRef, value]);
|
|
144
|
+
|
|
145
|
+
return { handleKey };
|
|
146
|
+
}
|
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
* with no chat named, it is kept for this page session only.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { useState } from 'preact/hooks';
|
|
26
|
+
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
27
27
|
import { useSearchParams } from '@/client/lib/router/search-params';
|
|
28
28
|
import { useSessionState } from '@/client/hooks/workspace/session-state';
|
|
29
|
+
import { useSessionStateContext } from '@/client/hooks/workspace/session-state/context';
|
|
30
|
+
import { subscribeSessionKey } from '@/shared/lib/workspace/session-state/listeners';
|
|
31
|
+
import { getSessionValue } from '@/shared/lib/workspace/session-state/store';
|
|
29
32
|
import { useBrowserPageContextInsert } from '@/client/hooks/chat/composer/browser-context';
|
|
30
33
|
import { useReviewIncludeInsert } from '@/client/hooks/chat/composer/review-context';
|
|
31
34
|
import { CHAT_DRAFT_ATTACHMENTS_KEY, CHAT_DRAFT_KEY } from '@/shared/lib/chat/composer/draft';
|
|
@@ -50,6 +53,47 @@ export function useComposerDraft(): ComposerDraftState {
|
|
|
50
53
|
const [storedAttachments, setStoredAttachments] = useSessionState<Attachment[]>(CHAT_DRAFT_ATTACHMENTS_KEY, []);
|
|
51
54
|
const [landingText, setLandingText] = useState('');
|
|
52
55
|
const [landingAttachments, setLandingAttachments] = useState<Attachment[]>([]);
|
|
56
|
+
const { sessionId } = useSessionStateContext();
|
|
57
|
+
|
|
58
|
+
// The draft is normally private to this composer, but a CANCELLED held prompt
|
|
59
|
+
// is written back into this very slot by another module (the sidebar's cancel,
|
|
60
|
+
// the waiting dispatcher's failure path). Without this follow, the text lands
|
|
61
|
+
// in the store and the mounted box — the one the user is looking at — keeps
|
|
62
|
+
// rendering its empty copy.
|
|
63
|
+
//
|
|
64
|
+
// `applied` is not bookkeeping: `setStoredText` writes the store, which
|
|
65
|
+
// notifies this very listener. Comparing against the last value applied (and
|
|
66
|
+
// recording it BEFORE the setters run) is what makes the write converge
|
|
67
|
+
// instead of recursing.
|
|
68
|
+
const appliedRef = useRef({ text: storedText, attachments: storedAttachments });
|
|
69
|
+
appliedRef.current = { text: storedText, attachments: storedAttachments };
|
|
70
|
+
// Set while this listener is writing the value it just read: the setters
|
|
71
|
+
// persist, which notifies this same listener. Re-entering there is how the
|
|
72
|
+
// first version recursed until the stack ran out.
|
|
73
|
+
const applyingRef = useRef(false);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!scoped) return;
|
|
76
|
+
const follow = () => {
|
|
77
|
+
if (applyingRef.current) return;
|
|
78
|
+
const text = getSessionValue<string>(sessionId, CHAT_DRAFT_KEY) ?? '';
|
|
79
|
+
const attachments = getSessionValue<Attachment[]>(sessionId, CHAT_DRAFT_ATTACHMENTS_KEY) ?? [];
|
|
80
|
+
if (text === appliedRef.current.text && attachments === appliedRef.current.attachments) return;
|
|
81
|
+
appliedRef.current = { text, attachments };
|
|
82
|
+
applyingRef.current = true;
|
|
83
|
+
setStoredText(text);
|
|
84
|
+
setStoredAttachments(attachments);
|
|
85
|
+
applyingRef.current = false;
|
|
86
|
+
};
|
|
87
|
+
const offText = subscribeSessionKey(sessionId, CHAT_DRAFT_KEY, follow);
|
|
88
|
+
const offAttachments = subscribeSessionKey(sessionId, CHAT_DRAFT_ATTACHMENTS_KEY, follow);
|
|
89
|
+
return () => {
|
|
90
|
+
offText();
|
|
91
|
+
offAttachments();
|
|
92
|
+
};
|
|
93
|
+
// The two setters are state setters from `useSessionState`; re-subscribing
|
|
94
|
+
// on their identity would tear down the listeners on every render.
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
}, [sessionId, scoped]);
|
|
53
97
|
|
|
54
98
|
const inputValue = scoped ? storedText : landingText;
|
|
55
99
|
const setInputValue = scoped ? setStoredText : setLandingText;
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
} from '@/client/hooks/chat/omp/pending-sessions';
|
|
25
25
|
import {
|
|
26
26
|
clearPendingSessionWaiting,
|
|
27
|
+
markPendingSessionDraft,
|
|
27
28
|
markPendingSessionWaiting,
|
|
28
29
|
pendingSessionWait,
|
|
29
|
-
releasePendingSessionByWait,
|
|
30
30
|
} from '@/client/hooks/chat/omp/pending-waiting';
|
|
31
31
|
|
|
32
32
|
afterEach(() => {
|
|
@@ -66,16 +66,17 @@ describe('pending session waiting state', () => {
|
|
|
66
66
|
expect(listPendingSessions().map((entry) => entry.id)).toContain(id);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
// Cancelling keeps the chat: the prompt's text is written back into that
|
|
70
|
+
// chat's composer, so the row the user returns to must still exist — and it
|
|
71
|
+
// must survive the settle pass that a SENT prompt would expire, because it is
|
|
72
|
+
// an unsent draft again.
|
|
73
|
+
test('a cancelled wait becomes an unsent draft that keeps its row', () => {
|
|
74
|
+
const id = startPendingSession(1);
|
|
75
|
+
markPendingSessionWaiting(id, { waitId: 'wait-1', dependsOn: 'sess-a', dependsOnTitle: 'A' });
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
expect(
|
|
78
|
-
expect(ids).toContain(second);
|
|
77
|
+
markPendingSessionDraft(id);
|
|
78
|
+
expect(pendingSessionWait(id)).toBeNull();
|
|
79
|
+
expect(listPendingSessions().find((entry) => entry.id === id)?.sentAt).toBeNull();
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
// The wait ends where the spawn answers: the new row is a real session from
|
|
@@ -35,14 +35,22 @@ export function clearPendingSessionWaiting(id: string): void {
|
|
|
35
35
|
patchPendingEntry(id, (entry) => (entry.waiting ? { ...entry, waiting: undefined } : entry));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* The wait was cancelled (or failed) and its text is back in the composer.
|
|
40
|
+
*
|
|
41
|
+
* `sentAt` is cleared with the cue: the entry is an UNSENT draft again, so the
|
|
42
|
+
* reconcile pass keeps it while that draft exists instead of expiring it on the
|
|
43
|
+
* sent-prompt settle window and taking the restored text's row away.
|
|
44
|
+
*/
|
|
45
|
+
export function markPendingSessionDraft(id: string): void {
|
|
46
|
+
patchPendingEntry(id, (entry) => (
|
|
47
|
+
entry.waiting || entry.sentAt !== null
|
|
48
|
+
? { ...entry, waiting: undefined, sentAt: null }
|
|
49
|
+
: entry
|
|
50
|
+
));
|
|
51
|
+
}
|
|
52
|
+
|
|
38
53
|
/** The waiting half of one entry, or null when the row is not waiting. */
|
|
39
54
|
export function pendingSessionWait(id: string): PendingWait | null {
|
|
40
55
|
return listPendingSessions().find((entry) => entry.id === id)?.waiting ?? null;
|
|
41
56
|
}
|
|
42
|
-
|
|
43
|
-
/** Drop the entry whose prompt was held by `waitId` (the wait was cancelled). */
|
|
44
|
-
export function releasePendingSessionByWait(waitId: string): void {
|
|
45
|
-
for (const entry of listPendingSessions()) {
|
|
46
|
-
if (entry.waiting?.waitId === waitId) patchPendingEntry(entry.id, () => null);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -271,6 +271,17 @@ describe('useOmpPromptSender.sendNewPrompt', () => {
|
|
|
271
271
|
expect(probe.connected).toEqual(['omp-9']);
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
+
test('sends the ACP mode pick on the spawn body', async () => {
|
|
275
|
+
// The composer's pending chat has no session to command, so a mode picked on
|
|
276
|
+
// it can only travel here; dropping it started the chat in the agent's
|
|
277
|
+
// default mode while the chip named the operator's pick.
|
|
278
|
+
const requests = installFetch({ [NEW]: { body: { success: true, sessionId: 'acp-1', harness: 'claude' } } });
|
|
279
|
+
const probe = mountSender(null);
|
|
280
|
+
await probe.sender().sendNewPrompt('first', '/w', undefined, { harness: 'claude', sessionMode: 'architect' });
|
|
281
|
+
|
|
282
|
+
expect(requests[0].body).toMatchObject({ harness: 'claude', sessionMode: 'architect' });
|
|
283
|
+
});
|
|
284
|
+
|
|
274
285
|
test('omits every unset pick so a bare spawn behaves as before', async () => {
|
|
275
286
|
const requests = installFetch({ [NEW]: { body: { success: true, sessionId: 'omp-1' } } });
|
|
276
287
|
const probe = mountSender(null);
|
|
@@ -141,6 +141,9 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
141
141
|
// Plan/goal picks from the pending view. Omitted when the user made
|
|
142
142
|
// none, so a spawn with no selection behaves exactly as before.
|
|
143
143
|
...(composerOptions?.modes ? { modes: composerOptions.modes } : {}),
|
|
144
|
+
// The ACP ladder pick from the same view — the agent's own vocabulary,
|
|
145
|
+
// applied by the route as a config write after `session/new`.
|
|
146
|
+
...(composerOptions?.sessionMode ? { sessionMode: composerOptions.sessionMode } : {}),
|
|
144
147
|
...(composerOptions?.harness ? { harness: composerOptions.harness } : {}),
|
|
145
148
|
}),
|
|
146
149
|
});
|
|
@@ -185,10 +185,10 @@ export function useChatTimelineActions(deps: ChatTimelineActionsDeps): ChatTimel
|
|
|
185
185
|
// keep the draft so the user can edit or retype it.
|
|
186
186
|
if (blockTuiOnlySend(textToSend, setLocalMessages, harness)) return;
|
|
187
187
|
|
|
188
|
-
// A
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
if (await holdFromComposer(deps, textToSend, attachments
|
|
188
|
+
// A prompt held for another session: nothing is sent now, and the chat's
|
|
189
|
+
// pending/held row stays on screen saying what it waits for. Checked before
|
|
190
|
+
// the queue-vs-send split, so a busy chat still defers instead of queueing.
|
|
191
|
+
if (await holdFromComposer(deps, textToSend, attachments)) return;
|
|
192
192
|
|
|
193
193
|
// "A run is in flight" is the CHAT-level flag, not this client's own:
|
|
194
194
|
// `isGenerating` only knows the run THIS page started, so a second tab, a
|
|
@@ -181,4 +181,58 @@ describe('splitAskFrames', () => {
|
|
|
181
181
|
expect(split.framesByTool.size).toBe(0);
|
|
182
182
|
expect(split.modalRequest).toBe(gate);
|
|
183
183
|
});
|
|
184
|
+
|
|
185
|
+
test('a select whose title matches no question is claimed by its option rows', () => {
|
|
186
|
+
// The parser-drift safety net: the two derivations of a form's question text
|
|
187
|
+
// can disagree on a shape neither was written for, and the title is the only
|
|
188
|
+
// key that drifts. The offered rows are the same list either way.
|
|
189
|
+
const frame: ExtensionUiDialogRequest = {
|
|
190
|
+
type: 'extension_ui_request',
|
|
191
|
+
id: 'f1',
|
|
192
|
+
method: 'select',
|
|
193
|
+
title: 'Which language? And more',
|
|
194
|
+
options: ['A', 'B', 'Other (type your own)'],
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const split = splitAskFrames(askHistory(['Which language?']), [frame], true);
|
|
198
|
+
|
|
199
|
+
expect(split.framesByTool.get('call_ask')?.[0]?.map((held) => held.id)).toEqual(['f1']);
|
|
200
|
+
expect(split.modalRequest).toBeNull();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test('an approval gate is never claimed by an ask, even when its rows match', () => {
|
|
204
|
+
// The gate check runs before the row match: a gate whose choices happen to
|
|
205
|
+
// equal a question's options must still reach the modal, or "Approve" would
|
|
206
|
+
// be posted as that question's answer.
|
|
207
|
+
const [history] = askHistory(['Which language?']);
|
|
208
|
+
history.toolCalls![0].input = {
|
|
209
|
+
questions: [{ question: 'Which language?', options: [{ label: 'Approve' }, { label: 'Deny' }] }],
|
|
210
|
+
};
|
|
211
|
+
const gate: ExtensionUiDialogRequest = {
|
|
212
|
+
type: 'extension_ui_request',
|
|
213
|
+
id: 'g1',
|
|
214
|
+
method: 'select',
|
|
215
|
+
title: 'Allow tool: read\nReason: Restricted folder: /tmp/secret',
|
|
216
|
+
options: ['Approve', 'Deny'],
|
|
217
|
+
};
|
|
218
|
+
const split = splitAskFrames([history], [gate], true);
|
|
219
|
+
|
|
220
|
+
expect(split.framesByTool.size).toBe(0);
|
|
221
|
+
expect(split.modalRequest).toBe(gate);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test('a picker with unrelated rows keeps the modal', () => {
|
|
225
|
+
const picker: ExtensionUiDialogRequest = {
|
|
226
|
+
type: 'extension_ui_request',
|
|
227
|
+
id: 'p1',
|
|
228
|
+
method: 'select',
|
|
229
|
+
title: 'Choose a branch',
|
|
230
|
+
options: ['main', 'release/1.0'],
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const split = splitAskFrames(askHistory(['Which language?']), [picker], true);
|
|
234
|
+
|
|
235
|
+
expect(split.framesByTool.size).toBe(0);
|
|
236
|
+
expect(split.modalRequest).toBe(picker);
|
|
237
|
+
});
|
|
184
238
|
});
|