dsh-lark-bot 0.8.2 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,10 +87,15 @@ npx dsh-lark-bot@latest setup --profile dsh-lark
87
87
  ```
88
88
 
89
89
  `setup` 会自动完成:发现本机 dsh → 预批准 pnpm 构建策略 → 执行标准的
90
- `dsh plugin --profile dsh-lark add dsh-lark-bot`。
90
+ `dsh plugin --profile dsh-lark add dsh-lark-bot`,并**默认同时安装「安全网守护」**——系统级
91
+ 常驻、dsh 全部下线后仍保留飞书救援入口(核心能力之一,见下文「安全网守护」一节)。
92
+ 一条命令即完成全部安装。
91
93
 
92
94
  `setup` automatically: locates your dsh install → pre-approves pnpm's build policy → runs the
93
- standard `dsh plugin --profile dsh-lark add dsh-lark-bot`.
95
+ standard `dsh plugin --profile dsh-lark add dsh-lark-bot`, and **also installs the safety-net
96
+ guardian by default** — a system-level resident process that keeps the Feishu rescue entrance
97
+ alive even when dsh is fully down (one of the core features; see "Safety-net guardian" below).
98
+ One command installs everything.
94
99
 
95
100
  ### 2. 启动并扫码绑定 | Start and bind with one scan
96
101
 
@@ -197,8 +202,8 @@ runtime profiles): after a task finishes it can push messages to other groups/to
197
202
  members. The bridge listens on 127.0.0.1 with a random per-boot token — nothing is exposed to the
198
203
  public network.
199
204
 
200
- **安全网守护(Safe-mode guardian)**:可选安装一个独立于 dsh 进程、系统级常驻的最小守护进程
201
- Linux systemd user unit / macOS LaunchAgent / Windows 启动项)。dsh 正常运行时守护保持静默;
205
+ **安全网守护(Safe-mode guardian)**:默认随 `setup` 一起安装的、独立于 dsh 进程、系统级常驻的
206
+ 最小守护进程(Linux systemd user unit / macOS LaunchAgent / Windows 启动项)。dsh 正常运行时守护保持静默;
202
207
  一旦 dsh 进程下线或无法 boot(例如某个第三方插件破坏了整个 profile 组合),守护自动接管飞书
203
208
  通道,用户无需接触命令行即可发送控制信号自救:
204
209
 
@@ -212,12 +217,13 @@ public network.
212
217
  全程不需要命令行;dsh 恢复后守护自动断开并回归静默。安装:
213
218
 
214
219
  ```bash
215
- npx dsh-lark-bot@latest setup --profile dsh-lark --guardian
216
- # 或已安装后单独安装:dsh-lark-bot guardian install
220
+ # setup 默认安装(无需额外参数);已安装后也可单独安装 / 重装:
221
+ dsh-lark-bot guardian install --dsh-profile dsh-lark
217
222
  ```
223
+ 不需要守护时,安装时加 `--no-guardian` 跳过;单独卸载用 `dsh-lark-bot guardian uninstall`。
218
224
 
219
- **Safety-net guardian**: optionally install a minimal system-level resident process that is
220
- independent of the dsh process. While dsh runs, the guardian stays silent; once dsh goes down or
225
+ **Safety-net guardian**: a minimal system-level resident process installed **by default with
226
+ `setup`**, independent of the dsh process. While dsh runs, the guardian stays silent; once dsh goes down or
221
227
  fails to boot (e.g. a third-party plugin breaks the whole profile composition), the guardian
222
228
  takes over the Feishu channel so you can self-heal without touching the command line:
223
229
 
@@ -234,9 +240,10 @@ No command line is needed for the whole rescue flow; once dsh is back, the guard
234
240
  channel automatically. Install:
235
241
 
236
242
  ```bash
237
- npx dsh-lark-bot@latest setup --profile dsh-lark --guardian
238
- # or later: dsh-lark-bot guardian install
243
+ # Installed by default with setup (no extra flag); can also be installed / refreshed later:
244
+ dsh-lark-bot guardian install --dsh-profile dsh-lark
239
245
  ```
246
+ Pass `--no-guardian` to setup to skip it; remove it later with `dsh-lark-bot guardian uninstall`.
240
247
 
241
248
  ### 模型 / Provider / 凭据管理 | Models / Providers / Credentials
242
249
 
@@ -285,21 +292,25 @@ npx dsh-lark-bot@latest setup --profile dsh-lark
285
292
  ```
286
293
 
287
294
  `setup` 自动完成:定位本机 dsh → 预批准 pnpm 构建策略(protobufjs)→ 执行标准
288
- `dsh plugin --profile dsh-lark add dsh-lark-bot`。加 `--guardian` 会同时安装「安全网守护」
289
- (见「安全网守护」一节)。已安装时重复执行即升级到最新版。
295
+ `dsh plugin --profile dsh-lark add dsh-lark-bot`,并**默认同时安装「安全网守护」**
296
+ (见「安全网守护」一节;不需要时加 `--no-guardian` 跳过)。已安装时重复执行即升级到最新版。
290
297
 
