4. 调试与验证工作流
August 14, 2026 · View on GitHub
下面是经过 spike 实证的精确路径(无需 DEEPSEEK_API_KEY 即可跑通)。
4.1 脚手架
npx create-dsh-plugin my-plugin -t tool # tool | events | webui
npx create-dsh-plugin my-events -t events --yes --verify
--verify 依次跑 pnpm install → pnpm run build → dsh plugin add(临时 profile)→ dump-config grep。
脚手架的核心价值是把 @deepseek-ai/dsh-tools 锁到 next tag 版本(见 §5.3 分发与发布)。
截图:
(四步全绿)。
4.2 编译
cd my-plugin
pnpm install
pnpm run build # tsc -> dist/index.js(纯 ESM)
4.3 装进 profile
# 在「父目录」执行(相对路径锚定调用目录):
dsh plugin --profile my-profile add ./my-plugin
截图:
(
dsh plugin add+--dump-config)。
4.4 验证配置组装
dsh --profile my-profile --dump-config | grep my-plugin
# 预期:
# - id: my-plugin
# name: my-plugin
--dump-config 打印组装后的树(不 boot);--dump-default-config 只打印 bundle 层。
4.5 boot 并观察
dsh --profile my-profile
# 观察插件自己的日志,例如:
# [my-plugin] registered "my_tool" — listed=true
# Ctrl-C → disposer 执行:[my-plugin] DISPOSED — ...
4.6 无 key 验证事件触发
dsh plugin --profile headless add ./my-plugin
dsh --profile headless "run a probe"
# session/event 真实触发;随后模型调用报 MISSING_CREDENTIAL
# (诚实的阻塞点——你已经证明了编译 + 装载 + 事件接线)。
常用环境变量:DSH_HOME、DEEPSEEK_API_KEY、DEEPSEEK_BASE_URL、
DSH_TOOLS_MODE(native/code/both)、DSH_PERMISSION_MODE、DSH_CWD。
← Prev: 15 条设计准则 · Contents · Next: 分发与发布 →
(四步全绿)。
(