Dynamic-plugin mode (Settings-page UI without installing the package)
August 14, 2026 · View on GitHub
The packaged dsh-vps-hub (install via npm) provides the eight vps_* model
tools. If you also want the Settings → VPS Hub page (Orca-style UI:
server cards, test-connect, add form with ~/.ssh/config alias prefill,
remove) without installing the package, load this example as a session
dynamic Cordis Plugin:
-
In a DSH session with dynamic-plugin support, call
cordis_definewith:-
code.host:return { name: 'vps-hub', apply: /* paste the body of apply() from host.js — i.e. the whole file minus the first line "export function apply(ctx) {" and its final closing "}" */ } -
code.client:return { name: 'vps-hub-ui', apply: /* paste the body of apply() from client.js the same way */ }
-
-
cordis_runthe returned package. The client half asks for approval once — allow it in the UI. -
Now, for the life of the session (until DSH restarts):
- the eight tools
vps_list/vps_import_ssh_config/vps_add/vps_remove/vps_test/vps_exec/vps_upload/vps_downloadare callable by the agent; - Settings → VPS Hub shows the server ledger UI.
- the eight tools
The ledger file ~/.dsh/vpshub-targets.json is shared with the packaged
plugin, so both modes interoperate. Keys stay path references only.
Note: dynamic plugins are session-scoped and vanish on DSH restart (the ledger file persists). For a permanent install, use the npm package instead — see the repository README.
Two ways to use these files
A. Full dynamic plugin (standalone — tools + UI, no npm install)
Use host.js + client.js. The session gets both the eight vps_* tools
AND the Settings UI. Do NOT also mount the npm package in the same session —
tool names would collide.
B. UI-only overlay (recommended when the npm package is installed)
Use ui-only-host.js + client.js. The npm package keeps serving the tools;
this overlay adds ONLY the Settings → VPS Hub page and its RPC handlers, so
both coexist. Steps:
cordis_define:code.host: pasteapply()'s body fromui-only-host.jsasreturn { name: 'vps-hub-ui-rpc', apply: <body> }code.client: pasteapply()'s body fromclient.jsasreturn { name: 'vps-hub-ui', apply: <body> }
cordis_runand approve the client half once.- Settings → VPS Hub.
Approval policy note
The client half needs a one-time approval. If your deployment runs with
approval disabled (DSH_PERMISSION_MODE=danger-full-access / policy
never), dynamic client plugins cannot be authorized — switch the session
permission mode to workspace-write (Settings → 权限 → ask) or set
DSH_PERMISSION_MODE=ask for the session where you load the UI, approve,
then switch back. The ledger and tools are unaffected.