dsh-plugin-conflict-audit: DSH Plugin Conflict Audit

Introduction

DSH’s philosophy is “everything is a plugin.” As the number of plugins grows, conflicts often manifest not as explicit errors but as silent failures: abnormal tool behavior, inexplicably lost configurations, or 404 responses from APIs. The existing dsh-market only checks whether “a new plugin’s own tools can be invoked” at install time — it performs no cross-plugin namespace detection. dsh-plugin-conflict-audit solves this problem: one logic, two usage modes, sharing the same implementation.

What It Is

dsh-plugin-conflict-audit is a read-only detection tool for discovering conflicts between DSH plugins. It combines static source scanning with runtime validation to check for tool name collisions, patch row ID conflicts, route overlaps, skill name duplicates, missing service dependencies, version compatibility mismatches, and other risks. After installation, the plugin provides a plugin_conflict_audit tool and automatically runs a self-check 4 seconds after startup.

Core Features

Conflict Types

Conflict Type Surface Symptom Actual Cause
Tool name collision Tool still exists, but behaves incorrectly Registry uses overwrite semantics; the first registrant silently disappears
inject declares a non-existent service Plugin “installed but no response” cordis fiber remains permanently pending — no error, no exit
Patch row ID collision Configuration inexplicably lost Entire config rows overwrite each other
Route prefix overlap An endpoint returns 404 / returns another plugin’s data webServer overwrites on later registration

Safety Guarantee

This script is strictly read-only:

  • Only uses fs.readFileSync / fs.readdirSync / fs.statSync / fs.existsSync
  • No writes, no deletions, no directory creation
  • No network access, no child processes
  • Does not import / require any inspected plugins (does not execute inspected code)
  • At the end of each run, it self-scans its own source to confirm no write operations / child processes / network APIs appear

Verified: A full (path, size, mtime) snapshot comparison of ~/.dsh/profiles/desktop and ~/.dsh/skills before and after execution shows 0 file changes.

Installation & Activation

Install from npm:

dsh plugin --profile web add dsh-plugin-conflict-audit

Install directly from GitHub (use this while it’s not yet published on npm):

dsh plugin --profile web add github:www111-ui/dsh-plugin-conflict-audit

Restart the harness after installation to activate. The plugin_conflict_audit tool will then appear, and a self-check will run automatically 4 seconds after startup.

Prefer not to install the plugin and just want to run a one-off check:

git clone https://github.com/www111-ui/dsh-plugin-conflict-audit.git
cd dsh-plugin-conflict-audit
node audit.mjs

Typical Usage

CLI Mode

NODE=~/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/node/bin/node.exe

$NODE audit.mjs                 # Audit the default profile
$NODE audit.mjs --json          # Machine-readable output
$NODE audit.mjs --verbose       # Show skip details
$NODE audit.mjs --profile xyz   # Specify a profile

Exit codes: 0 clean · 2 hard conflicts found · 1 script internal error.

Plugin Mode

plugin_conflict_audit                      # Agent invokes directly
  profile           Optional, defaults to DSH_PROFILE
  mode              static / runtime / both (default: both)
  includeInfo       Whether to include INFO items (default: true)
  includeInventory  Whether to attach plugin inventory (default: false, saves tokens)

Two Modes

Mode Data Source What It Sees
static On-disk source code and manifests Tool names, routes, skills, version declarations, patch rows
runtime Current process ctx.get() Actual tool registry, service existence, composed plugin rows
both (default) Both combined; runtime corrects static conclusions Everything

The runtime portion has been verified working (DSH 0.2.2-rc.1):

ctx.get('tools').definitions()   // → 69 actually registered tool IDs
ctx.get('loader').root           // → 213 rows of {id, name, disabled} in the composition layer
ctx.get(svc)                     // → Whether a service exists (verified: 23 exist / 17 missing)

