In DeepSeek Harness (DSH) plugin development, when multiple plugins need to share the same capability (such as unified search or web fetch), calling the global ctx directly can easily lead to conflicts or inconsistent state. @wangmuy/dsh-provider-dispatcher is a generic provider dispatcher that proxies multiple standard DSH child plugins onto a single capability so they can work together.
This is a generic provider dispatcher, categorized under workflow, maintained by wangmuy, and licensed under the MIT License. It allows multiple child plugins to run in isolated realms. The framework records the child plugins’ registration calls and uses a setup script to build a proxy that dispatches a single operation to all recorded child providers.
Core Features¶
- Proxies multiple standard DSH child plugins onto a single capability.
- Supports dispatch for
web searchandweb fetchcapabilities. - Provides
parallelmerge andbail(stop at first success) strategies. - Supports custom
mergefunctions. - Provides isolated realms for child plugins.
- Integrates configuration through
cordis.patch.yml.
Installation and Enablement¶
To install the plugin, run the following command:
dsh plugin --profile web add @wangmuy/dsh-provider-dispatcher
Configuration and Usage¶
After installation, you need to define the configuration in cordis.patch.yml. The configuration mainly includes injected services, a setup script, and a list of child plugins.
- inject: Specifies the services to inject (for example
['web']). - setup: Specifies the module path of the setup script.
- children: Array of child plugins, where each child plugin includes
name(module path) andconfig.
The plugin ships with two built-in setup scripts:
* web-search-setup: Dispatched for search providers (registerSearchProvider).
* web-fetch-setup: Dispatched for fetch providers (registerFetchProvider).
Configuration parameters (params) are read by the setup script:
* providerId: The ID under which the dispatcher registers globally (defaults to dispatcher-search or dispatcher-fetch).
* strategy: Dispatch strategy, supports parallel (run all and merge) or bail (stop at the first success).
* tolerateFailures: Whether to tolerate child plugin failures, defaults to true.
* merge: Module path of a custom merge function.
Child plugins are standard DSH plugins, and they register providers through ctx.web.registerSearchProvider or registerFetchProvider. These calls are not registered directly to the global ctx; instead, they are captured in an isolated realm.
Notes¶
If a child plugin is a bundle, it must be removed from dsh.profile.bundles.
If a child plugin (for example @liustack/modsearch) appears in both bundles and children, its bundle layer will bypass the dispatcher proxy and register directly to the global ctx.web or ctx.tools. After removing the bundles configuration entry, the plugin will correctly follow the proxy flow.
Summary¶
This plugin solves the coordination problem when multiple plugins share a capability by using isolated realms and a proxy pattern. Developers can write custom setup scripts to flexibly define the combination logic for child plugins.