Repository navigation
feat(agent-manager): drag sessions, worktrees, terminals, and documents into the prompt #14102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marius-kilocode
merged 3 commits into
main
from
allow-drag-drop-session-worktree-cards-to-prompt
Sep 14, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "kilo-code": minor | ||
| --- | ||
|
|
||
| Mention sessions, worktrees, terminals, and open documents by dragging their tab or card into the prompt. |
100 changes: 100 additions & 0 deletions
100
packages/kilo-vscode/tests/unit/prompt-mention-drop.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import { afterEach, describe, expect, it } from "bun:test" | ||
| import { | ||
| beginPromptMentionDrop, | ||
| endPromptMentionDrop, | ||
| insideRect, | ||
| registerPromptMentionDrop, | ||
| type PromptMentionDrop, | ||
| } from "../../webview-ui/src/utils/prompt-mention-drop" | ||
|
|
||
| const hadDoc = "document" in globalThis | ||
| const originalDoc = hadDoc ? globalThis.document : undefined | ||
| const listeners = new Set<(event: PointerEvent) => void>() | ||
|
|
||
| function mockDocument() { | ||
| listeners.clear() | ||
| ;(globalThis as Record<string, unknown>).document = { | ||
| addEventListener: (type: string, handler: (event: PointerEvent) => void) => { | ||
| if (type === "pointermove") listeners.add(handler) | ||
| }, | ||
| removeEventListener: (type: string, handler: (event: PointerEvent) => void) => { | ||
| if (type === "pointermove") listeners.delete(handler) | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| function restoreDocument() { | ||
| if (hadDoc) (globalThis as Record<string, unknown>).document = originalDoc | ||
| else delete (globalThis as Record<string, unknown>).document | ||
| } | ||
|
|
||
| function move(x: number, y: number) { | ||
| for (const handler of listeners) handler({ clientX: x, clientY: y } as PointerEvent) | ||
| } | ||
|
|
||
| function target() { | ||
| return { | ||
| isConnected: true, | ||
| getBoundingClientRect: () => ({ left: 100, top: 100, right: 300, bottom: 200 }), | ||
| } as unknown as HTMLElement | ||
| } | ||
|
|
||
| const drop: PromptMentionDrop = { | ||
| kind: "session", | ||
| session: { id: "s1", title: "Chat", updated: 1 }, | ||
| } | ||
|
|
||
| afterEach(() => { | ||
| registerPromptMentionDrop(undefined, undefined) | ||
| endPromptMentionDrop() | ||
| restoreDocument() | ||
| }) | ||
|
|
||
| describe("insideRect", () => { | ||
| it("includes the edges and excludes outside points", () => { | ||
| const rect = { left: 10, top: 20, right: 30, bottom: 40 } | ||
| expect(insideRect(rect, 10, 20)).toBe(true) | ||
| expect(insideRect(rect, 30, 40)).toBe(true) | ||
| expect(insideRect(rect, 9, 20)).toBe(false) | ||
| expect(insideRect(rect, 30, 41)).toBe(false) | ||
| }) | ||
| }) | ||
|
|
||
| describe("prompt mention drop", () => { | ||
| it("inserts only when the last pointer position is inside the target", () => { | ||
| mockDocument() | ||
| const inserted: PromptMentionDrop[] = [] | ||
| registerPromptMentionDrop(target(), (value) => { | ||
| inserted.push(value) | ||
| return true | ||
| }) | ||
|
|
||
| beginPromptMentionDrop(drop) | ||
| move(200, 150) | ||
| expect(endPromptMentionDrop()).toBe(true) | ||
|
|
||
| expect(inserted).toEqual([drop]) | ||
| }) | ||
|
|
||
| it("does not insert when the pointer is outside the target", () => { | ||
| mockDocument() | ||
| const inserted: PromptMentionDrop[] = [] | ||
| registerPromptMentionDrop(target(), (value) => { | ||
| inserted.push(value) | ||
| return true | ||
| }) | ||
|
|
||
| beginPromptMentionDrop(drop) | ||
| move(500, 500) | ||
| expect(endPromptMentionDrop()).toBe(false) | ||
|
|
||
| expect(inserted).toEqual([]) | ||
| }) | ||
|
|
||
| it("does nothing when no target is registered", () => { | ||
| mockDocument() | ||
| beginPromptMentionDrop(drop) | ||
| expect(listeners.size).toBe(0) | ||
| expect(endPromptMentionDrop()).toBe(false) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
packages/kilo-vscode/webview-ui/agent-manager/constrain-drag-x.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.