dsh-cherry-bridge 0.1.11 → 0.2.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.en.md CHANGED
@@ -28,23 +28,25 @@ flowchart TB
28
28
  ```
29
29
 
30
30
  - Package: `dsh-cherry-bridge`, plugin id: `cherry-remote`
31
- - Transport: `ws://` + Noise XX (encryption lives in the Noise record layer; no TLS termination required)
31
+ - Transport: `ws://` + Noise XX by default (encryption lives in the Noise record layer); a desktop behind a TLS front is reached over `wss://`, with `wsTls` supplying the private-CA trust
32
32
  - Tool face: 14 `cherry_*` tools, enabled **per workspace**, and by default **nobody has them** (see “Scope”)
33
33
  - Settings page and HTTP face: the same-origin prefix `/cherry-remote/api` on the host web server
34
34
 
35
35
  ## Install
36
36
 
37
37
  > **DSH version requirement**: `>=0.2.0-rc.2 <0.3.0-0` (declared via `engines.dsh` in `package.json`; when unmet the bundle is skipped and its settings-page row disabled — `dsh plugin allow-version` grants an explicit exemption; 0.3.0 needs a fresh compatibility pass before the range widens).
38
+ >
39
+ > **Cherry Studio compatibility**: desktop **2.1.4 – 2.1.8 is tested** — the `v3` custom-address QR needs **2.1.8+**, and the `v2` QR of 2.1.4 – 2.1.7 works too. Outside that range is unverified: the handshake negotiates protocol version `[1]` only, so an incompatible peer fails loudly as `unreachable` instead of misbehaving. The protocol packages are pinned to `0.7.0` / `0.2.5` — the versions desktop 2.1.8 ships.
38
40
 
39
41
  ```bash
40
42
  # From npm (recommended, pinned)
41
- npx @deepseek-ai/dsh plugin --profile web add dsh-cherry-bridge@0.1.11
43
+ npx @deepseek-ai/dsh plugin --profile web add dsh-cherry-bridge@0.2.0
42
44
 
43
45
  # Install the latest npm release
44
46
  npx @deepseek-ai/dsh plugin --profile web add dsh-cherry-bridge
45
47
 
46
48
  # From GitHub source (same commit as the npm release)
47
- npx @deepseek-ai/dsh plugin --profile web add github:SAXEM1997/dsh-cherry-bridge#v0.1.11
49
+ npx @deepseek-ai/dsh plugin --profile web add github:SAXEM1997/dsh-cherry-bridge#v0.2.0
48
50
  ```
49
51
 
