ChatGPTClaudeGrok / X / CursorGemini

DSH plugin web client: layering, remotes, and reconnect

Plugin DevelopmentPublished 2026-11-12Author: DeepSeek Plugin Market
DSH pluginDeepSeek HarnessWeb clientLayeringReconnect
DSH plugin web client: six-layer ownership, lazy CommonJS boot, generated remotes, non-React client models, and reconnect semantics per data kind.

"State got scrambled after reconnecting" usually means different data was treated as one recovery semantic. In DSH plugin's web client, the persistent session journal, control streams, and ordinary notifications each reconnect differently. Identify the channel first, then discuss fixes.

Six layers of ownership

Dependencies point one way, and the reverse direction travels only through callbacks.(source)

LayerMain ownerResponsibility
Host apppackages/api/*-controller host entriesAuthoritative state, persistence, mutation order, access policy, stream production
Transport and API assemblyclient/connection, api/gateway, api/remotesEstablish client generations; expose generated ctx.remote methods and streams
Client modelapi/session-controller/client and peersReact-free mirrors of host state handling races and identity
UI adapterclient/ui-session, client/ui-workspaceTurn model observables into slot sources; own view-level navigation
Conversation dataclient/ui-conversation, ui-chat and peersAssemble target snapshots; own shell and input flows
Composition and renderingclient/ui-slots, ui-renderer, feature packagesDeclare extension points, derive props, bind hooks, mount trees

The direction is: host state → remote transport → client model → UI adapter → conversation or presentation → slots → React.

User actions travel back through callbacks into injected client services or generated remote namespaces. Presentation components never receive Cordis ctx, transport objects, or other feature plugin implementations — a constraint that stops the UI from bypassing the model to mutate state.

Browser boot: a lazy CommonJS table

Loading a bundle only registers a factory; materializing the entry runs it.(source)

The Host writes the composed WebBootGraph into window.__DSH_BOOT__ and installs the browser module-loader facade before the parser-preloaded script runs. The module system is a lazy CommonJS table: loading a bundle registers a factory only, and materializing an entry runs that factory with synchronous require, resolving platform modules and declared dynamic dependencies.

The web boot kernel creates the module system, prefetches immediate entries, mounts the vendored Cordis Loader, and then creates every entry in the graph. Activation order comes from Cordis service injection; module graph order only decides whether a synchronous import can be materialized.

Boot auditing has a firm verdict: the full roster reaches settled and the audit passes — an entry in the browser-required list that fails to activate rejects startup, while other inactive entries emit one console warning. Finally ui-renderer hydrates without framework-owned boot DOM and calls the single context-level renderSlot('root').

Remote communication: use the generated face

Feature packages depend on generated service faces, not Gateway implementations or host runtime entries.(source)

Host business services mark callable methods with Typert Remote decorators. Host generation produces strict descriptors, runtime codecs, declaration merges, and source maps. The client api-remotes assembly selects those generated contributions and mounts concrete methods onto ctx.remote.<namespace> and Session-scoped agentCtx.remote.<namespace>.

Duties are split cleanly: Connection owns request URL resolution, request correlation, the /api carrier, trust checks, exact fetch routing, and connection generations; API Gateway owns remote dispatch, cancellation, logical streams, and forwarding of selected host events.

Controller operations belong in generated remote methods or explicit remote streams; feature-owned downloads register exact fetch routes. The internal $events logical stream is the Connection generation source: its opening ready frame carries the host home used for path display and establishes a generation once host listeners are mounted and before any controller begins a baseline read.

ctx.remote.$on() delivers allowlisted ordinary events to the root client context and scoped waterfall events to the resolved Session context; a waterfall listener may return a result, call next(), or reject.

Client models: state mirrors without React

The host decides truth; the client keeps only the latest usable local projection.(source)

Every API controller package owns a paired host face and client face. The client side maintains identity-stable, React-free models over the same generated wire types and exposes observable snapshots plus commands. UI packages consume those client services instead of copying transport state into component stores.

Sessions split into three layers: ClientSessions provides ctx.sessions, owning references, source counts, Session scopes, and stable SessionBinding objects while projecting catalog state without the global current-Session choice; SessionManager owns the list baseline, live list and control updates, lazy Session instances, projection stores, subagent catalogs, and the conflict order between pulls and late updates; each Session owns one contiguous logical event window represented by SessionEventLikeEntry, plus paging, follow, prompt and control state, and snapshots for adapters.

The persistent event path hinges on the first frame: follow()'s first frame carries the current header, tail page, cursor, and the full projection baseline. History records carry explicit event-or-chunks discriminants with field-aligned inner events; the journal validates each record's closed logical seq range, and the client keeps it directly as a SessionEventLikeEntry with no per-record conversion. Every physical generation atomically replaces the retained window with that snapshot, then appends standard live events by seq. page() serves only older history and gap repair.

Workspace model and race merging

Reconnect replaces wholesale with a new baseline instead of guessing increments.(source)

api/workspace-controller keeps workspace mutation policy and the authoritative follow feed on the host. ClientWorkspaceModel owns browser rows, workspace order, archived and pinned Session id arrays, command echo, and race merging between streams and unary calls.

Each stream generation first yields a complete baseline, then upsert, remove, order, archived, and pinned increments; reconnect replaces the model with the new baseline. WorkspaceController exposes that model as ctx.workspaces, and ui-workspace offers useWorkspaces plus navigation callbacks.

Product semantics worth remembering: the sidebar ArchivedFilter controls default hiding in lists and search, showing archived, or showing archived only; archived rows keep their sort position but render greyed out and must be unarchived through the row menu or a search result before opening, calling workspace.unarchiveSession. Session display order lives in browser local storage and includes hidden archived entries; pinning moves a Session within that full order, and unpinning does not restore a previous position.

Conversation, slots, and reconnect

The persistent journal and control streams recover differently, and ordinary notifications never replay.(source)

ui-session installs the Session scope adapter and provides useSessions, useSessionStatus, useSession, and useProjection over the remote-access client service. SessionProvider may inherit an outer binding or bind an explicit SessionReference, so coexisting subtrees can point at different Sessions.

ui-conversation binds once per SessionBinding.eventSource. The event registry associates persistent Session events with client-only assistant and live-chunk updates into stable business contexts, and the view registry materializes target snapshots. Chat Assistant, Trajectory Assistant, and Turn Tail all interpret both live chunks and the compact stream embedded in persistent settlement, so reconnect and paged history reproduce identical Assistant state without persistent token rows.

ui-slots provides the typed registry and lifecycle ledger; ui-renderer is the only package binding raw observables through useSyncExternalStore, owning React context and rendering the root tree.

Reconnect semantics fall into three classes: the persistent Session journal validates logical seq ranges and replaces the window with each generation's opening snapshot, with page() filling older history and repairing later gaps; Session control and workspace streams retain the last published value while disconnected and atomically replace it with the new opening baseline; ordinary forwarded notifications never replay, so stateful domains needing reliable recovery must supply their own baseline, cursor, or explicit query.

There is no unified client runtime, events.mux, events.host, or generic resync() API. Physical and logical recovery are independent: the Gateway mux restores the physical WebSocket, and once Connection publishes a usable generation, each RemoteStream reopens its own logical source. Carrier failures may retry; business errors, illegal opening items, or protocol violations terminate the owning logical stream.

Package boundaries and verification

Feature packages share declarations only, never runtime values.(source)

Feature plugin packages may share declarations through import type; they must not import or re-export another feature plugin's values at runtime. Cross-package behavior uses injected Cordis services, and cross-package UI uses slots. Target-specific conversation definitions, projection helpers, and final view data stay in the owning target package even when Chat and Trajectory deliberately implement parallel logic. Shared runtime values need a narrow, feature-lifetime-free static owner such as client/store, ui-primitives, or a browser-safe util package.

Six verification steps:

  1. Disconnect the network for 30 seconds and recover, asserting no duplicated or missing persistent Session messages.
  2. Produce a control update while disconnected and assert recovery overwrites with the new baseline rather than stacking.
  3. Trigger an ordinary notification and assert it is not replayed after recovery.
  4. Archive a Session and assert the row remains visible but greyed out and cannot be opened directly.
  5. Unarchive it and assert unarchiveSession was called and the row opens again.
  6. Inspect the component tree after reconnect and assert no duplicate transport state exists.

If step 2 produces duplicated state, check whether the client model applied increments onto the old baseline instead of replacing first.

For how client modules are discovered and injected, see client module wiring; for slot extension, see slot hooks and injection.

One line to close: six layers with one-way dependencies, lazy CommonJS boot, remotes through generated faces, client models without React, reconnect split by data kind, and feature packages sharing declarations only.

ChatGPTClaudeGrok / X / CursorGemini

FAQ

Can a DSH plugin presentation component receive Cordis ctx?

No. DSH plugin forbids presentation components from receiving Cordis ctx, transport objects, or other feature plugin implementations. DSH plugin passes framework hooks, owner props, store actions, and explicit injections through derived props.

Are ordinary DSH plugin notifications replayed?

No. DSH plugin does not replay ordinary forwarded notifications. DSH plugin requires stateful domains needing reliable recovery to supply their own baseline, cursor, or explicit query.

Is there a unified DSH plugin resync API?

No. DSH plugin states the architecture has no unified Client Runtime, events.mux, or generic resync. DSH plugin exposes generation state from Connection, logical streams from Gateway, and per-model replacement or continuation semantics.

Can an archived DSH plugin session be opened directly?

No. DSH plugin keeps the archived row in place but greyed out. DSH plugin requires unarchiving through the row menu or a search result first, then opening.

Related Terms

WebBootGraph
WebBootGraph is the composition boot graph the Host writes to window.__DSH_BOOT__, describing each browser entry and its dependencies.— DeepSeek Harness reference - Web client architecture
SessionBinding
SessionBinding is the stable binding object ClientSessions owns, carrying the Session scope, eventSource, and related references.— DeepSeek Harness reference - Web client architecture
SessionEventLikeEntry
SessionEventLikeEntry is one entry in the Client's contiguous logical event window, kept from packed Remote history without per-record conversion.— DeepSeek Harness reference - Web client architecture
ClientWorkspaceModel
ClientWorkspaceModel is the browser-side workspace model owning rows, order, archived and pinned arrays, and stream versus unary race merging.— DeepSeek Harness reference - Web client architecture

Sources