@kabmo-labs/kabmo 0.27.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 +495 -467
- package/dist/client/static/js/index-81f7berm.css +1 -0
- package/dist/client/static/js/{index-e3qh2yps.js → index-xzvyrxya.js} +795 -795
- 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/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/session-sidebar/CategoryItem.tsx +2 -1
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +9 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +2 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +202 -0
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +80 -19
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +23 -3
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +3 -0
- 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/Item.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +6 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +9 -1
- package/src/client/components/settings/Modal.tsx +6 -2
- package/src/client/components/settings/Sidebar.tsx +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/workspace/chat-timeline/AiMessageFooter.fork.test.ts +24 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +8 -4
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +34 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +3 -2
- package/src/client/components/workspace/chat-timeline/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/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/index.tsx +11 -5
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +1 -9
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +101 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +2 -2
- 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/terminal-panel/RealtimeTerminalView.tsx +9 -1
- package/src/client/components/workspace/terminal-panel/focus.test.ts +70 -0
- package/src/client/components/workspace/terminal-panel/focus.ts +46 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +14 -1
- package/src/client/components/workspace/terminal-panel/mount.ts +17 -9
- package/src/client/components/workspace/terminal-panel/scroll-hold.test.ts +158 -0
- package/src/client/components/workspace/terminal-panel/scroll-hold.ts +136 -0
- package/src/client/hooks/chat/composer/use-draft.ts +45 -1
- package/src/client/hooks/chat/omp/pending-sessions.waiting.test.ts +11 -10
- package/src/client/hooks/chat/omp/pending-waiting.ts +15 -7
- package/src/client/hooks/chat/omp/prompt-send.test.ts +11 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +3 -0
- package/src/client/hooks/chat/timeline/actions.ts +4 -4
- package/src/client/hooks/chat/timeline/composer-modes.ts +13 -2
- package/src/client/hooks/chat/timeline/fork-open.ts +52 -0
- package/src/client/hooks/chat/timeline/index.ts +5 -2
- package/src/client/hooks/chat/timeline/mode-availability.ts +7 -0
- package/src/client/hooks/chat/timeline/modes-contract.ts +6 -0
- package/src/client/hooks/chat/timeline/modes-hydrate.ts +93 -0
- package/src/client/hooks/chat/timeline/modes.ts +32 -52
- package/src/client/hooks/chat/timeline/new-chat-open.ts +7 -6
- package/src/client/hooks/chat/timeline/new-chat.ts +10 -1
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +4 -0
- package/src/client/hooks/chat/timeline/pending-session-mode.test.ts +136 -0
- package/src/client/hooks/chat/timeline/pending-session-mode.ts +69 -0
- package/src/client/hooks/chat/timeline/pending-warmup.test.ts +147 -0
- package/src/client/hooks/chat/timeline/pending-warmup.ts +62 -0
- package/src/client/hooks/chat/timeline/run-identity.test.ts +12 -0
- package/src/client/hooks/chat/timeline/run-identity.ts +4 -1
- package/src/client/hooks/chat/timeline/send-props.ts +2 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +1 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +1 -0
- package/src/client/hooks/chat/timeline/send.test.ts +1 -0
- package/src/client/hooks/chat/timeline/session-harness.ts +4 -0
- package/src/client/hooks/chat/timeline/use-fork-session.ts +9 -22
- package/src/client/hooks/chat/waiting/cancel.ts +13 -6
- package/src/client/hooks/chat/waiting/choice.ts +13 -16
- package/src/client/hooks/chat/waiting/composer-wait.ts +70 -0
- package/src/client/hooks/chat/waiting/dispatch.ts +48 -28
- package/src/client/hooks/chat/waiting/held.ts +37 -13
- package/src/client/hooks/chat/waiting/hold.test.ts +22 -0
- package/src/client/hooks/chat/waiting/hold.ts +20 -11
- package/src/client/hooks/chat/waiting/restore.test.ts +69 -0
- package/src/client/hooks/chat/waiting/restore.ts +34 -0
- package/src/client/hooks/chat/waiting/store.ts +9 -3
- package/src/client/hooks/editor/file-editor-types.ts +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/ui/notifications.ts +17 -8
- package/src/client/hooks/workspace/panel-registry.ts +1 -1
- package/src/client/hooks/workspace/scheduled-tasks.ts +26 -11
- package/src/client/lib/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/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/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/workspace/refresh-cadence.test.ts +25 -1
- package/src/shared/lib/workspace/relative-time.ts +16 -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-32rpkj6b.css +0 -1
- package/src/client/hooks/editor/use-external-change-notice.ts +0 -71
- package/src/client/hooks/editor/use-external-change.test.ts +0 -88
- package/src/client/hooks/editor/use-external-change.ts +0 -146
|
@@ -3,6 +3,7 @@ import { useMemo } from 'preact/hooks';
|
|
|
3
3
|
import { memo } from 'preact/compat';
|
|
4
4
|
import { AlertCircle, Bot, GitFork, Info, MessageSquarePlus, Undo2, User } from 'lucide-preact';
|
|
5
5
|
import type { Attachment, ChatMessageData } from '@/shared/types';
|
|
6
|
+
import { canForkAt, type ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
|
|
6
7
|
import { toAttachmentList } from '@/shared/lib/chat/attachments';
|
|
7
8
|
import { ThinkingSection } from '@/client/components/workspace/chat-timeline/ThinkingSection';
|
|
8
9
|
import { ToolCallingSection } from '@/client/components/workspace/chat-timeline/ToolCallingSection';
|
|
@@ -30,7 +31,10 @@ interface ChatMessageItemProps {
|
|
|
30
31
|
*/
|
|
31
32
|
onNewChat?: (content: string, attachments?: Attachment[]) => void;
|
|
32
33
|
/** Branch the chat before/at this row. Absent draws no button. */
|
|
33
|
-
onFork?: (msgId: string) => void;
|
|
34
|
+
onFork?: (msgId: string, role: ForkAnchorRole) => void;
|
|
35
|
+
/** The agent behind this chat; a harness that cannot fork at a user row
|
|
36
|
+
* draws no Fork button here. */
|
|
37
|
+
harness?: string;
|
|
34
38
|
|
|
35
39
|
/** Extra classes on the root wrapper (e.g. spacing between messages). */
|
|
36
40
|
className?: string;
|
|
@@ -55,12 +59,14 @@ export const ChatMessageItem = memo(function ChatMessageItem({
|
|
|
55
59
|
onUndo,
|
|
56
60
|
onNewChat,
|
|
57
61
|
onFork,
|
|
62
|
+
harness,
|
|
58
63
|
className = '',
|
|
59
64
|
isPrevAssistant = false,
|
|
60
65
|
userActions = true,
|
|
61
66
|
isMobile = false,
|
|
62
67
|
}: ChatMessageItemProps) {
|
|
63
68
|
const isUser = msg.role === 'user';
|
|
69
|
+
const canFork = Boolean(onFork) && canForkAt(harness, 'user');
|
|
64
70
|
|
|
65
71
|
/** A notice row renders as a card. When omp diverted the turn's answer into
|
|
66
72
|
* `notice` instead, the row is an answer (it kept the turn's own metadata)
|
|
@@ -161,7 +167,7 @@ export const ChatMessageItem = memo(function ChatMessageItem({
|
|
|
161
167
|
{/* Fork Button — branches the session at this row, leaving the
|
|
162
168
|
source untouched. Separate from New Chat: a fork carries the
|
|
163
169
|
history, a new chat does not. */}
|
|
164
|
-
{userActions &&
|
|
170
|
+
{userActions && canFork && (
|
|
165
171
|
<button
|
|
166
172
|
type="button"
|
|
167
173
|
className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
|
|
@@ -169,7 +175,7 @@ export const ChatMessageItem = memo(function ChatMessageItem({
|
|
|
169
175
|
aria-label="Fork this session from this message"
|
|
170
176
|
onClick={(e) => {
|
|
171
177
|
e.preventDefault();
|
|
172
|
-
onFork(msg.id);
|
|
178
|
+
onFork?.(msg.id, 'user');
|
|
173
179
|
}}
|
|
174
180
|
>
|
|
175
181
|
<GitFork size={12} />
|
|
@@ -11,6 +11,7 @@ import { previousNonNoticeIndex, resolveRunFooters, streamingRowIndex } from '@/
|
|
|
11
11
|
import { groupTraceRows } from '@/shared/lib/chat/timeline/trace-groups';
|
|
12
12
|
import type { TimelineRowWindow } from '@/client/hooks/chat/timeline/row-window';
|
|
13
13
|
import type { Attachment, ChatMessageData } from '@/shared/types';
|
|
14
|
+
import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
|
|
14
15
|
|
|
15
16
|
export interface MessageListProps {
|
|
16
17
|
messages: ChatMessageData[];
|
|
@@ -29,7 +30,7 @@ export interface MessageListProps {
|
|
|
29
30
|
/** Seeds a new chat from a row. A user row also hands over its attachments. */
|
|
30
31
|
onNewChat?: (content: string, attachments?: Attachment[]) => void;
|
|
31
32
|
/** Branch the session at a user row. */
|
|
32
|
-
onFork?: (msgId: string) => void;
|
|
33
|
+
onFork?: (msgId: string, role: ForkAnchorRole) => void;
|
|
33
34
|
isMobile?: boolean;
|
|
34
35
|
/**
|
|
35
36
|
* Whether chat-owning actions render: a USER row's Undo / Fork / New-chat,
|
|
@@ -143,6 +144,7 @@ export const MessageList = memo(function MessageList({
|
|
|
143
144
|
onUndo={onUndo}
|
|
144
145
|
onNewChat={onNewChat}
|
|
145
146
|
onFork={onFork}
|
|
147
|
+
{...(harness ? { harness } : {})}
|
|
146
148
|
isPrevAssistant={isPrevAssistant}
|
|
147
149
|
userActions={userActions}
|
|
148
150
|
isMobile={isMobile}
|
|
@@ -2,6 +2,7 @@ import type { Attachment, ChatMessageData } from '@/shared/types';
|
|
|
2
2
|
import { AiMessageFooter } from '@/client/components/workspace/chat-timeline/AiMessageFooter';
|
|
3
3
|
import { messageAnswerText } from '@/shared/lib/chat/notice-row';
|
|
4
4
|
import { formatMessageStamp } from '@/shared/lib/format/time';
|
|
5
|
+
import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
|
|
5
6
|
|
|
6
7
|
interface RunFooterProps {
|
|
7
8
|
/** The run's last real AI message (`RunFooterSlot.msg`). */
|
|
@@ -36,7 +37,7 @@ interface RunFooterProps {
|
|
|
36
37
|
* (`msg.id`), never `retryTargetId`: the opening user row would fork BEFORE
|
|
37
38
|
* the answer, while the footer sits under it.
|
|
38
39
|
*/
|
|
39
|
-
onFork?: (msgId: string) => void;
|
|
40
|
+
onFork?: (msgId: string, role: ForkAnchorRole) => void;
|
|
40
41
|
/** Mobile uses a compact provider/model footer with a bottom-sheet menu. */
|
|
41
42
|
isMobile?: boolean;
|
|
42
43
|
/**
|
|
@@ -6,6 +6,7 @@ import { MobileTurnJump } from '@/client/components/workspace/chat-timeline/Mobi
|
|
|
6
6
|
import { LoadingOlderIndicator } from '@/client/components/workspace/chat-timeline/SessionSkeleton';
|
|
7
7
|
import { OrphanAsks } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks';
|
|
8
8
|
import type { Attachment, ChatMessageData, UserTurnRef } from '@/shared/types';
|
|
9
|
+
import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
|
|
9
10
|
|
|
10
11
|
interface TimelineBodyProps {
|
|
11
12
|
isMobile: boolean;
|
|
@@ -35,7 +36,7 @@ interface TimelineBodyProps {
|
|
|
35
36
|
onUndo: (id: string, content?: string) => void;
|
|
36
37
|
onRetry: (id: string) => void;
|
|
37
38
|
onNewChat: (content: string, attachments?: Attachment[]) => void;
|
|
38
|
-
onFork?: (msgId: string) => void;
|
|
39
|
+
onFork?: (msgId: string, role: ForkAnchorRole) => void;
|
|
39
40
|
showScrollBottom: boolean;
|
|
40
41
|
jumpToBottom: (behavior?: ScrollBehavior) => void;
|
|
41
42
|
/** Which rows of `messages` are mounted (see `useTimelineRowWindow`). */
|
|
@@ -21,6 +21,7 @@ import type { AIModelOption, Attachment } from '@/shared/types';
|
|
|
21
21
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
22
22
|
import type { ComposerRow } from '@/shared/lib/chat/composer/style';
|
|
23
23
|
import type { ComposerModes } from '@/client/components/workspace/chat-timeline/chat-input/modes-props';
|
|
24
|
+
import type { WaitingCandidate } from '@/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker';
|
|
24
25
|
import type { ComposerPickerPlacement } from '@/client/components/common/ComposerPicker';
|
|
25
26
|
import { AttachmentToolbar } from '@/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar';
|
|
26
27
|
import { ComposerNotice } from '@/client/components/workspace/chat-timeline/chat-input/ComposerNotice';
|
|
@@ -85,6 +86,12 @@ export interface ComposerRowsInput {
|
|
|
85
86
|
voiceListening?: boolean;
|
|
86
87
|
voiceBusy?: boolean;
|
|
87
88
|
onVoiceToggle?: () => void;
|
|
89
|
+
/** "Wait for session": the pick and the sessions it may name. */
|
|
90
|
+
waiting?: {
|
|
91
|
+
value: WaitingCandidate | null;
|
|
92
|
+
candidates: WaitingCandidate[];
|
|
93
|
+
onChange: (candidate: WaitingCandidate | null) => void;
|
|
94
|
+
};
|
|
88
95
|
/** Which harness runs this chat, and whether the tab strip may change it. */
|
|
89
96
|
harness?: string;
|
|
90
97
|
harnessEditable?: boolean;
|
|
@@ -180,6 +187,7 @@ export function composerRows({
|
|
|
180
187
|
voiceBusy={input.voiceBusy}
|
|
181
188
|
onVoiceToggle={input.onVoiceToggle}
|
|
182
189
|
text={input.value}
|
|
190
|
+
{...(input.waiting ? { waiting: input.waiting } : {})}
|
|
183
191
|
harness={input.harness}
|
|
184
192
|
harnessEditable={input.harnessEditable}
|
|
185
193
|
onSelectHarness={input.onSelectHarness}
|
package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx
CHANGED
|
@@ -82,4 +82,13 @@ describe('SessionModeDropdown', () => {
|
|
|
82
82
|
expect(picks).toEqual(['code']);
|
|
83
83
|
expect(el.querySelector('[role="listbox"]')).toBeNull();
|
|
84
84
|
});
|
|
85
|
+
|
|
86
|
+
test('a chat that has not spawned says "Mode", not an empty chip', async () => {
|
|
87
|
+
// The ladder comes from the harness probe, which names the values but not
|
|
88
|
+
// always which one is current; an empty label read as a broken control
|
|
89
|
+
// beside a working list.
|
|
90
|
+
const el = await mount({ currentValue: '', values: TWO_MODES.values });
|
|
91
|
+
const trigger = el.querySelector('button[aria-haspopup="listbox"]');
|
|
92
|
+
expect(trigger?.getAttribute('aria-label')).toBe('Session mode: Mode');
|
|
93
|
+
});
|
|
85
94
|
});
|
|
@@ -35,7 +35,10 @@ export function SessionModeDropdown({ mode, pending, onSelect }: SessionModeDrop
|
|
|
35
35
|
|
|
36
36
|
if (!mode || mode.values.length < 2) return null;
|
|
37
37
|
const current = mode.values.find((choice) => choice.value === mode.currentValue);
|
|
38
|
-
|
|
38
|
+
// A chat that has not spawned yet has no live selector to ask: the probe names
|
|
39
|
+
// the ladder but not always which value is current, and an empty label read as
|
|
40
|
+
// a broken chip beside a working list.
|
|
41
|
+
const label = current?.name ?? (mode.currentValue || 'Mode');
|
|
39
42
|
|
|
40
43
|
return (
|
|
41
44
|
<div className="relative" ref={ref}>
|
|
@@ -5,6 +5,7 @@ import { ThinkingLevelDropdown } from '@/client/components/workspace/chat-timeli
|
|
|
5
5
|
import { AccessDropdown } from '@/client/components/workspace/chat-timeline/chat-input/AccessDropdown';
|
|
6
6
|
import { ModeToggles } from '@/client/components/workspace/chat-timeline/chat-input/ModeToggles';
|
|
7
7
|
import { PluginComposerActions } from '@/client/components/workspace/chat-timeline/chat-input/PluginComposerSlots';
|
|
8
|
+
import { WaitingDependencyPicker, type WaitingCandidate } from '@/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker';
|
|
8
9
|
import type { ComposerModes } from '@/client/components/workspace/chat-timeline/chat-input/modes-props';
|
|
9
10
|
import { DEFAULT_APPROVAL_MODE, type ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
10
11
|
|
|
@@ -53,6 +54,16 @@ export interface ComposerToolbarProps {
|
|
|
53
54
|
onVoiceToggle?: () => void;
|
|
54
55
|
/** The draft, handed to a plugin `composerAction` at render time. */
|
|
55
56
|
text?: string;
|
|
57
|
+
/**
|
|
58
|
+
* "Wait for session" for the NEXT prompt: the pick, the sessions it may name,
|
|
59
|
+
* and the setter. Mounted at the FAR RIGHT of this row, before the action
|
|
60
|
+
* pair — the same control the draft row shows on a chat that has not started.
|
|
61
|
+
*/
|
|
62
|
+
waiting?: {
|
|
63
|
+
value: WaitingCandidate | null;
|
|
64
|
+
candidates: WaitingCandidate[];
|
|
65
|
+
onChange: (candidate: WaitingCandidate | null) => void;
|
|
66
|
+
};
|
|
56
67
|
/** Which harness runs this chat, and whether the tab strip may change it. */
|
|
57
68
|
harness?: string;
|
|
58
69
|
harnessEditable?: boolean;
|
|
@@ -125,6 +136,7 @@ export function ComposerToolbar({
|
|
|
125
136
|
voiceBusy,
|
|
126
137
|
onVoiceToggle,
|
|
127
138
|
text = '',
|
|
139
|
+
waiting,
|
|
128
140
|
harness,
|
|
129
141
|
harnessEditable = true,
|
|
130
142
|
onSelectHarness,
|
|
@@ -205,6 +217,18 @@ export function ComposerToolbar({
|
|
|
205
217
|
{/* Plugin contributions sit before the built-in controls, in store
|
|
206
218
|
order. An empty slot renders nothing, so this row is unchanged. */}
|
|
207
219
|
<PluginComposerActions text={text} isSubmitting={chatInFlight} />
|
|
220
|
+
{/* The NEXT prompt's wait pick, at the far right of the row beside the
|
|
221
|
+
action pair. Hidden while there is nothing to wait for and no pick
|
|
222
|
+
already made — an always-drawn chip would promise a session that
|
|
223
|
+
does not exist. */}
|
|
224
|
+
{waiting && (waiting.value || waiting.candidates.length > 0) && (
|
|
225
|
+
<WaitingDependencyPicker
|
|
226
|
+
candidates={waiting.candidates}
|
|
227
|
+
value={waiting.value}
|
|
228
|
+
onChange={waiting.onChange}
|
|
229
|
+
compactLabel
|
|
230
|
+
/>
|
|
231
|
+
)}
|
|
208
232
|
{/* Voice input — only when the browser can capture audio. Idle ▸ mic,
|
|
209
233
|
recording ▸ pulsing red mic-off, transcribing ▸ spinner. It shares
|
|
210
234
|
the action pair's geometry: it is the third control of one cluster,
|
package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* "Wait for session" — the composer's dependency pick
|
|
7
|
+
* "Wait for session" — the composer's dependency pick.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Two mounts, one control: the draft row above a chat that has not started, and
|
|
10
|
+
* the toolbar of a chat that already has a session (the NEXT prompt). Only
|
|
11
|
+
* sessions with a run in flight are offered, and that is a rule rather than a
|
|
12
|
+
* filter for convenience: a prompt held on an idle session would be released
|
|
11
13
|
* by the very next sweep, so the dropdown would be promising a wait that cannot
|
|
12
14
|
* happen. The list is derived from the sidebar's server-tracked status map —
|
|
13
15
|
* the same `stream` rows the row spinner is drawn from — so a session that
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
* immediately.
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
|
-
import { useCallback,
|
|
24
|
+
import { useCallback, useRef, useState } from 'preact/hooks';
|
|
23
25
|
import { Hourglass, ChevronDown, Check, X } from 'lucide-preact';
|
|
24
26
|
import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
|
|
25
27
|
import type { WorkspaceFolderData } from '@/shared/types';
|
|
@@ -31,15 +33,12 @@ export interface WaitingCandidate {
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface WaitingDependencyPickerProps {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
streamStatusMap: Record<string, string | undefined>;
|
|
37
|
-
/** The session this composer writes to; never offered as its own dependency. */
|
|
38
|
-
sessionId: string | null;
|
|
39
|
-
/** A name for a streaming id the sidebar structure has not scanned yet. */
|
|
40
|
-
titleFor?: (id: string) => string | undefined;
|
|
36
|
+
/** Sessions that may be waited on, from `waitingCandidates`. */
|
|
37
|
+
candidates: WaitingCandidate[];
|
|
41
38
|
value: WaitingCandidate | null;
|
|
42
39
|
onChange: (candidate: WaitingCandidate | null) => void;
|
|
40
|
+
/** Toolbar mount: the label collapses on a narrow composer. */
|
|
41
|
+
compactLabel?: boolean;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -82,12 +81,10 @@ export function waitingCandidates(
|
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
export function WaitingDependencyPicker({
|
|
85
|
-
|
|
86
|
-
streamStatusMap,
|
|
87
|
-
sessionId,
|
|
88
|
-
titleFor,
|
|
84
|
+
candidates,
|
|
89
85
|
value,
|
|
90
86
|
onChange,
|
|
87
|
+
compactLabel = false,
|
|
91
88
|
}: WaitingDependencyPickerProps) {
|
|
92
89
|
const [open, setOpen] = useState(false);
|
|
93
90
|
const ref = useRef<HTMLDivElement>(null);
|
|
@@ -96,10 +93,6 @@ export function WaitingDependencyPicker({
|
|
|
96
93
|
// render — including every stream-status frame.
|
|
97
94
|
const close = useCallback(() => setOpen(false), []);
|
|
98
95
|
useOnClickOutside(ref, close);
|
|
99
|
-
const candidates = useMemo(
|
|
100
|
-
() => waitingCandidates(folders, streamStatusMap, sessionId, titleFor),
|
|
101
|
-
[folders, streamStatusMap, sessionId, titleFor],
|
|
102
|
-
);
|
|
103
96
|
const unavailable = candidates.length === 0;
|
|
104
97
|
|
|
105
98
|
return (
|
|
@@ -117,7 +110,7 @@ export function WaitingDependencyPicker({
|
|
|
117
110
|
}`}
|
|
118
111
|
>
|
|
119
112
|
<Hourglass size={13} className={`flex-shrink-0 ${value ? 'text-ink/80' : 'text-ink/50 group-hover:text-ink/80'}`} />
|
|
120
|
-
<span className=
|
|
113
|
+
<span className={`max-w-[200px] truncate tracking-tight ${compactLabel ? 'hidden @[520px]:inline' : ''}`}>
|
|
121
114
|
{value ? `Wait for ${value.title}` : 'Wait for session'}
|
|
122
115
|
</span>
|
|
123
116
|
<ChevronDown
|
|
@@ -54,6 +54,7 @@ export function ChatInput({
|
|
|
54
54
|
composerModelRef,
|
|
55
55
|
/** Pending pick from a previous turn; omits for non-streaming composers. */
|
|
56
56
|
deferredComposerPickRef = NO_PENDING_PICK,
|
|
57
|
+
waiting,
|
|
57
58
|
chatRunning,
|
|
58
59
|
expandable = false,
|
|
59
60
|
hero = false,
|
|
@@ -331,6 +332,7 @@ export function ChatInput({
|
|
|
331
332
|
voiceListening,
|
|
332
333
|
voiceBusy,
|
|
333
334
|
onVoiceToggle: handleVoiceToggle,
|
|
335
|
+
...(waiting ? { waiting } : {}),
|
|
334
336
|
})}
|
|
335
337
|
/>
|
|
336
338
|
);
|
|
@@ -129,11 +129,11 @@ export interface ChatInputProps {
|
|
|
129
129
|
* "Wait for session": the pick, the sessions that may be waited on, and the
|
|
130
130
|
* setter.
|
|
131
131
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
132
|
+
* The pick defers the NEXT prompt of THIS chat. It reaches the composer in
|
|
133
|
+
* two places — a chat that has not started shows it in its draft row, and
|
|
134
|
+
* every chat with a session shows it at the far right of the toolbar — so a
|
|
135
|
+
* composer that does not own a chat turn (the New Chat modal, the side-question
|
|
136
|
+
* form) omits it.
|
|
137
137
|
*/
|
|
138
138
|
waiting?: {
|
|
139
139
|
value: WaitingCandidate | null;
|
|
@@ -25,8 +25,9 @@ import { ChatOverlays } from '@/client/components/workspace/chat-timeline/ChatOv
|
|
|
25
25
|
import { composerRootFor } from '@/shared/lib/workspace/active-project';
|
|
26
26
|
import { usePendingProjectModel } from '@/client/hooks/chat/timeline/pending-model';
|
|
27
27
|
import { useNewChatOpen } from '@/client/hooks/chat/timeline/new-chat-open';
|
|
28
|
+
import { usePendingWarmup } from '@/client/hooks/chat/timeline/pending-warmup';
|
|
28
29
|
import { useSidebarData } from '@/client/hooks/chat/omp/session-list';
|
|
29
|
-
import {
|
|
30
|
+
import { useComposerWait } from '@/client/hooks/chat/waiting/composer-wait';
|
|
30
31
|
import { useSessionHarness } from '@/client/hooks/chat/timeline/session-harness';
|
|
31
32
|
|
|
32
33
|
interface ChatTimelineProps {
|
|
@@ -54,6 +55,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
|
|
|
54
55
|
localMessages,
|
|
55
56
|
isGenerating,
|
|
56
57
|
timelineRunning,
|
|
58
|
+
reloadMessages,
|
|
57
59
|
hasMore,
|
|
58
60
|
loadingOlder, loadOlderError, sessionLoading,
|
|
59
61
|
loadOlder,
|
|
@@ -144,8 +146,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
|
|
|
144
146
|
// A pending "new-…" chat has no messages yet, so the workspace picker stays
|
|
145
147
|
// available until the first send spawns the real session.
|
|
146
148
|
const isPendingSession = Boolean(sessionId?.startsWith('new-'));
|
|
147
|
-
|
|
148
|
-
const { heldWait, cancelHeldWait } = useHeldWait(sessionId, isPendingSession, pushToast);
|
|
149
|
+
const composerWait = useComposerWait({ sessionId, folders, streamStatusMap, titleFor: titleHint, value: waitingDependency.value, onChange: waitingDependency.set, onNotice: pushToast, onDispatched: reloadMessages });
|
|
149
150
|
const composerRoot = composerRootFor(folders, sessionId, selectedFolderId);
|
|
150
151
|
// The workspace's own default model, resolved by the same rule the spawn
|
|
151
152
|
// uses, so the pending composer's pill does not promise Kabmo's global pick.
|
|
@@ -153,6 +154,10 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
|
|
|
153
154
|
const sessionDataModel = typeof sessionData?.model === 'object' ? sessionData.model : null;
|
|
154
155
|
const branch = usePendingBranch({ sessionId, folders, selectedFolderId, setSelectedFolderId, urlParentId: searchParams.get('parentSessionId'), urlForkFrom: searchParams.get('forkFrom'), urlForkAt: searchParams.get('forkAt'), setSearchParams, harnessPicker: activeHarness.picker, pendingHarnessRef });
|
|
155
156
|
const fork = useForkSession(sessionId, folders, selectedFolderId);
|
|
157
|
+
// Warm the boot here: the harness and the Plan pick are known here only.
|
|
158
|
+
usePendingWarmup({
|
|
159
|
+
sessionId, folders, selectedFolderId, harness: activeHarness.harness, plan: modes.plan, worktreePath: spawnTarget?.worktreePath ?? null,
|
|
160
|
+
});
|
|
156
161
|
// A fork's source transcript, drawn above the pending composer and reloaded
|
|
157
162
|
// when "Fork from" moves to another session.
|
|
158
163
|
const forkPreview = useForkPreview(branch.forkSourceSessionId, branch.forkAnchorEntryId);
|
|
@@ -206,8 +211,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
|
|
|
206
211
|
titleForSession={titleHint}
|
|
207
212
|
waitingFor={waitingDependency.value}
|
|
208
213
|
onWaitingForChange={waitingDependency.set}
|
|
209
|
-
|
|
210
|
-
onCancelWait={cancelHeldWait}
|
|
214
|
+
{...composerWait.held}
|
|
211
215
|
spawnTarget={spawnTarget}
|
|
212
216
|
onSpawnTargetChange={setSpawnTarget}
|
|
213
217
|
{...branch.viewProps}
|
|
@@ -300,6 +304,8 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
|
|
|
300
304
|
modes={modes}
|
|
301
305
|
composerModelRef={composerModelRef}
|
|
302
306
|
deferredComposerPickRef={deferredComposerPickRef}
|
|
307
|
+
waiting={composerWait.waiting}
|
|
308
|
+
{...composerWait.held}
|
|
303
309
|
sessionModel={typeof sessionData?.model === 'object' ? sessionData.model : null}
|
|
304
310
|
sessionThinkingLevel={sessionData?.thinkingLevel}
|
|
305
311
|
{...activeHarness.picker}
|
|
@@ -41,9 +41,6 @@ export interface DraftTargetRowProps {
|
|
|
41
41
|
branchAllowNone?: boolean;
|
|
42
42
|
waitingFor?: WaitingCandidate | null;
|
|
43
43
|
onWaitingForChange?: (candidate: WaitingCandidate | null) => void;
|
|
44
|
-
streamStatusMap?: Record<string, string | undefined>;
|
|
45
|
-
/** A name for a streaming session the sidebar has not scanned yet. */
|
|
46
|
-
titleForSession?: (id: string) => string | undefined;
|
|
47
44
|
candidates: WaitingCandidate[];
|
|
48
45
|
}
|
|
49
46
|
|
|
@@ -60,8 +57,6 @@ export function DraftTargetRow({
|
|
|
60
57
|
branchAllowNone = true,
|
|
61
58
|
waitingFor = null,
|
|
62
59
|
onWaitingForChange,
|
|
63
|
-
streamStatusMap = {},
|
|
64
|
-
titleForSession,
|
|
65
60
|
candidates,
|
|
66
61
|
}: DraftTargetRowProps) {
|
|
67
62
|
return (
|
|
@@ -103,10 +98,7 @@ export function DraftTargetRow({
|
|
|
103
98
|
wait for (or a pick already made). */}
|
|
104
99
|
{onWaitingForChange && (waitingFor || candidates.length > 0) && (
|
|
105
100
|
<WaitingDependencyPicker
|
|
106
|
-
|
|
107
|
-
streamStatusMap={streamStatusMap}
|
|
108
|
-
sessionId={null}
|
|
109
|
-
titleFor={titleForSession}
|
|
101
|
+
candidates={candidates}
|
|
110
102
|
value={waitingFor}
|
|
111
103
|
onChange={onWaitingForChange}
|
|
112
104
|
/>
|
package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The draft-target row's BRANCH control, rendered.
|
|
8
|
+
*
|
|
9
|
+
* Two facts a reader would otherwise only meet in a browser:
|
|
10
|
+
*
|
|
11
|
+
* - the trigger's glyph is the fork, not the branch. Both controls sit in the
|
|
12
|
+
* same row and the worktree picker already draws `GitBranch`, so the two
|
|
13
|
+
* read as one control when this one copied it;
|
|
14
|
+
* - choosing a row reports that session, and "No parent" reports null — the
|
|
15
|
+
* pending chat is born top-level again.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
19
|
+
import { Window } from 'happy-dom';
|
|
20
|
+
import { h, render } from 'preact';
|
|
21
|
+
import { act } from 'preact/test-utils';
|
|
22
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
23
|
+
import { ParentSessionPicker } from '@/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker';
|
|
24
|
+
import type { WorkspaceFolderData } from '@/shared/types';
|
|
25
|
+
|
|
26
|
+
const folders = [
|
|
27
|
+
{
|
|
28
|
+
id: 1,
|
|
29
|
+
name: 'kabmo',
|
|
30
|
+
sessions: [{ id: 'a', folder_id: 1, title: 'Alpha' }],
|
|
31
|
+
},
|
|
32
|
+
] as unknown as WorkspaceFolderData[];
|
|
33
|
+
|
|
34
|
+
const mounted: HTMLElement[] = [];
|
|
35
|
+
|
|
36
|
+
beforeAll(() => {
|
|
37
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
afterEach(() => {
|
|
41
|
+
for (const host of mounted.splice(0)) {
|
|
42
|
+
render(null, host);
|
|
43
|
+
host.remove();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterAll(() => {
|
|
48
|
+
restoreDomGlobals();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
async function mount(node: h.JSX.Element): Promise<HTMLElement> {
|
|
52
|
+
const host = document.createElement('div');
|
|
53
|
+
document.body.appendChild(host);
|
|
54
|
+
await act(async () => {
|
|
55
|
+
render(node, host);
|
|
56
|
+
});
|
|
57
|
+
mounted.push(host);
|
|
58
|
+
return host;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
describe('ParentSessionPicker', () => {
|
|
62
|
+
test('the trigger carries the fork glyph, not the worktree branch glyph', async () => {
|
|
63
|
+
const host = await mount(
|
|
64
|
+
h(ParentSessionPicker, { folders, sessionId: null, value: null, onChange: () => {} }),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const trigger = host.querySelector('[data-testid="parent-session-picker"]');
|
|
68
|
+
expect(trigger?.querySelector('.lucide-git-fork')).not.toBeNull();
|
|
69
|
+
expect(trigger?.querySelector('.lucide-git-branch')).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('choosing a session reports it, and "No parent" clears the pick', async () => {
|
|
73
|
+
const seen: (string | null)[] = [];
|
|
74
|
+
const host = await mount(
|
|
75
|
+
h(ParentSessionPicker, {
|
|
76
|
+
folders,
|
|
77
|
+
sessionId: 'new-1',
|
|
78
|
+
value: null,
|
|
79
|
+
onChange: (id) => {
|
|
80
|
+
seen.push(id);
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
await act(async () => {
|
|
86
|
+
(host.querySelector('[data-testid="parent-session-picker"]') as HTMLButtonElement).click();
|
|
87
|
+
});
|
|
88
|
+
await act(async () => {
|
|
89
|
+
(host.querySelector('[data-testid="parent-candidate"]') as HTMLButtonElement).click();
|
|
90
|
+
});
|
|
91
|
+
expect(seen).toEqual(['a']);
|
|
92
|
+
|
|
93
|
+
await act(async () => {
|
|
94
|
+
(host.querySelector('[data-testid="parent-session-picker"]') as HTMLButtonElement).click();
|
|
95
|
+
});
|
|
96
|
+
await act(async () => {
|
|
97
|
+
(host.querySelector('[data-testid="parent-candidate-none"]') as HTMLButtonElement).click();
|
|
98
|
+
});
|
|
99
|
+
expect(seen).toEqual(['a', null]);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { useCallback, useMemo, useRef, useState } from 'preact/hooks';
|
|
19
|
-
import { Check, ChevronDown,
|
|
19
|
+
import { Check, ChevronDown, GitFork, X } from 'lucide-preact';
|
|
20
20
|
import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
|
|
21
21
|
import type { WorkspaceFolderData } from '@/shared/types';
|
|
22
22
|
|
|
@@ -92,7 +92,7 @@ export function ParentSessionPicker({
|
|
|
92
92
|
selected ? 'bg-ink/10 text-ink' : 'text-ink/75 hover:text-ink hover:bg-ink/5'
|
|
93
93
|
}`}
|
|
94
94
|
>
|
|
95
|
-
<
|
|
95
|
+
<GitFork size={13} className={`flex-shrink-0 ${selected ? 'text-ink/80' : 'text-ink/50 group-hover:text-ink/80'}`} />
|
|
96
96
|
<span className="max-w-[220px] truncate tracking-tight">{triggerLabel}</span>
|
|
97
97
|
<ChevronDown
|
|
98
98
|
size={13}
|
|
@@ -13,6 +13,7 @@ import type { EditorCommand } from '@/shared/lib/code/editor/keymap';
|
|
|
13
13
|
import { EDITOR_MAX_FONT_SIZE, EDITOR_MIN_FONT_SIZE } from '@/shared/lib/code/editor/typography';
|
|
14
14
|
import { RENDERED_VIEWERS, type ViewerKind } from '@/shared/lib/fs/document-kind';
|
|
15
15
|
import type { OpenedFile } from '@/shared/types/fs';
|
|
16
|
+
import { isProbeableTab } from '@/client/hooks/workspace/missing-files';
|
|
16
17
|
import type { EditorThemeState } from '@/client/hooks/editor/theme';
|
|
17
18
|
|
|
18
19
|
interface FilePaneProps {
|
|
@@ -138,11 +139,15 @@ export function FilePane({
|
|
|
138
139
|
onZoomOut={() => setZoomLevel((z) => Math.max(EDITOR_MIN_FONT_SIZE, z - 1))}
|
|
139
140
|
onCopy={editor.copy}
|
|
140
141
|
onDownload={editor.download}
|
|
141
|
-
|
|
142
|
+
onReload={editor.reloadFromDisk}
|
|
142
143
|
onSaveAs={onSaveAs}
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
|
|
144
|
+
// Offered for a clean buffer too: the auto-refresh watcher compares the
|
|
145
|
+
// disk's hash, and this is the manual answer to "read it again". Only a
|
|
146
|
+
// tab that names no file on disk (an attachment, a device/handle launch)
|
|
147
|
+
// has nothing to reload, and the same predicate the tab strip uses decides
|
|
148
|
+
// that.
|
|
149
|
+
canReload={isProbeableTab(activeFile) && !editor.loadError && !editor.unsupported}
|
|
150
|
+
reloadDiscardsEdits={editor.isDirty}
|
|
146
151
|
onToggleMaximize={() => setIsMaximized(!isMaximized)}
|
|
147
152
|
/>
|
|
148
153
|
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
import { ExternalChangeStrip } from '@/client/components/workspace/editor/ExternalChangeStrip';
|
|
25
25
|
import { ConflictStrip } from '@/client/components/workspace/editor/ConflictStrip';
|
|
26
|
-
import type {
|
|
26
|
+
import type { DiskDigest } from '@/client/hooks/editor/use-disk-digest';
|
|
27
27
|
import type { WriteConflict } from '@/client/hooks/editor/use-write-conflict';
|
|
28
28
|
import type { OpenedFile } from '@/shared/types/fs';
|
|
29
29
|
|
|
30
30
|
interface EditorNoticesProps {
|
|
31
31
|
activeFile: OpenedFile | undefined;
|
|
32
32
|
/** The disk moved under a dirty buffer, or null. */
|
|
33
|
-
externalChange:
|
|
33
|
+
externalChange: DiskDigest | null;
|
|
34
34
|
/** A save was refused because the disk moved, or null. */
|
|
35
35
|
conflict: WriteConflict | null;
|
|
36
36
|
/** Take the disk copy and drop the buffer's edits. */
|
|
@@ -26,7 +26,7 @@ import type { ComponentChildren } from 'preact';
|
|
|
26
26
|
import { EditorNotices } from '@/client/components/workspace/editor/Notices';
|
|
27
27
|
import { SaveAsModal } from '@/client/components/workspace/editor/SaveAsModal';
|
|
28
28
|
import { EditorDialogs } from '@/client/components/workspace/editor/Dialogs';
|
|
29
|
-
import type {
|
|
29
|
+
import type { DiskDigest } from '@/client/hooks/editor/use-disk-digest';
|
|
30
30
|
import type { CloseGuard } from '@/client/hooks/editor/use-close-guard';
|
|
31
31
|
import type { UseFileEditorResult } from '@/client/hooks/editor/file-editor-types';
|
|
32
32
|
import type { WriteConflict } from '@/client/hooks/editor/use-write-conflict';
|
|
@@ -42,7 +42,7 @@ interface EditorPaneProps {
|
|
|
42
42
|
/** The active file and the buffer it is drawn from. */
|
|
43
43
|
activeFile: OpenedFile | undefined;
|
|
44
44
|
editor: UseFileEditorResult;
|
|
45
|
-
externalChange:
|
|
45
|
+
externalChange: DiskDigest | null;
|
|
46
46
|
conflict: WriteConflict | null;
|
|
47
47
|
onReload: () => void;
|
|
48
48
|
onKeepMine: () => void;
|