ext: add 'Open in workspace' extension for read_file tool cards - #5
ext: add 'Open in workspace' extension for read_file tool cards#5ChonSong wants to merge 3 commits into
Conversation
Inject a Lucide folder-open button inside buildToolCard() for tools classified as 'read' kind (_toolActionKind). Clicking opens the file in the workspace file-tree panel via openArtifactPath(). - toolReadPath computed upstream from _toolTargetLabel(tc) - Button rendered inside .tool-card-detail (expanded), with a !hasDetail fallback for cards without a snippet/args section - Uses data-ws-path attribute + dataset read to avoid JS string escaping in the inline onclick - CSS .tool-card-ws-open / .tool-card-ws-open-btn styled to match .tool-card-more pattern (blue link, 10px, opacity hover)
This reverts commit 35fa241.
This replaces the previous core-patch approach (reverted in 1fde372) with a proper extension that: - Uses a MutationObserver to watch for tool-card-row[data-tool-kind='read'] elements and injects an 'Open in workspace' button - Reads the file path from row._tcData.args (path/file_path/file/target/name) - Falls back to injecting at the card level when no .tool-card-detail exists - The button calls openArtifactPath(path) — same function the workspace panel uses for artifact links - Stays off by default: use via HERMES_WEBUI_EXTENSION_DIR or Settings → Extensions gallery install Usage: HERMES_WEBUI_EXTENSION_DIR=./extensions/open-in-workspace HERMES_WEBUI_EXTENSION_MANIFEST=manifest.json python3 bootstrap.py
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Moved to ChonSong/hermes-webui-extensions — this is an extension, not core WebUI code. Scope expanded: now also adds numbered file-change chips (write_file/patch/read_file) to assistant message footers. New home: ChonSong/hermes-webui-extensions#6 |
Summary
An extension that adds an "Open in workspace" button to
read_filetool cards. Clicking callsopenArtifactPath(path)— same mechanism used by workspace panel artifact links.Why an extension, not a core patch
The WebUI has a proper extension system (
api/extensions.py,docs/EXTENSIONS.md). This is a textbook use case: additive workflow UI that should be opt-in. Zero footprint when not installed — no CSS bundle change, no core JS change.How it works
MutationObserverto watch for.tool-card-row[data-tool-kind="read"]elementsrow._tcData.args(path / file_path / file / target / name).tool-card-detailopenArtifactPath(path)— the same function used by the workspace panelInstall
Or from Settings → Extensions → Gallery (after this is published to the gallery).
Files
extensions/open-in-workspace/open-in-workspace.jsextensions/open-in-workspace/manifest.jsonextensions/open-in-workspace/README.mdRelated
ext/open-in-workspace