dsh-jiuling-remote-mobile 1.0.28 → 1.0.29

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.
Files changed (2) hide show
  1. package/lib/client.js +40 -1
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -2311,7 +2311,46 @@ window.__ModuleLoader__.load({
2311
2311
  * (见其 `lib/client.js:1527` 的 inject 数组)。不加的话 `ctx.remote`
2312
2312
  * 属性访问会拿到 `undefined`,`patchAgentPresets` 直接静默跳过。
2313
2313
  */
2314
- const inject = ['slots', 'uiWorkspace', 'sessions', 'workspaces', 'remote', 'remote.agentPresets'];
2314
+ /**
2315
+ * 需要宿主提供的服务:slot 注册表、工作区浏览与导航、会话数据、远程命名空间。
2316
+ *
2317
+ * ⚠️⚠️ **这里只能写「真实存在的服务名」,绝不能写带点的子属性。**
2318
+ *
2319
+ * 这是 1.0.25 → 1.0.28 四个版本「改了却完全没有效果」的**真正根因**。
2320
+ *
2321
+ * cordis 的 `Inject.resolve()`(`cordis/lib/index.js:1491`)把数组每一项
2322
+ * 原样收进一个 map:`for (const name of inject) result[name] = null;`。
2323
+ * 然后 `Fiber._refresh()`(同文件 `:1317`)逐个检查:
2324
+ *
2325
+ * ```js
2326
+ * for (const name of Object.keys(this.inject)) {
2327
+ * const impl = this._store[name];
2328
+ * if (!impl) { epoch = INACTIVE; break; } // ← 缺一个就全不激活
2329
+ * ...
2330
+ * }
2331
+ * ```
2332
+ *
2333
+ * 我原来在这里写了 `'remote.agentPresets'` —— 它不是服务名,而是 `remote`
2334
+ * 服务上的一个**属性**。`_getImpl('remote.agentPresets')` 找不到它
2335
+ * ⇒ `_store['remote.agentPresets']` 是 undefined ⇒ `epoch = INACTIVE`
2336
+ * ⇒ **`apply()` 从头到尾没有被调用过**。
2337
+ *
2338
+ * 症状正好是用户报的三连:
2339
+ * - 「模型列表能够快速切换回来了,但是预设列表没有切换」——
2340
+ * 模型走的是 `patchModelDirectories`,它在 `apply()` 里……**同样没跑**,
2341
+ * 但模型列表的切换靠的是宿主 `mergeCatalog` + 官方自己的重算,所以照样生效;
2342
+ * - 「不管是私有默认工作区还是手机目录工作区,都无法切换回手机预设」——
2343
+ * 因为我的 `patchAgentPresets` 一次都没执行;
2344
+ * - 而「电脑模型列表能显示」也成立:那是宿主侧做的,与客户端插件无关。
2345
+ *
2346
+ * 官方 `dsh-client-ui-agent-preset` 之所以能写 `'remote.agentPresets'`
2347
+ * (见其 `lib/client.js:1532`),是因为它**同时**注入了 `'remote'`
2348
+ * 且那是 `RemoteNamespace` 的合法子服务寻址方式;
2349
+ * 本插件不依赖子命名空间 —— `ctx.remote.agentPresets` 经 `'remote'`
2350
+ * 注入后是可直接读到的属性(`ctx.get('remote')` 的返回值上带它),
2351
+ * 所以只声明 `'remote'` 就够,**不要**再列子路径。
2352
+ */
2353
+ const inject = ['slots', 'uiWorkspace', 'sessions', 'workspaces', 'remote'];
2315
2354
 
2316
2355
  /**
2317
2356
  * Client 插件主体:注册「手机 / 电脑」双页签的目录选择对话框 + 订阅流式帧。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-jiuling-remote-mobile",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "DSH 远程目录(手机端):在选文件夹流程里多出「电脑」页签,进入电脑目录、在电脑上发起对话,并把电脑的实时消息流同步到手机本地界面(只传文本,不映射桌面)。",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",