291
298
  `setup` locates your dsh, pre-approves pnpm's build policy (protobufjs) and runs the standard
292
- `dsh plugin --profile dsh-lark add dsh-lark-bot`. Adding `--guardian` also installs the
293
- safety-net guardian (see "Safety-net guardian" above). Re-running it upgrades to the latest version.
299
+ `dsh plugin --profile dsh-lark add dsh-lark-bot`. It **also installs the safety-net guardian by
300
+ default** (see "Safety-net guardian" above; pass `--no-guardian` to skip). Re-running it upgrades
301
+ to the latest version.
294
302
 
295
303
  ### 升级 | Upgrade
296
304
 
297
305
  - 插件本体:重跑 `setup`(或 `dsh plugin --profile <name> add dsh-lark-bot`)拉取 npm 最新版。
306
+ - 安全网守护:随 `setup` 一起安装 / 升级(幂等重装),也可单独 `dsh-lark-bot guardian install`。
298
307
  - CLI 工具(可选):`npm i -g dsh-lark-bot@latest`;使用 `npx` 时无需全局安装。
299
308
  - 升级后重启 profile:`dsh --profile dsh-lark`。
300
309
 
301
310
  - Plugin: re-run `setup` (or `dsh plugin --profile <name> add dsh-lark-bot`) to pull the latest
302
311
  npm release.
312
+ - Safety-net guardian: installed / upgraded together with `setup` (idempotent), or standalone via
313
+ `dsh-lark-bot guardian install`.
303
314
  - CLI tool (optional): `npm i -g dsh-lark-bot@latest`; not needed when using `npx`.
304
315
  - Restart the profile after upgrading: `dsh --profile dsh-lark`.
305
316
 
@@ -391,7 +402,7 @@ tasks and session archival.
391
402
  对应 runtime 并自动重建。
392
403
  - 桥接引擎作为 dsh 插件在 dsh 进程内运行,agent 执行使用官方 dsh SDK runtime 子进程
393
404
  (嵌套 runtime 是有意取舍,用于按工作区隔离的 runtime 池与 scope 内并行 run)。
394
- 唯一的进程级例外是可选安装的「安全网守护」——它独立于 dsh / Cordis 常驻,仅在 dsh
405
+ 唯一的进程级例外是默认安装的「安全网守护」——它独立于 dsh / Cordis 常驻,仅在 dsh
395
406
  下线后接管飞书通道,正常运行时保持静默。
396
407
  - 飞书文档评论、富文本回复为规划中能力,尚未实现。
397
408
  - pnpm ≥ 10 的构建脚本策略由 `setup` 自动处理;手动 `dsh plugin add` 时若报
@@ -673,7 +684,7 @@ See "Community Listings" in the next section for ecosystem registration status.
673
684
 
674
685
  核心思路:**飞书通道与 agent 后端解耦**。桥接层复刻 `lark-channel-bridge` 的成熟做法(WebSocket 长连接 + 流式卡片 + 会话路由),agent 后端通过 adapter 抽象,默认挂接官方 DeepSeek Harness SDK(`DSH_LARK_ADAPTER=sdk`),可选 ACP 审批模式与 legacy headless。
675
686
 
676
- 可选「安全网守护」(`src/guardian/`)独立于 dsh 进程常驻:dsh 在线时静默,下线时接管飞书
687
+ 默认安装的「安全网守护」(`src/guardian/`)独立于 dsh 进程常驻:dsh 在线时静默,下线时接管飞书
677
688
  通道接收 `/safemode` 控制信号,以仅核心 profile(`dsh-base` + `dsh-headless`)拉起受限对话
678
689
  用于自愈,`/safemode exit` 重启完整 profile 并交还通道。
679
690
 
package/dist/cli.js CHANGED
@@ -5796,6 +5796,7 @@ function looksLikeDshProcess(cmdline) {
5796
5796
  return cmdline.includes("@deepseek-ai/dsh") || /(?:^|\s)dsh(?:\.exe)?(?:\s|$)/.test(cmdline);
5797
5797
  }
5798
5798
  function matchProfileProcess(cmdline, dshProfile) {
5799
+ if (/(?:^|\s)plugin(?:\s|$)/.test(cmdline)) return false;
5799
5800
  return hasProfileFlag(cmdline, dshProfile) && looksLikeDshProcess(cmdline);
5800
5801
  }
5801
5802
  async function listProcesses() {
@@ -6135,6 +6136,7 @@ async function runSetup(options = {}) {
6135
6136
  "\u672A\u627E\u5230\u672C\u673A dsh \u5B89\u88C5\uFF08`@deepseek-ai/dsh`\uFF09\u3002\u8BF7\u5148\u5B89\u88C5 DeepSeek Harness\uFF0C\u518D\u8FD0\u884C\u672C\u547D\u4EE4\u3002"
6136
6137
  );
6137
6138
  }
6139
+ const installGuardianService = options.guardian !== false;
6138
6140
  const profileDir = join13(dshHome, "profiles", profile);
6139
6141
  await mkdir12(profileDir, { recursive: true });
