跪拜 Guibai
← All articles
Frontend

Replicating WorkBuddy's User Entry in DeepSeek Harness: A Slot Takeover Plugin

By 再吃一根胡萝卜 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Any plugin that needs to replace a built-in DSH UI element hits the same single-slot priority shadowing and single-file client constraints. The pattern of keeping host data separate from client rendering also gives a clean upgrade path when a real backend becomes available.

Summary

The DSH plugin ecosystem uses a slot system where components register into named slots. To replicate WorkBuddy's user info entry, the author chose to take over the official settings.launcher slot rather than add a new row to sidebar.footer.action. That slot is single-typed and renders only the lowest-priority registration, so the plugin must register with a negative priority like -100 to shadow the official AccountMenu. The underlying account service keeps running, so settings, theme, and sign-out remain real host calls.

The plugin is split into host and client halves. The host runs in the Node process and serves a single GET /workbuddy-user/api/profile endpoint that reads profile.json for demo data like tier and points. The client is a 541-line single file because the browser module loader can only resolve host-shared modules, not relative paths. Real avatar and nickname come from ctx.remote.account.getProfile(), while the menu mixes those with disabled demo buttons for WorkBuddy-only features.

Three pitfalls dominate the debugging: CSS defined but never injected via a <style> element, slot priority conflict at 0, and an inject list missing remote.account, which silently prevents activation. The article insists on browser verification with a Puppeteer probe because curl and DOM checks cannot catch these failures. A full reproduction checklist runs from file creation through syntax checks, plugin install, and interface tests.

Takeaways
— WorkBuddy's user entry lives in the settings.launcher slot, which is a single-type slot that renders only the registration with the lowest priority.
— To shadow the official AccountMenu, register with priority: -100; priority 0 causes an 'already has a registration' error.
— A plugin built with host/client halves: host serves /workbuddy-user/api/profile from profile.json, client fetches same-origin and renders UI.
— Client code must be a single file because DSH's browser loader only resolves host-shared modules (react, react-dom) and not relative paths.
— Real account data comes from ctx.remote.account.getState() (sign-in status) and getProfile() with a nested result: profile at result.value.value.
— The client metadata version (0.2.1-rc.5) must match the official one or Platform may reject requests.
— Three failure modes: missing <style> injection, slot priority 0 conflict, and inject missing 'remote.account', which prevents plugin activation.
— Verification requires a browser; a Puppeteer probe checks for the trigger element, popover content, and console errors.
— Demo data (tier, points, station) merges default ← host profile.json ← localStorage override, with localStorage having highest priority.
Conclusions

Taking over a single slot beats adding a list-slot entry because it replaces the official UI while preserving the underlying account service; this is a cleaner pattern for any plugin that wants to swap an entry point.

The single-file client constraint is a direct consequence of DSH's module loader design, and it forces plugin authors to inline everything, making large plugins harder to maintain but also simpler to deploy.

The article's emphasis on browser-level verification stems from the fact that plugin registration can succeed while the UI is broken; interface tests alone cannot see whether styles are injected or whether the plugin actually activated.

Separating host data provisioning from client rendering is a pragmatic way to keep a demo-data UI switchable to a real backend later, but it adds an HTTP round-trip that pure client-side plugins would avoid.

Concepts & terms
DSH (DeepSeek Harness)
A client harness for DeepSeek's AI services, supporting a plugin system with slots and a web-based UI.
Slot system
DSH's UI composition mechanism where plugins register components into named slots. Slots can be of type 'list' (all registrations render) or 'single' (only the lowest-priority registration renders).
Host and client halves
A plugin architecture where the Node-side host serves HTTP APIs and the browser-side client renders UI; they communicate via a JSON contract over HTTP.
Priority shadowing
In a single slot, the registration with the smallest numeric priority wins. A negative priority shadows the official registration that uses default 0.
Module loader for browser plugins
DSH's browser plugin loader (window.__ModuleLoader__.load) can only resolve host-shared modules from a fixed table; relative paths are not supported, so all client code must live in one file.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