Skip to content

ext: add 'Open in workspace' extension for read_file tool cards - #5

Closed
ChonSong wants to merge 3 commits into
masterfrom
ext/open-in-workspace
Closed

ext: add 'Open in workspace' extension for read_file tool cards#5
ChonSong wants to merge 3 commits into
masterfrom
ext/open-in-workspace

Conversation

@ChonSong

Copy link
Copy Markdown
Owner

Summary

An extension that adds an "Open in workspace" button to read_file tool cards. Clicking calls openArtifactPath(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

  • Uses MutationObserver to watch for .tool-card-row[data-tool-kind="read"] elements
  • Reads the file path from row._tcData.args (path / file_path / file / target / name)
  • Injects a Lucide folder-open button inside .tool-card-detail
  • Falls back to card-level injection when no detail section exists
  • Button calls openArtifactPath(path) — the same function used by the workspace panel

Install

HERMES_WEBUI_EXTENSION_DIR=./extensions/open-in-workspace \
HERMES_WEBUI_EXTENSION_MANIFEST=manifest.json \
python3 bootstrap.py

Or from Settings → Extensions → Gallery (after this is published to the gallery).

Files

File Purpose
extensions/open-in-workspace/open-in-workspace.js Extension script
extensions/open-in-workspace/manifest.json Gallery manifest
extensions/open-in-workspace/README.md Usage docs

Related

ChonSong added 3 commits July 14, 2026 22:35
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 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
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e5dbe8c7-7d49-4b6a-ae85-f90863a558bd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ChonSong

Copy link
Copy Markdown
Owner Author

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

@ChonSong ChonSong closed this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant