Han-Yao94/dsh-session-toolkit ↗★ 3

dsh-session-toolkit

Unified local plugin: session identity, global prompt, auto-resume, web restart, session log reposition, peer message (6 plugins consolidated). 适合需要自动恢复会话、全局提示词注入及Web一键重启等综合功能的用户。

パッケージ
dsh-session-toolkit
互換性
未検証
Harness ピア範囲
^0.1.7-alpha.1
Cordis ピア範囲
^4.0.3
バージョン
0.1.11
ライセンス
MIT
最終更新
2026/09/23

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Han-Yao94/dsh-session-toolkit

ドキュメント

README 全文を読む ↗

Configuration and the settings data plane

The plugin's host-side Config validates the entire configuration tree with schemastery as soon as the plugin loads; resolution order is schema default → profile patch (user layer), both resolved on the host before the plugin sees them.

From DSH 0.1.7 on, settings projects only fields declared volatile(), and a settings surface is identified by exactly two facts: the id of the edited entry (session-toolkit) and that entry's Config. Consequently:

  • User data (identity texts, global and per-workspace prompts, the auto-resume switches, the UI knobs) are volatile fields: the browser half reads and writes the same entry Config through ctx.get('configForms').get('session-toolkit'), and host-validated writes land in the active profile's cordis.patch.yml (there is no settings.yaml namespace and no settingsScope service any more).
  • The host half calls .get() wherever it needs a value: a committed volatile update does not remount the plugin, so the identity and global-prompt sections pick the new text up on the next assembly, and auto-resume resumes a newly enabled session immediately through loader/volatile-update.
  • Ordinary fields (orders, budgets, retry and concurrency knobs) stay non-volatile: they are still visible in the settings form, but editing them goes through the normal cordis configuration lifecycle.
  • The read-only runtime projections (live workspaces, referenced-file read status) are not configuration at all: they go straight to the browser through GET /api/session-toolkit/state and never land in a file or in a form.

Configuration

Settings fields (volatile parts of the entry config)

The entry id is fixed at session-toolkit; the volatile() fields below are exactly the data the settings page reads and writes. They are schema-validated and land in the active profile's cordis.patch.yml. The field name is the config path (identity.sessions etc.), and the browser half addresses the same paths through configForms.get('session-toolkit').

FieldSchemaNotes
identity.default{enabled: boolean, text: string}Default identity. Resolution: session record → default → empty. Disabled or empty entries inject nothing.
identity.sessionsRecordPer-session identity, clipped to identity.maxText (8000 chars, token guard).
autoResume.sessionsRecordPer-session "resume after restart" switch; absent keys mean off.
globalPrompt.{enabled,content,files}{enabled: boolean, content: string, files: string[]}Injected into every conversation when enabled. files is the list of referenced files appended at assembly (live read with mtime/size cache; failed or oversized files skipped).
workspacePrompt.workspaces`Record
`Per-workspace prompt. A session gets the most-specific (longest matching path) enabled workspace whose directory prefix-matches its cwd.
workspacePrompt.removedstring[]Paths the user removed, so the active-workspace sync never re-adds them.
client.*7 UI knobs (see the table below)Browser-half runtime parameters (char limit, restart timeout/poll/fill, copy feedback).

Runtime projections (never persisted, not configuration): live workspaces [{path, sessionCount}] aggregated from ctx.agents.roots() (each agent's session.header.cwd, deduped and counted; never sourced from workspaceRegistry, which is not visible in this plugin's scope) and referenced-file read status Record; both reach the settings page through GET /api/session-toolkit/state.

Plugin Config (cordis)

The plugin exposes a single Config (schemastery schema) with per-feature keys. Defaults equal current behavior; override them via the plugin row's config in cordis.yml / cordis.patch.yml without touching code. The .volatile() keys (user data plus client.*) are exactly what the settings page reads and writes, and the browser half sees the same resolved values through configForms.get('session-toolkit') (see Configuration and the settings data plane).