50
52
  The package ships `cordis.patch.yml` (`package.json`'s `dsh.bundle.patch` points
@@ -93,6 +95,9 @@ cherry_interactions → see pending question/approval cards; cherry_respond answ
93
95
  | `dataDir` | string | `$DSH_HOME/cherry-remote` (fallback `~/.dsh/cherry-remote`) | Plugin data directory holding `identity.key` and `devices.json` (both `0600`). |
94
96
  | `perSessionCacheBytes` | number | `2097152` (2 MiB) | Per-session cap on the **local** subscription event cache; beyond it the oldest events are dropped LRU-style with a `warn`. |
95
97
  | `rateBudgetPerSecond` | number | `32` | Per-device smoothed request budget (req/s). The desktop's shared allowance is 64 req/s through 2.1.6 and 256 req/s from 2.1.7, and only the newer generation downgrades an overrun to a single `RATE_LIMITED` refusal (the older one terminates the session with close `1011`) — hence a value sized for the harsher generation. Content reads (`agent.content.read`) derive their own tier at 8:1, **capped at 512/s** (that allowance is the same in both generations). |
98
+ | `wsTls` | object | — | **Flat** `tls.connect` options for every `wss` dial (`rejectUnauthorized` / `ca` only): operator-supplied trust for a desktop behind a private CA or a self-signed TLS front. Applied to BOTH dial sites — pairing and reconnect. **Never written to the device archive, never logged, never in diagnostics.** The whole object applies as written or is ignored entirely: an unknown key or unusable value warns by name and falls back to Node's default trust store (no partial application). |
99
+
100
+ > `wsTls.ca` is **PEM CONTENT** (the certificate text itself), not a file path.
96
101
 
97
102
  > ⚠️ `cordis.patch.yml`'s `config` is **whole-replace**, not merged with the
98
103
  > defaults. Removing a key gets you the plugin default; a key that exists but is
@@ -200,7 +205,9 @@ subscription was lost and could not be rebuilt, so the outcome is
200
205
  - **Known limitations**: `cherry_respond` lets a DSH agent approve Cherry-side
201
206
  approval cards on the user's behalf (the MVP adds no interception layer and
202
207
  trusts DSH's own tool-call approvals); only the `agent` capability is
203
- requested per device; `ws://` only (Noise encryption), no direct TLS.
208
+ requested per device; transport is `ws://` by default, and `wss://` requires a
209
+ TLS front in front of the desktop (this plugin never terminates TLS; `wsTls`
210
+ carries the private-CA trust).
204
211
 
205
212
  > Engineering detail — replay rules, the 32 MiB/≈3× memory contract, empty-page
206
213
  > and cursor tolerance, integrity semantics — lives in [`AGENTS.md`](AGENTS.md).
package/README.md CHANGED
@@ -26,23 +26,25 @@ flowchart TB
26
26
  ```
27
27
 
28
28
  - 包名:`dsh-cherry-bridge`,插件 id:`cherry-remote`
29
- - 传输:`ws://` + Noise XX(加密由 Noise 记录层提供,不依赖 TLS 终止)
29
+ - 传输:默认 `ws://` + Noise XX(加密由 Noise 记录层提供);桌面端位于 TLS 前置之后时拨 `wss://`,私有 CA 的信任由 `wsTls` 提供
30
30
  - 工具面:14 个 `cherry_*` 工具,**按工作区**启用,默认**谁都没有**(见「启用范围」)
31
31
  - 设置页与 HTTP 面:宿主 Web 服务器上的同源前缀 `/cherry-remote/api`
32
32
 
33
33
  ## 安装
34
34
 
35
35
  > **DSH 版本需求**:`>=0.2.0-rc.2 <0.3.0-0`(由 `package.json` 的 `engines.dsh` 声明;不满足时 bundle 被跳过、设置页里该插件的行被禁用,确需在区间外使用可用 `dsh plugin allow-version` 精确豁免。0.3.0 需重新评估兼容性后再放开)。
36
+ >
37
+ > **Cherry Studio 兼容范围**:桌面端 **2.1.4 – 2.1.8 已实测**——`v3` 自定义地址二维码需 **2.1.8+**,2.1.4–2.1.7 的 `v2` 二维码同样可用。区间外未经验证:握手只协商协议版本 `[1]`,不兼容时会以 `unreachable` 明确失败,不会静默出错。协议包钉在 `0.7.0` / `0.2.5`,即桌面端 2.1.8 所携带的版本。
36
38
 
37
39
  ```bash
38
40
  # 从 npm 安装(推荐,钉住版本)
39
- npx @deepseek-ai/dsh plugin --profile web add dsh-cherry-bridge@0.1.11
41
+ npx @deepseek-ai/dsh plugin --profile web add dsh-cherry-bridge@0.2.0
40
42
 
41
43
  # 安装 npm 最新发布版
42
44
  npx @deepseek-ai/dsh plugin --profile web add dsh-cherry-bridge
43
45
 
44
46
  # 从 GitHub 源码安装(与 npm 发布同一提交)
45
- npx @deepseek-ai/dsh plugin --profile web add github:SAXEM1997/dsh-cherry-bridge#v0.1.11
47
+ npx @deepseek-ai/dsh plugin --profile web add github:SAXEM1997/dsh-cherry-bridge#v0.2.0
46
48
  ```
47
49
 
48
50
  本包自带 `cordis.patch.yml`(`package.json` 的 `dsh.bundle.patch` 指向它),
@@ -85,6 +87,9 @@ cherry_interactions → 看待答的提问/审批卡;cherry_respond 作答
85
87
  | `dataDir` | string | `$DSH_HOME/cherry-remote`(回退 `~/.dsh/cherry-remote`) | 插件数据目录,存放 `identity.key` 与 `devices.json`(均 `0600`)。 |
86
88
  | `perSessionCacheBytes` | number | `2097152`(2 MiB) | 每个会话的**本地**订阅事件缓存上限,超出按 LRU 丢弃最旧事件并 `warn`。 |
87
89
  | `rateBudgetPerSecond` | number | `32` | 每设备平滑请求预算(请求/秒)。桌面端共享额度在 ≤2.1.6 是 64 req/s、≥2.1.7 是 256 req/s,且只有新版本才把超限降级为单请求 `RATE_LIMITED`(旧版本直接 close `1011` 终止会话),故按更严格的一代取保守值。内容读取(`agent.content.read`)按 8:1 派生独立一档,且**封顶 512/s**(该额度两代一致)。 |
90
+ | `wsTls` | object | — | 每次 `wss` 拨号的**扁平** `tls.connect` 选项(只接受 `rejectUnauthorized` / `ca`),供桌面端位于私有 CA 或自签 TLS 前置之后时由运维提供信任;配对与重连**两个拨号点**共用。**不写入设备档案、不写日志、不进诊断报告。** 整个对象要么按原样生效、要么整体忽略:未知键或不可用值按名 `warn` 后回退 Node 默认信任库(不部分应用)。 |
91
+
92
+ > `wsTls.ca` 是 **PEM 内容**(证书文本本身),不是文件路径。
88
93
 
89
94
  > ⚠️ `cordis.patch.yml` 的 `config` 是**整体替换**,不与默认值合并。删掉一个键得到的是
90
95
  > 插件默认值;键存在但值非法(`0`、负数、字符串)会按名 `warn` 后回落默认值。
@@ -155,7 +160,8 @@ cherry_interactions → 看待答的提问/审批卡;cherry_respond 作答
155
160
  idle 回答的历史走查仍从那一刻起算自己的预算(慢但成功的快照不会把走查挤成零);
156
161
  代价是两段预算**分开计**,病态调用可能把两段都花掉。
157
162
  - **已知限制**:`cherry_respond` 让 DSH agent 可代替用户批准 Cherry 端审批卡(MVP 不加拦截层,
158
- 信任 DSH 自身的工具审批);每设备仅申请 `agent` capability;仅 `ws://`(Noise 加密),不做 TLS 直连。
163
+ 信任 DSH 自身的工具审批);每设备仅申请 `agent` capability;传输默认 `ws://`,
164
+ `wss://` 要求桌面端位于 TLS 前置之后(本插件不做 TLS 终止;私有 CA 的信任由 `wsTls` 提供)。
159
165
 
