dsh-session-url-plugin

August 16, 2026 · View on GitHub

English | 中文

Part of the dsh-plugins collection; see that index for all self-built plugins.

A browser-only plugin for the DSH Web GUI that syncs the address-bar URL to the current session and accepts deep links that open or start conversations — mirroring how ChatGPT and Claude expose conversations in the URL.

URL scheme

  • ?session=<id> — open the conversation with that id (like ChatGPT's /c/<id> and Claude's /chat/<id>).
  • ?q=<prompt> / ?prompt=<prompt> — start a new conversation and send the prompt immediately (like Claude's claude.ai/new?q= and ChatGPT's chatgpt.com/?q=).

Behavior

  • Session → URL: selecting any session rewrites the address bar to ?session=<id> via history.replaceState (no history pollution); returning to the blank no-session state removes the parameter.
  • URL → session: on load and on popstate, the plugin reads ?session= and opens that session (guarded by byId, so an unknown id is ignored), and reads ?q=/?prompt= to start a new conversation and auto-send the question.
  • Consumed q/prompt parameters are removed from the URL so a refresh does not re-send.

How it works

Two invisible (null-rendering) slot entries:

  • shell.overlay (root scope) — UrlController watches the current session through the useSessions hook and rewrites the URL; it also consumes deep links once the session list reaches ready, and re-reads the URL on popstate.
  • conversation.input.dock (session scope) — PromptInjector delivers a pending ?q= prompt into the next blank session (inputActions.setDraft + submit). It listens to a closure-level signal so a reused blank session (no session-id change) still receives the prompt.

The host half (index.js) is an empty apply: all behavior lives in the browser bundle (client.js), discovered through the package.json dsh.client declaration.

What it reads and writes

The plugin reads the client sessions / workspaces / slots / timer services and the browser location / history. It writes only the page URL via history.replaceState; no wire data and no durable state.

Installation

Copy the following block to your DSH agent and it will install the plugin for you:

请安装会话 URL 深链插件(@doiiarx/dsh-session-url-plugin):

1. 克隆仓库:
   git clone https://github.com/DoiiarX/dsh-session-url-plugin
   cd dsh-session-url-plugin
2. 挂进 web profile:编辑 $HOME/.dsh/profiles/web/package.json,
   在 dependencies 加 "@doiiarx/dsh-session-url-plugin": "link:<本插件目录绝对路径>",
   在 dsh.profile.bundles 加 "@doiiarx/dsh-session-url-plugin"。
3. 在 profile 目录执行 pnpm install。
4. 重启 DSH web 服务器(新增 client 插件行在启动时扫描)。
5. 验证:打开 http://127.0.0.1:3080/?q=测试 会自动开新对话并发送;切换会话时地址栏出现 ?session=<id>。

Model Experience

None, as a presentation-only plugin: URL state and deep-link navigation are browser UI and never reach a model request. The plugin contributes no system-prompt prose and no tool schemas.

Known Limitations and Deferred Work

  • No path-based routes — the plugin uses query parameters (?session=) rather than ChatGPT/Claude-style path segments (/c/<id>), so it needs no server route and cannot break the SPA's root path.
  • replaceState, not pushState — the URL always reflects the current session but adds no history entry per selection; back/forward still work through the popstate re-read, but session clicks do not build a browser history chain.
  • Auto-send is best-effort — the ?q= prompt is delivered through the composer inputActions; a composer blocked by model-selection policy may still receive the draft but not submit it.