@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
|
@@ -90,8 +90,6 @@ export function PanelPluginsSection() {
|
|
|
90
90
|
const actions = usePanelPluginActions();
|
|
91
91
|
const dock = useLeftDock();
|
|
92
92
|
|
|
93
|
-
const refresh = () => void refreshPanelRegistry();
|
|
94
|
-
|
|
95
93
|
const available = catalog.filter((entry) => !entry.installed);
|
|
96
94
|
const failureMap = new Map(failures.map((failure) => [failure.pluginId, failure.reason]));
|
|
97
95
|
// An installed plugin's icon and README, for the card. Both come from the
|
|
@@ -123,7 +121,7 @@ export function PanelPluginsSection() {
|
|
|
123
121
|
onSetAutoUpdate={actions.setAutoUpdate}
|
|
124
122
|
onCheckUpdates={actions.checkUpdates}
|
|
125
123
|
onUpdateAll={actions.updateAll}
|
|
126
|
-
onRefresh={
|
|
124
|
+
onRefresh={refreshPanelRegistry}
|
|
127
125
|
/>
|
|
128
126
|
|
|
129
127
|
{actions.error ? (
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The schema-driven settings form.
|
|
8
|
+
*
|
|
9
|
+
* The load-bearing cases are the two a visual check cannot see: a secret is
|
|
10
|
+
* never prefilled and is left OUT of the request when untouched (sending the
|
|
11
|
+
* mask back would overwrite the credential), and a number field is sent as a
|
|
12
|
+
* number rather than the string the input holds.
|
|
13
|
+
*
|
|
14
|
+
* Rendered with `h()` against happy-dom, following the panel suites.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
18
|
+
import { Window } from 'happy-dom';
|
|
19
|
+
import { h, render } from 'preact';
|
|
20
|
+
import { act } from 'preact/test-utils';
|
|
21
|
+
import { PluginSettingsModal } from '@/client/components/settings/categories/panel-plugins/SettingsModal';
|
|
22
|
+
import { PLUGIN_SECRET_MASK } from '@/shared/lib/plugins/settings';
|
|
23
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
24
|
+
|
|
25
|
+
let container: HTMLElement;
|
|
26
|
+
const nativeFetch = globalThis.fetch;
|
|
27
|
+
|
|
28
|
+
const DEFINITIONS = {
|
|
29
|
+
note: { type: 'string', label: 'Note prefix', description: 'Prepended to every note.' },
|
|
30
|
+
retries: { type: 'number', label: 'Retries' },
|
|
31
|
+
verbose: { type: 'boolean', label: 'Verbose' },
|
|
32
|
+
token: { type: 'string', label: 'API token', secret: true },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const VALUES = { note: 'hello', retries: 3, verbose: false, token: PLUGIN_SECRET_MASK };
|
|
36
|
+
|
|
37
|
+
interface Sent {
|
|
38
|
+
url: string;
|
|
39
|
+
method: string;
|
|
40
|
+
body: unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let sent: Sent[] = [];
|
|
44
|
+
|
|
45
|
+
/** The one shape the component sends. */
|
|
46
|
+
function isValuesBody(body: unknown): body is { values: Record<string, unknown> } {
|
|
47
|
+
if (typeof body !== 'object' || body === null || !('values' in body)) return false;
|
|
48
|
+
const values = body.values;
|
|
49
|
+
return typeof values === 'object' && values !== null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
beforeAll(() => {
|
|
53
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
afterEach(() => {
|
|
57
|
+
if (container) render(null, container);
|
|
58
|
+
globalThis.fetch = nativeFetch;
|
|
59
|
+
sent = [];
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
afterAll(() => {
|
|
63
|
+
restoreDomGlobals();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
function stubFetch() {
|
|
67
|
+
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
68
|
+
const url = String(input);
|
|
69
|
+
const method = init?.method ?? 'GET';
|
|
70
|
+
const body = init?.body ? JSON.parse(String(init.body)) : undefined;
|
|
71
|
+
sent.push({ url, method, body });
|
|
72
|
+
const values = method === 'PUT' && isValuesBody(body) ? { ...VALUES, ...body.values } : VALUES;
|
|
73
|
+
return new Response(JSON.stringify({ pluginId: 'demo', definitions: DEFINITIONS, values }), {
|
|
74
|
+
status: 200,
|
|
75
|
+
headers: { 'content-type': 'application/json' },
|
|
76
|
+
});
|
|
77
|
+
}) as typeof fetch;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function mount(): Promise<HTMLElement> {
|
|
81
|
+
stubFetch();
|
|
82
|
+
container = document.createElement('div');
|
|
83
|
+
document.body.append(container);
|
|
84
|
+
await act(async () => {
|
|
85
|
+
render(h(PluginSettingsModal, { pluginId: 'demo', name: 'Demo', onClose: () => {} }), container);
|
|
86
|
+
});
|
|
87
|
+
await flush();
|
|
88
|
+
return container;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Let the fetch promise chain settle; each `await` in the component is a tick. */
|
|
92
|
+
async function flush(): Promise<void> {
|
|
93
|
+
for (let tick = 0; tick < 6; tick += 1) {
|
|
94
|
+
await act(async () => {
|
|
95
|
+
await Promise.resolve();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function input(el: HTMLElement, label: string): HTMLInputElement {
|
|
101
|
+
const field = el.querySelector<HTMLInputElement>(`#plugin-setting-${label}`);
|
|
102
|
+
if (!field) throw new Error(`no input for ${label}`);
|
|
103
|
+
return field;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
describe('PluginSettingsModal', () => {
|
|
107
|
+
test('renders one control per definition, from the schema', async () => {
|
|
108
|
+
const el = await mount();
|
|
109
|
+
expect(el.textContent).toContain('Note prefix');
|
|
110
|
+
expect(el.textContent).toContain('Prepended to every note.');
|
|
111
|
+
expect(input(el, 'note').value).toBe('hello');
|
|
112
|
+
expect(input(el, 'retries').value).toBe('3');
|
|
113
|
+
expect(input(el, 'verbose').checked).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('a stored secret starts empty and says it is stored', async () => {
|
|
117
|
+
const el = await mount();
|
|
118
|
+
const token = input(el, 'token');
|
|
119
|
+
expect(token.type).toBe('password');
|
|
120
|
+
expect(token.value).toBe('');
|
|
121
|
+
expect(token.getAttribute('placeholder')).toContain('stored');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('saves typed values, sends numbers as numbers, and omits an untouched secret', async () => {
|
|
125
|
+
const el = await mount();
|
|
126
|
+
|
|
127
|
+
const note = input(el, 'note');
|
|
128
|
+
await act(async () => {
|
|
129
|
+
note.value = 'changed';
|
|
130
|
+
note.dispatchEvent(new Event('input', { bubbles: true }));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const save = Array.from(el.querySelectorAll('button')).find((button) => button.textContent?.trim() === 'Save');
|
|
134
|
+
if (!save) throw new Error('no Save button');
|
|
135
|
+
await act(async () => {
|
|
136
|
+
save.click();
|
|
137
|
+
});
|
|
138
|
+
await flush();
|
|
139
|
+
|
|
140
|
+
const put = sent.find((request) => request.method === 'PUT');
|
|
141
|
+
expect(put?.url).toBe('/api/panels/settings/demo');
|
|
142
|
+
expect(put?.body).toEqual({ values: { note: 'changed', retries: 3, verbose: false } });
|
|
143
|
+
expect(el.textContent).toContain('Saved');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('a typed secret replaces the stored one', async () => {
|
|
147
|
+
const el = await mount();
|
|
148
|
+
|
|
149
|
+
const token = input(el, 'token');
|
|
150
|
+
await act(async () => {
|
|
151
|
+
token.value = 'new-token';
|
|
152
|
+
token.dispatchEvent(new Event('input', { bubbles: true }));
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const save = Array.from(el.querySelectorAll('button')).find((button) => button.textContent?.trim() === 'Save');
|
|
156
|
+
if (!save) throw new Error('no Save button');
|
|
157
|
+
await act(async () => {
|
|
158
|
+
save.click();
|
|
159
|
+
});
|
|
160
|
+
await flush();
|
|
161
|
+
|
|
162
|
+
const put = sent.find((request) => request.method === 'PUT');
|
|
163
|
+
expect(put && isValuesBody(put.body) ? put.body.values.token : undefined).toBe('new-token');
|
|
164
|
+
});
|
|
165
|
+
});
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A panel plugin's settings form, rendered from its declared schema.
|
|
8
|
+
*
|
|
9
|
+
* The schema is the plugin's `settings-schema.json`, read by the server, so the
|
|
10
|
+
* form exists without the plugin running — a switched-off plugin can still be
|
|
11
|
+
* configured. Three field types are rendered (`string`, `number`, `boolean`);
|
|
12
|
+
* the schema validator refuses anything else before it reaches this file, which
|
|
13
|
+
* is why there is no fallback branch that would draw a control the server cannot
|
|
14
|
+
* validate.
|
|
15
|
+
*
|
|
16
|
+
* A secret is treated as WRITE-ONLY. The server never sends the stored value, so
|
|
17
|
+
* the box starts empty with a "stored" placeholder: an untouched field is left
|
|
18
|
+
* out of the request, and only text the user actually typed replaces it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { useEffect, useState } from 'preact/hooks';
|
|
22
|
+
import { AlertTriangle, Loader2, SlidersHorizontal } from 'lucide-preact';
|
|
23
|
+
import { Modal } from '@/client/components/common/Modal';
|
|
24
|
+
import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
|
|
25
|
+
import { PLUGIN_SECRET_MASK } from '@/shared/lib/plugins/settings';
|
|
26
|
+
import type { PluginSettingDefinition } from '@kabmo-labs/kabmo-sdk';
|
|
27
|
+
|
|
28
|
+
type SettingValue = string | number | boolean;
|
|
29
|
+
type Draft = Record<string, string | boolean>;
|
|
30
|
+
|
|
31
|
+
interface SettingsPayload {
|
|
32
|
+
pluginId: string;
|
|
33
|
+
definitions: Record<string, PluginSettingDefinition>;
|
|
34
|
+
values: Record<string, SettingValue>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface PluginSettingsModalProps {
|
|
38
|
+
pluginId: string;
|
|
39
|
+
/** The plugin's display name, for the dialog header. */
|
|
40
|
+
name: string;
|
|
41
|
+
onClose: () => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function PluginSettingsModal({ pluginId, name, onClose }: PluginSettingsModalProps) {
|
|
45
|
+
const [payload, setPayload] = useState<SettingsPayload | null>(null);
|
|
46
|
+
const [draft, setDraft] = useState<Draft>({});
|
|
47
|
+
const [error, setError] = useState<string | null>(null);
|
|
48
|
+
const [saving, setSaving] = useState(false);
|
|
49
|
+
const [saved, setSaved] = useState(false);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
let cancelled = false;
|
|
53
|
+
fetch(`/api/panels/settings/${encodeURIComponent(pluginId)}`, { credentials: 'same-origin' })
|
|
54
|
+
.then(async (response) => {
|
|
55
|
+
if (!response.ok) throw new Error(await errorOf(response));
|
|
56
|
+
return (await response.json()) as SettingsPayload;
|
|
57
|
+
})
|
|
58
|
+
.then(
|
|
59
|
+
(next) => {
|
|
60
|
+
if (cancelled) return;
|
|
61
|
+
setPayload(next);
|
|
62
|
+
setDraft(initialDraft(next.definitions, next.values));
|
|
63
|
+
},
|
|
64
|
+
(cause: unknown) => {
|
|
65
|
+
if (!cancelled) setError(cause instanceof Error ? cause.message : String(cause));
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
return () => {
|
|
69
|
+
cancelled = true;
|
|
70
|
+
};
|
|
71
|
+
}, [pluginId]);
|
|
72
|
+
|
|
73
|
+
const definitions = payload ? Object.entries(payload.definitions) : [];
|
|
74
|
+
|
|
75
|
+
function change(key: string, value: string | boolean) {
|
|
76
|
+
setDraft((current) => ({ ...current, [key]: value }));
|
|
77
|
+
setSaved(false);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function submit(event: Event) {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
if (!payload) return;
|
|
83
|
+
setError(null);
|
|
84
|
+
setSaved(false);
|
|
85
|
+
|
|
86
|
+
const values: Record<string, unknown> = {};
|
|
87
|
+
for (const [key, definition] of Object.entries(payload.definitions)) {
|
|
88
|
+
const current = draft[key];
|
|
89
|
+
if (definition.type === 'boolean') {
|
|
90
|
+
values[key] = current === true;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const text = String(current ?? '');
|
|
94
|
+
// An untouched secret is not sent: the field means "keep the stored
|
|
95
|
+
// value", and the server never gave us the value to repeat.
|
|
96
|
+
if (definition.secret && !text) continue;
|
|
97
|
+
if (definition.type === 'number') {
|
|
98
|
+
const parsed = Number(text.trim());
|
|
99
|
+
if (text.trim() === '' || !Number.isFinite(parsed)) {
|
|
100
|
+
setError(`${definition.label} needs a number.`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
values[key] = parsed;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
values[key] = text;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
setSaving(true);
|
|
110
|
+
try {
|
|
111
|
+
const response = await fetch(`/api/panels/settings/${encodeURIComponent(pluginId)}`, {
|
|
112
|
+
method: 'PUT',
|
|
113
|
+
credentials: 'same-origin',
|
|
114
|
+
headers: { 'content-type': 'application/json' },
|
|
115
|
+
body: JSON.stringify({ values }),
|
|
116
|
+
});
|
|
117
|
+
if (!response.ok) throw new Error(await errorOf(response));
|
|
118
|
+
const next = (await response.json()) as SettingsPayload;
|
|
119
|
+
setPayload(next);
|
|
120
|
+
setDraft(initialDraft(next.definitions, next.values));
|
|
121
|
+
setSaved(true);
|
|
122
|
+
} catch (cause) {
|
|
123
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
124
|
+
} finally {
|
|
125
|
+
setSaving(false);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Modal
|
|
131
|
+
onClose={onClose}
|
|
132
|
+
maxWidthClass="max-w-lg"
|
|
133
|
+
header={
|
|
134
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
135
|
+
<SlidersHorizontal size={15} className="text-ink/50 flex-shrink-0" />
|
|
136
|
+
<span className="text-sm font-medium text-ink truncate">{name}</span>
|
|
137
|
+
<span className="text-[11px] text-ink/45 font-mono truncate">{pluginId}</span>
|
|
138
|
+
</div>
|
|
139
|
+
}
|
|
140
|
+
form={{ onSubmit: submit, className: 'px-5 py-4 space-y-4' }}
|
|
141
|
+
footer={
|
|
142
|
+
<div className="flex items-center gap-2">
|
|
143
|
+
{error ? (
|
|
144
|
+
<span className="flex items-start gap-1.5 text-error min-w-0">
|
|
145
|
+
<AlertTriangle size={13} className="flex-shrink-0 mt-0.5" />
|
|
146
|
+
<span className="text-[11px] leading-snug">{error}</span>
|
|
147
|
+
</span>
|
|
148
|
+
) : saved ? (
|
|
149
|
+
<span className="text-[11px] text-success">Saved</span>
|
|
150
|
+
) : null}
|
|
151
|
+
<button
|
|
152
|
+
type="submit"
|
|
153
|
+
disabled={saving || !payload}
|
|
154
|
+
className="ml-auto px-3 py-1.5 rounded-md bg-ink text-paper text-[11px] font-medium hover:bg-ink/90 transition-colors disabled:opacity-40 disabled:cursor-not-allowed"
|
|
155
|
+
>
|
|
156
|
+
{saving ? 'Saving…' : 'Save'}
|
|
157
|
+
</button>
|
|
158
|
+
</div>
|
|
159
|
+
}
|
|
160
|
+
>
|
|
161
|
+
{!payload ? (
|
|
162
|
+
error ? null : (
|
|
163
|
+
<div className="flex items-center gap-2 text-ink/50">
|
|
164
|
+
<Loader2 size={14} className="animate-spin" />
|
|
165
|
+
<span className="text-xs">Reading settings…</span>
|
|
166
|
+
</div>
|
|
167
|
+
)
|
|
168
|
+
) : definitions.length === 0 ? (
|
|
169
|
+
<p className="text-xs text-ink/50">This plugin declares no settings.</p>
|
|
170
|
+
) : (
|
|
171
|
+
definitions.map(([key, definition]) => (
|
|
172
|
+
<SettingField
|
|
173
|
+
key={key}
|
|
174
|
+
name={key}
|
|
175
|
+
definition={definition}
|
|
176
|
+
value={draft[key]}
|
|
177
|
+
stored={definition.secret === true && payload.values[key] === PLUGIN_SECRET_MASK}
|
|
178
|
+
onChange={(value) => change(key, value)}
|
|
179
|
+
/>
|
|
180
|
+
))
|
|
181
|
+
)}
|
|
182
|
+
</Modal>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Every field is one labelled control plus its description. */
|
|
187
|
+
function SettingField({
|
|
188
|
+
name,
|
|
189
|
+
definition,
|
|
190
|
+
value,
|
|
191
|
+
stored,
|
|
192
|
+
onChange,
|
|
193
|
+
}: {
|
|
194
|
+
name: string;
|
|
195
|
+
definition: PluginSettingDefinition;
|
|
196
|
+
value: string | boolean | undefined;
|
|
197
|
+
/** A secret already has a value; the box starts empty and says so. */
|
|
198
|
+
stored: boolean;
|
|
199
|
+
onChange: (value: string | boolean) => void;
|
|
200
|
+
}) {
|
|
201
|
+
const inputClass =
|
|
202
|
+
'w-full px-2.5 py-1.5 rounded-lg border border-ink/15 bg-paper focus:outline-none focus:border-ink/40 text-xs text-ink transition-colors';
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<div className="space-y-1">
|
|
206
|
+
<label className="block text-xs font-medium text-ink" for={`plugin-setting-${name}`}>
|
|
207
|
+
{definition.label}
|
|
208
|
+
</label>
|
|
209
|
+
{definition.description ? (
|
|
210
|
+
<p className="text-[11px] text-ink/50 leading-snug">{definition.description}</p>
|
|
211
|
+
) : null}
|
|
212
|
+
|
|
213
|
+
{definition.type === 'boolean' ? (
|
|
214
|
+
<label className="flex items-center gap-2 cursor-pointer select-none pt-0.5">
|
|
215
|
+
<input
|
|
216
|
+
id={`plugin-setting-${name}`}
|
|
217
|
+
type="checkbox"
|
|
218
|
+
checked={value === true}
|
|
219
|
+
onChange={(event) => onChange(event.currentTarget.checked)}
|
|
220
|
+
className={`${CHECKBOX_CLASS} accent-ink cursor-pointer`}
|
|
221
|
+
/>
|
|
222
|
+
<span className="text-[11px] text-ink/70">{value === true ? 'on' : 'off'}</span>
|
|
223
|
+
</label>
|
|
224
|
+
) : (
|
|
225
|
+
<input
|
|
226
|
+
id={`plugin-setting-${name}`}
|
|
227
|
+
type={definition.type === 'number' ? 'number' : definition.secret ? 'password' : 'text'}
|
|
228
|
+
value={typeof value === 'string' ? value : ''}
|
|
229
|
+
spellcheck={false}
|
|
230
|
+
autocomplete="off"
|
|
231
|
+
placeholder={stored ? 'stored — type a new value to replace' : undefined}
|
|
232
|
+
onInput={(event) => onChange(event.currentTarget.value)}
|
|
233
|
+
className={`${inputClass} font-mono`}
|
|
234
|
+
/>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** The server's error sentence, or the status when the body carried none. */
|
|
241
|
+
async function errorOf(response: Response): Promise<string> {
|
|
242
|
+
const body = (await response.json().catch(() => null)) as { error?: string } | null;
|
|
243
|
+
return body?.error ?? `The settings request failed (${response.status})`;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** The form's starting values: secrets empty, everything else as stored. */
|
|
247
|
+
function initialDraft(
|
|
248
|
+
definitions: Record<string, PluginSettingDefinition>,
|
|
249
|
+
values: Record<string, SettingValue>,
|
|
250
|
+
): Draft {
|
|
251
|
+
const draft: Draft = {};
|
|
252
|
+
for (const [key, definition] of Object.entries(definitions)) {
|
|
253
|
+
if (definition.type === 'boolean') {
|
|
254
|
+
draft[key] = values[key] === true;
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
draft[key] = definition.secret ? '' : String(values[key] ?? '');
|
|
258
|
+
}
|
|
259
|
+
return draft;
|
|
260
|
+
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* a write. It is the latter, and the sentence says so.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { useState } from 'preact/hooks';
|
|
19
20
|
import { ArrowDownToLine, CheckSquare, Loader2, RefreshCw, Square } from 'lucide-preact';
|
|
20
21
|
|
|
21
22
|
interface PluginToolbarProps {
|
|
@@ -28,7 +29,8 @@ interface PluginToolbarProps {
|
|
|
28
29
|
onSetAutoUpdate: (enabled: boolean) => Promise<boolean>;
|
|
29
30
|
onCheckUpdates: () => Promise<boolean>;
|
|
30
31
|
onUpdateAll: () => Promise<boolean>;
|
|
31
|
-
|
|
32
|
+
/** Re-read the registry; the promise is what spins the button. */
|
|
33
|
+
onRefresh: () => void | Promise<void>;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export function PluginToolbar({
|
|
@@ -43,6 +45,17 @@ export function PluginToolbar({
|
|
|
43
45
|
}: PluginToolbarProps) {
|
|
44
46
|
const checking = busy === 'check_updates';
|
|
45
47
|
const updatingAll = busy === 'update_all';
|
|
48
|
+
// The registry re-read is the one action here that has no entry in `busy`
|
|
49
|
+
// (it is not a mutation), so its own in-flight flag lives here.
|
|
50
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
51
|
+
const reloadRegistry = async () => {
|
|
52
|
+
setRefreshing(true);
|
|
53
|
+
try {
|
|
54
|
+
await onRefresh();
|
|
55
|
+
} finally {
|
|
56
|
+
setRefreshing(false);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
46
59
|
return (
|
|
47
60
|
<div className="flex flex-wrap items-center gap-2">
|
|
48
61
|
<button
|
|
@@ -98,12 +111,13 @@ export function PluginToolbar({
|
|
|
98
111
|
|
|
99
112
|
<button
|
|
100
113
|
type="button"
|
|
101
|
-
onClick={
|
|
102
|
-
disabled={busy !== null}
|
|
114
|
+
onClick={() => void reloadRegistry()}
|
|
115
|
+
disabled={busy !== null || refreshing}
|
|
116
|
+
aria-busy={refreshing}
|
|
103
117
|
className="flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded border border-ink/15 hover:bg-ink/5 disabled:opacity-50"
|
|
104
118
|
title="Re-read the marketplace from disk"
|
|
105
119
|
>
|
|
106
|
-
<RefreshCw size={13} />
|
|
120
|
+
<RefreshCw size={13} className={refreshing ? 'animate-spin' : undefined} />
|
|
107
121
|
Refresh
|
|
108
122
|
</button>
|
|
109
123
|
|
|
@@ -116,75 +116,78 @@ export function PluginMarketplacePane({
|
|
|
116
116
|
</p>
|
|
117
117
|
) : (
|
|
118
118
|
<div className="rounded-lg border border-ink/10 divide-y divide-ink/5">
|
|
119
|
-
{marketplaces.map((marketplace) =>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<
|
|
119
|
+
{marketplaces.map((marketplace) => {
|
|
120
|
+
const updating = busy === `Updating ${marketplace.name}`;
|
|
121
|
+
return (
|
|
122
|
+
<div key={marketplace.name} className="flex items-center gap-3 px-3 py-2.5">
|
|
123
|
+
<div className="min-w-0 flex-1">
|
|
124
|
+
<div className="flex items-center gap-1.5">
|
|
125
|
+
<span className="text-xs font-medium text-ink truncate">{marketplace.name}</span>
|
|
126
|
+
<span className="text-[10px] font-mono uppercase text-ink/45">{marketplace.sourceType}</span>
|
|
127
|
+
</div>
|
|
128
|
+
<p className="text-[11px] font-mono text-ink/50 truncate">{marketplace.sourceUri}</p>
|
|
129
|
+
<p className="text-[10px] text-ink/45">
|
|
130
|
+
{marketplace.error ? (
|
|
131
|
+
<span className="text-error">{marketplace.error}</span>
|
|
132
|
+
) : (
|
|
133
|
+
`${marketplace.pluginCount ?? 0} plugins · updated ${formatDate(marketplace.updatedAt)}`
|
|
134
|
+
)}
|
|
135
|
+
</p>
|
|
125
136
|
</div>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
137
|
+
<div className="flex items-center gap-1.5 flex-shrink-0">
|
|
138
|
+
<button
|
|
139
|
+
type="button"
|
|
140
|
+
disabled={isBusy}
|
|
141
|
+
onClick={() =>
|
|
142
|
+
void run(`Updating ${marketplace.name}`, {
|
|
143
|
+
type: 'update_marketplace',
|
|
144
|
+
name: marketplace.name,
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
title="Re-fetch this catalog"
|
|
148
|
+
className="p-1.5 rounded-lg border border-ink/20 text-ink/60 hover:text-ink hover:border-ink/40 transition-colors cursor-pointer disabled:opacity-40"
|
|
149
|
+
>
|
|
150
|
+
<RefreshCw size={13} className={updating ? 'animate-spin' : undefined} aria-hidden="true" />
|
|
151
|
+
</button>
|
|
152
|
+
{confirmingRemove === marketplace.name ? (
|
|
153
|
+
<>
|
|
154
|
+
<button
|
|
155
|
+
type="button"
|
|
156
|
+
disabled={isBusy}
|
|
157
|
+
onClick={() => {
|
|
158
|
+
void run(`Removing ${marketplace.name}`, {
|
|
159
|
+
type: 'remove_marketplace',
|
|
160
|
+
name: marketplace.name,
|
|
161
|
+
});
|
|
162
|
+
setConfirmingRemove(null);
|
|
163
|
+
}}
|
|
164
|
+
className="px-2 py-1 rounded-lg border border-error text-error text-[11px] font-medium hover:bg-error/5 transition-colors cursor-pointer disabled:opacity-40"
|
|
165
|
+
>
|
|
166
|
+
Confirm
|
|
167
|
+
</button>
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
onClick={() => setConfirmingRemove(null)}
|
|
171
|
+
className="px-1.5 py-1 rounded-lg text-[11px] text-ink/60 hover:text-ink cursor-pointer"
|
|
172
|
+
>
|
|
173
|
+
Cancel
|
|
174
|
+
</button>
|
|
175
|
+
</>
|
|
130
176
|
) : (
|
|
131
|
-
`${marketplace.pluginCount ?? 0} plugins · updated ${formatDate(marketplace.updatedAt)}`
|
|
132
|
-
)}
|
|
133
|
-
</p>
|
|
134
|
-
</div>
|
|
135
|
-
<div className="flex items-center gap-1.5 flex-shrink-0">
|
|
136
|
-
<button
|
|
137
|
-
type="button"
|
|
138
|
-
disabled={isBusy}
|
|
139
|
-
onClick={() =>
|
|
140
|
-
void run(`Updating ${marketplace.name}`, {
|
|
141
|
-
type: 'update_marketplace',
|
|
142
|
-
name: marketplace.name,
|
|
143
|
-
})
|
|
144
|
-
}
|
|
145
|
-
title="Re-fetch this catalog"
|
|
146
|
-
className="p-1.5 rounded-lg border border-ink/20 text-ink/60 hover:text-ink hover:border-ink/40 transition-colors cursor-pointer disabled:opacity-40"
|
|
147
|
-
>
|
|
148
|
-
<RefreshCw size={13} />
|
|
149
|
-
</button>
|
|
150
|
-
{confirmingRemove === marketplace.name ? (
|
|
151
|
-
<>
|
|
152
177
|
<button
|
|
153
178
|
type="button"
|
|
154
179
|
disabled={isBusy}
|
|
155
|
-
onClick={() =>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
name: marketplace.name,
|
|
159
|
-
});
|
|
160
|
-
setConfirmingRemove(null);
|
|
161
|
-
}}
|
|
162
|
-
className="px-2 py-1 rounded-lg border border-error text-error text-[11px] font-medium hover:bg-error/5 transition-colors cursor-pointer disabled:opacity-40"
|
|
180
|
+
onClick={() => setConfirmingRemove(marketplace.name)}
|
|
181
|
+
title="Remove this marketplace (installed plugins stay)"
|
|
182
|
+
className="p-1.5 rounded-lg border border-ink/20 text-ink/60 hover:border-error hover:text-error transition-colors cursor-pointer disabled:opacity-40"
|
|
163
183
|
>
|
|
164
|
-
|
|
184
|
+
<Trash2 size={13} />
|
|
165
185
|
</button>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onClick={() => setConfirmingRemove(null)}
|
|
169
|
-
className="px-1.5 py-1 rounded-lg text-[11px] text-ink/60 hover:text-ink cursor-pointer"
|
|
170
|
-
>
|
|
171
|
-
Cancel
|
|
172
|
-
</button>
|
|
173
|
-
</>
|
|
174
|
-
) : (
|
|
175
|
-
<button
|
|
176
|
-
type="button"
|
|
177
|
-
disabled={isBusy}
|
|
178
|
-
onClick={() => setConfirmingRemove(marketplace.name)}
|
|
179
|
-
title="Remove this marketplace (installed plugins stay)"
|
|
180
|
-
className="p-1.5 rounded-lg border border-ink/20 text-ink/60 hover:border-error hover:text-error transition-colors cursor-pointer disabled:opacity-40"
|
|
181
|
-
>
|
|
182
|
-
<Trash2 size={13} />
|
|
183
|
-
</button>
|
|
184
|
-
)}
|
|
186
|
+
)}
|
|
187
|
+
</div>
|
|
185
188
|
</div>
|
|
186
|
-
|
|
187
|
-
)
|
|
189
|
+
);
|
|
190
|
+
})}
|
|
188
191
|
</div>
|
|
189
192
|
)}
|
|
190
193
|
</section>
|
|
@@ -22,7 +22,8 @@ interface PluginSidebarListProps {
|
|
|
22
22
|
error: string | null;
|
|
23
23
|
onClearError: () => void;
|
|
24
24
|
onInstall: (spec: string) => void;
|
|
25
|
-
|
|
25
|
+
/** Re-read omp's registries; the promise is what spins the glyph. */
|
|
26
|
+
onRefresh: () => void | Promise<void>;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -53,6 +54,7 @@ export function PluginSidebarList({
|
|
|
53
54
|
onRefresh,
|
|
54
55
|
}: PluginSidebarListProps) {
|
|
55
56
|
const [spec, setSpec] = useState('');
|
|
57
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
56
58
|
const installedCount = plugins.filter((plugin) => plugin.enabled).length;
|
|
57
59
|
|
|
58
60
|
return (
|
|
@@ -97,11 +99,20 @@ export function PluginSidebarList({
|
|
|
97
99
|
</span>
|
|
98
100
|
<button
|
|
99
101
|
type="button"
|
|
100
|
-
|
|
102
|
+
disabled={refreshing}
|
|
103
|
+
aria-busy={refreshing}
|
|
104
|
+
onClick={async () => {
|
|
105
|
+
setRefreshing(true);
|
|
106
|
+
try {
|
|
107
|
+
await onRefresh();
|
|
108
|
+
} finally {
|
|
109
|
+
setRefreshing(false);
|
|
110
|
+
}
|
|
111
|
+
}}
|
|
101
112
|
title="Re-read omp's plugin registries"
|
|
102
|
-
className="p-1 rounded-md text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer"
|
|
113
|
+
className="p-1 rounded-md text-ink/60 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50"
|
|
103
114
|
>
|
|
104
|
-
<RefreshCw size={14} className={busy ? 'animate-spin' : undefined} />
|
|
115
|
+
<RefreshCw size={14} className={busy || refreshing ? 'animate-spin' : undefined} />
|
|
105
116
|
</button>
|
|
106
117
|
</div>
|
|
107
118
|
|