dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
Remote-only OpenKapsel workspace bridge for the DeepSeek Harness: replaces host filesystem and shell tools with a fail-closed remote tool set. Self-hosted alternative to cloud agent sandboxes.
OpenKapsel workspace bridge for the DeepSeek Harness. It turns a remote OpenKapsel workspace into model-visible tools: supply the read-only workspace URL ending in /w/ and its matching control token, and the agent can list/read/write files, run Shell tasks, and call the other OpenKapsel REST surfaces. The model has no host filesystem or host Shell tool in the bundled remote-only preset.
The bridge reuses the workspace-published openkapsel-rest skill's Python helpers (openkapsel_http.py and openkapsel_config.py), vendored under skill/. Each kapsel_* tool invokes one of those two fixed scripts through the harness host Shell service. The model cannot choose the script or use that service as a Shell tool. Authentication, Context attribution (plan_id/taskname/message), REST error decoding, and credential renewal stay owned by the maintained skill code. Every helper subprocess receives an explicit DSH workspace-write policy rooted at that agent's private state directory; the executor also controls any platform temporary-directory access.
Area · Requirements and scope DSH · Automatic mode registration requires DSH 0.2.0-rc.2 or newer with the declarative preset registry. Registration and tool activation are verified against 0.2.0-rc.2 and 0.2.1-rc.2 with the web profile. The legacy file installer is retained for older DSH versions. Other profiles are not verified. Node.js · Package declares >=18; the test matrix covers Node.js 22 and 24. Use a version supported by your DSH installation; Node.js 18 is not covered by this project's CI. Python · Python 3.10+ on the Host's PATH: python on Windows, python3 on macOS/Linux. The test matrix covers 3.10 and 3.14. Host platform · macOS/Linux use DSH's Bash executor; Windows uses DSH's PowerShell executor without Bash. GitHub installation and Host startup verified on macOS. Windows installation and actual plugin use confirmed by user testing (2026-09-09). Linux/Windows automated tests are configured in CI. External service · Requires a reachable, user-selected OpenKapsel Server and its Workspace URL/control token. Requests and their supplied file contents or commands are sent to that server. Local access · Runs fixed Python helpers through DSH's Shell service and writes session credentials under $DSH_HOME/state/dsh-openkapsel (default ~/.dsh/state/dsh-openkapsel). Model-facing host file/Shell tools and run_code are denied. Credentials · Stores the read URL and control token under the user's DSH state directory. Unix uses 0600 files and 0700 directories; Windows relies on the containing user directory's ACL (chmod does not enforce Unix permissions there). Automatic renewal may replace stored credentials. Remote permissions · Can read, modify, and run Shell commands within the remote token's grants. Typed tools are conveniences; the server enforces authorization for generic REST calls too. DSH policy · read-only denies remote mutations and Shell; a one-call approval may authorize a retry. workspace-write and danger-full-access both remain bounded by the remote token. License · MIT. This is a community plugin, not an official DeepSeek product.
An installed Cordis package could implement the transport in Node. This bridge keeps Python because the existing helpers already own renewal, authentication, error decoding, and Context merging. Reusing them avoids a second protocol implementation that could drift as OpenKapsel evolves. This does not grant the model a local Shell: script paths are plugin-owned constants and arguments travel as JSON on stdin to a fixed Python bootstrap.
Requires python on Windows or python3 on macOS/Linux on PATH.
index.js Host-side Cordis plugin and typed remote tools
bundle.js Legacy preset-copy bootstrap for pre-0.2 DSH
cordis.patch.yml Declarative OpenKapsel mode registration
preset-install.js Legacy, update-safe preset file installer
skill/openkapsel-rest/ Vendored REST skill and fixed Python helpers
preset/kapsel/ Canonical remote composition and legacy mode files
bin/install-preset.js Copies mode files for older DSH installations
cordis.example.yml Annotated bridge row
tests/ Tool-catalog and remote-isolation testsInstall from GitHub into the DSH web profile:
dsh plugin --profile web add github:zzzmmmnn/dsh-openkapselNo manual symlink or local source checkout is required. DSH manages the package as a profile dependency. Its dsh.bundle patch declares OpenKapsel Remote through @deepseek-ai/dsh-agent-preset. The bridge and its remote-only guard belong to that mode; the default standard mode is unchanged.
Restart DSH after installing or updating. Create a new session and select OpenKapsel Remote, then supply the workspace URL and matching control token through kapsel_config. Existing non-empty sessions keep their selected mode. The current DSH registry eagerly validates mode compositions, so tools can be registered at startup while remaining visible only within the selected mode.
Version 0.9.5 fixes mode discovery on DSH 0.2. Copying files into $DSH_HOME/.agent-presets/kapsel alone no longer registers a mode. No manual profile patch or preset-copy command is needed with the new bundle. If you previously added a preset-openkapsel declaration to your profile as a workaround, remove that declaration when upgrading: the bundle now owns it. Preserve any custom mode configuration by applying it as an override of the bundle's preset-openkapsel row rather than adding a second declaration.
For pre-0.2 installations that discover file-based presets, the explicit dsh-openkapsel-install-preset command and dsh-openkapsel/bundle export remain available. They copy to $DSH_HOME/.agent-presets/kapsel (default ~/.dsh/.agent-presets/kapsel) and preserve locally modified files. Use dsh plugin --profile web exec dsh-openkapsel-install-preset --force only to intentionally replace those files. Older hosts need their legacy profile integration; the current automatic bundle targets the declarative registry. Uninstalling the package does not delete legacy files or session credentials.
Select OpenKapsel Remote in the DSH preset picker:
Do not add dsh-openkapsel to standard or minimal: both expose host-local tools. The bundled preset intentionally omits host Bash/PowerShell, filesystem/search/editor, job control, local AGENTS.md discovery, and local skill discovery. It retains only the OpenKapsel bridge plus skill, ask_user_question, and todo_write.
The plugin also installs a fail-closed tool guard. Accidentally composing an undeclared or local tool therefore causes execution to be denied even if a future preset edit makes that tool visible to the model. DSH's optional run_code presentation transport is denied. Remote-only mode explicitly selects native tools, so model-authored code is not executed through a host code runtime.
The bridge resolves the current policy from ctx.sandboxPolicy for every tool call:
DSH mode · Remote OpenKapsel behavior read-only · Allows configuration, status, Discovery, filesystem reads, and generic GET/HEAD; denies remote mutations and Shell execution workspace-write · Allows every capability granted by the OpenKapsel token danger-full-access · Same bridge behavior as workspace-write; it never widens the OpenKapsel token
A denied mutation can be retried with a one-call approval request:
{
"sandbox_permissions": "workspace-write",
"justification": "Update the requested remote configuration file once."
}The plugin delegates the request to DSH's approval service before contacting the remote mutation endpoint. Approval does not change the session's durable sandbox mode. Rejection, cancellation, a missing approval channel, malformed fields, and non-widening requests all fail closed.
The bridge row inside the bundled preset is:
- id: tool-kapsel
name: 'dsh-openkapsel'
config:
taskname: dsh
enforceRemoteOnly: truedsh-openkapsel consumes the host shell, tools, skills, and sandboxPolicy services and publishes none. Mount it in the dedicated agent preset, not globally.
kapsel_config(workspace_url, control_token) stores credentials in thisDSH session's private plugin state, then selects or creates an active root Plan for mutation attribution. Re-run it to switch workspaces or rotate credentials.
skill("openkapsel-rest") loads the authoritative REST reference beforenontrivial operations.
Tool · Purpose kapsel_config / kapsel_status · Configure or inspect the active workspace kapsel_plan_update · Update or complete a Plan (parentage cannot be changed) with a structured debrief with a structured debrief kapsel_fs_list / kapsel_fs_read_files / kapsel_fs_stat / kapsel_fs_grep / kapsel_fs_find · Read-side filesystem kapsel_fs_write / kapsel_fs_replace · Remote text write/edit kapsel_shell_exec / kapsel_task_output · Run a Shell task on the server or a mapped client and poll its output kapsel_shell_request_approval, kapsel_files_request_approval, kapsel_function_request_approval · Request legacy Shell/File or generic function-owned grants; return approval URLs without executing operations kapsel_mapping_list · List mapped client directories, online status, and advertised execution/RPC capabilities kapsel_rpc · Unified server/mapping RPC entry: omit mapping_id for the server workspace or provide it for a client mapping; sync returns directly, task returns a normal server or unified client task id; writes use DSH approval + Plan/Context and mapped writes require a writable mapping kapsel_fs_copy / kapsel_fs_move / kapsel_transfer · Copy or move across workspace and client storage, then inspect/cancel/resume asynchronous transfers kapsel_recycle · List, restore, or explicitly purge an item in the selected storage root kapsel_http · Context, Memory, preview, schedules, and other REST surfaces
For client mappings, first call kapsel_mapping_list and inspect the client's reported platform and sandbox mode. Shell execution uses kapsel_shell_exec; a mapped cwd with target: "auto" runs on that client and returns a unified task ID. Inspect output with kapsel_task_output, and use kapsel_http with the ordinary /task/* lifecycle for status, stdin, interrupt, or kill. Mapping-specific public task/argv REST endpoints are not exposed. An unsandboxed client task has that client's OS-account permissions.
kapsel_shell_exec accepts target: "auto" (default), "server", or "client". Auto selects a connected client when cwd is inside its mapping (for example laptop/project), otherwise the server. A missing/denied client fails without server fallback. The client needs OpenKapsel 1.62.0+ and an enabled writable execution mapping. Its own OS, sandbox, and limits apply; server /env settings are not injected. The returned task ID works with kapsel_task_output and the standard /task/* controls via kapsel_http. Client stdout/stderr are combined in stdout; client stdin chunks are at most 16 KiB. The public execution interface is command-string based; there is no mapping-specific literal-argv REST endpoint.
kapsel_http.json is always a JSON object. Endpoint fields belong inside it, not beside it. Context-management endpoints are handled specially because their plan_id fields describe the Context graph rather than ordinary operation attribution; prefer kapsel_plan_update for Plan changes.
Each DSH agent is keyed separately by agent.id. Credentials live under $DSH_HOME/state/dsh-openkapsel//.openkapsel.env; active Plan and taskname values are held in an agent-keyed WeakMap. The local project cwd is not used for credentials or remote-workspace selection. An absolute stateDir plugin option can replace the default private state root.
For a recorded mutation, taskname is resolved from the current tool call, then the selected active Plan/session value, then the value set by kapsel_config, then the plugin's preset configuration, and finally dsh. Empty and whitespace-only values do not suppress this fallback. The active Plan is selected automatically when plan_id is omitted; selecting a persisted Plan after a Host restart also restores that Plan's taskname. A missing or blank message receives a short default operation message.
Typed tools are convenience wrappers, not an additional permission boundary. kapsel_http exposes the REST surfaces available to the selected credential; the remote server enforces endpoint, path, and capability authorization. DSH read-only mode additionally denies mutating HTTP methods and Shell execution. This assumes that GET/HEAD endpoints honor read semantics; project application routes implement their own behavior and authorization.
The current DSH Shell service accepts a command string, not an argv array. The bridge sends helper paths and arguments as ASCII JSON on stdin to a fixed Python bootstrap. Model input never enters the Host Shell command text. NUL arguments are rejected. Generated tests round-trip quotes, newlines, substitutions, backslashes, empty strings, and Unicode through Bash on Unix and PowerShell 7/Windows PowerShell 5.1 on Windows. Helpers retain their DSH sandbox policy, and their exit codes propagate through PowerShell.
Version 0.5.0 renames the package, installer command, and default state directory to dsh-openkapsel. Reinstall the preset and initialize credentials again after upgrading. To reuse an existing private state directory, explicitly configure stateDir to that directory. Tool names (kapsel_*) and the kapsel preset ID remain stable.
Run npm ci and npm test. GitHub Actions checks Node.js 22/24 with Python 3.10/3.14 on Linux and Windows, including helper argument round-trip and remote permission tests.
To check automatic mode registration against an installed DSH 0.2 host, set DSH_RUNTIME_PACKAGE to that installation's package.json and run node --test tests/runtime.test.js. For example, on macOS/Linux:
DSH_RUNTIME_PACKAGE="$(npm root -g)/@deepseek-ai/dsh/package.json" node --test tests/runtime.test.jsThe test uses a fresh temporary profile, the host's real plugin loader and Shell executor, and a local mock workspace. It checks mode discovery, isolation from Standard mode, successful kapsel_config initialization, Python error propagation, and a subsequent file listing. No model or external OpenKapsel workspace is contacted.
Version 0.9.7 uses the DSH 0.2 Shell process-handle API (execute(spec) followed by result()) for both Python helpers. The legacy run(spec) API remains supported for older explicit integrations.
Unix mode 0600 (Windows uses inherited directory ACLs). Neither the token nor its host-private path is returned in tool results.
writes, Shell, Context, and Memory.
taskname andmessage.
preview or public-share URLs.
kapsel_*, skill,ask_user_question, and todo_write.
npm testThe tests assert that the bundled preset contains no local Shell/filesystem provider and run two simulated DSH agents against separate HTTP workspaces. The integration test verifies that each remote workspace receives only its own write, the local sentinel remains unchanged, and credentials exist only under the private state root.
OpenKapsel uses explicit, scoped Workspace Password approvals independently of the host agent's own mutation permission. Before unsandboxed Shell execution, call kapsel_shell_request_approval with target: "server" or the exact Mapping ID and a specific reason. The response may include an approval_url; open it to grant access, then pass approved: true to kapsel_shell_exec. The adapter supplies the owning Conversation's writer_nonce automatically. Merely calling Shell never creates an approval URL. An omitted Shell timeout defaults to 120 seconds; explicitly provided finite positive timeouts are not capped by the old client maximum.
For generic function-owned Approval use kapsel_function_request_approval with a registered function, exact target, function-specific args, and reason. The adapter supplies the private Conversation writer nonce and owning Plan; the returned approval URL does not execute the function. Approval never bypasses explicit sandbox read-only or deny path rules. Completed Plans are immutable; create a new Plan for later work while modifying existing Memory independently.
For File read/write grants, use kapsel_files_request_approval with access: "read"|"write", explicit target, reason, and optionally an absolute external path (set scope_is_directory: false for a file alias). After approval, call the relevant File REST API through kapsel_http with approved: true and matching target. The adapter supplies the nonce and Plan Context automatically, including for approved reads. File read and write grants are separate; unscoped grants cannot unlock external paths. Grants do not bypass path deny rules, Mapping write protection, OS permissions or protected configuration. For more detail, read the bundled shell and files reference chapters. Host agent write approval still applies to any request needing remote mutation attribution.
kapsel_fs_find exposes indexed filename search with recursive fallback. query is optional (omitting it matches all filenames), mode can be literal or glob, and results can be sorted by name, path, size or modification time. Use an explicit Mapping/Storage path to search that source.
Version 0.9.0 added kapsel_fs_read_files, kapsel_fs_manifest, and kapsel_fs_grep. The current unified RPC contract targets OpenKapsel 1.62.0+. Git and Archive operations use kapsel_rpc; Git read operations remain independent of Shell/client execution permission and run bounded, validated Git reads directly in the original repository while retaining trusted operator Git configuration. Git add, commit, restore, checkout, branch/tag/stash mutations, fetch, pull, push, and clone are write=true, execution=task; Archive create and extract use the same task model.
kapsel_rpc is the single dynamic RPC entry point for both locations. Omit mapping_id to target the server workspace; provide a mapping name to target a client mapping. Server-capable families are advertised by Discovery under capabilities.mappings.rpc.families with server_rpc and operation categories such as sync_reads / task_writes. Client mappings continue to publish per-operation description, JSON input_schema, boolean write, and execution through kapsel_mapping_list.
A server task returns a normal server task id; a mapping task returns a unified client.. id. Poll either with kapsel_task_output; inspect or control either kind through ordinary /task/* routes with kapsel_http. Never replay an uncertain write-task start. write=true always uses DSH approval plus OpenKapsel Plan/Context; mapped writes additionally require the mapping to be administratively writable. There is no server/mapping/FUSE fallback after the RPC target is selected. Git reads/writes and Archive list/read/create/extract all use kapsel_rpc.
The generic HTTP tool recognizes POST fs/read/files and fs/query/manifest as read-only. It also classifies both rpc// and mapping//rpc// from runtime RPC metadata, so RPC reads bypass mutation approval while writes use approval and Plan attribution. Archive preview uses generic archive RPC (list/read). Other POST operations retain their existing guard. Query values may be arrays to send repeated parameters, e.g. include: ["*.py", "*.js"] or file: ["a", "b"]. The vendored REST skill is synchronized with the main OpenKapsel project. Server RPC task deadlines default to 600 seconds unless overridden (maximum 86400); mapped RPC task deadlines also obey the client task policy. The bundled HTTP helper waits 120 seconds and the DSH helper process budget is 130 seconds for ordinary synchronous requests.
The bundled REST references track OpenKapsel 2.3.0. The current mapping handshake requires client 1.62.0+.
An interrupted connection does not automatically cancel a client Shell task. Short tasks (timeout at most 120 seconds) run in the Client process and do not survive a Client process restart. Longer tasks (timeout above 120 seconds) run in the Client's shared, disk-backed Job Manager and can survive Client restart. The Job Manager is limited to 16 jobs globally and four per Mapping key. Job IDs have the form &xxxx&. Query /task/* after reconnect using the original ID; Manager output is disk-backed and can be read incrementally. If a task has disappeared, do not infer its outcome or automatically replay its start. The Client default timeout is 120 seconds, while an explicit finite positive timeout can be much longer (subject to the actual runtime policy).