Introduction¶
In the DeepSeek Harness (DSH) ecosystem, multiple plugins maintain session metadata independently, scattered across $DSH_HOME/session-*.json files. When the need arises to access this data uniformly in the UI or other plugins, each source must make a separate request and parse the file. This plugin merges the originally scattered session metadata into a single response via a read-only aggregation endpoint, reducing I/O and parsing overhead.
Plugin Positioning¶
This is a DSH plugin maintained by 879745uhjun, categorized as “Workflow”. It does not write to any source files, only reads existing session metadata files, and provides a GET /session-meta route and a browser event bus (P2-⑩, Client 0.3.0) to synchronize session state changes in real-time within the Web UI.
Core Features¶
1. Session Metadata Aggregation¶
The plugin reads the following four source files (all located in $DSH_HOME):
session-stars.json: Session ratings, accessed viaratings[session].starssession-todos.json: To-do items, accessed viatodos[session], containingdone,priority,dueAtsession-boxes.json: Boxes the session belongs to, accessed viamemberships[session], returning a list of box IDssession-notify.json: Completion reminder toggle, determined by whetherwatched[session]exists
On each request, the plugin aggregates this data by session ID and returns a unified sessions object.
2. API Response Format¶
GET /session-meta returns JSON:
{
"ok": true,
"generatedAt": 1795000000000,
"truncated": false,
"total": 12,
"sources": {
"stars": { "state": "ok", "updatedAt": 1794990000000, "count": 5 },
"todos": { "state": "empty", "updatedAt": 1794990001000, "count": 0 },
"boxes": { "state": "ok", "updatedAt": 1794990002000, "count": 3 },
"notify": { "state": "missing", "updatedAt": 0, "count": 0 }
},
"sessions": {
"session-abc": {
"stars": 0,
"todo": { "done": false, "priority": "high", "dueAt": 1795000000000 },
"boxes": ["b_1"],
"watching": true
}
}
}
sources.<name>.stateis one ofok,empty,missing,invalidstarsbeing 0 indicates a recorded rating, which is different from the absence of the fieldtodo,boxes, andwatchingonly appear when the session possesses the corresponding attributes- Each source file has a size limit of 4 MiB; exceeding it returns
invalid,reason: "too-large" - The aggregation result contains at most 2000 sessions; if exceeded,
truncated: trueandtotalretains the actual count
3. Caching and Error Handling¶
The response includes an ETag based on the file (size, mtimeMs). When the client sends an If-None-Match, 304 is returned if there are no changes. Only GET and HEAD are accepted; other methods return 405. Cross-origin calls return 403.
4. Browser Event Bus (Client)¶
When the plugin loads in the Web UI, it exposes an event bus globally:
window.__dshSessionEvents = {
version: 1,
emit({ source, sessionId, kind }),
on(listener) => off,
}
window.dshSessionEvents = window.__dshSessionEvents
If that name is already taken, the instance upgrades to a versioned object (__dshSessionEvents.v2, dshSessionEvents.v2, etc.). Consumers should read in priority order: window.__dshSessionEvents ?? window['__dshSessionEvents.v2'] ?? window.dshSessionEvents.
The event bus bridges three data sources:
| source | Stream Path | Event Type | Payload Fields |
|---|---|---|---|
todos |
/session-todos/events |
todos |
todos |
stars |
/session-stars/events |
ratings |
ratings |
notify |
/session-notify/events |
watched |
watched |
When connecting, each source emits a { source, sessionId: null, kind: 'snapshot' } event; subsequently, only sessions that have changed or disappeared will receive kind: 'changed'. When the plugin unloads, it closes its streams and cleans up the name.
Usage Example:
const bus = window.__dshSessionEvents ?? window.dshSessionEvents
const off = bus.on(async (event) => {
if (event.source !== 'todos') return
const meta = await fetch('/session-meta').then((response) => response.json())
// Use meta.sessions[event.sessionId]
})
Installation and Activation¶
The plugin is declared via dsh.bundle.patch. The installation method is as follows:
- Open “Plugins → Add plugin” in the Web UI
- Select this plugin and install it
- Or use
install_bundlein the plugin manager - After installation, refresh the Web UI page to apply changes
Command-line installation example:
dsh plugin --profile desktop add github:879745uhjun/dsh-session-hub
Use Cases¶
- Need to uniformly display session ratings, to-do items, belonging boxes, completion reminders, and other states in the DSH Web UI
- Need to read session metadata in other plugins without repeatedly parsing multiple files
- Need to listen to session state changes in the browser and perform UI updates
Notes¶
- The plugin is a read-only operation and will not modify any source files
- The current version primarily features
P2-⑨(Host aggregation, 0.1.0), with the browser event bus (P2-⑩, 0.3.0) as a subsequent minor version - Client functionality (
client.js) is a placeholder until the browser event bus is fully released - It is recommended to check the source code and license before installation
Summary¶
dsh-session-hub aggregates the scattered session metadata in the DSH ecosystem into a single endpoint, reducing I/O and parsing costs, and provides a browser event bus for real-time synchronization. For developers who need to share session state across plugins, it is a practical middleware tool.
- Directory Page: https://www.skillhub.cn/plugins/879745uhjun/dsh-session-hub
- GitHub: https://github.com/879745uhjun/dsh-session-hub