-
Notifications
You must be signed in to change notification settings - Fork 1.7k
WIP: Draft document tool #4802
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
base: main
Are you sure you want to change the base?
WIP: Draft document tool #4802
Conversation
🦋 Changeset detectedLatest commit: 9051b40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a draft document tool (create_draft) that allows the AI agent to create temporary, in-memory planning documents. These documents use a draft:// URI scheme, appear as editor tabs, but are not persisted to disk. The implementation spans both VS Code and JetBrains IDEs.
Key Changes
- New Tool:
create_drafttool for creating ephemeral planning documents - File System Provider: Custom file system provider for
draft://URIs in both VS Code and JetBrains - Tool Integration: Updated
read_fileandwrite_to_filetools to handle draft documents
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/shared/tools.ts |
Adds create_draft tool type definitions and registration |
src/services/planning/draftPaths.ts |
Path utilities for draft:// URI handling |
src/services/planning/DraftFileSystemProvider.ts |
VS Code FileSystemProvider implementation |
src/services/planning/index.ts |
Service exports |
src/extension.ts |
Registers draft file system provider (VS Code only) |
src/core/tools/CreateDraftTool.ts |
Tool implementation following BaseTool pattern |
src/core/tools/ReadFileTool.ts |
Adds draft document reading support with auto-approval |
src/core/tools/WriteToFileTool.ts |
Adds draft document writing support |
src/core/tools/simpleReadFileTool.ts |
Adds draft document support |
src/core/prompts/tools/create-draft.ts |
XML protocol tool description |
src/core/prompts/tools/native-tools/create_draft.ts |
Native protocol tool definition |
src/core/prompts/tools/index.ts |
Tool description registration |
src/core/prompts/tools/filter-tools-for-mode.ts |
Filters out create_draft for CLI mode |
src/core/assistant-message/presentAssistantMessage.ts |
Tool execution registration |
packages/types/src/tool.ts |
Adds tool name to type definitions |
jetbrains/plugin/.../DraftPaths.kt |
Kotlin version of path utilities |
jetbrains/plugin/.../DraftFileSystemProvider.kt |
JetBrains implementation using LightVirtualFile |
jetbrains/plugin/.../CreateDraftTool.kt |
Kotlin tool handler |
jetbrains/plugin/.../EditorAndDocManager.kt |
Editor integration for draft URIs |
jetbrains/plugin/.../MainThreadFileSystemShape.kt |
File system RPC integration |
jetbrains/plugin/.../MainThreadLanguageModelToolsShape.kt |
Tool invocation RPC integration |
jetbrains/plugin/.../RPCManager.kt |
Updated to pass project reference |
jetbrains/host/src/rpcManager.ts |
RPC stub with comments |
jetbrains/host/src/rpcAccessor.ts |
RPC protocol global accessor |
jetbrains/host/src/main.ts |
Sets RPC protocol for global access |
docs/jetbrains-create-draft-implementation-plan.md |
Implementation documentation |
CREATE_DRAFT_TOOL_PRD.md |
Product requirements document |
CREATE_DRAFT_TEST_PROMPT.md |
Testing guide |
jetbrains/plugin/src/main/kotlin/ai/kilocode/jetbrains/filesystem/DraftFileSystemProvider.kt
Outdated
Show resolved
Hide resolved
9959d5f to
960991f
Compare
…eation - Added tool to facilitate the creation of temporary, in-memory planning documents. - Implemented functionality to handle draft documents, including reading and writing operations. - Integrated draft management into the existing file system provider, allowing drafts to be opened as editor tabs. - Updated relevant documentation and tests to reflect the new tool and its usage. This enhancement improves the user experience by enabling structured thinking and planning without the need for persistent storage.
…nctionality - Replaced the create_draft tool with create_plan to better reflect its purpose of creating ephemeral planning documents. - Updated all references in the codebase, including imports, function calls, and documentation. - Enhanced the tool's description to clarify its usage for brainstorming and structured thinking. - Removed the previous draft management system and integrated the new plan management into the existing file system provider. - Updated tests and snapshots to ensure compatibility with the new tool name and functionality. This change improves clarity and aligns the tool's name with its intended use, enhancing the user experience in planning tasks.
- Replaced direct VSCode file system calls with helper functions for reading and writing plan documents. - Updated ApplyDiffTool, CreatePlanTool, and SearchAndReplaceTool to utilize the new helper methods, improving code clarity and maintainability. - Removed unnecessary logging statements to clean up the codebase. - Enhanced error handling for plan document operations, providing clearer feedback to users. This refactor enhances the overall structure of the planning tools, making them more efficient and easier to manage.
…d functionality - Introduced the ephemeralPlanning experiment across various components, including experiment IDs and configurations. - Updated the experiment schema to include ephemeralPlanning, allowing for conditional tool exclusions based on its state. - Modified relevant tests to account for the new experiment, ensuring comprehensive coverage. - Enhanced the settings localization to provide descriptions for the ephemeralPlanning feature. This addition improves the flexibility of planning tools by enabling temporary document creation based on user settings.
f9c87eb to
9051b40
Compare
Context
Implementation
Screenshots
How to Test
Get in Touch