@kabmo-labs/kabmo 0.21.1 → 0.22.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/README.md +7 -2
- package/dist/client/index.html +9 -8
- package/dist/client/index.js +334 -334
- package/dist/client/static/js/{index-thwqf24c.js → index-297dck9a.js} +784 -791
- package/dist/client/static/js/index-7ppta1pb.css +1 -0
- package/extensions/kabmo-modes/commands.ts +17 -3
- package/extensions/kabmo-modes/goal-start.ts +101 -0
- package/extensions/kabmo-modes/goal.test.ts +80 -5
- package/extensions/kabmo-modes/goal.ts +13 -38
- package/extensions/kabmo-modes/prompts.test.ts +12 -0
- package/extensions/kabmo-modes/prompts.ts +9 -2
- package/index.html +8 -7
- package/package.json +2 -2
- package/src/cli/lib/args.js +9 -0
- package/src/cli/lib/args.test.js +26 -0
- package/src/cli/lib/commands/doctor.js +153 -0
- package/src/cli/lib/commands/doctor.test.js +139 -0
- package/src/cli/lib/commands/serve.js +23 -10
- package/src/cli/lib/commands/status.js +22 -3
- package/src/cli/lib/omp-setup.js +131 -0
- package/src/cli/lib/omp-setup.test.js +115 -0
- package/src/cli/main.js +1 -1
- package/src/client/components/common/DemoDataBadge.tsx +52 -0
- package/src/client/components/common/FolderPicker.tsx +2 -2
- package/src/client/components/common/Modal.tsx +15 -1
- package/src/client/components/common/code-surface/blame-panel.ts +1 -1
- package/src/client/components/common/context-usage-button/index.test.tsx +1 -1
- package/src/client/components/common/context-usage-button/index.tsx +4 -4
- package/src/client/components/common/demo-data-badge.test.tsx +58 -0
- package/src/client/components/common/diagram-viewer/index.tsx +2 -2
- package/src/client/components/common/editor-view-buttons/index.tsx +2 -2
- package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
- package/src/client/components/common/header-controls/index.tsx +4 -1
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +2 -2
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +1 -1
- package/src/client/components/common/panel-mark/index.tsx +2 -1
- package/src/client/components/common/server-control/Panel.tsx +3 -3
- package/src/client/components/common/server-control/index.tsx +1 -1
- package/src/client/components/common/shell-update-button/Modal.tsx +1 -1
- package/src/client/components/common/todo-row/index.tsx +1 -1
- package/src/client/components/layout/ActivityBar.tsx +4 -0
- package/src/client/components/layout/ShellNotice.tsx +33 -0
- package/src/client/components/layout/desktop-layout/index.tsx +14 -16
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +14 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +2 -1
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +5 -1
- package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
- package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +56 -0
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +12 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +2 -1
- package/src/client/components/layout/session-sidebar/modern/index.tsx +6 -2
- package/src/client/components/layout/session-sidebar/new-workspace-modal/CloneField.tsx +1 -1
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +3 -3
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +150 -0
- package/src/client/components/layout/session-sidebar/variant-props.ts +6 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +20 -30
- package/src/client/components/mobile/MainView.tsx +5 -2
- package/src/client/components/mobile/RightSidebar.tsx +1 -1
- package/src/client/components/mobile/SessionSidebar.tsx +3 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +7 -1
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
- package/src/client/components/settings/Modal.tsx +15 -1
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +2 -2
- package/src/client/components/settings/categories/OmpSettings.tsx +1 -1
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +1 -1
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +3 -3
- package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +2 -2
- package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +5 -5
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/ComposerStyleSection.tsx +1 -1
- package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +1 -1
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +2 -2
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +5 -5
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +3 -3
- package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +2 -2
- package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
- package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +4 -3
- package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +2 -2
- package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +1 -1
- package/src/client/components/settings/categories/project-settings/PathField.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +3 -3
- package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +4 -4
- package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/PriceFields.tsx +1 -1
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +4 -4
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +2 -2
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +1 -1
- package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +5 -5
- package/src/client/components/workspace/browser-panel/AddressBar.tsx +1 -1
- package/src/client/components/workspace/browser-panel/Screencast.tsx +6 -6
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +1 -1
- package/src/client/components/workspace/browser-panel/index.tsx +1 -1
- package/src/client/components/workspace/browser-toolbar/index.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +13 -26
- package/src/client/components/workspace/chat-timeline/GoalNotice.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/QueueList.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SubagentView.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ArmedGoalStrip.tsx +71 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.test.ts +176 -0
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +70 -81
- package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +10 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +20 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +13 -7
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +65 -3
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +69 -19
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +174 -0
- package/src/client/components/workspace/chat-timeline/chat-input/goal-modal-parts.tsx +80 -0
- package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +15 -3
- package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Header.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/SelectBody.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +6 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +13 -13
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +9 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +10 -10
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/GoalRecord.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +6 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +5 -5
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -15
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +7 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +4 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +17 -17
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/EnvelopeHeader.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/OutputWindow.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips.tsx +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +1 -1
- package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +2 -2
- package/src/client/components/workspace/context-panel/StatsGrid.tsx +1 -1
- package/src/client/components/workspace/context-panel/index.tsx +1 -1
- package/src/client/components/workspace/diff-panel/ConflictBanner.tsx +1 -1
- package/src/client/components/workspace/editor/EmptyEditor.tsx +1 -1
- package/src/client/components/workspace/editor/FindWidget.tsx +1 -1
- package/src/client/components/workspace/editor/Tabs.tsx +1 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +1 -1
- package/src/client/components/workspace/file-explorer/OutlineSection.tsx +2 -2
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -1
- package/src/client/components/workspace/file-explorer/index.tsx +1 -1
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
- package/src/client/components/workspace/git-panel/ChangesList.tsx +3 -3
- package/src/client/components/workspace/git-panel/ConflictItem.tsx +3 -3
- package/src/client/components/workspace/git-panel/FileItem.tsx +2 -2
- package/src/client/components/workspace/git-panel/StashSection.tsx +5 -5
- package/src/client/components/workspace/git-panel/TreeItem.tsx +2 -2
- package/src/client/components/workspace/git-panel/branch-modal/BranchRow.tsx +4 -4
- package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -2
- package/src/client/components/workspace/git-panel/index.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/Item.tsx +3 -3
- package/src/client/components/workspace/model-dropdown/Section.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
- package/src/client/components/workspace/plan-panel/index.tsx +2 -2
- package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
- package/src/client/components/workspace/repo-picker/Row.tsx +6 -6
- package/src/client/components/workspace/search-panel/Body.tsx +2 -2
- package/src/client/components/workspace/search-panel/Results.tsx +1 -1
- package/src/client/components/workspace/search-panel/index.tsx +1 -1
- package/src/client/components/workspace/terminal-panel/index.tsx +1 -1
- package/src/client/components/workspace/todo-panel/PhaseGroup.tsx +1 -1
- package/src/client/components/workspace/todo-panel/index.tsx +2 -2
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -5
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +13 -13
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +4 -4
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +1 -1
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +7 -7
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/Nav.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/index.tsx +2 -2
- package/src/client/glass.css +50 -0
- package/src/client/glass.test.ts +68 -24
- package/src/client/hooks/chat/composer/browser-context.test.ts +6 -6
- package/src/client/hooks/chat/composer/use-draft.test.ts +2 -2
- package/src/client/hooks/chat/omp/prompt-send.test.ts +36 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +24 -18
- package/src/client/hooks/chat/omp/session-list.tsx +24 -70
- package/src/client/hooks/chat/omp/session-merges.ts +89 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -1
- package/src/client/hooks/chat/timeline/armed-goal-send.test.ts +168 -0
- package/src/client/hooks/chat/timeline/armed-goal.test.ts +178 -0
- package/src/client/hooks/chat/timeline/goal-command.ts +57 -27
- package/src/client/hooks/chat/timeline/index.ts +7 -4
- package/src/client/hooks/chat/timeline/mode-post.ts +46 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +94 -0
- package/src/client/hooks/chat/timeline/modes.ts +60 -95
- package/src/client/hooks/chat/timeline/send-props.ts +97 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +6 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +55 -8
- package/src/client/hooks/chat/timeline/send.test.ts +17 -1
- package/src/client/hooks/chat/timeline/send.ts +64 -72
- package/src/client/hooks/ui/dialog-behaviour.ts +143 -0
- package/src/client/hooks/ui/theme.ts +17 -0
- package/src/client/hooks/workspace/copy-tab-path.ts +23 -0
- package/src/client/hooks/workspace/mobile-back.ts +71 -0
- package/src/client/palette-class.test.ts +93 -0
- package/src/client/tailwind-contrast.test.ts +194 -0
- package/src/client/tailwind.css +327 -8
- package/src/server/lib/assets/theme-shell.server.ts +4 -10
- package/src/server/lib/omp/config/provider-seeds.test.ts +39 -1
- package/src/server/lib/omp/config/provider-seeds.ts +32 -3
- package/src/server/lib/omp/config/provider-vision-compat.test.ts +140 -0
- package/src/server/lib/omp/core/host-resolution.test.ts +1 -55
- package/src/server/lib/omp/core/install-hint.test.ts +48 -0
- package/src/server/lib/omp/core/install-hint.ts +64 -0
- package/src/server/lib/omp/core/startup.test.ts +125 -0
- package/src/server/lib/omp/core/startup.ts +5 -1
- package/src/server/lib/omp/mode/request.ts +14 -6
- package/src/server/plugins/ssr.ts +2 -1
- package/src/shared/lib/browser/annotate.test.ts +22 -22
- package/src/shared/lib/browser/annotate.ts +14 -14
- package/src/shared/lib/browser/page-context.ts +6 -6
- package/src/shared/lib/icons/icon-paint-authority.test.ts +86 -0
- package/src/shared/lib/icons/icon-paint-authority.ts +94 -0
- package/src/shared/lib/icons/icon-paint-css.test.ts +44 -8
- package/src/shared/lib/icons/icon-paint-css.ts +18 -1
- package/src/shared/lib/icons/icon-paint-panel.ts +15 -18
- package/src/shared/lib/icons/icon-paint-weight.ts +20 -1
- package/src/shared/lib/icons/icon-tone.ts +58 -13
- package/src/shared/lib/icons/tint-hues.generated.ts +51 -6
- package/src/shared/lib/icons/tint-tones.test.ts +257 -0
- package/src/shared/lib/icons/tint.test.ts +3 -211
- package/src/shared/lib/icons/tint.ts +23 -25
- package/src/shared/lib/omp/mode/actions.ts +40 -0
- package/src/shared/lib/omp/mode/types.ts +12 -0
- package/src/shared/lib/theme/css.ts +21 -0
- package/src/shared/lib/theme/first-frame.ts +38 -0
- package/src/shared/lib/theme/ink-scale.test.ts +151 -0
- package/src/shared/lib/theme/ink-scale.ts +103 -0
- package/src/shared/lib/theme/shell-palette.test.ts +22 -5
- package/src/shared/lib/theme/shell-palette.ts +9 -4
- package/src/shared/lib/theme/theme.test.ts +28 -3
- package/src/shared/lib/workspace/project-accent.test.ts +33 -1
- package/src/shared/lib/workspace/project-accent.ts +23 -0
- package/src/shared/types/omp/agent.ts +24 -9
- package/dist/client/static/js/index-0721wrkf.css +0 -1
package/src/client/glass.css
CHANGED
|
@@ -234,6 +234,21 @@
|
|
|
234
234
|
* to 2.88:1 while 92% holds 4.59:1, because bright code behind a menu is what
|
|
235
235
|
* a dark theme actually has under it. */
|
|
236
236
|
--glass-popover: color-mix(in srgb, var(--theme-paper) 84%, transparent);
|
|
237
|
+
/* The fill for a popover that CANNOT blur: one nested inside another frosted
|
|
238
|
+
* surface, which is a backdrop root (see the rule near the bottom of this
|
|
239
|
+
* file). Declared here, surface-independent, because the composer's `glass`
|
|
240
|
+
* style is offered in the classic look too.
|
|
241
|
+
*
|
|
242
|
+
* **OPAQUE, and the number is a measurement rather than a preference.** With
|
|
243
|
+
* no blur the panel is a straight alpha over its backdrop, so every percent of
|
|
244
|
+
* transparency is readable text behind a list of model names. Measured with
|
|
245
|
+
* ghost text painted exactly behind the panel: 84% left it at `1.47:1`, 92%
|
|
246
|
+
* `1.21:1`, 96% `1.10:1` — all still legible in the screenshot. This is the
|
|
247
|
+
* file's own rule ("a raised surface that is READ keeps its own opaque
|
|
248
|
+
* `bg-paper`"), and a dropdown is the most-read surface there is. The material
|
|
249
|
+
* still reads as glass through the sheen, the rim and the bloom, which is
|
|
250
|
+
* where a pane is legible anyway. */
|
|
251
|
+
--glass-popover-nested: var(--theme-paper);
|
|
237
252
|
/* A STUCK sticky header's fill — see `.glass-sticky[data-stuck]`.
|
|
238
253
|
*
|
|
239
254
|
* OPAQUE, and mixed toward the CANVAS, not transparent. Two measured reasons.
|
|
@@ -712,6 +727,39 @@
|
|
|
712
727
|
background-color: var(--glass-popover);
|
|
713
728
|
}
|
|
714
729
|
|
|
730
|
+
/*
|
|
731
|
+
* A popover NESTED in another frosted surface cannot lean on its blur, so its
|
|
732
|
+
* fill has to carry the legibility by itself.
|
|
733
|
+
*
|
|
734
|
+
* `backdrop-filter` makes an element a BACKDROP ROOT: a descendant's filter
|
|
735
|
+
* samples that ancestor's painted output, not the page. The composer card is
|
|
736
|
+
* `[data-composer-style="glass"]`, whose own `backdrop-filter:
|
|
737
|
+
* var(--glass-card-filter)` IS the material — so the model dropdown (with the
|
|
738
|
+
* thinking and access panels and the specs card beside it) ran a `blur(24px)`
|
|
739
|
+
* that sampled nothing. Measured on the real dropdown over 6px black/white
|
|
740
|
+
* stripes: inside the card the stripes stayed at min/max `0/255` (variance
|
|
741
|
+
* 16216), while the same panel portalled to `<body>` read `221/224` (variance
|
|
742
|
+
* 0.7). The panel was therefore a straight alpha over RAW content, and a
|
|
743
|
+
* transcript showing through measured `1.47:1` — reported as the composer's
|
|
744
|
+
* model dropdown being "terlalu transparan sehingga teks tidak terlihat ketika
|
|
745
|
+
* di belakannya ada teks juga". Raising the tint alone did not fix it: 92%
|
|
746
|
+
* measured `1.21:1` and 96% `1.10:1`, both still readable in a screenshot.
|
|
747
|
+
*
|
|
748
|
+
* So this tier takes the file's own answer for a surface that is READ: the
|
|
749
|
+
* palette's opaque paper. The sheen, the rim and the bloom still paint at full
|
|
750
|
+
* strength, so it still reads as glass at its edges — which is where a pane is
|
|
751
|
+
* legible anyway.
|
|
752
|
+
*
|
|
753
|
+
* The scope is the composer card ONLY. A popover that hangs in `<body>` (every
|
|
754
|
+
* `AnchoredMenu`, the settings menus) keeps `--glass-popover`: there the blur IS
|
|
755
|
+
* alive, and 84% measured free. A dialog is not the same case either — its own
|
|
756
|
+
* 96% tint and the veil already flatten what it covers, verified with the same
|
|
757
|
+
* stripe probe.
|
|
758
|
+
*/
|
|
759
|
+
[data-surface="glass"] [data-composer-style="glass"] .glass-popover {
|
|
760
|
+
background-color: var(--glass-popover-nested);
|
|
761
|
+
}
|
|
762
|
+
|
|
715
763
|
/* A browser that cannot blur, or a user who asked for less transparency: the
|
|
716
764
|
* opaque palette. `--glass-panel` IS the plane's fill, so overriding it here
|
|
717
765
|
* also fixes the sheen's contrast, which is why the sheen is switched off too.
|
|
@@ -741,6 +789,7 @@
|
|
|
741
789
|
--glass-chrome: var(--theme-paper);
|
|
742
790
|
--glass-overlay: var(--theme-paper);
|
|
743
791
|
--glass-popover: var(--theme-paper);
|
|
792
|
+
--glass-popover-nested: var(--theme-paper);
|
|
744
793
|
--glass-card: var(--theme-paper);
|
|
745
794
|
--glass-stuck: var(--theme-paper);
|
|
746
795
|
--glass-bloom: none;
|
|
@@ -769,6 +818,7 @@
|
|
|
769
818
|
--glass-chrome: var(--theme-paper);
|
|
770
819
|
--glass-overlay: var(--theme-paper);
|
|
771
820
|
--glass-popover: var(--theme-paper);
|
|
821
|
+
--glass-popover-nested: var(--theme-paper);
|
|
772
822
|
--glass-card: var(--theme-paper);
|
|
773
823
|
--glass-stuck: var(--theme-paper);
|
|
774
824
|
--glass-bloom: none;
|
package/src/client/glass.test.ts
CHANGED
|
@@ -9,18 +9,17 @@ import { mixHex } from '@/shared/lib/theme/color';
|
|
|
9
9
|
import { contrastRatio } from '@/shared/lib/theme/legibility';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* The composer's `glass`
|
|
13
|
-
*
|
|
14
|
-
* token
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* it as a transparent composer while `getComputedStyle` on the token returned an
|
|
12
|
+
* The composer's `glass` STYLE is not a surface style: it is offered in the
|
|
13
|
+
* classic look too, where `[data-surface="glass"]` is not set. A `--glass-*`
|
|
14
|
+
* token declared only inside that attribute block therefore does not exist for
|
|
15
|
+
* the composer, and `background-color: var(--glass-card)` silently computes to
|
|
16
|
+
* `rgba(0,0,0,0)` — a card with no fill. That shipped for the length of one
|
|
17
|
+
* edit: a transparent composer while `getComputedStyle` on the token returned an
|
|
19
18
|
* empty string.
|
|
20
19
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* So this asserts the SHAPE of the contract, not one value: every material token
|
|
21
|
+
* the composer rule READS must be declared where the rule can see it — `:root`
|
|
22
|
+
* or a variant block, never only under the surface attribute.
|
|
24
23
|
*/
|
|
25
24
|
const read = (file: string): Promise<string> => Bun.file(new URL(file, import.meta.url)).text();
|
|
26
25
|
|
|
@@ -91,11 +90,11 @@ describe('glass composer material', () => {
|
|
|
91
90
|
});
|
|
92
91
|
|
|
93
92
|
/**
|
|
94
|
-
* The popover tier is the
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
93
|
+
* The popover tier is the composer's argument one size down: a dropdown carrying
|
|
94
|
+
* only a tint reads as a LIFTED BOX, because on a dark palette translucent paper
|
|
95
|
+
* only ever darkens it. Measured on the session-actions menu before the bloom —
|
|
96
|
+
* corner `(56,61,71)` over a body of `(41,44,52)` on a sidebar of `(51,58,67)`,
|
|
97
|
+
* 1.09:1 against what it covers.
|
|
99
98
|
*/
|
|
100
99
|
describe('glass popover material', () => {
|
|
101
100
|
test('the popover adds its own bloom on top of the shared material', async () => {
|
|
@@ -116,8 +115,7 @@ describe('glass popover material', () => {
|
|
|
116
115
|
expect(sharedBody).toContain('background-image: linear-gradient(');
|
|
117
116
|
|
|
118
117
|
// A dialog keeps the sheen and the rim it was measured with: a dialog has
|
|
119
|
-
// prose in the middle, and the bloom
|
|
120
|
-
// corners — which a dialog cannot afford to guess at.
|
|
118
|
+
// prose in the middle, and the bloom stays in the corners.
|
|
121
119
|
expect(tailwind).toContain('[data-composer-style="glass"]');
|
|
122
120
|
});
|
|
123
121
|
|
|
@@ -129,13 +127,62 @@ describe('glass popover material', () => {
|
|
|
129
127
|
expect(menu).toContain('glass-popover fixed');
|
|
130
128
|
expect(list).toContain('glass-popover fixed');
|
|
131
129
|
});
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The `/` and `@` lists are the composer's own popovers and render INSIDE
|
|
133
|
+
* `[data-composer-style="glass"]`, exactly where a blur is dead, so the nested
|
|
134
|
+
* tier has to reach them. The picker is a plain div, not an `AnchoredMenu`, so
|
|
135
|
+
* the tier is a literal in its className — and that class is what makes the
|
|
136
|
+
* list a popover at all in the glass surface.
|
|
137
|
+
*/
|
|
138
|
+
test('the composer picker carries the popover tier', async () => {
|
|
139
|
+
const picker = await read('./components/common/ComposerPicker.tsx');
|
|
140
|
+
expect(picker).toContain('glass-popover');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A popover INSIDE another frosted surface has no working blur:
|
|
145
|
+
* `backdrop-filter` makes its host a backdrop root, so the descendant's filter
|
|
146
|
+
* samples that host, not the page. Measured on the composer's model dropdown
|
|
147
|
+
* over 6px black/white stripes — min/max `0/255` (variance 16216) nested in the
|
|
148
|
+
* glass card against `221/224` (variance 0.7) portalled to `<body>`; text
|
|
149
|
+
* behind it measured `1.47:1` and was still readable at 96%.
|
|
150
|
+
*
|
|
151
|
+
* So the NESTED tier is OPAQUE, scoped to the composer card, so a
|
|
152
|
+
* body-portalled menu keeps its 84% with a live blur.
|
|
153
|
+
*/
|
|
154
|
+
test('a popover nested in a frosted surface is opaque, and only there', async () => {
|
|
155
|
+
const glass = await read('./glass.css');
|
|
156
|
+
const surface = ruleBody(glass, '[data-surface="glass"]');
|
|
157
|
+
const nested = ruleBody(glass, '[data-surface="glass"] [data-composer-style="glass"] .glass-popover');
|
|
158
|
+
|
|
159
|
+
// The rule reads a token, not a literal: a second recipe for the material is
|
|
160
|
+
// the defect every assertion in this file exists to prevent.
|
|
161
|
+
expect(nested).toContain('background-color: var(--glass-popover-nested)');
|
|
162
|
+
// Opaque paper: no blur hides the backdrop, and every percent of transparency
|
|
163
|
+
// is legible text behind a list of model names.
|
|
164
|
+
expect(surface).toContain('--glass-popover-nested: var(--theme-paper);');
|
|
165
|
+
// The blurred tier stays translucent — a body-portalled menu still blurs.
|
|
166
|
+
expect(surface).toContain('--glass-popover: color-mix(');
|
|
167
|
+
|
|
168
|
+
// A browser without `backdrop-filter`, or a reduced-transparency request,
|
|
169
|
+
// resolves every tint to solid paper — the nested token must be in BOTH
|
|
170
|
+
// blocks, or it keeps compositing a translucent panel with nothing behind.
|
|
171
|
+
for (const block of [
|
|
172
|
+
glass.slice(glass.indexOf('@supports not ('), glass.indexOf('@media (prefers-reduced-transparency')),
|
|
173
|
+
glass.slice(glass.indexOf('@media (prefers-reduced-transparency')),
|
|
174
|
+
]) {
|
|
175
|
+
expect(block).toContain('--glass-popover-nested: var(--theme-paper);');
|
|
176
|
+
}
|
|
177
|
+
});
|
|
132
178
|
});
|
|
133
179
|
|
|
134
180
|
/**
|
|
135
181
|
* A workspace column is the same chrome as the sidebar beside it. Every view
|
|
136
|
-
* under it opens with its own `bg-paper` root,
|
|
137
|
-
*
|
|
138
|
-
*
|
|
182
|
+
* under it opens with its own `bg-paper` root, right in the classic look and
|
|
183
|
+
* wrong under the glass surface — measured, the 293px column composited to the
|
|
184
|
+
* palette's solid paper while the sidebar was the plane's chrome ("right panel
|
|
185
|
+
* juga belum glass banget").
|
|
139
186
|
*/
|
|
140
187
|
describe('glass column material', () => {
|
|
141
188
|
test('a workspace column is chrome, and its view roots step aside for it', async () => {
|
|
@@ -143,10 +190,7 @@ describe('glass column material', () => {
|
|
|
143
190
|
read('./glass.css'),
|
|
144
191
|
read('./components/layout/desktop-layout/WorkspacePanels.tsx'),
|
|
145
192
|
]);
|
|
146
|
-
//
|
|
147
|
-
// 293px column composited to solid paper while the sidebar beside it was the
|
|
148
|
-
// plane's chrome — two materials in one window ("right panel juga belum glass
|
|
149
|
-
// banget"). The marker is on the SLOT (one owner), never on each view.
|
|
193
|
+
// The marker is on the SLOT (one owner), never on each view.
|
|
150
194
|
expect(panels).toContain('data-panel-chrome=""');
|
|
151
195
|
expect(panels).toContain('glass-chrome w-full h-full');
|
|
152
196
|
expect(glass).toContain('[data-surface="glass"] [data-panel-chrome] > .bg-paper,');
|
|
@@ -72,7 +72,7 @@ describe('useBrowserPageContextInsert', () => {
|
|
|
72
72
|
test('a plain page lands in the draft as the URL block', () => {
|
|
73
73
|
mountBridge();
|
|
74
74
|
act(() => emitBrowserPageContext({ url: 'https://a.test/x' }));
|
|
75
|
-
expect(draft).toBe('[
|
|
75
|
+
expect(draft).toBe('[Browser page context]\nURL: https://a.test/x\n(Continue from this page.)');
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
test('an annotated page lands as the block with its numbered marks', () => {
|
|
@@ -82,16 +82,16 @@ describe('useBrowserPageContextInsert', () => {
|
|
|
82
82
|
annotations: [{ id: 'a', tool: 'box', start: { x: 0.1, y: 0.1 }, end: { x: 0.2, y: 0.2 }, label: '', note: 'mati' }],
|
|
83
83
|
panel: { width: 1000, height: 500, viewportMode: 'laptop', zoom: 100 },
|
|
84
84
|
}));
|
|
85
|
-
expect(draft).toContain('
|
|
86
|
-
expect(draft).toContain('1.
|
|
87
|
-
expect(draft).toContain('
|
|
85
|
+
expect(draft).toContain('Annotations (1):');
|
|
86
|
+
expect(draft).toContain('1. box left 10.0%, top 10.0%');
|
|
87
|
+
expect(draft).toContain(': mati');
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
test('two events append two blocks rather than overwriting the draft', () => {
|
|
91
91
|
mountBridge();
|
|
92
92
|
act(() => emitBrowserPageContext({ url: 'https://a.test' }));
|
|
93
93
|
act(() => emitBrowserPageContext({ url: 'https://b.test' }));
|
|
94
|
-
expect(draft.match(/\[
|
|
94
|
+
expect(draft.match(/\[Browser page context\]/g)).toHaveLength(2);
|
|
95
95
|
expect(draft).toContain('https://a.test');
|
|
96
96
|
expect(draft).toContain('https://b.test');
|
|
97
97
|
});
|
|
@@ -111,7 +111,7 @@ describe('useBrowserPageContextInsert', () => {
|
|
|
111
111
|
annotations: [{ id: 'a', tool: 'box', start: { x: 1, y: 0 } } as never],
|
|
112
112
|
panel: { width: 1000, height: 500, viewportMode: 'laptop', zoom: 100 },
|
|
113
113
|
}));
|
|
114
|
-
expect(draft).not.toContain('
|
|
114
|
+
expect(draft).not.toContain('Annotations');
|
|
115
115
|
expect(draft).toContain('URL: https://a.test');
|
|
116
116
|
});
|
|
117
117
|
});
|
|
@@ -38,7 +38,7 @@ import type { ComposerDraftState } from '@/client/hooks/chat/composer/use-draft'
|
|
|
38
38
|
import type { SessionStateContextValue } from '@/client/hooks/workspace/session-state/context';
|
|
39
39
|
|
|
40
40
|
const LANDING_ID = '1';
|
|
41
|
-
const SEEDED = '[
|
|
41
|
+
const SEEDED = '[Browser page context]\nURL: http://localhost:7801/\n(Continue from this page.)';
|
|
42
42
|
|
|
43
43
|
let container: HTMLElement | undefined;
|
|
44
44
|
let holder: { api: ComposerDraftState | null };
|
|
@@ -118,7 +118,7 @@ describe('useComposerDraft', () => {
|
|
|
118
118
|
test('an annotation sent at the landing stays out of the persisted draft', () => {
|
|
119
119
|
mount('');
|
|
120
120
|
act(() => emitBrowserPageContext({ url: 'https://a.test/x' }));
|
|
121
|
-
expect(holder.api!.inputValue).toContain('[
|
|
121
|
+
expect(holder.api!.inputValue).toContain('[Browser page context]');
|
|
122
122
|
expect(getSessionValue(LANDING_ID, CHAT_DRAFT_KEY)).toBeUndefined();
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -202,6 +202,42 @@ describe('useOmpPromptSender.sendPrompt', () => {
|
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
+
describe('useOmpPromptSender.sendNewPrompt — ordering', () => {
|
|
206
|
+
const NEW = '/api/agent/new';
|
|
207
|
+
|
|
208
|
+
test('beforePrompt runs after the id exists and before the prompt', async () => {
|
|
209
|
+
const order: string[] = [];
|
|
210
|
+
const requests = installFetch({ [NEW]: { body: { success: true, sessionId: 'omp-5' } } });
|
|
211
|
+
const probe = mountSender(null);
|
|
212
|
+
// One extra hook: the prompt POST is the last call, so its ORDER is what
|
|
213
|
+
// the armed goal depends on — a goal created after it can miss the turn.
|
|
214
|
+
const original = (globalThis as unknown as Record<string, unknown>).fetch as typeof fetch;
|
|
215
|
+
(globalThis as unknown as Record<string, unknown>).fetch = (async (input: unknown, init?: { method?: string; body?: string }) => {
|
|
216
|
+
order.push(String(input));
|
|
217
|
+
return original(input as never, init as never);
|
|
218
|
+
}) as typeof fetch;
|
|
219
|
+
|
|
220
|
+
const result = await probe.sender().sendNewPrompt('first', '/w', undefined, {}, async (sid) => {
|
|
221
|
+
order.push(`goal:${sid}`);
|
|
222
|
+
return false;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
expect(result).toEqual({ sessionId: 'omp-5', model: null });
|
|
226
|
+
expect(order).toEqual([NEW, 'goal:omp-5', '/api/agent/omp-5']);
|
|
227
|
+
expect(requests.length).toBe(2);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('a spawn with no armed goal passes no hook at all', async () => {
|
|
231
|
+
const requests = installFetch({ [NEW]: { body: { success: true, sessionId: 'omp-6' } } });
|
|
232
|
+
const probe = mountSender(null);
|
|
233
|
+
|
|
234
|
+
// The goal-less path: exactly two requests (create + prompt), no third call.
|
|
235
|
+
await probe.sender().sendNewPrompt('first', '/w');
|
|
236
|
+
|
|
237
|
+
expect(requests.map((r) => r.url)).toEqual([NEW, '/api/agent/omp-6']);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
205
241
|
describe('useOmpPromptSender.sendNewPrompt', () => {
|
|
206
242
|
const NEW = '/api/agent/new';
|
|
207
243
|
|
|
@@ -20,7 +20,7 @@ import { useCallback } from 'preact/hooks';
|
|
|
20
20
|
import type { Dispatch, SetStateAction } from 'preact/compat';
|
|
21
21
|
import { setSessionTitleHint } from '@/client/hooks/chat/omp/sidebar-overlay';
|
|
22
22
|
import { redirectToOwningInstance, type SessionOwnerConflict } from '@/client/hooks/chat/omp/owner-redirect';
|
|
23
|
-
import type { AgentImage, OmpAgentState, PromptDispatchResult } from '@/shared/types';
|
|
23
|
+
import type { AgentImage, OmpAgentState, PromptDispatchResult, SpawnOptions, SpawnedSession } from '@/shared/types';
|
|
24
24
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
25
25
|
|
|
26
26
|
export interface OmpPromptSenderDeps {
|
|
@@ -37,16 +37,19 @@ export interface OmpPromptSender {
|
|
|
37
37
|
message: string,
|
|
38
38
|
cwd: string,
|
|
39
39
|
images?: AgentImage[],
|
|
40
|
-
composerOptions?:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
composerOptions?: SpawnOptions,
|
|
41
|
+
/**
|
|
42
|
+
* Runs once the session exists and its stream is attached, BEFORE the
|
|
43
|
+
* prompt is dispatched. The armed goal is started here: the record must
|
|
44
|
+
* exist before the turn it belongs to starts, and this is the only moment
|
|
45
|
+
* that is both after the id exists and before the prompt.
|
|
46
|
+
*
|
|
47
|
+
* Resolves TRUE when it CONSUMED the prompt — an armed interview renders
|
|
48
|
+
* its own opening turn with the operator's words folded in, so dispatching
|
|
49
|
+
* the raw message after it would be a second turn asking the same thing.
|
|
50
|
+
*/
|
|
51
|
+
beforePrompt?: (sessionId: string) => Promise<boolean>,
|
|
52
|
+
) => Promise<SpawnedSession | null>;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
@@ -118,13 +121,9 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
118
121
|
message: string,
|
|
119
122
|
cwd: string,
|
|
120
123
|
images?: AgentImage[],
|
|
121
|
-
composerOptions?:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
accessMode?: ApprovalMode;
|
|
125
|
-
modes?: { plan: boolean; goal: boolean } | null;
|
|
126
|
-
},
|
|
127
|
-
): Promise<{ sessionId: string; model: { provider: string; modelId: string } | null } | null> => {
|
|
124
|
+
composerOptions?: SpawnOptions,
|
|
125
|
+
beforePrompt?: (sessionId: string) => Promise<boolean>,
|
|
126
|
+
): Promise<SpawnedSession | null> => {
|
|
128
127
|
setState((prev) => ({ ...prev, isGenerating: true, error: null }));
|
|
129
128
|
// The real id does not exist until `ensure_session` answers, so the mark
|
|
130
129
|
// can only be armed past that point — the spawn itself is covered by the
|
|
@@ -162,6 +161,13 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
162
161
|
// first assistant message), so until then the row would read
|
|
163
162
|
// `New Session - <clock>`. A hint only — the real row supersedes it.
|
|
164
163
|
setSessionTitleHint(sid, message);
|
|
164
|
+
// The goal (when one is armed) is STARTED HERE — after the id exists,
|
|
165
|
+
// before the prompt — so the prompt below is its first turn. Awaiting it
|
|
166
|
+
// is what makes the order a fact rather than a race. An armed interview
|
|
167
|
+
// answers true: it already opened the turn, so this prompt is not sent.
|
|
168
|
+
if (beforePrompt && await beforePrompt(sid)) {
|
|
169
|
+
return { sessionId: sid, model: createdBody.model ?? null };
|
|
170
|
+
}
|
|
165
171
|
const res = await fetch(`/api/agent/${encodeURIComponent(sid)}`, {
|
|
166
172
|
method: 'POST',
|
|
167
173
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -50,6 +50,17 @@ export interface SidebarDataHandle {
|
|
|
50
50
|
isMock: boolean;
|
|
51
51
|
/** True only before the first snapshot lands — drives the skeleton. */
|
|
52
52
|
initializing: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The first snapshot never arrived and the channel is not connected: the
|
|
55
|
+
* list has no data and no answer is coming on its own.
|
|
56
|
+
*
|
|
57
|
+
* This is what separates "still loading" from "failed", and before it existed
|
|
58
|
+
* the sidebar could only tell them apart by waiting — measured with `/api/**`
|
|
59
|
+
* aborted, the skeleton was still drawn after seven seconds with no message,
|
|
60
|
+
* no retry and no `role="alert"`. A UI that cannot say "this did not work" is
|
|
61
|
+
* an unfinished UI, so the state is a field rather than an inferred flag.
|
|
62
|
+
*/
|
|
63
|
+
failed: boolean;
|
|
53
64
|
/** True when the socket is down or a sequence gap was seen. */
|
|
54
65
|
stale: boolean;
|
|
55
66
|
/**
|
|
@@ -100,81 +111,20 @@ export interface SidebarDataHandle {
|
|
|
100
111
|
|
|
101
112
|
const SidebarDataContext = createContext<SidebarDataHandle | null>(null);
|
|
102
113
|
|
|
103
|
-
|
|
104
|
-
function mergeStatus(
|
|
105
|
-
folders: WorkspaceFolderData[],
|
|
106
|
-
status: SidebarStatusPayload | null,
|
|
107
|
-
): WorkspaceFolderData[] {
|
|
108
|
-
if (!status) return folders;
|
|
109
|
-
return folders.map((folder) => ({
|
|
110
|
-
...folder,
|
|
111
|
-
sessions: (folder.sessions ?? []).map((session) => {
|
|
112
|
-
const volatile = status[String(session.id)];
|
|
113
|
-
return volatile ? { ...session, ...volatile } : session;
|
|
114
|
-
}),
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Advance each row's live fields from the activity payload.
|
|
120
|
-
*
|
|
121
|
-
* `sidebar:activity` carries only the RUNNING sessions (see its doc), so an id
|
|
122
|
-
* it does not name keeps whatever the structure gave it. Three rules, each of
|
|
123
|
-
* which is a way this can go wrong:
|
|
124
|
-
*
|
|
125
|
-
* - the `updated_at` comparison is what makes two sources safe to
|
|
126
|
-
* interleave: the structure is re-scanned at every turn boundary and may
|
|
127
|
-
* already carry a stamp this payload has not caught up with, and a late
|
|
128
|
-
* activity frame must never move a row BACKWARDS (that reorders the
|
|
129
|
-
* sidebar under the reader);
|
|
130
|
-
* - `hasSubagents` only ever turns ON, because the payload is a live read of
|
|
131
|
-
* what is on disk and a subagent transcript does not disappear when its run
|
|
132
|
-
* ends — a `false` here is "not seen yet", not "none exist";
|
|
133
|
-
* - nothing else is touched. Every other field of a row changes on a
|
|
134
|
-
* STRUCTURAL event, and those publish the structure for their own reason.
|
|
135
|
-
*/
|
|
136
|
-
function mergeActivity(
|
|
137
|
-
folders: WorkspaceFolderData[],
|
|
138
|
-
activity: SidebarActivityPayload | null,
|
|
139
|
-
): WorkspaceFolderData[] {
|
|
140
|
-
if (!activity) return folders;
|
|
141
|
-
let changed = false;
|
|
142
|
-
const merged = folders.map((folder) => ({
|
|
143
|
-
...folder,
|
|
144
|
-
sessions: (folder.sessions ?? []).map((session) => {
|
|
145
|
-
const live = activity[String(session.id)];
|
|
146
|
-
if (!live) return session;
|
|
147
|
-
const updated_at = live.updatedAt && isNewerStamp(live.updatedAt, session.updated_at)
|
|
148
|
-
? live.updatedAt
|
|
149
|
-
: session.updated_at;
|
|
150
|
-
const hasSubagents = session.hasSubagents || live.hasSubagents === true;
|
|
151
|
-
if (updated_at === session.updated_at && hasSubagents === Boolean(session.hasSubagents)) return session;
|
|
152
|
-
changed = true;
|
|
153
|
-
return { ...session, updated_at, hasSubagents };
|
|
154
|
-
}),
|
|
155
|
-
}));
|
|
156
|
-
// A stable identity matters: the sidebar's own `useMemo` chain (filter, sort,
|
|
157
|
-
// pending overlay) keys on this array, and returning a fresh one per activity
|
|
158
|
-
// frame would re-sort 731 rows for a stamp that did not move.
|
|
159
|
-
return changed ? merged : folders;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** Whether `next` is a later ISO stamp than `current`. An absent current is older. */
|
|
163
|
-
function isNewerStamp(next: string, current?: string): boolean {
|
|
164
|
-
if (!current) return true;
|
|
165
|
-
const nextMs = Date.parse(next);
|
|
166
|
-
const currentMs = Date.parse(current);
|
|
167
|
-
// An unparseable value on either side is not evidence of a newer stamp; the
|
|
168
|
-
// structure's own field stays authoritative.
|
|
169
|
-
if (!Number.isFinite(nextMs) || !Number.isFinite(currentMs)) return false;
|
|
170
|
-
return nextMs > currentMs;
|
|
171
|
-
}
|
|
114
|
+
import { mergeActivity, mergeStatus } from '@/client/hooks/chat/omp/session-merges';
|
|
172
115
|
|
|
173
116
|
export function SidebarDataProvider({ children, initialFolders = [] }: { children: ReactNode; initialFolders?: WorkspaceFolderData[] }) {
|
|
174
117
|
const structure = useRealtimeTopic<SidebarPayload>(TOPIC_SIDEBAR);
|
|
175
118
|
const status = useRealtimeTopic<SidebarStatusPayload>(TOPIC_SIDEBAR_STATUS);
|
|
176
119
|
const activity = useRealtimeTopic<SidebarActivityPayload>(TOPIC_SIDEBAR_ACTIVITY);
|
|
177
120
|
|
|
121
|
+
// "Loading" is only true while an answer is still plausible. The channel
|
|
122
|
+
// reports its own verdict, so a socket that closed before the first snapshot
|
|
123
|
+
// is a FAILED read rather than an eternal skeleton: measured with `/api/**`
|
|
124
|
+
// aborted, the drawer drew placeholders forever with nothing on screen saying
|
|
125
|
+
// why and no control to try again.
|
|
126
|
+
const failed = structure.data === null && structure.status === 'closed';
|
|
127
|
+
|
|
178
128
|
// Session ids whose badge the user has already dismissed on this mount.
|
|
179
129
|
// Optimistic strip: keeps the click→disappearance instant and stops the
|
|
180
130
|
// pending ack effect in useSessionStatusAck from double-POSTing.
|
|
@@ -310,6 +260,7 @@ export function SidebarDataProvider({ children, initialFolders = [] }: { childre
|
|
|
310
260
|
streamStatusMap,
|
|
311
261
|
isMock,
|
|
312
262
|
initializing,
|
|
263
|
+
failed,
|
|
313
264
|
stale: structure.stale || status.stale,
|
|
314
265
|
refresh,
|
|
315
266
|
refreshNow,
|
|
@@ -320,7 +271,7 @@ export function SidebarDataProvider({ children, initialFolders = [] }: { childre
|
|
|
320
271
|
titleHint: (id) => (id === null || id === undefined ? undefined : titleHintRef.current.get(String(id))),
|
|
321
272
|
};
|
|
322
273
|
// `overlayVersion` is the re-render trigger for the two refs above.
|
|
323
|
-
}, [folders, isMock, initializing, structure.stale, status.stale, structure.refreshing, refresh, refreshNow, refreshing, isRefreshing, markSeen, overlayVersion]);
|
|
274
|
+
}, [folders, isMock, initializing, failed, structure.stale, status.stale, structure.refreshing, refresh, refreshNow, refreshing, isRefreshing, markSeen, overlayVersion]);
|
|
324
275
|
|
|
325
276
|
return <SidebarDataContext.Provider value={value}>{children}</SidebarDataContext.Provider>;
|
|
326
277
|
}
|
|
@@ -337,6 +288,9 @@ export function useSidebarData(): SidebarDataHandle {
|
|
|
337
288
|
streamStatusMap: {},
|
|
338
289
|
isMock: false,
|
|
339
290
|
initializing: true,
|
|
291
|
+
// No provider means no channel was ever asked; claiming a failure would be
|
|
292
|
+
// a guess, and the honest state is still "loading".
|
|
293
|
+
failed: false,
|
|
340
294
|
stale: false,
|
|
341
295
|
refresh: () => {},
|
|
342
296
|
refreshNow: () => {},
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The three MERGES the session list performs on a server snapshot, split out of
|
|
8
|
+
* `session-list.tsx` so the provider stays under the repo's size ceiling.
|
|
9
|
+
*
|
|
10
|
+
* Each one is a pure folder array in, folder array out, and each has the same
|
|
11
|
+
* contract: return the SAME array when nothing moved. That identity is what the
|
|
12
|
+
* sidebar's memo chain (filter, sort, pending overlay) keys on — returning a
|
|
13
|
+
* fresh array per activity frame re-sorted 731 rows for a stamp that had not
|
|
14
|
+
* changed.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { WorkspaceFolderData } from '@/shared/types';
|
|
18
|
+
import type { SidebarActivityPayload, SidebarStatusPayload } from '@/shared/types/realtime';
|
|
19
|
+
|
|
20
|
+
/** Merge a structure payload with the volatile map, by session id. */
|
|
21
|
+
export function mergeStatus(
|
|
22
|
+
folders: WorkspaceFolderData[],
|
|
23
|
+
status: SidebarStatusPayload | null,
|
|
24
|
+
): WorkspaceFolderData[] {
|
|
25
|
+
if (!status) return folders;
|
|
26
|
+
return folders.map((folder) => ({
|
|
27
|
+
...folder,
|
|
28
|
+
sessions: (folder.sessions ?? []).map((session) => {
|
|
29
|
+
const volatile = status[String(session.id)];
|
|
30
|
+
return volatile ? { ...session, ...volatile } : session;
|
|
31
|
+
}),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Advance each row's live fields from the activity payload.
|
|
37
|
+
*
|
|
38
|
+
* `sidebar:activity` carries only the RUNNING sessions (see its doc), so an id
|
|
39
|
+
* it does not name keeps whatever the structure gave it. Three rules, each of
|
|
40
|
+
* which is a way this can go wrong:
|
|
41
|
+
*
|
|
42
|
+
* - the `updated_at` comparison is what makes two sources safe to
|
|
43
|
+
* interleave: the structure is re-scanned at every turn boundary and may
|
|
44
|
+
* already carry a stamp this payload has not caught up with, and a late
|
|
45
|
+
* activity frame must never move a row BACKWARDS (that reorders the
|
|
46
|
+
* sidebar under the reader);
|
|
47
|
+
* - `hasSubagents` only ever turns ON, because the payload is a live read of
|
|
48
|
+
* what is on disk and a subagent transcript does not disappear when its run
|
|
49
|
+
* ends — a `false` here is "not seen yet", not "none exist";
|
|
50
|
+
* - nothing else is touched. Every other field of a row changes on a
|
|
51
|
+
* STRUCTURAL event, and those publish the structure for their own reason.
|
|
52
|
+
*/
|
|
53
|
+
export function mergeActivity(
|
|
54
|
+
folders: WorkspaceFolderData[],
|
|
55
|
+
activity: SidebarActivityPayload | null,
|
|
56
|
+
): WorkspaceFolderData[] {
|
|
57
|
+
if (!activity) return folders;
|
|
58
|
+
let changed = false;
|
|
59
|
+
const merged = folders.map((folder) => ({
|
|
60
|
+
...folder,
|
|
61
|
+
sessions: (folder.sessions ?? []).map((session) => {
|
|
62
|
+
const live = activity[String(session.id)];
|
|
63
|
+
if (!live) return session;
|
|
64
|
+
const updated_at = live.updatedAt && isNewerStamp(live.updatedAt, session.updated_at)
|
|
65
|
+
? live.updatedAt
|
|
66
|
+
: session.updated_at;
|
|
67
|
+
const hasSubagents = session.hasSubagents || live.hasSubagents === true;
|
|
68
|
+
if (updated_at === session.updated_at && hasSubagents === Boolean(session.hasSubagents)) return session;
|
|
69
|
+
changed = true;
|
|
70
|
+
return { ...session, updated_at, hasSubagents };
|
|
71
|
+
}),
|
|
72
|
+
}));
|
|
73
|
+
// A stable identity matters: the sidebar's own `useMemo` chain (filter, sort,
|
|
74
|
+
// pending overlay) keys on this array, and returning a fresh one per activity
|
|
75
|
+
// frame would re-sort 731 rows for a stamp that did not move.
|
|
76
|
+
return changed ? merged : folders;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Whether `next` is a later ISO stamp than `current`. An absent current is older. */
|
|
80
|
+
export function isNewerStamp(next: string, current?: string): boolean {
|
|
81
|
+
if (!current) return true;
|
|
82
|
+
const nextMs = Date.parse(next);
|
|
83
|
+
const currentMs = Date.parse(current);
|
|
84
|
+
// An unparseable value on either side is not evidence of a newer stamp; the
|
|
85
|
+
// structure's own field stays authoritative.
|
|
86
|
+
if (!Number.isFinite(nextMs) || !Number.isFinite(currentMs)) return false;
|
|
87
|
+
return nextMs > currentMs;
|
|
88
|
+
}
|
|
89
|
+
|
|
@@ -61,6 +61,8 @@ export interface SessionSidebarControllerOptions {
|
|
|
61
61
|
export interface SessionSidebarController {
|
|
62
62
|
folders: WorkspaceFolderData[];
|
|
63
63
|
initializing: boolean;
|
|
64
|
+
/** The first read failed; the list has no data and no reply is coming. */
|
|
65
|
+
failed: boolean;
|
|
64
66
|
refresh: () => void;
|
|
65
67
|
/** User-initiated refresh — raises `refreshing` until that load settles. */
|
|
66
68
|
refreshNow: () => void;
|
|
@@ -88,7 +90,7 @@ export function useSessionSidebarController(
|
|
|
88
90
|
options: SessionSidebarControllerOptions = {},
|
|
89
91
|
): SessionSidebarController {
|
|
90
92
|
const { expandSearchMatches = false, onSelectSession, onAfterSelect } = options;
|
|
91
|
-
const { folders, initializing, refresh, refreshNow, refreshing, isRefreshing, markSeen, hasSeen, streamStatusMap, titleHint } = useSidebarData();
|
|
93
|
+
const { folders, initializing, failed, refresh, refreshNow, refreshing, isRefreshing, markSeen, hasSeen, streamStatusMap, titleHint } = useSidebarData();
|
|
92
94
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
93
95
|
const sessionParam = searchParams.get('sessionId');
|
|
94
96
|
// Read as a string, never off the `searchParams` object: `useSearchParams`
|
|
@@ -313,6 +315,7 @@ export function useSessionSidebarController(
|
|
|
313
315
|
return {
|
|
314
316
|
folders,
|
|
315
317
|
initializing,
|
|
318
|
+
failed,
|
|
316
319
|
refresh: revalidate,
|
|
317
320
|
refreshNow,
|
|
318
321
|
refreshing,
|