dsh-lark-bot 0.9.2 → 0.10.1
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 +28 -12
- package/SECURITY.md +3 -2
- package/cordis.patch.yml +5 -4
- package/dist/cli.js +492 -109
- package/dist/cli.js.map +1 -1
- package/dist/plugin.d.ts +14 -0
- package/dist/plugin.js +142 -55
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,7 +127,7 @@ DSH_LARK_APP_ID=cli_xxx DSH_LARK_APP_SECRET=<secret> DSH_LARK_TENANT=feishu \
|
|
|
127
127
|
> 卸载:`dsh plugin --profile dsh-lark remove dsh-lark-bot`。
|
|
128
128
|
> Uninstall: `dsh plugin --profile dsh-lark remove dsh-lark-bot`.
|
|
129
129
|
|
|
130
|
-
###
|
|
130
|
+
### 3. 基本使用 | Basic usage
|
|
131
131
|
|
|
132
132
|
在飞书里向 bot 发送普通消息即可开始工作,常用命令:
|
|
133
133
|
|
|
@@ -222,12 +222,18 @@ you answer — no extra command needed. The run-timeout watchdog pauses while a
|
|
|
222
222
|
|
|
223
223
|
- `/safemode`:进入**仅核心安全模式**——守护创建 `~/.dsh/profiles/<profile>-safe`(仅
|
|
224
224
|
`dsh-base` + `dsh-headless` 两个官方核心 bundle,**不加载任何第三方插件**),后续消息经
|
|
225
|
-
守护转发给该核心 dsh 逐条对话,配合代码执行能力定位 / 修复 /
|
|
225
|
+
守护转发给该核心 dsh 逐条对话,配合代码执行能力定位 / 修复 / 禁用损坏插件;安全模式优先使用
|
|
226
|
+
官方 **SDK 流式引擎**(实时思考 / 工具调用 / web search / 打字机式文字输出,与正常模式同一张
|
|
227
|
+
流式卡),SDK runtime 不可用时自动回退 headless(任务期间卡片仍实时显示“正在思考 / 已运行 Ns /
|
|
228
|
+
无响应 Ns”活动状态);
|
|
226
229
|
- `/safemode plugins`:列出故障 profile 已安装的插件清单(自愈诊断);
|
|
227
230
|
- `/safemode status`:查看守护 / dsh / 安全模式状态;
|
|
231
|
+
- `/safemode stop`:终止当前正在运行的安全模式任务(也可点击任务卡片上的 ⏹ 按钮);
|
|
228
232
|
- `/safemode exit`:退出安全模式,守护重启完整 profile 并把飞书通道交还给正常形态;
|
|
229
233
|
|
|
230
|
-
|
|
234
|
+
安全模式任务有**空闲超时**(`DSH_LARK_GUARDIAN_SAFE_TIMEOUT_MS`,默认 10 分钟:任务持续无
|
|
235
|
+
活动事件才被终止,活跃的流式任务不会被误杀),超时或失败都会在卡片上给出明确终态,不会无声
|
|
236
|
+
挂起。全程不需要命令行;dsh 恢复后守护自动断开并回归静默。安装:
|
|
231
237
|
|
|
232
238
|
```bash
|
|
233
239
|
# 随 setup 默认安装(无需额外参数);已安装后也可单独安装 / 重装:
|
|
@@ -243,14 +249,21 @@ takes over the Feishu channel so you can self-heal without touching the command
|
|
|
243
249
|
- `/safemode`: enter **core-only safe mode** — the guardian provisions
|
|
244
250
|
`~/.dsh/profiles/<profile>-safe` with only the two official core bundles (`dsh-base` +
|
|
245
251
|
`dsh-headless`, **no third-party plugins**) and proxies a restricted conversation to that core
|
|
246
|
-
dsh so you can locate / fix / disable the offending plugin
|
|
252
|
+
dsh so you can locate / fix / disable the offending plugin. Safe mode prefers the official
|
|
253
|
+
**SDK streaming engine** (real-time reasoning / tool calls / web search / typewriter text on the
|
|
254
|
+
same streaming card as normal mode) and falls back to headless with a live activity card
|
|
255
|
+
("thinking / elapsed Ns / no response Ns") when the SDK runtime cannot be provisioned;
|
|
247
256
|
- `/safemode plugins`: list the plugins installed into the broken profile;
|
|
248
257
|
- `/safemode status`: show guardian / dsh / safe-mode state;
|
|
258
|
+
- `/safemode stop`: interrupt the currently running safe-mode task (or use the ⏹ button on the card);
|
|
249
259
|
- `/safemode exit`: leave safe mode — the guardian relaunches the full profile and hands the
|
|
250
260
|
Feishu channel back;
|
|
251
261
|
|
|
252
|
-
|
|
253
|
-
|
|
262
|
+
Safe-mode tasks are bounded by an **idle timeout**
|
|
263
|
+
(`DSH_LARK_GUARDIAN_SAFE_TIMEOUT_MS`, default 10 minutes: a task is stopped only after it has
|
|
264
|
+
been silent for the whole window, so active streaming work is never cut short); timeouts and failures always surface a
|
|
265
|
+
clear terminal state on the card instead of hanging silently. No command line is needed for the
|
|
266
|
+
whole rescue flow; once dsh is back, the guardian releases the channel automatically. Install:
|
|
254
267
|
|
|
255
268
|
```bash
|
|
256
269
|
# Installed by default with setup (no extra flag); can also be installed / refreshed later:
|
|
@@ -483,7 +496,7 @@ Core environment variables:
|
|
|
483
496
|
| `DSH_LARK_MAX_TOKENS` | 未设置 | SDK agent 每请求输出 token 上限<br>Per-request output token cap for SDK agents |
|
|
484
497
|
| `DSH_LARK_ACCESS_DEFAULT_DENY` | `false` | 无白名单时拒绝私聊<br>Reject private chats when no allowlist is configured |
|
|
485
498
|
| `DSH_LARK_EVENT_FRESHNESS_MS` | `600000` | 过期消息拒绝窗口(0 关闭)<br>Stale-message rejection window (0 disables) |
|
|
486
|
-
| `DSH_LARK_RUN_TIMEOUT_MS` | `300000` |
|
|
499
|
+
| `DSH_LARK_RUN_TIMEOUT_MS` | `300000` | 单次运行空闲超时:持续无活动事件才终止(活跃任务不会被误杀)<br>Idle timeout for a single run: stops only after the run has been silent for this long |
|
|
487
500
|
| `DSH_LARK_STOP_GRACE_MS` | `5000` | SIGTERM 后等待优雅退出再 SIGKILL 的宽限期<br>Grace period after SIGTERM before SIGKILL |
|
|
488
501
|
| `DSH_LARK_SCOPE_CONCURRENCY` | `2` | 每个 scope 的并行任务数(1=严格串行)<br>Concurrent runs per scope (1 = strictly serial) |
|
|
489
502
|
| `DSH_LARK_RETENTION_MSGS` | `40` | 每个 scope 保留的消息条数(0=全部保留)<br>Messages kept per scope (0 keeps everything) |
|
|
@@ -496,6 +509,9 @@ Core environment variables:
|
|
|
496
509
|
| `DSH_LARK_GUARDIAN_POLL_MS` | `2000` | 守护看门狗轮询间隔<br>Guardian watchdog poll interval |
|
|
497
510
|
| `DSH_LARK_GUARDIAN_STALE_MS` | `15000` | 心跳超时阈值,超过且无 dsh 进程则接管飞书通道<br>Heartbeat staleness threshold before channel takeover |
|
|
498
511
|
| `DSH_LARK_GUARDIAN_ENGINE_DEAD_MS` | `120000` | dsh 进程存活但心跳持续超时该时长,判定桥接引擎已死并接管<br>Live dsh process with heartbeat stale this long is treated as engine-dead (takeover) |
|
|
512
|
+
| `DSH_LARK_GUARDIAN_SAFE_ADAPTER` | `auto` | 安全模式引擎:`auto` 优先 SDK 流式、失败回退 headless;`sdk` 强制 SDK;`headless` 跳过预置<br>Safe-mode engine: `auto` tries the SDK streaming runtime then falls back to headless; `sdk` requires it; `headless` skips provisioning |
|
|
513
|
+
| `DSH_LARK_GUARDIAN_SAFE_TIMEOUT_MS` | `600000` | 安全模式单任务空闲超时(持续无活动事件才停止并出超时卡)<br>Safe-mode per-task idle timeout (stops the run after it has been silent this long and renders a timeout card) |
|
|
514
|
+
| `DSH_LARK_GUARDIAN_CARD_DENSITY` | `detailed` | 安全模式任务卡片密度(compact / standard / detailed)<br>Card density for safe-mode run cards |
|
|
499
515
|
|
|
500
516
|
启动时会自动查找本机常见的 `@deepseek-ai/dsh` 安装位置。只有自动发现失败或需要指定特殊 profile 时,才需要设置这两个变量。
|
|
501
517
|
|
|
@@ -519,8 +535,8 @@ This tool runs **locally**; before installing, be aware that it accesses:
|
|
|
519
535
|
引用,凭据文件权限 0600、目录 0700,字面密钥不进入 settings 或聊天记录)。
|
|
520
536
|
- **安全网守护(默认随 `setup` 安装)**:系统级常驻进程,读取 `~/.dsh-lark/config.json` 中的飞书
|
|
521
537
|
凭据;dsh 下线时接管同一 bot 的飞书长连接并扫描本机进程(仅 `ps` 命令行,不读内存);
|
|
522
|
-
`/safemode`
|
|
523
|
-
|
|
538
|
+
`/safemode` 时创建仅官方核心的 dsh profile(headless 或 SDK JSON-RPC runtime,均无第三方插件)
|
|
539
|
+
并逐条执行任务;SDK 引擎会以官方 `dsh-sdk-jsonrpc-server` 子进程提供实时流式事件。
|
|
524
540
|
|
|
525
541
|
- **Feishu credentials**: the PersonalAgent app `app_id` / `app_secret`, stored in plaintext at
|
|
526
542
|
`~/.dsh-lark/config.json` (file mode 600).
|
|
@@ -560,14 +576,14 @@ availability probe for the current adapter (`sdk` / `acp` / `headless` runtime h
|
|
|
560
576
|
Common issues:
|
|
561
577
|
|
|
562
578
|
- **bot 静默 / 长连接失败**:查看 stderr 上的 JSONL 日志,关注 `channel` 与 `channel-command` 类别;SDK 会自动重连。
|
|
563
|
-
- **agent 无响应**:发送 `/status` 查看当前 scope、cwd 和 active run;发送 `/stop`
|
|
579
|
+
- **agent 无响应**:发送 `/status` 查看当前 scope、cwd 和 active run;发送 `/stop` 终止当前任务;持续无响应超过 `DSH_LARK_RUN_TIMEOUT_MS` 时看门狗会自动终止(空闲超时,活跃任务不会被误杀)。
|
|
564
580
|
- **首次扫码失败**:确认本机时间准确、网络可访问飞书开放平台;已拿到 App ID/Secret 时可用 `--app-id` / `--app-secret` 跳过扫码。
|
|
565
581
|
|
|
566
582
|
- **Silent bot / long-connection failure**: check the JSONL logs on stderr, focusing on the
|
|
567
583
|
`channel` and `channel-command` categories; the SDK reconnects automatically.
|
|
568
584
|
- **Unresponsive agent**: send `/status` to view the scope, cwd and active run; send `/stop` to
|
|
569
|
-
terminate the current task; the watchdog terminates it automatically after
|
|
570
|
-
`DSH_LARK_RUN_TIMEOUT_MS
|
|
585
|
+
terminate the current task; the idle watchdog terminates it automatically after it has been
|
|
586
|
+
silent for `DSH_LARK_RUN_TIMEOUT_MS` (active streaming work is never cut short).
|
|
571
587
|
- **First QR binding fails**: make sure the local clock is accurate and the Feishu open platform
|
|
572
588
|
is reachable; with an existing App ID/Secret you can skip scanning via `--app-id` /
|
|
573
589
|
`--app-secret`.
|
package/SECURITY.md
CHANGED
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
- 控制信号默认拒绝:仅管理员(`access.admins`,无管理员时回退 `allowedUsers`)可触发
|
|
46
46
|
`/safemode` 系列命令,未授权消息静默丢弃;
|
|
47
47
|
- 过期事件复用 `DSH_LARK_EVENT_FRESHNESS_MS` 窗口拒绝;
|
|
48
|
-
- 心跳 / 守护状态文件以 `0600` 写入;安全模式仅挂载官方核心 bundle
|
|
49
|
-
`dsh-headless
|
|
48
|
+
- 心跳 / 守护状态文件以 `0600` 写入;安全模式仅挂载官方核心 bundle(headless:
|
|
49
|
+
`dsh-base` + `dsh-headless`;SDK 流式优先:`dsh-base` + `dsh-sdk-jsonrpc-server`,
|
|
50
|
+
均不挂载第三方插件与 bridge 回调工具),避免把故障面带进救援通道。
|
|
50
51
|
|
|
51
52
|
## 数据与凭据 · Data & credentials
|
|
52
53
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# dsh-lark-bot as a profile bundle.
|
|
2
|
-
|
|
3
|
-
# Installed with `dsh plugin --profile <name> add dsh-lark-bot` (or the
|
|
4
|
-
#
|
|
2
|
+
#
|
|
3
|
+
# Installed with `dsh plugin --profile <name> add dsh-lark-bot` (or the single
|
|
4
|
+
# `dsh-lark-bot setup` command), dsh appends this package to the profile's
|
|
5
5
|
# `dsh.profile.bundles` and applies this patch on boot:
|
|
6
6
|
# - `dsh-lark-bot/plugin` starts the full bridge engine IN-PROCESS (Feishu
|
|
7
7
|
# channel, workspace/session layers, notify server, nested dsh SDK
|
|
8
8
|
# runtime) and exposes `ctx.larkBridge` (status / stop).
|
|
9
|
-
# - `dsh-lark-bot/notify` mounts the `lark_notify` tool for the host agent
|
|
9
|
+
# - `dsh-lark-bot/notify` mounts the `lark_notify` tool for the host agent
|
|
10
|
+
# (mentions + cross-session messages).
|
|
10
11
|
# First boot without credentials prints a QR code for one-time binding.
|
|
11
12
|
# Set DSH_LARK_DISABLED=1 to keep the engine stopped.
|
|
12
13
|
|