Skip to content

feat(agent-manager): drag sessions, worktrees, terminals, and documents into the prompt - #14102

Merged
marius-kilocode merged 3 commits into
mainfrom
allow-drag-drop-session-worktree-cards-to-prompt
Sep 14, 2026
Merged

feat(agent-manager): drag sessions, worktrees, terminals, and documents into the prompt#14102
marius-kilocode merged 3 commits into
mainfrom
allow-drag-drop-session-worktree-cards-to-prompt

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Session tabs and worktree cards could only be referenced in the prompt through the @ mention picker. Users could not drag the item they were looking at into the composer, and dragging a worktree out of the sidebar kept reordering the list under the pointer.

Why This Change Was Made

  • solid-dnd drives the tab and worktree drags with pointer events, so adding a native HTML5 draggable to the same element conflicts with reordering. The change reuses the existing drag lifecycle and resolves the drop by hit-testing the pointer against a registered prompt rectangle.
  • The worktree X-axis constraint and the tab Y-axis constraint pinned the drag overlay to its lane, so it could not visually leave the sidebar or tab bar. Both now allow movement toward the prompt. Reordering stops once the item leaves its lane, which keeps the existing reorder animations while removing the spurious list movement during a drag to the prompt.
  • A drop on the prompt is consumed by the prompt, so drag end does not also move a worktree into the section under the pointer.
  • Only session tabs, terminals, and documents produce a mention. Other tabs keep their current behavior.

User Impact

  • Drag a session tab, worktree card, terminal tab, or open document tab onto the prompt to insert the matching @ mention.
  • The prompt shows a focus highlight while a mention drag is over it, and the inserted mention ends with a trailing space so typing can continue.
  • Reordering tabs, moving worktrees between sections, and tab persistence keep working.

Evidence

  • bun run typecheck, bun run lint, bun run bundle, bun run knip, and bun run check-kilocode-change pass.
  • bun run test:unit: 5535 pass, 2 skip, 0 fail.
  • New unit tests cover the drop resolver, insideRect hit testing, and insertDrop for worktree, session, terminal, and file mentions.
  • Interactive drag verification needs a real pointer drag. The self-test CLI has no drag primitive for solid-dnd pointer gestures, so the gesture itself was not exercised automatically.

How to Test

  1. Open the Agent Manager with a worktree and a session.
  2. Drag a session tab, a terminal tab, and a worktree card onto the prompt. Confirm each inserts its @ mention with a trailing space.
  3. Open a markdown document in the Documents side panel and drag its tab onto the prompt. Confirm the @ file path is inserted.
  4. Drag a worktree card to a section, and reorder tabs in the main bar and sidebar. Confirm those still work.
  5. Release a worktree card in the main pane away from the prompt. Confirm nothing moves and the order is unchanged.

Checklist

  • No linked issue. This is a direct feature handled in this worktree.
  • Tests/verification described.
  • Screenshots/video marked N/A. The change is an interactive drag with no stable still frame.
  • Changeset added (minor).
  • Diff reviewed.

Comment thread packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts
Comment thread packages/kilo-vscode/webview-ui/src/components/chat/TabDnd.tsx Outdated
Comment thread packages/kilo-vscode/webview-ui/src/utils/prompt-mention-drop.ts
Comment thread packages/kilo-vscode/webview-ui/agent-manager/SidebarBody.tsx Outdated
Comment thread packages/kilo-vscode/webview-ui/agent-manager/worktree-references.ts Outdated
Comment thread packages/kilo-vscode/webview-ui/agent-manager/ProjectSidebarBody.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review ff5aeba..79663af7: the only new change is a regenerated visual-regression baseline (full-screen-diff-with-changes-chromium-linux.png), a generated artifact outside review scope. The prior drag-to-prompt findings were addressed in ff5aeba.

Files Reviewed (3 files)
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/agentmanager/full-screen-diff-with-changes-chromium-linux.png
  • packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts
  • packages/kilo-vscode/webview-ui/src/utils/prompt-mention-drop.ts
Previous Review Summaries (2 snapshots, latest commit ff5aeba)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit ff5aeba)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (9 files)
  • packages/kilo-vscode/tests/unit/prompt-mention-drop.test.ts
  • packages/kilo-vscode/tests/unit/use-file-mention.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/InspectorTabStrip.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectSidebarBody.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/SidebarBody.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/worktree-references.ts
  • packages/kilo-vscode/webview-ui/src/components/chat/TabDnd.tsx
  • packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts
  • packages/kilo-vscode/webview-ui/src/utils/prompt-mention-drop.ts

Previous review (commit 81ecad2)

Status: 6 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 3
SUGGESTION 2
Issue Details (click to expand)

CRITICAL

File Line Issue
packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts 730 insertToken omits remember(offset, token), so typing after a drag-dropped mention reopens the @ dropdown and Enter no longer sends (it can select a mention or open the file picker).

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/components/chat/TabDnd.tsx 24 outsideSidePanel uses the dragged tab's own rect on the reorder axis, blocking leftward reordering of side-panel (terminal/document) tabs.
packages/kilo-vscode/webview-ui/src/utils/prompt-mention-drop.ts 54 registerPromptMentionDrop(undefined, ...) does not tear down the global pointermove listener or reset active/dragging, leaking state on unmount mid-drag.
packages/kilo-vscode/webview-ui/agent-manager/SidebarBody.tsx 300 Outside-sidebar release leaves the in-memory reorder un-reverted and unpersisted, unlike ProjectSidebarBody.

SUGGESTION

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/worktree-references.ts 71 disabled: false is hardcoded, making insertDrop's disabled guard unreachable for dragged worktrees.
packages/kilo-vscode/webview-ui/agent-manager/ProjectSidebarBody.tsx 247 The prompt-drop path skips the origin restore that the outside-sidebar path performs.
Files Reviewed (19 files)
  • .changeset/agent-manager-prompt-mention-drop.md
  • packages/kilo-vscode/tests/unit/prompt-mention-drop.test.ts
  • packages/kilo-vscode/tests/unit/use-file-mention.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/InspectorTabStrip.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/ProjectSidebarBody.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/SidebarBody.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/agent-manager/constrain-drag-x.ts
  • packages/kilo-vscode/webview-ui/agent-manager/section-dnd.ts
  • packages/kilo-vscode/webview-ui/agent-manager/tab-drag.ts
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/SideTerminalPanel.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/worktree-references.ts - 1 issue
  • packages/kilo-vscode/webview-ui/documents/DocumentPanel.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/SessionTabStrip.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/TabDnd.tsx - 1 issue
  • packages/kilo-vscode/webview-ui/src/hooks/file-mention-utils.ts
  • packages/kilo-vscode/webview-ui/src/hooks/useFileMention.ts - 1 issue
  • packages/kilo-vscode/webview-ui/src/styles/prompt-input.css
  • packages/kilo-vscode/webview-ui/src/utils/prompt-mention-drop.ts - 1 issue

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

marius-kilocode and others added 2 commits September 14, 2026 09:38
- Track dropped mentions so typing after a drop keeps the dropdown closed
- Detect leaving the side panel via strip bounds so leftward reordering works
- Tear down the drop listener and drag state when the prompt unmounts
- Restore sidebar worktree order on prompt and outside drops
- Derive the disabled flag for drag-dropped worktree references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants