feat(tool): add open tool for files and URLs#24891
Draft
Marxist-Leninist wants to merge 1 commit intoanomalyco:devfrom
Draft
feat(tool): add open tool for files and URLs#24891Marxist-Leninist wants to merge 1 commit intoanomalyco:devfrom
Marxist-Leninist wants to merge 1 commit intoanomalyco:devfrom
Conversation
…lder Adds an `open` builtin tool that hands a file path, folder, or URL to the OS default handler. Useful for "open the generated report", "reveal this artifact in Explorer", or "show this URL in the user's browser" without needing a bash command. Parameters: * `target` — local path, folder, or http(s)/file URL. * `reason` — optional short reason rendered to the user. * `reveal_in_folder` — when target is a real file, open the parent folder with the file selected (Windows: explorer /select,, macOS: open -R, Linux: xdg-open parent). Safety: * Allowed URL schemes: http, https, file. Anything else (including javascript: and data:) is rejected. * Local paths must exist — refuses missing targets up-front. * No shell — spawns the platform launcher directly with windowsHide so untrusted target text cannot inject commands. Wires registry, agent permission list, and the TUI ToolPart switch so the chat shows "⤢ Open file report.txt" or "⤢ Open url https://example.com..." instead of the generic spinner.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: The search results show that PR #24891 (the current PR) appears in all results. After filtering out the current PR itself, the other PRs found don't appear to be duplicates - they address different features like pagination, browser tools, sidebar plugins, clipboard handling, path separators, text transformations, and tool aliases. No duplicate PRs found |
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.
Issue for this PR
Closes #24890
Type of change
What does this PR do?
Adds a built-in
opentool that can surface a local file, folder,file://URL, orhttp(s)URL using the operating system default handler.The tool resolves relative local paths from the project directory, rejects unsupported URL schemes, asks for an
openpermission before launching anything, and returns structured metadata indicating whether the OS launcher accepted the request. On Windows it usesrundll32.exe url.dll,FileProtocolHandlerfor files/URLs and Explorer for folders/reveal, avoidingcmd /c startshell parsing.How did you verify your code works?
packages/opencode:bun test test/tool/open.test.ts --timeout 30000git diff --checkgit grep.Screenshots / recordings
No screenshot. This is a tool/runtime change; the TUI shows a compact
Opentool part.Checklist