返回目录
其他 插件

dsh-lan-access

nonmean/dsh-lan-access

DeepSeek Harness web plugin that adds a LAN access

Stars
0
Forks
0
Issues
0
更新
今天

PROJECT TOPICS

项目标签

PROJECT README

README

dsh-lan-access

A DeepSeek Harness web plugin that adds a LAN access toggle to the DSH Settings shell (Settings → General). It replaces the manual cordis.patch.yml webserver override:

  • On — the web GUI binds 0.0.0.0, so other machines on the same network can open it at http://<LAN-IP>:3080. The /api trust fence is updated live, so the browser on a LAN machine works fully (chat, tools, workspace).
  • Off — the GUI binds 127.0.0.1 again (loopback only — the safe default).

How it works

Half File Role
Host src/index.ts Registers the persisted lan-access settings namespace, the fenced /lan-access JSON route (GET state / POST set), the bind controller, and the lanAccess bind-host service. The webserver row's composed host expression reads that service, so every webserver (re)start — boot, toggle, or a post-boot user-patch re-apply — converges to the persisted setting; the controller only restarts the row when the bind actually differs.
Client src/client/ Registers the General-settings row (settings.general.item, order 15) with a native checkbox switch, the LAN URLs (primary first, all live NIC addresses shown, copy button), zh/en copy, and restart-tolerant polling.

The route fence accepts loopback or the deployment's trusted authorities, read live from the connection row's resolved config — the same boundary the /api gateway uses. Cross-site requests are refused.

Install from GitHub

The built artifacts (lib/) are committed, so installation needs no build step and no modification of the DeepSeek Harness checkout:

# From GitHub (replace <owner>/<repo>)
dsh plugin --profile web add git+https://github.com/<owner>/<repo>.git

# ...or clone and install the local checkout (link: keeps your rebuilds live)
git clone https://github.com/<owner>/<repo>.git
dsh plugin --profile web add link:/path/to/dsh-lan-access

# Restart the GUI
dsh web

The install appends dsh-lan-access to dsh.profile.bundles; its dsh.bundle.patch inserts the host row and overrides the webserver row's host with the lanAccess service expression. The client half is picked up by the client-modules scanner automatically. No harness change is required for the core feature — the toggle, the LAN bind, and the live /api trust fence all ship inside the plugin.

Local development — rebuild with pnpm build (or npm run build) after changing src/, then reinstall/restart. The repo's node_modules mirrors the DSH profile's package farm (TypeScript/tsdown come from the harness checkout).

Migrating from a manual patch — remove any webserver host: 0.0.0.0 override from the profile's cordis.patch.yml (and the bundle patch layers) so the plugin is the single owner of the bind host.

Use

  1. Open the GUI, go to Settings (sidebar footer) → General.

  2. Flip 局域网访问 / LAN access.

    • Enabling shows the ONE address other devices can open — the IPv4 of the interface that owns the default route (http://192.168.x.x:3080) — with a copy button.
    • The web server restarts to rebind; the row waits for it and re-reads the state (a network error mid-restart is not reported as failure).
    • The plugin also installs a crypto.randomUUID polyfill on plain-HTTP LAN origins (that Web API only exists in secure contexts, and the DSH API client mints every RPC id with it — without the polyfill a remote browser fails with "crypto.randomUUID is not a function").
  3. The choice is persisted in ~/.dsh/settings.yaml:

    lan-access:
      enabled: true

Optional compatibility patches (fully working workspace from LAN)

The plugin itself is self-contained, but two pre-existing DSH ecosystem gates also block LAN browsers and live outside the plugin's own code. The repo ships both fixes as ready-made patches with one installer:

./scripts/install-patches.sh web                          # better-sidebar fence fix
./scripts/install-patches.sh web /path/to/deepseek-harness # + optional harness patch
Tier Patch Fixes When you need it
2 patches/dsh-better-sidebar.patch dsh-better-sidebar's trust fence matched the connection row by the wrong name and read the raw !!js config, so its panels (explorer / editor / terminal / git) only ever accepted loopback. The pnpm patch matches @deepseek-ai/dsh-client-connection and reads the fiber's resolved trustedHosts per request. You use dsh-better-sidebar and want its panels from a LAN machine.
3 patches/harness-connection-trustedHostPrivileged.patch The /api gateway pins host.pickDirectory and host.openPath to loopback even on trusted-host deployments (a deliberate no-authentication boundary). The patch adds an opt-in trustedHostPrivileged config to packages/client/connection and rebuilds it. You want LAN browsers to open paths in host apps / use the native directory chooser. Optional: the workspace's own add/browse flow does not need it.

Tier 2 is applied to the profile itself (a pnpm patch, like any patchedDependencies). Tier 3 modifies the DSH dev checkout: it applies with git apply, runs the harness's own pnpm run build:lib:client build, and then asks you to add the connection-row override (the installer prints it; restate trustedHosts, drop trustedHostPrivileged to restore the pin). Without the Tier-3 harness patch the extra config key is ignored harmlessly, so the two tiers can be installed independently. The harness patch is generated against the 0.1.0-rc.5 checkout it was developed on; on a different DSH version, git apply may fail and the two small hunks (Config field + the privileged set in apply) are trivial to re-apply by hand.

Security notes

  • Default is off (loopback). The DSH launcher itself refuses --host 0.0.0.0 for the same reason: binding all interfaces exposes the agent's tools to the network. Only enable it on a trusted network.
  • The toggle is only reachable through the fenced route, and disabling from a remote machine cuts that machine off (expected — re-enable locally).
  • The bind survives plugin reloads and patch re-applies; a full process restart re-applies the persisted value at boot.

Development

pnpm build        # tsdown: lib/index.js (host) + lib/client.js (browser bundle)
pnpm typecheck    # tsc --noEmit

The client bundle is a __ModuleLoader__.load closure-factory artifact (same format as the DSH monorepo's tsdown client preset); only the frozen platform-module table words stay external. After changing client code, rebuild and restart dsh web (the client-modules package metadata cache expires only on restart).

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类其他
规则置信度

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。