What runtime adds:

  1. Eliminates false positives: Tools extracted statically from code are not necessarily actually registered. In testing, dsh-aurabot-qq’s 42 qq_* tools and whale-persona’s memory tool are all absent from the global registry (mounted per-agent scope). These are now flagged as W_PLUGIN_TOOLS_NOT_LIVE instead of being treated as real tools in conflict detection.
  2. Service dependencies go from guesswork to verified: I_SERVICE_UNVERIFIED is upgraded to a verified conclusion — truly missing services are reported as E_SERVICE_MISSING; existing ones are simply not flagged.
  3. Composed rows become visible: You can see the final 213 composed rows and which ones are disabled.

Fiber State

loader.entries()        → Iterable entry tree, each with entry.fiber
entry.fiber.state       → Numeric enum: 0 pending / 1 loading / 2 active / 3 failed / 5 unloading
entry.fiber._error      → Failure reason (e.g., service "x" has been registered at ...)
entry.options.inject    → Dependencies declared by this entry; verify each via ctx.get()

Two pitfalls encountered:

  1. loader.entries() returns an iterable, not a plain object. Initially, using Object.keys() showed empty, leading to a false conclusion that it was “unavailable” and the approach was abandoned.
  2. fiber.state is a number, not a string. Searching for .status would never find it.

Now it can report:

Code Level Meaning
E_FIBER_PENDING_MISSING ERROR Fiber permanently pending + inject‘d service has no provider → plugin silently non-functional
E_FIBER_FAILED ERROR Fiber failed, with _error original text included
W_FIBER_PENDING WARN Pending, but all dependencies present (possibly loading order / internal await stuck)

Sample Output

Clean:

✓ No hard conflicts (WARN 2 · INFO 9)
profile desktop · DSH 0.2.2-rc.1 · 12 scannable plugins
! [W_COMPAT_UNLISTED] dsh-blender@0.2.4: Compatibility declaration does not include current DSH 0.2.2-rc.1
    Declared "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2". The plugin may still work correctly (runtime takes priority), but this is an unverified combination.
