@kabmo-labs/kabmo 0.24.0 → 0.26.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 +585 -512
- package/dist/client/static/js/{index-jcr5twtp.js → index-95b3n20k.js} +1105 -1207
- package/dist/client/static/js/index-p2yw9ywf.css +1 -0
- package/package.json +2 -4
- package/src/cli/lib/args.js +24 -1
- package/src/cli/lib/args.test.js +16 -0
- package/src/cli/lib/commands/session.js +233 -0
- package/src/cli/lib/commands/session.test.js +103 -0
- package/src/cli/main.js +1 -1
- package/src/client/components/common/ComposerPicker.tsx +3 -0
- package/src/client/components/common/code-surface/shiki.test.ts +82 -0
- package/src/client/components/common/code-surface/shiki.ts +28 -7
- package/src/client/components/common/session-actions-menu/index.tsx +59 -2
- package/src/client/components/common/session-branch/BranchGuides.tsx +93 -0
- package/src/client/components/common/session-branch/SubagentRow.tsx +77 -0
- package/src/client/components/common/session-branch/index.tsx +169 -0
- package/src/client/components/common/session-branch/session-branch.test.tsx +240 -0
- package/src/client/components/common/session-branch/style.ts +29 -0
- package/src/client/components/common/session-row/StatusSlot.tsx +17 -5
- package/src/client/components/common/session-row/index.tsx +28 -3
- package/src/client/components/common/session-row/session-row.test.tsx +11 -0
- package/src/client/components/common/session-state-provider/index.tsx +1 -1
- package/src/client/components/layout/desktop-layout/resizer/separator-drag.ts +3 -3
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +70 -61
- package/src/client/components/layout/session-sidebar/SessionItem.batch.test.ts +3 -3
- package/src/client/components/layout/session-sidebar/SessionItem.test.ts +25 -2
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +35 -7
- package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +261 -0
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +39 -198
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTableLog.test.tsx +114 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.test.tsx +130 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.tsx +128 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +56 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +44 -36
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +62 -47
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +63 -50
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.test.ts +5 -0
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +37 -12
- package/src/client/components/settings/Sidebar.tsx +1 -1
- package/src/client/components/settings/categories/NotificationSettings.test.tsx +92 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +112 -2
- package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.fork.test.ts +94 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +31 -5
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +64 -70
- package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +35 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +128 -122
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +22 -1
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +11 -5
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +10 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +12 -3
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +15 -1
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +85 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +84 -0
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +5 -0
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +155 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +11 -20
- package/src/client/components/workspace/chat-timeline/target-picker/DraftTargetRow.tsx +115 -0
- package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +173 -0
- package/src/client/components/workspace/chat-timeline/target-picker/parent-session-options.test.ts +49 -0
- package/src/client/components/workspace/terminal-panel/KeyBar.tsx +10 -8
- package/src/client/components/workspace/terminal-panel/{RealtimeXtermView.tsx → RealtimeTerminalView.tsx} +51 -58
- package/src/client/components/workspace/terminal-panel/fit.test.ts +37 -0
- package/src/client/components/workspace/terminal-panel/fit.ts +64 -0
- package/src/client/components/workspace/terminal-panel/fonts.test.ts +161 -0
- package/src/client/components/workspace/terminal-panel/fonts.ts +164 -0
- package/src/client/components/workspace/terminal-panel/grid.test.ts +52 -0
- package/src/client/components/workspace/terminal-panel/grid.ts +118 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +25 -21
- package/src/client/components/workspace/terminal-panel/mount.ts +247 -223
- package/src/client/components/workspace/terminal-panel/navigation.test.ts +54 -0
- package/src/client/components/workspace/terminal-panel/navigation.ts +47 -0
- package/src/client/data/settings/omp-schema.json +1 -1
- package/src/client/data/theme/terminal.test.ts +25 -0
- package/src/client/data/theme/terminal.ts +96 -79
- package/src/client/hooks/chat/composer/items.test.ts +31 -26
- package/src/client/hooks/chat/composer/pick-mapping.test.ts +42 -0
- package/src/client/hooks/chat/omp/folder-auto-expand.ts +1 -1
- package/src/client/hooks/chat/omp/pending-adoption.ts +51 -0
- package/src/client/hooks/chat/omp/pending-child.test.ts +73 -0
- package/src/client/hooks/chat/omp/pending-entry.ts +59 -0
- package/src/client/hooks/chat/omp/pending-rows.ts +6 -2
- package/src/client/hooks/chat/omp/pending-sessions.test.ts +1 -2
- package/src/client/hooks/chat/omp/pending-sessions.ts +45 -69
- package/src/client/hooks/chat/omp/pending-waiting.ts +1 -1
- package/src/client/hooks/chat/omp/prompt-send.test.ts +7 -7
- package/src/client/hooks/chat/omp/prompt-send.ts +26 -14
- package/src/client/hooks/chat/omp/run-switch.ts +1 -1
- package/src/client/hooks/chat/omp/session-list.tsx +4 -0
- package/src/client/hooks/chat/subagents/roster.ts +122 -0
- package/src/client/hooks/chat/timeline/child-spawn.test.ts +55 -0
- package/src/client/hooks/chat/timeline/child-spawn.ts +45 -0
- package/src/client/hooks/chat/timeline/fork-request.test.ts +54 -0
- package/src/client/hooks/chat/timeline/fork-request.ts +43 -0
- package/src/client/hooks/chat/timeline/mode-availability.test.ts +1 -1
- package/src/client/hooks/chat/timeline/mode-availability.ts +33 -0
- package/src/client/hooks/chat/timeline/mode-markers.ts +7 -1
- package/src/client/hooks/chat/timeline/mode-post.ts +15 -3
- package/src/client/hooks/chat/timeline/modes-contract.ts +9 -4
- package/src/client/hooks/chat/timeline/modes.test.ts +56 -18
- package/src/client/hooks/chat/timeline/modes.ts +42 -29
- package/src/client/hooks/chat/timeline/pending-branch.ts +205 -0
- package/src/client/hooks/chat/timeline/pending-dispatch.ts +253 -0
- package/src/client/hooks/chat/timeline/prompt-text.test.ts +34 -1
- package/src/client/hooks/chat/timeline/prompt-text.ts +47 -20
- package/src/client/hooks/chat/timeline/send-execute.test.ts +39 -0
- package/src/client/hooks/chat/timeline/send-helpers.ts +30 -1
- package/src/client/hooks/chat/timeline/send-steer.test.ts +3 -1
- package/src/client/hooks/chat/timeline/send.test-util.ts +7 -1
- package/src/client/hooks/chat/timeline/send.test.ts +3 -1
- package/src/client/hooks/chat/timeline/send.ts +48 -133
- package/src/client/hooks/chat/timeline/session-harness.ts +6 -0
- package/src/client/hooks/chat/timeline/stop-with-queue.ts +42 -0
- package/src/client/hooks/chat/timeline/use-fork-session.ts +58 -0
- package/src/client/hooks/models/use-harness-update.test.ts +286 -0
- package/src/client/hooks/models/use-harness-update.ts +250 -0
- package/src/client/hooks/ui/input-required-alert.ts +12 -5
- package/src/client/hooks/ui/notifications.ts +45 -0
- package/src/client/hooks/ui/run-outcome-alert.ts +48 -0
- package/src/client/hooks/workspace/expanded-sessions.ts +36 -7
- package/src/client/hooks/workspace/terminal/index.ts +17 -3
- package/src/client/hooks/workspace/terminal/socket.ts +9 -4
- package/src/client/lib/native/open-session.ts +33 -0
- package/src/client/lib/notifications/os.test.ts +125 -0
- package/src/client/lib/notifications/os.ts +130 -0
- package/src/client/lib/plugins/sidebar-bridge.ts +2 -20
- package/src/client/lib/router/open-session.test.ts +75 -0
- package/src/client/lib/router/open-session.ts +34 -0
- package/src/client/lib/session-tree.test.ts +50 -0
- package/src/client/lib/session-tree.ts +59 -0
- package/src/client/lib/signals.ts +5 -1
- package/src/client/main.tsx +6 -0
- package/src/client/tailwind.css +17 -11
- package/src/server/index.ts +2 -0
- package/src/server/lib/auth/guard.ts +10 -0
- package/src/server/lib/btw/session-copy.server.ts +6 -44
- package/src/server/lib/btw/session-copy.test.ts +2 -1
- package/src/server/lib/db/schema.ts +5 -0
- package/src/server/lib/db/seed-terminal.test.ts +1 -1
- package/src/server/lib/db/seed.test.ts +1 -1
- package/src/server/lib/harness/acp/background-work.test.ts +262 -0
- package/src/server/lib/harness/acp/background-work.ts +320 -0
- package/src/server/lib/harness/acp/calls.ts +15 -1
- package/src/server/lib/harness/acp/client-capabilities.test.ts +55 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +61 -0
- package/src/server/lib/harness/acp/client-fs.test.ts +135 -0
- package/src/server/lib/harness/acp/client-fs.ts +131 -0
- package/src/server/lib/harness/acp/client-initialize.test.ts +70 -0
- package/src/server/lib/harness/acp/client-initialize.ts +84 -0
- package/src/server/lib/harness/acp/client.ts +33 -23
- package/src/server/lib/harness/acp/commands.test.ts +5 -5
- package/src/server/lib/harness/acp/commands.ts +14 -2
- package/src/server/lib/harness/acp/frames-timing.test.ts +68 -0
- package/src/server/lib/harness/acp/frames-v2.test.ts +85 -0
- package/src/server/lib/harness/acp/frames.ts +71 -158
- package/src/server/lib/harness/acp/gateway-env.test.ts +64 -0
- package/src/server/lib/harness/acp/gateway-env.ts +70 -0
- package/src/server/lib/harness/acp/mapper.test.ts +40 -0
- package/src/server/lib/harness/acp/mapper.ts +12 -0
- package/src/server/lib/harness/acp/permissions.ts +6 -0
- package/src/server/lib/harness/acp/prompt.test.ts +20 -0
- package/src/server/lib/harness/acp/prompt.ts +19 -3
- package/src/server/lib/harness/acp/protocol.ts +41 -2
- package/src/server/lib/harness/acp/session-background.test.ts +129 -0
- package/src/server/lib/harness/acp/session-exit.ts +31 -0
- package/src/server/lib/harness/acp/session-facts.ts +1 -1
- package/src/server/lib/harness/acp/session-handshake.test.ts +197 -0
- package/src/server/lib/harness/acp/session-handshake.ts +110 -7
- package/src/server/lib/harness/acp/session-idle.ts +7 -6
- package/src/server/lib/harness/acp/session-listeners.ts +31 -0
- package/src/server/lib/harness/acp/session-notifications.ts +41 -2
- package/src/server/lib/harness/acp/session-observers.test.ts +63 -0
- package/src/server/lib/harness/acp/session-permissions.test.ts +29 -0
- package/src/server/lib/harness/acp/session-permissions.ts +36 -0
- package/src/server/lib/harness/acp/session-requests.test.ts +92 -0
- package/src/server/lib/harness/acp/session-requests.ts +89 -0
- package/src/server/lib/harness/acp/session-turns.ts +28 -8
- package/src/server/lib/harness/acp/session-usage.ts +4 -0
- package/src/server/lib/harness/acp/session-web-state.ts +30 -2
- package/src/server/lib/harness/acp/session.test-util.ts +42 -2
- package/src/server/lib/harness/acp/session.ts +115 -115
- package/src/server/lib/harness/acp/tool-calls.ts +223 -0
- package/src/server/lib/harness/acp/turn.test.ts +183 -0
- package/src/server/lib/harness/acp/turn.ts +102 -10
- package/src/server/lib/harness/acp/v2.test.ts +144 -0
- package/src/server/lib/harness/acp/v2.ts +220 -0
- package/src/server/lib/harness/acp/verbs.ts +58 -8
- package/src/server/lib/harness/launch.test.ts +25 -0
- package/src/server/lib/harness/launch.ts +24 -10
- package/src/server/lib/harness/session.ts +3 -0
- package/src/server/lib/harness/spawn.server.ts +15 -2
- package/src/server/lib/harness/update-job-store.test.ts +151 -0
- package/src/server/lib/harness/update-job-store.ts +115 -0
- package/src/server/lib/harness/update-job.server.ts +94 -0
- package/src/server/lib/harness/update-queue.server.ts +292 -0
- package/src/server/lib/harness/update-queue.test.ts +265 -0
- package/src/server/lib/harness/update-spawn.server.ts +96 -0
- package/src/server/lib/harness/update-worker.test.ts +153 -0
- package/src/server/lib/harness/update-worker.ts +202 -0
- package/src/server/lib/lifecycle/after-listen.ts +9 -0
- package/src/server/lib/lifecycle/paths.ts +28 -0
- package/src/server/lib/omp/rpc/manager.ts +5 -5
- package/src/server/lib/omp/rpc/prewarm-pool.ts +12 -3
- package/src/server/lib/omp/rpc/run-settle.server.ts +10 -1
- package/src/server/lib/omp/rpc/session-registry.ts +14 -2
- package/src/server/lib/omp/rpc/subagent-liveness.ts +5 -5
- package/src/server/lib/omp/rpc/terminal-settle.ts +58 -6
- package/src/server/lib/omp/session/delete-flow.server.ts +48 -0
- package/src/server/lib/omp/session/delete.server.ts +5 -0
- package/src/server/lib/omp/session/rewind-file.ts +39 -21
- package/src/server/lib/omp/session/sidebar-data.server.ts +16 -18
- package/src/server/lib/omp/session/transcript-copy.ts +123 -0
- package/src/server/lib/sessions/agent-token.server.test.ts +64 -0
- package/src/server/lib/sessions/agent-token.server.ts +134 -0
- package/src/server/lib/sessions/answers.server.test.ts +33 -0
- package/src/server/lib/sessions/answers.server.ts +37 -0
- package/src/server/lib/sessions/dispatch.server.test.ts +143 -0
- package/src/server/lib/sessions/dispatch.server.ts +128 -0
- package/src/server/lib/sessions/fork.server.test.ts +277 -0
- package/src/server/lib/sessions/fork.server.ts +329 -0
- package/src/server/lib/sessions/lifecycle.server.test.ts +75 -0
- package/src/server/lib/sessions/lifecycle.server.ts +71 -0
- package/src/server/lib/sessions/notify.server.test.ts +112 -0
- package/src/server/lib/sessions/notify.server.ts +212 -0
- package/src/server/lib/sessions/relation-types.ts +76 -0
- package/src/server/lib/sessions/relations.server.test.ts +207 -0
- package/src/server/lib/sessions/relations.server.ts +337 -0
- package/src/server/lib/sessions/resolve.server.ts +106 -0
- package/src/server/lib/sessions/schema.server.ts +82 -0
- package/src/server/lib/sessions/sidebar-relations.server.test.ts +61 -0
- package/src/server/lib/sessions/sidebar-relations.server.ts +47 -0
- package/src/server/lib/sessions/spawn.server.test.ts +237 -0
- package/src/server/lib/sessions/spawn.server.ts +335 -0
- package/src/server/lib/terminal/attach-replay.test.ts +2 -2
- package/src/server/lib/terminal/output.test.ts +2 -2
- package/src/server/lib/terminal/output.ts +1 -1
- package/src/server/lib/terminal/resize.test.ts +99 -0
- package/src/server/lib/terminal/runtime.server.ts +26 -6
- package/src/server/lib/terminal/send-result.test.ts +18 -1
- package/src/server/lib/terminal/send-result.ts +26 -2
- package/src/server/lib/terminal/session.server.ts +6 -6
- package/src/server/lib/usage/new-api.test.ts +92 -0
- package/src/server/lib/usage/new-api.ts +131 -0
- package/src/server/lib/usage/provider-endpoint.test.ts +106 -0
- package/src/server/lib/usage/provider-key.ts +33 -0
- package/src/server/lib/usage/providers.server.ts +10 -3
- package/src/server/lib/usage/vendor-balance.server.ts +4 -53
- package/src/server/lib/usage/vendor-http.ts +41 -0
- package/src/server/lib/usage/window.ts +55 -0
- package/src/server/routes/agent/command.ts +14 -1
- package/src/server/routes/agent/harness-command.ts +12 -5
- package/src/server/routes/agent/new.ts +15 -0
- package/src/server/routes/chat/stream.ts +7 -2
- package/src/server/routes/harness/add-provider.test.ts +9 -1
- package/src/server/routes/harness/import-action.ts +4 -0
- package/src/server/routes/harness/import.test.ts +1 -1
- package/src/server/routes/harness/index.ts +5 -1
- package/src/server/routes/harness/update-status.ts +32 -0
- package/src/server/routes/harness/update.test.ts +156 -0
- package/src/server/routes/harness/update.ts +64 -147
- package/src/server/routes/sessions/answer.ts +24 -0
- package/src/server/routes/sessions/batch-delete.ts +11 -5
- package/src/server/routes/sessions/body-readers.ts +43 -0
- package/src/server/routes/sessions/delete.ts +4 -2
- package/src/server/routes/sessions/fork.ts +89 -0
- package/src/server/routes/sessions/index.ts +14 -0
- package/src/server/routes/sessions/relations.ts +85 -0
- package/src/server/routes/sessions/routes.test.ts +1 -2
- package/src/server/routes/sessions/session.ts +23 -0
- package/src/server/routes/sessions/spawn.ts +137 -0
- package/src/server/routes/terminal/ws.ts +3 -3
- package/src/shared/lib/chat/composer/client.ts +31 -2
- package/src/shared/lib/chat/composer/delegation.test.ts +93 -0
- package/src/shared/lib/chat/composer/delegation.ts +206 -0
- package/src/shared/lib/chat/notice-text.ts +1 -1
- package/src/shared/lib/chat/omp/agent-events.ts +11 -0
- package/src/shared/lib/chat/omp/session-modes-signal.test.ts +41 -0
- package/src/shared/lib/chat/tool/summary-wait.test.ts +11 -0
- package/src/shared/lib/code/ansi.ts +1 -1
- package/src/shared/lib/fonts/nerd-symbols.css +4 -3
- package/src/shared/lib/fonts/nerd-symbols.test.ts +9 -9
- package/src/shared/lib/harness/mode-signal.ts +20 -0
- package/src/shared/lib/harness/provider-facts.test.ts +27 -0
- package/src/shared/lib/harness/providers.ts +35 -1
- package/src/shared/lib/harness/session-modes.ts +24 -0
- package/src/shared/lib/harness/update-job.ts +80 -0
- package/src/shared/lib/harness/update-plan.test.ts +21 -6
- package/src/shared/lib/harness/update-plan.ts +12 -4
- package/src/shared/lib/icons/tint-hues.generated.ts +34 -34
- package/src/shared/lib/notifications/outcomes.test.ts +96 -0
- package/src/shared/lib/notifications/outcomes.ts +64 -0
- package/src/shared/lib/notifications/settings.test.ts +49 -0
- package/src/shared/lib/notifications/settings.ts +34 -0
- package/src/shared/lib/omp/session/default-title.ts +5 -4
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +3 -2
- package/src/shared/lib/omp/session/schema-migrations.ts +4 -0
- package/src/shared/lib/omp/session/stream-state.server.test.ts +19 -0
- package/src/shared/lib/omp/session/stream-state.server.ts +24 -4
- package/src/shared/lib/omp/session/wait-idle.test.ts +11 -0
- package/src/shared/lib/omp/session/wait-idle.ts +12 -2
- package/src/shared/lib/settings/defaults.ts +3 -0
- package/src/shared/lib/theme/catalog.test.ts +13 -9
- package/src/shared/lib/theme/color.test.ts +2 -2
- package/src/shared/lib/theme/color.ts +4 -4
- package/src/shared/lib/theme/theme.test.ts +1 -1
- package/src/shared/lib/workspace/terminal/input.test.ts +27 -0
- package/src/shared/lib/workspace/terminal/input.ts +33 -0
- package/src/shared/lib/workspace/terminal/keys.test.ts +1 -1
- package/src/shared/lib/workspace/terminal/keys.ts +7 -7
- package/src/shared/types/chat.ts +1 -1
- package/src/shared/types/harness-update.ts +89 -0
- package/src/shared/types/omp/agent.ts +19 -2
- package/src/shared/types/realtime.ts +2 -0
- package/src/shared/types/settings/state.ts +10 -0
- package/src/shared/types/workspace.ts +8 -0
- package/src/test-support/fake-omp-fork.ts +16 -2
- package/src/test-support/harness-table.test-util.ts +31 -1
- package/dist/client/static/js/index-z3w7n85q.css +0 -1
- package/src/client/components/common/subagent-list/index.tsx +0 -165
- package/src/client/components/workspace/terminal-panel/webgl.test.ts +0 -75
- package/src/client/components/workspace/terminal-panel/webgl.ts +0 -108
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'preact/hooks';
|
|
2
2
|
import type { ReactNode } from 'preact/compat';
|
|
3
|
-
import { Brain, Clock3, Coins, Hourglass, MessageSquarePlus, MoreHorizontal, RotateCcw, X } from 'lucide-preact';
|
|
3
|
+
import { Brain, Clock3, Coins, GitFork, Hourglass, MessageSquarePlus, MoreHorizontal, RotateCcw, X } from 'lucide-preact';
|
|
4
4
|
import { CopyButton } from '@/client/components/common/CopyButton';
|
|
5
5
|
import { RunMark } from '@/client/components/workspace/chat-timeline/RunMark';
|
|
6
6
|
import { PluginMessageActions } from '@/client/components/workspace/chat-timeline/PluginMessageActions';
|
|
@@ -33,12 +33,20 @@ interface AiMessageFooterProps {
|
|
|
33
33
|
msgId: string;
|
|
34
34
|
onRetry?: (msgId: string) => void;
|
|
35
35
|
onNewChat?: (content: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Anchor row for Fork. Separate from `msgId`, which Retry resolves to the
|
|
38
|
+
* run's OPENING user row: forking there branches before the answer this
|
|
39
|
+
* footer sits under. The anchor is the run's owner row instead, so the fork
|
|
40
|
+
* keeps the answer.
|
|
41
|
+
*/
|
|
42
|
+
forkTargetId?: string;
|
|
43
|
+
onFork?: (msgId: string) => void;
|
|
36
44
|
isMobile?: boolean;
|
|
37
45
|
/**
|
|
38
|
-
* Whether the row offers Retry / New-chat.
|
|
39
|
-
* turn, branch a
|
|
40
|
-
* row the chat does not own — the BTW panel's side answer —
|
|
41
|
-
* instead of rendering buttons that do nothing.
|
|
46
|
+
* Whether the row offers Retry / Fork / New-chat. All of them act on the
|
|
47
|
+
* CHAT (re-run a chat turn, branch a session from it), so a footer that
|
|
48
|
+
* describes a row the chat does not own — the BTW panel's side answer —
|
|
49
|
+
* turns them off instead of rendering buttons that do nothing.
|
|
42
50
|
*/
|
|
43
51
|
showActions?: boolean;
|
|
44
52
|
}
|
|
@@ -56,6 +64,8 @@ export function AiMessageFooter({
|
|
|
56
64
|
harness,
|
|
57
65
|
onRetry,
|
|
58
66
|
onNewChat,
|
|
67
|
+
forkTargetId,
|
|
68
|
+
onFork,
|
|
59
69
|
isMobile = false,
|
|
60
70
|
showActions = true,
|
|
61
71
|
}: AiMessageFooterProps) {
|
|
@@ -71,6 +81,11 @@ export function AiMessageFooter({
|
|
|
71
81
|
onNewChat?.(content);
|
|
72
82
|
};
|
|
73
83
|
|
|
84
|
+
const handleFork = () => {
|
|
85
|
+
setIsMenuOpen(false);
|
|
86
|
+
if (forkTargetId) onFork?.(forkTargetId);
|
|
87
|
+
};
|
|
88
|
+
|
|
74
89
|
useEffect(() => {
|
|
75
90
|
if (!isMenuOpen) return;
|
|
76
91
|
const handleKeyDown = (event: globalThis.KeyboardEvent) => {
|
|
@@ -221,6 +236,12 @@ export function AiMessageFooter({
|
|
|
221
236
|
<RotateCcw size={20} className="shrink-0 text-ink/55" />
|
|
222
237
|
<span>Retry response</span>
|
|
223
238
|
</button>
|
|
239
|
+
{onFork && forkTargetId && (
|
|
240
|
+
<button type="button" aria-label="Fork session from this answer" onClick={handleFork} className="flex min-h-12 w-full items-center gap-3 rounded-lg px-3 text-left text-sm text-ink transition-colors hover:bg-ink/5 cursor-pointer">
|
|
241
|
+
<GitFork size={20} className="shrink-0 text-ink/55" />
|
|
242
|
+
<span>Fork from this answer</span>
|
|
243
|
+
</button>
|
|
244
|
+
)}
|
|
224
245
|
<button type="button" aria-label="Start new chat from this answer" onClick={handleNewChat} className="flex min-h-12 w-full items-center gap-3 rounded-lg px-3 text-left text-sm text-ink transition-colors hover:bg-ink/5 cursor-pointer">
|
|
225
246
|
<MessageSquarePlus size={20} className="shrink-0 text-ink/55" />
|
|
226
247
|
<span>Start new chat from this answer</span>
|
|
@@ -267,6 +288,11 @@ export function AiMessageFooter({
|
|
|
267
288
|
ariaLabel="Copy response"
|
|
268
289
|
emptyTitle="Nothing to copy — this run produced no text"
|
|
269
290
|
/>
|
|
291
|
+
{showActions && onFork && forkTargetId && (
|
|
292
|
+
<button type="button" className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer" title="Fork from here" aria-label="Fork session from this answer" onClick={handleFork}>
|
|
293
|
+
<GitFork size={12} />
|
|
294
|
+
</button>
|
|
295
|
+
)}
|
|
270
296
|
{showActions && (
|
|
271
297
|
<button type="button" className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer" title="New Chat from here" aria-label="Start new chat from this answer" onClick={handleNewChat}>
|
|
272
298
|
<MessageSquarePlus size={12} />
|
|
@@ -2,6 +2,7 @@ import type { Dispatch, SetStateAction } from 'preact/compat';
|
|
|
2
2
|
import { ChatInput } from '@/client/components/workspace/chat-timeline/chat-input/index';
|
|
3
3
|
import { BtwForm } from '@/client/components/workspace/btw-panel/index';
|
|
4
4
|
import { useBtwMode } from '@/client/hooks/chat/btw/mode';
|
|
5
|
+
import { ComposerDockFrame } from '@/client/components/workspace/chat-timeline/ComposerDockFrame';
|
|
5
6
|
import { GeneratingIndicator } from '@/client/components/workspace/chat-timeline/GeneratingIndicator';
|
|
6
7
|
import { QueueList } from '@/client/components/workspace/chat-timeline/QueueList';
|
|
7
8
|
import type { Attachment, QueuedMessage } from '@/shared/types';
|
|
@@ -121,76 +122,69 @@ export function ComposerDock({
|
|
|
121
122
|
const btw = useBtwMode(sessionId);
|
|
122
123
|
|
|
123
124
|
return (
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<GeneratingIndicator
|
|
137
|
-
modelName={modelName}
|
|
138
|
-
generatingVerb={generatingVerb}
|
|
139
|
-
provider={provider}
|
|
140
|
-
providerNames={providerNames}
|
|
141
|
-
{...(harness ? { harness } : {})}
|
|
142
|
-
/>
|
|
143
|
-
)}
|
|
144
|
-
<QueueList
|
|
145
|
-
queue={messageQueue}
|
|
146
|
-
onRemove={onRemoveQueueItem}
|
|
147
|
-
onReorder={onReorderQueue}
|
|
148
|
-
onEdit={onEditQueueItem}
|
|
149
|
-
onSendNow={onSendNowQueueItem}
|
|
125
|
+
<ComposerDockFrame isMobile={isMobile}>
|
|
126
|
+
{/* Plugin banner strip: above the input, in the chat's own composer.
|
|
127
|
+
An empty slot renders nothing, so a Kabmo with no plugins keeps
|
|
128
|
+
this dock byte-identical. */}
|
|
129
|
+
<PluginComposerBanners />
|
|
130
|
+
{showGeneratingIndicator && (
|
|
131
|
+
<GeneratingIndicator
|
|
132
|
+
modelName={modelName}
|
|
133
|
+
generatingVerb={generatingVerb}
|
|
134
|
+
provider={provider}
|
|
135
|
+
providerNames={providerNames}
|
|
136
|
+
{...(harness ? { harness } : {})}
|
|
150
137
|
/>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
138
|
+
)}
|
|
139
|
+
<QueueList
|
|
140
|
+
queue={messageQueue}
|
|
141
|
+
onRemove={onRemoveQueueItem}
|
|
142
|
+
onReorder={onReorderQueue}
|
|
143
|
+
onEdit={onEditQueueItem}
|
|
144
|
+
onSendNow={onSendNowQueueItem}
|
|
145
|
+
/>
|
|
146
|
+
{btw.open ? (
|
|
147
|
+
<BtwForm
|
|
148
|
+
mode={btw}
|
|
149
|
+
appSettings={appSettings}
|
|
150
|
+
composerModelRef={composerModelRef}
|
|
151
|
+
rootPath={rootPath}
|
|
152
|
+
variant={variant}
|
|
153
|
+
modelName={modelName}
|
|
154
|
+
provider={provider}
|
|
155
|
+
providerNames={providerNames}
|
|
156
|
+
/>
|
|
157
|
+
) : (
|
|
158
|
+
<ChatInput
|
|
159
|
+
value={inputValue}
|
|
160
|
+
onChange={setInputValue}
|
|
161
|
+
sessionId={sessionId}
|
|
162
|
+
rootPath={rootPath}
|
|
163
|
+
attachments={attachments}
|
|
164
|
+
onAttachmentsChange={setAttachments}
|
|
165
|
+
onSend={onSend}
|
|
166
|
+
isGenerating={isGenerating}
|
|
167
|
+
chatRunning={showGeneratingIndicator}
|
|
168
|
+
onStop={onStop}
|
|
169
|
+
appSettings={appSettings}
|
|
170
|
+
onThinkingLevelChange={onThinkingLevelChange}
|
|
171
|
+
onModelChange={onModelChange}
|
|
172
|
+
accessMode={accessMode}
|
|
173
|
+
onAccessModeChange={onAccessModeChange}
|
|
174
|
+
modes={modes}
|
|
175
|
+
composerModelRef={composerModelRef}
|
|
176
|
+
deferredComposerPickRef={deferredComposerPickRef}
|
|
177
|
+
sessionModel={sessionModel}
|
|
178
|
+
sessionThinkingLevel={sessionThinkingLevel}
|
|
179
|
+
harness={harness}
|
|
180
|
+
harnessEditable={harnessEditable}
|
|
181
|
+
onSelectHarness={onSelectHarness}
|
|
182
|
+
variant={variant}
|
|
183
|
+
expandable
|
|
184
|
+
hero={hero}
|
|
185
|
+
shrinkWhileReading={shrinkWhileReading}
|
|
186
|
+
/>
|
|
187
|
+
)}
|
|
188
|
+
</ComposerDockFrame>
|
|
195
189
|
);
|
|
196
190
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentChildren } from 'preact';
|
|
2
|
+
|
|
3
|
+
interface ComposerDockFrameProps {
|
|
4
|
+
isMobile: boolean;
|
|
5
|
+
children: ComponentChildren;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The dock's frame: the padding, the chat-column width and the phone's
|
|
10
|
+
* safe-area inset every "rows above the composer" stack shares.
|
|
11
|
+
*
|
|
12
|
+
* It exists because that dock is drawn in two places — the real timeline
|
|
13
|
+
* (`ComposerDock`) and the pending `new-…` chat, whose composer lives in
|
|
14
|
+
* `EmptyWorkspacePrompt` until the spawn adopts it. Spelled out separately, the
|
|
15
|
+
* two drifted: the pending view kept the landing page's `p-8` and its
|
|
16
|
+
* `space-y-3` stack, while the dock used `p-4 pt-1` with the rows flush. The
|
|
17
|
+
* generating indicator therefore sat **28px higher** while the spawn was in
|
|
18
|
+
* flight (`Loading…`, 141px above the pane's bottom) than once the run streamed
|
|
19
|
+
* (`Thinking…`, 113px) — the row jumped at the moment the chat was adopted, and
|
|
20
|
+
* the jump read as two different indicators.
|
|
21
|
+
*
|
|
22
|
+
* The `relative` belongs here: it keeps the queue/indicator stack anchored
|
|
23
|
+
* above the input while the side-question form takes the composer's place.
|
|
24
|
+
*/
|
|
25
|
+
export function ComposerDockFrame({ isMobile, children }: ComposerDockFrameProps) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-composer-dock=""
|
|
29
|
+
className={`border-t-0 bg-transparent flex-shrink-0 ${isMobile ? 'px-3 pt-1' : 'p-4 pt-1'}`}
|
|
30
|
+
style={isMobile ? { paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom, 0px))' } : undefined}
|
|
31
|
+
>
|
|
32
|
+
<div className="chat-column relative">{children}</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -5,17 +5,16 @@ import type { Attachment, ChatMessageData, WorkspaceFolderData } from '@/shared/
|
|
|
5
5
|
import { ChatInput } from '@/client/components/workspace/chat-timeline/chat-input/index';
|
|
6
6
|
import { ChatMessageItem } from '@/client/components/workspace/chat-timeline/MessageItem';
|
|
7
7
|
import { RunFooter } from '@/client/components/workspace/chat-timeline/RunFooter';
|
|
8
|
+
import { ComposerDockFrame } from '@/client/components/workspace/chat-timeline/ComposerDockFrame';
|
|
8
9
|
import { GeneratingIndicator } from '@/client/components/workspace/chat-timeline/GeneratingIndicator';
|
|
9
10
|
import { resolveRunFooters, streamingRowIndex } from '@/shared/lib/chat/timeline/run-footer';
|
|
10
11
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
11
12
|
import {
|
|
12
|
-
WaitingDependencyPicker,
|
|
13
13
|
waitingCandidates,
|
|
14
14
|
type WaitingCandidate,
|
|
15
15
|
} from '@/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker';
|
|
16
16
|
import { Hourglass } from 'lucide-preact';
|
|
17
|
-
import {
|
|
18
|
-
import { WorktreePicker } from '@/client/components/workspace/chat-timeline/target-picker/WorktreePicker';
|
|
17
|
+
import { DraftTargetRow } from '@/client/components/workspace/chat-timeline/target-picker/DraftTargetRow';
|
|
19
18
|
import type { SpawnTarget } from '@/client/hooks/chat/timeline/spawn-target';
|
|
20
19
|
|
|
21
20
|
interface EmptyWorkspacePromptProps {
|
|
@@ -73,6 +72,12 @@ interface EmptyWorkspacePromptProps {
|
|
|
73
72
|
*/
|
|
74
73
|
spawnTarget?: SpawnTarget | null;
|
|
75
74
|
onSpawnTargetChange?: (next: SpawnTarget | null) => void;
|
|
75
|
+
/** The session this chat runs UNDER, or null for a top-level chat. */
|
|
76
|
+
parentSessionId?: string | null;
|
|
77
|
+
onParentSessionChange?: (sessionId: string | null) => void;
|
|
78
|
+
/** "Parent session" for a child, "Fork from" for a fork. */
|
|
79
|
+
branchLabel?: string;
|
|
80
|
+
branchAllowNone?: boolean;
|
|
76
81
|
/** Reports a worktree the composer created or failed to create. */
|
|
77
82
|
onWorktreeReport?: (message: string) => void;
|
|
78
83
|
/** The "wait for session" pick, persisted per chat. */
|
|
@@ -125,6 +130,10 @@ export function EmptyWorkspacePrompt({
|
|
|
125
130
|
titleForSession,
|
|
126
131
|
spawnTarget = null,
|
|
127
132
|
onSpawnTargetChange,
|
|
133
|
+
parentSessionId = null,
|
|
134
|
+
onParentSessionChange,
|
|
135
|
+
branchLabel,
|
|
136
|
+
branchAllowNone,
|
|
128
137
|
onWorktreeReport,
|
|
129
138
|
waitingFor = null,
|
|
130
139
|
onWaitingForChange,
|
|
@@ -159,65 +168,81 @@ export function EmptyWorkspacePrompt({
|
|
|
159
168
|
}
|
|
160
169
|
}, [messages.length]);
|
|
161
170
|
|
|
171
|
+
const isMobile = variant === 'mobile';
|
|
172
|
+
// A chat with rows to show (or a prompt in flight) draws the SAME dock the
|
|
173
|
+
// real timeline does. It used to keep this page's centred `p-8` column and a
|
|
174
|
+
// `space-y-3` stack, so the generating indicator — and the composer under it
|
|
175
|
+
// — sat 28px higher while the spawn was in flight (`Loading…`, 141px from the
|
|
176
|
+
// pane's bottom) than once the run streamed in the real timeline
|
|
177
|
+
// (`Thinking…`, 113px). The row jumped at the moment the chat was adopted,
|
|
178
|
+
// which read as two different indicators.
|
|
179
|
+
const docked = messages.length > 0 || isGenerating;
|
|
180
|
+
|
|
181
|
+
const heldPrompt = heldWait ? (
|
|
182
|
+
<div className="flex items-center gap-2 rounded-lg border border-ink/15 bg-ink/[0.03] px-3 py-2 text-xs text-ink/70">
|
|
183
|
+
<Hourglass size={12} className="shrink-0 animate-pulse text-ink/60" />
|
|
184
|
+
<span className="min-w-0 flex-1 truncate">
|
|
185
|
+
Waiting for {heldWait.title ?? 'another session'} to finish before this prompt is sent.
|
|
186
|
+
</span>
|
|
187
|
+
{onCancelWait && (
|
|
188
|
+
<button
|
|
189
|
+
type="button"
|
|
190
|
+
data-testid="cancel-held-prompt"
|
|
191
|
+
onClick={onCancelWait}
|
|
192
|
+
className="shrink-0 rounded border border-ink/20 px-2 py-0.5 text-[11px] text-ink/70 hover:bg-ink/5 hover:text-ink cursor-pointer"
|
|
193
|
+
>
|
|
194
|
+
Cancel
|
|
195
|
+
</button>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
) : null;
|
|
199
|
+
|
|
200
|
+
const composer = (
|
|
201
|
+
<ChatInput
|
|
202
|
+
value={inputValue}
|
|
203
|
+
onChange={setInputValue}
|
|
204
|
+
rootPath={rootPath}
|
|
205
|
+
attachments={inputAttachments}
|
|
206
|
+
onAttachmentsChange={setInputAttachments}
|
|
207
|
+
onSend={onSend}
|
|
208
|
+
isGenerating={isGenerating}
|
|
209
|
+
disabled={!selectedFolderId || Boolean(heldWait)}
|
|
210
|
+
className="w-full shrink-0"
|
|
211
|
+
appSettings={appSettings}
|
|
212
|
+
onThinkingLevelChange={onThinkingLevelChange}
|
|
213
|
+
onModelChange={onModelChange}
|
|
214
|
+
sessionModel={sessionModel}
|
|
215
|
+
sessionThinkingLevel={sessionThinkingLevel}
|
|
216
|
+
accessMode={accessMode}
|
|
217
|
+
onAccessModeChange={onAccessModeChange}
|
|
218
|
+
modes={modes}
|
|
219
|
+
composerModelRef={composerModelRef}
|
|
220
|
+
deferredComposerPickRef={deferredComposerPickRef}
|
|
221
|
+
{...(harness ? { harness } : {})}
|
|
222
|
+
harnessEditable={harnessEditable}
|
|
223
|
+
{...(onSelectHarness ? { onSelectHarness } : {})}
|
|
224
|
+
variant={variant}
|
|
225
|
+
expandable
|
|
226
|
+
// A brand-new chat has no turns: the `stage` composer style draws its
|
|
227
|
+
// wider, taller card here and nowhere else.
|
|
228
|
+
hero={messages.length === 0}
|
|
229
|
+
/>
|
|
230
|
+
);
|
|
231
|
+
|
|
162
232
|
return (
|
|
163
|
-
<div
|
|
164
|
-
|
|
233
|
+
<div
|
|
234
|
+
className={`flex flex-col h-full bg-canvas ${docked ? '' : isMobile ? 'px-3 py-4' : 'p-8'} ${className}`}
|
|
235
|
+
style={!docked && isMobile ? { paddingBottom: 'max(1rem, env(safe-area-inset-bottom, 0px))' } : undefined}
|
|
165
236
|
>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
>
|
|
171
|
-
{/* Workspace Selection Seamless Dropdown (No border, transparent
|
|
172
|
-
background). Hidden once a chat has been sent — the session now has
|
|
173
|
-
a target workspace, so the composer is the only focus. */}
|
|
174
|
-
{messages.length === 0 && (
|
|
175
|
-
<div className="flex items-center gap-1 flex-wrap">
|
|
176
|
-
{/* Two controls, because they answer two questions: the workspace
|
|
177
|
-
(which project) and the worktree (which checkout of it). The
|
|
178
|
-
worktree control draws itself only for a git repository, and it
|
|
179
|
-
reads its list on mount because its own trigger names the branch
|
|
180
|
-
the project root holds. */}
|
|
181
|
-
<WorkspacePicker
|
|
182
|
-
folders={folders as WorkspaceFolderData[]}
|
|
183
|
-
selectedFolderId={selectedFolderId}
|
|
184
|
-
setSelectedFolderId={setSelectedFolderId}
|
|
185
|
-
onClearWorktree={() => onSpawnTargetChange?.(null)}
|
|
186
|
-
/>
|
|
187
|
-
{onSpawnTargetChange && (
|
|
188
|
-
<WorktreePicker
|
|
189
|
-
folders={folders as WorkspaceFolderData[]}
|
|
190
|
-
selectedFolderId={selectedFolderId}
|
|
191
|
-
target={spawnTarget}
|
|
192
|
-
setTarget={onSpawnTargetChange}
|
|
193
|
-
onReport={onWorktreeReport}
|
|
194
|
-
/>
|
|
195
|
-
)}
|
|
196
|
-
{/* The wait picker sits BESIDE the workspace picker, because both
|
|
197
|
-
answer the same question about the chat that has not started:
|
|
198
|
-
where it runs, and what it waits for. It only appears while there
|
|
199
|
-
is something to wait for (or a pick already made). */}
|
|
200
|
-
{onWaitingForChange && (waitingFor || candidates.length > 0) && (
|
|
201
|
-
<WaitingDependencyPicker
|
|
202
|
-
folders={folders}
|
|
203
|
-
streamStatusMap={streamStatusMap}
|
|
204
|
-
sessionId={null}
|
|
205
|
-
titleFor={titleForSession}
|
|
206
|
-
value={waitingFor}
|
|
207
|
-
onChange={onWaitingForChange}
|
|
208
|
-
/>
|
|
209
|
-
)}
|
|
210
|
-
</div>
|
|
211
|
-
)}
|
|
212
|
-
|
|
213
|
-
{/* Pending session timeline: optimistic bubbles render here immediately
|
|
214
|
-
on send, then the real session (UUID) takes over the ChatTimeline.
|
|
215
|
-
Only shown when there are messages so the empty composer stays
|
|
216
|
-
centered next to the workspace picker. */}
|
|
217
|
-
{messages.length > 0 && (
|
|
237
|
+
{docked ? (
|
|
238
|
+
<>
|
|
239
|
+
{/* The pending transcript reserves the box the real timeline's own
|
|
240
|
+
scroller does (`TimelineBody`), so adoption moves no text either. */}
|
|
218
241
|
<div
|
|
219
242
|
ref={timelineRef}
|
|
220
|
-
className=
|
|
243
|
+
className={`flex-1 min-h-0 overflow-y-auto scroll-smooth overscroll-contain ${
|
|
244
|
+
isMobile ? 'pl-4 pr-3 py-3 pb-8' : 'p-4 pb-10'
|
|
245
|
+
}`}
|
|
221
246
|
>
|
|
222
247
|
<div className="chat-column">
|
|
223
248
|
{messages.map((msg, idx) => {
|
|
@@ -232,7 +257,7 @@ export function EmptyWorkspacePrompt({
|
|
|
232
257
|
isStreaming={isLoading}
|
|
233
258
|
onUndo={onUndo}
|
|
234
259
|
onNewChat={onNewChat}
|
|
235
|
-
isMobile={
|
|
260
|
+
isMobile={isMobile}
|
|
236
261
|
className={isAiFragment ? 'mt-1' : 'mt-8'}
|
|
237
262
|
/>
|
|
238
263
|
{footer && (
|
|
@@ -256,71 +281,52 @@ export function EmptyWorkspacePrompt({
|
|
|
256
281
|
})}
|
|
257
282
|
</div>
|
|
258
283
|
</div>
|
|
259
|
-
)}
|
|
260
284
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
)}
|
|
273
|
-
{/* A held prompt owns this chat until it is released: there is no
|
|
274
|
-
session to send a second prompt to, and a composer that looked live
|
|
275
|
-
would accept one that could not be delivered. */}
|
|
276
|
-
{heldWait && (
|
|
277
|
-
<div className="flex items-center gap-2 rounded-lg border border-ink/15 bg-ink/[0.03] px-3 py-2 text-xs text-ink/70">
|
|
278
|
-
<Hourglass size={12} className="shrink-0 animate-pulse text-ink/60" />
|
|
279
|
-
<span className="min-w-0 flex-1 truncate">
|
|
280
|
-
Waiting for {heldWait.title ?? 'another session'} to finish before this prompt is sent.
|
|
281
|
-
</span>
|
|
282
|
-
{onCancelWait && (
|
|
283
|
-
<button
|
|
284
|
-
type="button"
|
|
285
|
-
data-testid="cancel-held-prompt"
|
|
286
|
-
onClick={onCancelWait}
|
|
287
|
-
className="shrink-0 rounded border border-ink/20 px-2 py-0.5 text-[11px] text-ink/70 hover:bg-ink/5 hover:text-ink cursor-pointer"
|
|
288
|
-
>
|
|
289
|
-
Cancel
|
|
290
|
-
</button>
|
|
285
|
+
{/* One frame with the real dock (`ComposerDock`), so the indicator and
|
|
286
|
+
the composer cannot sit at two different heights. */}
|
|
287
|
+
<ComposerDockFrame isMobile={isMobile}>
|
|
288
|
+
{isGenerating && (
|
|
289
|
+
<GeneratingIndicator
|
|
290
|
+
modelName={modelName}
|
|
291
|
+
generatingVerb={generatingVerb}
|
|
292
|
+
provider={provider}
|
|
293
|
+
providerNames={providerNames}
|
|
294
|
+
{...(harness ? { harness } : {})}
|
|
295
|
+
/>
|
|
291
296
|
)}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
297
|
+
{heldPrompt}
|
|
298
|
+
{composer}
|
|
299
|
+
</ComposerDockFrame>
|
|
300
|
+
</>
|
|
301
|
+
) : (
|
|
302
|
+
<div className="chat-column flex flex-col min-h-0 my-auto justify-center space-y-3">
|
|
303
|
+
{/* Workspace Selection Seamless Dropdown (No border, transparent
|
|
304
|
+
background). A chat with rows keeps its target and drops the
|
|
305
|
+
picker; this branch is only the chat that has not started. */}
|
|
306
|
+
<DraftTargetRow
|
|
307
|
+
folders={folders as WorkspaceFolderData[]}
|
|
308
|
+
selectedFolderId={selectedFolderId}
|
|
309
|
+
setSelectedFolderId={setSelectedFolderId}
|
|
310
|
+
spawnTarget={spawnTarget}
|
|
311
|
+
onSpawnTargetChange={onSpawnTargetChange}
|
|
312
|
+
onWorktreeReport={onWorktreeReport}
|
|
313
|
+
parentSessionId={parentSessionId}
|
|
314
|
+
onParentSessionChange={onParentSessionChange}
|
|
315
|
+
branchLabel={branchLabel}
|
|
316
|
+
branchAllowNone={branchAllowNone}
|
|
317
|
+
waitingFor={waitingFor}
|
|
318
|
+
onWaitingForChange={onWaitingForChange}
|
|
319
|
+
streamStatusMap={streamStatusMap}
|
|
320
|
+
titleForSession={titleForSession}
|
|
321
|
+
candidates={candidates}
|
|
322
|
+
/>
|
|
323
|
+
{/* A held prompt owns this chat until it is released: there is no
|
|
324
|
+
session to send a second prompt to, and a composer that looked live
|
|
325
|
+
would accept one that could not be delivered. */}
|
|
326
|
+
{heldPrompt}
|
|
327
|
+
{composer}
|
|
328
|
+
</div>
|
|
329
|
+
)}
|
|
324
330
|
</div>
|
|
325
331
|
);
|
|
326
332
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TargetedMouseEvent } from 'preact';
|
|
2
2
|
import { useMemo } from 'preact/hooks';
|
|
3
3
|
import { memo } from 'preact/compat';
|
|
4
|
-
import { AlertCircle, Bot, Info, MessageSquarePlus, Undo2, User } from 'lucide-preact';
|
|
4
|
+
import { AlertCircle, Bot, GitFork, Info, MessageSquarePlus, Undo2, User } from 'lucide-preact';
|
|
5
5
|
import type { Attachment, ChatMessageData } from '@/shared/types';
|
|
6
6
|
import { toAttachmentList } from '@/shared/lib/chat/attachments';
|
|
7
7
|
import { ThinkingSection } from '@/client/components/workspace/chat-timeline/ThinkingSection';
|
|
@@ -29,6 +29,8 @@ interface ChatMessageItemProps {
|
|
|
29
29
|
* it from the new chat.
|
|
30
30
|
*/
|
|
31
31
|
onNewChat?: (content: string, attachments?: Attachment[]) => void;
|
|
32
|
+
/** Branch the chat before/at this row. Absent draws no button. */
|
|
33
|
+
onFork?: (msgId: string) => void;
|
|
32
34
|
|
|
33
35
|
/** Extra classes on the root wrapper (e.g. spacing between messages). */
|
|
34
36
|
className?: string;
|
|
@@ -52,6 +54,7 @@ export const ChatMessageItem = memo(function ChatMessageItem({
|
|
|
52
54
|
isStreaming = false,
|
|
53
55
|
onUndo,
|
|
54
56
|
onNewChat,
|
|
57
|
+
onFork,
|
|
55
58
|
className = '',
|
|
56
59
|
isPrevAssistant = false,
|
|
57
60
|
userActions = true,
|
|
@@ -155,6 +158,24 @@ export const ChatMessageItem = memo(function ChatMessageItem({
|
|
|
155
158
|
emptyTitle="Nothing to copy — attachment-only prompt"
|
|
156
159
|
/>
|
|
157
160
|
|
|
161
|
+
{/* Fork Button — branches the session at this row, leaving the
|
|
162
|
+
source untouched. Separate from New Chat: a fork carries the
|
|
163
|
+
history, a new chat does not. */}
|
|
164
|
+
{userActions && onFork && (
|
|
165
|
+
<button
|
|
166
|
+
type="button"
|
|
167
|
+
className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
|
|
168
|
+
title="Fork from here"
|
|
169
|
+
aria-label="Fork this session from this message"
|
|
170
|
+
onClick={(e) => {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
onFork(msg.id);
|
|
173
|
+
}}
|
|
174
|
+
>
|
|
175
|
+
<GitFork size={12} />
|
|
176
|
+
</button>
|
|
177
|
+
)}
|
|
178
|
+
|
|
158
179
|
{/* New Chat Button */}
|
|
159
180
|
{userActions && (
|
|
160
181
|
<button
|