@kabmo-labs/kabmo 0.26.0 → 0.28.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/dist/client/index.html +1 -1
- package/dist/client/index.js +502 -474
- package/dist/client/static/js/index-81f7berm.css +1 -0
- package/dist/client/static/js/{index-95b3n20k.js → index-xzvyrxya.js} +799 -799
- 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 +2 -2
- package/src/client/components/common/Toast.test.tsx +28 -2
- package/src/client/components/common/Toast.tsx +21 -9
- package/src/client/components/common/harness-glyph/index.tsx +18 -1
- 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/layout/desktop-layout/LeftColumn.tsx +2 -1
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +4 -2
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +9 -1
- package/src/client/components/layout/session-sidebar/SessionList.tsx +2 -1
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +3 -2
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +2 -1
- package/src/client/components/layout/session-sidebar/modern/RevealRow.tsx +56 -0
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +12 -29
- package/src/client/components/layout/session-sidebar/modern/reveal-row.test.tsx +104 -0
- 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 +23 -3
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +5 -1
- package/src/client/components/layout/session-sidebar/variant-props.ts +2 -1
- package/src/client/components/mobile/SessionSidebar.tsx +2 -1
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +156 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +41 -86
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +4 -2
- package/src/client/components/mobile/mobile-session-sidebar/List.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 +7 -3
- package/src/client/components/settings/Sidebar.tsx +30 -3
- package/src/client/components/settings/categories/HarnessSettings.tsx +11 -7
- 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 +1 -1
- package/src/client/components/settings/categories/harness-settings/CustomHarnessForm.tsx +186 -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/SettingsModal.test.tsx +165 -0
- package/src/client/components/settings/categories/panel-plugins/SettingsModal.tsx +260 -0
- package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
- package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +39 -19
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +1 -0
- package/src/client/components/settings/categories/usage-settings/limit-groups.test.ts +94 -0
- package/src/client/components/settings/categories/usage-settings/limit-groups.ts +118 -0
- package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +118 -0
- 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 +61 -56
- package/src/client/components/workspace/chat-timeline/MessageItem.fork.test.ts +80 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +9 -3
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +11 -1
- package/src/client/components/workspace/chat-timeline/PendingTranscript.tsx +130 -0
- 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.tsx +24 -0
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +13 -20
- 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/fork-preview.test.tsx +141 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +17 -6
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +3 -10
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +101 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +5 -4
- package/src/client/components/workspace/editor/FilePane.tsx +9 -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 +16 -10
- package/src/client/components/workspace/editor/index.tsx +6 -10
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +4 -3
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +23 -14
- package/src/client/components/workspace/git-panel/index.tsx +2 -2
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +17 -6
- 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 +17 -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/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/omp/session-list.tsx +5 -0
- package/src/client/hooks/chat/omp/sidebar-reload.test.ts +85 -0
- package/src/client/hooks/chat/omp/sidebar-reload.ts +30 -0
- package/src/client/hooks/chat/timeline/actions.ts +4 -4
- 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/fork-preview.test.ts +148 -0
- package/src/client/hooks/chat/timeline/fork-preview.ts +104 -0
- package/src/client/hooks/chat/timeline/fork-send.test.ts +139 -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-branch.ts +9 -0
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +53 -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/stop-with-queue.ts +1 -1
- package/src/client/hooks/chat/timeline/use-fork-session.ts +9 -22
- package/src/client/hooks/chat/waiting/cancel.ts +15 -7
- 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 +50 -29
- package/src/client/hooks/chat/waiting/held.ts +38 -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 +21 -12
- 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 +90 -0
- package/src/client/hooks/editor/use-file-editor.ts +90 -52
- package/src/client/hooks/editor/use-file-read.ts +24 -10
- package/src/client/hooks/editor/use-file-writes.ts +4 -4
- package/src/client/hooks/models/harness-catalog.ts +15 -0
- package/src/client/hooks/settings/providers/actions.ts +3 -2
- package/src/client/hooks/settings/providers/messages.ts +9 -7
- package/src/client/hooks/settings/providers/model-actions.ts +2 -1
- package/src/client/hooks/ui/editor-error-toast.ts +2 -1
- package/src/client/hooks/ui/notifications.ts +17 -8
- package/src/client/hooks/workspace/batch-archive.test.ts +2 -2
- package/src/client/hooks/workspace/batch-archive.ts +4 -2
- package/src/client/hooks/workspace/git-action-outcome.ts +4 -3
- package/src/client/hooks/workspace/navbar-session-actions.ts +2 -1
- package/src/client/hooks/workspace/panel-registry.ts +1 -1
- package/src/client/hooks/workspace/scheduled-tasks.ts +26 -11
- package/src/client/hooks/workspace/session-actions.test.ts +2 -1
- package/src/client/hooks/workspace/session-actions.ts +2 -1
- package/src/client/hooks/workspace/terminal/connection.test.ts +63 -0
- package/src/client/hooks/workspace/terminal/connection.ts +47 -0
- package/src/client/hooks/workspace/terminal/index.ts +35 -4
- package/src/client/hooks/workspace/workspace-folder-actions.ts +2 -1
- 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/server/index.ts +7 -0
- 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.ts +6 -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-queue.server.ts +3 -3
- 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.test.ts +2 -1
- package/src/server/lib/omp/rpc/frame-fold.ts +6 -45
- 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/sidebar-data.harness.test.ts +6 -3
- package/src/server/lib/omp/session/standby.server.ts +13 -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/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/usage/report.server.ts +57 -0
- 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/new-mode.test.ts +40 -0
- package/src/server/routes/agent/new.ts +31 -10
- package/src/server/routes/agent/prewarm.ts +48 -7
- package/src/server/routes/fs/action.ts +9 -1
- package/src/server/routes/fs/digest.test.ts +100 -0
- package/src/server/routes/fs/digest.ts +106 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/fs/read.ts +6 -1
- package/src/server/routes/harness/custom.test.ts +131 -0
- package/src/server/routes/harness/import-action.ts +2 -2
- package/src/server/routes/harness/root.ts +41 -8
- 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/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/composer/delegation.ts +3 -3
- package/src/shared/lib/chat/timeline/fork-anchor.test.ts +97 -0
- package/src/shared/lib/chat/timeline/fork-anchor.ts +47 -0
- package/src/shared/lib/chat/timeline/fork-preview.test.ts +62 -0
- package/src/shared/lib/chat/timeline/fork-preview.ts +36 -0
- package/src/shared/lib/fs/content-hash.ts +29 -0
- package/src/shared/lib/harness/catalog.ts +48 -6
- 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 +65 -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/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/notifications/settings.test.ts +21 -0
- package/src/shared/lib/notifications/settings.ts +24 -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/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/ui/toast-duration.test.ts +25 -1
- package/src/shared/lib/ui/toast-duration.ts +22 -4
- package/src/shared/lib/workspace/refresh-cadence.test.ts +25 -1
- package/src/shared/lib/workspace/relative-time.ts +16 -0
- package/src/shared/lib/workspace/session-state/store.ts +4 -0
- package/src/shared/types/harness.ts +7 -0
- package/src/shared/types/omp/agent.ts +6 -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 +12 -1
- package/src/shared/types/waiting.ts +9 -0
- package/src/test-support/file-editor.test-util.ts +70 -5
- package/dist/client/static/js/index-p2yw9ywf.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
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
parseOnce,
|
|
31
31
|
validateSchedule,
|
|
32
32
|
} from '@/shared/lib/schedule/parse';
|
|
33
|
+
import { isValidTimeZone } from '@/shared/lib/schedule/timezone';
|
|
33
34
|
|
|
34
35
|
describe('parseInterval', () => {
|
|
35
36
|
test('accepts compact and spaced spellings', () => {
|
|
@@ -185,3 +186,50 @@ describe('parseOnce', () => {
|
|
|
185
186
|
expect(parseOnce('tomorrow')).toBeNull();
|
|
186
187
|
});
|
|
187
188
|
});
|
|
189
|
+
|
|
190
|
+
describe('timezone-aware schedules', () => {
|
|
191
|
+
test('a cron fires at the wall time of the task zone, not the server zone', () => {
|
|
192
|
+
const fields = parseCron('0 9 * * *')!;
|
|
193
|
+
// 2026-03-02T00:00Z is exactly 09:00 in Asia/Tokyo, so the next fire is
|
|
194
|
+
// the following day — not the same instant.
|
|
195
|
+
const from = Date.UTC(2026, 2, 2, 0, 0);
|
|
196
|
+
expect(nextCronOccurrence(fields, new Date(from), 'Asia/Tokyo')).toBe(Date.UTC(2026, 2, 3, 0, 0));
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('a spring-forward gap is skipped, not shifted', () => {
|
|
200
|
+
const fields = parseCron('0 2 * * *')!;
|
|
201
|
+
// 2026-03-08 02:00 does not exist in New York; the next fire is the 9th.
|
|
202
|
+
const from = Date.UTC(2026, 2, 8, 0, 0);
|
|
203
|
+
expect(nextCronOccurrence(fields, new Date(from), 'America/New_York')).toBe(Date.UTC(2026, 2, 9, 6, 0));
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test('a fall-back overlap resolves to its first occurrence', () => {
|
|
207
|
+
const fields = parseCron('0 1 * * *')!;
|
|
208
|
+
// 2026-11-01 01:00 occurs twice in New York; the first is 05:00Z (EDT).
|
|
209
|
+
const from = Date.UTC(2026, 10, 1, 0, 0);
|
|
210
|
+
expect(nextCronOccurrence(fields, new Date(from), 'America/New_York')).toBe(Date.UTC(2026, 10, 1, 5, 0));
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('a naive once spec is read in the task zone', () => {
|
|
214
|
+
expect(parseOnce('2026-10-01T09:00', 'Europe/Kyiv')).toBe(Date.UTC(2026, 9, 1, 6, 0));
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('an offset-bearing once spec stays absolute', () => {
|
|
218
|
+
expect(parseOnce('2026-10-01T09:00:00Z', 'Europe/Kyiv')).toBe(Date.UTC(2026, 9, 1, 9, 0));
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('validateSchedule previews in the task zone', () => {
|
|
222
|
+
const now = Date.UTC(2026, 2, 2, 0, 0);
|
|
223
|
+
expect(validateSchedule('cron', '0 9 * * *', now, 'Asia/Tokyo')).toEqual({
|
|
224
|
+
ok: true,
|
|
225
|
+
nextRunAt: Date.UTC(2026, 2, 3, 0, 0),
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('isValidTimeZone accepts IANA names and rejects junk', () => {
|
|
230
|
+
expect(isValidTimeZone('Europe/Kyiv')).toBe(true);
|
|
231
|
+
expect(isValidTimeZone('UTC')).toBe(true);
|
|
232
|
+
expect(isValidTimeZone('Mars/Olympus')).toBe(false);
|
|
233
|
+
expect(isValidTimeZone('')).toBe(false);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import type { ScheduleKind } from '@/shared/types/schedule';
|
|
28
|
+
import { isValidTimeZone, serverTimeZone, wallClock, wallTimeToInstant } from '@/shared/lib/schedule/timezone';
|
|
28
29
|
|
|
29
30
|
/** Shortest interval the runtime can honour: it ticks once a minute. */
|
|
30
31
|
export const MIN_INTERVAL_MS = 60_000;
|
|
@@ -153,10 +154,9 @@ export function parseCron(spec: string): CronFields | null {
|
|
|
153
154
|
};
|
|
154
155
|
}
|
|
155
156
|
|
|
156
|
-
function dayMatches(fields: CronFields,
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
const byDom = fields.daysOfMonth.includes(dom);
|
|
157
|
+
function dayMatches(fields: CronFields, year: number, month: number, day: number): boolean {
|
|
158
|
+
const dow = new Date(Date.UTC(year, month - 1, day)).getUTCDay();
|
|
159
|
+
const byDom = fields.daysOfMonth.includes(day);
|
|
160
160
|
const byDow = fields.daysOfWeek.includes(dow);
|
|
161
161
|
// Vixie cron: with both fields restricted the day matches if EITHER does.
|
|
162
162
|
if (fields.domRestricted && fields.dowRestricted) return byDom || byDow;
|
|
@@ -165,60 +165,78 @@ function dayMatches(fields: CronFields, date: Date): boolean {
|
|
|
165
165
|
return true;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
function firstAtLeast(values: number[], floor: number): number | null {
|
|
169
|
-
for (const value of values) if (value >= floor) return value;
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
168
|
/**
|
|
174
|
-
* The first fire strictly after `from`, in
|
|
169
|
+
* The first fire strictly after `from`, in the task's zone. Null when the
|
|
175
170
|
* expression never matches inside the horizon (an impossible date such as
|
|
176
171
|
* `0 0 30 2 *`).
|
|
172
|
+
*
|
|
173
|
+
* The walk advances one CALENDAR DAY at a time in the zone's own calendar, and
|
|
174
|
+
* a month the month-field excludes is jumped whole. Advancing by an offset
|
|
175
|
+
* instead would land mid-month after a skip and miss the first of the month it
|
|
176
|
+
* jumped to. Candidate wall times are converted through the zone, so a DST
|
|
177
|
+
* transition neither shifts the fire nor produces a duplicate.
|
|
177
178
|
*/
|
|
178
|
-
export function nextCronOccurrence(fields: CronFields, from: Date): number | null {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
cursor.setSeconds(0, 0);
|
|
183
|
-
cursor.setMinutes(cursor.getMinutes() + 1);
|
|
179
|
+
export function nextCronOccurrence(fields: CronFields, from: Date, timeZone?: string): number | null {
|
|
180
|
+
const zone = timeZone && isValidTimeZone(timeZone) ? timeZone : serverTimeZone();
|
|
181
|
+
const start = wallClock(from.getTime(), zone);
|
|
182
|
+
const horizon = Date.UTC(start.year + 8, start.month - 1, start.day);
|
|
184
183
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
for (let day = new Date(cursorDayStart); day.getTime() <= horizon.getTime(); ) {
|
|
193
|
-
if (!fields.months.includes(day.getMonth() + 1)) {
|
|
194
|
-
day = new Date(day.getFullYear(), day.getMonth() + 1, 1);
|
|
184
|
+
for (let dayCursor = Date.UTC(start.year, start.month - 1, start.day); dayCursor <= horizon; ) {
|
|
185
|
+
const date = new Date(dayCursor);
|
|
186
|
+
const year = date.getUTCFullYear();
|
|
187
|
+
const month = date.getUTCMonth() + 1;
|
|
188
|
+
const day = date.getUTCDate();
|
|
189
|
+
if (!fields.months.includes(month)) {
|
|
190
|
+
dayCursor = Date.UTC(year, month, 1);
|
|
195
191
|
continue;
|
|
196
192
|
}
|
|
197
|
-
if (dayMatches(fields, day)) {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const minuteFloor = sameDay && hour === cursor.getHours() ? cursor.getMinutes() : 0;
|
|
203
|
-
const minute = firstAtLeast(fields.minutes, minuteFloor);
|
|
204
|
-
if (minute !== null) {
|
|
205
|
-
return new Date(day.getFullYear(), day.getMonth(), day.getDate(), hour, minute, 0, 0).getTime();
|
|
193
|
+
if (dayMatches(fields, year, month, day)) {
|
|
194
|
+
for (const hour of fields.hours) {
|
|
195
|
+
for (const minute of fields.minutes) {
|
|
196
|
+
const instant = wallTimeToInstant(year, month, day, hour, minute, zone);
|
|
197
|
+
if (instant !== null && instant > from.getTime()) return instant;
|
|
206
198
|
}
|
|
207
199
|
}
|
|
208
200
|
}
|
|
209
|
-
|
|
201
|
+
dayCursor = Date.UTC(year, month - 1, day + 1);
|
|
210
202
|
}
|
|
211
203
|
return null;
|
|
212
204
|
}
|
|
213
205
|
|
|
214
|
-
/**
|
|
215
|
-
|
|
206
|
+
/** A datetime with no offset: its wall time is read in the task's zone. */
|
|
207
|
+
const NAIVE_DATETIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Parse a `once` spec (ISO-8601 timestamp, or epoch ms).
|
|
211
|
+
*
|
|
212
|
+
* A spec that carries an offset (`Z`, `+02:00`) is absolute and is left to
|
|
213
|
+
* `Date.parse`. A naive datetime is a wall-clock statement, so with a zone it
|
|
214
|
+
* is resolved in that zone; without one it keeps `Date.parse`'s local reading.
|
|
215
|
+
*/
|
|
216
|
+
export function parseOnce(spec: string, timeZone?: string): number | null {
|
|
216
217
|
const text = spec.trim();
|
|
217
218
|
if (!text) return null;
|
|
218
219
|
if (/^\d+$/.test(text)) {
|
|
219
220
|
const ms = Number(text);
|
|
220
221
|
return ms > 0 ? ms : null;
|
|
221
222
|
}
|
|
223
|
+
if (timeZone) {
|
|
224
|
+
const match = text.match(NAIVE_DATETIME);
|
|
225
|
+
if (match) {
|
|
226
|
+
const [, year, month, day, hour, minute, second, fraction] = match;
|
|
227
|
+
const instant = wallTimeToInstant(
|
|
228
|
+
Number(year),
|
|
229
|
+
Number(month),
|
|
230
|
+
Number(day),
|
|
231
|
+
Number(hour),
|
|
232
|
+
Number(minute),
|
|
233
|
+
timeZone,
|
|
234
|
+
);
|
|
235
|
+
if (instant === null) return null;
|
|
236
|
+
const millis = (second ? Number(second) * 1_000 : 0) + (fraction ? Number(fraction.padEnd(3, '0')) : 0);
|
|
237
|
+
return instant + millis;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
222
240
|
const ms = Date.parse(text);
|
|
223
241
|
return Number.isNaN(ms) ? null : ms;
|
|
224
242
|
}
|
|
@@ -232,10 +250,15 @@ export type ScheduleValidation =
|
|
|
232
250
|
* both the modal (inline feedback) and the route (a stale client) use, so a
|
|
233
251
|
* row can never be written with a spec the runtime cannot schedule.
|
|
234
252
|
*/
|
|
235
|
-
export function validateSchedule(
|
|
253
|
+
export function validateSchedule(
|
|
254
|
+
kind: ScheduleKind,
|
|
255
|
+
spec: string,
|
|
256
|
+
now = Date.now(),
|
|
257
|
+
timeZone?: string,
|
|
258
|
+
): ScheduleValidation {
|
|
236
259
|
if (!spec.trim()) return { ok: false, error: 'Enter a schedule.' };
|
|
237
260
|
if (kind === 'once') {
|
|
238
|
-
const at = parseOnce(spec);
|
|
261
|
+
const at = parseOnce(spec, timeZone);
|
|
239
262
|
if (at === null) return { ok: false, error: 'Use an ISO timestamp, e.g. 2026-10-01T09:00.' };
|
|
240
263
|
if (at <= now) return { ok: false, error: 'That time is already in the past.' };
|
|
241
264
|
return { ok: true, nextRunAt: at };
|
|
@@ -250,7 +273,7 @@ export function validateSchedule(kind: ScheduleKind, spec: string, now = Date.no
|
|
|
250
273
|
if (!fields) {
|
|
251
274
|
return { ok: false, error: 'Use 5 fields: minute hour day-of-month month day-of-week.' };
|
|
252
275
|
}
|
|
253
|
-
const next = nextCronOccurrence(fields, new Date(now));
|
|
276
|
+
const next = nextCronOccurrence(fields, new Date(now), timeZone);
|
|
254
277
|
if (next === null) return { ok: false, error: 'That expression never matches a date.' };
|
|
255
278
|
return { ok: true, nextRunAt: next };
|
|
256
279
|
}
|
|
@@ -263,6 +286,7 @@ export function nextRunAfter(
|
|
|
263
286
|
kind: ScheduleKind,
|
|
264
287
|
spec: string,
|
|
265
288
|
after: number,
|
|
289
|
+
timeZone?: string,
|
|
266
290
|
): number | null {
|
|
267
291
|
if (kind === 'once') return null;
|
|
268
292
|
if (kind === 'every') {
|
|
@@ -270,15 +294,15 @@ export function nextRunAfter(
|
|
|
270
294
|
return interval === null ? null : after + interval;
|
|
271
295
|
}
|
|
272
296
|
const fields = parseCron(spec);
|
|
273
|
-
return fields ? nextCronOccurrence(fields, new Date(after)) : null;
|
|
297
|
+
return fields ? nextCronOccurrence(fields, new Date(after), timeZone) : null;
|
|
274
298
|
}
|
|
275
299
|
|
|
276
300
|
/** Human summary of a schedule for the task list and the run log. */
|
|
277
|
-
export function describeSchedule(kind: ScheduleKind, spec: string): string {
|
|
301
|
+
export function describeSchedule(kind: ScheduleKind, spec: string, timeZone?: string): string {
|
|
278
302
|
const text = spec.trim();
|
|
279
303
|
if (kind === 'once') {
|
|
280
|
-
const at = parseOnce(text);
|
|
281
|
-
return at === null ? text : `Once at ${new Date(at).toLocaleString()}`;
|
|
304
|
+
const at = parseOnce(text, timeZone);
|
|
305
|
+
return at === null ? text : `Once at ${new Date(at).toLocaleString(undefined, timeZone ? { timeZone } : undefined)}`;
|
|
282
306
|
}
|
|
283
307
|
if (kind === 'every') {
|
|
284
308
|
const interval = parseInterval(text);
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* IANA timezone arithmetic for the schedule grammar.
|
|
8
|
+
*
|
|
9
|
+
* A cron expression is a WALL-CLOCK statement: `0 9 * * 1-5` means 09:00 where
|
|
10
|
+
* the user lives, not 09:00 in whatever zone the server process happens to
|
|
11
|
+
* run in. A container is usually UTC, so interpreting the expression with
|
|
12
|
+
* `Date`'s local getters silently fires a "morning" task at the wrong hour for
|
|
13
|
+
* every user east or west of Greenwich. Every task therefore stores its zone,
|
|
14
|
+
* and the parser resolves wall times through this module.
|
|
15
|
+
*
|
|
16
|
+
* The conversion is the standard two-pass offset resolution: guess the instant
|
|
17
|
+
* by treating the wall time as UTC, read the zone's offset at that instant,
|
|
18
|
+
* subtract it, and re-read the offset at the result. A second pass is needed
|
|
19
|
+
* because the first guess can land on the other side of a DST transition.
|
|
20
|
+
* A wall time that does not exist (the spring-forward gap) returns null, and an
|
|
21
|
+
* ambiguous one (the fall-back overlap) resolves to its FIRST occurrence.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export interface WallClock {
|
|
25
|
+
year: number;
|
|
26
|
+
month: number;
|
|
27
|
+
day: number;
|
|
28
|
+
hour: number;
|
|
29
|
+
minute: number;
|
|
30
|
+
second: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const formatters = new Map<string, Intl.DateTimeFormat>();
|
|
34
|
+
|
|
35
|
+
function formatter(timeZone: string): Intl.DateTimeFormat {
|
|
36
|
+
let cached = formatters.get(timeZone);
|
|
37
|
+
if (!cached) {
|
|
38
|
+
cached = new Intl.DateTimeFormat('en-US', {
|
|
39
|
+
timeZone,
|
|
40
|
+
hourCycle: 'h23',
|
|
41
|
+
year: 'numeric',
|
|
42
|
+
month: '2-digit',
|
|
43
|
+
day: '2-digit',
|
|
44
|
+
hour: '2-digit',
|
|
45
|
+
minute: '2-digit',
|
|
46
|
+
second: '2-digit',
|
|
47
|
+
});
|
|
48
|
+
formatters.set(timeZone, cached);
|
|
49
|
+
}
|
|
50
|
+
return cached;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Whether `value` names a zone this runtime can resolve. */
|
|
54
|
+
export function isValidTimeZone(value: string): boolean {
|
|
55
|
+
if (!value) return false;
|
|
56
|
+
try {
|
|
57
|
+
formatter(value);
|
|
58
|
+
return true;
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The zone the process runs in; the default for a task that names none. */
|
|
65
|
+
export function serverTimeZone(): string {
|
|
66
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The wall-clock reading of `instant` in `timeZone`. */
|
|
70
|
+
export function wallClock(instant: number, timeZone: string): WallClock {
|
|
71
|
+
const parts = formatter(timeZone).formatToParts(new Date(instant));
|
|
72
|
+
const read = (type: Intl.DateTimeFormatPartTypes): number => {
|
|
73
|
+
const part = parts.find((entry) => entry.type === type);
|
|
74
|
+
return part ? Number(part.value) : 0;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
year: read('year'),
|
|
78
|
+
month: read('month'),
|
|
79
|
+
day: read('day'),
|
|
80
|
+
hour: read('hour'),
|
|
81
|
+
minute: read('minute'),
|
|
82
|
+
second: read('second'),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The zone's offset from UTC at `instant`, in milliseconds. */
|
|
87
|
+
function offsetMs(instant: number, timeZone: string): number {
|
|
88
|
+
const wall = wallClock(instant, timeZone);
|
|
89
|
+
const asUtc = Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute, wall.second);
|
|
90
|
+
return asUtc - Math.floor(instant / 1000) * 1000;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The instant at which `timeZone` reads the given wall time, or null when that
|
|
95
|
+
* wall time does not exist (a spring-forward gap).
|
|
96
|
+
*/
|
|
97
|
+
export function wallTimeToInstant(
|
|
98
|
+
year: number,
|
|
99
|
+
month: number,
|
|
100
|
+
day: number,
|
|
101
|
+
hour: number,
|
|
102
|
+
minute: number,
|
|
103
|
+
timeZone: string,
|
|
104
|
+
): number | null {
|
|
105
|
+
const guess = Date.UTC(year, month - 1, day, hour, minute);
|
|
106
|
+
const firstOffset = offsetMs(guess, timeZone);
|
|
107
|
+
let instant = guess - firstOffset;
|
|
108
|
+
const secondOffset = offsetMs(instant, timeZone);
|
|
109
|
+
if (secondOffset !== firstOffset) instant = guess - secondOffset;
|
|
110
|
+
|
|
111
|
+
const wall = wallClock(instant, timeZone);
|
|
112
|
+
if (
|
|
113
|
+
wall.year !== year ||
|
|
114
|
+
wall.month !== month ||
|
|
115
|
+
wall.day !== day ||
|
|
116
|
+
wall.hour !== hour ||
|
|
117
|
+
wall.minute !== minute
|
|
118
|
+
) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return instant;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The calendar date `instant` falls on in `timeZone`. */
|
|
125
|
+
export function wallDate(instant: number, timeZone: string): { year: number; month: number; day: number } {
|
|
126
|
+
const wall = wallClock(instant, timeZone);
|
|
127
|
+
return { year: wall.year, month: wall.month, day: wall.day };
|
|
128
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { describe, expect, test } from 'bun:test';
|
|
17
|
-
import { TOAST_EXIT_MS, toastDurationMs } from '@/shared/lib/ui/toast-duration';
|
|
17
|
+
import { TOAST_EXIT_MS, toastDurationMs, updateOutcomeTone } from '@/shared/lib/ui/toast-duration';
|
|
18
18
|
|
|
19
19
|
describe('toastDurationMs', () => {
|
|
20
20
|
test('a short confirmation gets the success floor, not a flicker', () => {
|
|
@@ -67,8 +67,32 @@ describe('toastDurationMs', () => {
|
|
|
67
67
|
);
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
test('a warning outlasts a confirmation and gives way to a failure', () => {
|
|
71
|
+
const message = 'Merging feature stopped on a conflict; resolve it above.';
|
|
72
|
+
expect(toastDurationMs({ tone: 'warning', message })).toBeGreaterThan(
|
|
73
|
+
toastDurationMs({ tone: 'success', message })!,
|
|
74
|
+
);
|
|
75
|
+
expect(toastDurationMs({ tone: 'warning', message })).toBeLessThan(
|
|
76
|
+
toastDurationMs({ tone: 'error', message })!,
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
70
80
|
test('the exit animation is a real duration, short enough to read as a fade', () => {
|
|
71
81
|
expect(TOAST_EXIT_MS).toBeGreaterThan(0);
|
|
72
82
|
expect(TOAST_EXIT_MS).toBeLessThan(400);
|
|
73
83
|
});
|
|
74
84
|
});
|
|
85
|
+
|
|
86
|
+
describe('updateOutcomeTone', () => {
|
|
87
|
+
test('a run that finished is a success', () => {
|
|
88
|
+
expect(updateOutcomeTone({ success: true, manual: false })).toBe('success');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('a run the environment cannot perform is a warning: the user still has to act', () => {
|
|
92
|
+
expect(updateOutcomeTone({ success: true, manual: true })).toBe('warning');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('a failed run is an error, even when it also names a manual command', () => {
|
|
96
|
+
expect(updateOutcomeTone({ success: false, manual: true })).toBe('error');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -23,20 +23,25 @@
|
|
|
23
23
|
* caller overriding it does so in one place.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
export type ToastTone = 'success' | 'error';
|
|
26
|
+
export type ToastTone = 'success' | 'error' | 'warning';
|
|
27
27
|
|
|
28
28
|
/** How long the fade-out runs. The timer and the class that animates agree here. */
|
|
29
29
|
export const TOAST_EXIT_MS = 180;
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Notice-me base, per tone. A warning sits between the two: it did not fail, but
|
|
33
|
+
* it names something the reader has to decide on (a stopped operation, a manual
|
|
34
|
+
* command), so it is noticed like a failure and skimmed like a confirmation.
|
|
35
|
+
*/
|
|
36
|
+
const BASE_MS: Record<ToastTone, number> = { success: 2500, warning: 3200, error: 4000 };
|
|
33
37
|
|
|
34
38
|
/** Reading rate per tone: an error is re-read, a confirmation is skimmed. */
|
|
35
|
-
const PER_CHAR_MS: Record<ToastTone, number> = { success: 45, error: 55 };
|
|
39
|
+
const PER_CHAR_MS: Record<ToastTone, number> = { success: 45, warning: 50, error: 55 };
|
|
36
40
|
|
|
37
41
|
/** Floor and ceiling per tone: nothing flickers, nothing sits for a minute. */
|
|
38
42
|
const BOUNDS_MS: Record<ToastTone, { min: number; max: number }> = {
|
|
39
43
|
success: { min: 3000, max: 8000 },
|
|
44
|
+
warning: { min: 4000, max: 10000 },
|
|
40
45
|
error: { min: 5000, max: 12000 },
|
|
41
46
|
};
|
|
42
47
|
|
|
@@ -68,3 +73,16 @@ export function toastDurationMs({ tone, message, explicit, sticky }: ToastDurati
|
|
|
68
73
|
const byLength = BASE_MS[tone] + PER_CHAR_MS[tone] * message.trim().length;
|
|
69
74
|
return Math.round(Math.min(max, Math.max(min, byLength)));
|
|
70
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The tone an update run's answer deserves.
|
|
79
|
+
*
|
|
80
|
+
* A failed run is an error. A run the environment could not perform for itself
|
|
81
|
+
* (`manual`) reports the command to run: the update is still waiting on the
|
|
82
|
+
* user, so it is neither a success nor a failure. Every shell that applies an
|
|
83
|
+
* update reads this, so the three of them cannot disagree about the same answer.
|
|
84
|
+
*/
|
|
85
|
+
export function updateOutcomeTone(result: { success: boolean; manual: boolean }): ToastTone {
|
|
86
|
+
if (!result.success) return 'error';
|
|
87
|
+
return result.manual ? 'warning' : 'success';
|
|
88
|
+
}
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
SIDEBAR_DATA_TTL_MS,
|
|
24
24
|
STREAM_HEARTBEAT_MS,
|
|
25
25
|
} from '@/shared/lib/workspace/refresh-cadence';
|
|
26
|
-
import { relativeTimeAgo } from '@/shared/lib/workspace/relative-time';
|
|
26
|
+
import { formatFullDate, relativeTimeAgo } from '@/shared/lib/workspace/relative-time';
|
|
27
27
|
|
|
28
28
|
describe('refresh cadences', () => {
|
|
29
29
|
test('the documented millisecond values', () => {
|
|
@@ -115,3 +115,27 @@ describe('relativeTimeAgo', () => {
|
|
|
115
115
|
expect(relativeTimeAgo(Date.now() - 5 * MINUTE)).toBe('5m');
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
describe('formatFullDate', () => {
|
|
120
|
+
test('missing or unparseable input yields null', () => {
|
|
121
|
+
expect(formatFullDate(null)).toBeNull();
|
|
122
|
+
expect(formatFullDate(undefined)).toBeNull();
|
|
123
|
+
expect(formatFullDate('')).toBeNull();
|
|
124
|
+
expect(formatFullDate('not a date')).toBeNull();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('renders the full weekday, date and clock', () => {
|
|
128
|
+
// 2026-11-12T14:30:00Z — the exact local rendering depends on the test
|
|
129
|
+
// machine's zone, so assert the parts that do not.
|
|
130
|
+
const label = formatFullDate('2026-11-12T14:30:00.000Z');
|
|
131
|
+
expect(label).toContain('Nov');
|
|
132
|
+
expect(label).toContain('2026');
|
|
133
|
+
expect(label).toContain('12');
|
|
134
|
+
expect(label).toMatch(/\d{1,2}:\d{2}/);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('parses an ISO string the same as its epoch millis', () => {
|
|
138
|
+
const iso = '2026-01-15T11:30:00.000Z';
|
|
139
|
+
expect(formatFullDate(iso)).toBe(formatFullDate(Date.parse(iso)));
|
|
140
|
+
});
|
|
141
|
+
});
|
|
@@ -23,3 +23,19 @@ export function relativeTimeAgo(value: string | number | null | undefined, now:
|
|
|
23
23
|
const month = date.toLocaleString('en-US', { month: 'short' });
|
|
24
24
|
return sameYear ? `${day} ${month}` : `${day} ${month} ${date.getFullYear()}`;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
/** Full timestamp for a row's hover tooltip: `Wed, 12 Nov 2026, 02:30 PM`.
|
|
28
|
+
* Returns null for a missing/unparseable timestamp, matching `relativeTimeAgo`. */
|
|
29
|
+
export function formatFullDate(value: string | number | null | undefined): string | null {
|
|
30
|
+
if (value === null || value === undefined || value === '') return null;
|
|
31
|
+
const ms = typeof value === 'number' ? value : Date.parse(value);
|
|
32
|
+
if (Number.isNaN(ms)) return null;
|
|
33
|
+
return new Date(ms).toLocaleString('en-US', {
|
|
34
|
+
weekday: 'short',
|
|
35
|
+
day: 'numeric',
|
|
36
|
+
month: 'short',
|
|
37
|
+
year: 'numeric',
|
|
38
|
+
hour: '2-digit',
|
|
39
|
+
minute: '2-digit',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
* - userBrowser.viewportMode string
|
|
46
46
|
* - userBrowser.zoomLevel number
|
|
47
47
|
* - terminal.id string (server-side PTY id; reattached on reload)
|
|
48
|
+
* - terminal.opened boolean — the session has had its terminal panel on
|
|
49
|
+
* screen, so its shell belongs to the session. A PTY
|
|
50
|
+
* is never started merely because the (hidden) panel
|
|
51
|
+
* mounted; see `hooks/workspace/terminal/connection.ts`
|
|
48
52
|
* - git.viewMode 'flat' | 'tree'
|
|
49
53
|
* - git.commitDraft string
|
|
50
54
|
* - git.stagedExpanded boolean
|
|
@@ -56,6 +56,10 @@ export interface HarnessSummary {
|
|
|
56
56
|
* to install, probe or configure, so the settings page leaves it out and the
|
|
57
57
|
* picker never draws it as blocked. */
|
|
58
58
|
builtIn?: true;
|
|
59
|
+
/** True for a harness the user added, so the card can offer Remove. */
|
|
60
|
+
custom?: true;
|
|
61
|
+
/** The letter the UI draws when there is no vendor mark. */
|
|
62
|
+
initial?: string;
|
|
59
63
|
install?: string;
|
|
60
64
|
note?: string;
|
|
61
65
|
/** False when the user switched this harness off: it then leaves the settings
|
|
@@ -70,6 +74,9 @@ export interface HarnessSummary {
|
|
|
70
74
|
models: HarnessSelectorValue[];
|
|
71
75
|
thinking: HarnessSelectorValue[];
|
|
72
76
|
modes: HarnessSelectorValue[];
|
|
77
|
+
/** The mode the agent reported as current when its probe session opened,
|
|
78
|
+
* when it published one. */
|
|
79
|
+
currentMode?: string;
|
|
73
80
|
probedAt: number;
|
|
74
81
|
/** True when the record is older than `PROBE_TTL_MS`. The answer is still
|
|
75
82
|
* shown — with its age — rather than being reported as "never probed". */
|
|
@@ -131,6 +131,12 @@ export interface SpawnOptions {
|
|
|
131
131
|
/** Plan/goal picks made on a pending view. A brand-new session has no
|
|
132
132
|
* transcript to restore them from, so they ride the spawn environment. */
|
|
133
133
|
modes?: { plan: boolean; goal: boolean } | null;
|
|
134
|
+
/**
|
|
135
|
+
* The ACP mode id the composer picked on a pending chat. ACP applies modes as
|
|
136
|
+
* a config write right after `session/new`, so this travels with the spawn
|
|
137
|
+
* rather than as an environment value.
|
|
138
|
+
*/
|
|
139
|
+
sessionMode?: string | null;
|
|
134
140
|
/**
|
|
135
141
|
* Which harness runs the chat. A SPAWN property — it decides the transport,
|
|
136
142
|
* the model list and every capability the panels can show — so it can only be
|
|
@@ -170,7 +170,7 @@ export interface PanelPluginStatus {
|
|
|
170
170
|
/** The mark colour the manifest declares, when it declares one. */
|
|
171
171
|
color?: string;
|
|
172
172
|
capabilities?: string[];
|
|
173
|
-
/** How many settings the
|
|
173
|
+
/** How many settings the plugin's schema declares, so the card can say what is configurable. */
|
|
174
174
|
settingsCount?: number;
|
|
175
175
|
/**
|
|
176
176
|
* The version the SOURCE offers, when it is known and newer.
|
|
@@ -194,7 +194,7 @@ export interface PanelPluginStatus {
|
|
|
194
194
|
/**
|
|
195
195
|
* One plugin the bundled marketplace offers, whether or not it is installed.
|
|
196
196
|
*
|
|
197
|
-
* The catalog is what the
|
|
197
|
+
* The catalog is what the Plugins Kabmo pane lists as AVAILABLE: the bundled
|
|
198
198
|
* marketplace is a store the user installs from, so a plugin sitting in
|
|
199
199
|
* `<package>/marketplace/plugins/` is an offer, not an install. A catalog entry
|
|
200
200
|
* cannot describe what a plugin CONTRIBUTES — that is known only after its
|
|
@@ -248,7 +248,7 @@ export interface PanelRegistryPayload {
|
|
|
248
248
|
* built-in panel list, and does not need one, because the client is what
|
|
249
249
|
* resolves a bare id to a component. Carrying the set here rather than in the
|
|
250
250
|
* Kabmo settings blob is what keeps ONE store: the activity-bar menu and
|
|
251
|
-
* the
|
|
251
|
+
* the Plugins Kabmo switches write the same ids through the same endpoint,
|
|
252
252
|
* so the two surfaces cannot disagree about whether a panel is on.
|
|
253
253
|
*/
|
|
254
254
|
disabledPanels: string[];
|
|
@@ -75,8 +75,10 @@ export interface PanelPluginManifest {
|
|
|
75
75
|
*/
|
|
76
76
|
server?: string;
|
|
77
77
|
/**
|
|
78
|
-
* Declared settings
|
|
79
|
-
*
|
|
78
|
+
* **Legacy.** Declared settings used to live here; they now live in
|
|
79
|
+
* `settings-schema.json` at the plugin root, which the host reads without the
|
|
80
|
+
* plugin running. This key is still read when that file is absent, so a
|
|
81
|
+
* plugin written before the file existed keeps its form.
|
|
80
82
|
*/
|
|
81
83
|
settings?: Record<string, PluginSettingDefinition>;
|
|
82
84
|
/**
|
|
@@ -34,6 +34,19 @@ export interface ScheduledTask {
|
|
|
34
34
|
prompt: string;
|
|
35
35
|
kind: ScheduleKind;
|
|
36
36
|
spec: string;
|
|
37
|
+
/**
|
|
38
|
+
* Which harness runs the task (`omp-rpc`, `claude`, `codex`, …). A spawn-time
|
|
39
|
+
* property, not a label: it decides the transport, the model catalog and the
|
|
40
|
+
* launch command. `omp-rpc` is the built-in default.
|
|
41
|
+
*/
|
|
42
|
+
harness: string;
|
|
43
|
+
/**
|
|
44
|
+
* IANA zone the spec is read in. A cron expression is a wall-clock statement,
|
|
45
|
+
* so `0 9 * * 1-5` means 09:00 here, not 09:00 in the server's zone. Resolved
|
|
46
|
+
* at write time (the server's zone when the request names none) so a task
|
|
47
|
+
* keeps firing at the hour it was created for even if the server moves.
|
|
48
|
+
*/
|
|
49
|
+
timezone: string;
|
|
37
50
|
/** Workspace folder the run starts in; null uses the server's default cwd. */
|
|
38
51
|
folderId: number | null;
|
|
39
52
|
/** Resolved at creation from the folder, so a deleted folder cannot strand it. */
|