dsh-docker-workspace
Docker remote workspaces for DeepSeek Harness. Attach a folder inside a
container on any Docker context — including a remote context reached over
ssh:// — and work on it from the Web GUI and from the agent.
The connection is the only thing that differs from
dsh-remote: instead of SSH + SFTP it
uses the docker CLI, so a docker --context you already trust is enough. You
get the same shape of experience — a workspace list, a file tree, text and image
preview, and download — read-only apart from downloads, with the picture below
for exactly what is and is not there.
What you get
- Docker workspace files — a Start-panel card (a
guideentry on the tab type, the same mechanism the reference plugin uses) opens a right-sidebar tab that lists the container tree of the workspace the session runs in. The tab's chip carries the same name, so it can be reopened from the tab strip after its first open. - File previews open as their own tab — clicking a file opens a
dsh-resource://docker-workspace/…tab beside the tree, rendered full width with a Download button. The address scheme is private because the host'sfileprotocol has exactly one provider, whose preview readsctx.fs. - One entry point for adding — Add Docker workspace… in the sidebar foot
opens the picker. The Workspaces section header is host-private markup and a
plugin has exactly one action seat (
sidebar.footer.action); a mirrored DOM node there proved unreliable (it can land in a collapsed section and hide the footer copy without showing anything), so it is not used. Created workspaces appear in the normal Workspaces list. - Container folders as workspaces — adding one also registers a harness workspace, so a session can be started in it and the project list groups it.
- Agent tools —
dw_contexts,dw_containers,dw_workspaces,dw_ls,dw_read,dw_write,dw_exec. Every call runs inside the container.
Why the native Files tab shows one file
DSH's built-in Files tab reads ctx.fs, and the harness allows exactly one
filesystem implementation per host: a second fs registration is refused
(service "fs" has been registered at <root>), and a workspace record must point
at a real directory (workspaceRegistry.create canonicalizes with fs.realpath).
An anchor directory is therefore unavoidable, and the built-in tab can only ever
show it — which is why the plugin writes a README.md there explaining where the
files are, and why reading container files is done by its own panel and its own
right-sidebar tab.
Install
dsh plugin --profile <name> add ./dsh-docker-workspace
Or use Plugins → Add plugin with this directory. Restart the host and refresh the page afterwards; the panel and tools appear with the plugin.
Use
- Click Add Docker workspace… in the sidebar foot. The picker opens as a
centered dialog: choose a context, a container and a folder such as
/workspace. Include stopped containers widens the container list. - The workspace joins the normal Workspaces list, so a session can start in it. In that session, open the Docker workspace files card on the Start panel to get the container tree.
- Select a file to open it in its own preview tab, where Download is available.
- In a session started in that workspace, ask the agent for anything that needs
the container — for example "run the tests in /workspace" — and it uses
dw_exec.
Requirements
- The
dockerCLI on the machine running the DSH host, with the contexts you want already configured (docker context ls). A remote context must be authenticated non-interactively, since the host cannot answer a password or host-key prompt. - A container that is running, and a POSIX
shinside it. Listing prefers GNUfind -printfand falls back tosh+stat+readlink(busybox/Alpine is covered); file transfers use the daemon's own tar archive, so a file's bytes never depend on tooling inside the image.
How it works
| Piece | Role |
|---|---|
lib/docker.js |
Spawns the CLI with an explicit --context; collects binary output. |
lib/tar.js |
ustar reader/writer for docker cp <ref> - and docker cp - <ref>. |
lib/service.js |
One method per operation: contexts, containers, list, read, write, exec, add/remove workspace. |
lib/route.js |
Loopback-only JSON route plus a byte route for preview and download. |
lib/tools.js |
Agent tools, all delegating to the service. |
lib/client.js |
The browser panel: workspace list, add form, file tree, preview. |
A container folder cannot be a harness workspace directly, because
workspaceRegistry.create canonicalizes with fs.realpath. The plugin therefore
keeps its own record of { context, container, path } and registers the harness
workspace on a small empty anchor directory. The record is the source of
truth; the anchor exists only so DSH can group a session under it.
Limitations
- One container folder per workspace; there is no cross-container view.
- No file upload into the container, no rename/delete, no watch/refresh from the
host side, and no git panel. Editing is done by the agent through
dw_write; the panel is read-only apart from download. - A directory listing is capped at 5000 entries, a preview read at 1 MiB and a download at 32 MiB.
- The panel route accepts requests from this machine only.
Diagnostics
The packaged desktop host keeps no plugin console output, so the plugin writes its own log:
$DSH_HOME/docker-workspaces/diagnostics.log # default: %USERPROFILE%\.dsh\docker-workspaces\diagnostics.log
Each line is timestamped and records the decisions that can silently fail:
- plugin readiness and the record count at startup;
add/removeof a workspace, with the outcome of the harness project entry;- every harness-registration failure, with the service's own error message;
- errors returned by the panel route;
- how many project entries a startup repair restored.
The same recent lines are returned with the panel's status call, and the panel
shows them in a collapsible warning whenever a workspace has no entry in the
project list — so a missing sidebar item explains itself without developer tools.
Records and cleanup
If a project entry is missing from the Workspaces list while the folder still
shows in the plugin panel, add the same container folder again: the plugin
restores the entry instead of silently doing nothing. At startup it also repairs
records that never got an entry, while leaving alone any record whose project you
deleted yourself.
Records and anchor directories live under $DSH_HOME/docker-workspaces by
default (override with the row's rootDir). Removing a workspace from the panel
deletes its record, its anchor directory, and the harness project entry that
was registered for it, so the project list does not keep a dangling entry. Files
inside the container are never touched.
Configuration
The row accepts plain config in cordis.patch.yml:
- id: dsh-docker-workspace
config:
dockerPath: C:\Program Files\Docker\Docker\resources\bin\docker.exe
route: /dsh-docker-workspace/api
rootDir: C:\Users\me\.dsh\docker-workspaces
timeoutMs: 60000
Development
This repository carries its own maintainer skill in
.dsh/skills/reference-first-plugin-research:
when a feature request names a reference project, investigate how that project
implements the feature — especially its UI wiring — and write the comparison table
before designing anything. .dsh/ is tracked on purpose and is excluded from the
package files, so it stays with the code but never ships.
Tests
pnpm test # unit + client contract + DOM UI harness
pnpm test:ui # DOM UI harness only
pnpm test:docker # live integration, starts its own container
- Unit — tar codec, container paths, store, route helpers, tool contracts, diagnostics, registry races.
- Client contract — loads the browser bundle with a stub loader and asserts its slot registrations, tab type, locale key parity and the click path.
- DOM UI harness (
test/ui.test.mjs) — loads the real bundle into jsdom with real React, mounts the components the host would mount, clicks the sidebar action, fills the dialog, opens the files tab and asserts the rendered DOM. It also hidessidebarRightTabs/sidebarRightfromctx.getto reproduce the host's asynchronous mount, so a regression to "capture the service at activation time" fails here instead of in your browser. - Integration — creates a
ubuntu:22.04container, exercises every service method, and removes the container afterwards; skips itself without Docker.
What the harness still cannot check: the host's real CSS/tokens, panel geometry, and how the slots look in the actual window. Those need a browser.
还没有评论,来写第一条。