开发、编排与安全开源项目

DSH Ops Agents

运维诊断 Agent

分别面向运维诊断和 Runbook 知识问答的两个 DSH 原生预设。

项目 README(英文原文)

在 GitHub 中查看

dsh-ops-agents

Ops agent presets for DeepSeek Harness: two additional entries in the agent-preset picker, next to the shipped 标准模式 / PTC 模式 / 极简模式 / 创造模式.

  • 故障诊断 (ops-diagnosis) — a read-only fault-diagnosis agent. An SRE persona drives a fixed workflow (triage → evidence → hypotheses → root cause → remediation advice) over five demo tools — query_metrics, query_logs, list_alerts, get_service_topology, run_diagnostic_check — that return deterministic mock data telling one coherent incident story. No shell or write tools are mounted; the agent is read-only by construction.
  • 知识库 (ops-kb) — a knowledge-base Q&A agent over a local document directory. kb_search ranks Markdown/text chunks by query-term hits with file and line citations, kb_list enumerates the corpus. Ships with sample ops docs; point OPS_KB_DIR at your own directory to use a real corpus.

No dsh framework code is modified: the package composes through the documented bundle patch-layer extension point, and each preset is a plain agent-preset directory (agent.cordis.yml + preset.yml) with zero-dependency preset-local tool plugins.

Requirements

  • A dsh profile with the preset roster composed (the shipped web profile, i.e. @deepseek-ai/dsh-base + @deepseek-ai/dsh-web-app).
  • Node.js 20+.

Install

Install into a profile (creates the profile if needed):

dsh plugin --profile web add dsh-ops-agents

Or from a local checkout / tarball:

dsh plugin --profile web add ./dsh-ops-agents
dsh plugin --profile web add ./dsh-ops-agents-0.1.0.tgz   # pnpm pack first

Verify the layer, then boot:

dsh --profile web --dump-config   # shows a "# == dsh-ops-agents" layer
dsh --profile web                 # the preset picker gains 故障诊断 and 知识库

To remove: dsh plugin --profile web remove dsh-ops-agents (the two synced preset directories under $DSH_HOME/.agent-presets/ are left behind; delete ops-diagnosis/ and ops-kb/ there to remove them from the picker).

How it works

One package, three parts:

  • Bundle layer (cordis.patch.yml): inserts a single glue row into the profile composition, discovered through the manifest's dsh.bundle.patch declaration.
  • Glue plugin (src/index.ts): on boot, copies the bundled presets/* directories into $DSH_HOME/.agent-presets/, the user preset root that dsh-agent-presets always scans. A bundle patch cannot add a discovery root itself — the CLI's profile assembly force-sets roots on the agent-presets row after every bundle layer — and discovery skips symlinked directories, so real copies it is. The sync overwrites only the two preset ids this package ships (ops-diagnosis, ops-kb); anything else in the user root is untouched. Discovery re-reads the root on every roster read, so new sessions see the presets without a restart.
  • Preset directories (presets/ops-diagnosis/, presets/ops-kb/): each carries preset.yml (picker display text), agent.cordis.yml (a dsh-persona complete-prompt row plus the preset-local tool plugin), and a plugins/*.mjs zero-dependency tool plugin loaded by plain Node straight from the preset directory. Hand-rolled tool definitions, no dsh imports — ctx.tools.register() enforces only the output schema.

Do not hand-edit the synced copies under $DSH_HOME/.agent-presets/ops-* — every boot overwrites them from the installed package. Edit the package (or copy the preset to a new id in the picker) instead.

Development

pnpm install
pnpm run build      # tsc → lib/
pnpm run test       # vitest: tool registrations and retrieval behavior

Preset edits need no build — the glue sync copies them verbatim on the next boot. The glue plugin does.

License

MIT