feat(ai): support dragging explorer paths into agent context#230
Open
shiva-manu wants to merge 3 commits into
Open
feat(ai): support dragging explorer paths into agent context#230shiva-manu wants to merge 3 commits into
shiva-manu wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds end-to-end drag-and-drop support for transferring Explorer file/folder paths into agent surfaces (AI composer + terminal), using a shared internal drag MIME payload.
Changes:
- Introduces a shared Explorer drag payload (
application/x-terax-path) with read/write helpers. - Enables dragging Explorer nodes and dropping them into the AI composer (attach file contents or directory listing).
- Enables dropping Explorer paths into terminal panes, inserting shell-quoted paths.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/terminal/TerminalPane.tsx | Accepts TERAX path drops and writes shell-quoted paths into the terminal session. |
| src/modules/terminal/lib/shellQuote.ts | Adds shell-quoting utilities for dropped path insertion (POSIX + Windows). |
| src/modules/explorer/lib/dragPayload.ts | Defines the shared internal drag MIME type and helpers to read/write payloads. |
| src/modules/explorer/FileTreeNode.tsx | Marks tree nodes draggable and writes the shared drag payload on drag start. |
| src/modules/ai/lib/composer.tsx | Adds path-based attachment handling, including directory listing fallback. |
| src/modules/ai/components/AiInputBar.tsx | Handles drops for TERAX path payloads and file drops to attach to the next message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
+5
| /** Chars that are always safe unquoted in both cmd/PowerShell and POSIX shells. */ | ||
| const SAFE_CHARS = /^[A-Za-z0-9_\-+.,/:@=%]+$/; | ||
|
|
| size: number, | ||
| fallbackName?: string, | ||
| ) => { | ||
| const name = path.split("/").pop() || fallbackName || path; |
Comment on lines
181
to
+186
| } catch (e) { | ||
| console.error("attachFileByPath failed:", e); | ||
| try { | ||
| const entries = await native.readDir(path); | ||
| const text = formatDirectoryAttachment(path, entries); | ||
| addPathAttachment(path, text, text.length, "Directory"); | ||
| } catch { |
Comment on lines
+88
to
+91
| const paths = readPathDragPayload(e.dataTransfer); | ||
| if (paths.length === 0) return; | ||
| e.preventDefault(); | ||
| setIsPathDragOver(false); |
4 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds drag-and-drop support for passing files and folders from the Explorer
into agent workflows.
Files dropped onto the AI composer are attached to the next agent message,
while paths dropped into terminal-based agent CLIs are inserted with shell-
safe quoting.
Why
Explorer items could be dragged, but dropping them into the agentic CLI or AI
input did not pass usable file/folder context to the agent.
How
Introduces a shared Explorer drag payload using
application/x-terax-path,then handles that payload in both the AI composer and terminal pane.
For folders, the composer attaches a directory listing as context. For
terminal drops, paths are shell-quoted before being written into the terminal.
Testing
Verified the code builds successfully and the changed TypeScript paths
compile.
pnpm exec tsc --noEmitcleansrc-tauri/)cargo checkcleanpnpm tauri devAdditional validation run:
npm run buildcleangit diff --checkcleanScreenshots / GIFs
Screencast.from.2026-05-14.00-39-33.mp4
#229