6140
6142
  await approveBuilds(profileDir);
@@ -6143,7 +6145,7 @@ async function runSetup(options = {}) {
6143
6145
  `
6144
6146
  );
6145
6147
  await runDshPlugin(bin, profile, packageSpec);
6146
- if (options.guardian) {
6148
+ if (installGuardianService) {
6147
6149
  const install = options.installGuardianFn ?? installGuardian;
6148
6150
  const guardianResult = await install({
6149
6151
  env: loadRuntimeEnv(process.env),
@@ -6168,13 +6170,14 @@ async function runSetup(options = {}) {
6168
6170
  "",
6169
6171
  "\u9996\u6B21\u542F\u52A8\u4F1A\u5728\u7EC8\u7AEF\u6253\u5370\u4E8C\u7EF4\u7801\uFF0C\u7528\u98DE\u4E66 / Lark \u626B\u7801\u5B8C\u6210\u4E00\u6B21\u6027\u7ED1\u5B9A\uFF1B",
6170
6172
  "\u7ED1\u5B9A\u540E dsh \u5373\u4EE5\u6807\u51C6\u63D2\u4EF6\u65B9\u5F0F\u52A0\u8F7D dsh-lark-bot \u7684\u6865\u63A5\u5F15\u64CE\u3002",
6171
- ...options.guardian ? [
6173
+ ...installGuardianService ? [
6172
6174
  "",
6173
- "\u5B89\u5168\u7F51\u5B88\u62A4\u5DF2\u5B89\u88C5\uFF1Adsh \u4E0B\u7EBF\u540E\u4ECD\u53EF\u901A\u8FC7\u98DE\u4E66\u53D1\u9001 /safemode \u8FDB\u5165\u4EC5\u6838\u5FC3\u5B89\u5168\u6A21\u5F0F\u81EA\u6551\u3002",
6174
- "\u67E5\u770B\u72B6\u6001\uFF1Adsh-lark-bot guardian status"
6175
+ "\u5B89\u5168\u7F51\u5B88\u62A4\u5DF2\u9ED8\u8BA4\u5B89\u88C5\uFF1Adsh \u5168\u90E8\u4E0B\u7EBF\u540E\u4ECD\u53EF\u901A\u8FC7\u98DE\u4E66\u53D1\u9001 /safemode \u8FDB\u5165\u4EC5\u6838\u5FC3\u5B89\u5168\u6A21\u5F0F\u81EA\u6551\u3002",
6176
+ "\u67E5\u770B\u72B6\u6001\uFF1Adsh-lark-bot guardian status",
6177
+ "\u4E0D\u9700\u8981\u65F6\u53EF\u8DF3\u8FC7\u5B89\u88C5\uFF1Anpx dsh-lark-bot@latest setup --no-guardian"
6175
6178
  ] : [
6176
6179
  "",
6177
- "\u63D0\u793A\uFF1A\u53EF\u52A0 --guardian \u540C\u65F6\u5B89\u88C5\u300C\u5B89\u5168\u7F51\u5B88\u62A4\u300D\uFF08dsh \u5168\u90E8\u4E0B\u7EBF\u540E\u7684\u98DE\u4E66\u6551\u63F4\u901A\u9053\uFF09\u3002"
6180
+ "\u63D0\u793A\uFF1A\u672C\u6B21\u672A\u5B89\u88C5\u5B89\u5168\u7F51\u5B88\u62A4\uFF08--no-guardian\uFF09\u3002\u9700\u8981\u65F6\u968F\u65F6\u6267\u884C dsh-lark-bot guardian install\u3002"
6178
6181
  ],
6179
6182
  ""
6180
6183
  ].join("\n")
@@ -7106,10 +7109,10 @@ function buildProgram() {
7106
7109
  program.name("dsh-lark-bot").description("Bridge DeepSeek Harness into Feishu / Lark").version(packageVersion(), "-v, --version");
7107
7110
  program.command("setup").description(
7108
7111
  "Install this package as a standard dsh profile bundle (single install path)"
7109
- ).option("--profile <name>", "dsh profile to install into (default: dsh-lark)").option("--guardian", "also install the safety-net guardian service").action(async (opts) => {
7112
+ ).option("--profile <name>", "dsh profile to install into (default: dsh-lark)").option("--guardian", "install the safety-net guardian service (installed by default; compatibility)").option("--no-guardian", "skip installing the safety-net guardian service (installed by default)").action(async (opts) => {
7110
7113
  await runSetup({
7111
7114
  ...opts.profile ? { profile: opts.profile } : {},
7112
- ...opts.guardian ? { guardian: true } : {}
7115
+ guardian: opts.guardian !== false
7113
7116
  });
7114
7117
  });
7115
7118
  program.command("doctor").description("Run local diagnostics").option("--profile <name>", "profile name").option("--workspace <path>", "initial working directory").option("--app-id <id>", "existing Lark/Feishu app id").option("--app-secret <secret>", "existing Lark/Feishu app secret").option("--tenant <tenant>", "feishu or lark").action(async (opts) => {