! [W_DYNAMIC_TOOL_NAMES] dsh-ops: Tool names are composed at runtime; static scan can only list literals
    Matched indicator: publicToolName( —— The actual number of tools in this plugin may far exceed the 0 listed above.
Last boot self-check: 2026-11-22T04:33:08.583Z

With collisions:

✗ 2 hard conflicts (WARN 0 · INFO 0)
✗ [E_TOOL_COLLISION] Tool name collision: clash_tool
    plugin-a(high) + plugin-b(high) —— Registry uses overwrite semantics; the later-loaded one wins, the other silently disappears.
✗ [E_PATCH_ROW_COLLISION] Two plugins insert the same patch row ID: shared-row
    plugin-a + plugin-b

Boot Self-Check

Runs once with a 4-second delay after activation. If hard conflicts are found, it writes a single console.warn (formatted as [conflict-audit] Found N plugin conflicts: ...). Configurable:

- id: conflict-audit
  config:
    startupSelfCheck: false   # Disable self-check
    startupDelayMs: 4000      # Delay
    profile: desktop          # Override profile name

How to Apply Code Changes

For plugins installed via link:, modifications are still served from the old ESM module cache in the host — invoking the tool directly will exhibit old behavior. You don’t need to restart the entire app; simply disable and re-enable the bundle to force cordis to rebuild its layer and re-import:

plugin_manager set_bundle { target: "dsh-plugin-conflict-audit", enabled: false }
plugin_manager set_bundle { target: "dsh-plugin-conflict-audit", enabled: true }

Verified working: after modification, the tool list changed from an incorrect 2 to the correct 1, and bootAt was updated accordingly.

Check Items

Code Level Meaning
E_TOOL_COLLISION ERROR Two plugins register the same tool name
E_PATCH_ROW_COLLISION ERROR Two plugins insert the same patch row ID
E_PROFILE_MISSING / E_BUNDLE_MISSING / E_PATCH_MISSING ERROR Configuration points to something that doesn’t exist
W_PATCH_OVERRIDE_FIGHT WARN Two plugins override the same config row
W_COMPAT_UNLISTED WARN Plugin’s compatibility declaration does not include the current DSH version
W_DYNAMIC_TOOL_NAMES WARN Tool names composed at runtime; static scan is incomplete
W_ROUTE_OVERLAP WARN Route prefixes suspected to overlap (heuristic)
W_SKILL_COLLISION WARN Duplicate skill names
W_SCAN_CAPPED WARN File count hit the cap; results are incomplete
W_PLUGIN_TOOLS_NOT_LIVE WARN Static scan shows tools but none are registered at runtime
W_STATIC_ONLY_COLLISION WARN Static name collision but not registered at runtime (low confidence)
E_SERVICE_MISSING ERROR Verified service does not exist → will cause fiber pending
E_FIBER_PENDING_MISSING ERROR Fiber permanently pending, missing dependency service
E_FIBER_FAILED ERROR Fiber failed to start, with _error original text
W_FIBER_PENDING WARN Pending but all dependencies present
W_DANGLING_OVERRIDE WARN Your patch overrides a row that doesn’t exist in the composed result (no-op)
I_PARTIAL_LIVE INFO Some tools registered (most others are scope-mounted)
I_UNTRACKED_LIVE_TOOLS INFO Registered at runtime but not recorded statically (likely core tools)
I_DISABLED_ROWS INFO Rows disabled in the composition layer
I_USER_PATCH_TARGETS INFO Your patch customizes plugin rows (by design, not a conflict)
I_DISABLED INFO Installed but not enabled
I_SERVICE_UNVERIFIED INFO Service dependency not in known core list (low confidence)

Tests

$NODE test/detector-test.mjs     # Audit logic (17 items)
$NODE test/plugin-load-test.mjs  # Cordis shell (52 items)

This step is non-negotiable. When the audit report says “0 conflicts,” there are two possibilities: it’s truly clean, or the detector is deaf. The report alone cannot distinguish between these.

  • detector-test creates two fixtures: fixture/conflict/ (intentionally colliding tool names + patch rows) must report 2 ERRORs; fixture/clean/ must report 0 ERRORs
  • plugin-load-test uses stubs to replace the host’s @deepseek-ai/dsh-tools, verifying module initialization, apply() doesn’t throw, tool registration, execute() returns valid structure, and graceful degradation (not crash) on registration failure

Known Limitations

  1. Dynamic tool names cannot be detected. For example, dsh-ops uses TOOL_PREFIX = 'ops_' + publicToolName(raw) to compose names; the literal string ops_bash simply doesn’t exist. Such plugins are flagged with W_DYNAMIC_TOOL_NAMES; their tool inventories are incomplete and conflict detection is unreliable. A complete fix requires reading the runtime registry (the enumeration API for ctx.tools is unverified).
  2. The core service whitelist is observational, not authoritative. The host package lives in app.asar, so no authoritative list can be read; I_SERVICE_UNVERIFIED is therefore only a low-confidence hint.
  3. Route detection is heuristic. It only captures string literals for path:/prefix: near webServer.
  4. Only static files are inspected, not runtime state. Actual loading results are also affected by fiber state and config evaluation.
  5. Code changes require host-side reload — link: installation does not hot-swap loaded ESM modules. A new CLI process sees new code immediately, but the host requires one disable/enable bundle cycle (see “How to Apply Code Changes” above) or an app restart; the two may be briefly inconsistent.

Fix Suggestions

Every finding that can offer a remediation includes a fix text field telling you exactly what to do next: tool collision → disable command; fiber pending → which service is missing, who to install or who to remove; dangling override → confirm the bundle or delete the config. Findings that can’t (e.g., pure informational items) simply don’t include one.

Ecosystem Context

DSH’s philosophy is “everything is a plugin.” The community directory is an independent site with no official affiliation to DeepSeek / High-Flyer. This plugin is developed by maintainer www111-ui and categorized under admin-security.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye