dsh-lark-bot 0.10.2 → 0.12.0

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
@@ -328,17 +328,61 @@ to the latest version.
328
328
 
329
329
  ### 升级 | Upgrade
330
330
 
331
+ **推荐:一行命令彻底升级(v0.12.0+ 新增,issue #10)**
332
+
333
+ ```bash
334
+ npx dsh-lark-bot@latest upgrade --profile dsh-lark --yes
335
+ ```
336
+
337
+ `upgrade` 自动完成:检测当前已装版本 / 运行中 CLI / npm 最新版 → 升级**包本体**
338
+ (`dsh plugin add <name>@<latest>`)→ **幂等重装并重启 guardian 服务** → 升级后运行
339
+ `doctor` 验证。覆盖运行中实例的安全处理:
340
+
341
+ - 默认不打断运行中的 dsh profile,只提示重启命令(升级不影响配置 / 会话 / 凭据);
342
+ - `--restart`:升级后自动重启 guardian 服务与(受管/后台的)dsh profile 进程;
343
+ - `--check`:只报告版本与运行状态,零改动;
344
+ - `--rollback`:回滚到上一次升级前的版本(记录在 `~/.dsh-lark/upgrade-state.json`);
345
+ - `--force`:无法访问 npm(离线)时按当前运行版本重装;
346
+ - `--no-guardian`:跳过守护升级;
347
+ - **runtime profile 一致性修复**:升级后自动把 `dsh-lark-sdk` / `dsh-lark-acp` 的
348
+ own-package 链接重指到新版本(避免下次启动重新预置)。
349
+
350
+ 无需交互确认时加 `--yes`(非交互环境不带 `--yes` 会安全中止)。其余方式:
351
+
331
352
  - 插件本体:重跑 `setup`(或 `dsh plugin --profile <name> add dsh-lark-bot`)拉取 npm 最新版。
332
- - 安全网守护:随 `setup` 一起安装 / 升级(幂等重装),也可单独 `dsh-lark-bot guardian install`。
353
+ - 安全网守护:随 `upgrade` / `setup` 一起安装 / 升级(幂等重装),也可单独
354
+ `dsh-lark-bot guardian install`。
333
355
  - CLI 工具(可选):`npm i -g dsh-lark-bot@latest`;使用 `npx` 时无需全局安装。
334
- - 升级后重启 profile:`dsh --profile dsh-lark`。
356
+ - 升级后重启 profile(未用 `--restart` 时):`dsh --profile dsh-lark`。
357
+
358
+ - **Recommended: one-command full upgrade (new in v0.12.0, issue #10)**
359
+
360
+ ```bash
361
+ npx dsh-lark-bot@latest upgrade --profile dsh-lark --yes
362
+ ```
363
+
364
+ `upgrade` detects the installed / running / npm-latest versions, upgrades the **package**
365
+ (`dsh plugin add <name>@<latest>`), **idempotently reinstalls and restarts the guardian
366
+ service**, then runs `doctor` verification. Running instances are handled safely:
367
+
368
+ - By default the running dsh profile is never interrupted — you only get the restart command
369
+ (config / sessions / credentials are untouched);
370
+ - `--restart`: also restarts the guardian service and (managed/detached) dsh profile processes;
371
+ - `--check`: report versions and running state only, no changes;
372
+ - `--rollback`: reinstall the version recorded before the last upgrade
373
+ (`~/.dsh-lark/upgrade-state.json`);
374
+ - `--force`: reinstall the running version when npm is unreachable (offline);
375
+ - `--no-guardian`: skip the guardian upgrade.
376
+
377
+ Pass `--yes` to skip the interactive confirmation (non-interactive runs fail closed without it).
378
+ Alternatives:
335
379
 
336
380
  - Plugin: re-run `setup` (or `dsh plugin --profile <name> add dsh-lark-bot`) to pull the latest
337
381
  npm release.
338
- - Safety-net guardian: installed / upgraded together with `setup` (idempotent), or standalone via
339
- `dsh-lark-bot guardian install`.
382
+ - Safety-net guardian: installed / upgraded together with `upgrade` / `setup` (idempotent), or
383
+ standalone via `dsh-lark-bot guardian install`.
340
384
  - CLI tool (optional): `npm i -g dsh-lark-bot@latest`; not needed when using `npx`.
341
- - Restart the profile after upgrading: `dsh --profile dsh-lark`.
385
+ - Restart the profile after upgrading (when not using `--restart`): `dsh --profile dsh-lark`.
342
386
 
343
387
  ### 禁用 | Disable
344
388
 
@@ -406,7 +450,9 @@ tasks and session archival.
406
450
  - **平台**:Linux / macOS / Windows(飞书 WebSocket 出站长连接,免公网服务器 / 域名 / 内网穿透)。
407
451
  - 默认 adapter 为官方 **`@deepseek-ai/dsh-sdk-client`**(SDK JSON-RPC runtime,原生 session 续跑 +
408
452
  token 级流式事件);`DSH_LARK_ADAPTER=acp` 切到官方 **ACP server**(审批卡);`headless` 保留旧版
409
- 子进程 fallback。首次启动自动在 `~/.dsh/profiles/dsh-lark-sdk`(或 `dsh-lark-acp`)创建 runtime profile。
453
+ 子进程 fallback;`DSH_LARK_ADAPTER=web` 驱动**本地 dsh web agent**(`session.prompt` +
454
+ `/api/events.mux`,网页端成为唯一写者,从根上消除多写者会话损坏)。首次启动自动在
455
+ `~/.dsh/profiles/dsh-lark-sdk`(或 `dsh-lark-acp`)创建 runtime profile。
410
456
 
411
457
  - **DeepSeek Harness (`dsh`)**: verified against **dsh 0.1.0-rc.6** (last verified 2026-08-15: SDK JSON-RPC / ACP
412
458
  runtime handshake + real streaming task verification), connected through the official
@@ -419,7 +465,9 @@ tasks and session archival.
419
465
  - The default adapter is the official **`@deepseek-ai/dsh-sdk-client`** (SDK JSON-RPC runtime with
420
466
  native session continuation and token-level streaming events); `DSH_LARK_ADAPTER=acp` switches
421
467
  to the official **ACP server** (approval cards); `headless` keeps the legacy subprocess
422
- fallback. On first start the bot creates the runtime profile at
468
+ fallback; `DSH_LARK_ADAPTER=web` drives the **local dsh web agent** (`session.prompt` +
469
+ `/api/events.mux` — the web agent becomes the single writer, eliminating multi-writer
470
+ session-log corruption at the root). On first start the bot creates the runtime profile at
423
471
  `~/.dsh/profiles/dsh-lark-sdk` (or `dsh-lark-acp`).
424
472
 
425
473
  ## 已知限制 | Known limitations
@@ -490,10 +538,12 @@ Core environment variables:
490
538
  | `DSH_LARK_WORKSPACE` | 未设置 | 新会话默认工作目录<br>Default working directory for new sessions |
491
539
  | `DSH_LARK_DSH_COMMAND` | `自动发现` | dsh 启动命令;通常无需设置<br>dsh launch command; usually not needed |
492
540
  | `DSH_LARK_DSH_ARGS` | `自动发现` | dsh 启动参数,逗号分隔;通常无需设置<br>dsh launch args, comma-separated; usually not needed |
493
- | `DSH_LARK_ADAPTER` | `sdk` | `sdk`(默认)/ `acp`(审批)/ `headless`(legacy)<br>`sdk` (default) / `acp` (approval) / `headless` (legacy) |
541
+ | `DSH_LARK_ADAPTER` | `sdk` | `sdk`(默认)/ `acp`(审批)/ `headless`(legacy)/ `web`(本地 dsh web agent,单写者)<br>`sdk` (default) / `acp` (approval) / `headless` (legacy) / `web` (local dsh web agent, single writer) |
494
542
  | `DSH_LARK_PROVIDER` | `deepseek-official` | 模型 provider<br>Model provider |
495
543
  | `DSH_LARK_MODEL` | `deepseek-v4-flash` | 默认模型<br>Default model |
496
544
  | `DSH_LARK_MAX_TOKENS` | 未设置 | SDK agent 每请求输出 token 上限<br>Per-request output token cap for SDK agents |
545
+ | `DSH_LARK_WEB_URL` | `http://127.0.0.1:3080` | `web` 适配器:本地 dsh web agent 的 base URL<br>`web` adapter: base URL of the local dsh web agent |
546
+ | `DSH_LARK_WEB_PUSH` | `true` | `web` 适配器:网页端回合完成时推送到飞书并自动切换会话映射(`0` 关闭)<br>`web` adapter: push web-GUI turn completions to Feishu and auto-switch the chat mapping (`0` disables) |
497
547
  | `DSH_LARK_ACCESS_DEFAULT_DENY` | `false` | 无白名单时拒绝私聊<br>Reject private chats when no allowlist is configured |
498
548
  | `DSH_LARK_EVENT_FRESHNESS_MS` | `600000` | 过期消息拒绝窗口(0 关闭)<br>Stale-message rejection window (0 disables) |
499
549
  | `DSH_LARK_RUN_TIMEOUT_MS` | `300000` | 单次运行空闲超时:持续无活动事件才终止(活跃任务不会被误杀)<br>Idle timeout for a single run: stops only after the run has been silent for this long |
@@ -512,6 +562,7 @@ Core environment variables:
512
562
  | `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
563
  | `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
564
  | `DSH_LARK_GUARDIAN_CARD_DENSITY` | `detailed` | 安全模式任务卡片密度(compact / standard / detailed)<br>Card density for safe-mode run cards |
565
+ | `DSH_LARK_UPGRADE_REGISTRY` | `https://registry.npmjs.org` | `upgrade` 探测最新版本的 npm registry(可指向镜像)<br>npm registry used by `upgrade` to discover the latest version (mirrors supported) |
515
566
 
516
567
  启动时会自动查找本机常见的 `@deepseek-ai/dsh` 安装位置。只有自动发现失败或需要指定特殊 profile 时,才需要设置这两个变量。
517
568
 
@@ -734,11 +785,12 @@ and relaunches the full profile on `/safemode exit`.
734
785
  | `src/onboard/` | 首次扫码创建 / 绑定 PersonalAgent 应用<br>First-run QR onboarding |
735
786
  | `src/session/` | 会话路由、排队、访问控制<br>Session routing, queueing, access control |
736
787
  | `src/workspace/` | 项目工作区、git worktree 隔离与规则注入<br>Project workspace, git worktree isolation & rule injection |
737
- | `src/adapters/` | agent 后端适配器(sdk 默认 / acp 审批 / headless legacy)<br>Agent backend adapters (sdk / acp / headless) |
788
+ | `src/adapters/` | agent 后端适配器(sdk 默认 / acp 审批 / headless legacy / web 单写者)<br>Agent backend adapters (sdk / acp / headless / web single-writer) |
738
789
  | `src/card/` | 流式卡片状态与渲染<br>Streaming card state & rendering |
739
790
  | `src/bot/` | 运行注册、消息排队、审批/问答注册表<br>Run registry, queueing, approval/question registries |
740
791
  | `src/commands/` | 斜杠命令(/cd /ws /new …)<br>Slash commands |
741
- | `src/cli/` | CLI 入口:`setup`(唯一安装命令)/ `doctor`(诊断)/ 隐藏 `run`<br>CLI entry: setup / doctor / hidden run |
792
+ | `src/cli/` | CLI 入口:`setup`(唯一安装命令)/ `doctor`(诊断)/ `upgrade`(一键升级)/ 隐藏 `run`<br>CLI entry: setup / doctor / upgrade / hidden run |
793
+ | `src/upgrade/` | 一键升级(issue #10):版本探测、升级状态、运行检测、guardian/profile 重启助手、runtime 链接修复<br>One-command upgrade (issue #10): version probe, upgrade state, running-state detection, restart helpers, runtime link repair |
742
794
  | `src/guardian/` | 安全网守护:心跳、进程观察、仅核心安全 profile、接管状态机、系统服务安装<br>Safety-net guardian: heartbeat, process watch, core-only safe profile, takeover state machine, service install |
743
795
  | `src/config/` | profile / 配置 / 访问白名单 / dsh 配置管理<br>Profile, config, access & dsh config management |
744
796
  | `src/core/` | 结构化日志<br>Structured logging |
@@ -766,27 +818,29 @@ and relaunches the full profile on `/safemode exit`.
766
818
 
767
819
  | 平台 Platform | 状态 Status | 说明 Notes |
768
820
  | :--- | :--- | :--- |
769
- | [awesome-dsh-plugins](https://github.com/AdamPlatin123/awesome-dsh-plugins) | ✅ 已收录 · 运行级可用<br>Listed · runtime-verified | 社区榜单标注 `✅ 运行级可用`,2026-08-14 agent 实测通过;收录条目更新至 v0.8.0([PR #127](https://github.com/AdamPlatin123/awesome-dsh-plugins/pull/127) 已合并),v0.10.1 同步已跟进([#139](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139) 最新评论)<br>Shown as `✅ 运行级可用` in the community leaderboard; agent-tested on 2026-08-14; v0.8.0 entry merged via [PR #127](https://github.com/AdamPlatin123/awesome-dsh-plugins/pull/127); v0.10.1 sync requested in [#139](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139) |
770
- | [dshfind](https://dshfind.com/zh/plugins/PlutoKeating/dsh-lark-bot) | ✅ 已收录 · 详情页已上线<br>Listed · detail page live | 中英日韩四语详情页已上线(含安装命令与亮点),条目名称正常([issue #2](https://github.com/hikariming/dshfind/issues/2) 已关闭);v0.10.1 数据刷新已提交([issue #6](https://github.com/hikariming/dshfind/issues/6));顶部徽章 / 展示卡来自 dshfind<br>Four-language detail page is live (install command & highlights), entry name fixed ([issue #2](https://github.com/hikariming/dshfind/issues/2) closed); v0.10.1 data refresh requested in [issue #6](https://github.com/hikariming/dshfind/issues/6); the header badge / card comes from dshfind |
771
- | [omdsh-dev/community](https://github.com/orgs/omdsh-dev/discussions/12) | ✅ 已提交收录申请<br>Submission submitted | `[Plugin]` 收录申请(Discussion #12)已通过;v0.8.0 更新、六项独家亮点与 v0.10.1 稳定性修复说明均已发布在该讨论<br>`[Plugin]` submission (Discussion #12) accepted; v0.8.0 update, the six-exclusive-highlights summary and the v0.10.1 stability-fix notes are all posted there |
821
+ | [awesome-dsh-plugins](https://github.com/AdamPlatin123/awesome-dsh-plugins) | ✅ 已收录 · 运行级可用<br>Listed · runtime-verified | 社区榜单标注 `✅ 运行级可用`,2026-08-14 agent 实测通过;收录条目更新至 v0.8.0([PR #127](https://github.com/AdamPlatin123/awesome-dsh-plugins/pull/127) 已合并),v0.10.2 同步已跟进([#139](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139) 最新评论)<br>Shown as `✅ 运行级可用` in the community leaderboard; agent-tested on 2026-08-14; v0.8.0 entry merged via [PR #127](https://github.com/AdamPlatin123/awesome-dsh-plugins/pull/127); v0.10.2 sync requested in [#139](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139) |
822
+ | [dshfind](https://dshfind.com/zh/plugins/PlutoKeating/dsh-lark-bot) | ✅ 已收录 · 详情页已上线<br>Listed · detail page live | 中英日韩四语详情页已上线(含安装命令与亮点),条目名称正常([issue #2](https://github.com/hikariming/dshfind/issues/2) 已关闭);v0.10.2 数据刷新已提交([issue #6](https://github.com/hikariming/dshfind/issues/6));顶部徽章 / 展示卡来自 dshfind<br>Four-language detail page is live (install command & highlights), entry name fixed ([issue #2](https://github.com/hikariming/dshfind/issues/2) closed); v0.10.2 data refresh requested in [issue #6](https://github.com/hikariming/dshfind/issues/6); the header badge / card comes from dshfind |
823
+ | [omdsh-dev/community](https://github.com/orgs/omdsh-dev/discussions/12) | ✅ 已提交收录申请<br>Submission submitted | `[Plugin]` 收录申请(Discussion #12)已通过;v0.8.0 更新、六项独家亮点与 v0.10.1 / v0.10.2 稳定性修复说明均已发布在该讨论<br>`[Plugin]` submission (Discussion #12) accepted; v0.8.0 update, the six-exclusive-highlights summary and the v0.10.1 / v0.10.2 stability-fix notes are all posted there |
772
824
 
773
825
  **更新请求进度 / Update request status**:
774
826
 
775
827
  - awesome-dsh-plugins 收录条目更新:[#127](https://github.com/AdamPlatin123/awesome-dsh-plugins/pull/127) — ✅ 已合并
776
828
  - dshfind 数据刷新请求(含条目名称异常修正):[#2](https://github.com/hikariming/dshfind/issues/2) — ✅ 已关闭,详情页已更新
777
829
  - omdsh-dev/community 收录讨论更新:[Discussion #12 更新评论](https://github.com/orgs/omdsh-dev/discussions/12#discussioncomment-18021998) — ✅ 已发布
778
- - awesome-dsh-plugins 榜单行同步至 v0.10.1:[#139 最新评论](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139#issuecomment-5304291100) — 📨 已提交
779
- - dshfind 数据刷新至 v0.10.1:[#6](https://github.com/hikariming/dshfind/issues/6) — 📨 已提交
830
+ - awesome-dsh-plugins 榜单行同步至 v0.10.2:[#139 最新评论](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139#issuecomment-5304382615) — 📨 已提交
831
+ - dshfind 数据刷新至 v0.10.2:[#6 跟进评论](https://github.com/hikariming/dshfind/issues/6#issuecomment-5304382647) — 📨 已提交
780
832
  - omdsh-dev/community v0.10.1 更新说明:[Discussion #12 评论](https://github.com/omdsh-dev/community/discussions/12#discussioncomment-18034706) — ✅ 已发布
833
+ - omdsh-dev/community v0.10.2 更新说明:[Discussion #12 评论](https://github.com/omdsh-dev/community/discussions/12#discussioncomment-18034903) — ✅ 已发布
781
834
 
782
835
  **Update requests**:
783
836
 
784
837
  - awesome-dsh-plugins entry refresh: [#127](https://github.com/AdamPlatin123/awesome-dsh-plugins/pull/127) — ✅ merged
785
838
  - dshfind data-refresh request (incl. fixing the entry name): [#2](https://github.com/hikariming/dshfind/issues/2) — ✅ closed, detail page updated
786
839
  - omdsh-dev/community listing update: [Discussion #12 update comment](https://github.com/orgs/omdsh-dev/discussions/12#discussioncomment-18021998) — ✅ posted
787
- - awesome-dsh-plugins leaderboard sync to v0.10.1: [#139 comment](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139#issuecomment-5304291100) — 📨 submitted
788
- - dshfind data refresh to v0.10.1: [#6](https://github.com/hikariming/dshfind/issues/6) — 📨 submitted
840
+ - awesome-dsh-plugins leaderboard sync to v0.10.2: [#139 comment](https://github.com/AdamPlatin123/awesome-dsh-plugins/issues/139#issuecomment-5304382615) — 📨 submitted
841
+ - dshfind data refresh to v0.10.2: [#6 follow-up](https://github.com/hikariming/dshfind/issues/6#issuecomment-5304382647) — 📨 submitted
789
842
  - omdsh-dev/community v0.10.1 update: [Discussion #12 comment](https://github.com/omdsh-dev/community/discussions/12#discussioncomment-18034706) — ✅ posted
843
+ - omdsh-dev/community v0.10.2 update: [Discussion #12 comment](https://github.com/omdsh-dev/community/discussions/12#discussioncomment-18034903) — ✅ posted
790
844
 
791
845
  **亮点跟进 / Highlights follow-ups**(六项独家能力与 issue #6 设计实现):
792
846