Preamble¶
In the DSH plugin architecture, building a plugin with specific business capabilities usually requires manually orchestrating multiple foundational tools (such as data fetching, causal inference, and document generation). dsh-dcs-engine (Dynamic Capability Synthesis Engine) aims to solve this problem. It can synthesize fragmented foundational tools at runtime into named, registered, reusable, and persistable DSH Capabilities, thereby reducing repetitive boilerplate code and accelerating the development of capability composition.
Positioning¶
It is the Host Composition Layer of the DSH protocol stack and also the consumer and demonstration carrier of the five core components (CDP, intent network, CSP, ASP, universal-adapter):
- CDP (
ctx.cdpRegistry): consumes semantics (cognitive_style/semantic_tags/boundaries) for candidate scoring. - Intent Network (
ctx.intentNetwork): reuses itsplan()method, or uses the built-inruletopology planning. - CSP (
ctx.cspStore): only writesdecision_trace. - ASP (
ctx.aspGuard): enforcesside_effectsreview before registering synthesized artifacts. - universal-adapter: only consumes its
mcp::*tools bridged intoctx.tools.
DCS does not replace any one of these components. Instead, it makes the existing five core components “truly usable” and validates the performance of this protocol stack under composite applications.
Core Capabilities¶
- Synthesis Strategies: supports
rule(default, zero LLM overhead),llm, andhybridstrategies. - Materializer (M2 Stage): can already generate a complete deployable
dsh-cap-<id>plugin skeleton, including files such aspackage.json,tsconfig.json, andsrc/index.ts. - Registration and Reuse: synthesized artifacts can be registered in
capabilityRegistryand exposed throughdefineTool. - Safety Review: synthesized artifacts must pass a
ctx.aspGuardreview before registration.
Installation and Enablement¶
Install it through the DSH plugin manager:
dsh plugin --profile web add github:helibeiqi/dsh-dcs-engine
Typical Usage¶
1. Basic Synthesis and Registration¶
Taking “analyze the reasons for AAPL decline and generate a Chinese report” as an example, DCS automatically selects foundational components (such as dsh-quant-data-mcp::quote, mcp::causal_inference, and docx_gen::create), plans the topology using built-in rules, generates a stock_causal_report CapabilitySpec, and registers it after passing ASP review.
const registry = ctx.get('capabilityRegistry');
const spec = await registry.synthesizeAndRegister('分析 AAPL 下跌原因并生成中文报告');
const report = await registry.invoke(spec.id, { symbol: 'AAPL' });
2. Export a Complete Plugin Skeleton¶
Use the Materializer to generate a complete deployable plugin directory:
npx tsx scripts/dcs-synthesize.ts --intent "分析 AAPL 下跌原因并生成中文报告" --persist
# Output to capabilities/stock_causal_report.capability.json
Configuration Options¶
The plugin supports the following configuration fields:
| Field | Description | Default Value |
|---|---|---|
sources |
Foundation component sources (such as artifacts in capabilitiesDir) |
{ capabilitiesDir: "./capabilities" } |
synthesizer |
Synthesis strategy (strategy), fallback to LLM, maximum number of candidates |
{ strategy: "rule", fallbackToLLM: true, maxCandidates: 20 } |
registry |
Deduplication (semantic hash), automatic tool registration | { deduplicate: true, autoRegisterTools: true } |
materializer |
M2 stage switch, output format | { enabled: false, format: "plugin-skeleton" } |
safety |
ASP review requirements, block registration on failure | { requireAsp: true, blockOnFail: true } |
Note: Only the five fields above are recognized; other fields are invalid.
Safety Notes¶
- Mandatory ASP Review: synthesized artifacts must pass
ctx.aspGuardbefore registration. Whensafety.blockOnFailistrueand the review fails, aSynthesisRejectedErroris thrown. - Unknown ASP State Handling: without ASP,
safety.asp_verdict = "unknown". Ifsafety.requireAsp=true, the plugin refuses to register. - File Path Whitelist: all file I/O operations are limited to
capabilitiesDirandoutDir.
Cautions¶
- Developer Preview: the M2-stage Materializer can already generate a complete skeleton, but the API may change within the
0.1.xreleases. In production environments, wait for the stable1.0release. - Dependencies: runtime dependencies include
@deepseek-ai/cordis >= 0.1.0and@deepseek-ai/dsh-tools >= 0.1.0. - Manual Refinement: the
src/index.tsgenerated by the Materializer uses generic input mapping and may require manual refinement of the exact parameter schema for the tools in each step.
Summary¶
dsh-dcs-engine provides a mechanism that allows developers to quickly generate DSH plugin skeletons with complex capabilities through intent descriptions. It leverages the DSH five core components through orthogonal collaboration, and its strict safety review mechanism ensures the safety of synthesized artifacts.