# dsh-request-manager [δΈ­ζ–‡](./README.md) | English Manage LLM API request policies for DeepSeek Harness β€” override the default request behavior. The plugin adds a **Request Manager** button to the session header; click it to open the **Request Manager panel**. All settings are global across sessions and need no separate on/off switch β€” each feature engages based on its configured value. ![Request Manager panel](assets/screenshot_en.png) ## Features ### Extra request delay Inserts an extra delay (milliseconds) between API requests. Each session's first request is exempt; automatic and manual retries are delayed as well. `0` = off. ### Retries Overrides the number of automatic retries after a failed API request (the DSH default is 5 in current versions). Leave empty for no override. Some kinds of API failures are never retried by DSH by default (e.g. `SSE stream ended without [DONE]`, `NETWORK ERROR`); this option does not affect the retry policy of such failures. ### Intercept "request failure" When an API request fails, the Request Manager panel expands automatically and shows a card for handling the intercepted failure: ![Intercept "request failure"](assets/screenshot2_en.png) - **πŸ” Retry**: re-sends the same request in place (still subject to the extra delay); if it fails again, the card shows again β€” retry as many times as you like. - **🚩 Give up**: ends the turn through DSH's native failure path. This option applies uniformly, including failures DSH would never retry by default. The timeout is configurable in seconds: after the configured duration the selected action runs automatically β€” retry or give up; `0` disables the timeout. Pressing stop or disposing the session releases it immediately. With auto-retry selected, a persistently failing request re-sends every timeout cycle. ## Install ```sh dsh plugin --profile web add github:tree-func/dsh-request-manager ``` Restart the DSH process after installing. ## Uninstall ```sh dsh plugin --profile web remove dsh-request-manager ``` ## Architecture A single-package bundle plugin with a host half and a client half: ``` dsh-request-manager/ β”œβ”€β”€ package.json # dsh.bundle.patch + dsh.client.platform: web manifest β”œβ”€β”€ cordis.patch.yml # inserts this bundle at the profile root layer β”œβ”€β”€ index.js # host half └── client.js # browser half ``` - **Host (index.js)**: mounted at the web profile root layer as a bundle; listens at the root scope to every session's `agent/request` (extra delay) and `agent/request-error` (retry-count override, failure interception) events, and registers a resident `/reqmgr-api` route for the browser to read/write global config and submit interception decisions. - **Client (client.js)**: loaded through the official ModuleLoader; registers the Request Manager button and dropdown panel into the `conversation.session.header.utilities` slot, polls interception state once per second, and styles everything with `--dsw-*` semantic tokens so light and dark themes both work. Settings persist in the browser's localStorage and are restored to the host on page load. ## Known Limitations - **Conversations are isolated from each other**: interception notices (the alert dot and the auto-expanded panel) appear only in the conversation where the failure happened; staying in another conversation shows no hint. If you don't switch back in time, the hold is handled automatically according to the timeout settings. ## Localization UI copy is registered with the official locale service (namespace `requestManager`) and switches between Chinese and English automatically following the DSH language setting. ## Build The plugin is plain JavaScript β€” the source is the artifact, no build step: ```sh npm test # syntax check (node --check index.js && node --check client.js) ``` Development loop: refresh the browser page after editing `client.js`; restart the DSH process after editing `index.js`. ## License [MIT](./LICENSE) --- This plugin was built with AI assistance.