@musdrop/ds-harness-remote 0.6.9 → 0.6.11

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
@@ -1,3 +1,28 @@
1
+ > [!IMPORTANT]
2
+ > # 这是一个 fork,不是原版
3
+ >
4
+ > 本包 [`@musdrop/ds-harness-remote`](https://github.com/musdrop/ds-harness-remote) 是 [`liguobao/ds-harness-remote`](https://github.com/liguobao/ds-harness-remote)(原版 npm 包 `ds-harness-remote`)的 fork,在原有全部功能之上新增了**跨设备模型借出/借用**。
5
+ >
6
+ > **新增功能:模型共享**
7
+ >
8
+ > - **借出(Lend)**:把本机已配置的模型借给其它设备。请求由本机代发、使用本机自己的凭据——对方拿不到任何密钥,但每次调用消耗的是本机账号的额度。
9
+ > - **借用(Borrow)**:借用其它设备借出的模型。借到的模型出现在本机模型选择器中,以对方**设备名称**作为提供商名,其下列出具体模型。
10
+ > - **双向授权**:借出方按提供商/设备配置允许借出哪些模型;借用方按设备决定是否启用。只有两边都同意的模型才会出现在选择器里。
11
+ > - **端到端加密**:模型请求走 ds-harness-remote 既有的 Noise 加密 P2P/中继通道,凭据不出本机。
12
+ > - 配置入口:**设置 → 插件 → 本插件详情 → 「模型共享」区块**;也可用 CLI(`ds-harness-remote model-share show` 等),详见 [docs/model-sharing.md](https://github.com/musdrop/ds-harness-remote/blob/main/docs/model-sharing.md)。
13
+ >
14
+ > **⚠️ 与原版不能同时安装**
15
+ >
16
+ > 本包与原版 `ds-harness-remote` 使用**相同的插件 ID**(`com.r2049.ds-harness-remote`),同一个 DSH profile 里**只能装两者之一**——同时安装时插件管理器把二者视为同一插件,启用开关互相影响、无法各自独立启停。
17
+ >
18
+ > 也正因为同 ID,本包可以直接**替换**原版:卸载原版、安装本包后,原有 Remote 配置(服务器地址、已授权设备、登录状态等)全部无缝继承,无需重新配对。模型共享的借出/借用配置存在独立的 `model-share.json`,不占用原版配置字段。想恢复原版时反向操作即可。
19
+ >
20
+ > **安装本包**:先在插件管理里卸载原版 `ds-harness-remote`,再安装 `@musdrop/ds-harness-remote`,重启 DSH。
21
+ >
22
+ > 以下为原版 README。原有功能(远程工作区、会话接管、终端、文件上传下载、CodeX/ACP 等)在本包中全部可用。
23
+
24
+ ---
25
+
1
26
  # DeepSeek Harness Remote
2
27
 
3
28
  Continue DeepSeek Harness sessions and experimental Codex, Cursor, and Antigravity workspaces from another device over an end-to-end encrypted connection.
package/cordis.patch.yml CHANGED
@@ -2,7 +2,7 @@
2
2
  # is deferred to a later release, so no terminal-specific entry is inserted.
3
3
  - insert:
4
4
  - id: ds-harness-remote
5
- name: 'ds-harness-remote'
5
+ name: '@musdrop/ds-harness-remote'
6
6
  inject:
7
7
  - webServer
8
8
  config:
package/dist/client.js CHANGED
@@ -2190,7 +2190,32 @@ If a code was sent, recover the original submission without changing it.`,
2190
2190
  claudeVirtualWorkspace: "Claude virtual workspace",
2191
2191
  hermesVirtualWorkspace: "Hermes virtual workspace",
2192
2192
  kimiVirtualWorkspace: "Kimi virtual workspace",
2193
- codexVirtualSessions: "Sessions"
2193
+ codexVirtualSessions: "Sessions",
2194
+ modelSharing: "Model sharing",
2195
+ modelSharingHint: "Lend your models to other devices, or borrow models from them.",
2196
+ modelShareLending: "Lend models",
2197
+ modelShareLendingHint: "This device runs requests from others using its own credentials.",
2198
+ modelShareBorrowing: "Borrow models",
2199
+ modelShareBorrowingHint: "Borrowed models appear in your model picker.",
2200
+ modelShareEnableLending: "Allow lending models",
2201
+ modelShareNoGrants: "No models are lent yet.",
2202
+ modelShareNoSources: "No borrowing sources are configured yet.",
2203
+ modelShareAddGrant: "Add rule",
2204
+ modelShareRemove: "Remove",
2205
+ modelShareAllModels: "All models",
2206
+ modelShareAnyDevice: "Any device",
2207
+ modelShareProvider: "Provider",
2208
+ modelShareModels: "Models",
2209
+ modelShareDevice: "Device",
2210
+ modelShareMaxConcurrent: "Max concurrent requests",
2211
+ modelShareAllowlist: "Allowed devices",
2212
+ modelShareSaved: "Model sharing settings saved.",
2213
+ modelShareSelectProvider: "Select a provider",
2214
+ modelShareSelectModels: "Select models",
2215
+ modelShareBorrowFrom: "Borrow from",
2216
+ modelShareOffline: "offline",
2217
+ modelShareOnline: "online",
2218
+ modelShareNotLoaded: "Model sharing settings are unavailable."
2194
2219
  }, zh = {
2195
2220
  uploadTooLarge: "\u6587\u4EF6\u8D85\u8FC7\u5F53\u524D\u8FDE\u63A5\u7684\u5355\u6587\u4EF6\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\u3002",
2196
2221
  relayUploadTooLarge: "\u6587\u4EF6\u8D85\u8FC7\u5F53\u524D\u8FDE\u63A5\u7684\u5355\u6587\u4EF6\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\u3002Relay \u548C TURN \u4E0A\u4F20\u65F6\uFF0C\u666E\u901A\u7528\u6237\u6BCF\u4E2A\u6587\u4EF6\u6700\u591A 20 MiB\uFF0C\u652F\u6301\u4F1A\u5458\u989D\u5EA6\u7684\u8FDE\u63A5\u6700\u591A 100 MiB\u3002",
@@ -2603,7 +2628,32 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
2603
2628
  claudeVirtualWorkspace: "Claude \u5DE5\u4F5C\u533A",
2604
2629
  hermesVirtualWorkspace: "Hermes \u5DE5\u4F5C\u533A",
2605
2630
  kimiVirtualWorkspace: "Kimi \u5DE5\u4F5C\u533A",
2606
- codexVirtualSessions: "Sessions"
2631
+ codexVirtualSessions: "Sessions",
2632
+ modelSharing: "\u6A21\u578B\u5171\u4EAB",
2633
+ modelSharingHint: "\u628A\u672C\u673A\u6A21\u578B\u501F\u7ED9\u5176\u4ED6\u8BBE\u5907\uFF0C\u6216\u501F\u7528\u5176\u4ED6\u8BBE\u5907\u7684\u6A21\u578B\u3002",
2634
+ modelShareLending: "\u501F\u51FA\u6A21\u578B",
2635
+ modelShareLendingHint: "\u672C\u673A\u7528\u81EA\u8EAB\u7684\u767B\u5F55\u51ED\u636E\uFF0C\u4EE3\u66FF\u5176\u4ED6\u8BBE\u5907\u53D1\u8D77\u6A21\u578B\u8BF7\u6C42\u3002",
2636
+ modelShareBorrowing: "\u501F\u7528\u6A21\u578B",
2637
+ modelShareBorrowingHint: "\u501F\u5230\u7684\u6A21\u578B\u4F1A\u51FA\u73B0\u5728\u672C\u673A\u7684\u6A21\u578B\u9009\u62E9\u5668\u4E2D\u3002",
2638
+ modelShareEnableLending: "\u5141\u8BB8\u501F\u51FA\u6A21\u578B",
2639
+ modelShareNoGrants: "\u8FD8\u6CA1\u6709\u501F\u51FA\u4EFB\u4F55\u6A21\u578B\u3002",
2640
+ modelShareNoSources: "\u8FD8\u6CA1\u6709\u914D\u7F6E\u501F\u7528\u6765\u6E90\u3002",
2641
+ modelShareAddGrant: "\u6DFB\u52A0\u89C4\u5219",
2642
+ modelShareRemove: "\u5220\u9664",
2643
+ modelShareAllModels: "\u5168\u90E8\u6A21\u578B",
2644
+ modelShareAnyDevice: "\u4EFB\u610F\u8BBE\u5907",
2645
+ modelShareProvider: "\u63D0\u4F9B\u5546",
2646
+ modelShareModels: "\u6A21\u578B",
2647
+ modelShareDevice: "\u8BBE\u5907",
2648
+ modelShareMaxConcurrent: "\u6700\u5927\u5E76\u53D1\u6570",
2649
+ modelShareAllowlist: "\u5141\u8BB8\u7684\u8BBE\u5907",
2650
+ modelShareSaved: "\u6A21\u578B\u5171\u4EAB\u8BBE\u7F6E\u5DF2\u4FDD\u5B58\u3002",
2651
+ modelShareSelectProvider: "\u9009\u62E9\u63D0\u4F9B\u5546",
2652
+ modelShareSelectModels: "\u9009\u62E9\u6A21\u578B",
2653
+ modelShareBorrowFrom: "\u501F\u7528\u81EA",
2654
+ modelShareOffline: "\u79BB\u7EBF",
2655
+ modelShareOnline: "\u5728\u7EBF",
2656
+ modelShareNotLoaded: "\u6A21\u578B\u5171\u4EAB\u8BBE\u7F6E\u4E0D\u53EF\u7528\u3002"
2607
2657
  }, ru = {
2608
2658
  uploadTooLarge: "\u0424\u0430\u0439\u043B \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0435\u0442 \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u043B\u0438\u043C\u0438\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 ({size}).",
2609
2659
  relayUploadTooLarge: "\u0424\u0430\u0439\u043B \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0435\u0442 \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u043B\u0438\u043C\u0438\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 ({size}). \u0427\u0435\u0440\u0435\u0437 Relay \u0438 TURN \u043B\u0438\u043C\u0438\u0442 \u0441\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 20 \u041C\u0438\u0411 \u043D\u0430 \u0444\u0430\u0439\u043B \u0438\u043B\u0438 100 \u041C\u0438\u0411, \u0435\u0441\u043B\u0438 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043B\u0438\u043C\u0438\u0442 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0438.",
@@ -3016,7 +3066,32 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
3016
3066
  claudeVirtualWorkspace: "\u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0430\u044F \u0440\u0430\u0431\u043E\u0447\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C Claude",
3017
3067
  hermesVirtualWorkspace: "\u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0430\u044F \u0440\u0430\u0431\u043E\u0447\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C Hermes",
3018
3068
  kimiVirtualWorkspace: "\u0412\u0438\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0430\u044F \u0440\u0430\u0431\u043E\u0447\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C Kimi",
3019
- codexVirtualSessions: "\u0421\u0435\u0441\u0441\u0438\u0438"
3069
+ codexVirtualSessions: "\u0421\u0435\u0441\u0441\u0438\u0438",
3070
+ modelSharing: "\u041E\u0431\u043C\u0435\u043D \u043C\u043E\u0434\u0435\u043B\u044F\u043C\u0438",
3071
+ modelSharingHint: "\u041F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0439\u0442\u0435 \u043C\u043E\u0434\u0435\u043B\u0438 \u0434\u0440\u0443\u0433\u0438\u043C \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430\u043C \u0438\u043B\u0438 \u0437\u0430\u0438\u043C\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u043C\u043E\u0434\u0435\u043B\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432.",
3072
+ modelShareLending: "\u041F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043C\u043E\u0434\u0435\u043B\u0435\u0439",
3073
+ modelShareLendingHint: "\u042D\u0442\u043E \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442 \u0437\u0430\u043F\u0440\u043E\u0441\u044B \u043E\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u044F \u0441\u0432\u043E\u0438 \u0443\u0447\u0451\u0442\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435.",
3074
+ modelShareBorrowing: "\u0417\u0430\u0438\u043C\u0441\u0442\u0432\u043E\u0432\u0430\u043D\u0438\u0435 \u043C\u043E\u0434\u0435\u043B\u0435\u0439",
3075
+ modelShareBorrowingHint: "\u041C\u043E\u0434\u0435\u043B\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432 \u043F\u043E\u044F\u0432\u044F\u0442\u0441\u044F \u0432 \u0432\u0430\u0448\u0435\u043C \u0432\u044B\u0431\u043E\u0440\u0435 \u043C\u043E\u0434\u0435\u043B\u0435\u0439.",
3076
+ modelShareEnableLending: "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043C\u043E\u0434\u0435\u043B\u0435\u0439",
3077
+ modelShareNoGrants: "\u041C\u043E\u0434\u0435\u043B\u0438 \u0435\u0449\u0451 \u043D\u0435 \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D\u044B.",
3078
+ modelShareNoSources: "\u0417\u0430\u0438\u043C\u0441\u0442\u0432\u043E\u0432\u0430\u043D\u0438\u0435 \u0435\u0449\u0451 \u043D\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0435\u043D\u043E.",
3079
+ modelShareAddGrant: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u0440\u0430\u0432\u0438\u043B\u043E",
3080
+ modelShareRemove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
3081
+ modelShareAllModels: "\u0412\u0441\u0435 \u043C\u043E\u0434\u0435\u043B\u0438",
3082
+ modelShareAnyDevice: "\u041B\u044E\u0431\u043E\u0435 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E",
3083
+ modelShareProvider: "\u041F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440",
3084
+ modelShareModels: "\u041C\u043E\u0434\u0435\u043B\u0438",
3085
+ modelShareDevice: "\u0423\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E",
3086
+ modelShareMaxConcurrent: "\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0445 \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432",
3087
+ modelShareAllowlist: "\u0420\u0430\u0437\u0440\u0435\u0448\u0451\u043D\u043D\u044B\u0435 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430",
3088
+ modelShareSaved: "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043E\u0431\u043C\u0435\u043D\u0430 \u043C\u043E\u0434\u0435\u043B\u044F\u043C\u0438 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.",
3089
+ modelShareSelectProvider: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430",
3090
+ modelShareSelectModels: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043C\u043E\u0434\u0435\u043B\u0438",
3091
+ modelShareBorrowFrom: "\u0417\u0430\u0438\u043C\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0438\u0437",
3092
+ modelShareOffline: "\u043E\u0444\u043B\u0430\u0439\u043D",
3093
+ modelShareOnline: "\u043E\u043D\u043B\u0430\u0439\u043D",
3094
+ modelShareNotLoaded: "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043E\u0431\u043C\u0435\u043D\u0430 \u043C\u043E\u0434\u0435\u043B\u044F\u043C\u0438 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B."
3020
3095
  }, uk = {
3021
3096
  uploadTooLarge: "\u0424\u0430\u0439\u043B \u043F\u0435\u0440\u0435\u0432\u0438\u0449\u0443\u0454 \u043F\u043E\u0442\u043E\u0447\u043D\u0438\u0439 \u043B\u0456\u043C\u0456\u0442 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F ({size}).",
3022
3097
  relayUploadTooLarge: "\u0424\u0430\u0439\u043B \u043F\u0435\u0440\u0435\u0432\u0438\u0449\u0443\u0454 \u043F\u043E\u0442\u043E\u0447\u043D\u0438\u0439 \u043B\u0456\u043C\u0456\u0442 \u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F ({size}). \u0427\u0435\u0440\u0435\u0437 Relay \u0456 TURN \u043B\u0456\u043C\u0456\u0442 \u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C 20 \u041C\u0456\u0411 \u043D\u0430 \u0444\u0430\u0439\u043B \u0430\u0431\u043E 100 \u041C\u0456\u0411, \u044F\u043A\u0449\u043E \u0437\u2019\u0454\u0434\u043D\u0430\u043D\u043D\u044F \u043F\u0456\u0434\u0442\u0440\u0438\u043C\u0443\u0454 \u043B\u0456\u043C\u0456\u0442 \u043F\u0435\u0440\u0435\u0434\u043F\u043B\u0430\u0442\u0438.",
@@ -3429,7 +3504,32 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
3429
3504
  claudeVirtualWorkspace: "\u0412\u0456\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0438\u0439 \u0440\u043E\u0431\u043E\u0447\u0438\u0439 \u043F\u0440\u043E\u0441\u0442\u0456\u0440 Claude",
3430
3505
  hermesVirtualWorkspace: "\u0412\u0456\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0438\u0439 \u0440\u043E\u0431\u043E\u0447\u0438\u0439 \u043F\u0440\u043E\u0441\u0442\u0456\u0440 Hermes",
3431
3506
  kimiVirtualWorkspace: "\u0412\u0456\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0438\u0439 \u0440\u043E\u0431\u043E\u0447\u0438\u0439 \u043F\u0440\u043E\u0441\u0442\u0456\u0440 Kimi",
3432
- codexVirtualSessions: "\u0421\u0435\u0441\u0456\u0457"
3507
+ codexVirtualSessions: "\u0421\u0435\u0441\u0456\u0457",
3508
+ modelSharing: "\u041C\u043E\u0434\u0435\u043B\u044C\u043D\u0438\u0439 \u043E\u0431\u043C\u0456\u043D",
3509
+ modelSharingHint: "\u041D\u0430\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043C\u043E\u0434\u0435\u043B\u0456 \u0456\u043D\u0448\u0438\u043C \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u044F\u043C \u0430\u0431\u043E \u043F\u043E\u0437\u0438\u0447\u0430\u0439\u0442\u0435 \u043C\u043E\u0434\u0435\u043B\u0456 \u0437 \u0456\u043D\u0448\u0438\u0445 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457\u0432.",
3510
+ modelShareLending: "\u041D\u0430\u0434\u0430\u043D\u043D\u044F \u043C\u043E\u0434\u0435\u043B\u0435\u0439",
3511
+ modelShareLendingHint: "\u0426\u0435\u0439 \u043F\u0440\u0438\u0441\u0442\u0440\u0456\u0439 \u0432\u0438\u043A\u043E\u043D\u0443\u0454 \u0437\u0430\u043F\u0438\u0442\u0438 \u0432\u0456\u0434 \u0456\u043D\u0448\u0438\u0445 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457\u0432, \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u044E\u0447\u0438 \u0432\u043B\u0430\u0441\u043D\u0456 \u043E\u0431\u043B\u0456\u043A\u043E\u0432\u0456 \u0434\u0430\u043D\u0456.",
3512
+ modelShareBorrowing: "\u041F\u043E\u0437\u0438\u0447\u0430\u043D\u043D\u044F \u043C\u043E\u0434\u0435\u043B\u0435\u0439",
3513
+ modelShareBorrowingHint: "\u041C\u043E\u0434\u0435\u043B\u0456 \u0437 \u0456\u043D\u0448\u0438\u0445 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457\u0432 \u0437\u2019\u044F\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0443 \u0432\u0430\u0448\u043E\u043C\u0443 \u0432\u0438\u0431\u043E\u0440\u0456 \u043C\u043E\u0434\u0435\u043B\u0435\u0439.",
3514
+ modelShareEnableLending: "\u0414\u043E\u0437\u0432\u043E\u043B\u0438\u0442\u0438 \u043D\u0430\u0434\u0430\u043D\u043D\u044F \u043C\u043E\u0434\u0435\u043B\u0435\u0439",
3515
+ modelShareNoGrants: "\u041C\u043E\u0434\u0435\u043B\u0456 \u0449\u0435 \u043D\u0435 \u043D\u0430\u0434\u0430\u043D\u0456.",
3516
+ modelShareNoSources: "\u041F\u043E\u0437\u0438\u0447\u0430\u043D\u043D\u044F \u0449\u0435 \u043D\u0435 \u043D\u0430\u043B\u0430\u0448\u0442\u043E\u0432\u0430\u043D\u043E.",
3517
+ modelShareAddGrant: "\u0414\u043E\u0434\u0430\u0442\u0438 \u043F\u0440\u0430\u0432\u0438\u043B\u043E",
3518
+ modelShareRemove: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
3519
+ modelShareAllModels: "\u0423\u0441\u0456 \u043C\u043E\u0434\u0435\u043B\u0456",
3520
+ modelShareAnyDevice: "\u0411\u0443\u0434\u044C-\u044F\u043A\u0438\u0439 \u043F\u0440\u0438\u0441\u0442\u0440\u0456\u0439",
3521
+ modelShareProvider: "\u041F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440",
3522
+ modelShareModels: "\u041C\u043E\u0434\u0435\u043B\u0456",
3523
+ modelShareDevice: "\u041F\u0440\u0438\u0441\u0442\u0440\u0456\u0439",
3524
+ modelShareMaxConcurrent: "\u041C\u0430\u043A\u0441\u0438\u043C\u0443\u043C \u043E\u0434\u043D\u043E\u0447\u0430\u0441\u043D\u0438\u0445 \u0437\u0430\u043F\u0438\u0442\u0456\u0432",
3525
+ modelShareAllowlist: "\u0414\u043E\u0437\u0432\u043E\u043B\u0435\u043D\u0456 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457",
3526
+ modelShareSaved: "\u041D\u0430\u043B\u0430\u0448\u0442\u0443\u0432\u0430\u043D\u043D\u044F \u043C\u043E\u0434\u0435\u043B\u044C\u043E\u0432\u043E\u0433\u043E \u043E\u0431\u043C\u0456\u043D\u0443 \u0437\u0431\u0435\u0440\u0435\u0436\u0435\u043D\u043E.",
3527
+ modelShareSelectProvider: "\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430",
3528
+ modelShareSelectModels: "\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043C\u043E\u0434\u0435\u043B\u0456",
3529
+ modelShareBorrowFrom: "\u041F\u043E\u0437\u0438\u0447\u0430\u0442\u0438 \u0437",
3530
+ modelShareOffline: "\u043E\u0444\u043B\u0430\u0439\u043D",
3531
+ modelShareOnline: "\u043E\u043D\u043B\u0430\u0439\u043D",
3532
+ modelShareNotLoaded: "\u041D\u0430\u043B\u0430\u0448\u0442\u0443\u0432\u0430\u043D\u043D\u044F \u043C\u043E\u0434\u0435\u043B\u044C\u043E\u0432\u043E\u0433\u043E \u043E\u0431\u043C\u0456\u043D\u0443 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0456."
3433
3533
  };
3434
3534
 
3435
3535
  // packages/plugin/src/client/header.ts
@@ -4217,6 +4317,362 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
4217
4317
  };
4218
4318
  }
4219
4319
 
4320
+ // packages/plugin/src/client/model-sharing.ts
4321
+ init_page_globals();
4322
+ function Chevron(React) {
4323
+ return React.createElement("svg", {
4324
+ width: 12,
4325
+ height: 12,
4326
+ viewBox: "0 0 16 16",
4327
+ "aria-hidden": !0,
4328
+ className: "dshRemoteAcpChevron"
4329
+ }, React.createElement("path", {
4330
+ d: "M4 6l4 4 4-4",
4331
+ fill: "none",
4332
+ stroke: "currentColor",
4333
+ strokeWidth: 1.75,
4334
+ strokeLinecap: "round",
4335
+ strokeLinejoin: "round"
4336
+ }));
4337
+ }
4338
+ function createModelSharingSection(React) {
4339
+ return function(props) {
4340
+ let { control, t, available = !0 } = props, [view, setView] = React.useState(void 0), [busy, setBusy] = React.useState(!1), [error, setError] = React.useState(void 0), [notice, setNotice] = React.useState(void 0), [grantDevice, setGrantDevice] = React.useState(""), [grantProvider, setGrantProvider] = React.useState(""), [grantModels, setGrantModels] = React.useState(""), [concurrencyDraft, setConcurrencyDraft] = React.useState(void 0), viewRef = React.useRef(void 0), queueRef = React.useRef(Promise.resolve()), busyRef = React.useRef(!1), applyView = (next) => {
4341
+ viewRef.current = next, setView(next), setConcurrencyDraft(void 0);
4342
+ }, load = React.useCallback(async () => {
4343
+ setError(void 0);
4344
+ try {
4345
+ applyView(await control("modelshare.get"));
4346
+ } catch (reason) {
4347
+ setError(messageOf(reason, t));
4348
+ }
4349
+ }, [control]);
4350
+ React.useEffect(() => {
4351
+ load();
4352
+ }, [load]);
4353
+ let enqueue = React.useCallback((mutate) => {
4354
+ let current = viewRef.current;
4355
+ current === void 0 || !current.writable || !available || (busyRef.current = !0, setBusy(!0), setNotice(void 0), queueRef.current = queueRef.current.then(async () => {
4356
+ try {
4357
+ let next = mutate(viewRef.current?.store ?? current.store), result = await control("modelshare.set", next);
4358
+ applyView(result), setNotice(t("modelShareSaved"));
4359
+ } catch (reason) {
4360
+ setError(messageOf(reason, t));
4361
+ }
4362
+ }), queueRef.current.finally(() => {
4363
+ busyRef.current = !1, setBusy(!1);
4364
+ }));
4365
+ }, [available, control, t]), patchHost = (changes) => {
4366
+ enqueue((current) => ({ ...current, host: { ...current.host, ...changes } }));
4367
+ }, patchSources = (sources) => {
4368
+ enqueue((current) => ({ ...current, borrower: { ...current.borrower, sources } }));
4369
+ }, toggleAllowedDevice = (deviceId) => {
4370
+ if (view === void 0) return;
4371
+ let current = view.store.host.allowedDevices, next = current.includes(deviceId) ? current.filter((id) => id !== deviceId) : [...current, deviceId];
4372
+ patchHost({ allowedDevices: next });
4373
+ }, addGrant = () => {
4374
+ if (view === void 0 || grantProvider.trim() === "") return;
4375
+ let provider = grantProvider.trim(), models = grantModels.split(",").map((item) => item.trim()).filter((item) => item !== ""), grants = [
4376
+ ...view.store.host.grants.filter((item) => !(item.provider === provider && item.deviceId === (grantDevice.trim() || void 0))),
4377
+ {
4378
+ ...grantDevice.trim() === "" ? {} : { deviceId: grantDevice.trim() },
4379
+ provider,
4380
+ models
4381
+ }
4382
+ ];
4383
+ patchHost({ grants }), setGrantDevice(""), setGrantProvider(""), setGrantModels("");
4384
+ }, removeGrant = (index) => {
4385
+ view !== void 0 && patchHost({ grants: view.store.host.grants.filter((_, i) => i !== index) });
4386
+ }, toggleSource = (deviceId, hostName) => {
4387
+ if (view === void 0) return;
4388
+ let sources = { ...view.store.borrower.sources }, current = sources[deviceId];
4389
+ sources[deviceId] = {
4390
+ enabled: !(current?.enabled ?? !1),
4391
+ models: current?.models ?? [],
4392
+ hostName: current?.hostName ?? hostName
4393
+ }, patchSources(sources);
4394
+ }, label = (device) => `${device.name}${device.online ? ` \xB7 ${t("modelShareOnline")}` : device.known ? ` \xB7 ${t("modelShareOffline")}` : ""}`;
4395
+ if (view === void 0)
4396
+ return React.createElement(
4397
+ "div",
4398
+ { className: "dshRemoteAuthorizationSetting dshRemoteModelShareSetting" },
4399
+ React.createElement(
4400
+ "div",
4401
+ null,
4402
+ React.createElement("strong", null, t("modelSharing")),
4403
+ React.createElement("p", null, error ?? t("modelShareNotLoaded"))
4404
+ )
4405
+ );
4406
+ let { host, borrower } = view.store, disabled = busy || !view.writable || !available, lendingRows = React.createElement(
4407
+ "div",
4408
+ { className: "dshRemoteAcpList" },
4409
+ React.createElement(
4410
+ "div",
4411
+ { className: "dshRemoteAcpRow" },
4412
+ React.createElement(
4413
+ "div",
4414
+ { className: "dshRemoteAcpRowMain" },
4415
+ React.createElement(
4416
+ "div",
4417
+ { className: "dshRemoteAcpRowInfo" },
4418
+ React.createElement("strong", { className: "dshRemoteAcpName" }, t("modelShareEnableLending")),
4419
+ React.createElement("p", null, t("modelShareLendingHint"))
4420
+ ),
4421
+ React.createElement("input", {
4422
+ type: "checkbox",
4423
+ role: "switch",
4424
+ className: "dshRemoteSwitch",
4425
+ checked: host.enabled,
4426
+ "aria-checked": host.enabled,
4427
+ disabled,
4428
+ "aria-label": t("modelShareEnableLending"),
4429
+ onChange: (event) => patchHost({ enabled: event.target.checked })
4430
+ })
4431
+ )
4432
+ ),
4433
+ React.createElement(
4434
+ "div",
4435
+ { className: "dshRemoteAcpRow" },
4436
+ React.createElement(
4437
+ "div",
4438
+ { className: "dshRemoteAcpRowMain" },
4439
+ React.createElement(
4440
+ "div",
4441
+ { className: "dshRemoteAcpRowInfo" },
4442
+ React.createElement("strong", { className: "dshRemoteAcpName" }, t("modelShareMaxConcurrent"))
4443
+ ),
4444
+ React.createElement(
4445
+ "div",
4446
+ { className: "dshRemoteAcpRowActions" },
4447
+ React.createElement("input", {
4448
+ type: "number",
4449
+ min: 1,
4450
+ max: 16,
4451
+ // Local draft so typing does not persist every keystroke.
4452
+ value: concurrencyDraft ?? String(host.maxConcurrent),
4453
+ disabled,
4454
+ "aria-label": t("modelShareMaxConcurrent"),
4455
+ onChange: (event) => setConcurrencyDraft(event.target.value),
4456
+ onBlur: (event) => {
4457
+ let raw = Number(event.target.value), clamped = Math.min(16, Math.max(1, Number.isFinite(raw) ? Math.trunc(raw) : 1));
4458
+ setConcurrencyDraft(void 0), clamped !== host.maxConcurrent && patchHost({ maxConcurrent: clamped });
4459
+ }
4460
+ })
4461
+ )
4462
+ )
4463
+ ),
4464
+ ...view.peers.map((device) => React.createElement(
4465
+ "div",
4466
+ {
4467
+ key: `allow-${device.deviceId}`,
4468
+ className: "dshRemoteAcpRow"
4469
+ },
4470
+ React.createElement(
4471
+ "div",
4472
+ { className: "dshRemoteAcpRowMain" },
4473
+ React.createElement(
4474
+ "div",
4475
+ { className: "dshRemoteAcpRowInfo" },
4476
+ React.createElement("strong", { className: "dshRemoteAcpName" }, label(device))
4477
+ ),
4478
+ React.createElement("input", {
4479
+ type: "checkbox",
4480
+ role: "switch",
4481
+ className: "dshRemoteSwitch",
4482
+ checked: host.allowedDevices.includes(device.deviceId),
4483
+ "aria-checked": host.allowedDevices.includes(device.deviceId),
4484
+ disabled,
4485
+ "aria-label": `${t("modelShareAllowlist")}: ${label(device)}`,
4486
+ onChange: () => toggleAllowedDevice(device.deviceId)
4487
+ })
4488
+ )
4489
+ )),
4490
+ ...host.grants.map((grant, index) => React.createElement(
4491
+ "div",
4492
+ {
4493
+ key: `grant-${index}`,
4494
+ className: "dshRemoteAcpRow"
4495
+ },
4496
+ React.createElement(
4497
+ "div",
4498
+ { className: "dshRemoteAcpRowMain" },
4499
+ React.createElement(
4500
+ "div",
4501
+ { className: "dshRemoteAcpRowInfo" },
4502
+ React.createElement(
4503
+ "strong",
4504
+ { className: "dshRemoteAcpName" },
4505
+ `${grant.provider} \xB7 ${grant.models.length === 0 ? t("modelShareAllModels") : grant.models.join(", ")}`
4506
+ ),
4507
+ React.createElement("p", null, grant.deviceId ?? t("modelShareAnyDevice"))
4508
+ ),
4509
+ React.createElement(
4510
+ "div",
4511
+ { className: "dshRemoteAcpRowActions" },
4512
+ React.createElement("button", {
4513
+ type: "button",
4514
+ className: "dshRemoteAcpRemoveBtn",
4515
+ disabled,
4516
+ "aria-label": t("modelShareRemove"),
4517
+ onClick: () => removeGrant(index)
4518
+ }, t("modelShareRemove"))
4519
+ )
4520
+ )
4521
+ )),
4522
+ host.grants.length === 0 ? React.createElement("p", { className: "dshRemoteAcpDiag" }, t("modelShareNoGrants")) : null,
4523
+ React.createElement(
4524
+ "div",
4525
+ { className: "dshRemoteAcpAddForm" },
4526
+ React.createElement(
4527
+ "div",
4528
+ { className: "dshRemoteAcpAddInputs" },
4529
+ React.createElement(
4530
+ "select",
4531
+ {
4532
+ value: grantProvider,
4533
+ disabled,
4534
+ "aria-label": t("modelShareProvider"),
4535
+ onChange: (event) => setGrantProvider(event.target.value)
4536
+ },
4537
+ React.createElement("option", { value: "" }, t("modelShareSelectProvider")),
4538
+ ...view.localProviders.map((provider) => React.createElement("option", {
4539
+ key: provider.id,
4540
+ value: provider.id
4541
+ }, provider.name ?? provider.id))
4542
+ ),
4543
+ React.createElement("input", {
4544
+ type: "text",
4545
+ value: grantModels,
4546
+ disabled,
4547
+ placeholder: t("modelShareSelectModels"),
4548
+ "aria-label": t("modelShareModels"),
4549
+ onChange: (event) => setGrantModels(event.target.value)
4550
+ }),
4551
+ React.createElement("button", {
4552
+ type: "button",
4553
+ className: "dshRemoteAcpAddTrigger",
4554
+ disabled: disabled || grantProvider === "",
4555
+ onClick: addGrant
4556
+ }, t("modelShareAddGrant"))
4557
+ ),
4558
+ React.createElement(
4559
+ "p",
4560
+ { className: "dshRemoteAcpDiag" },
4561
+ `${t("modelShareDevice")}: `,
4562
+ React.createElement(
4563
+ "select",
4564
+ {
4565
+ value: grantDevice,
4566
+ disabled,
4567
+ "aria-label": t("modelShareDevice"),
4568
+ onChange: (event) => setGrantDevice(event.target.value)
4569
+ },
4570
+ React.createElement("option", { value: "" }, t("modelShareAnyDevice")),
4571
+ ...view.peers.map((device) => React.createElement("option", {
4572
+ key: device.deviceId,
4573
+ value: device.deviceId
4574
+ }, label(device)))
4575
+ )
4576
+ )
4577
+ )
4578
+ ), borrowingRows = React.createElement(
4579
+ "div",
4580
+ { className: "dshRemoteAcpList" },
4581
+ ...view.peers.map((device) => {
4582
+ let source = borrower.sources[device.deviceId];
4583
+ return React.createElement(
4584
+ "div",
4585
+ {
4586
+ key: `borrow-${device.deviceId}`,
4587
+ className: "dshRemoteAcpRow"
4588
+ },
4589
+ React.createElement(
4590
+ "div",
4591
+ { className: "dshRemoteAcpRowMain" },
4592
+ React.createElement(
4593
+ "div",
4594
+ { className: "dshRemoteAcpRowInfo" },
4595
+ React.createElement("strong", { className: "dshRemoteAcpName" }, label(device)),
4596
+ React.createElement(
4597
+ "p",
4598
+ null,
4599
+ `${t("modelShareBorrowFrom")} ${device.name} \xB7 ${source?.models.length === 0 || source === void 0 ? t("modelShareAllModels") : source.models.join(", ")}`
4600
+ )
4601
+ ),
4602
+ React.createElement("input", {
4603
+ type: "checkbox",
4604
+ role: "switch",
4605
+ className: "dshRemoteSwitch",
4606
+ checked: source?.enabled ?? !1,
4607
+ "aria-checked": source?.enabled ?? !1,
4608
+ disabled,
4609
+ "aria-label": `${t("modelShareBorrowFrom")}: ${label(device)}`,
4610
+ onChange: () => toggleSource(device.deviceId, device.name)
4611
+ })
4612
+ )
4613
+ );
4614
+ }),
4615
+ Object.keys(borrower.sources).length === 0 ? React.createElement("p", { className: "dshRemoteAcpDiag" }, t("modelShareNoSources")) : null
4616
+ );
4617
+ return React.createElement(
4618
+ "div",
4619
+ { className: "dshRemoteModelShareSections" },
4620
+ React.createElement(
4621
+ "details",
4622
+ { className: "dshRemoteAuthorizationSetting dshRemoteAcpSetting" },
4623
+ React.createElement(
4624
+ "summary",
4625
+ null,
4626
+ React.createElement(
4627
+ "div",
4628
+ { className: "dshRemoteAcpSummaryText" },
4629
+ React.createElement("strong", null, t("modelShareLending")),
4630
+ React.createElement("p", null, t("modelSharingHint"))
4631
+ ),
4632
+ React.createElement(
4633
+ "span",
4634
+ { className: "dshRemoteAcpSummaryMeta" },
4635
+ React.createElement("span", { className: "dshRemoteAcpCountText" }, String(host.grants.length)),
4636
+ Chevron(React)
4637
+ )
4638
+ ),
4639
+ lendingRows
4640
+ ),
4641
+ React.createElement(
4642
+ "details",
4643
+ { className: "dshRemoteAuthorizationSetting dshRemoteAcpSetting" },
4644
+ React.createElement(
4645
+ "summary",
4646
+ null,
4647
+ React.createElement(
4648
+ "div",
4649
+ { className: "dshRemoteAcpSummaryText" },
4650
+ React.createElement("strong", null, t("modelShareBorrowing")),
4651
+ React.createElement("p", null, t("modelShareBorrowingHint"))
4652
+ ),
4653
+ React.createElement(
4654
+ "span",
4655
+ { className: "dshRemoteAcpSummaryMeta" },
4656
+ React.createElement(
4657
+ "span",
4658
+ { className: "dshRemoteAcpCountText" },
4659
+ String(Object.values(borrower.sources).filter((source) => source.enabled).length)
4660
+ ),
4661
+ Chevron(React)
4662
+ )
4663
+ ),
4664
+ borrowingRows
4665
+ ),
4666
+ error !== void 0 ? React.createElement("p", { className: "dshRemoteError", role: "alert" }, error) : null,
4667
+ notice !== void 0 ? React.createElement("p", {
4668
+ className: "dshRemoteNotice",
4669
+ role: "status",
4670
+ "aria-live": "polite"
4671
+ }, notice) : null
4672
+ );
4673
+ };
4674
+ }
4675
+
4220
4676
  // packages/plugin/src/client/settings.ts
4221
4677
  var import_qrcode2 = __toESM(require_browser(), 1);
4222
4678
  var sidebarEntryChoices = [
@@ -4233,7 +4689,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
4233
4689
  kimi: "Kimi"
4234
4690
  }, BUILTIN_ACP_SCAN_ONLY = /* @__PURE__ */ new Set(["cursor", "antigravity", "hermes", "kimi"]);
4235
4691
  function createRemotePluginOptions(React) {
4236
- let ServerNotice = createServerNotice(React), HostPairingPanel = createHostPairingPanel(React);
4692
+ let ServerNotice = createServerNotice(React), HostPairingPanel = createHostPairingPanel(React), ModelSharingSection = createModelSharingSection(React);
4237
4693
  function RemotePluginOptions(props) {
4238
4694
  let { t } = props, subscribeStatus = typeof props.statusFeed?.subscribe == "function" ? props.statusFeed.subscribe : () => () => {
4239
4695
  }, getStatusSnapshot = typeof props.statusFeed?.getSnapshot == "function" ? props.statusFeed.getSnapshot : () => {
@@ -5341,6 +5797,12 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
5341
5797
  sidebarEntrySetting,
5342
5798
  resetIdentitySetting,
5343
5799
  acpSetting,
5800
+ // [model-sharing] 专用的模型借出/借用配置区块。
5801
+ React.createElement(ModelSharingSection, {
5802
+ control: props.control,
5803
+ t,
5804
+ available: writable
5805
+ }),
5344
5806
  React.createElement(
5345
5807
  "div",
5346
5808
  { className: "dshRemoteAuthorizationSetting" },
@@ -5432,6 +5894,12 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
5432
5894
  sidebarEntrySetting,
5433
5895
  resetIdentitySetting,
5434
5896
  acpSetting,
5897
+ // [model-sharing] 专用的模型借出/借用配置区块。
5898
+ React.createElement(ModelSharingSection, {
5899
+ control: props.control,
5900
+ t,
5901
+ available: writable
5902
+ }),
5435
5903
  React.createElement(
5436
5904
  "div",
5437
5905
  { className: "dshRemoteSettingsSignIn" },
@@ -5545,6 +6013,9 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
5545
6013
  ".dshRemoteAcpList{display:flex;flex-direction:column;margin-top:10px;padding-left:16px;border-top:1px solid var(--dsw-alias-border-l3)}.dshRemoteAcpRow{display:flex;flex-direction:column;gap:4px;padding:10px 0}.dshRemoteAcpRow+.dshRemoteAcpRow{border-top:1px solid var(--dsw-alias-border-l3)}.dshRemoteAcpRowMain{display:grid;grid-template-columns:minmax(0,1fr) auto 38px;align-items:center;column-gap:16px;min-width:0}.dshRemoteAcpRowInfo{display:flex;align-items:center;gap:12px;min-width:0}.dshRemoteAcpName{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;line-height:1.45;color:var(--dsw-alias-label-primary)}",
5546
6014
  '.dshRemoteAcpStatus{display:inline-flex;align-items:center;gap:6px;min-width:0;font-size:12px;font-weight:400;line-height:1.45;color:var(--dsw-alias-label-tertiary);white-space:nowrap}.dshRemoteAcpStatus::before{content:"";width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-label-dimmed);flex:0 0 auto}.dshRemoteAcpStatus.isPassed{color:var(--dsw-alias-label-secondary)}.dshRemoteAcpStatus.isPassed::before{background:var(--dsw-alias-state-success-primary)}.dshRemoteAcpStatus.isFailed{color:var(--dsw-alias-state-danger-primary)}.dshRemoteAcpStatus.isFailed::before{background:var(--dsw-alias-state-danger-primary)}.dshRemoteAcpStatus.isChecking{color:var(--dsw-alias-label-secondary)}.dshRemoteAcpStatus.isChecking::before{background:var(--dsw-alias-brand-primary)}',
5547
6015
  ".dshRemoteAcpRowActions{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;justify-self:end}.dshRemoteAcpActionBtn,.dshRemoteAcpRemoveBtn,.dshRemoteAcpAddTrigger{appearance:none;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:5px;height:28px;padding:0 8px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;font-weight:500;line-height:1;white-space:nowrap;cursor:pointer;transition:color .14s,background .14s}.dshRemoteAcpActionBtn:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteAcpActionBtn.isConfigure{color:var(--dsw-alias-brand-primary)}.dshRemoteAcpActionBtn.isConfigure:hover:not(:disabled){color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 10%,transparent)}.dshRemoteAcpActionBtn:disabled,.dshRemoteAcpRemoveBtn:disabled,.dshRemoteAcpAddTrigger:disabled{opacity:.45;cursor:default}.dshRemoteAcpRemoveBtn{color:var(--dsw-alias-label-tertiary)}.dshRemoteAcpRemoveBtn:hover:not(:disabled){color:var(--dsw-alias-state-danger-primary);background:color-mix(in srgb,var(--dsw-alias-state-danger-primary) 10%,transparent)}",
6016
+ // [model-sharing] The model-share section reuses the ACP row classes; these two
6017
+ // selectors only add the select / number controls it introduces.
6018
+ ".dshRemoteAcpAddInputs select,.dshRemoteAcpRowActions input[type=number]{box-sizing:border-box;min-width:0;height:32px;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);padding:0 10px;font:inherit;font-size:12px}.dshRemoteAcpAddInputs select:focus-visible,.dshRemoteAcpRowActions input[type=number]:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.dshRemoteAcpRowActions input[type=number]{width:72px;text-align:center}",
5548
6019
  ".dshRemoteAcpDiag{margin:0;font-size:12px;line-height:1.45;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.dshRemoteAcpAddTrigger{margin-top:6px;margin-left:8px;align-self:flex-start;color:var(--dsw-alias-label-tertiary)}.dshRemoteAcpAddTrigger:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteAcpAddForm{margin-top:8px;padding:12px 0 2px 16px;border-top:1px solid var(--dsw-alias-border-l3)}.dshRemoteAcpAddInputs{display:grid;grid-template-columns:minmax(90px,.85fr) minmax(130px,1.15fr) minmax(90px,.9fr) auto auto;gap:8px;align-items:center}.dshRemoteAcpAddInputs input{box-sizing:border-box;width:100%;min-width:0;height:32px;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);padding:0 10px;font:inherit;font-size:12px}.dshRemoteAcpAddInputs input:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}.dshRemoteAcpAddInputs button{box-sizing:border-box;height:32px;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-primary);padding:0 12px;cursor:pointer;font:inherit;font-size:12px;font-weight:500;white-space:nowrap;transition:border-color .15s,background .15s}.dshRemoteAcpAddInputs button.isGhost{border-color:transparent;color:var(--dsw-alias-label-tertiary)}.dshRemoteAcpAddInputs button:hover:not(:disabled){border-color:var(--dsw-alias-label-dimmed);background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteAcpAddInputs button.isGhost:hover:not(:disabled){border-color:transparent;color:var(--dsw-alias-label-primary)}.dshRemoteAcpAddInputs button:disabled{opacity:.45;cursor:default}@media(prefers-reduced-motion:reduce){.dshRemoteAcpChevron{transition:none}}",
5549
6020
  ".dshRemoteCancelWorkspace{min-height:36px;border:0;background:transparent;color:var(--dsw-alias-label-secondary);padding:6px 0;cursor:pointer}.dshRemoteCancelWorkspace:hover:not(:disabled){color:var(--dsw-alias-label-primary);text-decoration:underline}.dshRemoteCancelWorkspace:disabled{opacity:.5;cursor:default}",
5550
6021
  ".dshRemoteHostLoading{display:flex;align-items:center;justify-content:center;gap:8px;position:absolute;left:50%;transform:translateX(-50%);white-space:nowrap;color:var(--dsw-alias-label-secondary)}",
package/dist/index.js CHANGED
@@ -75383,7 +75383,7 @@ function parseIpv6(value) {
75383
75383
  }
75384
75384
 
75385
75385
  // packages/plugin/src/version.ts
75386
- var PLUGIN_VERSION = "0.6.9";
75386
+ var PLUGIN_VERSION = "0.6.11";
75387
75387
 
75388
75388
  // packages/plugin/src/server-api.ts
75389
75389
  var TERMINAL_CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/u;
@@ -113908,9 +113908,152 @@ async function installOrConfigureBackend(backendId2, options = {}) {
113908
113908
  throw new Error(`Installation of ${spec.name} completed but executable could not be verified.`);
113909
113909
  }
113910
113910
 
113911
+ // packages/plugin/src/model-share/settings-store.ts
113912
+ import { watch as watch2 } from "node:fs";
113913
+ import { mkdir as mkdir5, readFile as readFile6, rename as rename4, writeFile as writeFile4 } from "node:fs/promises";
113914
+ import { dirname as dirname9, join as join17 } from "node:path";
113915
+ var DEFAULT_STORE = {
113916
+ version: 1,
113917
+ host: {
113918
+ enabled: false,
113919
+ allowedDevices: [],
113920
+ grants: [],
113921
+ maxConcurrent: 2
113922
+ },
113923
+ borrower: {
113924
+ sources: {}
113925
+ }
113926
+ };
113927
+ function normalizeStore2(input4) {
113928
+ const raw = typeof input4 === "object" && input4 !== null ? input4 : {};
113929
+ const hostRaw = typeof raw.host === "object" && raw.host !== null ? raw.host : {};
113930
+ const borrowerRaw = typeof raw.borrower === "object" && raw.borrower !== null ? raw.borrower : {};
113931
+ const grants = Array.isArray(hostRaw.grants) ? hostRaw.grants.flatMap((entry) => {
113932
+ if (typeof entry !== "object" || entry === null) return [];
113933
+ const grant = entry;
113934
+ const provider = typeof grant.provider === "string" ? grant.provider.trim() : "";
113935
+ if (provider === "") return [];
113936
+ return [{
113937
+ ...typeof grant.deviceId === "string" && grant.deviceId.trim() !== "" ? { deviceId: grant.deviceId.trim() } : {},
113938
+ provider,
113939
+ models: Array.isArray(grant.models) ? grant.models.filter((model) => typeof model === "string" && model.trim() !== "").map((model) => model.trim()) : []
113940
+ }];
113941
+ }) : [];
113942
+ const sourcesRaw = typeof borrowerRaw.sources === "object" && borrowerRaw.sources !== null ? borrowerRaw.sources : {};
113943
+ const sources = {};
113944
+ for (const [deviceId, value] of Object.entries(sourcesRaw)) {
113945
+ if (deviceId.trim() === "" || typeof value !== "object" || value === null) continue;
113946
+ const source = value;
113947
+ sources[deviceId] = {
113948
+ enabled: source.enabled === true,
113949
+ models: Array.isArray(source.models) ? source.models.filter((model) => typeof model === "string" && model.trim() !== "").map((model) => model.trim()) : [],
113950
+ ...typeof source.hostName === "string" && source.hostName.trim() !== "" ? { hostName: source.hostName.trim() } : {}
113951
+ };
113952
+ }
113953
+ const maxConcurrentRaw = typeof hostRaw.maxConcurrent === "number" ? Math.trunc(hostRaw.maxConcurrent) : DEFAULT_STORE.host.maxConcurrent;
113954
+ return {
113955
+ version: 1,
113956
+ host: {
113957
+ enabled: hostRaw.enabled === true,
113958
+ allowedDevices: Array.isArray(hostRaw.allowedDevices) ? hostRaw.allowedDevices.filter((id7) => typeof id7 === "string" && id7.trim() !== "").map((id7) => id7.trim()) : [],
113959
+ grants,
113960
+ maxConcurrent: Number.isFinite(maxConcurrentRaw) ? Math.min(Math.max(maxConcurrentRaw, 1), 16) : DEFAULT_STORE.host.maxConcurrent
113961
+ },
113962
+ borrower: { sources }
113963
+ };
113964
+ }
113965
+ var ModelShareStoreFile = class {
113966
+ constructor(directory, fileName = "model-share.json") {
113967
+ this.directory = directory;
113968
+ this.fileName = fileName;
113969
+ }
113970
+ cache;
113971
+ writing = Promise.resolve();
113972
+ /** Active directory watcher, if `watch()` was called. */
113973
+ watcher;
113974
+ get path() {
113975
+ return join17(this.directory, this.fileName);
113976
+ }
113977
+ async read() {
113978
+ if (this.cache !== void 0) return this.cache;
113979
+ try {
113980
+ const text = await readFile6(this.path, "utf8");
113981
+ this.cache = normalizeStore2(JSON.parse(text));
113982
+ } catch {
113983
+ this.cache = normalizeStore2(void 0);
113984
+ }
113985
+ return this.cache;
113986
+ }
113987
+ async write(next) {
113988
+ const normalized = normalizeStore2(next);
113989
+ this.cache = normalized;
113990
+ const path = this.path;
113991
+ this.writing = this.writing.catch(() => void 0).then(async () => {
113992
+ await mkdir5(dirname9(path), { recursive: true });
113993
+ const temporary = `${path}.${process.pid}.tmp`;
113994
+ await writeFile4(temporary, `${JSON.stringify(normalized, void 0, 2)}
113995
+ `, "utf8");
113996
+ await rename4(temporary, path);
113997
+ });
113998
+ await this.writing;
113999
+ return normalized;
114000
+ }
114001
+ /** Read-modify-write helper for concurrent callers. */
114002
+ async update(mutate) {
114003
+ const current = await this.read();
114004
+ return this.write(mutate(current));
114005
+ }
114006
+ /**
114007
+ * Observe on-disk policy changes so a CLI edit or a hand-edited JSON takes
114008
+ * effect without restarting the Harness. Returns an unsubscribe function.
114009
+ *
114010
+ * The watcher is best-effort: a missing directory simply yields no events,
114011
+ * and a failed watch never throws into the caller.
114012
+ */
114013
+ watch(onChange) {
114014
+ if (this.watcher !== void 0) return this.watcher;
114015
+ let closed = false;
114016
+ let timer2;
114017
+ const emit2 = () => {
114018
+ if (closed) return;
114019
+ this.cache = void 0;
114020
+ void this.read().then((store) => {
114021
+ if (!closed) onChange(store);
114022
+ }).catch(() => void 0);
114023
+ };
114024
+ try {
114025
+ const directory = this.directory;
114026
+ const fileName = this.fileName;
114027
+ const handle = watch2(directory, { persistent: false }, (_event, changed) => {
114028
+ if (changed != null && String(changed) !== fileName) return;
114029
+ if (timer2 !== void 0) clearTimeout(timer2);
114030
+ timer2 = setTimeout(emit2, 120);
114031
+ timer2.unref?.();
114032
+ });
114033
+ handle.on("error", () => void 0);
114034
+ const stop = () => {
114035
+ closed = true;
114036
+ if (timer2 !== void 0) clearTimeout(timer2);
114037
+ try {
114038
+ handle.close();
114039
+ } catch {
114040
+ }
114041
+ };
114042
+ this.watcher = stop;
114043
+ return stop;
114044
+ } catch {
114045
+ const stop = () => {
114046
+ closed = true;
114047
+ };
114048
+ this.watcher = stop;
114049
+ return stop;
114050
+ }
114051
+ }
114052
+ };
114053
+
113911
114054
  // packages/plugin/src/control-runtime.ts
113912
114055
  var PluginControlRuntime = class {
113913
- constructor(config2, identityDirectory, settings, client, host, switchServer, updates, useDefaultStorage = false, logStore) {
114056
+ constructor(config2, identityDirectory, settings, client, host, switchServer, updates, useDefaultStorage = false, logStore, modelShare) {
113914
114057
  this.config = config2;
113915
114058
  this.identityDirectory = identityDirectory;
113916
114059
  this.settings = settings;
@@ -113920,6 +114063,7 @@ var PluginControlRuntime = class {
113920
114063
  this.updates = updates;
113921
114064
  this.useDefaultStorage = useDefaultStorage;
113922
114065
  this.logStore = logStore;
114066
+ this.modelShare = modelShare;
113923
114067
  }
113924
114068
  logoutFlight;
113925
114069
  serverSwitchFlight;
@@ -113995,6 +114139,8 @@ var PluginControlRuntime = class {
113995
114139
  if (endpoint === "settings.identity.reset") return ok3(await this.resetIdentity(payload));
113996
114140
  if (endpoint === "settings.logs.get") return ok3(await this.getLogs(payload));
113997
114141
  if (endpoint === "settings.logs.clear") return ok3(await this.clearLogs());
114142
+ if (endpoint === "modelshare.get") return ok3(await this.modelShareGet());
114143
+ if (endpoint === "modelshare.set") return ok3(await this.modelShareSet(payload));
113998
114144
  if (endpoint === "host.authorization.set" && this.client !== void 0) {
113999
114145
  const value = record10(payload);
114000
114146
  if (typeof value.enabled !== "boolean") throw new ClientModeError("INVALID_MESSAGE", "Host authorization state is required.");
@@ -114569,6 +114715,94 @@ var PluginControlRuntime = class {
114569
114715
  if (options?.onlyIfChanged && (current.hostControl?.enabled ?? true) === enabled) return;
114570
114716
  await this.settings.replace(editableConfig({ ...current, hostControl: { enabled } }));
114571
114717
  }
114718
+ // [model-sharing] BEGIN
114719
+ modelShareBinding() {
114720
+ const binding = this.modelShare?.();
114721
+ if (binding === void 0) {
114722
+ throw new ClientModeError("SETTINGS_UNAVAILABLE", "Model sharing is unavailable on this Host.");
114723
+ }
114724
+ if (!this.storageAvailable && this.startupFailure instanceof Error) throw this.startupFailure;
114725
+ return binding;
114726
+ }
114727
+ /** Collect the device roster without letting an authorization failure break the page. */
114728
+ async modelSharePeers(store) {
114729
+ const byId = /* @__PURE__ */ new Map();
114730
+ const remember = (deviceId, name2, online = false, connected = false, known = true) => {
114731
+ if (deviceId.trim() === "") return;
114732
+ const existing = byId.get(deviceId);
114733
+ if (existing === void 0) {
114734
+ byId.set(deviceId, {
114735
+ deviceId,
114736
+ name: name2 || deviceId,
114737
+ online,
114738
+ connected,
114739
+ known
114740
+ });
114741
+ return;
114742
+ }
114743
+ existing.online ||= online;
114744
+ existing.connected ||= connected;
114745
+ existing.known ||= known;
114746
+ if (existing.name === existing.deviceId && name2 !== "") existing.name = name2;
114747
+ };
114748
+ for (const peer of this.host?.hostStatus().connectedClients ?? []) {
114749
+ remember(peer.deviceId, peer.name ?? "", true, true);
114750
+ }
114751
+ if (this.client !== void 0) {
114752
+ try {
114753
+ for (const device of await this.client.devices()) {
114754
+ remember(device.deviceId, device.name ?? "", device.online, false);
114755
+ }
114756
+ } catch {
114757
+ }
114758
+ }
114759
+ const lending = store.host;
114760
+ for (const id7 of lending.allowedDevices) remember(id7, id7);
114761
+ for (const grant of lending.grants) {
114762
+ if (grant.deviceId !== void 0) remember(grant.deviceId, grant.deviceId);
114763
+ }
114764
+ for (const [hostId, source] of Object.entries(store.borrower.sources)) {
114765
+ remember(hostId, source.hostName ?? hostId);
114766
+ }
114767
+ return [...byId.values()].sort((a, b) => a.name.localeCompare(b.name));
114768
+ }
114769
+ async modelShareCatalog(llm) {
114770
+ if (llm === void 0) return [];
114771
+ const providers = llm.listProviders().filter((provider) => !provider.id.startsWith("remote-"));
114772
+ return Promise.all(providers.map(async (provider) => ({
114773
+ id: provider.id,
114774
+ ...provider.name === void 0 ? {} : { name: provider.name },
114775
+ models: (await llm.listModels(provider.id).catch(() => [])).map((model) => ({
114776
+ id: model.id,
114777
+ ...model.name === void 0 ? {} : { name: model.name }
114778
+ }))
114779
+ })));
114780
+ }
114781
+ async modelShareGet() {
114782
+ const { store, llm } = this.modelShareBinding();
114783
+ const policy = await store.read();
114784
+ return {
114785
+ store: policy,
114786
+ peers: await this.modelSharePeers(policy),
114787
+ localProviders: await this.modelShareCatalog(llm),
114788
+ writable: this.settings !== void 0
114789
+ };
114790
+ }
114791
+ async modelShareSet(payload) {
114792
+ const binding = this.modelShareBinding();
114793
+ const raw = record10(payload);
114794
+ const candidate = raw.store !== void 0 ? raw.store : raw;
114795
+ const next = normalizeStore2(candidate);
114796
+ await binding.store.write(next);
114797
+ await binding.resync?.();
114798
+ return {
114799
+ store: next,
114800
+ peers: await this.modelSharePeers(next),
114801
+ localProviders: await this.modelShareCatalog(binding.llm),
114802
+ writable: this.settings !== void 0
114803
+ };
114804
+ }
114805
+ // [model-sharing] END
114572
114806
  currentEditableConfig() {
114573
114807
  if (this.settings === void 0) return editableConfig(this.config);
114574
114808
  try {
@@ -114752,9 +114986,9 @@ function fail4(error62) {
114752
114986
  import { basename as basename10, dirname as dirname13 } from "node:path";
114753
114987
 
114754
114988
  // packages/plugin/src/host-log-store.ts
114755
- import { mkdir as mkdir5, open as open7, readFile as readFile6, rename as rename4, rm as rm4, stat as stat7, writeFile as writeFile4 } from "node:fs/promises";
114989
+ import { mkdir as mkdir6, open as open7, readFile as readFile7, rename as rename5, rm as rm4, stat as stat7, writeFile as writeFile5 } from "node:fs/promises";
114756
114990
  import { homedir as homedir8 } from "node:os";
114757
- import { dirname as dirname9, join as join17 } from "node:path";
114991
+ import { dirname as dirname10, join as join18 } from "node:path";
114758
114992
  var DEFAULT_MAX_ENTRIES = 1e3;
114759
114993
  var DEFAULT_MAX_FILE_BYTES = 2 * 1024 * 1024;
114760
114994
  var DEFAULT_MAX_BACKUPS = 2;
@@ -114762,10 +114996,10 @@ var MAX_LINE_CHARS = 8192;
114762
114996
  var TAIL_READ_BYTES = 512 * 1024;
114763
114997
  function resolveHostLogPath(options = {}) {
114764
114998
  const env = options.env ?? process.env;
114765
- const home = env.DSH_HOME || join17(options.homeDirectory ?? homedir8(), ".dsh");
114999
+ const home = env.DSH_HOME || join18(options.homeDirectory ?? homedir8(), ".dsh");
114766
115000
  const rawProfile = options.profile ?? env.DSH_PROFILE ?? "";
114767
115001
  const profileSlug = rawProfile.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "host";
114768
- return join17(home, "logs", "ds-harness-remote", `${profileSlug}.log`);
115002
+ return join18(home, "logs", "ds-harness-remote", `${profileSlug}.log`);
114769
115003
  }
114770
115004
  var HostLogStore = class {
114771
115005
  filePath;
@@ -114915,7 +115149,7 @@ var HostLogStore = class {
114915
115149
  async appendToDisk(payload) {
114916
115150
  const target3 = this.filePath;
114917
115151
  if (!this.dirEnsured) {
114918
- await mkdir5(dirname9(target3), { recursive: true, mode: 448 });
115152
+ await mkdir6(dirname10(target3), { recursive: true, mode: 448 });
114919
115153
  this.dirEnsured = true;
114920
115154
  }
114921
115155
  if (!this.sizeVerified) {
@@ -114927,12 +115161,12 @@ var HostLogStore = class {
114927
115161
  if (this.currentBytes > 0 && this.currentBytes + byteLength > this.maxFileBytes) {
114928
115162
  await this.rotateFiles(target3);
114929
115163
  }
114930
- await writeFile4(target3, payload, { encoding: "utf8", flag: "a", mode: 384 });
115164
+ await writeFile5(target3, payload, { encoding: "utf8", flag: "a", mode: 384 });
114931
115165
  this.currentBytes += byteLength;
114932
115166
  }
114933
115167
  async rotateFiles(target3) {
114934
115168
  if (this.maxBackups === 0) {
114935
- await writeFile4(target3, "", { encoding: "utf8", mode: 384 });
115169
+ await writeFile5(target3, "", { encoding: "utf8", mode: 384 });
114936
115170
  this.currentBytes = 0;
114937
115171
  return;
114938
115172
  }
@@ -114943,7 +115177,7 @@ var HostLogStore = class {
114943
115177
  await rm4(dest, { force: true }).catch(() => void 0);
114944
115178
  }
114945
115179
  try {
114946
- await rename4(src, dest);
115180
+ await rename5(src, dest);
114947
115181
  } catch (error62) {
114948
115182
  if (!isEnoent(error62)) throw error62;
114949
115183
  }
@@ -114953,10 +115187,10 @@ var HostLogStore = class {
114953
115187
  async clearDisk() {
114954
115188
  const target3 = this.filePath;
114955
115189
  if (!this.dirEnsured) {
114956
- await mkdir5(dirname9(target3), { recursive: true, mode: 448 });
115190
+ await mkdir6(dirname10(target3), { recursive: true, mode: 448 });
114957
115191
  this.dirEnsured = true;
114958
115192
  }
114959
- await writeFile4(target3, "", { encoding: "utf8", mode: 384 });
115193
+ await writeFile5(target3, "", { encoding: "utf8", mode: 384 });
114960
115194
  this.sizeVerified = true;
114961
115195
  for (let index = 1; index <= this.maxBackups; index++) {
114962
115196
  await rm4(`${target3}.${index}`, { force: true }).catch(() => void 0);
@@ -115002,7 +115236,7 @@ function parsePersistedLine(line, seq) {
115002
115236
  }
115003
115237
  async function readTailUtf8(filePath, totalSize, maxBytes2) {
115004
115238
  if (totalSize <= maxBytes2) {
115005
- return readFile6(filePath, "utf8");
115239
+ return readFile7(filePath, "utf8");
115006
115240
  }
115007
115241
  const handle = await open7(filePath, "r");
115008
115242
  try {
@@ -115843,7 +116077,7 @@ function unavailable2() {
115843
116077
 
115844
116078
  // packages/plugin/src/host-pairing.ts
115845
116079
  import { createHash as createHash9, createHmac as createHmac6, createPrivateKey as createPrivateKey4, createPublicKey as createPublicKey2, diffieHellman as diffieHellman2, hkdfSync, randomBytes as randomBytes16, createCipheriv as createCipheriv5, createDecipheriv as createDecipheriv4 } from "node:crypto";
115846
- import { join as join18 } from "node:path";
116080
+ import { join as join19 } from "node:path";
115847
116081
  import { rm as rm5 } from "node:fs/promises";
115848
116082
  var root = "/api/v1/device-pairing/sessions";
115849
116083
  var active = /* @__PURE__ */ new Set(["created", "claimed", "approved"]);
@@ -115876,7 +116110,7 @@ var HostPairing = class {
115876
116110
  this.fetcher = fetcher;
115877
116111
  this.serverUrl = normalizeServerUrl(serverUrl, httpServerAllowlist);
115878
116112
  this.store = new ServerCredentialStore(directory);
115879
- this.path = join18(directory, "host-pairing.json");
116113
+ this.path = join19(directory, "host-pairing.json");
115880
116114
  }
115881
116115
  path;
115882
116116
  store;
@@ -116096,7 +116330,7 @@ var HostPairing = class {
116096
116330
  import { randomUUID as randomUUID19 } from "node:crypto";
116097
116331
  import { constants as constants8 } from "node:fs";
116098
116332
  import { link as link2, lstat as lstat7, open as open8, realpath as realpath8, stat as stat9, unlink as unlink2 } from "node:fs/promises";
116099
- import { extname, isAbsolute as isAbsolute9, join as join19 } from "node:path";
116333
+ import { extname, isAbsolute as isAbsolute9, join as join20 } from "node:path";
116100
116334
 
116101
116335
  // packages/plugin/src/workspace-upload-budget.ts
116102
116336
  import { statfs } from "node:fs/promises";
@@ -116245,7 +116479,7 @@ var WorkspaceUploadHost = class {
116245
116479
  const directory = await stat9(root2);
116246
116480
  if (!directory.isDirectory()) throw failure3("UPLOAD_WORKSPACE_UNAVAILABLE");
116247
116481
  const reservation = await this.budget.reserve(root2, directory.dev, p.sessionId, p.totalBytes);
116248
- const temp = join19(root2, `.dsh-upload-${randomUUID19()}.part`);
116482
+ const temp = join20(root2, `.dsh-upload-${randomUUID19()}.part`);
116249
116483
  let handle;
116250
116484
  try {
116251
116485
  handle = await open8(temp, constants8.O_CREAT | constants8.O_EXCL | constants8.O_RDWR | (constants8.O_NOFOLLOW ?? 0), 384);
@@ -116315,7 +116549,7 @@ var WorkspaceUploadHost = class {
116315
116549
  await this.validateRoot(upload);
116316
116550
  const name2 = suffix === 0 ? upload.name : `${stem} (${suffix})${extension2}`;
116317
116551
  try {
116318
- await link2(upload.temp, join19(upload.root, name2));
116552
+ await link2(upload.temp, join20(upload.root, name2));
116319
116553
  } catch (error62) {
116320
116554
  if (error62.code === "EEXIST") continue;
116321
116555
  throw error62;
@@ -119133,26 +119367,26 @@ function closeCode(code) {
119133
119367
  import { randomUUID as randomUUID20 } from "node:crypto";
119134
119368
  import { homedir as homedir10 } from "node:os";
119135
119369
  import { lstat as lstat8, realpath as realpath10, stat as stat11 } from "node:fs/promises";
119136
- import { dirname as dirname11, isAbsolute as isAbsolute11, join as join21, parse as parse6, relative as relative6, resolve as resolve11, sep as sep5 } from "node:path";
119370
+ import { dirname as dirname12, isAbsolute as isAbsolute11, join as join22, parse as parse6, relative as relative6, resolve as resolve11, sep as sep5 } from "node:path";
119137
119371
 
119138
119372
  // packages/plugin/src/remote-directory-browser.ts
119139
- import { mkdir as mkdir6, realpath as realpath9, readdir as readdir6, stat as stat10 } from "node:fs/promises";
119373
+ import { mkdir as mkdir7, realpath as realpath9, readdir as readdir6, stat as stat10 } from "node:fs/promises";
119140
119374
  import { homedir as homedir9, platform as platform2 } from "node:os";
119141
- import { basename as basename9, dirname as dirname10, isAbsolute as isAbsolute10, join as join20, parse as parse5, resolve as resolve10 } from "node:path";
119375
+ import { basename as basename9, dirname as dirname11, isAbsolute as isAbsolute10, join as join21, parse as parse5, resolve as resolve10 } from "node:path";
119142
119376
  var MAX_ENTRIES = 500;
119143
119377
  async function ensureHostWorkspaceDirectory(path) {
119144
119378
  if (typeof path !== "string" || path.trim() === "" || path.includes("\0") || !isAbsolute10(path) || resolve10(path) === parse5(path).root) {
119145
119379
  throw new RpcError("INVALID_MESSAGE", "Workspace path must be an absolute, non-root directory path.");
119146
119380
  }
119147
- await mkdir6(path, { recursive: true });
119381
+ await mkdir7(path, { recursive: true });
119148
119382
  }
119149
119383
  async function createHostChildDirectory(parent, name2) {
119150
119384
  if (typeof parent !== "string" || !isAbsolute10(parent) || parent.includes("\0") || typeof name2 !== "string" || !name2.trim() || name2 === "." || name2 === ".." || /[/\\\0]/u.test(name2) || platform2() === "win32" && (/[<>:"|?*\x00-\x1f]|[. ]$/u.test(name2) || /^(con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\.|$)/iu.test(name2))) {
119151
119385
  throw new RpcError("INVALID_MESSAGE", "Invalid parent path or folder name.");
119152
119386
  }
119153
119387
  try {
119154
- const target3 = join20(await realpath9(parent), name2);
119155
- await mkdir6(target3);
119388
+ const target3 = join21(await realpath9(parent), name2);
119389
+ await mkdir7(target3);
119156
119390
  return target3;
119157
119391
  } catch (error62) {
119158
119392
  if (error62.code === "EEXIST") throw new RpcError("ALREADY_EXISTS", "The name is already in use.");
@@ -119190,7 +119424,7 @@ function crumbs(path) {
119190
119424
  let current = path;
119191
119425
  while (current !== root2) {
119192
119426
  segments.unshift(basename9(current));
119193
- current = dirname10(current);
119427
+ current = dirname11(current);
119194
119428
  }
119195
119429
  for (const segment of segments) {
119196
119430
  current = resolve10(current, segment);
@@ -120688,7 +120922,7 @@ var HarnessRemoteBridge = class {
120688
120922
  }
120689
120923
  const safeBaseRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, rawBaseFile, endpoint, sessionWorkspace.cwd);
120690
120924
  const baseCandidate = resolve11(sessionWorkspace.root, safeBaseRel);
120691
- const baseDir = dirname11(baseCandidate);
120925
+ const baseDir = dirname12(baseCandidate);
120692
120926
  const targetCandidate = resolve11(baseDir, path);
120693
120927
  safeRel = await this.verifyWorkspacePathContainment(sessionWorkspace.root, targetCandidate, endpoint, sessionWorkspace.cwd);
120694
120928
  } else {
@@ -120784,7 +121018,7 @@ var HarnessRemoteBridge = class {
120784
121018
  const parts = rel.split(sep5).filter((p) => p.length > 0 && p !== ".");
120785
121019
  let currentPath = root2;
120786
121020
  for (let i = 0; i < parts.length - 1; i++) {
120787
- currentPath = join21(currentPath, parts[i]);
121021
+ currentPath = join22(currentPath, parts[i]);
120788
121022
  if (isPathOutside3(relative6(root2, currentPath))) {
120789
121023
  throw workspaceFileFailure("WORKSPACE_PATH_DENIED", "The requested workspace path is outside the workspace.", "outside-root");
120790
121024
  }
@@ -122402,149 +122636,6 @@ async function waitForStartupGrace(promise2, graceMs) {
122402
122636
  }
122403
122637
  }
122404
122638
 
122405
- // packages/plugin/src/model-share/settings-store.ts
122406
- import { watch as watch2 } from "node:fs";
122407
- import { mkdir as mkdir7, readFile as readFile7, rename as rename5, writeFile as writeFile5 } from "node:fs/promises";
122408
- import { dirname as dirname12, join as join22 } from "node:path";
122409
- var DEFAULT_STORE = {
122410
- version: 1,
122411
- host: {
122412
- enabled: false,
122413
- allowedDevices: [],
122414
- grants: [],
122415
- maxConcurrent: 2
122416
- },
122417
- borrower: {
122418
- sources: {}
122419
- }
122420
- };
122421
- function normalizeStore2(input4) {
122422
- const raw = typeof input4 === "object" && input4 !== null ? input4 : {};
122423
- const hostRaw = typeof raw.host === "object" && raw.host !== null ? raw.host : {};
122424
- const borrowerRaw = typeof raw.borrower === "object" && raw.borrower !== null ? raw.borrower : {};
122425
- const grants = Array.isArray(hostRaw.grants) ? hostRaw.grants.flatMap((entry) => {
122426
- if (typeof entry !== "object" || entry === null) return [];
122427
- const grant = entry;
122428
- const provider = typeof grant.provider === "string" ? grant.provider.trim() : "";
122429
- if (provider === "") return [];
122430
- return [{
122431
- ...typeof grant.deviceId === "string" && grant.deviceId.trim() !== "" ? { deviceId: grant.deviceId.trim() } : {},
122432
- provider,
122433
- models: Array.isArray(grant.models) ? grant.models.filter((model) => typeof model === "string" && model.trim() !== "").map((model) => model.trim()) : []
122434
- }];
122435
- }) : [];
122436
- const sourcesRaw = typeof borrowerRaw.sources === "object" && borrowerRaw.sources !== null ? borrowerRaw.sources : {};
122437
- const sources = {};
122438
- for (const [deviceId, value] of Object.entries(sourcesRaw)) {
122439
- if (deviceId.trim() === "" || typeof value !== "object" || value === null) continue;
122440
- const source = value;
122441
- sources[deviceId] = {
122442
- enabled: source.enabled === true,
122443
- models: Array.isArray(source.models) ? source.models.filter((model) => typeof model === "string" && model.trim() !== "").map((model) => model.trim()) : [],
122444
- ...typeof source.hostName === "string" && source.hostName.trim() !== "" ? { hostName: source.hostName.trim() } : {}
122445
- };
122446
- }
122447
- const maxConcurrentRaw = typeof hostRaw.maxConcurrent === "number" ? Math.trunc(hostRaw.maxConcurrent) : DEFAULT_STORE.host.maxConcurrent;
122448
- return {
122449
- version: 1,
122450
- host: {
122451
- enabled: hostRaw.enabled === true,
122452
- allowedDevices: Array.isArray(hostRaw.allowedDevices) ? hostRaw.allowedDevices.filter((id7) => typeof id7 === "string" && id7.trim() !== "").map((id7) => id7.trim()) : [],
122453
- grants,
122454
- maxConcurrent: Number.isFinite(maxConcurrentRaw) ? Math.min(Math.max(maxConcurrentRaw, 1), 16) : DEFAULT_STORE.host.maxConcurrent
122455
- },
122456
- borrower: { sources }
122457
- };
122458
- }
122459
- var ModelShareStoreFile = class {
122460
- constructor(directory, fileName = "model-share.json") {
122461
- this.directory = directory;
122462
- this.fileName = fileName;
122463
- }
122464
- cache;
122465
- writing = Promise.resolve();
122466
- /** Active directory watcher, if `watch()` was called. */
122467
- watcher;
122468
- get path() {
122469
- return join22(this.directory, this.fileName);
122470
- }
122471
- async read() {
122472
- if (this.cache !== void 0) return this.cache;
122473
- try {
122474
- const text = await readFile7(this.path, "utf8");
122475
- this.cache = normalizeStore2(JSON.parse(text));
122476
- } catch {
122477
- this.cache = normalizeStore2(void 0);
122478
- }
122479
- return this.cache;
122480
- }
122481
- async write(next) {
122482
- const normalized = normalizeStore2(next);
122483
- this.cache = normalized;
122484
- const path = this.path;
122485
- this.writing = this.writing.catch(() => void 0).then(async () => {
122486
- await mkdir7(dirname12(path), { recursive: true });
122487
- const temporary = `${path}.${process.pid}.tmp`;
122488
- await writeFile5(temporary, `${JSON.stringify(normalized, void 0, 2)}
122489
- `, "utf8");
122490
- await rename5(temporary, path);
122491
- });
122492
- await this.writing;
122493
- return normalized;
122494
- }
122495
- /** Read-modify-write helper for concurrent callers. */
122496
- async update(mutate) {
122497
- const current = await this.read();
122498
- return this.write(mutate(current));
122499
- }
122500
- /**
122501
- * Observe on-disk policy changes so a CLI edit or a hand-edited JSON takes
122502
- * effect without restarting the Harness. Returns an unsubscribe function.
122503
- *
122504
- * The watcher is best-effort: a missing directory simply yields no events,
122505
- * and a failed watch never throws into the caller.
122506
- */
122507
- watch(onChange) {
122508
- if (this.watcher !== void 0) return this.watcher;
122509
- let closed = false;
122510
- let timer2;
122511
- const emit2 = () => {
122512
- if (closed) return;
122513
- this.cache = void 0;
122514
- void this.read().then((store) => {
122515
- if (!closed) onChange(store);
122516
- }).catch(() => void 0);
122517
- };
122518
- try {
122519
- const directory = this.directory;
122520
- const fileName = this.fileName;
122521
- const handle = watch2(directory, { persistent: false }, (_event, changed) => {
122522
- if (changed != null && String(changed) !== fileName) return;
122523
- if (timer2 !== void 0) clearTimeout(timer2);
122524
- timer2 = setTimeout(emit2, 120);
122525
- timer2.unref?.();
122526
- });
122527
- handle.on("error", () => void 0);
122528
- const stop = () => {
122529
- closed = true;
122530
- if (timer2 !== void 0) clearTimeout(timer2);
122531
- try {
122532
- handle.close();
122533
- } catch {
122534
- }
122535
- };
122536
- this.watcher = stop;
122537
- return stop;
122538
- } catch {
122539
- const stop = () => {
122540
- closed = true;
122541
- };
122542
- this.watcher = stop;
122543
- return stop;
122544
- }
122545
- }
122546
- };
122547
-
122548
122639
  // packages/plugin/src/model-share/host.ts
122549
122640
  var ROUTE_SEPARATOR = "::";
122550
122641
  function routeKey(provider, model) {
@@ -127541,7 +127632,7 @@ var PluginUpdateChecker = class {
127541
127632
 
127542
127633
  // packages/plugin/src/plugin-self-update.ts
127543
127634
  import { randomUUID as randomUUID24 } from "node:crypto";
127544
- var REMOTE_PLUGIN_PACKAGE = "ds-harness-remote";
127635
+ var REMOTE_PLUGIN_PACKAGE = "@musdrop/ds-harness-remote";
127545
127636
  var LocalPluginUpgrade = class {
127546
127637
  constructor(checker, manager, subscribe, requestId2 = randomUUID24) {
127547
127638
  this.checker = checker;
@@ -128367,6 +128458,7 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
128367
128458
  let controlRuntime;
128368
128459
  const modelShareBorrowers = [];
128369
128460
  let borrowerSync;
128461
+ let modelShareStore;
128370
128462
  try {
128371
128463
  const nativeTypertGateway = ctx.get("typertGateway");
128372
128464
  let connectionExports = {};
@@ -128407,11 +128499,12 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
128407
128499
  role: "host"
128408
128500
  });
128409
128501
  const modelShareEnabled = nextConfig.modelShare.enabled;
128410
- const modelShareStore = new ModelShareStoreFile(defaultIdentityDirectory);
128502
+ const activeStore = new ModelShareStoreFile(defaultIdentityDirectory);
128503
+ modelShareStore = activeStore;
128411
128504
  const lendingFactory = modelShareEnabled ? (deviceId) => {
128412
128505
  const llm = ctx.get("llm", false);
128413
128506
  if (llm === void 0) return void 0;
128414
- return new ModelShareHost(llm, modelShareStore, logger2, deviceId);
128507
+ return new ModelShareHost(llm, activeStore, logger2, deviceId);
128415
128508
  } : void 0;
128416
128509
  const nextRuntime = new HostPluginRuntime(
128417
128510
  nextConfig,
@@ -128458,12 +128551,12 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
128458
128551
  }
128459
128552
  const llmRegistry = ctx.get("llm", false);
128460
128553
  if (modelShareEnabled && llmRegistry !== void 0 && nextClientRuntime !== void 0) {
128461
- const borrower = new BorrowerRuntime(llmRegistry, modelShareStore, logger2);
128554
+ const borrower = new BorrowerRuntime(llmRegistry, activeStore, logger2);
128462
128555
  modelShareBorrowers.push(borrower);
128463
128556
  const clientRuntimeForSync = nextClientRuntime;
128464
128557
  const syncBorrowed = async () => {
128465
128558
  if (closed) return;
128466
- const { borrower: policy } = await modelShareStore.read();
128559
+ const { borrower: policy } = await activeStore.read();
128467
128560
  for (const hostId of borrower.activeHosts()) {
128468
128561
  if (policy.sources[hostId]?.enabled !== true) borrower.unregister(hostId);
128469
128562
  }
@@ -128479,7 +128572,7 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
128479
128572
  };
128480
128573
  void syncBorrowed();
128481
128574
  borrowerSync = syncBorrowed;
128482
- modelShareStore.watch(() => {
128575
+ activeStore.watch(() => {
128483
128576
  void syncBorrowed();
128484
128577
  });
128485
128578
  }
@@ -128553,7 +128646,14 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
128553
128646
  replaceServer,
128554
128647
  pluginUpgrade,
128555
128648
  true,
128556
- logStore
128649
+ logStore,
128650
+ // [model-sharing] Lazy binding so server switches recreate the store
128651
+ // and the borrower providers can be resynced after a policy edit.
128652
+ () => modelShareStore === void 0 ? void 0 : {
128653
+ store: modelShareStore,
128654
+ llm: ctx.get("llm", false),
128655
+ resync: () => borrowerSync?.() ?? Promise.resolve()
128656
+ }
128557
128657
  );
128558
128658
  if (initialStorageError !== void 0) {
128559
128659
  controlRuntime?.setStartupFailure(initialStorageError, { storageAvailable: false });
package/dsh-plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://dsh.community/schemas/dsh-plugin-0.15.json",
3
3
  "id": "com.r2049.ds-harness-remote",
4
4
  "name": "@musdrop/ds-harness-remote",
5
- "version": "0.6.9",
5
+ "version": "0.6.11",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@musdrop/ds-harness-remote",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "description": "P2P-based, end-to-end encrypted remote access to DeepSeek Harness, CodeX, Claude Code, Pi, and other workspaces from web and mobile clients. Fork adding cross-device model lending/borrowing.",
5
5
  "keywords": [
6
6
  "deepseek",