160
166
  > 传输重放、32 MiB/≈3× 内存、空页与游标容忍、完整性语义等工程细节见 [`AGENTS.md`](AGENTS.md)。
161
167
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,18 @@
1
1
  import { connectSecureChannel } from "@cherrystudio/remote-transport";
2
2
  import "@cherrystudio/remote-protocol/agent";
3
+ //#region src/connection.d.ts
4
+ /**
5
+ * Options handed to every `WebSocket` dial (issue #126).
6
+ *
7
+ * FLAT `tls.connect` options — `ws` forwards its own option bag straight to
8
+ * `tls.connect`, so `{ rejectUnauthorized: false }` or `{ ca: <pem> }` belong
9
+ * at the top level rather than under a `tls:` key.
10
+ */
11
+ type WsDialOptions = {
12
+ rejectUnauthorized?: boolean;
13
+ ca?: string | Buffer | Array<string | Buffer>;
14
+ };
15
+ //#endregion
3
16
  //#region src/tools.d.ts
4
17
  /**
5
18
  * The plugin's tool face: the complete fourteen-tool `cherry_*` family — six
@@ -264,10 +277,24 @@ export interface CherryBridgeConfig {
264
277
  * (not a protocol value). Omitted uses {@link DEFAULT_PER_SESSION_CACHE_BYTES}.
265
278
  */
266
279
  perSessionCacheBytes?: number;
280
+ /**
281
+ * FLAT `tls.connect` options for every `wss` dial (issue #133): the operator's
282
+ * TLS trust for a desktop behind a private CA or a self-signed TLS front.
283
+ * `ws` forwards this bag straight to Node's TLS layer, so `{ ca: <pem> }` and
284
+ * `{ rejectUnauthorized: false }` belong at the TOP level — the `{ tls: {…} }`
285
+ * shape (`https`' wrapper) is not recognised by `ws` and is refused here.
286
+ * Applied to BOTH dial sites: the steady-state pool and pairing.
287
+ *
288
+ * NEVER persisted in the record, never logged, never reported: a `ca` is PEM
289
+ * CONTENT, and trust is a grant the operator makes, not a fact the desktop
290
+ * asserts about itself.
291
+ */
292
+ wsTls?: WsDialOptions;
267
293
  }
268
294
  /**
269
- * The two config values that reach constructor arguments, with their defaults
270
- * applied.
295
+ * The plugin-config values that reach constructor arguments, resolved once: the
296
+ * two numeric budgets with their defaults applied, and the validated TLS trust
297
+ * bag (see {@link dialOptions}).
271
298
  *
272
299
  * Resolved ONCE per `apply` and threaded explicitly, rather than re-read at each
273
300
  * construction site: a config surface that can change between two constructions
@@ -276,8 +303,9 @@ export interface CherryBridgeConfig {
276
303
  export interface ResolvedBridgeConfig {
277
304
  rateBudgetPerSecond: number;
278
305
  perSessionCacheBytes: number;
306
+ wsTls: WsDialOptions | undefined;
279
307
  }
280
- /** Applies the documented fallbacks to the plugin config's numeric keys. */
308
+ /** Applies the documented fallbacks and validates the plugin config's keys. */
281
309
  export declare function resolveBridgeConfig(config?: CherryBridgeConfig): ResolvedBridgeConfig;
282
310
  /** The context slice `apply` touches beyond the HTTP face's own services. */
283
311
  export interface CherryBridgeContext extends CherryHttpContext, CherryToolsContext {