Artifact Space: View valid artifacts by session in the DSH sidebar

Preface

After a DSH session finishes, the workspace often has scattered writes from a dozen places: the reports delivered to you, scripts you tweaked on the fly, and generated intermediate data. While these exist in the host logs, it is not easy to fish them out from the logs—you have to remember the filenames and filter out the ones that actually still exist on the disk from the endless write and edit events. Artifact Space aims to do exactly this: list the valid artifacts left behind by a session, organized by workspace and session, with direct preview in the panel.

The plugin introduced below is Artifact Space, repository majestyjun/artifact-space, npm package name @xxjxx/artifact-space, current version 1.4.0, MIT licensed (see repository LICENSE). It is positioned as a client-side plugin that adds an “Artifact Space” sidebar entry to DSH.

What is it

In a nutshell: It adds an entry to the DSH sidebar that lists the valid files produced by each session, organized by “Workspace → Session”, and supports direct preview.

Technically, it is in the form of a package-bundle, split into a host side and a browser side:

Side File Responsibility
Host index.js Registers two routes requiring authentication: GET /api/artifact-space.rows and GET /api/artifact-space.read
Browser client.js Registers a sidebar entry (sidebar.panellist) and a main panel (main slot, key artifact-space)

The two sides communicate via authenticated host routes registered through ctx.connection.fetch.register. Credentials do not leave the local loopback. The plugin declares that it does not use any host private APIs.

What counts as artifacts

The host side folds each session’s own log events, retaining two categories:

  • Files declared via deliverables/presented, type presented;
  • Files written or modified by successful write, edit, or str_replace_editor calls, type produced.

Only files that still exist are listed. Sessions with no surviving artifacts are discarded. Workspaces and sessions are sorted by last active time.

Each artifact also carries three pieces of source information on the panel: marked as “Delivered” or “Produced”, from which round of conversation, and what the session said about this file at that time. List rows only show badges, while the preview area header fully displays the round and description.

Core Features

Previewing selects the rendering method based on the file extension, rather than dumping raw text directly: Markdown, HTML, YML/YAML, and JSON each have dedicated renderers; images are displayed directly; other formats fall back to plain text.

Code files (e.g., js, ts, py, json, yml) are opened in an editor form: line numbers snap to scrolling, syntax highlighting, and the bottom status bar shows language, line count, size, and encoding.

Images go through a dedicated route: the host returns raw bytes when the file is located within its workspace, has an image extension, and is under 16 MB in size, along with the corresponding Content-Type. SVGs are also rendered as images, and scripts within them are not executed by the browser. The image preview area provides fullscreen viewing and downloading.

HTML artifacts are delivered by the host, but relative references in the document (e.g., src, href, poster, srcset) are first rewritten to resource addresses with session authentication. Absolute addresses, data: URIs, and pure anchors remain unchanged; references climbing out of the workspace root using .. are rejected. The document is delivered with content-security-policy, and the preview box has an additional sandbox permission for containment; scripts in the document will not execute.

Search matches across three levels: Workspace, Session, and Artifact. Space-separated words are “alternatives” rather than “narrowing”, so searching for client json finds both client.js and package.json at the same time. Matching words are highlighted, the result count is displayed next to the search box, and Ctrl/Cmd+F focuses the search box.

Favorites use “Session + Path” as the key, persisting across restarts via localStorage. The key prefix is artifactSpace.favorite.v1.*. Each favorite occupies one key; unliking directly deletes that key. When storage is unavailable (private window, quota full), the feature degrades to being valid only for the current session, rather than throwing an error. The lifecycle of a favorite can be longer than the session: once the owning session is deleted, the entry is marked as invalid and cannot be opened. The “Clean N Invalid” button in the favorites header deletes these entries. Invalid entries are not automatically cleaned up—the host will drop the entire row when the session log is unreadable or being waited for, so “not in the list” does not prove “file deleted”.

Installation and Enablement

Install from the Plugin Market: Open Settings → Plugins → Discover, search for Artifact Space, and install. The market will install the exact version specified in the index and enable it via the profile patch. The status of public directory listings in the README is as follows:

Directory Location Status
Official Plugin Market (awesome-dsh-plugin registry) awesome-dsh-plugin.com PR submitted
1024 Community Plugin Directory deepseek1024.com Listed and synchronized
Community Plugin Picks kejixiaoliang/awesome-dsh-plugins PR submitted

Install from registry:

npm install @xxjxx/artifact-space

Or use DSH’s command directly:

dsh plugin add @xxjxx/artifact-space

Then enable it in your own profile patch (~/.dsh/profiles/desktop/cordis.patch.yml):

- insert:
    - id: artifact-space
      name: 'artifact-space'

The environment requires DSH >= 0.1.5-alpha.2, which is declared in the engines.dsh range; the host will refuse to load if the running version does not meet the requirement. The browser side hot-reloads via dsh-client-hmr; changes to the host side require re-enabling the plugin (or restarting the app) so that the modules are re-imported.

Typical Usage

After installation, the “Artifact Space” entry appears in the sidebar. Open it to see workspace groups sorted by last activity. Expanding an item shows the list of sessions under that workspace, and expanding a session shows its artifact rows.

To find things, simply type artifact name fragments in the search box. Because space-separated words have an “alternative” semantic, client json matches both client.js and package.json in one go. If there are too many session rows, they can be collapsed; by default, only enough fit on the first screen are expanded.

Clicking an artifact row enters the preview area header, where you can copy the content or the absolute path. Copying prioritizes the asynchronous Clipboard API; if the host doesn’t support it (API missing, permission denied), it falls back to a hidden textarea with execCommand('copy'). The button will truthfully show failure when clipboard write is rejected. Binary files and files outside the workspace have no content to copy, but paths can still be copied.

Click the star icon on an artifact row to favorite it for later viewing in the favorites view.

Applicable Scenarios and Notes

Suitable for developers who continuously use DSH for multi-round collaboration, especially scenarios where artifacts are scattered across many sessions and you need to trace back “which round a certain report was produced in and what was said at that time.”

Before installation, you need to confirm one thing: the plugin runs with the permissions of the current dsh process and can read the host’s session logs and workspace files that it opens to it. It declares it does not initiate any of its own network requests or send data anywhere; however, you should still review the source code to confirm this yourself, as you should have read the MIT license as well.

Favorites are stored locally under the browser profile; unliking deletes the corresponding storage record, and the “Clear All” in the favorites header deletes all favorite storage records together. When in a private window or quota is full, favorites are only retained within the current session.

Conclusion

The value of Artifact Space lies in the fact that it does not change how DSH produces outputs, but rather reorganizes information already existing in the session logs into a list that is previewable, searchable, and bookmarkable, organized by workspace and session. For developers who need to frequently trace back session artifacts, it saves the trouble of sifting through logs.

Directory Page: https://www.skillhub.cn/plugins/majestyjun/artifact-space
GitHub: https://github.com/majestyjun/artifact-space

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye