DSH Plugin Data Flow: Host Supplies, Client Displays
Keeping all credential and network access on the Host side means the browser never sees keys, and plugins share data through a single host channel instead of each client reaching out independently. That makes security review and debugging straightforward: the Host is the only trust boundary.
DSH plugin architecture puts a clean separation between data and display. The Host process handles credentials, file access, external network calls, and persistence; the Client is a thin view that only requests specific data and paints it. LocalStorage, often cited as a counterexample, is just a cache for data that already arrived in the browser, not a source. Anything that requires host capabilities—user info, API keys, file contents—cannot be obtained by the Client directly.
The article traces a login-to-display flow: the login plugin's Host verifies credentials and stores user info; the display plugin's Host retrieves it via Cordis services using `ctx.get`; then it pushes to its own Client either through Typert Remote (type-safe RPC with zod validation and generated contracts) or HTTP routes (like `dsh-provider-usage` polling `GET /stats` every 60 seconds). The Client never looks for data; it asks and renders.
Host-side data sources vary: adapters pull usage from external APIs (DeepSeek, Kimi, OpenRouter) with keys kept in the Node process, or read local credential services, or execute shell commands via `ctx.shell` and return structured output. Communication options include Typert Remote as the official strong-typed channel, HTTP for polling and status endpoints, and WebSocket for streaming; `dsh-work-chat` even layers SSE on top. The rule: if a task needs credentials, file system, external network, or host state, the data source belongs to the Host.
The distinction between where data is stored (browser cache) and where it originates is a common source of confusion in plugin systems; the article's explicit separation clarifies the trust model.
Cordis's service mechanism lets Host-side plugins share data without any Client involvement, so cross-plugin communication stays inside one process and avoids network overhead.
The preference for Typert Remote over HTTP for typed data shows type safety across the boundary is valued, yet HTTP remains for polling and status, indicating a pragmatic mix rather than a single mandate.
I really approve of this division. The Client should just focus on rendering. I once took over code that used localStorage as a data source and went wild with it; state was all over the place, and trying to change it was a nightmare.