- id: session-toolkit
  name: 'dsh-session-toolkit'
  config:
    identity:
      maxText: 8000
      sectionOrder: 40
      default:                # volatile: default identity
        enabled: false
        text: ''
      sessions: {}            # volatile: Record
    globalPrompt:
      sectionOrder: 50
      workspaceSectionOrder: 60
      maxFileBytes: 262144    # per referenced file; oversized files are skipped and reported as fail
      maxTotalBytes: 1048576  # across all referenced files of one section
      enabled: false          # volatile: global prompt switch
      content: ''             # volatile: global prompt body
      files: []               # volatile: referenced file list
    workspacePrompt:          # volatile: per-workspace prompts
      workspaces: {}          # Record

      removed: []             # paths the user removed
    autoResume:
      concurrency: 3
      sessions: {}            # volatile: Record
    webRestart:
      scriptPath: ''          # optional; default derived as /autostart/dsh-web-restart.cmd
      spawnDelayMs: 500
    promptDedup:
      enabled: true           # cross-section line-level dedup across identity/global/workspace; default true (disable only by setting false)
    client:
      identityCharLimit: 4000 # volatile: the 7 keys below are read by the browser half
      restartTimeoutMs: 90000
      restartPollMs: 1000
      restartFillMs: 600
      restartFailThreshold: 2
      restartSettleMs: 8000
      copyFeedbackMs: 1600
KeyDefaultMeaning
identity.maxText8000Identity text clip limit (chars, token guard). UI soft limit is client.identityCharLimit (4000, editor); host hard-clip is this value (8000).
identity.sectionOrder40System-prompt order of the identity section. Migration: users who explicitly pinned identity.sectionOrder: 55 must set it to 40 to keep the identity-before-global ordering.
globalPrompt.sectionOrder50System-prompt order of the global prompt section.
globalPrompt.workspaceSectionOrder60System-prompt order of the workspace prompt section (placed last).
globalPrompt.maxFileBytes262144Per referenced file byte limit; an oversized file is skipped (status fail) instead of blocking assembly.
globalPrompt.maxTotalBytes1048576Combined byte budget for all referenced files of one section.
autoResume.concurrency3Max in-flight resumes during startup restore.
webRestart.scriptPathderivedRestart script path. Empty (default) = derive /autostart/dsh-web-restart.cmd on Windows / …/dsh-web-restart.sh on macOS+Linux, and on POSIX additionally enable self-relaunch (no script needed). Set a path to take over with your own script — on POSIX it runs via /bin/sh, and a missing file makes POST fail fast with 500 instead of hanging the overlay.
webRestart.spawnDelayMs500Delay before spawning the restart script (202 buffer).
promptDedup.enabledtrueCross-section line-level deduplication across the identity/global/workspace system-prompt sections (on by default; disable only by setting it to false). When on, each identical non-blank original line across the three sections keeps only its "first occurrence" (a single seen set spans all three); duplicate lines in later sections are dropped, while blank lines are always preserved (they are markdown's paragraph/list separators). Every section's unique content is preserved. It does not parse {{name}} placeholders, does not break markdown, never sets complete, and never touches harness-owned sections.
identity.default / identity.sessionsemptyUser data (volatile): default identity and per-session identities. Written by the "Session identity" settings page; also editable directly in the profile patch.
globalPrompt.enabled / .content / .filesoff / emptyUser data (volatile): global prompt switch, body, and referenced file list.
workspacePrompt.workspaces / .removedemptyUser data (volatile): per-workspace prompts plus the removed-path list. The active-workspace sync adds newly discovered paths to workspaces (through ctx.get('settings').update); paths listed in removed are never re-added.
autoResume.sessionsemptyUser data (volatile): per-session "resume after restart". A false→true edge resumes that session immediately.
The client.* keys below are validated by the host; they are the very fields the browser half reads through configForms.get('session-toolkit') (when the form is unavailable the client falls back to UI_FALLBACK in client/client.js, whose values equal the historical defaults). You can edit them in the plugin's settings page.
KeyDefaultMeaning
client.identityCharLimit4000Identity editor character limit (UI soft limit; the global-prompt editor uses it too).
client.restartTimeoutMs90000Restart overlay timeout before the manual-refresh hint.
client.restartPollMs1000Restart health-poll interval (and progress tick).
client.restartFillMs600Progress fill animation after recovery detected.
client.restartFailThreshold2Consecutive failed health polls before an interruption is considered observed.
client.restartSettleMs8000Settle window (ms) after recovery before the auto-reload. DSH session titles are generated asynchronously by the LLM with no "ready" signal, so this is the wait window for the first post-restart reload to reduce the title fallback (showing the workspace name). If a session title still shows the workspace name, refresh manually or raise this value. A full fix requires DSH to expose a "titles ready" signal.
client.copyFeedbackMs1600Copy-feedback checkmark duration.