@musdrop/ds-harness-remote 0.6.11 → 0.6.13
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 +25 -25
- package/dist/client.js +202 -122
- package/dist/index.js +106 -7
- package/dsh-plugin.json +1 -1
- package/locale/README.en.md +16 -0
- package/locale/README.ja.md +16 -0
- package/locale/README.ru.md +16 -0
- package/locale/README.uk.md +16 -0
- package/locale/README.zh.md +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +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
|
+
> [!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
|
+
|
|
26
26
|
# DeepSeek Harness Remote
|
|
27
27
|
|
|
28
28
|
Continue DeepSeek Harness sessions and experimental Codex, Cursor, and Antigravity workspaces from another device over an end-to-end encrypted connection.
|
package/dist/client.js
CHANGED
|
@@ -1778,7 +1778,7 @@ Minimum version required to store current data is: ` + bestVersion + `.
|
|
|
1778
1778
|
|
|
1779
1779
|
// packages/plugin/src/client-locale.ts
|
|
1780
1780
|
init_page_globals();
|
|
1781
|
-
var localeNamespace = "
|
|
1781
|
+
var localeNamespace = "ds-harness-remote", en = {
|
|
1782
1782
|
uploadTooLarge: "The file exceeds the current upload limit of {size}.",
|
|
1783
1783
|
relayUploadTooLarge: "The file exceeds the current upload limit of {size}. Relay and TURN allow 20 MiB per file, or 100 MiB on connections with member upload support.",
|
|
1784
1784
|
serverSavedLive: "Server address saved and applied.",
|
|
@@ -2215,7 +2215,15 @@ If a code was sent, recover the original submission without changing it.`,
|
|
|
2215
2215
|
modelShareBorrowFrom: "Borrow from",
|
|
2216
2216
|
modelShareOffline: "offline",
|
|
2217
2217
|
modelShareOnline: "online",
|
|
2218
|
-
modelShareNotLoaded: "Model sharing settings are unavailable."
|
|
2218
|
+
modelShareNotLoaded: "Model sharing settings are unavailable.",
|
|
2219
|
+
modelShareSelectedCount: "{count} selected",
|
|
2220
|
+
modelShareBorrowStatusOk: "Connected: {count} model(s) available in the picker.",
|
|
2221
|
+
modelShareBorrowStatusDisconnected: "Not connected to Remote: borrowing cannot sync.",
|
|
2222
|
+
modelShareBorrowStatusFailed: "Connection failed: {reason}",
|
|
2223
|
+
modelShareBorrowStatusPeerEmpty: "This device lends nothing usable right now.",
|
|
2224
|
+
modelShareRuleAnyDeviceHint: "A rule without any selected device applies to every authorized peer.",
|
|
2225
|
+
modelShareEdit: "Edit",
|
|
2226
|
+
modelShareSaveEdit: "Save rule"
|
|
2219
2227
|
}, zh = {
|
|
2220
2228
|
uploadTooLarge: "\u6587\u4EF6\u8D85\u8FC7\u5F53\u524D\u8FDE\u63A5\u7684\u5355\u6587\u4EF6\u4E0A\u4F20\u4E0A\u9650\uFF08{size}\uFF09\u3002",
|
|
2221
2229
|
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",
|
|
@@ -2653,7 +2661,15 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
2653
2661
|
modelShareBorrowFrom: "\u501F\u7528\u81EA",
|
|
2654
2662
|
modelShareOffline: "\u79BB\u7EBF",
|
|
2655
2663
|
modelShareOnline: "\u5728\u7EBF",
|
|
2656
|
-
modelShareNotLoaded: "\u6A21\u578B\u5171\u4EAB\u8BBE\u7F6E\u4E0D\u53EF\u7528\u3002"
|
|
2664
|
+
modelShareNotLoaded: "\u6A21\u578B\u5171\u4EAB\u8BBE\u7F6E\u4E0D\u53EF\u7528\u3002",
|
|
2665
|
+
modelShareSelectedCount: "\u5DF2\u9009 {count} \u9879",
|
|
2666
|
+
modelShareBorrowStatusOk: "\u5DF2\u8FDE\u63A5\uFF1A{count} \u4E2A\u6A21\u578B\u53EF\u7528\u3002",
|
|
2667
|
+
modelShareBorrowStatusDisconnected: "\u672A\u8FDE\u63A5\u5230\u8FDC\u7A0B\uFF1A\u501F\u7528\u65E0\u6CD5\u540C\u6B65\u3002",
|
|
2668
|
+
modelShareBorrowStatusFailed: "\u8FDE\u63A5\u5931\u8D25\uFF1A{reason}",
|
|
2669
|
+
modelShareBorrowStatusPeerEmpty: "\u8BE5\u8BBE\u5907\u5F53\u524D\u6CA1\u6709\u53EF\u501F\u7528\u7684\u6A21\u578B\u3002",
|
|
2670
|
+
modelShareRuleAnyDeviceHint: "\u672A\u9009\u62E9\u4EFB\u4F55\u8BBE\u5907\u7684\u89C4\u5219\u5BF9\u6240\u6709\u5DF2\u6388\u6743\u7684\u8BBE\u5907\u751F\u6548\u3002",
|
|
2671
|
+
modelShareEdit: "\u7F16\u8F91",
|
|
2672
|
+
modelShareSaveEdit: "\u4FDD\u5B58\u89C4\u5219"
|
|
2657
2673
|
}, ru = {
|
|
2658
2674
|
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}).",
|
|
2659
2675
|
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.",
|
|
@@ -3091,7 +3107,15 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
3091
3107
|
modelShareBorrowFrom: "\u0417\u0430\u0438\u043C\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0438\u0437",
|
|
3092
3108
|
modelShareOffline: "\u043E\u0444\u043B\u0430\u0439\u043D",
|
|
3093
3109
|
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."
|
|
3110
|
+
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.",
|
|
3111
|
+
modelShareSelectedCount: "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: {count}",
|
|
3112
|
+
modelShareBorrowStatusOk: "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u043E: \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u043C\u043E\u0434\u0435\u043B\u0435\u0439 \u2014 {count}.",
|
|
3113
|
+
modelShareBorrowStatusDisconnected: "\u041D\u0435\u0442 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u043A Remote: \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0437\u0430\u0438\u043C\u0441\u0442\u0432\u043E\u0432\u0430\u043D\u0438\u044F \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u043D\u0430.",
|
|
3114
|
+
modelShareBorrowStatusFailed: "\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F: {reason}",
|
|
3115
|
+
modelShareBorrowStatusPeerEmpty: "\u042D\u0442\u043E \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 \u043C\u043E\u0434\u0435\u043B\u0435\u0439.",
|
|
3116
|
+
modelShareRuleAnyDeviceHint: "\u041F\u0440\u0430\u0432\u0438\u043B\u043E \u0431\u0435\u0437 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0445 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432.",
|
|
3117
|
+
modelShareEdit: "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C",
|
|
3118
|
+
modelShareSaveEdit: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u043F\u0440\u0430\u0432\u0438\u043B\u043E"
|
|
3095
3119
|
}, uk = {
|
|
3096
3120
|
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}).",
|
|
3097
3121
|
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.",
|
|
@@ -3529,7 +3553,15 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
3529
3553
|
modelShareBorrowFrom: "\u041F\u043E\u0437\u0438\u0447\u0430\u0442\u0438 \u0437",
|
|
3530
3554
|
modelShareOffline: "\u043E\u0444\u043B\u0430\u0439\u043D",
|
|
3531
3555
|
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."
|
|
3556
|
+
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.",
|
|
3557
|
+
modelShareSelectedCount: "\u0412\u0438\u0431\u0440\u0430\u043D\u043E: {count}",
|
|
3558
|
+
modelShareBorrowStatusOk: "\u041F\u0456\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u043E: \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u043C\u043E\u0434\u0435\u043B\u0435\u0439 \u2014 {count}.",
|
|
3559
|
+
modelShareBorrowStatusDisconnected: "\u041D\u0435\u043C\u0430\u0454 \u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u044F \u0434\u043E Remote: \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0456\u0437\u0430\u0446\u0456\u044F \u043F\u043E\u0437\u0438\u0447\u0430\u043D\u043D\u044F \u043D\u0435\u043C\u043E\u0436\u043B\u0438\u0432\u0430.",
|
|
3560
|
+
modelShareBorrowStatusFailed: "\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u043D\u044F: {reason}",
|
|
3561
|
+
modelShareBorrowStatusPeerEmpty: "\u0426\u0435\u0439 \u043F\u0440\u0438\u0441\u0442\u0440\u0456\u0439 \u0437\u0430\u0440\u0430\u0437 \u043D\u0435 \u043D\u0430\u0434\u0430\u0454 \u043C\u043E\u0434\u0435\u043B\u0435\u0439.",
|
|
3562
|
+
modelShareRuleAnyDeviceHint: "\u041F\u0440\u0430\u0432\u0438\u043B\u043E \u0431\u0435\u0437 \u0432\u0438\u0431\u0440\u0430\u043D\u0438\u0445 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457\u0432 \u0434\u0456\u0454 \u0434\u043B\u044F \u0432\u0441\u0456\u0445 \u0430\u0432\u0442\u043E\u0440\u0438\u0437\u043E\u0432\u0430\u043D\u0438\u0445 \u043F\u0440\u0438\u0441\u0442\u0440\u043E\u0457\u0432.",
|
|
3563
|
+
modelShareEdit: "\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438",
|
|
3564
|
+
modelShareSaveEdit: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u043F\u0440\u0430\u0432\u0438\u043B\u043E"
|
|
3533
3565
|
};
|
|
3534
3566
|
|
|
3535
3567
|
// packages/plugin/src/client/header.ts
|
|
@@ -4337,7 +4369,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4337
4369
|
}
|
|
4338
4370
|
function createModelSharingSection(React) {
|
|
4339
4371
|
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), [
|
|
4372
|
+
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), [grantProvider, setGrantProvider] = React.useState(""), [grantAllModels, setGrantAllModels] = React.useState(!0), [grantModels, setGrantModels] = React.useState([]), [grantAnyDevice, setGrantAnyDevice] = React.useState(!0), [grantDevices, setGrantDevices] = React.useState([]), [editingGrant, setEditingGrant] = React.useState(!1), [concurrencyDraft, setConcurrencyDraft] = React.useState(void 0), viewRef = React.useRef(void 0), queueRef = React.useRef(Promise.resolve()), busyRef = React.useRef(!1), applyView = (next) => {
|
|
4341
4373
|
viewRef.current = next, setView(next), setConcurrencyDraft(void 0);
|
|
4342
4374
|
}, load = React.useCallback(async () => {
|
|
4343
4375
|
setError(void 0);
|
|
@@ -4366,23 +4398,6 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4366
4398
|
enqueue((current) => ({ ...current, host: { ...current.host, ...changes } }));
|
|
4367
4399
|
}, patchSources = (sources) => {
|
|
4368
4400
|
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
4401
|
}, toggleSource = (deviceId, hostName) => {
|
|
4387
4402
|
if (view === void 0) return;
|
|
4388
4403
|
let sources = { ...view.store.borrower.sources }, current = sources[deviceId];
|
|
@@ -4391,7 +4406,35 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4391
4406
|
models: current?.models ?? [],
|
|
4392
4407
|
hostName: current?.hostName ?? hostName
|
|
4393
4408
|
}, patchSources(sources);
|
|
4394
|
-
},
|
|
4409
|
+
}, removeGrant = (index) => {
|
|
4410
|
+
view !== void 0 && patchHost({ grants: view.store.host.grants.filter((_, i) => i !== index) });
|
|
4411
|
+
}, selectGrantProvider = (provider) => {
|
|
4412
|
+
setGrantProvider(provider), setGrantAllModels(!0), setGrantModels([]);
|
|
4413
|
+
}, toggleGrantModel = (modelId) => {
|
|
4414
|
+
setGrantModels((current) => current.includes(modelId) ? current.filter((id) => id !== modelId) : [...current, modelId]);
|
|
4415
|
+
}, toggleGrantDevice = (deviceId) => {
|
|
4416
|
+
setGrantDevices((current) => current.includes(deviceId) ? current.filter((id) => id !== deviceId) : [...current, deviceId]);
|
|
4417
|
+
}, addGrant = () => {
|
|
4418
|
+
if (view === void 0 || grantProvider === "") return;
|
|
4419
|
+
let provider = grantProvider, models = grantAllModels || grantModels.length === 0 ? [] : grantModels, anyDevice = grantAnyDevice || grantDevices.length === 0, replaced = new Set(anyDevice ? ["*"] : grantDevices), grants = view.store.host.grants.filter((grant) => grant.provider !== provider ? !0 : !replaced.has(grant.deviceId === void 0 ? "*" : grant.deviceId));
|
|
4420
|
+
for (let deviceId of anyDevice ? [void 0] : grantDevices)
|
|
4421
|
+
grants.push({ ...deviceId === void 0 ? {} : { deviceId }, provider, models });
|
|
4422
|
+
patchHost({ grants, enabled: !0 }), setGrantProvider(""), setGrantAllModels(!0), setGrantModels([]), setGrantAnyDevice(!0), setGrantDevices([]), setEditingGrant(!1);
|
|
4423
|
+
}, label = (device) => `${device.name}${device.online ? ` \xB7 ${t("modelShareOnline")}` : device.known ? ` \xB7 ${t("modelShareOffline")}` : ""}`, peerName = (deviceId) => view?.peers.find((device) => device.deviceId === deviceId)?.name ?? deviceId, grantModelsSummary = (models) => models.length === 0 ? t("modelShareAllModels") : models.join(", "), borrowStatus = (deviceId, source) => {
|
|
4424
|
+
if (view === void 0 || source?.enabled !== !0) return;
|
|
4425
|
+
let diagnostics = view.borrowerDiagnostics;
|
|
4426
|
+
if (diagnostics.syncAvailable !== !0)
|
|
4427
|
+
return { cls: " isFailed", text: t("modelShareBorrowStatusDisconnected") };
|
|
4428
|
+
let entry = diagnostics.sources.find((item) => item.hostId === deviceId);
|
|
4429
|
+
if (entry !== void 0) {
|
|
4430
|
+
if (entry.outcome === "registered")
|
|
4431
|
+
return { cls: " isPassed", text: t("modelShareBorrowStatusOk", { count: entry.modelCount }) };
|
|
4432
|
+
if (entry.outcome === "failed")
|
|
4433
|
+
return { cls: " isFailed", text: t("modelShareBorrowStatusFailed", { reason: entry.error ?? "" }) };
|
|
4434
|
+
if (entry.outcome === "host-disabled" || entry.outcome === "no-models")
|
|
4435
|
+
return { cls: " isFailed", text: t("modelShareBorrowStatusPeerEmpty") };
|
|
4436
|
+
}
|
|
4437
|
+
};
|
|
4395
4438
|
if (view === void 0)
|
|
4396
4439
|
return React.createElement(
|
|
4397
4440
|
"div",
|
|
@@ -4403,7 +4446,12 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4403
4446
|
React.createElement("p", null, error ?? t("modelShareNotLoaded"))
|
|
4404
4447
|
)
|
|
4405
4448
|
);
|
|
4406
|
-
let { host, borrower } = view.store, disabled = busy || !view.writable || !available,
|
|
4449
|
+
let { host, borrower } = view.store, disabled = busy || !view.writable || !available, draftModels = view.localProviders.find((provider) => provider.id === grantProvider)?.models ?? [], modelsSummary = grantAllModels || grantModels.length === 0 ? t("modelShareAllModels") : t("modelShareSelectedCount", { count: grantModels.length }), devicesSummary = grantAnyDevice || grantDevices.length === 0 ? t("modelShareAnyDevice") : t("modelShareSelectedCount", { count: grantDevices.length }), deviceSummaryLine = `${t("modelShareDevice")}: ${devicesSummary}`, modelSummaryLine = `${t("modelShareModels")}: ${modelsSummary}`, grantGroups = [];
|
|
4450
|
+
host.grants.forEach((grant, index) => {
|
|
4451
|
+
let group = grantGroups.find((candidate) => candidate.provider === grant.provider);
|
|
4452
|
+
group === void 0 && (group = { provider: grant.provider, entries: [] }, grantGroups.push(group)), group.entries.push({ index, grant });
|
|
4453
|
+
});
|
|
4454
|
+
let lendingRows = React.createElement(
|
|
4407
4455
|
"div",
|
|
4408
4456
|
{ className: "dshRemoteAcpList" },
|
|
4409
4457
|
React.createElement(
|
|
@@ -4415,31 +4463,11 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4415
4463
|
React.createElement(
|
|
4416
4464
|
"div",
|
|
4417
4465
|
{ className: "dshRemoteAcpRowInfo" },
|
|
4418
|
-
React.createElement(
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
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"))
|
|
4466
|
+
React.createElement(
|
|
4467
|
+
"div",
|
|
4468
|
+
{ className: "dshRemoteAcpRowInfo" },
|
|
4469
|
+
React.createElement("strong", { className: "dshRemoteAcpName" }, t("modelShareMaxConcurrent"))
|
|
4470
|
+
)
|
|
4443
4471
|
),
|
|
4444
4472
|
React.createElement(
|
|
4445
4473
|
"div",
|
|
@@ -4459,12 +4487,13 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4459
4487
|
}
|
|
4460
4488
|
})
|
|
4461
4489
|
)
|
|
4462
|
-
)
|
|
4490
|
+
),
|
|
4491
|
+
React.createElement("p", { className: "dshRemoteAcpDiag" }, t("modelShareRuleAnyDeviceHint"))
|
|
4463
4492
|
),
|
|
4464
|
-
...
|
|
4493
|
+
...grantGroups.map((group) => React.createElement(
|
|
4465
4494
|
"div",
|
|
4466
4495
|
{
|
|
4467
|
-
key: `
|
|
4496
|
+
key: `grant-group-${group.provider}`,
|
|
4468
4497
|
className: "dshRemoteAcpRow"
|
|
4469
4498
|
},
|
|
4470
4499
|
React.createElement(
|
|
@@ -4473,51 +4502,47 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4473
4502
|
React.createElement(
|
|
4474
4503
|
"div",
|
|
4475
4504
|
{ className: "dshRemoteAcpRowInfo" },
|
|
4476
|
-
React.createElement("strong", { className: "dshRemoteAcpName" },
|
|
4477
|
-
)
|
|
4478
|
-
|
|
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
|
-
},
|
|
4505
|
+
React.createElement("strong", { className: "dshRemoteAcpName" }, group.provider)
|
|
4506
|
+
)
|
|
4507
|
+
),
|
|
4496
4508
|
React.createElement(
|
|
4509
|
+
"p",
|
|
4510
|
+
{ className: "dshRemoteAcpDiag" },
|
|
4511
|
+
grantModelsSummary([...new Set(group.entries.map((entry) => entry.grant.models).flat())])
|
|
4512
|
+
),
|
|
4513
|
+
...group.entries.map((entry) => React.createElement(
|
|
4497
4514
|
"div",
|
|
4498
|
-
{
|
|
4499
|
-
|
|
4500
|
-
"
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
),
|
|
4507
|
-
React.createElement("p", null, grant.deviceId ?? t("modelShareAnyDevice"))
|
|
4508
|
-
),
|
|
4515
|
+
{
|
|
4516
|
+
key: `grant-${entry.index}`,
|
|
4517
|
+
className: "dshRemoteModelShareGrantEntry"
|
|
4518
|
+
},
|
|
4519
|
+
React.createElement("span", null, [
|
|
4520
|
+
entry.grant.deviceId === void 0 ? t("modelShareAnyDevice") : peerName(entry.grant.deviceId),
|
|
4521
|
+
grantModelsSummary(entry.grant.models)
|
|
4522
|
+
].join(" \xB7 ")),
|
|
4509
4523
|
React.createElement(
|
|
4510
4524
|
"div",
|
|
4511
4525
|
{ className: "dshRemoteAcpRowActions" },
|
|
4526
|
+
React.createElement("button", {
|
|
4527
|
+
type: "button",
|
|
4528
|
+
className: "dshRemoteAcpActionBtn",
|
|
4529
|
+
disabled,
|
|
4530
|
+
"aria-label": `${t("modelShareEdit")}: ${group.provider}${entry.grant.deviceId === void 0 ? "" : ` \u2192 ${peerName(entry.grant.deviceId)}`}`,
|
|
4531
|
+
// Edit = prefill the form from this grant and drop the saved
|
|
4532
|
+
// entry; saving the form writes the edited rule back.
|
|
4533
|
+
onClick: () => {
|
|
4534
|
+
setGrantProvider(group.provider), setGrantAllModels(entry.grant.models.length === 0), setGrantModels(entry.grant.models), setGrantAnyDevice(entry.grant.deviceId === void 0), setGrantDevices(entry.grant.deviceId === void 0 ? [] : [entry.grant.deviceId]), removeGrant(entry.index), setEditingGrant(!0);
|
|
4535
|
+
}
|
|
4536
|
+
}, t("modelShareEdit")),
|
|
4512
4537
|
React.createElement("button", {
|
|
4513
4538
|
type: "button",
|
|
4514
4539
|
className: "dshRemoteAcpRemoveBtn",
|
|
4515
4540
|
disabled,
|
|
4516
|
-
"aria-label": t("modelShareRemove")
|
|
4517
|
-
onClick: () => removeGrant(index)
|
|
4541
|
+
"aria-label": `${t("modelShareRemove")}: ${group.provider}${entry.grant.deviceId === void 0 ? "" : ` \u2192 ${peerName(entry.grant.deviceId)}`}`,
|
|
4542
|
+
onClick: () => removeGrant(entry.index)
|
|
4518
4543
|
}, t("modelShareRemove"))
|
|
4519
4544
|
)
|
|
4520
|
-
)
|
|
4545
|
+
))
|
|
4521
4546
|
)),
|
|
4522
4547
|
host.grants.length === 0 ? React.createElement("p", { className: "dshRemoteAcpDiag" }, t("modelShareNoGrants")) : null,
|
|
4523
4548
|
React.createElement(
|
|
@@ -4532,7 +4557,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4532
4557
|
value: grantProvider,
|
|
4533
4558
|
disabled,
|
|
4534
4559
|
"aria-label": t("modelShareProvider"),
|
|
4535
|
-
onChange: (event) =>
|
|
4560
|
+
onChange: (event) => selectGrantProvider(event.target.value)
|
|
4536
4561
|
},
|
|
4537
4562
|
React.createElement("option", { value: "" }, t("modelShareSelectProvider")),
|
|
4538
4563
|
...view.localProviders.map((provider) => React.createElement("option", {
|
|
@@ -4540,38 +4565,88 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4540
4565
|
value: provider.id
|
|
4541
4566
|
}, provider.name ?? provider.id))
|
|
4542
4567
|
),
|
|
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
4568
|
React.createElement("button", {
|
|
4552
4569
|
type: "button",
|
|
4553
4570
|
className: "dshRemoteAcpAddTrigger",
|
|
4554
4571
|
disabled: disabled || grantProvider === "",
|
|
4555
4572
|
onClick: addGrant
|
|
4556
|
-
}, t("modelShareAddGrant"))
|
|
4573
|
+
}, t(editingGrant ? "modelShareSaveEdit" : "modelShareAddGrant")),
|
|
4574
|
+
editingGrant ? React.createElement("button", {
|
|
4575
|
+
type: "button",
|
|
4576
|
+
className: "dshRemoteAcpAddTrigger",
|
|
4577
|
+
disabled,
|
|
4578
|
+
onClick: () => {
|
|
4579
|
+
setGrantProvider(""), setGrantAllModels(!0), setGrantModels([]), setGrantAnyDevice(!0), setGrantDevices([]), setEditingGrant(!1);
|
|
4580
|
+
}
|
|
4581
|
+
}, t("cancelServiceAddressEdit")) : null
|
|
4557
4582
|
),
|
|
4583
|
+
// Collapsible model checkboxes for the selected provider.
|
|
4558
4584
|
React.createElement(
|
|
4559
|
-
"
|
|
4560
|
-
{ className: "
|
|
4561
|
-
|
|
4585
|
+
"details",
|
|
4586
|
+
{ className: "dshRemoteModelSharePicker" },
|
|
4587
|
+
React.createElement("summary", null, modelSummaryLine),
|
|
4562
4588
|
React.createElement(
|
|
4563
|
-
"
|
|
4564
|
-
{
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4589
|
+
"div",
|
|
4590
|
+
{ className: "dshRemoteModelSharePickerList", role: "group", "aria-label": t("modelShareModels") },
|
|
4591
|
+
React.createElement(
|
|
4592
|
+
"label",
|
|
4593
|
+
null,
|
|
4594
|
+
React.createElement("input", {
|
|
4595
|
+
type: "checkbox",
|
|
4596
|
+
checked: grantAllModels,
|
|
4597
|
+
disabled,
|
|
4598
|
+
"aria-label": t("modelShareAllModels"),
|
|
4599
|
+
onChange: (event) => setGrantAllModels(event.target.checked)
|
|
4600
|
+
}),
|
|
4601
|
+
t("modelShareAllModels")
|
|
4602
|
+
),
|
|
4603
|
+
...draftModels.map((model) => React.createElement(
|
|
4604
|
+
"label",
|
|
4605
|
+
{ key: `model-${model.id}` },
|
|
4606
|
+
React.createElement("input", {
|
|
4607
|
+
type: "checkbox",
|
|
4608
|
+
checked: grantModels.includes(model.id),
|
|
4609
|
+
// The all-models checkbox disables individual selection.
|
|
4610
|
+
disabled: disabled || grantAllModels,
|
|
4611
|
+
"aria-label": model.name ?? model.id,
|
|
4612
|
+
onChange: () => toggleGrantModel(model.id)
|
|
4613
|
+
}),
|
|
4614
|
+
model.name ?? model.id
|
|
4615
|
+
))
|
|
4616
|
+
)
|
|
4617
|
+
),
|
|
4618
|
+
// Collapsible multi-device selection; empty means every peer.
|
|
4619
|
+
React.createElement(
|
|
4620
|
+
"details",
|
|
4621
|
+
{ className: "dshRemoteModelSharePicker" },
|
|
4622
|
+
React.createElement("summary", null, deviceSummaryLine),
|
|
4623
|
+
React.createElement(
|
|
4624
|
+
"div",
|
|
4625
|
+
{ className: "dshRemoteModelSharePickerList", role: "group", "aria-label": t("modelShareDevice") },
|
|
4626
|
+
React.createElement(
|
|
4627
|
+
"label",
|
|
4628
|
+
null,
|
|
4629
|
+
React.createElement("input", {
|
|
4630
|
+
type: "checkbox",
|
|
4631
|
+
checked: grantAnyDevice,
|
|
4632
|
+
disabled,
|
|
4633
|
+
"aria-label": t("modelShareAnyDevice"),
|
|
4634
|
+
onChange: (event) => setGrantAnyDevice(event.target.checked)
|
|
4635
|
+
}),
|
|
4636
|
+
t("modelShareAnyDevice")
|
|
4637
|
+
),
|
|
4638
|
+
...view.peers.map((device) => React.createElement(
|
|
4639
|
+
"label",
|
|
4640
|
+
{ key: `device-${device.deviceId}` },
|
|
4641
|
+
React.createElement("input", {
|
|
4642
|
+
type: "checkbox",
|
|
4643
|
+
checked: grantDevices.includes(device.deviceId),
|
|
4644
|
+
disabled: disabled || grantAnyDevice,
|
|
4645
|
+
"aria-label": label(device),
|
|
4646
|
+
onChange: () => toggleGrantDevice(device.deviceId)
|
|
4647
|
+
}),
|
|
4648
|
+
label(device)
|
|
4649
|
+
))
|
|
4575
4650
|
)
|
|
4576
4651
|
)
|
|
4577
4652
|
)
|
|
@@ -4579,7 +4654,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4579
4654
|
"div",
|
|
4580
4655
|
{ className: "dshRemoteAcpList" },
|
|
4581
4656
|
...view.peers.map((device) => {
|
|
4582
|
-
let source = borrower.sources[device.deviceId];
|
|
4657
|
+
let source = borrower.sources[device.deviceId], status = borrowStatus(device.deviceId, source);
|
|
4583
4658
|
return React.createElement(
|
|
4584
4659
|
"div",
|
|
4585
4660
|
{
|
|
@@ -4592,12 +4667,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4592
4667
|
React.createElement(
|
|
4593
4668
|
"div",
|
|
4594
4669
|
{ 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
|
-
)
|
|
4670
|
+
React.createElement("strong", { className: "dshRemoteAcpName" }, label(device))
|
|
4601
4671
|
),
|
|
4602
4672
|
React.createElement("input", {
|
|
4603
4673
|
type: "checkbox",
|
|
@@ -4609,6 +4679,11 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4609
4679
|
"aria-label": `${t("modelShareBorrowFrom")}: ${label(device)}`,
|
|
4610
4680
|
onChange: () => toggleSource(device.deviceId, device.name)
|
|
4611
4681
|
})
|
|
4682
|
+
),
|
|
4683
|
+
status === void 0 ? null : React.createElement(
|
|
4684
|
+
"p",
|
|
4685
|
+
{ className: "dshRemoteAcpDiag" },
|
|
4686
|
+
React.createElement("span", { className: `dshRemoteAcpStatus${status.cls}` }, status.text)
|
|
4612
4687
|
)
|
|
4613
4688
|
);
|
|
4614
4689
|
}),
|
|
@@ -4627,7 +4702,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
4627
4702
|
"div",
|
|
4628
4703
|
{ className: "dshRemoteAcpSummaryText" },
|
|
4629
4704
|
React.createElement("strong", null, t("modelShareLending")),
|
|
4630
|
-
React.createElement("p", null, t("
|
|
4705
|
+
React.createElement("p", null, t("modelShareLendingHint"))
|
|
4631
4706
|
),
|
|
4632
4707
|
React.createElement(
|
|
4633
4708
|
"span",
|
|
@@ -6017,6 +6092,9 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
6017
6092
|
// selectors only add the select / number controls it introduces.
|
|
6018
6093
|
".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}",
|
|
6019
6094
|
".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}}",
|
|
6095
|
+
// [model-sharing] Collapsible checkbox pickers and grant rows inside the
|
|
6096
|
+
// model-share settings section; everything else reuses dshRemoteAcp*.
|
|
6097
|
+
'.dshRemoteModelSharePicker{margin:8px 0 0 8px;font-size:12px;color:var(--dsw-alias-label-tertiary)}.dshRemoteModelSharePicker>summary{display:inline-flex;align-items:center;gap:6px;cursor:pointer;list-style:none;user-select:none;color:var(--dsw-alias-label-secondary);line-height:1.45;overflow-wrap:anywhere}.dshRemoteModelSharePicker>summary::-webkit-details-marker{display:none}.dshRemoteModelSharePicker>summary::before{content:"\u25B8";font-size:10px;transition:transform .15s ease-out}.dshRemoteModelSharePicker[open]>summary::before{transform:rotate(90deg)}.dshRemoteModelSharePicker>summary:hover{color:var(--dsw-alias-label-primary)}.dshRemoteModelSharePickerList{display:flex;flex-direction:column;gap:4px;margin:8px 0 0;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-3);max-height:180px;overflow-y:auto}.dshRemoteModelSharePickerList label{display:flex;align-items:center;gap:8px;min-width:0;font-size:12px;line-height:1.4;color:var(--dsw-alias-label-primary);cursor:pointer;overflow-wrap:anywhere}.dshRemoteModelSharePickerList input[type=checkbox]{flex:0 0 auto;margin:0;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}.dshRemoteModelSharePickerList input[type=checkbox]:disabled{cursor:default;opacity:.5}.dshRemoteModelSharePickerList label:has(input:disabled){color:var(--dsw-alias-label-tertiary)}.dshRemoteModelShareGrantEntry{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:6px 0 0 8px;font-size:12px;line-height:1.45;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dshRemoteModelShareGrantEntry>span{min-width:0}.dshRemoteModelShareGrantEntry .dshRemoteAcpRemoveBtn{flex:0 0 auto}@media(prefers-reduced-motion:reduce){.dshRemoteModelSharePicker>summary::before{transition:none}}',
|
|
6020
6098
|
".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}",
|
|
6021
6099
|
".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)}",
|
|
6022
6100
|
'.dshRemoteHostList{display:flex;flex-direction:column;border-top:1px solid var(--dsw-alias-border-l2);max-height:296px;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}.dshRemoteHostList.isCollapsed{max-height:none;overflow-y:visible}.dshRemoteHostList>button{min-height:58px;flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:16px;text-align:left;border:0;border-bottom:1px solid var(--dsw-alias-border-l2);background:transparent;padding:10px 20px 10px 4px;cursor:pointer}.dshRemoteHostList>button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteHostList>button:disabled{opacity:.5;cursor:default}.dshRemoteHostList>button[aria-current="true"]{background:var(--dsw-alias-interactive-bg-hover)}.dshRemoteHostList>button>span{min-width:0;display:flex;flex-direction:column;gap:3px}.dshRemoteHostList>button strong{font-size:14px;font-weight:500}.dshRemoteHostList small{color:var(--dsw-alias-label-secondary);font-size:12px}',
|
|
@@ -8787,7 +8865,9 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
8787
8865
|
})
|
|
8788
8866
|
}, RemoteWorkspaceAction)), ctx.slots.inject("plugins.row.config", () => ctx.slots.register({
|
|
8789
8867
|
name: "plugins.row.config",
|
|
8790
|
-
key
|
|
8868
|
+
// [model-sharing] The key must match the installed package name; the
|
|
8869
|
+
// host resolves slot ownership by it.
|
|
8870
|
+
key: `${clientModuleId}#ds-harness-remote`,
|
|
8791
8871
|
locale: localeNamespace,
|
|
8792
8872
|
inject: () => ({
|
|
8793
8873
|
control,
|
|
@@ -8798,7 +8878,7 @@ DSH Go \u626B\u7801\u6682\u4E0D\u652F\u6301\u591A\u53F0\u8BBE\u5907\u63A7\u5236\
|
|
|
8798
8878
|
})
|
|
8799
8879
|
}, RemotePluginOptions)), ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
|
|
8800
8880
|
name: "plugins.bundle.config",
|
|
8801
|
-
key:
|
|
8881
|
+
key: clientModuleId,
|
|
8802
8882
|
locale: localeNamespace,
|
|
8803
8883
|
inject: () => ({
|
|
8804
8884
|
control,
|
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.
|
|
75386
|
+
var PLUGIN_VERSION = "0.6.13";
|
|
75387
75387
|
|
|
75388
75388
|
// packages/plugin/src/server-api.ts
|
|
75389
75389
|
var TERMINAL_CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/u;
|
|
@@ -114779,12 +114779,13 @@ var PluginControlRuntime = class {
|
|
|
114779
114779
|
})));
|
|
114780
114780
|
}
|
|
114781
114781
|
async modelShareGet() {
|
|
114782
|
-
const { store, llm } = this.modelShareBinding();
|
|
114782
|
+
const { store, llm, describe: describe3 } = this.modelShareBinding();
|
|
114783
114783
|
const policy = await store.read();
|
|
114784
114784
|
return {
|
|
114785
114785
|
store: policy,
|
|
114786
114786
|
peers: await this.modelSharePeers(policy),
|
|
114787
114787
|
localProviders: await this.modelShareCatalog(llm),
|
|
114788
|
+
borrowerDiagnostics: this.modelShareDiagnostics(describe3),
|
|
114788
114789
|
writable: this.settings !== void 0
|
|
114789
114790
|
};
|
|
114790
114791
|
}
|
|
@@ -114799,9 +114800,23 @@ var PluginControlRuntime = class {
|
|
|
114799
114800
|
store: next,
|
|
114800
114801
|
peers: await this.modelSharePeers(next),
|
|
114801
114802
|
localProviders: await this.modelShareCatalog(binding.llm),
|
|
114803
|
+
borrowerDiagnostics: this.modelShareDiagnostics(binding.describe),
|
|
114802
114804
|
writable: this.settings !== void 0
|
|
114803
114805
|
};
|
|
114804
114806
|
}
|
|
114807
|
+
/** Borrow-side sync diagnostics; defaults keep the view shape stable. */
|
|
114808
|
+
modelShareDiagnostics(describe3) {
|
|
114809
|
+
if (describe3 === void 0) return { syncAvailable: false, sources: [] };
|
|
114810
|
+
try {
|
|
114811
|
+
const described = describe3();
|
|
114812
|
+
return {
|
|
114813
|
+
syncAvailable: described.syncAvailable === true,
|
|
114814
|
+
sources: Array.isArray(described.sources) ? described.sources : []
|
|
114815
|
+
};
|
|
114816
|
+
} catch {
|
|
114817
|
+
return { syncAvailable: false, sources: [] };
|
|
114818
|
+
}
|
|
114819
|
+
}
|
|
114805
114820
|
// [model-sharing] END
|
|
114806
114821
|
currentEditableConfig() {
|
|
114807
114822
|
if (this.settings === void 0) return editableConfig(this.config);
|
|
@@ -126883,6 +126898,7 @@ var RemoteModelAdapter = class extends LlmAdapter {
|
|
|
126883
126898
|
async *stream(options) {
|
|
126884
126899
|
const route = this.resolveRoute(options.model);
|
|
126885
126900
|
if (route === void 0) {
|
|
126901
|
+
this.transport.onStale?.("model-missing");
|
|
126886
126902
|
yield failureChunk("NO_ADAPTER", `The lending Host no longer advertises model "${options.model}".`);
|
|
126887
126903
|
return;
|
|
126888
126904
|
}
|
|
@@ -126899,6 +126915,7 @@ var RemoteModelAdapter = class extends LlmAdapter {
|
|
|
126899
126915
|
...options.reasoningEffort === void 0 ? {} : { reasoningEffort: options.reasoningEffort }
|
|
126900
126916
|
});
|
|
126901
126917
|
} catch (error62) {
|
|
126918
|
+
this.transport.onStale?.("model-missing");
|
|
126902
126919
|
yield failureChunk(
|
|
126903
126920
|
"NO_ADAPTER",
|
|
126904
126921
|
error62 instanceof Error ? `The lending Host rejected the request: ${error62.message}` : "The lending Host rejected the request."
|
|
@@ -126924,6 +126941,7 @@ var RemoteModelAdapter = class extends LlmAdapter {
|
|
|
126924
126941
|
try {
|
|
126925
126942
|
batch = await this.transport.drain(streamId, 2e4);
|
|
126926
126943
|
} catch (error62) {
|
|
126944
|
+
this.transport.onStale?.("connection-failed");
|
|
126927
126945
|
yield failureChunk(
|
|
126928
126946
|
"HTTP_502",
|
|
126929
126947
|
error62 instanceof Error ? `The lending Host connection failed: ${error62.message}` : "The lending Host connection failed."
|
|
@@ -126961,6 +126979,8 @@ var BorrowerRuntime = class {
|
|
|
126961
126979
|
this.logger = logger2;
|
|
126962
126980
|
}
|
|
126963
126981
|
registered = /* @__PURE__ */ new Map();
|
|
126982
|
+
/** Last sync outcome per Host, for the settings status line. */
|
|
126983
|
+
states = /* @__PURE__ */ new Map();
|
|
126964
126984
|
closed = false;
|
|
126965
126985
|
/**
|
|
126966
126986
|
* Refresh one Host: ask what it lends, apply this machine's own selection,
|
|
@@ -126974,6 +126994,7 @@ var BorrowerRuntime = class {
|
|
|
126974
126994
|
const { borrower } = await this.store.read();
|
|
126975
126995
|
const source = borrower.sources[hostId];
|
|
126976
126996
|
if (source === void 0 || !source.enabled) {
|
|
126997
|
+
this.states.set(hostId, { outcome: "disabled" });
|
|
126977
126998
|
this.unregister(hostId);
|
|
126978
126999
|
return;
|
|
126979
127000
|
}
|
|
@@ -126981,6 +127002,7 @@ var BorrowerRuntime = class {
|
|
|
126981
127002
|
try {
|
|
126982
127003
|
const listed = await transport.list();
|
|
126983
127004
|
if (!listed.enabled) {
|
|
127005
|
+
this.states.set(hostId, { outcome: "host-disabled" });
|
|
126984
127006
|
this.unregister(hostId);
|
|
126985
127007
|
return;
|
|
126986
127008
|
}
|
|
@@ -126990,6 +127012,7 @@ var BorrowerRuntime = class {
|
|
|
126990
127012
|
hostId,
|
|
126991
127013
|
reason: error62 instanceof Error ? error62.name : "unknown"
|
|
126992
127014
|
});
|
|
127015
|
+
this.states.set(hostId, { outcome: "failed", error: error62 instanceof Error ? error62.message : String(error62) });
|
|
126993
127016
|
this.unregister(hostId);
|
|
126994
127017
|
return;
|
|
126995
127018
|
}
|
|
@@ -127016,11 +127039,13 @@ var BorrowerRuntime = class {
|
|
|
127016
127039
|
const source = borrower.sources[hostId];
|
|
127017
127040
|
const providerId = providerIdForHost(hostId);
|
|
127018
127041
|
if (source === void 0 || !source.enabled) {
|
|
127042
|
+
this.states.set(hostId, { outcome: "disabled" });
|
|
127019
127043
|
this.unregister(hostId);
|
|
127020
127044
|
return;
|
|
127021
127045
|
}
|
|
127022
127046
|
const selected = source.models.length === 0 ? models : models.filter((entry) => source.models.includes(entry.id));
|
|
127023
127047
|
if (selected.length === 0) {
|
|
127048
|
+
this.states.set(hostId, { outcome: "no-models" });
|
|
127024
127049
|
this.unregister(hostId);
|
|
127025
127050
|
return;
|
|
127026
127051
|
}
|
|
@@ -127028,6 +127053,7 @@ var BorrowerRuntime = class {
|
|
|
127028
127053
|
if (existing !== void 0) {
|
|
127029
127054
|
existing.holder.models = [...selected];
|
|
127030
127055
|
existing.models = existing.holder.models;
|
|
127056
|
+
this.states.set(hostId, { outcome: "registered" });
|
|
127031
127057
|
return;
|
|
127032
127058
|
}
|
|
127033
127059
|
const holder = { models: [...selected] };
|
|
@@ -127045,6 +127071,7 @@ var BorrowerRuntime = class {
|
|
|
127045
127071
|
try {
|
|
127046
127072
|
const handle = this.llm.registerAdapter([providerId], adapter);
|
|
127047
127073
|
this.registered.set(hostId, { handle, models: holder.models, holder });
|
|
127074
|
+
this.states.set(hostId, { outcome: "registered" });
|
|
127048
127075
|
this.logger?.info("model-share: borrower provider registered", {
|
|
127049
127076
|
hostId,
|
|
127050
127077
|
providerId,
|
|
@@ -127056,6 +127083,10 @@ var BorrowerRuntime = class {
|
|
|
127056
127083
|
providerId,
|
|
127057
127084
|
reason: error62 instanceof Error ? error62.message : "unknown"
|
|
127058
127085
|
});
|
|
127086
|
+
this.states.set(hostId, {
|
|
127087
|
+
outcome: "failed",
|
|
127088
|
+
error: error62 instanceof Error ? error62.message : String(error62)
|
|
127089
|
+
});
|
|
127059
127090
|
}
|
|
127060
127091
|
}
|
|
127061
127092
|
/** Withdraw one Host's provider. Safe to call when nothing is registered. */
|
|
@@ -127072,12 +127103,33 @@ var BorrowerRuntime = class {
|
|
|
127072
127103
|
/** Withdraw everything; used on plugin unload. */
|
|
127073
127104
|
close() {
|
|
127074
127105
|
this.closed = true;
|
|
127106
|
+
this.states.clear();
|
|
127075
127107
|
for (const hostId of [...this.registered.keys()]) this.unregister(hostId);
|
|
127076
127108
|
}
|
|
127077
127109
|
/** Hosts currently exposed in the local selector. */
|
|
127078
127110
|
activeHosts() {
|
|
127079
127111
|
return [...this.registered.keys()];
|
|
127080
127112
|
}
|
|
127113
|
+
/**
|
|
127114
|
+
* Diagnostic snapshot for the settings UI: one entry per Host this runtime
|
|
127115
|
+
* has observed, covering both the latest sync outcome and what is currently
|
|
127116
|
+
* registered. Never throws; used read-only by `modelshare.get`.
|
|
127117
|
+
*/
|
|
127118
|
+
describeBorrower() {
|
|
127119
|
+
const hostIds = /* @__PURE__ */ new Set([...this.registered.keys(), ...this.states.keys()]);
|
|
127120
|
+
return [...hostIds].map((hostId) => {
|
|
127121
|
+
const existing = this.registered.get(hostId);
|
|
127122
|
+
const state2 = this.states.get(hostId);
|
|
127123
|
+
const outcome = state2?.outcome ?? (existing !== void 0 ? "registered" : "disabled");
|
|
127124
|
+
return {
|
|
127125
|
+
hostId,
|
|
127126
|
+
registered: existing !== void 0,
|
|
127127
|
+
modelCount: existing?.models.length ?? 0,
|
|
127128
|
+
outcome,
|
|
127129
|
+
...state2?.error === void 0 ? {} : { error: state2.error }
|
|
127130
|
+
};
|
|
127131
|
+
});
|
|
127132
|
+
}
|
|
127081
127133
|
};
|
|
127082
127134
|
|
|
127083
127135
|
// packages/plugin/src/model-share/policy.ts
|
|
@@ -128275,7 +128327,7 @@ var AcpGateway = class {
|
|
|
128275
128327
|
};
|
|
128276
128328
|
|
|
128277
128329
|
// packages/plugin/src/index.ts
|
|
128278
|
-
var name = "ds-harness-remote";
|
|
128330
|
+
var name = "@musdrop/ds-harness-remote";
|
|
128279
128331
|
var legacyLoaderModuleNames = /* @__PURE__ */ new Set(["@dsh-remote/plugin"]);
|
|
128280
128332
|
var pluginSettingsNamespace = "ds-harness-remote";
|
|
128281
128333
|
var DEFAULT_ENTRY_ID = "ds-harness-remote";
|
|
@@ -128458,6 +128510,7 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
|
|
|
128458
128510
|
let controlRuntime;
|
|
128459
128511
|
const modelShareBorrowers = [];
|
|
128460
128512
|
let borrowerSync;
|
|
128513
|
+
let borrowerSyncOnStale;
|
|
128461
128514
|
let modelShareStore;
|
|
128462
128515
|
try {
|
|
128463
128516
|
const nativeTypertGateway = ctx.get("typertGateway");
|
|
@@ -128554,20 +128607,41 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
|
|
|
128554
128607
|
const borrower = new BorrowerRuntime(llmRegistry, activeStore, logger2);
|
|
128555
128608
|
modelShareBorrowers.push(borrower);
|
|
128556
128609
|
const clientRuntimeForSync = nextClientRuntime;
|
|
128610
|
+
const SYNC_OK_MS = 6e4;
|
|
128611
|
+
const SYNC_RETRY_MS = 15e3;
|
|
128612
|
+
const lastSyncAt = /* @__PURE__ */ new Map();
|
|
128613
|
+
const lastSyncOk = /* @__PURE__ */ new Map();
|
|
128557
128614
|
const syncBorrowed = async () => {
|
|
128558
128615
|
if (closed) return;
|
|
128559
128616
|
const { borrower: policy } = await activeStore.read();
|
|
128560
128617
|
for (const hostId of borrower.activeHosts()) {
|
|
128561
|
-
if (policy.sources[hostId]?.enabled !== true)
|
|
128618
|
+
if (policy.sources[hostId]?.enabled !== true) {
|
|
128619
|
+
borrower.unregister(hostId);
|
|
128620
|
+
lastSyncAt.delete(hostId);
|
|
128621
|
+
lastSyncOk.delete(hostId);
|
|
128622
|
+
}
|
|
128562
128623
|
}
|
|
128624
|
+
const now = Date.now();
|
|
128563
128625
|
for (const [hostId, source] of Object.entries(policy.sources)) {
|
|
128564
128626
|
if (!source.enabled) continue;
|
|
128627
|
+
const elapsed = now - (lastSyncAt.get(hostId) ?? 0);
|
|
128628
|
+
if (elapsed < (lastSyncOk.get(hostId) === false ? SYNC_RETRY_MS : SYNC_OK_MS)) continue;
|
|
128629
|
+
lastSyncAt.set(hostId, now);
|
|
128565
128630
|
const deviceName = source.hostName ?? hostId;
|
|
128566
128631
|
const transport = clientRuntimeForSync.createModelShareTransport(hostId, deviceName);
|
|
128632
|
+
const before = borrower.activeHosts().includes(hostId);
|
|
128567
128633
|
await borrower.refresh(hostId, deviceName, {
|
|
128568
128634
|
...transport,
|
|
128569
|
-
list: () => clientRuntimeForSync.listSharedModels(hostId)
|
|
128570
|
-
|
|
128635
|
+
list: () => clientRuntimeForSync.listSharedModels(hostId),
|
|
128636
|
+
onStale: (reason) => {
|
|
128637
|
+
logger2.info("model-share: stale catalog detected", { hostId, reason });
|
|
128638
|
+
borrowerSyncOnStale?.(hostId);
|
|
128639
|
+
}
|
|
128640
|
+
}).then(() => {
|
|
128641
|
+
lastSyncOk.set(hostId, borrower.activeHosts().includes(hostId) || before);
|
|
128642
|
+
}).catch(() => {
|
|
128643
|
+
lastSyncOk.set(hostId, false);
|
|
128644
|
+
});
|
|
128571
128645
|
}
|
|
128572
128646
|
};
|
|
128573
128647
|
void syncBorrowed();
|
|
@@ -128575,6 +128649,23 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
|
|
|
128575
128649
|
activeStore.watch(() => {
|
|
128576
128650
|
void syncBorrowed();
|
|
128577
128651
|
});
|
|
128652
|
+
const syncTimer = setInterval(() => {
|
|
128653
|
+
void syncBorrowed();
|
|
128654
|
+
}, SYNC_OK_MS);
|
|
128655
|
+
syncTimer.unref?.();
|
|
128656
|
+
const previousDispose = borrower.close.bind(borrower);
|
|
128657
|
+
borrower.close = () => {
|
|
128658
|
+
clearInterval(syncTimer);
|
|
128659
|
+
previousDispose();
|
|
128660
|
+
};
|
|
128661
|
+
const staleHosts = /* @__PURE__ */ new Set();
|
|
128662
|
+
borrowerSyncOnStale = (hostId) => {
|
|
128663
|
+
if (staleHosts.has(hostId)) return;
|
|
128664
|
+
staleHosts.add(hostId);
|
|
128665
|
+
lastSyncAt.set(hostId, 0);
|
|
128666
|
+
lastSyncOk.set(hostId, false);
|
|
128667
|
+
void syncBorrowed().finally(() => staleHosts.delete(hostId));
|
|
128668
|
+
};
|
|
128578
128669
|
}
|
|
128579
128670
|
return { runtime: nextRuntime, clientRuntime: nextClientRuntime };
|
|
128580
128671
|
};
|
|
@@ -128649,10 +128740,18 @@ async function activate(ctx, readConfig, entryId, requireRemoteEvents = false) {
|
|
|
128649
128740
|
logStore,
|
|
128650
128741
|
// [model-sharing] Lazy binding so server switches recreate the store
|
|
128651
128742
|
// and the borrower providers can be resynced after a policy edit.
|
|
128743
|
+
// `describe` reports per-source borrow diagnostics: without a client
|
|
128744
|
+
// runtime the sync can never run, which the settings UI must surface.
|
|
128652
128745
|
() => modelShareStore === void 0 ? void 0 : {
|
|
128653
128746
|
store: modelShareStore,
|
|
128654
128747
|
llm: ctx.get("llm", false),
|
|
128655
|
-
resync: () => borrowerSync?.() ?? Promise.resolve()
|
|
128748
|
+
resync: () => borrowerSync?.() ?? Promise.resolve(),
|
|
128749
|
+
describe: () => ({
|
|
128750
|
+
// A ClientModeRuntime is the prerequisite for the borrower sync
|
|
128751
|
+
// transport; without it borrowed models can never appear.
|
|
128752
|
+
syncAvailable: clientRuntime !== void 0,
|
|
128753
|
+
sources: modelShareBorrowers.flatMap((borrower) => borrower.describeBorrower())
|
|
128754
|
+
})
|
|
128656
128755
|
}
|
|
128657
128756
|
);
|
|
128658
128757
|
if (initialStorageError !== void 0) {
|
package/dsh-plugin.json
CHANGED
package/locale/README.en.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
> [!IMPORTANT]
|
|
2
|
+
> ## This is a fork, not the original
|
|
3
|
+
>
|
|
4
|
+
> This plugin (`@musdrop/ds-harness-remote`) is a fork of [`liguobao/ds-harness-remote`](https://github.com/liguobao/ds-harness-remote) adding **cross-device model lending/borrowing** on top of everything below:
|
|
5
|
+
>
|
|
6
|
+
> - **Lend**: share this machine's configured models with other devices. Requests are re-driven locally with this machine's own credentials — the borrower never sees any secret, but every call spends this machine's quota.
|
|
7
|
+
> - **Borrow**: use models another device lends; they appear in the local model picker under that device's **name** as the provider.
|
|
8
|
+
> - **Two-sided grants**: the lender picks providers/devices and models; the borrower opts in per device. Only models allowed on both sides show up.
|
|
9
|
+
> - Configuration lives in this plugin's detail page, in the new **"Model sharing" section**.
|
|
10
|
+
>
|
|
11
|
+
> **⚠️ Not coinstallable with the original**: the plugin shares the original's id (`com.r2049.ds-harness-remote`), so a profile can hold only one of the two. The shared id also means this fork **replaces** the original seamlessly — existing Remote configuration and sign-in carry over. Model-sharing policy is stored in a separate `model-share.json`.
|
|
12
|
+
>
|
|
13
|
+
> The original feature tour follows.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# DS Harness Remote
|
|
2
18
|
|
|
3
19
|
[Website](https://dsh.r2049.cn/) · [Web client](https://dsh.r2049.cn/app) · [iOS beta](https://github.com/liguobao/ds-harness-remote/issues/20) · [Android download](https://github.com/liguobao/ds-harness-remote/releases/latest)
|
package/locale/README.ja.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
> [!IMPORTANT]
|
|
2
|
+
> ## これはフォーク版です(原版ではありません)
|
|
3
|
+
>
|
|
4
|
+
> 本プラグイン(`@musdrop/ds-harness-remote`)は [`liguobao/ds-harness-remote`](https://github.com/liguobao/ds-harness-remote) のフォークで、既存の全機能に加えて**デバイス間モデル貸借**を追加しています:
|
|
5
|
+
>
|
|
6
|
+
> - **貸出(Lend)**:このマシンが設定済みのモデルを他デバイスに貸し出します。リクエストはこのマシンが自身の資格情報で代行し、相手に秘密情報は渡りませんが、消費されるのはこのマシンのクォータです。
|
|
7
|
+
> - **借用(Borrow)**:他デバイスが貸し出したモデルを利用でき、選択器には相手の**デバイス名**をプロバイダーとして表示されます。
|
|
8
|
+
> - **双方向の許可**:貸し手はプロバイダー/デバイス/モデルを指定し、借り手はデバイスごとに有効化します。双方が許可したモデルのみ表示されます。
|
|
9
|
+
> - 設定は本プラグインの詳細ページにある**「モデル共有」セクション**で行います。
|
|
10
|
+
>
|
|
11
|
+
> **⚠️ 原版との併用不可**:原版 `ds-harness-remote` と同じプラグイン ID を持つため、同一 profile にはどちらか一方のみ。同 ID であるため、このフォークは原版をシームレスに**置き換え**でき、既存の Remote 設定とサインイン状態はそのまま引き継がれます。
|
|
12
|
+
>
|
|
13
|
+
> 以下は原版の機能紹介です。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# DS Harness Remote
|
|
2
18
|
|
|
3
19
|
[公式サイト](https://dsh.r2049.cn/) · [Web クライアント](https://dsh.r2049.cn/app) · [iOS ベータ](https://github.com/liguobao/ds-harness-remote/issues/20) · [Android ダウンロード](https://github.com/liguobao/ds-harness-remote/releases/latest)
|
package/locale/README.ru.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
> [!IMPORTANT]
|
|
2
|
+
> ## Это форк, а не оригинал
|
|
3
|
+
>
|
|
4
|
+
> Этот плагин (`@musdrop/ds-harness-remote`) — форк [`liguobao/ds-harness-remote`](https://github.com/liguobao/ds-harness-remote), добавляющий **предоставление и заимствование моделей между устройствами** поверх всех функций ниже:
|
|
5
|
+
>
|
|
6
|
+
> - **Предоставление**: этот компьютер отдаёт свои настроенные модели другим устройствам. Запросы выполняются локально с собственными учётными данными — заёмщик не видит секретов, но расходуется квота этого компьютера.
|
|
7
|
+
> - **Заимствование**: модели, предоставленные другими устройствами, появляются в локальном выборе моделей под **именем устройства** как провайдером.
|
|
8
|
+
> - **Двусторонние правила**: владелец задаёт провайдеров/устройства и модели, заёмщик включают по устройствам. Показываются только модели, разрешённые с обеих сторон.
|
|
9
|
+
> - Настройки — в карточке этого плагина, в новом разделе **«Обмен моделями»**.
|
|
10
|
+
>
|
|
11
|
+
> **⚠️ Нельзя устанавливать вместе с оригиналом**: у плагина тот же идентификатор, что у `ds-harness-remote`, поэтому в профиле может стоять только один из них. Общий идентификатор также означает, что форк **заменяет** оригинал без потерь — существующие настройки Remote и вход в аккаунт сохраняются.
|
|
12
|
+
>
|
|
13
|
+
> Ниже — описание оригинальных функций.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# DS Harness Remote
|
|
2
18
|
|
|
3
19
|
[Сайт](https://dsh.r2049.cn/) · [Веб-клиент](https://dsh.r2049.cn/app) · [Бета для iOS](https://github.com/liguobao/ds-harness-remote/issues/20) · [Скачать для Android](https://github.com/liguobao/ds-harness-remote/releases/latest)
|
package/locale/README.uk.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
> [!IMPORTANT]
|
|
2
|
+
> ## Це форк, а не оригінал
|
|
3
|
+
>
|
|
4
|
+
> Цей плагін (`@musdrop/ds-harness-remote`) — форк [`liguobao/ds-harness-remote`](https://github.com/liguobao/ds-harness-remote), що додає **надання та позичання моделей між пристроями** поверх усіх функцій нижче:
|
|
5
|
+
>
|
|
6
|
+
> - **Надання**: цей комп'ютер віддає свої налаштовані моделі іншим пристроям. Запити виконуються локально з власними обліковими даними — позичальник не бачить секретів, але витрачається квота цього комп'ютера.
|
|
7
|
+
> - **Позичання**: моделі, надані іншими пристроями, з'являються в локальному виборі моделей під **іменем пристрою** як провайдером.
|
|
8
|
+
> - **Двосторонні правила**: власник задає провайдерів/пристрої та моделі, позичальник вмикає за пристроями. Показуються лише моделі, дозволені з обох боків.
|
|
9
|
+
> - Налаштування — в картці цього плагіна, в новому розділі **«Модельний обмін»**.
|
|
10
|
+
>
|
|
11
|
+
> **⚠️ Не можна встановлювати разом з оригіналом**: у плагіна той самий ідентифікатор, що й у `ds-harness-remote`, тож у профілі може бути лише один з них. Спільний ідентифікатор також означає, що форк **замінює** оригінал без втрат — наявні налаштування Remote та вхід в акаунт зберігаються.
|
|
12
|
+
>
|
|
13
|
+
> Нижче — опис оригінальних функцій.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# DS Harness Remote
|
|
2
18
|
|
|
3
19
|
[Сайт](https://dsh.r2049.cn/) · [Вебклієнт](https://dsh.r2049.cn/app) · [Бета для iOS](https://github.com/liguobao/ds-harness-remote/issues/20) · [Завантажити для Android](https://github.com/liguobao/ds-harness-remote/releases/latest)
|
package/locale/README.zh.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
> [!IMPORTANT]
|
|
2
|
+
> ## 这是一个 fork,不是原版
|
|
3
|
+
>
|
|
4
|
+
> 本插件(`@musdrop/ds-harness-remote`)是 [`liguobao/ds-harness-remote`](https://github.com/liguobao/ds-harness-remote) 的 fork,在原有全部功能之上新增了**跨设备模型借出/借用**:
|
|
5
|
+
>
|
|
6
|
+
> - **借出**:把本机已配置的模型借给其它设备。请求由本机代发、使用本机自己的凭据——对方拿不到任何密钥,但每次调用消耗的是本机账号的额度。
|
|
7
|
+
> - **借用**:借用其它设备借出的模型,借到的模型以对方**设备名**作为提供商出现在本机模型选择器中。
|
|
8
|
+
> - **双向授权**:借出方按提供商/设备配置允许借出的模型,借用方按设备决定是否启用;两边都同意的模型才会出现。
|
|
9
|
+
> - 配置入口:本插件详情页下方新增的**「模型共享」区块**。
|
|
10
|
+
>
|
|
11
|
+
> **⚠️ 与原版不能同时安装**:本插件与原版 `ds-harness-remote` 使用相同插件 ID,同一 profile 只能装其一。同 ID 也意味着本插件可直接**替换**原版,原有 Remote 配置与登录状态无缝继承。模型共享的授权配置存在独立的 `model-share.json`,不影响原版配置字段。
|
|
12
|
+
>
|
|
13
|
+
> 以下为原版功能介绍。
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
1
17
|
# DS Harness Remote
|
|
2
18
|
|
|
3
19
|
[官方网站](https://dsh.r2049.cn/) · [Web 客户端](https://dsh.r2049.cn/app) · [iOS 内测](https://github.com/liguobao/ds-harness-remote/issues/20) · [Android 下载](https://github.com/liguobao/ds-harness-remote/releases/latest)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@musdrop/ds-harness-remote",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13",
|
|
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",
|